\n * @memberOf punycode\n * @type Object\n */\n 'ucs2': {\n 'decode': ucs2decode,\n 'encode': ucs2encode\n },\n 'decode': decode,\n 'encode': encode,\n 'toASCII': toASCII,\n 'toUnicode': toUnicode\n };\n /** Expose `punycode` */\n // Some AMD build optimizers, like r.js, check for specific condition patterns\n // like the following:\n\n if (true) {\n !(__WEBPACK_AMD_DEFINE_RESULT__ = function () {\n return punycode;\n }.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (freeExports && freeModule) {\n if (module.exports == freeExports) {\n // in Node.js, io.js, or RingoJS v0.8.0+\n freeModule.exports = punycode;\n } else {\n // in Narwhal or RingoJS v0.7.0-\n for (key in punycode) {\n punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]);\n }\n }\n } else {\n // in Rhino or a web browser\n root.punycode = punycode;\n }\n })(this);\n /* WEBPACK VAR INJECTION */\n\n }).call(exports, __webpack_require__(39)(module), __webpack_require__(7));\n /***/\n },\n /* 36 */\n\n /***/\n function (module, exports) {\n if (typeof Object.create === 'function') {\n // implementation from standard node.js 'util' module\n module.exports = function inherits(ctor, superCtor) {\n ctor.super_ = superCtor;\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n };\n } else {\n // old school shim for old browsers\n module.exports = function inherits(ctor, superCtor) {\n ctor.super_ = superCtor;\n\n var TempCtor = function TempCtor() {};\n\n TempCtor.prototype = superCtor.prototype;\n ctor.prototype = new TempCtor();\n ctor.prototype.constructor = ctor;\n };\n }\n /***/\n\n },\n /* 37 */\n\n /***/\n function (module, exports) {\n module.exports = function isBuffer(arg) {\n return arg && _typeof2(arg) === 'object' && typeof arg.copy === 'function' && typeof arg.fill === 'function' && typeof arg.readUInt8 === 'function';\n };\n /***/\n\n },\n /* 38 */\n\n /***/\n function (module, exports, __webpack_require__) {\n /* WEBPACK VAR INJECTION */\n (function (global, process) {\n // Copyright Joyent, Inc. and other Node contributors.\n //\n // Permission is hereby granted, free of charge, to any person obtaining a\n // copy of this software and associated documentation files (the\n // \"Software\"), to deal in the Software without restriction, including\n // without limitation the rights to use, copy, modify, merge, publish,\n // distribute, sublicense, and/or sell copies of the Software, and to permit\n // persons to whom the Software is furnished to do so, subject to the\n // following conditions:\n //\n // The above copyright notice and this permission notice shall be included\n // in all copies or substantial portions of the Software.\n //\n // THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n // USE OR OTHER DEALINGS IN THE SOFTWARE.\n var formatRegExp = /%[sdj%]/g;\n\n exports.format = function (f) {\n if (!isString(f)) {\n var objects = [];\n\n for (var i = 0; i < arguments.length; i++) {\n objects.push(inspect(arguments[i]));\n }\n\n return objects.join(' ');\n }\n\n var i = 1;\n var args = arguments;\n var len = args.length;\n var str = String(f).replace(formatRegExp, function (x) {\n if (x === '%%') return '%';\n if (i >= len) return x;\n\n switch (x) {\n case '%s':\n return String(args[i++]);\n\n case '%d':\n return Number(args[i++]);\n\n case '%j':\n try {\n return JSON.stringify(args[i++]);\n } catch (_) {\n return '[Circular]';\n }\n\n default:\n return x;\n }\n });\n\n for (var x = args[i]; i < len; x = args[++i]) {\n if (isNull(x) || !isObject(x)) {\n str += ' ' + x;\n } else {\n str += ' ' + inspect(x);\n }\n }\n\n return str;\n }; // Mark that a method should not be used.\n // Returns a modified function which warns once by default.\n // If --no-deprecation is set, then it is a no-op.\n\n\n exports.deprecate = function (fn, msg) {\n // Allow for deprecating things in the process of starting up.\n if (isUndefined(global.process)) {\n return function () {\n return exports.deprecate(fn, msg).apply(this, arguments);\n };\n }\n\n if (process.noDeprecation === true) {\n return fn;\n }\n\n var warned = false;\n\n function deprecated() {\n if (!warned) {\n if (process.throwDeprecation) {\n throw new Error(msg);\n } else if (process.traceDeprecation) {\n console.trace(msg);\n } else {\n console.error(msg);\n }\n\n warned = true;\n }\n\n return fn.apply(this, arguments);\n }\n\n return deprecated;\n };\n\n var debugs = {};\n var debugEnviron;\n\n exports.debuglog = function (set) {\n if (isUndefined(debugEnviron)) debugEnviron = process.env.NODE_DEBUG || '';\n set = set.toUpperCase();\n\n if (!debugs[set]) {\n if (new RegExp('\\\\b' + set + '\\\\b', 'i').test(debugEnviron)) {\n var pid = process.pid;\n\n debugs[set] = function () {\n var msg = exports.format.apply(exports, arguments);\n console.error('%s %d: %s', set, pid, msg);\n };\n } else {\n debugs[set] = function () {};\n }\n }\n\n return debugs[set];\n };\n /**\n * Echos the value of a value. Trys to print the value out\n * in the best way possible given the different types.\n *\n * @param {Object} obj The object to print out.\n * @param {Object} opts Optional options object that alters the output.\n */\n\n /* legacy: obj, showHidden, depth, colors*/\n\n\n function inspect(obj, opts) {\n // default options\n var ctx = {\n seen: [],\n stylize: stylizeNoColor\n }; // legacy...\n\n if (arguments.length >= 3) ctx.depth = arguments[2];\n if (arguments.length >= 4) ctx.colors = arguments[3];\n\n if (isBoolean(opts)) {\n // legacy...\n ctx.showHidden = opts;\n } else if (opts) {\n // got an \"options\" object\n exports._extend(ctx, opts);\n } // set default options\n\n\n if (isUndefined(ctx.showHidden)) ctx.showHidden = false;\n if (isUndefined(ctx.depth)) ctx.depth = 2;\n if (isUndefined(ctx.colors)) ctx.colors = false;\n if (isUndefined(ctx.customInspect)) ctx.customInspect = true;\n if (ctx.colors) ctx.stylize = stylizeWithColor;\n return formatValue(ctx, obj, ctx.depth);\n }\n\n exports.inspect = inspect; // http://en.wikipedia.org/wiki/ANSI_escape_code#graphics\n\n inspect.colors = {\n 'bold': [1, 22],\n 'italic': [3, 23],\n 'underline': [4, 24],\n 'inverse': [7, 27],\n 'white': [37, 39],\n 'grey': [90, 39],\n 'black': [30, 39],\n 'blue': [34, 39],\n 'cyan': [36, 39],\n 'green': [32, 39],\n 'magenta': [35, 39],\n 'red': [31, 39],\n 'yellow': [33, 39]\n }; // Don't use 'blue' not visible on cmd.exe\n\n inspect.styles = {\n 'special': 'cyan',\n 'number': 'yellow',\n 'boolean': 'yellow',\n 'undefined': 'grey',\n 'null': 'bold',\n 'string': 'green',\n 'date': 'magenta',\n // \"name\": intentionally not styling\n 'regexp': 'red'\n };\n\n function stylizeWithColor(str, styleType) {\n var style = inspect.styles[styleType];\n\n if (style) {\n return \"\\x1B[\" + inspect.colors[style][0] + 'm' + str + \"\\x1B[\" + inspect.colors[style][1] + 'm';\n } else {\n return str;\n }\n }\n\n function stylizeNoColor(str, styleType) {\n return str;\n }\n\n function arrayToHash(array) {\n var hash = {};\n array.forEach(function (val, idx) {\n hash[val] = true;\n });\n return hash;\n }\n\n function formatValue(ctx, value, recurseTimes) {\n // Provide a hook for user-specified inspect functions.\n // Check that value is an object with an inspect function on it\n if (ctx.customInspect && value && isFunction(value.inspect) && // Filter out the util module, it's inspect function is special\n value.inspect !== exports.inspect && // Also filter out any prototype objects using the circular check.\n !(value.constructor && value.constructor.prototype === value)) {\n var ret = value.inspect(recurseTimes, ctx);\n\n if (!isString(ret)) {\n ret = formatValue(ctx, ret, recurseTimes);\n }\n\n return ret;\n } // Primitive types cannot have properties\n\n\n var primitive = formatPrimitive(ctx, value);\n\n if (primitive) {\n return primitive;\n } // Look up the keys of the object.\n\n\n var keys = Object.keys(value);\n var visibleKeys = arrayToHash(keys);\n\n if (ctx.showHidden) {\n keys = Object.getOwnPropertyNames(value);\n } // IE doesn't make error fields non-enumerable\n // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx\n\n\n if (isError(value) && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {\n return formatError(value);\n } // Some type of object without properties can be shortcutted.\n\n\n if (keys.length === 0) {\n if (isFunction(value)) {\n var name = value.name ? ': ' + value.name : '';\n return ctx.stylize('[Function' + name + ']', 'special');\n }\n\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n }\n\n if (isDate(value)) {\n return ctx.stylize(Date.prototype.toString.call(value), 'date');\n }\n\n if (isError(value)) {\n return formatError(value);\n }\n }\n\n var base = '',\n array = false,\n braces = ['{', '}']; // Make Array say that they are Array\n\n if (isArray(value)) {\n array = true;\n braces = ['[', ']'];\n } // Make functions say that they are functions\n\n\n if (isFunction(value)) {\n var n = value.name ? ': ' + value.name : '';\n base = ' [Function' + n + ']';\n } // Make RegExps say that they are RegExps\n\n\n if (isRegExp(value)) {\n base = ' ' + RegExp.prototype.toString.call(value);\n } // Make dates with properties first say the date\n\n\n if (isDate(value)) {\n base = ' ' + Date.prototype.toUTCString.call(value);\n } // Make error with message first say the error\n\n\n if (isError(value)) {\n base = ' ' + formatError(value);\n }\n\n if (keys.length === 0 && (!array || value.length == 0)) {\n return braces[0] + base + braces[1];\n }\n\n if (recurseTimes < 0) {\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n } else {\n return ctx.stylize('[Object]', 'special');\n }\n }\n\n ctx.seen.push(value);\n var output;\n\n if (array) {\n output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);\n } else {\n output = keys.map(function (key) {\n return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);\n });\n }\n\n ctx.seen.pop();\n return reduceToSingleString(output, base, braces);\n }\n\n function formatPrimitive(ctx, value) {\n if (isUndefined(value)) return ctx.stylize('undefined', 'undefined');\n\n if (isString(value)) {\n var simple = '\\'' + JSON.stringify(value).replace(/^\"|\"$/g, '').replace(/'/g, \"\\\\'\").replace(/\\\\\"/g, '\"') + '\\'';\n return ctx.stylize(simple, 'string');\n }\n\n if (isNumber(value)) return ctx.stylize('' + value, 'number');\n if (isBoolean(value)) return ctx.stylize('' + value, 'boolean'); // For some reason typeof null is \"object\", so special case here.\n\n if (isNull(value)) return ctx.stylize('null', 'null');\n }\n\n function formatError(value) {\n return '[' + Error.prototype.toString.call(value) + ']';\n }\n\n function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {\n var output = [];\n\n for (var i = 0, l = value.length; i < l; ++i) {\n if (hasOwnProperty(value, String(i))) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, String(i), true));\n } else {\n output.push('');\n }\n }\n\n keys.forEach(function (key) {\n if (!key.match(/^\\d+$/)) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, key, true));\n }\n });\n return output;\n }\n\n function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {\n var name, str, desc;\n desc = Object.getOwnPropertyDescriptor(value, key) || {\n value: value[key]\n };\n\n if (desc.get) {\n if (desc.set) {\n str = ctx.stylize('[Getter/Setter]', 'special');\n } else {\n str = ctx.stylize('[Getter]', 'special');\n }\n } else {\n if (desc.set) {\n str = ctx.stylize('[Setter]', 'special');\n }\n }\n\n if (!hasOwnProperty(visibleKeys, key)) {\n name = '[' + key + ']';\n }\n\n if (!str) {\n if (ctx.seen.indexOf(desc.value) < 0) {\n if (isNull(recurseTimes)) {\n str = formatValue(ctx, desc.value, null);\n } else {\n str = formatValue(ctx, desc.value, recurseTimes - 1);\n }\n\n if (str.indexOf('\\n') > -1) {\n if (array) {\n str = str.split('\\n').map(function (line) {\n return ' ' + line;\n }).join('\\n').substr(2);\n } else {\n str = '\\n' + str.split('\\n').map(function (line) {\n return ' ' + line;\n }).join('\\n');\n }\n }\n } else {\n str = ctx.stylize('[Circular]', 'special');\n }\n }\n\n if (isUndefined(name)) {\n if (array && key.match(/^\\d+$/)) {\n return str;\n }\n\n name = JSON.stringify('' + key);\n\n if (name.match(/^\"([a-zA-Z_][a-zA-Z_0-9]*)\"$/)) {\n name = name.substr(1, name.length - 2);\n name = ctx.stylize(name, 'name');\n } else {\n name = name.replace(/'/g, \"\\\\'\").replace(/\\\\\"/g, '\"').replace(/(^\"|\"$)/g, \"'\");\n name = ctx.stylize(name, 'string');\n }\n }\n\n return name + ': ' + str;\n }\n\n function reduceToSingleString(output, base, braces) {\n var numLinesEst = 0;\n var length = output.reduce(function (prev, cur) {\n numLinesEst++;\n if (cur.indexOf('\\n') >= 0) numLinesEst++;\n return prev + cur.replace(/\\u001b\\[\\d\\d?m/g, '').length + 1;\n }, 0);\n\n if (length > 60) {\n return braces[0] + (base === '' ? '' : base + '\\n ') + ' ' + output.join(',\\n ') + ' ' + braces[1];\n }\n\n return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];\n } // NOTE: These type checking functions intentionally don't use `instanceof`\n // because it is fragile and can be easily faked with `Object.create()`.\n\n\n function isArray(ar) {\n return Array.isArray(ar);\n }\n\n exports.isArray = isArray;\n\n function isBoolean(arg) {\n return typeof arg === 'boolean';\n }\n\n exports.isBoolean = isBoolean;\n\n function isNull(arg) {\n return arg === null;\n }\n\n exports.isNull = isNull;\n\n function isNullOrUndefined(arg) {\n return arg == null;\n }\n\n exports.isNullOrUndefined = isNullOrUndefined;\n\n function isNumber(arg) {\n return typeof arg === 'number';\n }\n\n exports.isNumber = isNumber;\n\n function isString(arg) {\n return typeof arg === 'string';\n }\n\n exports.isString = isString;\n\n function isSymbol(arg) {\n return _typeof2(arg) === 'symbol';\n }\n\n exports.isSymbol = isSymbol;\n\n function isUndefined(arg) {\n return arg === void 0;\n }\n\n exports.isUndefined = isUndefined;\n\n function isRegExp(re) {\n return isObject(re) && objectToString(re) === '[object RegExp]';\n }\n\n exports.isRegExp = isRegExp;\n\n function isObject(arg) {\n return _typeof2(arg) === 'object' && arg !== null;\n }\n\n exports.isObject = isObject;\n\n function isDate(d) {\n return isObject(d) && objectToString(d) === '[object Date]';\n }\n\n exports.isDate = isDate;\n\n function isError(e) {\n return isObject(e) && (objectToString(e) === '[object Error]' || e instanceof Error);\n }\n\n exports.isError = isError;\n\n function isFunction(arg) {\n return typeof arg === 'function';\n }\n\n exports.isFunction = isFunction;\n\n function isPrimitive(arg) {\n return arg === null || typeof arg === 'boolean' || typeof arg === 'number' || typeof arg === 'string' || _typeof2(arg) === 'symbol' || // ES6 symbol\n typeof arg === 'undefined';\n }\n\n exports.isPrimitive = isPrimitive;\n exports.isBuffer = __webpack_require__(37);\n\n function objectToString(o) {\n return Object.prototype.toString.call(o);\n }\n\n function pad(n) {\n return n < 10 ? '0' + n.toString(10) : n.toString(10);\n }\n\n var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; // 26 Feb 16:19:34\n\n function timestamp() {\n var d = new Date();\n var time = [pad(d.getHours()), pad(d.getMinutes()), pad(d.getSeconds())].join(':');\n return [d.getDate(), months[d.getMonth()], time].join(' ');\n } // log is just a thin wrapper to console.log that prepends a timestamp\n\n\n exports.log = function () {\n console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));\n };\n /**\n * Inherit the prototype methods from one constructor into another.\n *\n * The Function.prototype.inherits from lang.js rewritten as a standalone\n * function (not on Function.prototype). NOTE: If this file is to be loaded\n * during bootstrapping this function needs to be rewritten using some native\n * functions as prototype setup using normal JavaScript does not work as\n * expected during bootstrapping (see mirror.js in r114903).\n *\n * @param {function} ctor Constructor function which needs to inherit the\n * prototype.\n * @param {function} superCtor Constructor function to inherit prototype from.\n */\n\n\n exports.inherits = __webpack_require__(36);\n\n exports._extend = function (origin, add) {\n // Don't do anything if add isn't an object\n if (!add || !isObject(add)) return origin;\n var keys = Object.keys(add);\n var i = keys.length;\n\n while (i--) {\n origin[keys[i]] = add[keys[i]];\n }\n\n return origin;\n };\n\n function hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n }\n /* WEBPACK VAR INJECTION */\n\n }).call(exports, __webpack_require__(7), __webpack_require__(5));\n /***/\n },\n /* 39 */\n\n /***/\n function (module, exports) {\n module.exports = function (module) {\n if (!module.webpackPolyfill) {\n module.deprecate = function () {};\n\n module.paths = []; // module.parent = undefined by default\n\n if (!module.children) module.children = [];\n Object.defineProperty(module, \"loaded\", {\n enumerable: true,\n get: function get() {\n return module.l;\n }\n });\n Object.defineProperty(module, \"id\", {\n enumerable: true,\n get: function get() {\n return module.i;\n }\n });\n module.webpackPolyfill = 1;\n }\n\n return module;\n };\n /***/\n\n }\n /******/\n ])\n );\n});","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nif (process.env.NODE_ENV !== 'production') {\n var ReactIs = require('react-is'); // By explicitly using `prop-types` you are opting into new development behavior.\n // http://fb.me/prop-types-in-prod\n\n\n var throwOnDirectAccess = true;\n module.exports = require('./factoryWithTypeCheckers')(ReactIs.isElement, throwOnDirectAccess);\n} else {\n // By explicitly using `prop-types` you are opting into new production behavior.\n // http://fb.me/prop-types-in-prod\n module.exports = require('./factoryWithThrowingShims')();\n}","import { css } from \"@emotion/react\";\nimport * as Feather from \"react-feather\";\n\nconst toPascalCase = (text) => {\n return text.replace(/(^\\w|-\\w)/g, clearAndUpper);\n};\n\nconst clearAndUpper = (text) => {\n return text.replace(/-/, \"\").toUpperCase();\n};\n\nconst Icon = ({ name }) => {\n const SelectedIcon = Feather[toPascalCase(name)];\n return (\n \n );\n};\n\nexport default Icon;\n","import { useMutation, useQuery, useQueryClient } from \"react-query\";\nimport { apiGet, apiPost } from \"@shared/queryHooks/api\";\n\nconst getJobBoardJob = async ({ jobId, organizationSlug }) => {\n if (jobId != undefined && organizationSlug != undefined) {\n return await apiGet({ path: `/public/organizations/${organizationSlug}/jobs/${jobId}` });\n }\n};\n\nconst applyForJob = async ({\n jobId,\n organizationSlug,\n application: { candidate, questionResponses, createdVia, src, source },\n recaptchaToken,\n}) => {\n if (jobId != undefined && organizationSlug != undefined) {\n return await apiPost({\n path: `/public/organizations/${organizationSlug}/jobs/${jobId}/apply`,\n variables: { candidate, questionResponses, createdVia, src, source, recaptchaToken },\n });\n }\n};\n\n/* Hooks\n--===================================================-- */\nfunction useJobBoardJob({\n jobId,\n organizationSlug,\n}): {\n status: any;\n data: any;\n error: any;\n isFetching: boolean;\n isLoading: boolean;\n} {\n return useQuery([\"jobBoardJob\", jobId], () => getJobBoardJob({ jobId, organizationSlug }), {\n refetchOnWindowFocus: false,\n });\n}\n\nfunction useApplyForJob() {\n const queryClient = useQueryClient();\n return useMutation(applyForJob, {\n onSuccess: (data, mutationVariables) => {\n window.logger(\"[useJobBoard] useApplyForJob\", { data, mutationVariables });\n queryClient.invalidateQueries([\"jobBoardJob\", mutationVariables.jobId]);\n },\n // throwOnError: true,\n });\n}\n\nexport { useJobBoardJob, useApplyForJob };\n","import React from \"react\";\nimport FormInput from \"@ats/src/components/forms/FormInput\";\nimport FormTextarea from \"@ats/src/components/forms/FormTextarea\";\nimport FormSelect from \"@ats/src/components/forms/FormSelect\";\nimport FormUploader from \"@ats/src/components/forms/FormUploader\";\n\nimport {\n MEGABYTE_IN_BYTES,\n isAllowedFileSize,\n isAllowedFileType,\n} from \"@ats/src/lib/utils/fileUploads\";\nimport { convertArrayToSelectOptions } from \"@shared/lib/utils\";\n\nexport default function QuestionResponse(props: {\n question: any;\n questionResponse: any;\n errors: any;\n index: number;\n handleQuestionResponseChange: (index, values, errors) => void;\n clearFixedErrors: (fieldName, errors) => any;\n}) {\n const { question, questionResponse, errors } = props;\n let customQuestionsErrors =\n errors && errors.customQuestionsErrors ? errors.customQuestionsErrors : null;\n const { id, questionText, placeholderText, requirementSetting, options } = question;\n const name = `${id}`;\n const questionResponseBody = questionResponse ? questionResponse.body : \"\";\n const questionSelectedOptions = questionResponse ? questionResponse.responseArray : \"\";\n const fileToUpload = questionResponse ? questionResponse.customFile : undefined;\n const label = questionText;\n const isRequired = requirementSetting === \"required\";\n const selectOptions = convertArrayToSelectOptions(options.data);\n const maxFileSize = MEGABYTE_IN_BYTES * 10;\n\n const handleQuestionResponseChange = (name, value) => {\n const { question, index, errors } = props;\n const response = { questionId: question.id, body: value };\n props.handleQuestionResponseChange(index, response, errors);\n };\n\n const handleSelectChange = (name, value) => {\n const { question, index, errors } = props;\n window.logger(\"%c[QuestionResponse] handleSelectChange\", \"color: #1976D2\", { name, value });\n props.handleQuestionResponseChange(index, { questionId: question.id, body: value }, errors);\n };\n\n const handleMultiSelectChange = (name, value) => {\n const { question, index, errors } = props;\n window.logger(\"%c[QuestionResponse] handleSelectChange\", \"color: #1976D2\", { name, value });\n const selections = value.map((item) => item.value);\n const response = { questionId: question.id, responseArray: selections };\n props.handleQuestionResponseChange(index, response, errors);\n };\n\n /* Handle File Input & Error\n --===================================================-- */\n const handleFileInputChange = (value) => {\n const { question, index } = props;\n window.logger(\"%c[QuestionResponse] handleFileInputChange\", \"color: #1976D2\", { name, value });\n const errors = props.clearFixedErrors(\"file\", props.errors);\n const response = { questionId: question.id, customFile: value.fileToUpload };\n props.handleQuestionResponseChange(index, response, errors);\n };\n\n const onInvalidFile = (file, expectedFileType) => {\n const { question, index } = props;\n window.logger(\"%c[QuestionResponse] onInvalidFile\", \"color: #1976D2\", {\n file,\n expectedFileType,\n });\n const errors = file ? invalidFileError(file) : props.errors;\n const response = { questionId: question.id, customFile: undefined };\n props.handleQuestionResponseChange(index, response, errors);\n };\n\n const invalidFileError = (file: File) => {\n let fileError: { file: string[] };\n if (!isAllowedFileType(\"combined\", file.type)) {\n fileError = {\n file: [window.APP_TRANSLATIONS.custom_question_file_type_error],\n };\n } else if (!isAllowedFileSize(maxFileSize, file.size)) {\n fileError = {\n file: [window.APP_TRANSLATIONS.custom_question_file_size_error],\n };\n }\n return fileError;\n };\n\n /* Return Question Component by Kind\n --===================================================-- */\n if (question.kind === \"text_short\") {\n return (\n \n );\n } else if (question.kind === \"text_long\") {\n return (\n \n );\n } else if (question.kind === \"single_select\") {\n return (\n \n );\n } else if (question.kind === \"multi_select\") {\n return (\n \n );\n } else if (question.kind === \"file_upload\") {\n return (\n \n undefined}\n loading={false}\n errors={customQuestionsErrors}\n isRequired={isRequired}\n requiredLabel={window.APP_TRANSLATIONS.required}\n />\n \n );\n } else {\n return null;\n }\n}\n","import React from \"react\";\nimport ReCAPTCHA from \"react-google-recaptcha\";\nimport isEmpty from \"lodash/isEmpty\";\nimport FormContainer from \"@ats/src/components/forms/FormContainer\";\nimport FormInput from \"@ats/src/components/forms/FormInput\";\nimport FormTextarea from \"@ats/src/components/forms/FormTextarea\";\nimport FormUploader from \"@ats/src/components/forms/FormUploader\";\nimport Button from \"@ats/src/components/shared/Button\";\n\nimport { removeHttpPrefix, removeKnownUrlPrefix } from \"@shared/lib/utils\";\n\nimport QuestionResponse from \"../components/QuestionResponse\";\n\nimport styled from \"@emotion/styled\";\nimport { css } from \"@emotion/react\";\n\nfunction ApplicationForm(props) {\n const {\n questions,\n errors,\n questionResponsesState,\n handleQuestionResponseChange,\n recaptchaRef,\n } = props;\n\n const onSubmit = (event) => {\n event.preventDefault();\n props.onSubmit();\n };\n\n const customQuestionNodes = (questions) => {\n if (!questions || questions.length === 0) return null;\n\n return questions.map(\n (question, index) => (\n \n ),\n // undefined,\n );\n };\n\n const onInvalidFile = (file, expectedFileType) => {\n props.onInputChange({\n resumeFile: undefined,\n errors: { resume: [window.APP_TRANSLATIONS.resume_error] },\n });\n };\n\n const inputs = () => {\n const {\n errors,\n name,\n email,\n phone,\n location,\n linkedinUrl,\n githubUrl,\n twitterUrl,\n dribbbleUrl,\n websiteUrl,\n resumeFile,\n settings,\n } = props;\n\n if (settings === undefined) return [];\n\n return [\n {\n name: \"name\",\n label: window.APP_TRANSLATIONS.name_label,\n placeholder: \"\",\n value: name,\n errors: errors,\n requirementSetting: settings[\"name\"],\n type: \"text\",\n component: \"FormInput\",\n },\n {\n name: \"email\",\n label: window.APP_TRANSLATIONS.email_address_label,\n placeholder: \"\",\n value: email,\n errors: errors,\n requirementSetting: settings[\"email\"],\n type: \"email\",\n component: \"FormInput\",\n },\n {\n name: \"phone\",\n label: window.APP_TRANSLATIONS.phone_number_label,\n placeholder: \"\",\n value: phone,\n errors: errors,\n requirementSetting: settings[\"phone\"],\n type: \"text\",\n component: \"FormInput\",\n },\n {\n name: \"location\",\n label: window.APP_TRANSLATIONS.location_label,\n placeholder: window.APP_TRANSLATIONS.location_placeholder,\n value: location,\n errors: errors,\n requirementSetting: settings[\"location\"],\n type: \"text\",\n component: \"FormInput\",\n },\n {\n name: \"linkedinUrl\",\n label: window.APP_TRANSLATIONS.linkedin_label,\n placeholder: \"...\",\n value: removeKnownUrlPrefix(linkedinUrl) || \"\",\n errors: errors,\n requirementSetting: settings[\"linkedinUrl\"],\n type: \"text\",\n pretext: \"https://linkedin.com/in/\",\n component: \"FormInput\",\n },\n {\n name: \"twitterUrl\",\n label: window.APP_TRANSLATIONS.twitter_label,\n placeholder: \"...\",\n value: removeKnownUrlPrefix(twitterUrl) || \"\",\n errors: errors,\n requirementSetting: settings[\"twitterUrl\"],\n type: \"text\",\n pretext: \"https://twitter.com/\",\n component: \"FormInput\",\n },\n {\n name: \"githubUrl\",\n label: window.APP_TRANSLATIONS.github_label,\n placeholder: \"...\",\n value: removeKnownUrlPrefix(githubUrl) || \"\",\n errors: errors,\n requirementSetting: settings[\"githubUrl\"],\n type: \"text\",\n pretext: \"https://github.com/\",\n component: \"FormInput\",\n },\n {\n name: \"dribbbleUrl\",\n label: window.APP_TRANSLATIONS.dribbble_label,\n placeholder: \"...\",\n value: removeKnownUrlPrefix(dribbbleUrl) || \"\",\n errors: errors,\n requirementSetting: settings[\"dribbbleUrl\"],\n type: \"text\",\n pretext: \"https://dribbble.com/\",\n component: \"FormInput\",\n },\n {\n name: \"websiteUrl\",\n label: window.APP_TRANSLATIONS.website_label,\n placeholder: \"...\",\n value: removeHttpPrefix(websiteUrl) || \"\",\n errors: errors,\n requirementSetting: settings[\"websiteUrl\"],\n type: \"text\",\n pretext: \"https://\",\n component: \"FormInput\",\n },\n {\n name: \"resumeFile\",\n label: window.APP_TRANSLATIONS.resume_label,\n placeholder: window.APP_TRANSLATIONS.resume_placeholder,\n value: resumeFile,\n errors: errors,\n requirementSetting: settings[\"resume\"],\n type: \"file\",\n component: \"FileUpload\",\n },\n ];\n };\n\n const recaptchaElement = (\n \n \n \n );\n\n const standardQuestions = () => {\n const inputsArr = inputs();\n\n return inputsArr.map((input) => {\n const {\n name,\n placeholder,\n label,\n value,\n type,\n pretext,\n component,\n requirementSetting,\n errors,\n } = input;\n\n if (requirementSetting === \"hidden\") return null;\n\n if (component === \"FormInput\")\n return (\n \n );\n\n if (component === \"FormTextarea\")\n return (\n \n );\n\n if (component === \"FileUpload\") {\n return (\n \n undefined}\n />\n \n );\n }\n });\n };\n\n const clearFixedErrors = (fieldName, errors) => {\n // window.logger(\"%c[ApplicationForm] clearFixedErrors\", \"color: #1976D2\", {\n // fieldName,\n // errors,\n // props,\n // });\n\n if (errors != undefined && errors[fieldName]) {\n // Mark error as fixed for this field\n delete errors[fieldName];\n }\n if (isEmpty(errors)) {\n errors = undefined;\n }\n // console.log(\"%c[ApplicationForm] clearFixedErrors\", \"color: #1976D2\", { errors });\n return errors;\n };\n\n const handleInputChange = (name, value) => {\n // console.warn('[ApplicationForm] handleInputChange name', name);\n let val = value;\n const errors = clearFixedErrors(name, props.errors);\n\n if (name === \"linkedinUrl\") {\n val = removeKnownUrlPrefix(val);\n } else if (name === \"websiteUrl\") {\n val = removeHttpPrefix(val);\n }\n\n props.onInputChange({ [name]: val, errors });\n };\n\n /* Handle File Input Change\n --===================================================-- */\n const handleFileInputChange = ({ fileToUpload }) => {\n console.log(\"[ApplicationForm] handleFileInputChange fileToUpload\", fileToUpload);\n\n if (fileToUpload) {\n const errors = clearFixedErrors(\"resume\", props.errors);\n props.onInputChange({ resumeFile: fileToUpload, errors });\n }\n };\n\n const submitButton = (\n \n {window.APP_TRANSLATIONS.submit_application}\n \n );\n\n return (\n <>\n {window.APP_TRANSLATIONS.apply_here}\n \n {standardQuestions()}\n {customQuestionNodes(questions)}\n {recaptchaElement}\n \n >\n );\n}\n\nexport default ApplicationForm;\n\n/* Styled Components\n======================================================= */\nconst Styled: any = {};\n\nStyled.Title = styled.h2((props: any) => {\n const t: any = props.theme;\n return css`\n label: ApplicationForm_Title;\n ${[t.mb(6), t.mt(1), t.text.h2, t.text.bold]}\n color: ${t.color.black};\n `;\n});\n\nStyled.Button = styled(Button)((props) => {\n const t: any = props.theme;\n return css`\n label: ApplicationForm_Button;\n ${t.mt(2)}\n `;\n});\n\nStyled.RecaptchaContainer = styled.div`\n label: ApplicationForm_RecaptchaContainer;\n\n .grecaptcha-badge {\n visibility: hidden;\n }\n`;\n","import React from \"react\";\nimport Joi from \"joi-browser\";\nimport isEmpty from \"lodash/isEmpty\";\nimport queryString from \"query-string\";\n\nimport { DirectUpload } from \"activestorage\";\nimport { useJobBoardJob, useApplyForJob } from \"@shared/queryHooks/jobBoard/useJobBoard\";\nimport { objectHasEmptyValues } from \"@shared/lib/utils\";\n\nimport ApplicationForm from \"./ApplicationForm\";\nimport EmptyState from \"@ats/src/components/shared/EmptyState\";\nimport LoadingIndicator from \"@ats/src/components/shared/LoadingIndicator\";\n\nimport styled from \"@emotion/styled\";\nimport { css } from \"@emotion/react\";\n\n/* REDUCER\n--===================================================-- */\nfunction questionResponsesReducer(state, action) {\n switch (action.type) {\n case \"SET_QUESTION_RESPONSE\": {\n return { ...state, [action.payload.questionId]: action.payload };\n }\n case \"DELETE_QUESTION_RESPONSE\": {\n const newState = { ...state };\n delete newState[action.payload.questionId];\n return newState;\n }\n default: {\n throw new Error(`Unhandled action type: ${action.type}`);\n }\n }\n}\n\nfunction ApplyApp(props) {\n const [submitted, setSubmitted] = React.useState(false);\n const [uploadingFile, setUploadingFile] = React.useState(false);\n const [errors, setErrors] = React.useState(null);\n const [questionResponsesState, questionResponsesDispatch] = React.useReducer(\n questionResponsesReducer,\n {},\n );\n\n const { src, source } = queryString.parse(location.search);\n const recaptchaRef = React.useRef(null);\n\n // window.logger(\"%c[ApplyApp] RENDER\", \"color: #1976D2\", { props, location, src });\n\n const [state, setState] = React.useState({\n name: \"\",\n email: \"\",\n phone: \"\",\n location: \"\",\n photo: \"\",\n coverLetter: \"\",\n linkedinUrl: \"\",\n twitterUrl: \"\",\n githubUrl: \"\",\n dribbbleUrl: \"\",\n websiteUrl: \"\",\n success: false,\n errors: null,\n resumeFile: undefined, // needs to be undefined for Joi\n });\n\n const jobId = window.inflowJobId;\n const organizationSlug = window.inflowOrganizationSlug;\n\n const { data: job, isLoading } = useJobBoardJob({\n jobId,\n organizationSlug,\n });\n\n const { mutate: applyForJob, isLoading: isLoadingApplyForJob } = useApplyForJob();\n\n if (isLoading === true) {\n return (\n \n \n \n );\n }\n\n const handleInputChange = ({ errors, ...inputValue }) => {\n setState({ ...state, ...inputValue });\n setErrors(errors);\n };\n\n const handleQuestionResponseChange = (questionIndex, response, errors) => {\n // window.logger(\"%c[ApplyApp] handleQuestionResponseChange\", \"color: #1976D2\", { response });\n\n if (errors != undefined && errors.customQuestionsErrors != undefined) {\n delete errors.customQuestionsErrors;\n }\n\n // setState({ ...state, errors: isEmpty(errors) ? undefined : errors });\n setErrors(isEmpty(errors) ? undefined : errors);\n //check for responses updated with null/empty/undefined body/array/file\n const invalidResponse = objectHasEmptyValues(response);\n\n questionResponsesDispatch({\n type: \"SET_QUESTION_RESPONSE\",\n payload: response,\n });\n //if invalid, update question state (above) so UI updates correctly\n //then delete invalid response to ensure required questions error\n if (invalidResponse) {\n questionResponsesDispatch({\n type: \"DELETE_QUESTION_RESPONSE\",\n payload: response,\n });\n }\n };\n\n /* onSubmit\n --===================================================-- */\n const onSubmit = async () => {\n const recaptchaToken = window.IS_TEST_ENV ? null : await recaptchaRef.current.executeAsync();\n\n const {\n name,\n email,\n phone,\n location,\n coverLetter,\n linkedinUrl,\n githubUrl,\n twitterUrl,\n dribbbleUrl,\n websiteUrl,\n resumeFile,\n } = state;\n\n if (isLoadingApplyForJob) {\n return;\n }\n\n let joiObject = {\n name: Joi.string().required(),\n email: Joi.string().email().required(),\n resumeFile: Joi.any().required(),\n };\n\n let objectToValidate = { name, email, resumeFile };\n\n if (job.settings[\"resume\"] !== \"required\") {\n delete joiObject.resumeFile;\n delete objectToValidate.resumeFile;\n }\n\n // window.logger(\"%c[ApplyApp] onSubmit\", \"color: #1976D2\", {\n // questionResponses: Object.values(questionResponsesState),\n // resumeFile,\n // settings: job.settings,\n // objectToValidate,\n // joiObject,\n // recaptchaToken,\n // });\n\n const schema = Joi.object().keys(joiObject);\n\n Joi.validate(objectToValidate, schema, { abortEarly: false }, (err, value) => {\n let errors;\n let questionsWithErrors = job.questions.filter((question, index) => {\n // console.log(\"%c[ApplyApp] questionsWithErrors\", \"color: #1976D2\", { question });\n return (\n question.requirementSetting === \"required\" &&\n (questionResponsesState[question.id] == undefined ||\n isEmpty(questionResponsesState[question.id]))\n // (question.questionResponse == undefined || isEmpty(question.questionResponse.body))\n );\n });\n\n if (err != undefined) {\n errors = {};\n console.error(\"[ApplyApp] onSubmit err.details\", err.details);\n\n err.details.forEach((index) => {\n let key = index.context.key;\n let message = index.message.replace(`\"${key}\" `, \"\");\n errors[key] = [message];\n });\n } else if (questionsWithErrors.length > 0) {\n errors = { customQuestionsErrors: {} };\n\n questionsWithErrors.forEach((question) => {\n errors.customQuestionsErrors[question.id] = [\"is required\"];\n });\n } else {\n handleSubmission({\n candidate: {\n name,\n email,\n phone,\n location,\n coverLetter,\n linkedinUrl,\n githubUrl,\n twitterUrl,\n dribbbleUrl,\n websiteUrl,\n },\n resumeFile,\n questionResponsesState,\n createdVia: \"created_via_job_board\",\n src,\n source, // pulled from the URL ?src=param\n recaptchaToken,\n });\n }\n // setState({ ...state, errors });\n setErrors(errors);\n recaptchaRef?.current?.reset();\n });\n };\n\n const handleSubmission = async ({\n candidate,\n resumeFile,\n questionResponsesState,\n createdVia,\n src,\n source,\n recaptchaToken,\n }) => {\n const fileUploadQuestions = job.questions.filter((question) => question.kind === \"file_upload\");\n let responses;\n if (!isEmpty(fileUploadQuestions)) {\n responses = await handleCustomFileUploads(fileUploadQuestions, questionResponsesState);\n } else {\n responses = Object.values(questionResponsesState);\n }\n\n if (resumeFile) {\n // Upload Resume, then postRequest with returned resumeSignedId\n const resumeSignedId = await directUploadFile(resumeFile);\n createCandidate({\n candidate: { ...candidate, resumeSignedId: resumeSignedId },\n questionResponses: responses,\n createdVia,\n src,\n source,\n recaptchaToken,\n });\n } else {\n createCandidate({\n candidate,\n questionResponses: responses,\n createdVia,\n src,\n source,\n recaptchaToken,\n });\n }\n };\n\n const createCandidate = ({\n candidate,\n questionResponses,\n createdVia,\n src,\n source,\n recaptchaToken,\n }) => {\n // window.logger(\"%c[ApplyApp] createCandidate \", \"color: #1976D2\", {\n // jobId,\n // organizationSlug,\n // application: {\n // candidate,\n // questionResponses,\n // },\n // });\n\n applyForJob(\n {\n jobId,\n organizationSlug,\n application: {\n candidate,\n questionResponses,\n createdVia,\n src,\n source,\n },\n recaptchaToken,\n },\n {\n onSuccess: (data) => {\n setSubmitted(true);\n setUploadingFile(false);\n },\n onError: (response) => {\n setErrors((response as any).data.errors);\n setUploadingFile(false);\n recaptchaRef?.current?.reset();\n },\n },\n );\n };\n\n /* UPLOAD HANDLERS */\n const directUploadFile = async (file) => {\n setUploadingFile(true);\n const railsDirectUploadUrl = `${window.APP_ATS_ROOT_URL}/api/v1/public/rails/active_storage/direct_uploads`;\n const upload = new DirectUpload(file, railsDirectUploadUrl, this);\n\n return new Promise((resolve, reject) => {\n upload.create((error, blob) => {\n if (error) {\n console.error(`[ApplyApp] directUploadFile error while uploading ${file.name}`, error);\n reject(error);\n } else {\n console.log(`%c[ApplyApp] directUploadFile ${file.name} blob`, \"color: #1976D2\", blob);\n resolve(blob.signed_id);\n }\n });\n });\n };\n\n const handleCustomFileUploads = async (fileUploadQuestions, responsesState) => {\n let fileUploads = [];\n fileUploadQuestions.forEach((question) => {\n if (responsesState[question.id] !== undefined && !isEmpty(responsesState[question.id])) {\n fileUploads.push(questionResponsesState[question.id]);\n }\n });\n // iterate through responses with files and upload each\n const fileUploadsResponses = {};\n for (const upload of fileUploads) {\n const signedId = await directUploadFile(upload.customFile);\n // assign returned signedId as the value of customFile\n const newResponse = { questionId: upload.questionId, customFile: signedId };\n fileUploadsResponses[upload.questionId] = newResponse;\n }\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign#merging_objects_with_same_properties\n const updatedQuestionResponsesState = Object.assign({}, responsesState, fileUploadsResponses);\n return Object.values(updatedQuestionResponsesState);\n };\n\n /* Handle successful submission */\n if (submitted) {\n return (\n \n );\n }\n\n return (\n <>\n \n \n \n \n This site is protected by reCAPTCHA and the Google{\" \"}\n Privacy Policy and{\" \"}\n Terms of Service apply.\n \n >\n );\n}\n\nexport default ApplyApp;\n\n/* Styled Components\n======================================================= */\nconst Styled: any = {};\n\nStyled.Container = styled.div((props: any) => {\n const t: any = props.theme;\n return css`\n label: ApplyApp;\n ${[t.text.sm, t.p(4), t.rounded.md]}\n border: 1px solid ${t.color.gray[200]};\n background: ${t.color.white};\n width: 100%;\n\n ${t.mq[\"lg\"]} {\n ${[t.p(6), t.pb(8)]}\n }\n `;\n});\n\nStyled.Loader = styled.div((props: any) => {\n const t: any = props.theme;\n return css`\n label: ApplyApp_Loader;\n ${t.rounded.md}\n border: 1px solid ${t.color.gray[200]};\n background: ${t.color.white};\n width: 100%;\n `;\n});\n\nStyled.Recaptcha = styled.p((props: any) => {\n const t: any = props.theme;\n return css`\n label: ApplyApp_Recaptcha;\n ${[t.text.xs, t.mt(8)]}\n color: ${t.color.gray[600]};\n a:hover {\n color: ${t.color.black};\n }\n `;\n});\n","// ./src/index.js\nimport React from \"react\";\nimport ReactDOM from \"react-dom\";\n\n// import ApplyAppWrapper from \"@jobBoard/src/views/ApplyApp/wrapper.js\";\n// import store from \"@jobBoard/src/lib/store\";\n\nimport { QueryClient, QueryClientProvider } from \"react-query\";\nimport { ThemeProvider } from \"@emotion/react\";\nimport theme from \"@ats/styles/theme\";\nimport lightTheme from \"@shared/styles/lightTheme\";\n\nimport ApplyApp from \"@jobBoard/src/views/ApplyApp\";\n\nfunction App(props) {\n const queryClient = new QueryClient();\n\n return (\n \n \n \n \n \n );\n}\n\ndocument.addEventListener(\"DOMContentLoaded\", function () {\n if (document.getElementById(\"apply\")) {\n const render = (Component = App) => {\n ReactDOM.render(, document.getElementById(\"apply\"));\n };\n\n render(undefined);\n }\n});\n","const fileTypes = {\n image: [\"image/png\", \"image/jpeg\", \"image/jpg\", \"image/svg+xml\"],\n document: [\n \"application/pdf\",\n \"application/vnd.openxmlformats-officedocument.wordprocessingml.document\",\n ],\n excel: [\n \"application/vnd.ms-excel\",\n \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\",\n ],\n csv: [\"text/csv\"],\n text: [\"text/plain\"],\n audio: [\n \"audio/mpeg\",\n \"audio/ogg\",\n \"audio/wav\",\n \"audio/x-wav\", // Firefox & Safari MIME type for .wav files\n \"video/ogg\", // Firefox identifies audio/ogg files as video/ogg \n ],\n};\n\nconst customQuestionUploadFileTypes = [...fileTypes.image, ...fileTypes.document, ...fileTypes.excel, ...fileTypes.csv, ...fileTypes.text, ...fileTypes.audio];\n\nfileTypes[\"combined\"] = customQuestionUploadFileTypes;\n\nexport type FileTypes = \"image\" | \"document\" | \"excel\" | \"csv\" | \"text\" | \"combined\" | \"any\";\n\nexport const KILOBYTE_IN_BYTES = 1024;\nexport const MEGABYTE_IN_KILOBYTES = 1024;\nexport const MEGABYTE_IN_BYTES = KILOBYTE_IN_BYTES * MEGABYTE_IN_KILOBYTES;\n\nexport const isAllowedFileType = (expectedFileType, actualFileType) => {\n if (expectedFileType === \"any\") return true;\n\n return expectedFileType === undefined\n ? true\n : fileTypes[expectedFileType].includes(actualFileType);\n};\n\nexport const isDocx = (contentType) => {\n return [\"application/vnd.openxmlformats-officedocument.wordprocessingml.document\"].includes(\n contentType,\n );\n};\n\nexport const isAllowedFileSize = (maxFileSize, actualFileSize) => {\n if (!maxFileSize) return true;\n return actualFileSize <= maxFileSize;\n};\n","var STATE_DELIMITER = '.';\nvar EMPTY_ACTIVITY_MAP = {};\nvar DEFAULT_GUARD_TYPE = 'xstate.guard';\nvar TARGETLESS_KEY = '';\nexport { DEFAULT_GUARD_TYPE, EMPTY_ACTIVITY_MAP, STATE_DELIMITER, TARGETLESS_KEY };","import { css } from \"@emotion/react\";\n\nconst baseColors = {\n white: '#FFFFFF',\n gray: {\n 50: '#FAFAFA',\n 100: '#F5F5F5',\n 200: '#E5E5E5',\n 300: '#D4D4D4',\n 400: '#A3A3A3',\n 500: '#737373',\n 600: '#525252',\n 700: '#404040',\n 800: '#262626',\n 900: '#171717',\n },\n black: '#000000',\n}\n\nconst color = {\n data: [\n \"#fd7f6f\",\n \"#7eb0d5\",\n \"#b2e061\",\n \"#bd7ebe\",\n \"#ffb55a\",\n \"#ffee65\",\n \"#beb9db\",\n \"#fdcce5\",\n \"#8bd3c7\",\n\n // \"#003f5c\",\n // \"#2f4b7c\",\n // \"#665191\",\n // \"#a05195\",\n // \"#d45087\",\n // \"#f95d6a\",\n // \"#ff7c43\",\n // \"#ffa600\",\n ],\n ...baseColors,\n\n orange: {\n 200: \"#EBD7B5\",\n },\n red: {\n 100: \"#FEE2E2\",\n 200: \"#FECACA\",\n 300: \"#FCA5A5\",\n 400: \"#F87171\",\n 500: \"#EF4444\",\n 600: \"#DC2626\",\n 700: \"#B91C1C\",\n },\n};\n\nconst spacing = {\n \"0\": \"0px\",\n px: \"1px\",\n \"1\": \"0.25rem\",\n \"2\": \"0.5rem\",\n \"3\": \"0.75rem\",\n \"4\": \"1rem\",\n \"5\": \"1.25rem\",\n \"6\": \"1.5rem\",\n \"8\": \"2rem\",\n \"10\": \"2.5rem\",\n \"12\": \"3rem\",\n \"16\": \"4rem\",\n \"20\": \"5rem\",\n \"24\": \"6rem\",\n \"32\": \"8rem\",\n \"40\": \"10rem\",\n \"48\": \"12rem\",\n \"56\": \"14rem\",\n \"64\": \"16rem\",\n auto: \"auto\",\n};\n\nfunction spacingFromSize(size) {\n let sizeString = size.toString();\n if (sizeString.charAt(0) === \"-\") {\n return \"-\" + spacing[sizeString.substr(1)];\n } else return spacing[sizeString];\n}\n\nconst typeScale = {\n xs: css`\n font-size: 0.75rem;\n `,\n sm: css`\n font-size: 0.875rem;\n `,\n base: css`\n font-size: 1rem;\n `,\n lg: css`\n font-size: 1.125rem;\n `,\n xl: css`\n font-size: 1.25rem;\n `,\n xxl: css`\n font-size: 1.5rem;\n `,\n xxxl: css`\n font-size: 1.875rem;\n `,\n};\n\nconst breakpoints: { [index: string]: number } = {\n md: 480,\n lg: 768,\n xl: 1024,\n};\n\nconst mq = Object.keys(breakpoints)\n .map((key) => [key, breakpoints[key]] as [string, number])\n .reduce((prev, [key, breakpoint]) => {\n prev[key] = `@media (min-width: ${breakpoint}px)`;\n return prev;\n }, {} as { [index: string]: string });\n\n\nconst theme = {\n color,\n spacing,\n mq,\n\n // Size\n h: function (size) {\n return css`\n height: ${spacing[size.toString()]};\n `;\n },\n w: function (size) {\n return css`\n width: ${spacing[size.toString()]};\n `;\n },\n\n // Position\n l: function (size) {\n return css`\n left: ${spacingFromSize(size)};\n `;\n },\n r: function (size) {\n return css`\n right: ${spacingFromSize(size)};\n `;\n },\n t: function (size) {\n return css`\n top: ${spacingFromSize(size)};\n `;\n },\n b: function (size) {\n return css`\n bottom: ${spacingFromSize(size)};\n `;\n },\n\n // Margins\n m: function (size) {\n return css`\n margin: ${spacingFromSize(size)};\n `;\n },\n ml: function (size) {\n return css`\n margin-left: ${spacingFromSize(size)};\n `;\n },\n mr: function (size) {\n return css`\n margin-right: ${spacingFromSize(size)};\n `;\n },\n mt: function (size) {\n return css`\n margin-top: ${spacingFromSize(size)};\n `;\n },\n mb: function (size) {\n return css`\n margin-bottom: ${spacingFromSize(size)};\n `;\n },\n mx: function (size) {\n return css`\n margin-left: ${spacingFromSize(size)};\n margin-right: ${spacingFromSize(size)};\n `;\n },\n my: function (size) {\n return css`\n margin-top: ${spacingFromSize(size)};\n margin-bottom: ${spacingFromSize(size)};\n `;\n },\n\n // Padding\n p: function (size) {\n return css`\n padding: ${spacing[size.toString()]};\n `;\n },\n pl: function (size) {\n return css`\n padding-left: ${spacing[size.toString()]};\n `;\n },\n pr: function (size) {\n return css`\n padding-right: ${spacing[size.toString()]};\n `;\n },\n pt: function (size) {\n return css`\n padding-top: ${spacing[size.toString()]};\n `;\n },\n pb: function (size) {\n return css`\n padding-bottom: ${spacing[size.toString()]};\n `;\n },\n px: function (size) {\n var sizeKey = size.toString();\n return css`\n padding-left: ${spacing[sizeKey]};\n padding-right: ${spacing[sizeKey]};\n `;\n },\n py: function (size) {\n var sizeKey = size.toString();\n return css`\n padding-top: ${spacing[sizeKey]};\n padding-bottom: ${spacing[sizeKey]};\n `;\n },\n\n text: {\n ...typeScale,\n\n // Font Weights\n normal: css`\n font-weight: 400;\n `,\n medium: css`\n font-weight: 450;\n `,\n semibold: css`\n font-weight: 500;\n `,\n bold: css`\n font-weight: 600;\n `,\n\n // Font Colors\n forefront: css`\n color: ${color.black};\n `,\n primary: css`\n color: ${color.black};\n `,\n secondary: css`\n color: ${color.gray[600]};\n `,\n\n // Headings\n h1: css`\n font-weight: 600;\n ${typeScale.xxxl};\n `,\n h2: css`\n font-weight: 600;\n ${typeScale.xxl};\n `,\n h3: css`\n font-weight: 600;\n ${typeScale.xl};\n `,\n h4: css`\n font-weight: 600;\n ${typeScale.lg};\n `,\n h5: css`\n font-weight: 600;\n ${typeScale.base};\n `,\n h6: css`\n font-weight: 600;\n ${typeScale.sm};\n `,\n },\n\n rounded: {\n xs: css`\n border-radius: 0.25rem;\n `,\n sm: css`\n border-radius: 0.3125rem;\n `,\n md: css`\n border-radius: 0.4375rem;\n `,\n },\n};\n\nexport default theme;","import React from \"react\";\nimport PropTypes, { any } from \"prop-types\";\nimport { errorTextViaYupOrRailsOrJoi } from \"@shared/lib/formHelpers\";\n\nimport styled from \"@emotion/styled\";\nimport { css } from \"@emotion/react\";\n\nimport FormLabel from \"./FormLabel\";\n\ntype Props = {\n name: string;\n placeholder?: string;\n label?: string;\n description?: string;\n scope?: any; // TODO: remove usage of this prop and delete it, bad pattern\n onChange?: (...args: any[]) => void;\n onBlur?: (...args: any[]) => void;\n className?: string;\n inputType?: string;\n rows?: any;\n value?: any;\n autoFocus?: boolean;\n isRequired?: boolean;\n isDisabled?: boolean;\n errors?: any[];\n onSelectionUpdate?: ({ ...args }) => void;\n children?: any;\n maxCharacterCount?: number;\n requiredLabel?: string;\n};\nfunction FormTextarea(props: Props) {\n const { errors, name, value, maxCharacterCount, requiredLabel = \"required\" } = props;\n const textAreaRef = React.useRef(null);\n let errorText = errorTextViaYupOrRailsOrJoi({ errors, name });\n const [characterCount, setCharacterCount] = React.useState(0);\n\n React.useEffect(() => {\n updateSelection();\n }, []);\n\n React.useEffect(() => {\n textAreaRef.current.addEventListener(\"keydown\", (event) => {\n if (event.keyCode === 27 || event.key === \"Escape\") {\n textAreaRef.current.blur();\n }\n return () => {\n textAreaRef.current.removeEventListener(\"keydown\");\n };\n });\n }, []);\n\n const handleChange = (event) => {\n event.preventDefault();\n\n updateSelection();\n\n if (props.scope !== undefined) {\n // TODO: deprecate this please, don't think actively used anymore\n props.scope.setState({ [props.name]: event.currentTarget.value, errors: null });\n } else if (props.onChange !== undefined) {\n const newValue = event.currentTarget.value;\n if (newValue.length > maxCharacterCount) {\n const sliced = newValue.slice(0, 280);\n props.onChange(props.name, sliced);\n setCharacterCount(sliced.length);\n } else {\n props.onChange(props.name, event.currentTarget.value);\n setCharacterCount(newValue.length);\n }\n }\n };\n\n const handleBlur = (event) => {\n event.preventDefault();\n event.stopPropagation();\n\n // Use the parent's scope to setState\n if (props.scope !== undefined && props.onBlur === undefined) {\n props.scope.setState({ [props.name]: event.currentTarget.value });\n } else if (props.onBlur !== undefined) {\n props.onBlur(props.name, event.currentTarget.value);\n }\n };\n\n const updateSelection = () => {\n const textarea = textAreaRef.current;\n\n if (props.onSelectionUpdate != undefined) {\n props.onSelectionUpdate({\n start: textarea.selectionStart,\n end: textarea.selectionEnd,\n textarea,\n });\n }\n\n // window.logger(\"%c[CMTM] updateSelection\", \"color: #1976D2\", {\n // // textarea,\n // start: textarea.selectionStart,\n // end: textarea.selectionEnd,\n // });\n };\n\n const textareaDescription = () => {\n if (props.description) {\n return (\n \n {props.description}\n {maxCharacterCount != undefined ? (\n = maxCharacterCount ? \"over-count\" : \"\"}>\n {`${characterCount > 0 ? ` (${characterCount}/${maxCharacterCount})` : \"\"}`}\n \n ) : null}\n
\n );\n }\n };\n\n const inputId = props.label\n ? `input${props.label.replace(/\\s+/g, \"\")}`\n : props.name\n ? props.name\n : \"Default\";\n\n return (\n \n \n {textareaDescription()}\n \n {props.children} {/* For displaying Joi rendered errors. See NewInviteForm example. */}\n \n );\n}\n\nFormTextarea.propTypes = {\n name: PropTypes.string.isRequired,\n placeholder: PropTypes.string,\n label: PropTypes.string,\n description: PropTypes.string,\n scope: PropTypes.object, // typically set to \"this\" from the parent so we can use setState\n onChange: PropTypes.func, //.isRequired, // This get's used as a callback if scope is not set\n className: PropTypes.string,\n inputType: PropTypes.string,\n rows: PropTypes.any,\n value: PropTypes.any,\n autoFocus: PropTypes.bool,\n isRequired: PropTypes.bool,\n isDisabled: PropTypes.bool,\n errors: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),\n onSelectionUpdate: PropTypes.func,\n};\n\nFormTextarea.defaultProps = {\n isRequired: false,\n isDisabled: false,\n};\n\nexport default FormTextarea;\n\n/* Styled Components\n======================================================= */\nlet Styled: any;\nStyled = {};\n\nStyled.Container = styled.div((props: any) => {\n const t: any = props.theme;\n return css`\n label: FormTextarea;\n ${t.mb(6)}\n > p {\n ${[t.text.sm, t.mt(-1), t.mb(2)]};\n color: ${t.dark ? t.color.gray[400] : t.color.gray[600]};\n max-width: 32rem;\n\n a {\n ${[t.text.medium]}\n color: ${t.dark ? t.color.gray[200] : t.color.black};\n\n &:hover {\n text-decoration: underline;\n }\n }\n\n ${t.mq[\"md\"]} {\n ${t.text.xs}\n }\n }\n\n ${t.mq[\"md\"]} {\n ${t.mb(5)}\n }\n\n span {\n ${[t.px(1), t.rounded.xs]}\n display: inline-flex;\n\n &.over-count {\n background-color: ${t.dark ? t.color.gray[700] : t.color.red[100]};\n color: ${t.dark ? t.color.red[400] : t.color.red[600]};\n }\n }\n `;\n});\n\nStyled.TextArea = styled.textarea((props: any) => {\n const t: any = props.theme;\n return css`\n label: FormTextarea_UI;\n ${[t.p(2), t.text.base, t.rounded.sm]}\n appearance: none;\n color: ${t.dark ? t.color.gray[200] : t.color.black};\n background-color: ${t.dark ? \"rgba(255,255,255,0.07)\" : t.color.white};\n width: 100%;\n max-width: 100%;\n min-width: 100%;\n min-height: ${t.spacing[24]};\n line-height: 1.4;\n text-overflow: ellipsis;\n border-width: 1px;\n border-style: solid;\n transition: border-color 0.2s ease, box-shadow 0.2s ease;\n border-color: ${props.hasError\n ? t.dark\n ? t.color.red[400]\n : t.color.red[500]\n : t.dark\n ? \"transparent\"\n : t.color.gray[300]};\n &::placeholder {\n color: ${t.color.gray[500]};\n }\n &:hover {\n border-color: ${props.hasError\n ? t.dark\n ? t.color.red[300]\n : t.color.red[600]\n : t.dark\n ? t.color.gray[600]\n : t.color.gray[400]};\n }\n &:focus {\n outline: none;\n border-color: ${props.hasError\n ? t.dark\n ? t.color.red[300]\n : t.color.red[600]\n : t.dark\n ? t.color.gray[500]\n : t.color.gray[400]};\n ${t.dark ? \"\" : `box-shadow: 0 0 0 2px ${t.color.gray[300]};`}\n }\n &:disabled {\n color: ${t.dark ? t.color.gray[500] : t.color.gray[600]};\n background-color: ${t.dark ? \"transparent\" : t.color.gray[100]};\n ${t.dark && `border: 1px solid ${t.color.gray[800]};`}\n }\n &:disabled:hover {\n ${!t.dark && `border-color: ${t.color.gray[300]};`}\n }\n\n ${t.mq[\"md\"]} {\n ${[t.text.sm]}\n }\n `;\n});\n","const colors = {\n white: '#FFFFFF',\n gray: {\n 50: '#FAFAFA',\n 100: '#F5F5F5',\n 200: '#E5E5E5',\n 300: '#D4D4D4',\n 400: '#A3A3A3',\n 500: '#737373',\n 600: '#525252',\n 700: '#404040',\n 800: '#262626',\n 900: '#171717',\n },\n black: '#000000',\n}\n\nexport default colors;","const theme = {\n radii: {\n xs: \"4px\",\n sm: \"5px\",\n md: \"7px\",\n lg: \"13px\",\n },\n shadow: \"0px 8px 20px -4px rgba(0, 0, 0, 0.08)\",\n};\n\nexport default theme;\n","import React from \"react\";\n// import PropTypes from \"prop-types\";\nimport { errorTextViaYupOrRailsOrJoi } from \"@shared/lib/formHelpers\";\nimport { DirectUpload } from \"activestorage\";\nimport { useMachine } from \"@xstate/react\";\nimport { Machine } from \"xstate\";\n\nimport styled from \"@emotion/styled\";\nimport { css } from \"@emotion/react\";\n\nimport Icon from \"@ats/src/components/shared/Icon\";\nimport FormLabel from \"@ats/src/components/forms/FormLabel\";\n\nimport { isAllowedFileSize, isAllowedFileType } from \"@ats/src/lib/utils/fileUploads\";\n\ntype Props = {\n displayType?: string;\n allowAutomaticUploading: boolean;\n htmlFor?: string; // used to connect the input and the uploader\n file?: any;\n fileName?: string;\n fileIsAlreadyUploaded: boolean;\n isRequired?: boolean;\n requiredLabel?: string;\n loading: boolean;\n name: string;\n label?: string;\n placeholder: {} | string;\n description?: string;\n tabIndex?: string;\n onChange?: ({}) => void;\n onCompleteDirectUpload: any;\n onStartDirectUpload?: (loading: boolean) => void;\n onInvalidFile: (file, expectedFileType) => void;\n errors: any;\n children?: any;\n expectedFileType: string;\n maxFileSize?: number;\n};\n\nexport default function FormUploader(props: Props) {\n // window.logger(\"%c[FormUploader] \", \"color: #1976D2\", { props });\n const {\n displayType,\n allowAutomaticUploading,\n tabIndex,\n placeholder,\n htmlFor,\n file,\n fileIsAlreadyUploaded,\n fileName, // useful for when displaying information for an already uploaded file\n label,\n isRequired,\n description,\n loading,\n children,\n expectedFileType,\n maxFileSize,\n onStartDirectUpload,\n requiredLabel = \"required\",\n } = props;\n\n const uploadMachine = Machine(\n {\n id: \"upload\",\n initial: \"noFile\",\n states: {\n noFile: {\n on: {\n ATTACH_FILE: \"fileAttachedForUpload\",\n AUTO_UPLOAD_FILE: \"newFileIsUploading\",\n HAS_EXISTING_FILE: \"existingFile\",\n },\n },\n existingFile: {\n on: {\n ATTACH_FILE: \"fileAttachedForUpload\",\n AUTO_UPLOAD_FILE: {\n target: \"replacementFileIsUploading\",\n actions: [\"sendOnLoadingCallback\"],\n },\n },\n },\n fileSuccessfullyUploaded: {\n on: {\n ATTACH_FILE: \"fileAttachedForUpload\",\n AUTO_UPLOAD_FILE: {\n target: \"replacementFileIsUploading\",\n actions: [\"sendOnLoadingCallback\"],\n },\n },\n },\n fileAttachedForUpload: {\n on: { INVALID_FILE: \"noFile\" },\n },\n newFileIsUploading: {\n on: { UPLOAD_COMPLETE: \"fileSuccessfullyUploaded\" },\n },\n replacementFileIsUploading: {\n on: { UPLOAD_COMPLETE: \"fileSuccessfullyUploaded\" },\n },\n },\n },\n {\n actions: {\n sendOnLoadingCallback: (context, event) => {\n window.logger(\"%c[FormUploader] sendOnLoadingCallback\", \"color: #1976D2\", {\n context,\n event,\n });\n const isLoading = event.type === \"AUTO_UPLOAD_FILE\";\n if (onStartDirectUpload != undefined) {\n onStartDirectUpload(isLoading);\n }\n },\n },\n },\n );\n\n const [state, send] = useMachine(uploadMachine);\n\n const [fileToUpload, setFileToUpload] = React.useState(file);\n\n let errorText = errorTextViaYupOrRailsOrJoi(props);\n\n React.useEffect(() => {\n setFileToUpload(file);\n\n if (fileIsAlreadyUploaded) {\n send(\"HAS_EXISTING_FILE\");\n }\n }, [file, fileIsAlreadyUploaded, send]);\n\n // window.logger(\"%c[FormUploader] STATE MACHINE value\", \"color: #1976D2\", { value: state.value });\n\n const fileExists = [\n \"existingFile\",\n \"fileAttachedForUpload\",\n \"fileSuccessfullyUploaded\",\n \"replacementFileIsUploading\",\n ].includes(String(state.value));\n\n const buttonText =\n displayType !== \"button\"\n ? placeholder\n : file != null && fileToUpload != null && fileExists\n ? fileToUpload.name\n : fileIsAlreadyUploaded && fileName\n ? fileName\n : placeholder;\n\n // const fileTypes = {\n // image: [\"image/png\", \"image/jpeg\", \"image/jpg\", \"image/svg+xml\"],\n // document: [\n // \"application/pdf\",\n // \"application/vnd.openxmlformats-officedocument.wordprocessingml.document\",\n // ],\n // };\n\n // const trimFilename = (filename) => {\n // let cutStart, cutEnd;\n\n // if (filename.length > 20) {\n // cutStart = 10;\n // cutEnd = filename.length - 7;\n // return filename.substr(0, cutStart) + \"...\" + filename.substr(cutEnd + 1);\n // } else {\n // return filename;\n // }\n // };\n\n // const isAllowedFileType = (expectedFileType, fileType) => {\n // return expectedFileType === undefined ? true : fileTypes[expectedFileType].includes(fileType);\n // };\n\n /* Handle File Input Change\n --===================================================-- */\n const handleFileInputChange = (e) => {\n e.preventDefault();\n const file = e.currentTarget.files[0];\n const upload = new DirectUpload(\n file,\n `/api/v1/public/rails/active_storage/direct_uploads`,\n this,\n );\n\n if (\n file &&\n isAllowedFileType(expectedFileType, file.type) &&\n isAllowedFileSize(maxFileSize, file.size)\n ) {\n if (props.onChange) props.onChange({ fileToUpload: file });\n\n if (allowAutomaticUploading) {\n send(\"AUTO_UPLOAD_FILE\");\n upload.create((error, blob) => {\n if (error) {\n console.error(\"[FormUploader] handleFileInputChange directUpload error\", error);\n } else {\n // window.logger('%c[FormUploader] uploaded file', 'color: #1976D2', { blob });\n props.onCompleteDirectUpload(blob).then((data) => {\n window.logger(\"%c[FormUploader] onCompleteDirectUpload\", \"color: #1976D2\", { data });\n if (data !== undefined) send(\"UPLOAD_COMPLETE\");\n });\n }\n });\n } else {\n setFileToUpload(file);\n send(\"ATTACH_FILE\");\n }\n } else {\n send(\"INVALID_FILE\");\n props.onInvalidFile(file, expectedFileType);\n }\n };\n\n return (\n \n {label && (\n \n )}\n {description && {description}
}\n \n \n \n {displayType === \"button\" && }\n {buttonText}\n \n\n {loading && (\n \n \n \n )}\n {!loading && displayType === \"button\" && state.value === \"fileSuccessfullyUploaded\" && (\n \n \n Uploaded\n \n )}\n {!loading && displayType === \"button\" && state.value === \"fileAttachedForUpload\" && (\n \n \n {window.APP_TRANSLATIONS.file_attached_label}\n \n )}\n \n {children}\n {/* For displaying Joi rendered errors. See NewInviteForm example. */}\n \n );\n}\n\nFormUploader.defaultProps = {\n // allowAutomaticUploading: true,\n displayType: \"button\",\n};\n\n/* Styled Components\n======================================================= */\nlet Styled: any;\nStyled = {};\n\nStyled.Container = styled.div((props: any) => {\n const t: any = props.theme;\n return css`\n label: FormUploader;\n ${props.displayType === \"dropdownLink\" ? \"margin-bottom: 2px\" : t.mb(6)};\n > p {\n ${[t.text.sm, t.mt(-1), t.mb(2)]};\n color: ${t.dark ? t.color.gray[400] : t.color.gray[600]};\n max-width: 32rem;\n\n a {\n ${[t.text.medium]}\n color: ${t.dark ? t.color.gray[200] : t.color.black};\n\n &:hover {\n text-decoration: underline;\n }\n }\n\n ${t.mq[\"md\"]} {\n ${t.text.xs}\n }\n }\n\n ${t.mq[\"md\"]} {\n ${props.displayType === \"dropdownLink\" ? \"margin-bottom: 2px\" : t.mb(5)};\n }\n `;\n});\n\nStyled.UIContainer = styled.div((props: any) => {\n const t: any = props.theme;\n return css`\n label: FormUploader_UI;\n display: flex;\n align-items: center;\n\n [type=\"file\"]:focus + label,\n [type=\"file\"]:focus + label:hover {\n transition: border-color 0.2s ease, box-shadow 0.2s;\n ${props.displayType === \"dropdownLink\"\n ? \"text-decoration: underline;\"\n : t.dark\n ? \"\"\n : `box-shadow: 0 0 0 2px ${t.color.gray[300]};`};\n border-color: ${t.dark ? t.color.gray[500] : t.color.gray[400]};\n }\n `;\n});\n\nStyled.UploadButton = styled.label((props: any) => {\n const t: any = props.theme;\n const base = css`\n label: FormUploader_UploadButton;\n border: none;\n appearance: none;\n outline: none;\n position: relative;\n cursor: pointer;\n overflow: hidden;\n display: flex;\n align-items: center;\n `;\n\n if (props.displayType === \"dropdownLink\") {\n return css`\n ${[t.text.medium, base]}\n color: ${t.dark ? t.color.gray[300] : t.color.black};\n background-color: transparent;\n &:hover {\n text-decoration: underline;\n }\n `;\n } else {\n return props.fileExists\n ? css`\n ${[t.h(10), t.text.base, t.rounded.sm, base]};\n padding: 0 ${t.spacing[2]};\n width: 100%;\n color: ${t.dark ? t.color.gray[200] : t.color.black};\n border: 1px solid ${t.dark ? \"transparent\" : t.color.gray[300]};\n background-color: ${t.dark ? \"rgba(255,255,255,0.08)\" : t.color.white};\n transition: background-color 0.2s ease, border-color 0.2s ease;\n svg {\n margin-right: ${t.spacing[1]};\n }\n &:hover {\n border-color: ${t.dark ? t.color.gray[600] : t.color.gray[400]};\n }\n\n ${t.mq[\"md\"]} {\n ${[t.h(8), t.text.sm]}\n }\n `\n : css`\n ${[t.h(10), t.text.base, t.rounded.sm, base]}\n padding: 0 ${t.spacing[4]};\n transition: background-color 0.2s ease;\n background-color: ${t.dark ? t.color.gray[700] : t.color.gray[200]};\n font-weight: 450;\n color: ${props.hasError\n ? t.dark\n ? t.color.red[300]\n : t.color.red[600]\n : t.dark\n ? t.color.gray[200]\n : t.color.black};\n svg {\n display: none;\n }\n &:hover {\n background-color: ${t.dark ? t.color.gray[600] : t.color.gray[300]};\n color: ${t.dark ? t.color.white : t.color.black};\n }\n\n ${t.mq[\"md\"]} {\n ${[t.h(8), t.text.sm]}\n }\n `;\n }\n});\n\nStyled.UploadButtonLabel = styled.span`\n label: FormUploader_UploadButtonLabel;\n display: flex;\n align-items: center;\n flex-shrink: 1;\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n`;\n\nStyled.Input = styled.input`\n label: FormUploader_Input;\n position: absolute;\n margin: -1px;\n width: 1px;\n height: 1px;\n border: 0;\n clip: rect(0, 0, 0, 0);\n overflow: hidden;\n`;\n\nStyled.UploadStatus = styled.div((props) => {\n const t: any = props.theme;\n return css`\n label: FormUploader_UploadStatus;\n ${t.ml(3)}\n display: flex;\n align-items: center;\n color: ${t.dark ? t.color.gray[300] : t.color.black};\n svg {\n ${t.mr(1)}\n }\n `;\n});\n","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\n(function (global, factory) {\n (typeof exports === \"undefined\" ? \"undefined\" : _typeof(exports)) === \"object\" && typeof module !== \"undefined\" ? factory(exports) : typeof define === \"function\" && define.amd ? define([\"exports\"], factory) : factory(global.ActiveStorage = {});\n})(this, function (exports) {\n \"use strict\";\n\n function createCommonjsModule(fn, module) {\n return module = {\n exports: {}\n }, fn(module, module.exports), module.exports;\n }\n\n var sparkMd5 = createCommonjsModule(function (module, exports) {\n (function (factory) {\n {\n module.exports = factory();\n }\n })(function (undefined) {\n var hex_chr = [\"0\", \"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"a\", \"b\", \"c\", \"d\", \"e\", \"f\"];\n\n function md5cycle(x, k) {\n var a = x[0],\n b = x[1],\n c = x[2],\n d = x[3];\n a += (b & c | ~b & d) + k[0] - 680876936 | 0;\n a = (a << 7 | a >>> 25) + b | 0;\n d += (a & b | ~a & c) + k[1] - 389564586 | 0;\n d = (d << 12 | d >>> 20) + a | 0;\n c += (d & a | ~d & b) + k[2] + 606105819 | 0;\n c = (c << 17 | c >>> 15) + d | 0;\n b += (c & d | ~c & a) + k[3] - 1044525330 | 0;\n b = (b << 22 | b >>> 10) + c | 0;\n a += (b & c | ~b & d) + k[4] - 176418897 | 0;\n a = (a << 7 | a >>> 25) + b | 0;\n d += (a & b | ~a & c) + k[5] + 1200080426 | 0;\n d = (d << 12 | d >>> 20) + a | 0;\n c += (d & a | ~d & b) + k[6] - 1473231341 | 0;\n c = (c << 17 | c >>> 15) + d | 0;\n b += (c & d | ~c & a) + k[7] - 45705983 | 0;\n b = (b << 22 | b >>> 10) + c | 0;\n a += (b & c | ~b & d) + k[8] + 1770035416 | 0;\n a = (a << 7 | a >>> 25) + b | 0;\n d += (a & b | ~a & c) + k[9] - 1958414417 | 0;\n d = (d << 12 | d >>> 20) + a | 0;\n c += (d & a | ~d & b) + k[10] - 42063 | 0;\n c = (c << 17 | c >>> 15) + d | 0;\n b += (c & d | ~c & a) + k[11] - 1990404162 | 0;\n b = (b << 22 | b >>> 10) + c | 0;\n a += (b & c | ~b & d) + k[12] + 1804603682 | 0;\n a = (a << 7 | a >>> 25) + b | 0;\n d += (a & b | ~a & c) + k[13] - 40341101 | 0;\n d = (d << 12 | d >>> 20) + a | 0;\n c += (d & a | ~d & b) + k[14] - 1502002290 | 0;\n c = (c << 17 | c >>> 15) + d | 0;\n b += (c & d | ~c & a) + k[15] + 1236535329 | 0;\n b = (b << 22 | b >>> 10) + c | 0;\n a += (b & d | c & ~d) + k[1] - 165796510 | 0;\n a = (a << 5 | a >>> 27) + b | 0;\n d += (a & c | b & ~c) + k[6] - 1069501632 | 0;\n d = (d << 9 | d >>> 23) + a | 0;\n c += (d & b | a & ~b) + k[11] + 643717713 | 0;\n c = (c << 14 | c >>> 18) + d | 0;\n b += (c & a | d & ~a) + k[0] - 373897302 | 0;\n b = (b << 20 | b >>> 12) + c | 0;\n a += (b & d | c & ~d) + k[5] - 701558691 | 0;\n a = (a << 5 | a >>> 27) + b | 0;\n d += (a & c | b & ~c) + k[10] + 38016083 | 0;\n d = (d << 9 | d >>> 23) + a | 0;\n c += (d & b | a & ~b) + k[15] - 660478335 | 0;\n c = (c << 14 | c >>> 18) + d | 0;\n b += (c & a | d & ~a) + k[4] - 405537848 | 0;\n b = (b << 20 | b >>> 12) + c | 0;\n a += (b & d | c & ~d) + k[9] + 568446438 | 0;\n a = (a << 5 | a >>> 27) + b | 0;\n d += (a & c | b & ~c) + k[14] - 1019803690 | 0;\n d = (d << 9 | d >>> 23) + a | 0;\n c += (d & b | a & ~b) + k[3] - 187363961 | 0;\n c = (c << 14 | c >>> 18) + d | 0;\n b += (c & a | d & ~a) + k[8] + 1163531501 | 0;\n b = (b << 20 | b >>> 12) + c | 0;\n a += (b & d | c & ~d) + k[13] - 1444681467 | 0;\n a = (a << 5 | a >>> 27) + b | 0;\n d += (a & c | b & ~c) + k[2] - 51403784 | 0;\n d = (d << 9 | d >>> 23) + a | 0;\n c += (d & b | a & ~b) + k[7] + 1735328473 | 0;\n c = (c << 14 | c >>> 18) + d | 0;\n b += (c & a | d & ~a) + k[12] - 1926607734 | 0;\n b = (b << 20 | b >>> 12) + c | 0;\n a += (b ^ c ^ d) + k[5] - 378558 | 0;\n a = (a << 4 | a >>> 28) + b | 0;\n d += (a ^ b ^ c) + k[8] - 2022574463 | 0;\n d = (d << 11 | d >>> 21) + a | 0;\n c += (d ^ a ^ b) + k[11] + 1839030562 | 0;\n c = (c << 16 | c >>> 16) + d | 0;\n b += (c ^ d ^ a) + k[14] - 35309556 | 0;\n b = (b << 23 | b >>> 9) + c | 0;\n a += (b ^ c ^ d) + k[1] - 1530992060 | 0;\n a = (a << 4 | a >>> 28) + b | 0;\n d += (a ^ b ^ c) + k[4] + 1272893353 | 0;\n d = (d << 11 | d >>> 21) + a | 0;\n c += (d ^ a ^ b) + k[7] - 155497632 | 0;\n c = (c << 16 | c >>> 16) + d | 0;\n b += (c ^ d ^ a) + k[10] - 1094730640 | 0;\n b = (b << 23 | b >>> 9) + c | 0;\n a += (b ^ c ^ d) + k[13] + 681279174 | 0;\n a = (a << 4 | a >>> 28) + b | 0;\n d += (a ^ b ^ c) + k[0] - 358537222 | 0;\n d = (d << 11 | d >>> 21) + a | 0;\n c += (d ^ a ^ b) + k[3] - 722521979 | 0;\n c = (c << 16 | c >>> 16) + d | 0;\n b += (c ^ d ^ a) + k[6] + 76029189 | 0;\n b = (b << 23 | b >>> 9) + c | 0;\n a += (b ^ c ^ d) + k[9] - 640364487 | 0;\n a = (a << 4 | a >>> 28) + b | 0;\n d += (a ^ b ^ c) + k[12] - 421815835 | 0;\n d = (d << 11 | d >>> 21) + a | 0;\n c += (d ^ a ^ b) + k[15] + 530742520 | 0;\n c = (c << 16 | c >>> 16) + d | 0;\n b += (c ^ d ^ a) + k[2] - 995338651 | 0;\n b = (b << 23 | b >>> 9) + c | 0;\n a += (c ^ (b | ~d)) + k[0] - 198630844 | 0;\n a = (a << 6 | a >>> 26) + b | 0;\n d += (b ^ (a | ~c)) + k[7] + 1126891415 | 0;\n d = (d << 10 | d >>> 22) + a | 0;\n c += (a ^ (d | ~b)) + k[14] - 1416354905 | 0;\n c = (c << 15 | c >>> 17) + d | 0;\n b += (d ^ (c | ~a)) + k[5] - 57434055 | 0;\n b = (b << 21 | b >>> 11) + c | 0;\n a += (c ^ (b | ~d)) + k[12] + 1700485571 | 0;\n a = (a << 6 | a >>> 26) + b | 0;\n d += (b ^ (a | ~c)) + k[3] - 1894986606 | 0;\n d = (d << 10 | d >>> 22) + a | 0;\n c += (a ^ (d | ~b)) + k[10] - 1051523 | 0;\n c = (c << 15 | c >>> 17) + d | 0;\n b += (d ^ (c | ~a)) + k[1] - 2054922799 | 0;\n b = (b << 21 | b >>> 11) + c | 0;\n a += (c ^ (b | ~d)) + k[8] + 1873313359 | 0;\n a = (a << 6 | a >>> 26) + b | 0;\n d += (b ^ (a | ~c)) + k[15] - 30611744 | 0;\n d = (d << 10 | d >>> 22) + a | 0;\n c += (a ^ (d | ~b)) + k[6] - 1560198380 | 0;\n c = (c << 15 | c >>> 17) + d | 0;\n b += (d ^ (c | ~a)) + k[13] + 1309151649 | 0;\n b = (b << 21 | b >>> 11) + c | 0;\n a += (c ^ (b | ~d)) + k[4] - 145523070 | 0;\n a = (a << 6 | a >>> 26) + b | 0;\n d += (b ^ (a | ~c)) + k[11] - 1120210379 | 0;\n d = (d << 10 | d >>> 22) + a | 0;\n c += (a ^ (d | ~b)) + k[2] + 718787259 | 0;\n c = (c << 15 | c >>> 17) + d | 0;\n b += (d ^ (c | ~a)) + k[9] - 343485551 | 0;\n b = (b << 21 | b >>> 11) + c | 0;\n x[0] = a + x[0] | 0;\n x[1] = b + x[1] | 0;\n x[2] = c + x[2] | 0;\n x[3] = d + x[3] | 0;\n }\n\n function md5blk(s) {\n var md5blks = [],\n i;\n\n for (i = 0; i < 64; i += 4) {\n md5blks[i >> 2] = s.charCodeAt(i) + (s.charCodeAt(i + 1) << 8) + (s.charCodeAt(i + 2) << 16) + (s.charCodeAt(i + 3) << 24);\n }\n\n return md5blks;\n }\n\n function md5blk_array(a) {\n var md5blks = [],\n i;\n\n for (i = 0; i < 64; i += 4) {\n md5blks[i >> 2] = a[i] + (a[i + 1] << 8) + (a[i + 2] << 16) + (a[i + 3] << 24);\n }\n\n return md5blks;\n }\n\n function md51(s) {\n var n = s.length,\n state = [1732584193, -271733879, -1732584194, 271733878],\n i,\n length,\n tail,\n tmp,\n lo,\n hi;\n\n for (i = 64; i <= n; i += 64) {\n md5cycle(state, md5blk(s.substring(i - 64, i)));\n }\n\n s = s.substring(i - 64);\n length = s.length;\n tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];\n\n for (i = 0; i < length; i += 1) {\n tail[i >> 2] |= s.charCodeAt(i) << (i % 4 << 3);\n }\n\n tail[i >> 2] |= 128 << (i % 4 << 3);\n\n if (i > 55) {\n md5cycle(state, tail);\n\n for (i = 0; i < 16; i += 1) {\n tail[i] = 0;\n }\n }\n\n tmp = n * 8;\n tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);\n lo = parseInt(tmp[2], 16);\n hi = parseInt(tmp[1], 16) || 0;\n tail[14] = lo;\n tail[15] = hi;\n md5cycle(state, tail);\n return state;\n }\n\n function md51_array(a) {\n var n = a.length,\n state = [1732584193, -271733879, -1732584194, 271733878],\n i,\n length,\n tail,\n tmp,\n lo,\n hi;\n\n for (i = 64; i <= n; i += 64) {\n md5cycle(state, md5blk_array(a.subarray(i - 64, i)));\n }\n\n a = i - 64 < n ? a.subarray(i - 64) : new Uint8Array(0);\n length = a.length;\n tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];\n\n for (i = 0; i < length; i += 1) {\n tail[i >> 2] |= a[i] << (i % 4 << 3);\n }\n\n tail[i >> 2] |= 128 << (i % 4 << 3);\n\n if (i > 55) {\n md5cycle(state, tail);\n\n for (i = 0; i < 16; i += 1) {\n tail[i] = 0;\n }\n }\n\n tmp = n * 8;\n tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);\n lo = parseInt(tmp[2], 16);\n hi = parseInt(tmp[1], 16) || 0;\n tail[14] = lo;\n tail[15] = hi;\n md5cycle(state, tail);\n return state;\n }\n\n function rhex(n) {\n var s = \"\",\n j;\n\n for (j = 0; j < 4; j += 1) {\n s += hex_chr[n >> j * 8 + 4 & 15] + hex_chr[n >> j * 8 & 15];\n }\n\n return s;\n }\n\n function hex(x) {\n var i;\n\n for (i = 0; i < x.length; i += 1) {\n x[i] = rhex(x[i]);\n }\n\n return x.join(\"\");\n }\n\n if (hex(md51(\"hello\")) !== \"5d41402abc4b2a76b9719d911017c592\") ;\n\n if (typeof ArrayBuffer !== \"undefined\" && !ArrayBuffer.prototype.slice) {\n (function () {\n function clamp(val, length) {\n val = val | 0 || 0;\n\n if (val < 0) {\n return Math.max(val + length, 0);\n }\n\n return Math.min(val, length);\n }\n\n ArrayBuffer.prototype.slice = function (from, to) {\n var length = this.byteLength,\n begin = clamp(from, length),\n end = length,\n num,\n target,\n targetArray,\n sourceArray;\n\n if (to !== undefined) {\n end = clamp(to, length);\n }\n\n if (begin > end) {\n return new ArrayBuffer(0);\n }\n\n num = end - begin;\n target = new ArrayBuffer(num);\n targetArray = new Uint8Array(target);\n sourceArray = new Uint8Array(this, begin, num);\n targetArray.set(sourceArray);\n return target;\n };\n })();\n }\n\n function toUtf8(str) {\n if (/[\\u0080-\\uFFFF]/.test(str)) {\n str = unescape(encodeURIComponent(str));\n }\n\n return str;\n }\n\n function utf8Str2ArrayBuffer(str, returnUInt8Array) {\n var length = str.length,\n buff = new ArrayBuffer(length),\n arr = new Uint8Array(buff),\n i;\n\n for (i = 0; i < length; i += 1) {\n arr[i] = str.charCodeAt(i);\n }\n\n return returnUInt8Array ? arr : buff;\n }\n\n function arrayBuffer2Utf8Str(buff) {\n return String.fromCharCode.apply(null, new Uint8Array(buff));\n }\n\n function concatenateArrayBuffers(first, second, returnUInt8Array) {\n var result = new Uint8Array(first.byteLength + second.byteLength);\n result.set(new Uint8Array(first));\n result.set(new Uint8Array(second), first.byteLength);\n return returnUInt8Array ? result : result.buffer;\n }\n\n function hexToBinaryString(hex) {\n var bytes = [],\n length = hex.length,\n x;\n\n for (x = 0; x < length - 1; x += 2) {\n bytes.push(parseInt(hex.substr(x, 2), 16));\n }\n\n return String.fromCharCode.apply(String, bytes);\n }\n\n function SparkMD5() {\n this.reset();\n }\n\n SparkMD5.prototype.append = function (str) {\n this.appendBinary(toUtf8(str));\n return this;\n };\n\n SparkMD5.prototype.appendBinary = function (contents) {\n this._buff += contents;\n this._length += contents.length;\n var length = this._buff.length,\n i;\n\n for (i = 64; i <= length; i += 64) {\n md5cycle(this._hash, md5blk(this._buff.substring(i - 64, i)));\n }\n\n this._buff = this._buff.substring(i - 64);\n return this;\n };\n\n SparkMD5.prototype.end = function (raw) {\n var buff = this._buff,\n length = buff.length,\n i,\n tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n ret;\n\n for (i = 0; i < length; i += 1) {\n tail[i >> 2] |= buff.charCodeAt(i) << (i % 4 << 3);\n }\n\n this._finish(tail, length);\n\n ret = hex(this._hash);\n\n if (raw) {\n ret = hexToBinaryString(ret);\n }\n\n this.reset();\n return ret;\n };\n\n SparkMD5.prototype.reset = function () {\n this._buff = \"\";\n this._length = 0;\n this._hash = [1732584193, -271733879, -1732584194, 271733878];\n return this;\n };\n\n SparkMD5.prototype.getState = function () {\n return {\n buff: this._buff,\n length: this._length,\n hash: this._hash\n };\n };\n\n SparkMD5.prototype.setState = function (state) {\n this._buff = state.buff;\n this._length = state.length;\n this._hash = state.hash;\n return this;\n };\n\n SparkMD5.prototype.destroy = function () {\n delete this._hash;\n delete this._buff;\n delete this._length;\n };\n\n SparkMD5.prototype._finish = function (tail, length) {\n var i = length,\n tmp,\n lo,\n hi;\n tail[i >> 2] |= 128 << (i % 4 << 3);\n\n if (i > 55) {\n md5cycle(this._hash, tail);\n\n for (i = 0; i < 16; i += 1) {\n tail[i] = 0;\n }\n }\n\n tmp = this._length * 8;\n tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);\n lo = parseInt(tmp[2], 16);\n hi = parseInt(tmp[1], 16) || 0;\n tail[14] = lo;\n tail[15] = hi;\n md5cycle(this._hash, tail);\n };\n\n SparkMD5.hash = function (str, raw) {\n return SparkMD5.hashBinary(toUtf8(str), raw);\n };\n\n SparkMD5.hashBinary = function (content, raw) {\n var hash = md51(content),\n ret = hex(hash);\n return raw ? hexToBinaryString(ret) : ret;\n };\n\n SparkMD5.ArrayBuffer = function () {\n this.reset();\n };\n\n SparkMD5.ArrayBuffer.prototype.append = function (arr) {\n var buff = concatenateArrayBuffers(this._buff.buffer, arr, true),\n length = buff.length,\n i;\n this._length += arr.byteLength;\n\n for (i = 64; i <= length; i += 64) {\n md5cycle(this._hash, md5blk_array(buff.subarray(i - 64, i)));\n }\n\n this._buff = i - 64 < length ? new Uint8Array(buff.buffer.slice(i - 64)) : new Uint8Array(0);\n return this;\n };\n\n SparkMD5.ArrayBuffer.prototype.end = function (raw) {\n var buff = this._buff,\n length = buff.length,\n tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n i,\n ret;\n\n for (i = 0; i < length; i += 1) {\n tail[i >> 2] |= buff[i] << (i % 4 << 3);\n }\n\n this._finish(tail, length);\n\n ret = hex(this._hash);\n\n if (raw) {\n ret = hexToBinaryString(ret);\n }\n\n this.reset();\n return ret;\n };\n\n SparkMD5.ArrayBuffer.prototype.reset = function () {\n this._buff = new Uint8Array(0);\n this._length = 0;\n this._hash = [1732584193, -271733879, -1732584194, 271733878];\n return this;\n };\n\n SparkMD5.ArrayBuffer.prototype.getState = function () {\n var state = SparkMD5.prototype.getState.call(this);\n state.buff = arrayBuffer2Utf8Str(state.buff);\n return state;\n };\n\n SparkMD5.ArrayBuffer.prototype.setState = function (state) {\n state.buff = utf8Str2ArrayBuffer(state.buff, true);\n return SparkMD5.prototype.setState.call(this, state);\n };\n\n SparkMD5.ArrayBuffer.prototype.destroy = SparkMD5.prototype.destroy;\n SparkMD5.ArrayBuffer.prototype._finish = SparkMD5.prototype._finish;\n\n SparkMD5.ArrayBuffer.hash = function (arr, raw) {\n var hash = md51_array(new Uint8Array(arr)),\n ret = hex(hash);\n return raw ? hexToBinaryString(ret) : ret;\n };\n\n return SparkMD5;\n });\n });\n\n var classCallCheck = function classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n };\n\n var createClass = function () {\n function defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n }\n\n return function (Constructor, protoProps, staticProps) {\n if (protoProps) defineProperties(Constructor.prototype, protoProps);\n if (staticProps) defineProperties(Constructor, staticProps);\n return Constructor;\n };\n }();\n\n var fileSlice = File.prototype.slice || File.prototype.mozSlice || File.prototype.webkitSlice;\n\n var FileChecksum = function () {\n createClass(FileChecksum, null, [{\n key: \"create\",\n value: function create(file, callback) {\n var instance = new FileChecksum(file);\n instance.create(callback);\n }\n }]);\n\n function FileChecksum(file) {\n classCallCheck(this, FileChecksum);\n this.file = file;\n this.chunkSize = 2097152;\n this.chunkCount = Math.ceil(this.file.size / this.chunkSize);\n this.chunkIndex = 0;\n }\n\n createClass(FileChecksum, [{\n key: \"create\",\n value: function create(callback) {\n var _this = this;\n\n this.callback = callback;\n this.md5Buffer = new sparkMd5.ArrayBuffer();\n this.fileReader = new FileReader();\n this.fileReader.addEventListener(\"load\", function (event) {\n return _this.fileReaderDidLoad(event);\n });\n this.fileReader.addEventListener(\"error\", function (event) {\n return _this.fileReaderDidError(event);\n });\n this.readNextChunk();\n }\n }, {\n key: \"fileReaderDidLoad\",\n value: function fileReaderDidLoad(event) {\n this.md5Buffer.append(event.target.result);\n\n if (!this.readNextChunk()) {\n var binaryDigest = this.md5Buffer.end(true);\n var base64digest = btoa(binaryDigest);\n this.callback(null, base64digest);\n }\n }\n }, {\n key: \"fileReaderDidError\",\n value: function fileReaderDidError(event) {\n this.callback(\"Error reading \" + this.file.name);\n }\n }, {\n key: \"readNextChunk\",\n value: function readNextChunk() {\n if (this.chunkIndex < this.chunkCount || this.chunkIndex == 0 && this.chunkCount == 0) {\n var start = this.chunkIndex * this.chunkSize;\n var end = Math.min(start + this.chunkSize, this.file.size);\n var bytes = fileSlice.call(this.file, start, end);\n this.fileReader.readAsArrayBuffer(bytes);\n this.chunkIndex++;\n return true;\n } else {\n return false;\n }\n }\n }]);\n return FileChecksum;\n }();\n\n function getMetaValue(name) {\n var element = findElement(document.head, 'meta[name=\"' + name + '\"]');\n\n if (element) {\n return element.getAttribute(\"content\");\n }\n }\n\n function findElements(root, selector) {\n if (typeof root == \"string\") {\n selector = root;\n root = document;\n }\n\n var elements = root.querySelectorAll(selector);\n return toArray$1(elements);\n }\n\n function findElement(root, selector) {\n if (typeof root == \"string\") {\n selector = root;\n root = document;\n }\n\n return root.querySelector(selector);\n }\n\n function dispatchEvent(element, type) {\n var eventInit = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n var disabled = element.disabled;\n var bubbles = eventInit.bubbles,\n cancelable = eventInit.cancelable,\n detail = eventInit.detail;\n var event = document.createEvent(\"Event\");\n event.initEvent(type, bubbles || true, cancelable || true);\n event.detail = detail || {};\n\n try {\n element.disabled = false;\n element.dispatchEvent(event);\n } finally {\n element.disabled = disabled;\n }\n\n return event;\n }\n\n function toArray$1(value) {\n if (Array.isArray(value)) {\n return value;\n } else if (Array.from) {\n return Array.from(value);\n } else {\n return [].slice.call(value);\n }\n }\n\n var BlobRecord = function () {\n function BlobRecord(file, checksum, url) {\n var _this = this;\n\n classCallCheck(this, BlobRecord);\n this.file = file;\n this.attributes = {\n filename: file.name,\n content_type: file.type,\n byte_size: file.size,\n checksum: checksum\n };\n this.xhr = new XMLHttpRequest();\n this.xhr.open(\"POST\", url, true);\n this.xhr.responseType = \"json\";\n this.xhr.setRequestHeader(\"Content-Type\", \"application/json\");\n this.xhr.setRequestHeader(\"Accept\", \"application/json\");\n this.xhr.setRequestHeader(\"X-Requested-With\", \"XMLHttpRequest\");\n this.xhr.setRequestHeader(\"X-CSRF-Token\", getMetaValue(\"csrf-token\"));\n this.xhr.addEventListener(\"load\", function (event) {\n return _this.requestDidLoad(event);\n });\n this.xhr.addEventListener(\"error\", function (event) {\n return _this.requestDidError(event);\n });\n }\n\n createClass(BlobRecord, [{\n key: \"create\",\n value: function create(callback) {\n this.callback = callback;\n this.xhr.send(JSON.stringify({\n blob: this.attributes\n }));\n }\n }, {\n key: \"requestDidLoad\",\n value: function requestDidLoad(event) {\n if (this.status >= 200 && this.status < 300) {\n var response = this.response;\n var direct_upload = response.direct_upload;\n delete response.direct_upload;\n this.attributes = response;\n this.directUploadData = direct_upload;\n this.callback(null, this.toJSON());\n } else {\n this.requestDidError(event);\n }\n }\n }, {\n key: \"requestDidError\",\n value: function requestDidError(event) {\n this.callback('Error creating Blob for \"' + this.file.name + '\". Status: ' + this.status);\n }\n }, {\n key: \"toJSON\",\n value: function toJSON() {\n var result = {};\n\n for (var key in this.attributes) {\n result[key] = this.attributes[key];\n }\n\n return result;\n }\n }, {\n key: \"status\",\n get: function get$$1() {\n return this.xhr.status;\n }\n }, {\n key: \"response\",\n get: function get$$1() {\n var _xhr = this.xhr,\n responseType = _xhr.responseType,\n response = _xhr.response;\n\n if (responseType == \"json\") {\n return response;\n } else {\n return JSON.parse(response);\n }\n }\n }]);\n return BlobRecord;\n }();\n\n var BlobUpload = function () {\n function BlobUpload(blob) {\n var _this = this;\n\n classCallCheck(this, BlobUpload);\n this.blob = blob;\n this.file = blob.file;\n var _blob$directUploadDat = blob.directUploadData,\n url = _blob$directUploadDat.url,\n headers = _blob$directUploadDat.headers;\n this.xhr = new XMLHttpRequest();\n this.xhr.open(\"PUT\", url, true);\n this.xhr.responseType = \"text\";\n\n for (var key in headers) {\n this.xhr.setRequestHeader(key, headers[key]);\n }\n\n this.xhr.addEventListener(\"load\", function (event) {\n return _this.requestDidLoad(event);\n });\n this.xhr.addEventListener(\"error\", function (event) {\n return _this.requestDidError(event);\n });\n }\n\n createClass(BlobUpload, [{\n key: \"create\",\n value: function create(callback) {\n this.callback = callback;\n this.xhr.send(this.file.slice());\n }\n }, {\n key: \"requestDidLoad\",\n value: function requestDidLoad(event) {\n var _xhr = this.xhr,\n status = _xhr.status,\n response = _xhr.response;\n\n if (status >= 200 && status < 300) {\n this.callback(null, response);\n } else {\n this.requestDidError(event);\n }\n }\n }, {\n key: \"requestDidError\",\n value: function requestDidError(event) {\n this.callback('Error storing \"' + this.file.name + '\". Status: ' + this.xhr.status);\n }\n }]);\n return BlobUpload;\n }();\n\n var id = 0;\n\n var DirectUpload = function () {\n function DirectUpload(file, url, delegate) {\n classCallCheck(this, DirectUpload);\n this.id = ++id;\n this.file = file;\n this.url = url;\n this.delegate = delegate;\n }\n\n createClass(DirectUpload, [{\n key: \"create\",\n value: function create(callback) {\n var _this = this;\n\n FileChecksum.create(this.file, function (error, checksum) {\n if (error) {\n callback(error);\n return;\n }\n\n var blob = new BlobRecord(_this.file, checksum, _this.url);\n notify(_this.delegate, \"directUploadWillCreateBlobWithXHR\", blob.xhr);\n blob.create(function (error) {\n if (error) {\n callback(error);\n } else {\n var upload = new BlobUpload(blob);\n notify(_this.delegate, \"directUploadWillStoreFileWithXHR\", upload.xhr);\n upload.create(function (error) {\n if (error) {\n callback(error);\n } else {\n callback(null, blob.toJSON());\n }\n });\n }\n });\n });\n }\n }]);\n return DirectUpload;\n }();\n\n function notify(object, methodName) {\n if (object && typeof object[methodName] == \"function\") {\n for (var _len = arguments.length, messages = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {\n messages[_key - 2] = arguments[_key];\n }\n\n return object[methodName].apply(object, messages);\n }\n }\n\n var DirectUploadController = function () {\n function DirectUploadController(input, file) {\n classCallCheck(this, DirectUploadController);\n this.input = input;\n this.file = file;\n this.directUpload = new DirectUpload(this.file, this.url, this);\n this.dispatch(\"initialize\");\n }\n\n createClass(DirectUploadController, [{\n key: \"start\",\n value: function start(callback) {\n var _this = this;\n\n var hiddenInput = document.createElement(\"input\");\n hiddenInput.type = \"hidden\";\n hiddenInput.name = this.input.name;\n this.input.insertAdjacentElement(\"beforebegin\", hiddenInput);\n this.dispatch(\"start\");\n this.directUpload.create(function (error, attributes) {\n if (error) {\n hiddenInput.parentNode.removeChild(hiddenInput);\n\n _this.dispatchError(error);\n } else {\n hiddenInput.value = attributes.signed_id;\n }\n\n _this.dispatch(\"end\");\n\n callback(error);\n });\n }\n }, {\n key: \"uploadRequestDidProgress\",\n value: function uploadRequestDidProgress(event) {\n var progress = event.loaded / event.total * 100;\n\n if (progress) {\n this.dispatch(\"progress\", {\n progress: progress\n });\n }\n }\n }, {\n key: \"dispatch\",\n value: function dispatch(name) {\n var detail = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n detail.file = this.file;\n detail.id = this.directUpload.id;\n return dispatchEvent(this.input, \"direct-upload:\" + name, {\n detail: detail\n });\n }\n }, {\n key: \"dispatchError\",\n value: function dispatchError(error) {\n var event = this.dispatch(\"error\", {\n error: error\n });\n\n if (!event.defaultPrevented) {\n alert(error);\n }\n }\n }, {\n key: \"directUploadWillCreateBlobWithXHR\",\n value: function directUploadWillCreateBlobWithXHR(xhr) {\n this.dispatch(\"before-blob-request\", {\n xhr: xhr\n });\n }\n }, {\n key: \"directUploadWillStoreFileWithXHR\",\n value: function directUploadWillStoreFileWithXHR(xhr) {\n var _this2 = this;\n\n this.dispatch(\"before-storage-request\", {\n xhr: xhr\n });\n xhr.upload.addEventListener(\"progress\", function (event) {\n return _this2.uploadRequestDidProgress(event);\n });\n }\n }, {\n key: \"url\",\n get: function get$$1() {\n return this.input.getAttribute(\"data-direct-upload-url\");\n }\n }]);\n return DirectUploadController;\n }();\n\n var inputSelector = \"input[type=file][data-direct-upload-url]:not([disabled])\";\n\n var DirectUploadsController = function () {\n function DirectUploadsController(form) {\n classCallCheck(this, DirectUploadsController);\n this.form = form;\n this.inputs = findElements(form, inputSelector).filter(function (input) {\n return input.files.length;\n });\n }\n\n createClass(DirectUploadsController, [{\n key: \"start\",\n value: function start(callback) {\n var _this = this;\n\n var controllers = this.createDirectUploadControllers();\n\n var startNextController = function startNextController() {\n var controller = controllers.shift();\n\n if (controller) {\n controller.start(function (error) {\n if (error) {\n callback(error);\n\n _this.dispatch(\"end\");\n } else {\n startNextController();\n }\n });\n } else {\n callback();\n\n _this.dispatch(\"end\");\n }\n };\n\n this.dispatch(\"start\");\n startNextController();\n }\n }, {\n key: \"createDirectUploadControllers\",\n value: function createDirectUploadControllers() {\n var controllers = [];\n this.inputs.forEach(function (input) {\n toArray$1(input.files).forEach(function (file) {\n var controller = new DirectUploadController(input, file);\n controllers.push(controller);\n });\n });\n return controllers;\n }\n }, {\n key: \"dispatch\",\n value: function dispatch(name) {\n var detail = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return dispatchEvent(this.form, \"direct-uploads:\" + name, {\n detail: detail\n });\n }\n }]);\n return DirectUploadsController;\n }();\n\n var processingAttribute = \"data-direct-uploads-processing\";\n var submitButtonsByForm = new WeakMap();\n var started = false;\n\n function start() {\n if (!started) {\n started = true;\n document.addEventListener(\"click\", didClick, true);\n document.addEventListener(\"submit\", didSubmitForm);\n document.addEventListener(\"ajax:before\", didSubmitRemoteElement);\n }\n }\n\n function didClick(event) {\n var target = event.target;\n\n if ((target.tagName == \"INPUT\" || target.tagName == \"BUTTON\") && target.type == \"submit\" && target.form) {\n submitButtonsByForm.set(target.form, target);\n }\n }\n\n function didSubmitForm(event) {\n handleFormSubmissionEvent(event);\n }\n\n function didSubmitRemoteElement(event) {\n if (event.target.tagName == \"FORM\") {\n handleFormSubmissionEvent(event);\n }\n }\n\n function handleFormSubmissionEvent(event) {\n var form = event.target;\n\n if (form.hasAttribute(processingAttribute)) {\n event.preventDefault();\n return;\n }\n\n var controller = new DirectUploadsController(form);\n var inputs = controller.inputs;\n\n if (inputs.length) {\n event.preventDefault();\n form.setAttribute(processingAttribute, \"\");\n inputs.forEach(disable);\n controller.start(function (error) {\n form.removeAttribute(processingAttribute);\n\n if (error) {\n inputs.forEach(enable);\n } else {\n submitForm(form);\n }\n });\n }\n }\n\n function submitForm(form) {\n var button = submitButtonsByForm.get(form) || findElement(form, \"input[type=submit], button[type=submit]\");\n\n if (button) {\n var _button = button,\n disabled = _button.disabled;\n button.disabled = false;\n button.focus();\n button.click();\n button.disabled = disabled;\n } else {\n button = document.createElement(\"input\");\n button.type = \"submit\";\n button.style.display = \"none\";\n form.appendChild(button);\n button.click();\n form.removeChild(button);\n }\n\n submitButtonsByForm[\"delete\"](form);\n }\n\n function disable(input) {\n input.disabled = true;\n }\n\n function enable(input) {\n input.disabled = false;\n }\n\n function autostart() {\n if (window.ActiveStorage) {\n start();\n }\n }\n\n setTimeout(autostart, 1);\n exports.start = start;\n exports.DirectUpload = DirectUpload;\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n});","import { __assign, __rest } from './_virtual/_tslib.js';\nimport { toSCXMLEvent, isFunction, toEventObject, getEventType, isString, isArray } from './utils.js';\nimport { SpecialTargets, ActionTypes } from './types.js';\nimport { send as send$1, update, assign as assign$1, raise as raise$1, init, log as log$1, cancel as cancel$1, error as error$1 } from './actionTypes.js';\nvar initEvent = /*#__PURE__*/toSCXMLEvent({\n type: init\n});\n\nfunction getActionFunction(actionType, actionFunctionMap) {\n return actionFunctionMap ? actionFunctionMap[actionType] || undefined : undefined;\n}\n\nfunction toActionObject(action, actionFunctionMap) {\n var actionObject;\n\n if (isString(action) || typeof action === 'number') {\n var exec = getActionFunction(action, actionFunctionMap);\n\n if (isFunction(exec)) {\n actionObject = {\n type: action,\n exec: exec\n };\n } else if (exec) {\n actionObject = exec;\n } else {\n actionObject = {\n type: action,\n exec: undefined\n };\n }\n } else if (isFunction(action)) {\n actionObject = {\n // Convert action to string if unnamed\n type: action.name || action.toString(),\n exec: action\n };\n } else {\n var exec = getActionFunction(action.type, actionFunctionMap);\n\n if (isFunction(exec)) {\n actionObject = __assign(__assign({}, action), {\n exec: exec\n });\n } else if (exec) {\n var type = action.type,\n other = __rest(action, [\"type\"]);\n\n actionObject = __assign(__assign({\n type: type\n }, exec), other);\n } else {\n actionObject = action;\n }\n }\n\n Object.defineProperty(actionObject, 'toString', {\n value: function value() {\n return actionObject.type;\n },\n enumerable: false,\n configurable: true\n });\n return actionObject;\n}\n\nvar toActionObjects = function toActionObjects(action, actionFunctionMap) {\n if (!action) {\n return [];\n }\n\n var actions = isArray(action) ? action : [action];\n return actions.map(function (subAction) {\n return toActionObject(subAction, actionFunctionMap);\n });\n};\n\nfunction toActivityDefinition(action) {\n var actionObject = toActionObject(action);\n return __assign(__assign({\n id: isString(action) ? action : actionObject.id\n }, actionObject), {\n type: actionObject.type\n });\n}\n/**\r\n * Raises an event. This places the event in the internal event queue, so that\r\n * the event is immediately consumed by the machine in the current step.\r\n *\r\n * @param eventType The event to raise.\r\n */\n\n\nfunction raise(event) {\n if (!isString(event)) {\n return send(event, {\n to: SpecialTargets.Internal\n });\n }\n\n return {\n type: raise$1,\n event: event\n };\n}\n\nfunction resolveRaise(action) {\n return {\n type: raise$1,\n _event: toSCXMLEvent(action.event)\n };\n}\n/**\r\n * Sends an event. This returns an action that will be read by an interpreter to\r\n * send the event in the next step, after the current step is finished executing.\r\n *\r\n * @param event The event to send.\r\n * @param options Options to pass into the send event:\r\n * - `id` - The unique send event identifier (used with `cancel()`).\r\n * - `delay` - The number of milliseconds to delay the sending of the event.\r\n * - `to` - The target of this event (by default, the machine the event was sent from).\r\n */\n\n\nfunction send(event, options) {\n return {\n to: options ? options.to : undefined,\n type: send$1,\n event: isFunction(event) ? event : toEventObject(event),\n delay: options ? options.delay : undefined,\n id: options && options.id !== undefined ? options.id : isFunction(event) ? event.name : getEventType(event)\n };\n}\n\nfunction resolveSend(action, ctx, _event, delaysMap) {\n var meta = {\n _event: _event\n }; // TODO: helper function for resolving Expr\n\n var resolvedEvent = toSCXMLEvent(isFunction(action.event) ? action.event(ctx, _event.data, meta) : action.event);\n var resolvedDelay;\n\n if (isString(action.delay)) {\n var configDelay = delaysMap && delaysMap[action.delay];\n resolvedDelay = isFunction(configDelay) ? configDelay(ctx, _event.data, meta) : configDelay;\n } else {\n resolvedDelay = isFunction(action.delay) ? action.delay(ctx, _event.data, meta) : action.delay;\n }\n\n var resolvedTarget = isFunction(action.to) ? action.to(ctx, _event.data, meta) : action.to;\n return __assign(__assign({}, action), {\n to: resolvedTarget,\n _event: resolvedEvent,\n event: resolvedEvent.data,\n delay: resolvedDelay\n });\n}\n/**\r\n * Sends an event to this machine's parent.\r\n *\r\n * @param event The event to send to the parent machine.\r\n * @param options Options to pass into the send event.\r\n */\n\n\nfunction sendParent(event, options) {\n return send(event, __assign(__assign({}, options), {\n to: SpecialTargets.Parent\n }));\n}\n/**\r\n * Sends an update event to this machine's parent.\r\n */\n\n\nfunction sendUpdate() {\n return sendParent(update);\n}\n/**\r\n * Sends an event back to the sender of the original event.\r\n *\r\n * @param event The event to send back to the sender\r\n * @param options Options to pass into the send event\r\n */\n\n\nfunction respond(event, options) {\n return send(event, __assign(__assign({}, options), {\n to: function to(_, __, _a) {\n var _event = _a._event;\n return _event.origin; // TODO: handle when _event.origin is undefined\n }\n }));\n}\n\nvar defaultLogExpr = function defaultLogExpr(context, event) {\n return {\n context: context,\n event: event\n };\n};\n/**\r\n *\r\n * @param expr The expression function to evaluate which will be logged.\r\n * Takes in 2 arguments:\r\n * - `ctx` - the current state context\r\n * - `event` - the event that caused this action to be executed.\r\n * @param label The label to give to the logged expression.\r\n */\n\n\nfunction log(expr, label) {\n if (expr === void 0) {\n expr = defaultLogExpr;\n }\n\n return {\n type: log$1,\n label: label,\n expr: expr\n };\n}\n\nvar resolveLog = function resolveLog(action, ctx, _event) {\n return __assign(__assign({}, action), {\n value: isString(action.expr) ? action.expr : action.expr(ctx, _event.data, {\n _event: _event\n })\n });\n};\n/**\r\n * Cancels an in-flight `send(...)` action. A canceled sent action will not\r\n * be executed, nor will its event be sent, unless it has already been sent\r\n * (e.g., if `cancel(...)` is called after the `send(...)` action's `delay`).\r\n *\r\n * @param sendId The `id` of the `send(...)` action to cancel.\r\n */\n\n\nvar cancel = function cancel(sendId) {\n return {\n type: cancel$1,\n sendId: sendId\n };\n};\n/**\r\n * Starts an activity.\r\n *\r\n * @param activity The activity to start.\r\n */\n\n\nfunction start(activity) {\n var activityDef = toActivityDefinition(activity);\n return {\n type: ActionTypes.Start,\n activity: activityDef,\n exec: undefined\n };\n}\n/**\r\n * Stops an activity.\r\n *\r\n * @param activity The activity to stop.\r\n */\n\n\nfunction stop(activity) {\n var activityDef = toActivityDefinition(activity);\n return {\n type: ActionTypes.Stop,\n activity: activityDef,\n exec: undefined\n };\n}\n/**\r\n * Updates the current context of the machine.\r\n *\r\n * @param assignment An object that represents the partial context to update.\r\n */\n\n\nvar assign = function assign(assignment) {\n return {\n type: assign$1,\n assignment: assignment\n };\n};\n/**\r\n * Returns an event type that represents an implicit event that\r\n * is sent after the specified `delay`.\r\n *\r\n * @param delayRef The delay in milliseconds\r\n * @param id The state node ID where this event is handled\r\n */\n\n\nfunction after(delayRef, id) {\n var idSuffix = id ? \"#\" + id : '';\n return ActionTypes.After + \"(\" + delayRef + \")\" + idSuffix;\n}\n/**\r\n * Returns an event that represents that a final state node\r\n * has been reached in the parent state node.\r\n *\r\n * @param id The final state node's parent state node `id`\r\n * @param data The data to pass into the event\r\n */\n\n\nfunction done(id, data) {\n var type = ActionTypes.DoneState + \".\" + id;\n var eventObject = {\n type: type,\n data: data\n };\n\n eventObject.toString = function () {\n return type;\n };\n\n return eventObject;\n}\n/**\r\n * Returns an event that represents that an invoked service has terminated.\r\n *\r\n * An invoked service is terminated when it has reached a top-level final state node,\r\n * but not when it is canceled.\r\n *\r\n * @param id The final state node ID\r\n * @param data The data to pass into the event\r\n */\n\n\nfunction doneInvoke(id, data) {\n var type = ActionTypes.DoneInvoke + \".\" + id;\n var eventObject = {\n type: type,\n data: data\n };\n\n eventObject.toString = function () {\n return type;\n };\n\n return eventObject;\n}\n\nfunction error(id, data) {\n var type = ActionTypes.ErrorPlatform + \".\" + id;\n var eventObject = {\n type: type,\n data: data\n };\n\n eventObject.toString = function () {\n return type;\n };\n\n return eventObject;\n}\n/**\r\n * Forwards (sends) an event to a specified service.\r\n *\r\n * @param target The target service to forward the event to.\r\n * @param options Options to pass into the send action creator.\r\n */\n\n\nfunction forwardTo(target, options) {\n return send(function (_, event) {\n return event;\n }, __assign(__assign({}, options), {\n to: target\n }));\n}\n/**\r\n * Escalates an error by sending it as an event to this machine's parent.\r\n *\r\n * @param errorData The error data to send, or the expression function that\r\n * takes in the `context`, `event`, and `meta`, and returns the error data to send.\r\n * @param options Options to pass into the send action creator.\r\n */\n\n\nfunction escalate(errorData, options) {\n return sendParent(function (context, event, meta) {\n return {\n type: error$1,\n data: isFunction(errorData) ? errorData(context, event, meta) : errorData\n };\n }, __assign(__assign({}, options), {\n to: SpecialTargets.Parent\n }));\n}\n\nexport { after, assign, cancel, done, doneInvoke, error, escalate, forwardTo, getActionFunction, initEvent, log, raise, resolveLog, resolveRaise, resolveSend, respond, send, sendParent, sendUpdate, start, stop, toActionObject, toActionObjects, toActivityDefinition };","import React from \"react\";\nimport PropTypes from \"prop-types\";\nimport isArray from \"lodash/isArray\";\nimport { errorTextViaYupOrRailsOrJoi } from \"@shared/lib/formHelpers\";\nimport { findSelectOptionByValue } from \"@ats/src/lib/lookups\";\n\nimport Select, { Creatable } from \"react-select\";\nimport FormLabel from \"@ats/src/components/forms/FormLabel\";\n\nimport styled from \"@emotion/styled\";\nimport { css } from \"@emotion/react\";\n\nconst handleChange = (props) => (selectedOption, actionObj) => {\n // Use the parent's scope to setState\n if (props.scope !== undefined) {\n if (actionObj.action === \"clear\") {\n props.scope.setState({ [props.name]: null, errors: null });\n } else {\n props.scope.setState({\n [props.name]: isArray(selectedOption) ? selectedOption : selectedOption.value,\n errors: null,\n });\n }\n } else if (props.onChange !== undefined) {\n if (actionObj.action === \"clear\") {\n props.onChange(props.name, null);\n } else {\n props.onChange(props.name, isArray(selectedOption) ? selectedOption : selectedOption.value);\n }\n } else {\n console.error(\"[FormSelect] scope or onChange must be defined\");\n }\n};\n\nconst handleInputChange = (props) => (selectedOption, actionObj) => {\n if (actionObj.action === \"clear\") {\n props.onInputChange(props.name, null);\n } else {\n props.onInputChange(\n props.name,\n isArray(selectedOption) ? selectedOption : selectedOption.value,\n );\n }\n};\n\nconst FormSelect = (props) => {\n const {\n errors,\n options,\n name,\n placeholder,\n value,\n label,\n description,\n onChange,\n isRequired,\n isDisabled,\n isClearable,\n isCreatable,\n isMulti,\n requiredLabel,\n ...rest\n } = props;\n let errorText = errorTextViaYupOrRailsOrJoi(props);\n\n const selectedOption = findSelectOptionByValue(options, value);\n const [selectRef, setSelectRef] = React.useState(null);\n\n const handleKeyDown = (event) => {\n if (event.keyCode === 27 || event.key === \"Escape\") {\n selectRef.blur();\n }\n };\n\n // window.logger(\"%c[FormSelect] errorText\", \"color: #1976D2\", {\n // errorText,\n // errors,\n // selectedOption,\n // rest,\n // });\n\n return isCreatable ? (\n \n {label && }\n {\n if (ref != undefined) {\n setSelectRef(ref);\n }\n }}\n />\n {props.children}\n {/* For displaying Joi rendered errors. See NewInviteForm example. */}\n \n ) : (\n \n {label && (\n \n )}\n {description && {description}
}\n {\n if (ref != undefined) {\n setSelectRef(ref);\n }\n }}\n onKeyDown={handleKeyDown}\n // data-testid=\"doesthiswork\"\n />\n {props.children}\n {/* For displaying Joi rendered errors. See NewInviteForm example. */}\n \n );\n};\n\nFormSelect.propTypes = {\n name: PropTypes.string.isRequired,\n placeholder: PropTypes.string,\n label: PropTypes.string,\n description: PropTypes.any,\n scope: PropTypes.object, // typically set to \"this\" from the parent so we can use setState\n onChange: PropTypes.func, //.isRequired, // This get's used as a callback if scope is not set\n className: PropTypes.string,\n value: PropTypes.any,\n options: PropTypes.any.isRequired,\n isRequired: PropTypes.bool,\n isDisabled: PropTypes.bool,\n isClearable: PropTypes.bool,\n errors: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),\n requiredLabel: PropTypes.string,\n};\n\nFormSelect.defaultProps = {\n isRequired: false,\n isDisabled: false,\n isClearable: false,\n isMulti: false,\n placeholder: \"Select...\",\n requiredLabel: \"required\",\n};\n\nexport default FormSelect;\n\n/* Styled Components\n======================================================= */\nconst Styled = {};\n\nStyled.Container = styled.div((props) => {\n const t = props.theme;\n return css`\n label: FormSelect;\n ${t.mb(5)}\n > p {\n ${[t.text.xs, t.mt(-1), t.mb(2)]}\n color: ${t.dark ? t.color.gray[400] : t.color.gray[600]};\n max-width: 32rem;\n\n a {\n ${[t.text.medium]}\n color: ${t.dark ? t.color.gray[200] : t.color.black};\n\n &:hover {\n text-decoration: underline;\n }\n }\n\n ${t.mq[\"md\"]} {\n ${t.text.xs}\n }\n }\n\n ${t.mq[\"md\"]} {\n ${t.mb(5)}\n }\n `;\n});\n\nStyled.Select = styled(Select)((props) => {\n const t = props.theme;\n return css`\n label: FormSelect_UI;\n .form-select-ui {\n &__clear-indicator {\n cursor: pointer;\n }\n &__control {\n ${[t.h(10), t.rounded.sm, t.text.base]}\n min-height: ${t.spacing[10]};\n width: 100%;\n appearance: none;\n color: ${t.dark ? t.color.gray[200] : t.color.black};\n background-color: ${t.dark ? \"rgba(255,255,255,0.07)\" : t.color.white};\n border-width: 1px;\n border-style: solid;\n border-color: ${props.hasError\n ? t.dark\n ? t.color.red[400]\n : t.color.red[500]\n : t.dark\n ? \"transparent\"\n : t.color.gray[300]};\n transition: border-color 0.2s ease, box-shadow 0.2s ease;\n &:hover {\n border-color: ${props.hasError\n ? t.dark\n ? t.color.red[300]\n : t.color.red[600]\n : t.dark\n ? t.color.gray[600]\n : t.color.gray[400]};\n }\n &:focus {\n outline: none;\n border-color: ${props.hasError\n ? t.dark\n ? t.color.red[300]\n : t.color.red[600]\n : t.dark\n ? t.color.gray[500]\n : t.color.gray[400]};\n ${t.dark ? \"\" : `box-shadow: 0 0 0 2px ${t.color.gray[300]};`}\n }\n &:focus:hover,\n &--is-focused,\n &--is-focused:hover {\n outline: none;\n border-color: ${props.hasError\n ? t.dark\n ? t.color.red[300]\n : t.color.red[600]\n : t.dark\n ? t.color.gray[500]\n : t.color.gray[400]};\n ${t.dark ? \"box-shadow: none;\" : `box-shadow: 0 0 0 2px ${t.color.gray[300]};`}\n }\n &--is-disabled {\n background-color: ${t.dark ? \"transparent\" : t.color.gray[100]};\n .form-select-ui__single-value {\n color: ${t.dark ? t.color.gray[500] : t.color.gray[600]};\n }\n ${t.dark && `border: 1px solid ${t.color.gray[800]};`}\n\n .form-select-ui__indicator svg {\n fill: ${t.color.gray[500]};\n stroke: ${t.dark ? t.color.gray[800] : t.color.gray[100]};\n }\n }\n\n ${t.mq[\"md\"]} {\n ${[t.h(8), t.text.sm]}\n min-height: ${t.spacing[8]};\n }\n }\n &__option {\n ${[t.h(10), t.px(2), t.text.base]}\n transition: color 0.2s ease, background-color 0.2s ease;\n display: flex;\n align-items: center;\n background-color: ${t.dark ? t.color.gray[700] : t.color.white};\n color: ${t.dark ? t.color.gray[200] : t.color.gray[600]};\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n\n &:hover,\n &--is-focused {\n background-color: ${t.dark ? t.color.gray[500] : t.color.gray[200]};\n color: ${t.dark ? t.color.white : t.color.black};\n }\n &--is-selected {\n background-color: ${t.dark ? t.color.gray[600] : t.color.gray[100]};\n color: ${t.dark ? t.color.white : t.color.black};\n }\n\n ${t.mq[\"md\"]} {\n ${[t.h(8), t.text.sm]}\n }\n }\n &__placeholder {\n ${[t.mx(0)]}\n color: ${t.color.gray[500]};\n }\n &__indicators {\n ${t.h(8)}\n align-items: center;\n height: 100%;\n span {\n display: none;\n }\n }\n &__indicator svg {\n height: 1.125rem;\n width: 1.125rem;\n stroke-width: 1px;\n fill: ${t.dark ? t.color.gray[300] : t.color.black};\n stroke: ${t.dark ? t.color.gray[800] : t.color.white};\n }\n &__dropdown-indicator {\n ${t.mr(\"px\")}\n padding: 0.3125rem;\n }\n &__clear-indicator svg {\n ${[t.rounded.xs]}\n position: relative;\n right: -${t.spacing[2]};\n background-color: ${t.dark ? t.color.gray[600] : t.color.gray[200]} !important;\n transition: background-color 0.2s ease;\n stroke: ${t.dark ? t.color.gray[600] : t.color.gray[200]};\n }\n &__clear-indicator:hover svg {\n background-color: ${t.dark ? t.color.orange[200] : t.color.gray[300]} !important;\n transition: background-color 0.2s ease;\n stroke: ${t.dark ? t.color.orange[200] : t.color.gray[300]};\n fill: ${t.color.black};\n }\n &__menu {\n ${[t.my(\"-px\"), t.rounded.sm]};\n border: 1px solid ${t.dark ? t.color.gray[500] : t.color.gray[400]};\n box-shadow: none;\n z-index: 20;\n }\n &__menu-list {\n ${[t.rounded.xs]};\n padding: 0;\n }\n &__value-container {\n ${[t.mx(0)]};\n height: 100%;\n > div {\n ${t.m(0)}\n }\n }\n &__input,\n &__single-value {\n color: ${t.dark ? t.color.gray[200] : t.color.black};\n ${t.m(0)};\n }\n &__multi-value {\n ${[t.m(\"px\"), t.rounded.xs]};\n margin-right: 0.25rem !important;\n height: 1.375rem;\n display: flex;\n align-items: center;\n background-color: ${t.dark ? t.color.gray[600] : t.color.gray[200]};\n transition: background-color 0.2s ease;\n &__label {\n ${[t.text.sm, t.py(\"px\"), t.pr(0), t.pl(2)]};\n color: ${t.dark ? t.color.white : t.color.black};\n }\n &__remove {\n height: 1.375rem;\n color: ${t.dark ? t.color.gray[400] : t.color.gray[500]};\n &:hover {\n background: none;\n color: ${t.dark ? t.color.white : t.color.black};\n cursor: pointer;\n }\n }\n }\n &__menu-notice,\n &__menu-notice--no-options {\n color: ${t.dark ? t.color.gray[600] : t.color.gray[400]};\n background-color: ${t.dark ? t.color.gray[800] : t.color.white};\n }\n }\n `;\n});\n\nStyled.Creatable = styled(Creatable)((props) => {\n const t = props.theme;\n return css`\n label: FormSelect_UI;\n .form-select-ui {\n &__clear-indicator {\n cursor: pointer;\n }\n &__control {\n ${[t.h(10), t.rounded.sm, t.text.base]}\n min-height: ${t.spacing[10]};\n width: 100%;\n appearance: none;\n color: ${t.dark ? t.color.gray[200] : t.color.black};\n background-color: ${t.dark ? \"rgba(255,255,255,0.07)\" : t.color.white};\n border-width: 1px;\n border-style: solid;\n border-color: ${props.hasError\n ? t.dark\n ? t.color.red[400]\n : t.color.red[500]\n : t.dark\n ? \"transparent\"\n : t.color.gray[300]};\n transition: border-color 0.2s ease, box-shadow 0.2s ease;\n &:hover {\n border-color: ${props.hasError\n ? t.dark\n ? t.color.red[300]\n : t.color.red[600]\n : t.dark\n ? t.color.gray[600]\n : t.color.gray[400]};\n }\n &:focus {\n outline: none;\n border-color: ${props.hasError\n ? t.dark\n ? t.color.red[300]\n : t.color.red[600]\n : t.dark\n ? t.color.gray[500]\n : t.color.gray[400]};\n ${t.dark ? \"\" : `box-shadow: 0 0 0 2px ${t.color.gray[300]};`}\n }\n &:focus:hover,\n &--is-focused,\n &--is-focused:hover {\n outline: none;\n border-color: ${props.hasError\n ? t.dark\n ? t.color.red[300]\n : t.color.red[600]\n : t.dark\n ? t.color.gray[500]\n : t.color.gray[400]};\n ${t.dark ? \"box-shadow: none;\" : `box-shadow: 0 0 0 2px ${t.color.gray[300]};`}\n }\n &--is-disabled {\n background-color: ${t.dark ? \"transparent\" : t.color.gray[100]};\n .form-select-ui__single-value {\n color: ${t.dark ? t.color.gray[500] : t.color.gray[600]};\n }\n ${t.dark && `border: 1px solid ${t.color.gray[800]};`}\n\n .form-select-ui__indicator svg {\n fill: ${t.color.gray[500]};\n stroke: ${t.dark ? t.color.gray[800] : t.color.gray[100]};\n }\n }\n\n ${t.mq[\"md\"]} {\n ${[t.h(8), t.text.sm]}\n min-height: ${t.spacing[8]};\n }\n }\n &__option {\n ${[t.h(10), t.px(2), t.text.base]}\n transition: color 0.2s ease, background-color 0.2s ease;\n display: flex;\n align-items: center;\n background-color: ${t.dark ? t.color.gray[700] : t.color.white};\n color: ${t.dark ? t.color.gray[200] : t.color.gray[600]};\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n\n &:hover,\n &--is-focused {\n background-color: ${t.dark ? t.color.gray[500] : t.color.gray[200]};\n color: ${t.dark ? t.color.white : t.color.black};\n }\n &--is-selected {\n background-color: ${t.dark ? t.color.gray[600] : t.color.gray[100]};\n color: ${t.dark ? t.color.white : t.color.black};\n }\n\n ${t.mq[\"md\"]} {\n ${[t.h(8), t.text.sm]}\n }\n }\n &__placeholder {\n ${[t.mx(0)]}\n color: ${t.color.gray[500]};\n }\n &__indicators {\n ${t.h(8)}\n align-items: center;\n height: 100%;\n span {\n display: none;\n }\n }\n &__indicator svg {\n height: 1.125rem;\n width: 1.125rem;\n stroke-width: 1px;\n fill: ${t.dark ? t.color.gray[300] : t.color.black};\n stroke: ${t.dark ? t.color.gray[800] : t.color.white};\n }\n &__dropdown-indicator {\n ${t.mr(\"px\")}\n padding: 0.3125rem;\n }\n &__clear-indicator svg {\n ${[t.rounded.xs]}\n position: relative;\n right: -${t.spacing[2]};\n background-color: ${t.dark ? t.color.gray[600] : t.color.gray[200]} !important;\n transition: background-color 0.2s ease;\n stroke: ${t.dark ? t.color.gray[600] : t.color.gray[200]};\n }\n &__clear-indicator:hover svg {\n background-color: ${t.dark ? t.color.orange[200] : t.color.gray[300]} !important;\n transition: background-color 0.2s ease;\n stroke: ${t.dark ? t.color.orange[200] : t.color.gray[300]};\n fill: ${t.color.black};\n }\n &__menu {\n ${[t.my(\"-px\"), t.rounded.sm]};\n border: 1px solid ${t.dark ? t.color.gray[500] : t.color.gray[400]};\n box-shadow: none;\n z-index: 20;\n }\n &__menu-list {\n ${[t.rounded.xs]};\n padding: 0;\n }\n &__value-container {\n ${[t.mx(0)]};\n height: 100%;\n > div {\n ${t.m(0)}\n }\n }\n &__input,\n &__single-value {\n color: ${t.dark ? t.color.gray[200] : t.color.black};\n ${t.m(0)};\n }\n &__multi-value {\n ${[t.m(\"px\"), t.rounded.xs]};\n margin-right: 0.25rem !important;\n height: 1.375rem;\n display: flex;\n align-items: center;\n background-color: ${t.dark ? t.color.gray[600] : t.color.gray[200]};\n transition: background-color 0.2s ease;\n &__label {\n ${[t.text.sm, t.py(\"px\"), t.pr(0), t.pl(2)]};\n color: ${t.dark ? t.color.white : t.color.black};\n }\n &__remove {\n height: 1.375rem;\n color: ${t.dark ? t.color.gray[400] : t.color.gray[500]};\n &:hover {\n background: none;\n color: ${t.dark ? t.color.white : t.color.black};\n cursor: pointer;\n }\n }\n }\n &__menu-notice,\n &__menu-notice--no-options {\n color: ${t.dark ? t.color.gray[600] : t.color.gray[400]};\n background-color: ${t.dark ? t.color.gray[800] : t.color.white};\n }\n }\n `;\n});\n","import React from \"react\";\nimport PropTypes from \"prop-types\";\nimport styled from \"@emotion/styled\";\nimport { css } from \"@emotion/react\";\nimport { useHotkeys } from \"react-hotkeys-hook\";\n\nimport { errorTextViaYupOrRailsOrJoi } from \"@shared/lib/formHelpers\";\n\nimport FormLabel from \"@ats/src/components/forms/FormLabel\";\n\nconst FormInput = (props) => {\n const { errors, label, isRequired, onKeyDown, defaultValue, requiredLabel } = props;\n let errorText = errorTextViaYupOrRailsOrJoi(props); // errorsDisplay(props);\n const inputRef = React.useRef(null);\n\n React.useEffect(() => {\n inputRef.current.addEventListener(\"keydown\", (event) => {\n if (event.keyCode === 27 || event.key === \"Escape\") {\n inputRef.current.blur();\n }\n return () => {\n inputRef.current.removeEventListener(\"keydown\");\n };\n });\n }, []);\n\n /* HOTKEYS\n --===================================================-- */\n useHotkeys(\n \"esc\",\n (event) => {\n event.preventDefault();\n event.stopPropagation();\n inputRef.current.blur();\n return false;\n },\n {},\n [],\n );\n\n const handleChange = (event) => {\n event.preventDefault();\n\n // Use the parent's scope to setState\n if (props.scope !== undefined) {\n props.scope.setState({\n [props.name]: event.currentTarget.value,\n errors: null,\n });\n } else if (props.onChange !== undefined) {\n props.onChange(props.name, event.currentTarget.value);\n }\n };\n\n const handleBlur = (event) => {\n event.preventDefault();\n\n if (props.onBlur !== undefined) {\n props.onBlur(props.name, event.currentTarget.value);\n }\n };\n\n // window.logger(\"%c[FormInput] Errors\", \"background: red; color: white;\", {\n // errors,\n // errorText,\n // });\n\n const inputId = props.label\n ? `input${props.label.replace(/\\s+/g, \"\")}`\n : props.name\n ? props.name\n : \"Default\";\n\n return (\n \n {label && (\n \n )}\n {props.description && {props.description}
}\n \n {props.pretext && {props.pretext}}\n \n \n {props.children} {/* For displaying Joi rendered errors. See NewInviteForm example. */}\n \n );\n};\n\nFormInput.propTypes = {\n name: PropTypes.string.isRequired,\n placeholder: PropTypes.string,\n label: PropTypes.string,\n description: PropTypes.string,\n scope: PropTypes.object, // typically set to \"this\" from the parent so we can use setState\n onChange: PropTypes.func, //.isRequired, // This get's used as a callback if scope is not set\n className: PropTypes.string,\n inputType: PropTypes.string,\n pretext: PropTypes.string,\n value: PropTypes.any,\n autoFocus: PropTypes.bool,\n isRequired: PropTypes.bool,\n isDisabled: PropTypes.bool,\n defaultValue: PropTypes.string,\n errors: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),\n requiredLabel: PropTypes.string,\n};\n\nFormInput.defaultProps = {\n isRequired: false,\n isDisabled: false,\n requiredLabel: \"required\",\n};\n\nexport default FormInput;\n\n/* Styled Components\n======================================================= */\nconst Styled = {};\n\nStyled.Container = styled.div((props) => {\n const t: any = props.theme;\n return css`\n label: FormInput;\n ${t.mb(6)}\n > p {\n ${[t.text.sm, t.mt(-1), t.mb(2)]};\n color: ${t.dark ? t.color.gray[400] : t.color.gray[600]};\n max-width: 32rem;\n\n a {\n ${[t.text.medium]}\n color: ${t.dark ? t.color.gray[200] : t.color.black};\n\n &:hover {\n text-decoration: underline;\n }\n }\n\n ${t.mq[\"md\"]} {\n ${t.text.xs}\n }\n }\n\n ${t.mq[\"md\"]} {\n ${t.mb(5)}\n }\n `;\n});\n\nStyled.UI = styled.div((props) => {\n const t: any = props.theme;\n return css`\n label: FormInput_UI;\n display: flex;\n input {\n ${[t.h(10), t.px(2), t.rounded.sm, t.text.base]}\n appearance: none;\n color: ${t.dark ? t.color.gray[200] : t.color.black};\n background-color: ${t.dark ? \"rgba(255,255,255,0.07)\" : t.color.white};\n width: 100%;\n text-overflow: ellipsis;\n border-width: 1px;\n border-style: solid;\n transition: border-color 0.2s ease, box-shadow 0.2s ease;\n border-color: ${props.hasError\n ? t.dark\n ? t.color.red[400]\n : t.color.red[500]\n : t.dark\n ? \"transparent\"\n : t.color.gray[300]};\n ${props.hasPretext ? \"border-top-left-radius: 0; border-bottom-left-radius: 0;\" : \"\"}\n &::placeholder {\n color: ${t.color.gray[500]};\n }\n &:hover {\n border-color: ${props.hasError\n ? t.dark\n ? t.color.red[300]\n : t.color.red[600]\n : t.dark\n ? t.color.gray[600]\n : t.color.gray[400]};\n }\n &:focus {\n outline: none;\n border-color: ${props.hasError\n ? t.dark\n ? t.color.red[300]\n : t.color.red[600]\n : t.dark\n ? t.color.gray[500]\n : t.color.gray[400]};\n ${t.dark ? \"\" : `box-shadow: 0 0 0 2px ${t.color.gray[300]};`}\n }\n &:disabled {\n color: ${t.dark ? t.color.gray[500] : t.color.gray[600]};\n background-color: ${t.dark ? \"transparent\" : t.color.gray[100]};\n ${t.dark && `border: 1px solid ${t.color.gray[800]};`}\n border-color: ${t.dark ? \"rgba(255,255,255,0.08)\" : t.color.gray[300]};\n }\n &:disabled:hover {\n ${!t.dark && `border-color: ${t.color.gray[300]};`}\n }\n\n ${t.mq[\"md\"]} {\n ${[t.h(8), t.text.sm]}\n }\n }\n input[type=\"number\"] {\n appearance: textfield;\n }\n input[type=\"number\"]::-webkit-inner-spin-button,\n input[type=\"number\"]::-webkit-outer-spin-button {\n appearance: none;\n margin: 0;\n }\n `;\n});\n\nStyled.Pretext = styled.div((props) => {\n const t: any = props.theme;\n return css`\n label: FormInput_Pretext;\n ${[t.h(10), t.px(2), t.text.base, t.rounded.sm]}\n color: ${t.dark ? t.color.gray[300] : t.color.gray[600]};\n display: flex;\n flex-shrink: 0;\n justify-content: center;\n align-items: center;\n border: 1px solid ${t.dark ? \"transparent\" : t.color.gray[300]};\n border-right: none;\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n background-color: ${t.dark ? t.color.gray[700] : t.color.gray[100]};\n\n ${t.mq[\"md\"]} {\n ${[t.h(8), t.text.sm]}\n }\n `;\n});\n","import colors from \"./colors\";\nimport theme from \"./theme\";\n\nconst poly = {\n color: {\n canvas: colors.white,\n border: colors.gray[200],\n borderHover: colors.gray[400],\n loudText: colors.black,\n primaryText: colors.black,\n secondaryText: colors.gray[600],\n placeholderText: colors.gray[500],\n\n subtleHover: colors.gray[100],\n loudHover: colors.gray[200],\n\n wellCanvas: colors.gray[100],\n\n calloutCanvas: colors.gray[100],\n\n dropdownCanvas: colors.white,\n dropdownBorder: colors.gray[400],\n dropdownDivider: colors.gray[200],\n dropdownHover: colors.gray[200],\n dropdownTextHover: colors.black,\n\n cardCanvas: colors.white,\n cardBorder: colors.gray[200],\n cardDivider: colors.gray[200],\n\n chipBorder: colors.gray[300],\n },\n ...theme,\n};\n\nexport default poly;\n","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nimport { __assign, __values, __spread, __read, __rest } from './_virtual/_tslib.js';\nimport { DEFAULT_GUARD_TYPE, STATE_DELIMITER } from './constants.js';\nimport { IS_PRODUCTION } from './environment.js';\nimport { mapValues, isArray, flatten, keys, toArray, toStateValue, isString, getEventType, matchesState, path, mapContext, toSCXMLEvent, pathToStateValue, isBuiltInEvent, partition, updateContext, warn, updateHistoryValue, toStatePath, mapFilterValues, toStatePaths, nestedPath, normalizeTarget, toGuard, toTransitionConfigArray, isMachine, isFunction } from './utils.js';\nimport { SpecialTargets } from './types.js';\nimport { getAllStateNodes, getConfiguration, has, getChildren, isInFinalState, getValue, isLeafNode } from './stateUtils.js';\nimport { start as start$1, stop as stop$1, pure, log, send, raise as raise$1, invoke, update, nullEvent, assign } from './actionTypes.js';\nimport { done, start, raise, stop, toActionObjects, toActionObject, resolveLog, resolveSend, resolveRaise, doneInvoke, error, toActivityDefinition, after, send as send$1, cancel, initEvent } from './actions.js';\nimport { State, stateValuesEqual } from './State.js';\nimport { createInvocableActor } from './Actor.js';\nvar NULL_EVENT = '';\nvar STATE_IDENTIFIER = '#';\nvar WILDCARD = '*';\nvar EMPTY_OBJECT = {};\n\nvar isStateId = function isStateId(str) {\n return str[0] === STATE_IDENTIFIER;\n};\n\nvar createDefaultOptions = function createDefaultOptions() {\n return {\n actions: {},\n guards: {},\n services: {},\n activities: {},\n delays: {}\n };\n};\n\nvar validateArrayifiedTransitions = function validateArrayifiedTransitions(stateNode, event, transitions) {\n var hasNonLastUnguardedTarget = transitions.slice(0, -1).some(function (transition) {\n return !('cond' in transition) && !('in' in transition) && (isString(transition.target) || isMachine(transition.target));\n });\n var eventText = event === NULL_EVENT ? 'the transient event' : \"event '\" + event + \"'\";\n warn(!hasNonLastUnguardedTarget, \"One or more transitions for \" + eventText + \" on state '\" + stateNode.id + \"' are unreachable. \" + \"Make sure that the default transition is the last one defined.\");\n};\n\nvar StateNode =\n/*#__PURE__*/\n\n/** @class */\nfunction () {\n function StateNode(\n /**\r\n * The raw config used to create the machine.\r\n */\n config, options,\n /**\r\n * The initial extended state\r\n */\n context) {\n var _this = this;\n\n this.config = config;\n this.context = context;\n /**\r\n * The order this state node appears. Corresponds to the implicit SCXML document order.\r\n */\n\n this.order = -1;\n this.__xstatenode = true;\n this.__cache = {\n events: undefined,\n relativeValue: new Map(),\n initialStateValue: undefined,\n initialState: undefined,\n on: undefined,\n transitions: undefined,\n candidates: {},\n delayedTransitions: undefined\n };\n this.idMap = {};\n this.options = Object.assign(createDefaultOptions(), options);\n this.parent = this.options._parent;\n this.key = this.config.key || this.options._key || this.config.id || '(machine)';\n this.machine = this.parent ? this.parent.machine : this;\n this.path = this.parent ? this.parent.path.concat(this.key) : [];\n this.delimiter = this.config.delimiter || (this.parent ? this.parent.delimiter : STATE_DELIMITER);\n this.id = this.config.id || __spread([this.machine.key], this.path).join(this.delimiter);\n this.version = this.parent ? this.parent.version : this.config.version;\n this.type = this.config.type || (this.config.parallel ? 'parallel' : this.config.states && keys(this.config.states).length ? 'compound' : this.config.history ? 'history' : 'atomic');\n\n if (!IS_PRODUCTION) {\n warn(!('parallel' in this.config), \"The \\\"parallel\\\" property is deprecated and will be removed in version 4.1. \" + (this.config.parallel ? \"Replace with `type: 'parallel'`\" : \"Use `type: '\" + this.type + \"'`\") + \" in the config for state node '\" + this.id + \"' instead.\");\n }\n\n this.initial = this.config.initial;\n this.states = this.config.states ? mapValues(this.config.states, function (stateConfig, key) {\n var _a;\n\n var stateNode = new StateNode(stateConfig, {\n _parent: _this,\n _key: key\n });\n Object.assign(_this.idMap, __assign((_a = {}, _a[stateNode.id] = stateNode, _a), stateNode.idMap));\n return stateNode;\n }) : EMPTY_OBJECT; // Document order\n\n var order = 0;\n\n function dfs(stateNode) {\n var e_1, _a;\n\n stateNode.order = order++;\n\n try {\n for (var _b = __values(getChildren(stateNode)), _c = _b.next(); !_c.done; _c = _b.next()) {\n var child = _c.value;\n dfs(child);\n }\n } catch (e_1_1) {\n e_1 = {\n error: e_1_1\n };\n } finally {\n try {\n if (_c && !_c.done && (_a = _b[\"return\"])) _a.call(_b);\n } finally {\n if (e_1) throw e_1.error;\n }\n }\n }\n\n dfs(this); // History config\n\n this.history = this.config.history === true ? 'shallow' : this.config.history || false;\n this._transient = !this.config.on ? false : Array.isArray(this.config.on) ? this.config.on.some(function (_a) {\n var event = _a.event;\n return event === NULL_EVENT;\n }) : NULL_EVENT in this.config.on;\n this.strict = !!this.config.strict; // TODO: deprecate (entry)\n\n this.onEntry = toArray(this.config.entry || this.config.onEntry).map(function (action) {\n return toActionObject(action);\n }); // TODO: deprecate (exit)\n\n this.onExit = toArray(this.config.exit || this.config.onExit).map(function (action) {\n return toActionObject(action);\n });\n this.meta = this.config.meta;\n this.data = this.type === 'final' ? this.config.data : undefined;\n this.invoke = toArray(this.config.invoke).map(function (invokeConfig, i) {\n var _a, _b;\n\n if (isMachine(invokeConfig)) {\n _this.machine.options.services = __assign((_a = {}, _a[invokeConfig.id] = invokeConfig, _a), _this.machine.options.services);\n return {\n type: invoke,\n src: invokeConfig.id,\n id: invokeConfig.id\n };\n } else if (typeof invokeConfig.src !== 'string') {\n var invokeSrc = _this.id + \":invocation[\" + i + \"]\"; // TODO: util function\n\n _this.machine.options.services = __assign((_b = {}, _b[invokeSrc] = invokeConfig.src, _b), _this.machine.options.services);\n return __assign(__assign({\n type: invoke,\n id: invokeSrc\n }, invokeConfig), {\n src: invokeSrc\n });\n } else {\n return __assign(__assign({}, invokeConfig), {\n type: invoke,\n id: invokeConfig.id || invokeConfig.src,\n src: invokeConfig.src\n });\n }\n });\n this.activities = toArray(this.config.activities).concat(this.invoke).map(function (activity) {\n return toActivityDefinition(activity);\n });\n this.transition = this.transition.bind(this);\n }\n\n StateNode.prototype._init = function () {\n if (this.__cache.transitions) {\n return;\n }\n\n getAllStateNodes(this).forEach(function (stateNode) {\n return stateNode.on;\n });\n };\n /**\r\n * Clones this state machine with custom options and context.\r\n *\r\n * @param options Options (actions, guards, activities, services) to recursively merge with the existing options.\r\n * @param context Custom context (will override predefined context)\r\n */\n\n\n StateNode.prototype.withConfig = function (options, context) {\n if (context === void 0) {\n context = this.context;\n }\n\n var _a = this.options,\n actions = _a.actions,\n activities = _a.activities,\n guards = _a.guards,\n services = _a.services,\n delays = _a.delays;\n return new StateNode(this.config, {\n actions: __assign(__assign({}, actions), options.actions),\n activities: __assign(__assign({}, activities), options.activities),\n guards: __assign(__assign({}, guards), options.guards),\n services: __assign(__assign({}, services), options.services),\n delays: __assign(__assign({}, delays), options.delays)\n }, context);\n };\n /**\r\n * Clones this state machine with custom context.\r\n *\r\n * @param context Custom context (will override predefined context, not recursive)\r\n */\n\n\n StateNode.prototype.withContext = function (context) {\n return new StateNode(this.config, this.options, context);\n };\n\n Object.defineProperty(StateNode.prototype, \"definition\", {\n /**\r\n * The well-structured state node definition.\r\n */\n get: function get() {\n return {\n id: this.id,\n key: this.key,\n version: this.version,\n type: this.type,\n initial: this.initial,\n history: this.history,\n states: mapValues(this.states, function (state) {\n return state.definition;\n }),\n on: this.on,\n transitions: this.transitions,\n onEntry: this.onEntry,\n onExit: this.onExit,\n activities: this.activities || [],\n meta: this.meta,\n order: this.order || -1,\n data: this.data,\n invoke: this.invoke\n };\n },\n enumerable: true,\n configurable: true\n });\n\n StateNode.prototype.toJSON = function () {\n return this.definition;\n };\n\n Object.defineProperty(StateNode.prototype, \"on\", {\n /**\r\n * The mapping of events to transitions.\r\n */\n get: function get() {\n if (this.__cache.on) {\n return this.__cache.on;\n }\n\n var transitions = this.transitions;\n return this.__cache.on = transitions.reduce(function (map, transition) {\n map[transition.eventType] = map[transition.eventType] || [];\n map[transition.eventType].push(transition);\n return map;\n }, {});\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(StateNode.prototype, \"after\", {\n get: function get() {\n return this.__cache.delayedTransitions || (this.__cache.delayedTransitions = this.getDelayedTransitions(), this.__cache.delayedTransitions);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(StateNode.prototype, \"transitions\", {\n /**\r\n * All the transitions that can be taken from this state node.\r\n */\n get: function get() {\n return this.__cache.transitions || (this.__cache.transitions = this.formatTransitions(), this.__cache.transitions);\n },\n enumerable: true,\n configurable: true\n });\n\n StateNode.prototype.getCandidates = function (eventName) {\n if (this.__cache.candidates[eventName]) {\n return this.__cache.candidates[eventName];\n }\n\n var _transient = eventName === NULL_EVENT;\n\n var candidates = this.transitions.filter(function (transition) {\n var sameEventType = transition.eventType === eventName; // null events should only match against eventless transitions\n\n return _transient ? sameEventType : sameEventType || transition.eventType === WILDCARD;\n });\n this.__cache.candidates[eventName] = candidates;\n return candidates;\n };\n /**\r\n * All delayed transitions from the config.\r\n */\n\n\n StateNode.prototype.getDelayedTransitions = function () {\n var _this = this;\n\n var afterConfig = this.config.after;\n\n if (!afterConfig) {\n return [];\n }\n\n var mutateEntryExit = function mutateEntryExit(delay, i) {\n var delayRef = isFunction(delay) ? _this.id + \":delay[\" + i + \"]\" : delay;\n var eventType = after(delayRef, _this.id);\n\n _this.onEntry.push(send$1(eventType, {\n delay: delay\n }));\n\n _this.onExit.push(cancel(eventType));\n\n return eventType;\n };\n\n var delayedTransitions = isArray(afterConfig) ? afterConfig.map(function (transition, i) {\n var eventType = mutateEntryExit(transition.delay, i);\n return __assign(__assign({}, transition), {\n event: eventType\n });\n }) : flatten(keys(afterConfig).map(function (delay, i) {\n var configTransition = afterConfig[delay];\n var resolvedTransition = isString(configTransition) ? {\n target: configTransition\n } : configTransition;\n var resolvedDelay = !isNaN(+delay) ? +delay : delay;\n var eventType = mutateEntryExit(resolvedDelay, i);\n return toArray(resolvedTransition).map(function (transition) {\n return __assign(__assign({}, transition), {\n event: eventType,\n delay: resolvedDelay\n });\n });\n }));\n return delayedTransitions.map(function (delayedTransition) {\n var delay = delayedTransition.delay;\n return __assign(__assign({}, _this.formatTransition(delayedTransition)), {\n delay: delay\n });\n });\n };\n /**\r\n * Returns the state nodes represented by the current state value.\r\n *\r\n * @param state The state value or State instance\r\n */\n\n\n StateNode.prototype.getStateNodes = function (state) {\n var _a;\n\n var _this = this;\n\n if (!state) {\n return [];\n }\n\n var stateValue = state instanceof State ? state.value : toStateValue(state, this.delimiter);\n\n if (isString(stateValue)) {\n var initialStateValue = this.getStateNode(stateValue).initial;\n return initialStateValue !== undefined ? this.getStateNodes((_a = {}, _a[stateValue] = initialStateValue, _a)) : [this.states[stateValue]];\n }\n\n var subStateKeys = keys(stateValue);\n var subStateNodes = subStateKeys.map(function (subStateKey) {\n return _this.getStateNode(subStateKey);\n });\n return subStateNodes.concat(subStateKeys.reduce(function (allSubStateNodes, subStateKey) {\n var subStateNode = _this.getStateNode(subStateKey).getStateNodes(stateValue[subStateKey]);\n\n return allSubStateNodes.concat(subStateNode);\n }, []));\n };\n /**\r\n * Returns `true` if this state node explicitly handles the given event.\r\n *\r\n * @param event The event in question\r\n */\n\n\n StateNode.prototype.handles = function (event) {\n var eventType = getEventType(event);\n return this.events.includes(eventType);\n };\n /**\r\n * Resolves the given `state` to a new `State` instance relative to this machine.\r\n *\r\n * This ensures that `.events` and `.nextEvents` represent the correct values.\r\n *\r\n * @param state The state to resolve\r\n */\n\n\n StateNode.prototype.resolveState = function (state) {\n var configuration = Array.from(getConfiguration([], this.getStateNodes(state.value)));\n return new State(__assign(__assign({}, state), {\n value: this.resolve(state.value),\n configuration: configuration\n }));\n };\n\n StateNode.prototype.transitionLeafNode = function (stateValue, state, _event) {\n var stateNode = this.getStateNode(stateValue);\n var next = stateNode.next(state, _event);\n\n if (!next || !next.transitions.length) {\n return this.next(state, _event);\n }\n\n return next;\n };\n\n StateNode.prototype.transitionCompoundNode = function (stateValue, state, _event) {\n var subStateKeys = keys(stateValue);\n var stateNode = this.getStateNode(subStateKeys[0]);\n\n var next = stateNode._transition(stateValue[subStateKeys[0]], state, _event);\n\n if (!next || !next.transitions.length) {\n return this.next(state, _event);\n }\n\n return next;\n };\n\n StateNode.prototype.transitionParallelNode = function (stateValue, state, _event) {\n var e_2, _a;\n\n var transitionMap = {};\n\n try {\n for (var _b = __values(keys(stateValue)), _c = _b.next(); !_c.done; _c = _b.next()) {\n var subStateKey = _c.value;\n var subStateValue = stateValue[subStateKey];\n\n if (!subStateValue) {\n continue;\n }\n\n var subStateNode = this.getStateNode(subStateKey);\n\n var next = subStateNode._transition(subStateValue, state, _event);\n\n if (next) {\n transitionMap[subStateKey] = next;\n }\n }\n } catch (e_2_1) {\n e_2 = {\n error: e_2_1\n };\n } finally {\n try {\n if (_c && !_c.done && (_a = _b[\"return\"])) _a.call(_b);\n } finally {\n if (e_2) throw e_2.error;\n }\n }\n\n var stateTransitions = keys(transitionMap).map(function (key) {\n return transitionMap[key];\n });\n var enabledTransitions = flatten(stateTransitions.map(function (st) {\n return st.transitions;\n }));\n var willTransition = stateTransitions.some(function (st) {\n return st.transitions.length > 0;\n });\n\n if (!willTransition) {\n return this.next(state, _event);\n }\n\n var entryNodes = flatten(stateTransitions.map(function (t) {\n return t.entrySet;\n }));\n var configuration = flatten(keys(transitionMap).map(function (key) {\n return transitionMap[key].configuration;\n }));\n return {\n transitions: enabledTransitions,\n entrySet: entryNodes,\n exitSet: flatten(stateTransitions.map(function (t) {\n return t.exitSet;\n })),\n configuration: configuration,\n source: state,\n actions: flatten(keys(transitionMap).map(function (key) {\n return transitionMap[key].actions;\n }))\n };\n };\n\n StateNode.prototype._transition = function (stateValue, state, _event) {\n // leaf node\n if (isString(stateValue)) {\n return this.transitionLeafNode(stateValue, state, _event);\n } // hierarchical node\n\n\n if (keys(stateValue).length === 1) {\n return this.transitionCompoundNode(stateValue, state, _event);\n } // orthogonal node\n\n\n return this.transitionParallelNode(stateValue, state, _event);\n };\n\n StateNode.prototype.next = function (state, _event) {\n var e_3, _a;\n\n var _this = this;\n\n var eventName = _event.name;\n var actions = [];\n var nextStateNodes = [];\n var selectedTransition;\n\n try {\n for (var _b = __values(this.getCandidates(eventName)), _c = _b.next(); !_c.done; _c = _b.next()) {\n var candidate = _c.value;\n var cond = candidate.cond,\n stateIn = candidate[\"in\"];\n var resolvedContext = state.context;\n var isInState = stateIn ? isString(stateIn) && isStateId(stateIn) ? // Check if in state by ID\n state.matches(toStateValue(this.getStateNodeById(stateIn).path, this.delimiter)) : // Check if in state by relative grandparent\n matchesState(toStateValue(stateIn, this.delimiter), path(this.path.slice(0, -2))(state.value)) : true;\n var guardPassed = false;\n\n try {\n guardPassed = !cond || this.evaluateGuard(cond, resolvedContext, _event, state);\n } catch (err) {\n throw new Error(\"Unable to evaluate guard '\" + (cond.name || cond.type) + \"' in transition for event '\" + eventName + \"' in state node '\" + this.id + \"':\\n\" + err.message);\n }\n\n if (guardPassed && isInState) {\n if (candidate.target !== undefined) {\n nextStateNodes = candidate.target;\n }\n\n actions.push.apply(actions, __spread(candidate.actions));\n selectedTransition = candidate;\n break;\n }\n }\n } catch (e_3_1) {\n e_3 = {\n error: e_3_1\n };\n } finally {\n try {\n if (_c && !_c.done && (_a = _b[\"return\"])) _a.call(_b);\n } finally {\n if (e_3) throw e_3.error;\n }\n }\n\n if (!selectedTransition) {\n return undefined;\n }\n\n if (!nextStateNodes.length) {\n return {\n transitions: [selectedTransition],\n entrySet: [],\n exitSet: [],\n configuration: state.value ? [this] : [],\n source: state,\n actions: actions\n };\n }\n\n var allNextStateNodes = flatten(nextStateNodes.map(function (stateNode) {\n return _this.getRelativeStateNodes(stateNode, state.historyValue);\n }));\n var isInternal = !!selectedTransition.internal;\n var reentryNodes = isInternal ? [] : flatten(allNextStateNodes.map(function (n) {\n return _this.nodesFromChild(n);\n }));\n return {\n transitions: [selectedTransition],\n entrySet: reentryNodes,\n exitSet: isInternal ? [] : [this],\n configuration: allNextStateNodes,\n source: state,\n actions: actions\n };\n };\n\n StateNode.prototype.nodesFromChild = function (childStateNode) {\n if (childStateNode.escapes(this)) {\n return [];\n }\n\n var nodes = [];\n var marker = childStateNode;\n\n while (marker && marker !== this) {\n nodes.push(marker);\n marker = marker.parent;\n }\n\n nodes.push(this); // inclusive\n\n return nodes;\n };\n /**\r\n * Whether the given state node \"escapes\" this state node. If the `stateNode` is equal to or the parent of\r\n * this state node, it does not escape.\r\n */\n\n\n StateNode.prototype.escapes = function (stateNode) {\n if (this === stateNode) {\n return false;\n }\n\n var parent = this.parent;\n\n while (parent) {\n if (parent === stateNode) {\n return false;\n }\n\n parent = parent.parent;\n }\n\n return true;\n };\n\n StateNode.prototype.evaluateGuard = function (guard, context, _event, state) {\n var guards = this.machine.options.guards;\n var guardMeta = {\n state: state,\n cond: guard,\n _event: _event\n }; // TODO: do not hardcode!\n\n if (guard.type === DEFAULT_GUARD_TYPE) {\n return guard.predicate(context, _event.data, guardMeta);\n }\n\n var condFn = guards[guard.type];\n\n if (!condFn) {\n throw new Error(\"Guard '\" + guard.type + \"' is not implemented on machine '\" + this.machine.id + \"'.\");\n }\n\n return condFn(context, _event.data, guardMeta);\n };\n\n StateNode.prototype.getActions = function (transition, currentContext, _event, prevState) {\n var e_4, _a, e_5, _b;\n\n var prevConfig = getConfiguration([], prevState ? this.getStateNodes(prevState.value) : [this]);\n var resolvedConfig = transition.configuration.length ? getConfiguration(prevConfig, transition.configuration) : prevConfig;\n\n try {\n for (var resolvedConfig_1 = __values(resolvedConfig), resolvedConfig_1_1 = resolvedConfig_1.next(); !resolvedConfig_1_1.done; resolvedConfig_1_1 = resolvedConfig_1.next()) {\n var sn = resolvedConfig_1_1.value;\n\n if (!has(prevConfig, sn)) {\n transition.entrySet.push(sn);\n }\n }\n } catch (e_4_1) {\n e_4 = {\n error: e_4_1\n };\n } finally {\n try {\n if (resolvedConfig_1_1 && !resolvedConfig_1_1.done && (_a = resolvedConfig_1[\"return\"])) _a.call(resolvedConfig_1);\n } finally {\n if (e_4) throw e_4.error;\n }\n }\n\n try {\n for (var prevConfig_1 = __values(prevConfig), prevConfig_1_1 = prevConfig_1.next(); !prevConfig_1_1.done; prevConfig_1_1 = prevConfig_1.next()) {\n var sn = prevConfig_1_1.value;\n\n if (!has(resolvedConfig, sn) || has(transition.exitSet, sn.parent)) {\n transition.exitSet.push(sn);\n }\n }\n } catch (e_5_1) {\n e_5 = {\n error: e_5_1\n };\n } finally {\n try {\n if (prevConfig_1_1 && !prevConfig_1_1.done && (_b = prevConfig_1[\"return\"])) _b.call(prevConfig_1);\n } finally {\n if (e_5) throw e_5.error;\n }\n }\n\n if (!transition.source) {\n transition.exitSet = []; // Ensure that root StateNode (machine) is entered\n\n transition.entrySet.push(this);\n }\n\n var doneEvents = flatten(transition.entrySet.map(function (sn) {\n var events = [];\n\n if (sn.type !== 'final') {\n return events;\n }\n\n var parent = sn.parent;\n events.push(done(sn.id, sn.data), // TODO: deprecate - final states should not emit done events for their own state.\n done(parent.id, sn.data ? mapContext(sn.data, currentContext, _event) : undefined));\n\n if (parent.parent) {\n var grandparent = parent.parent;\n\n if (grandparent.type === 'parallel') {\n if (getChildren(grandparent).every(function (parentNode) {\n return isInFinalState(transition.configuration, parentNode);\n })) {\n events.push(done(grandparent.id, grandparent.data));\n }\n }\n }\n\n return events;\n }));\n transition.exitSet.sort(function (a, b) {\n return b.order - a.order;\n });\n transition.entrySet.sort(function (a, b) {\n return a.order - b.order;\n });\n var entryStates = new Set(transition.entrySet);\n var exitStates = new Set(transition.exitSet);\n\n var _c = __read([flatten(Array.from(entryStates).map(function (stateNode) {\n return __spread(stateNode.activities.map(function (activity) {\n return start(activity);\n }), stateNode.onEntry);\n })).concat(doneEvents.map(raise)), flatten(Array.from(exitStates).map(function (stateNode) {\n return __spread(stateNode.onExit, stateNode.activities.map(function (activity) {\n return stop(activity);\n }));\n }))], 2),\n entryActions = _c[0],\n exitActions = _c[1];\n\n var actions = toActionObjects(exitActions.concat(transition.actions).concat(entryActions), this.machine.options.actions);\n return actions;\n };\n /**\r\n * Determines the next state given the current `state` and sent `event`.\r\n *\r\n * @param state The current State instance or state value\r\n * @param event The event that was sent at the current state\r\n * @param context The current context (extended state) of the current state\r\n */\n\n\n StateNode.prototype.transition = function (state, event, context) {\n if (state === void 0) {\n state = this.initialState;\n }\n\n var _event = toSCXMLEvent(event);\n\n var currentState;\n\n if (state instanceof State) {\n currentState = context === undefined ? state : this.resolveState(State.from(state, context));\n } else {\n var resolvedStateValue = isString(state) ? this.resolve(pathToStateValue(this.getResolvedPath(state))) : this.resolve(state);\n var resolvedContext = context ? context : this.machine.context;\n currentState = this.resolveState(State.from(resolvedStateValue, resolvedContext));\n }\n\n if (!IS_PRODUCTION && _event.name === WILDCARD) {\n throw new Error(\"An event cannot have the wildcard type ('\" + WILDCARD + \"')\");\n }\n\n if (this.strict) {\n if (!this.events.includes(_event.name) && !isBuiltInEvent(_event.name)) {\n throw new Error(\"Machine '\" + this.id + \"' does not accept event '\" + _event.name + \"'\");\n }\n }\n\n var stateTransition = this._transition(currentState.value, currentState, _event) || {\n transitions: [],\n configuration: [],\n entrySet: [],\n exitSet: [],\n source: currentState,\n actions: []\n };\n var prevConfig = getConfiguration([], this.getStateNodes(currentState.value));\n var resolvedConfig = stateTransition.configuration.length ? getConfiguration(prevConfig, stateTransition.configuration) : prevConfig;\n stateTransition.configuration = __spread(resolvedConfig);\n return this.resolveTransition(stateTransition, currentState, _event);\n };\n\n StateNode.prototype.resolveRaisedTransition = function (state, _event, originalEvent) {\n var _a;\n\n var currentActions = state.actions;\n state = this.transition(state, _event); // Save original event to state\n\n state._event = originalEvent;\n state.event = originalEvent.data;\n\n (_a = state.actions).unshift.apply(_a, __spread(currentActions));\n\n return state;\n };\n\n StateNode.prototype.resolveTransition = function (stateTransition, currentState, _event, context) {\n var e_6, _a;\n\n var _this = this;\n\n if (_event === void 0) {\n _event = initEvent;\n }\n\n if (context === void 0) {\n context = this.machine.context;\n }\n\n var configuration = stateTransition.configuration; // Transition will \"apply\" if:\n // - this is the initial state (there is no current state)\n // - OR there are transitions\n\n var willTransition = !currentState || stateTransition.transitions.length > 0;\n var resolvedStateValue = willTransition ? getValue(this.machine, configuration) : undefined;\n var historyValue = currentState ? currentState.historyValue ? currentState.historyValue : stateTransition.source ? this.machine.historyValue(currentState.value) : undefined : undefined;\n var currentContext = currentState ? currentState.context : context;\n var actions = this.getActions(stateTransition, currentContext, _event, currentState);\n var activities = currentState ? __assign({}, currentState.activities) : {};\n\n try {\n for (var actions_1 = __values(actions), actions_1_1 = actions_1.next(); !actions_1_1.done; actions_1_1 = actions_1.next()) {\n var action = actions_1_1.value;\n\n if (action.type === start$1) {\n activities[action.activity.type] = action;\n } else if (action.type === stop$1) {\n activities[action.activity.type] = false;\n }\n }\n } catch (e_6_1) {\n e_6 = {\n error: e_6_1\n };\n } finally {\n try {\n if (actions_1_1 && !actions_1_1.done && (_a = actions_1[\"return\"])) _a.call(actions_1);\n } finally {\n if (e_6) throw e_6.error;\n }\n }\n\n var _b = __read(partition(actions, function (action) {\n return action.type === assign;\n }), 2),\n assignActions = _b[0],\n otherActions = _b[1];\n\n var updatedContext = assignActions.length ? updateContext(currentContext, _event, assignActions, currentState) : currentContext;\n var resolvedActions = flatten(otherActions.map(function (actionObject) {\n switch (actionObject.type) {\n case raise$1:\n return resolveRaise(actionObject);\n\n case send:\n var sendAction = resolveSend(actionObject, updatedContext, _event, _this.machine.options.delays); // TODO: fix ActionTypes.Init\n\n if (!IS_PRODUCTION) {\n // warn after resolving as we can create better contextual message here\n warn(!isString(actionObject.delay) || typeof sendAction.delay === 'number', // tslint:disable-next-line:max-line-length\n \"No delay reference for delay expression '\" + actionObject.delay + \"' was found on machine '\" + _this.machine.id + \"'\");\n }\n\n return sendAction;\n\n case log:\n return resolveLog(actionObject, updatedContext, _event);\n\n case pure:\n return actionObject.get(updatedContext, _event.data) || [];\n\n default:\n return toActionObject(actionObject, _this.options.actions);\n }\n }));\n\n var _c = __read(partition(resolvedActions, function (action) {\n return action.type === raise$1 || action.type === send && action.to === SpecialTargets.Internal;\n }), 2),\n raisedEvents = _c[0],\n nonRaisedActions = _c[1];\n\n var invokeActions = resolvedActions.filter(function (action) {\n return action.type === start$1 && action.activity.type === invoke;\n });\n var children = invokeActions.reduce(function (acc, action) {\n acc[action.activity.id] = createInvocableActor(action.activity);\n return acc;\n }, currentState ? __assign({}, currentState.children) : {});\n var resolvedConfiguration = resolvedStateValue ? stateTransition.configuration : currentState ? currentState.configuration : [];\n var meta = resolvedConfiguration.reduce(function (acc, stateNode) {\n if (stateNode.meta !== undefined) {\n acc[stateNode.id] = stateNode.meta;\n }\n\n return acc;\n }, {});\n var isDone = isInFinalState(resolvedConfiguration, this);\n var nextState = new State({\n value: resolvedStateValue || currentState.value,\n context: updatedContext,\n _event: _event,\n // Persist _sessionid between states\n _sessionid: currentState ? currentState._sessionid : null,\n historyValue: resolvedStateValue ? historyValue ? updateHistoryValue(historyValue, resolvedStateValue) : undefined : currentState ? currentState.historyValue : undefined,\n history: !resolvedStateValue || stateTransition.source ? currentState : undefined,\n actions: resolvedStateValue ? nonRaisedActions : [],\n activities: resolvedStateValue ? activities : currentState ? currentState.activities : {},\n meta: resolvedStateValue ? meta : currentState ? currentState.meta : undefined,\n events: [],\n configuration: resolvedConfiguration,\n transitions: stateTransition.transitions,\n children: children,\n done: isDone\n });\n nextState.changed = _event.name === update || !!assignActions.length; // Dispose of penultimate histories to prevent memory leaks\n\n var history = nextState.history;\n\n if (history) {\n delete history.history;\n }\n\n if (!resolvedStateValue) {\n return nextState;\n }\n\n var maybeNextState = nextState;\n\n if (!isDone) {\n var isTransient = this._transient || configuration.some(function (stateNode) {\n return stateNode._transient;\n });\n\n if (isTransient) {\n maybeNextState = this.resolveRaisedTransition(maybeNextState, {\n type: nullEvent\n }, _event);\n }\n\n while (raisedEvents.length) {\n var raisedEvent = raisedEvents.shift();\n maybeNextState = this.resolveRaisedTransition(maybeNextState, raisedEvent._event, _event);\n }\n } // Detect if state changed\n\n\n var changed = maybeNextState.changed || (history ? !!maybeNextState.actions.length || !!assignActions.length || _typeof(history.value) !== _typeof(maybeNextState.value) || !stateValuesEqual(maybeNextState.value, history.value) : undefined);\n maybeNextState.changed = changed; // Preserve original history after raised events\n\n maybeNextState.historyValue = nextState.historyValue;\n maybeNextState.history = history;\n return maybeNextState;\n };\n /**\r\n * Returns the child state node from its relative `stateKey`, or throws.\r\n */\n\n\n StateNode.prototype.getStateNode = function (stateKey) {\n if (isStateId(stateKey)) {\n return this.machine.getStateNodeById(stateKey);\n }\n\n if (!this.states) {\n throw new Error(\"Unable to retrieve child state '\" + stateKey + \"' from '\" + this.id + \"'; no child states exist.\");\n }\n\n var result = this.states[stateKey];\n\n if (!result) {\n throw new Error(\"Child state '\" + stateKey + \"' does not exist on '\" + this.id + \"'\");\n }\n\n return result;\n };\n /**\r\n * Returns the state node with the given `stateId`, or throws.\r\n *\r\n * @param stateId The state ID. The prefix \"#\" is removed.\r\n */\n\n\n StateNode.prototype.getStateNodeById = function (stateId) {\n var resolvedStateId = isStateId(stateId) ? stateId.slice(STATE_IDENTIFIER.length) : stateId;\n\n if (resolvedStateId === this.id) {\n return this;\n }\n\n var stateNode = this.machine.idMap[resolvedStateId];\n\n if (!stateNode) {\n throw new Error(\"Child state node '#\" + resolvedStateId + \"' does not exist on machine '\" + this.id + \"'\");\n }\n\n return stateNode;\n };\n /**\r\n * Returns the relative state node from the given `statePath`, or throws.\r\n *\r\n * @param statePath The string or string array relative path to the state node.\r\n */\n\n\n StateNode.prototype.getStateNodeByPath = function (statePath) {\n if (typeof statePath === 'string' && isStateId(statePath)) {\n try {\n return this.getStateNodeById(statePath.slice(1));\n } catch (e) {// try individual paths\n // throw e;\n }\n }\n\n var arrayStatePath = toStatePath(statePath, this.delimiter).slice();\n var currentStateNode = this;\n\n while (arrayStatePath.length) {\n var key = arrayStatePath.shift();\n\n if (!key.length) {\n break;\n }\n\n currentStateNode = currentStateNode.getStateNode(key);\n }\n\n return currentStateNode;\n };\n /**\r\n * Resolves a partial state value with its full representation in this machine.\r\n *\r\n * @param stateValue The partial state value to resolve.\r\n */\n\n\n StateNode.prototype.resolve = function (stateValue) {\n var _a;\n\n var _this = this;\n\n if (!stateValue) {\n return this.initialStateValue || EMPTY_OBJECT; // TODO: type-specific properties\n }\n\n switch (this.type) {\n case 'parallel':\n return mapValues(this.initialStateValue, function (subStateValue, subStateKey) {\n return subStateValue ? _this.getStateNode(subStateKey).resolve(stateValue[subStateKey] || subStateValue) : EMPTY_OBJECT;\n });\n\n case 'compound':\n if (isString(stateValue)) {\n var subStateNode = this.getStateNode(stateValue);\n\n if (subStateNode.type === 'parallel' || subStateNode.type === 'compound') {\n return _a = {}, _a[stateValue] = subStateNode.initialStateValue, _a;\n }\n\n return stateValue;\n }\n\n if (!keys(stateValue).length) {\n return this.initialStateValue || {};\n }\n\n return mapValues(stateValue, function (subStateValue, subStateKey) {\n return subStateValue ? _this.getStateNode(subStateKey).resolve(subStateValue) : EMPTY_OBJECT;\n });\n\n default:\n return stateValue || EMPTY_OBJECT;\n }\n };\n\n StateNode.prototype.getResolvedPath = function (stateIdentifier) {\n if (isStateId(stateIdentifier)) {\n var stateNode = this.machine.idMap[stateIdentifier.slice(STATE_IDENTIFIER.length)];\n\n if (!stateNode) {\n throw new Error(\"Unable to find state node '\" + stateIdentifier + \"'\");\n }\n\n return stateNode.path;\n }\n\n return toStatePath(stateIdentifier, this.delimiter);\n };\n\n Object.defineProperty(StateNode.prototype, \"initialStateValue\", {\n get: function get() {\n var _a;\n\n if (this.__cache.initialStateValue) {\n return this.__cache.initialStateValue;\n }\n\n var initialStateValue;\n\n if (this.type === 'parallel') {\n initialStateValue = mapFilterValues(this.states, function (state) {\n return state.initialStateValue || EMPTY_OBJECT;\n }, function (stateNode) {\n return !(stateNode.type === 'history');\n });\n } else if (this.initial !== undefined) {\n if (!this.states[this.initial]) {\n throw new Error(\"Initial state '\" + this.initial + \"' not found on '\" + this.key + \"'\");\n }\n\n initialStateValue = isLeafNode(this.states[this.initial]) ? this.initial : (_a = {}, _a[this.initial] = this.states[this.initial].initialStateValue, _a);\n }\n\n this.__cache.initialStateValue = initialStateValue;\n return this.__cache.initialStateValue;\n },\n enumerable: true,\n configurable: true\n });\n\n StateNode.prototype.getInitialState = function (stateValue, context) {\n var configuration = this.getStateNodes(stateValue);\n return this.resolveTransition({\n configuration: configuration,\n entrySet: configuration,\n exitSet: [],\n transitions: [],\n source: undefined,\n actions: []\n }, undefined, undefined, context);\n };\n\n Object.defineProperty(StateNode.prototype, \"initialState\", {\n /**\r\n * The initial State instance, which includes all actions to be executed from\r\n * entering the initial state.\r\n */\n get: function get() {\n this._init();\n\n var initialStateValue = this.initialStateValue;\n\n if (!initialStateValue) {\n throw new Error(\"Cannot retrieve initial state from simple state '\" + this.id + \"'.\");\n }\n\n return this.getInitialState(initialStateValue);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(StateNode.prototype, \"target\", {\n /**\r\n * The target state value of the history state node, if it exists. This represents the\r\n * default state value to transition to if no history value exists yet.\r\n */\n get: function get() {\n var target;\n\n if (this.type === 'history') {\n var historyConfig = this.config;\n\n if (isString(historyConfig.target)) {\n target = isStateId(historyConfig.target) ? pathToStateValue(this.machine.getStateNodeById(historyConfig.target).path.slice(this.path.length - 1)) : historyConfig.target;\n } else {\n target = historyConfig.target;\n }\n }\n\n return target;\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Returns the leaf nodes from a state path relative to this state node.\r\n *\r\n * @param relativeStateId The relative state path to retrieve the state nodes\r\n * @param history The previous state to retrieve history\r\n * @param resolve Whether state nodes should resolve to initial child state nodes\r\n */\n\n StateNode.prototype.getRelativeStateNodes = function (relativeStateId, historyValue, resolve) {\n if (resolve === void 0) {\n resolve = true;\n }\n\n return resolve ? relativeStateId.type === 'history' ? relativeStateId.resolveHistory(historyValue) : relativeStateId.initialStateNodes : [relativeStateId];\n };\n\n Object.defineProperty(StateNode.prototype, \"initialStateNodes\", {\n get: function get() {\n var _this = this;\n\n if (isLeafNode(this)) {\n return [this];\n } // Case when state node is compound but no initial state is defined\n\n\n if (this.type === 'compound' && !this.initial) {\n if (!IS_PRODUCTION) {\n warn(false, \"Compound state node '\" + this.id + \"' has no initial state.\");\n }\n\n return [this];\n }\n\n var initialStateNodePaths = toStatePaths(this.initialStateValue);\n return flatten(initialStateNodePaths.map(function (initialPath) {\n return _this.getFromRelativePath(initialPath);\n }));\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Retrieves state nodes from a relative path to this state node.\r\n *\r\n * @param relativePath The relative path from this state node\r\n * @param historyValue\r\n */\n\n StateNode.prototype.getFromRelativePath = function (relativePath) {\n if (!relativePath.length) {\n return [this];\n }\n\n var _a = __read(relativePath),\n stateKey = _a[0],\n childStatePath = _a.slice(1);\n\n if (!this.states) {\n throw new Error(\"Cannot retrieve subPath '\" + stateKey + \"' from node with no states\");\n }\n\n var childStateNode = this.getStateNode(stateKey);\n\n if (childStateNode.type === 'history') {\n return childStateNode.resolveHistory();\n }\n\n if (!this.states[stateKey]) {\n throw new Error(\"Child state '\" + stateKey + \"' does not exist on '\" + this.id + \"'\");\n }\n\n return this.states[stateKey].getFromRelativePath(childStatePath);\n };\n\n StateNode.prototype.historyValue = function (relativeStateValue) {\n if (!keys(this.states).length) {\n return undefined;\n }\n\n return {\n current: relativeStateValue || this.initialStateValue,\n states: mapFilterValues(this.states, function (stateNode, key) {\n if (!relativeStateValue) {\n return stateNode.historyValue();\n }\n\n var subStateValue = isString(relativeStateValue) ? undefined : relativeStateValue[key];\n return stateNode.historyValue(subStateValue || stateNode.initialStateValue);\n }, function (stateNode) {\n return !stateNode.history;\n })\n };\n };\n /**\r\n * Resolves to the historical value(s) of the parent state node,\r\n * represented by state nodes.\r\n *\r\n * @param historyValue\r\n */\n\n\n StateNode.prototype.resolveHistory = function (historyValue) {\n var _this = this;\n\n if (this.type !== 'history') {\n return [this];\n }\n\n var parent = this.parent;\n\n if (!historyValue) {\n var historyTarget = this.target;\n return historyTarget ? flatten(toStatePaths(historyTarget).map(function (relativeChildPath) {\n return parent.getFromRelativePath(relativeChildPath);\n })) : parent.initialStateNodes;\n }\n\n var subHistoryValue = nestedPath(parent.path, 'states')(historyValue).current;\n\n if (isString(subHistoryValue)) {\n return [parent.getStateNode(subHistoryValue)];\n }\n\n return flatten(toStatePaths(subHistoryValue).map(function (subStatePath) {\n return _this.history === 'deep' ? parent.getFromRelativePath(subStatePath) : [parent.states[subStatePath[0]]];\n }));\n };\n\n Object.defineProperty(StateNode.prototype, \"stateIds\", {\n /**\r\n * All the state node IDs of this state node and its descendant state nodes.\r\n */\n get: function get() {\n var _this = this;\n\n var childStateIds = flatten(keys(this.states).map(function (stateKey) {\n return _this.states[stateKey].stateIds;\n }));\n return [this.id].concat(childStateIds);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(StateNode.prototype, \"events\", {\n /**\r\n * All the event types accepted by this state node and its descendants.\r\n */\n get: function get() {\n var e_7, _a, e_8, _b;\n\n if (this.__cache.events) {\n return this.__cache.events;\n }\n\n var states = this.states;\n var events = new Set(this.ownEvents);\n\n if (states) {\n try {\n for (var _c = __values(keys(states)), _d = _c.next(); !_d.done; _d = _c.next()) {\n var stateId = _d.value;\n var state = states[stateId];\n\n if (state.states) {\n try {\n for (var _e = (e_8 = void 0, __values(state.events)), _f = _e.next(); !_f.done; _f = _e.next()) {\n var event_1 = _f.value;\n events.add(\"\" + event_1);\n }\n } catch (e_8_1) {\n e_8 = {\n error: e_8_1\n };\n } finally {\n try {\n if (_f && !_f.done && (_b = _e[\"return\"])) _b.call(_e);\n } finally {\n if (e_8) throw e_8.error;\n }\n }\n }\n }\n } catch (e_7_1) {\n e_7 = {\n error: e_7_1\n };\n } finally {\n try {\n if (_d && !_d.done && (_a = _c[\"return\"])) _a.call(_c);\n } finally {\n if (e_7) throw e_7.error;\n }\n }\n }\n\n return this.__cache.events = Array.from(events);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(StateNode.prototype, \"ownEvents\", {\n /**\r\n * All the events that have transitions directly from this state node.\r\n *\r\n * Excludes any inert events.\r\n */\n get: function get() {\n var events = new Set(this.transitions.filter(function (transition) {\n return !(!transition.target && !transition.actions.length && transition.internal);\n }).map(function (transition) {\n return transition.eventType;\n }));\n return Array.from(events);\n },\n enumerable: true,\n configurable: true\n });\n\n StateNode.prototype.resolveTarget = function (_target) {\n var _this = this;\n\n if (_target === undefined) {\n // an undefined target signals that the state node should not transition from that state when receiving that event\n return undefined;\n }\n\n return _target.map(function (target) {\n if (!isString(target)) {\n return target;\n }\n\n var isInternalTarget = target[0] === _this.delimiter; // If internal target is defined on machine,\n // do not include machine key on target\n\n if (isInternalTarget && !_this.parent) {\n return _this.getStateNodeByPath(target.slice(1));\n }\n\n var resolvedTarget = isInternalTarget ? _this.key + target : target;\n\n if (_this.parent) {\n try {\n var targetStateNode = _this.parent.getStateNodeByPath(resolvedTarget);\n\n return targetStateNode;\n } catch (err) {\n throw new Error(\"Invalid transition definition for state node '\" + _this.id + \"':\\n\" + err.message);\n }\n } else {\n return _this.getStateNodeByPath(resolvedTarget);\n }\n });\n };\n\n StateNode.prototype.formatTransition = function (transitionConfig) {\n var _this = this;\n\n var normalizedTarget = normalizeTarget(transitionConfig.target);\n var internal = 'internal' in transitionConfig ? transitionConfig.internal : normalizedTarget ? normalizedTarget.some(function (_target) {\n return isString(_target) && _target[0] === _this.delimiter;\n }) : true;\n var guards = this.machine.options.guards;\n var target = this.resolveTarget(normalizedTarget);\n return __assign(__assign({}, transitionConfig), {\n actions: toActionObjects(toArray(transitionConfig.actions)),\n cond: toGuard(transitionConfig.cond, guards),\n target: target,\n source: this,\n internal: internal,\n eventType: transitionConfig.event\n });\n };\n\n StateNode.prototype.formatTransitions = function () {\n var e_9, _a;\n\n var _this = this;\n\n var onConfig;\n\n if (!this.config.on) {\n onConfig = [];\n } else if (Array.isArray(this.config.on)) {\n onConfig = this.config.on;\n } else {\n var _b = this.config.on,\n _c = WILDCARD,\n _d = _b[_c],\n wildcardConfigs = _d === void 0 ? [] : _d,\n strictOnConfigs_1 = __rest(_b, [_typeof(_c) === \"symbol\" ? _c : _c + \"\"]);\n\n onConfig = flatten(keys(strictOnConfigs_1).map(function (key) {\n var arrayified = toTransitionConfigArray(key, strictOnConfigs_1[key]);\n\n if (!IS_PRODUCTION) {\n validateArrayifiedTransitions(_this, key, arrayified);\n }\n\n return arrayified;\n }).concat(toTransitionConfigArray(WILDCARD, wildcardConfigs)));\n }\n\n var doneConfig = this.config.onDone ? toTransitionConfigArray(String(done(this.id)), this.config.onDone) : [];\n var invokeConfig = flatten(this.invoke.map(function (invokeDef) {\n var settleTransitions = [];\n\n if (invokeDef.onDone) {\n settleTransitions.push.apply(settleTransitions, __spread(toTransitionConfigArray(String(doneInvoke(invokeDef.id)), invokeDef.onDone)));\n }\n\n if (invokeDef.onError) {\n settleTransitions.push.apply(settleTransitions, __spread(toTransitionConfigArray(String(error(invokeDef.id)), invokeDef.onError)));\n }\n\n return settleTransitions;\n }));\n var delayedTransitions = this.after;\n var formattedTransitions = flatten(__spread(doneConfig, invokeConfig, onConfig).map(function (transitionConfig) {\n return toArray(transitionConfig).map(function (transition) {\n return _this.formatTransition(transition);\n });\n }));\n\n try {\n for (var delayedTransitions_1 = __values(delayedTransitions), delayedTransitions_1_1 = delayedTransitions_1.next(); !delayedTransitions_1_1.done; delayedTransitions_1_1 = delayedTransitions_1.next()) {\n var delayedTransition = delayedTransitions_1_1.value;\n formattedTransitions.push(delayedTransition);\n }\n } catch (e_9_1) {\n e_9 = {\n error: e_9_1\n };\n } finally {\n try {\n if (delayedTransitions_1_1 && !delayedTransitions_1_1.done && (_a = delayedTransitions_1[\"return\"])) _a.call(delayedTransitions_1);\n } finally {\n if (e_9) throw e_9.error;\n }\n }\n\n return formattedTransitions;\n };\n\n return StateNode;\n}();\n\nexport { StateNode };","function createNullActor(id) {\n return {\n id: id,\n send: function send() {\n return void 0;\n },\n subscribe: function subscribe() {\n return {\n unsubscribe: function unsubscribe() {\n return void 0;\n }\n };\n },\n toJSON: function toJSON() {\n return {\n id: id\n };\n }\n };\n}\n/**\r\n * Creates a null actor that is able to be invoked given the provided\r\n * invocation information in its `.meta` value.\r\n *\r\n * @param invokeDefinition The meta information needed to invoke the actor.\r\n */\n\n\nfunction createInvocableActor(invokeDefinition) {\n var tempActor = createNullActor(invokeDefinition.id);\n tempActor.meta = invokeDefinition;\n return tempActor;\n}\n\nfunction isActor(item) {\n try {\n return typeof item.send === 'function';\n } catch (e) {\n return false;\n }\n}\n\nexport { createInvocableActor, createNullActor, isActor };","var children = /*#__PURE__*/new Map();\nvar sessionIdIndex = 0;\nvar registry = {\n bookId: function bookId() {\n return \"x:\" + sessionIdIndex++;\n },\n register: function register(id, actor) {\n children.set(id, actor);\n return id;\n },\n get: function get(id) {\n return children.get(id);\n },\n free: function free(id) {\n children[\"delete\"](id);\n }\n};\nexport { registry };","import React from \"react\";\nimport PropTypes from \"prop-types\";\n\nimport styled from \"@emotion/styled\";\nimport { css, keyframes } from \"@emotion/react\";\n\nconst LoadingIndicator = ({ label, subtle }) =>\n subtle ? (\n \n \n \n \n \n ) : (\n \n {label && {label}}\n \n \n \n \n );\n\nLoadingIndicator.propTypes = {\n label: PropTypes.string,\n subtle: PropTypes.bool,\n};\n\nLoadingIndicator.defaultProps = {\n label: \"\",\n subtle: false,\n};\n\nexport default LoadingIndicator;\n\n/* Styled Components\n======================================================= */\nconst Styled = {};\n\nStyled.Container = styled.div((props) => {\n const t: any = props.theme;\n return css`\n label: LoadingIndicator;\n ${[t.my(24), t.mx(\"auto\")]}\n display: flex;\n flex-direction: column;\n align-items: center;\n `;\n});\n\nStyled.Label = styled.div((props) => {\n const t: any = props.theme;\n return css`\n label: LoadingIndicator_Label;\n ${[t.text.xs, t.mb(2)]}\n color: ${t.dark ? t.color.gray[400] : t.color.gray[600]};\n `;\n});\n\nStyled.Bar = styled.div((props) => {\n const t: any = props.theme;\n return css`\n label: LoadingIndicator_Bar;\n ${[t.w(32)]}\n height: 0.1875rem;\n background-color: ${t.dark ? \"rgba(255,255,255,0.07)\" : t.color.gray[200]};\n position: relative;\n overflow: hidden;\n `;\n});\n\nStyled.Indicator = styled.div((props) => {\n const t: any = props.theme;\n return css`\n label: LoadingIndicator_Indicator;\n ${[t.w(16)]}\n height: 100%;\n position: absolute;\n background-color: ${t.dark ? t.color.gray[400] : t.color.black};\n transition: transform 0.3s ease-in;\n animation: ${loading} 1.5s infinite ease;\n `;\n});\n\nconst loading = keyframes`\n 0%, 100% {\n transform: translate(-3rem,0);\n }\n 50% {\n transform: translate(7rem,0);\n }\n`;\n\nconst subtleKeyframe = keyframes`\n 0% {\n height: 0.75rem;\n }\n 30%,\n 100% {\n height: 0.125rem;\n }\n`;\n\nStyled.Subtle = styled.div((props) => {\n const t: any = props.theme;\n return css`\n label: LoadingIndicator_Subtle;\n ${t.h(10)}\n display: flex;\n align-items: center;\n div {\n position: relative;\n width: 0.125rem;\n margin: 0.125rem;\n background-color: ${t.dark ? t.color.gray[400] : t.color.gray[300]};\n animation: ${subtleKeyframe} 1.6s cubic-bezier(0, 0.5, 0.5, 1) infinite;\n }\n div:nth-of-type(1) {\n animation-delay: -0.24s;\n }\n div:nth-of-type(2) {\n animation-delay: -0.12s;\n }\n div:nth-of-type(3) {\n animation-delay: 0;\n }\n `;\n});\n","window.logger =\n window.IS_DEVELOPMENT || window.CONSOLE_LOG_ENABLED\n ? // window.CONSOLE_LOG_ENABLED\n console.log.bind(window.console)\n : function () {};\n","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nimport { __values, __assign, __spread } from './_virtual/_tslib.js';\nimport { IS_PRODUCTION } from './environment.js';\nimport { warn, mapContext, isFunction, keys, toSCXMLEvent, isPromiseLike, isObservable, isMachine, reportUnhandledExceptionOnInvocation, symbolObservable, isArray, toEventObject, isString, uniqueId } from './utils.js';\nimport { ActionTypes, SpecialTargets } from './types.js';\nimport { isInFinalState } from './stateUtils.js';\nimport { errorPlatform, log, stop, start, cancel, send, update, error as error$1 } from './actionTypes.js';\nimport { doneInvoke, initEvent, getActionFunction, error } from './actions.js';\nimport { isState, State, bindActionToState } from './State.js';\nimport { isActor } from './Actor.js';\nimport { Scheduler } from './scheduler.js';\nimport { registry } from './registry.js';\nimport { registerService } from './devTools.js';\nvar DEFAULT_SPAWN_OPTIONS = {\n sync: false,\n autoForward: false\n};\n/**\r\n * Maintains a stack of the current service in scope.\r\n * This is used to provide the correct service to spawn().\r\n *\r\n * @private\r\n */\n\nvar withServiceScope = /*#__PURE__*/function () {\n var serviceStack = [];\n return function (service, fn) {\n service && serviceStack.push(service);\n var result = fn(service || serviceStack[serviceStack.length - 1]);\n service && serviceStack.pop();\n return result;\n };\n}();\n\nvar InterpreterStatus;\n\n(function (InterpreterStatus) {\n InterpreterStatus[InterpreterStatus[\"NotStarted\"] = 0] = \"NotStarted\";\n InterpreterStatus[InterpreterStatus[\"Running\"] = 1] = \"Running\";\n InterpreterStatus[InterpreterStatus[\"Stopped\"] = 2] = \"Stopped\";\n})(InterpreterStatus || (InterpreterStatus = {}));\n\nvar Interpreter =\n/*#__PURE__*/\n\n/** @class */\nfunction () {\n /**\r\n * Creates a new Interpreter instance (i.e., service) for the given machine with the provided options, if any.\r\n *\r\n * @param machine The machine to be interpreted\r\n * @param options Interpreter options\r\n */\n function Interpreter(machine, options) {\n var _this = this;\n\n if (options === void 0) {\n options = Interpreter.defaultOptions;\n }\n\n this.machine = machine;\n this.scheduler = new Scheduler();\n this.delayedEventsMap = {};\n this.listeners = new Set();\n this.contextListeners = new Set();\n this.stopListeners = new Set();\n this.doneListeners = new Set();\n this.eventListeners = new Set();\n this.sendListeners = new Set();\n /**\r\n * Whether the service is started.\r\n */\n\n this.initialized = false;\n this._status = InterpreterStatus.NotStarted;\n this.children = new Map();\n this.forwardTo = new Set();\n /**\r\n * Alias for Interpreter.prototype.start\r\n */\n\n this.init = this.start;\n /**\r\n * Sends an event to the running interpreter to trigger a transition.\r\n *\r\n * An array of events (batched) can be sent as well, which will send all\r\n * batched events to the running interpreter. The listeners will be\r\n * notified only **once** when all events are processed.\r\n *\r\n * @param event The event(s) to send\r\n */\n\n this.send = function (event, payload) {\n if (isArray(event)) {\n _this.batch(event);\n\n return _this.state;\n }\n\n var _event = toSCXMLEvent(toEventObject(event, payload));\n\n if (_this._status === InterpreterStatus.Stopped) {\n // do nothing\n if (!IS_PRODUCTION) {\n warn(false, \"Event \\\"\" + _event.name + \"\\\" was sent to stopped service \\\"\" + _this.machine.id + \"\\\". This service has already reached its final state, and will not transition.\\nEvent: \" + JSON.stringify(_event.data));\n }\n\n return _this.state;\n }\n\n if (_this._status === InterpreterStatus.NotStarted && _this.options.deferEvents) {\n // tslint:disable-next-line:no-console\n if (!IS_PRODUCTION) {\n warn(false, \"Event \\\"\" + _event.name + \"\\\" was sent to uninitialized service \\\"\" + _this.machine.id + \"\\\" and is deferred. Make sure .start() is called for this service.\\nEvent: \" + JSON.stringify(_event.data));\n }\n } else if (_this._status !== InterpreterStatus.Running) {\n throw new Error(\"Event \\\"\" + _event.name + \"\\\" was sent to uninitialized service \\\"\" + _this.machine.id + \"\\\". Make sure .start() is called for this service, or set { deferEvents: true } in the service options.\\nEvent: \" + JSON.stringify(_event.data));\n }\n\n _this.scheduler.schedule(function () {\n // Forward copy of event to child actors\n _this.forward(_event);\n\n var nextState = _this.nextState(_event);\n\n _this.update(nextState, _event);\n });\n\n return _this._state; // TODO: deprecate (should return void)\n // tslint:disable-next-line:semicolon\n };\n\n this.sendTo = function (event, to) {\n var isParent = _this.parent && (to === SpecialTargets.Parent || _this.parent.id === to);\n var target = isParent ? _this.parent : isActor(to) ? to : _this.children.get(to) || registry.get(to);\n\n if (!target) {\n if (!isParent) {\n throw new Error(\"Unable to send event to child '\" + to + \"' from service '\" + _this.id + \"'.\");\n } // tslint:disable-next-line:no-console\n\n\n if (!IS_PRODUCTION) {\n warn(false, \"Service '\" + _this.id + \"' has no parent: unable to send event \" + event.type);\n }\n\n return;\n }\n\n if ('machine' in target) {\n // Send SCXML events to machines\n target.send(__assign(__assign({}, event), {\n name: event.name === error$1 ? \"\" + error(_this.id) : event.name,\n origin: _this.sessionId\n }));\n } else {\n // Send normal events to other targets\n target.send(event.data);\n }\n };\n\n var resolvedOptions = __assign(__assign({}, Interpreter.defaultOptions), options);\n\n var clock = resolvedOptions.clock,\n logger = resolvedOptions.logger,\n parent = resolvedOptions.parent,\n id = resolvedOptions.id;\n var resolvedId = id !== undefined ? id : machine.id;\n this.id = resolvedId;\n this.logger = logger;\n this.clock = clock;\n this.parent = parent;\n this.options = resolvedOptions;\n this.scheduler = new Scheduler({\n deferEvents: this.options.deferEvents\n });\n this.sessionId = registry.bookId();\n }\n\n Object.defineProperty(Interpreter.prototype, \"initialState\", {\n get: function get() {\n var _this = this;\n\n if (this._initialState) {\n return this._initialState;\n }\n\n return withServiceScope(this, function () {\n _this._initialState = _this.machine.initialState;\n return _this._initialState;\n });\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Interpreter.prototype, \"state\", {\n get: function get() {\n if (!IS_PRODUCTION) {\n warn(this._status !== InterpreterStatus.NotStarted, \"Attempted to read state from uninitialized service '\" + this.id + \"'. Make sure the service is started first.\");\n }\n\n return this._state;\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Executes the actions of the given state, with that state's `context` and `event`.\r\n *\r\n * @param state The state whose actions will be executed\r\n * @param actionsConfig The action implementations to use\r\n */\n\n Interpreter.prototype.execute = function (state, actionsConfig) {\n var e_1, _a;\n\n try {\n for (var _b = __values(state.actions), _c = _b.next(); !_c.done; _c = _b.next()) {\n var action = _c.value;\n this.exec(action, state, actionsConfig);\n }\n } catch (e_1_1) {\n e_1 = {\n error: e_1_1\n };\n } finally {\n try {\n if (_c && !_c.done && (_a = _b[\"return\"])) _a.call(_b);\n } finally {\n if (e_1) throw e_1.error;\n }\n }\n };\n\n Interpreter.prototype.update = function (state, _event) {\n var e_2, _a, e_3, _b, e_4, _c, e_5, _d;\n\n var _this = this; // Attach session ID to state\n\n\n state._sessionid = this.sessionId; // Update state\n\n this._state = state; // Execute actions\n\n if (this.options.execute) {\n this.execute(this.state);\n } // Dev tools\n\n\n if (this.devTools) {\n this.devTools.send(_event.data, state);\n } // Execute listeners\n\n\n if (state.event) {\n try {\n for (var _e = __values(this.eventListeners), _f = _e.next(); !_f.done; _f = _e.next()) {\n var listener = _f.value;\n listener(state.event);\n }\n } catch (e_2_1) {\n e_2 = {\n error: e_2_1\n };\n } finally {\n try {\n if (_f && !_f.done && (_a = _e[\"return\"])) _a.call(_e);\n } finally {\n if (e_2) throw e_2.error;\n }\n }\n }\n\n try {\n for (var _g = __values(this.listeners), _h = _g.next(); !_h.done; _h = _g.next()) {\n var listener = _h.value;\n listener(state, state.event);\n }\n } catch (e_3_1) {\n e_3 = {\n error: e_3_1\n };\n } finally {\n try {\n if (_h && !_h.done && (_b = _g[\"return\"])) _b.call(_g);\n } finally {\n if (e_3) throw e_3.error;\n }\n }\n\n try {\n for (var _j = __values(this.contextListeners), _k = _j.next(); !_k.done; _k = _j.next()) {\n var contextListener = _k.value;\n contextListener(this.state.context, this.state.history ? this.state.history.context : undefined);\n }\n } catch (e_4_1) {\n e_4 = {\n error: e_4_1\n };\n } finally {\n try {\n if (_k && !_k.done && (_c = _j[\"return\"])) _c.call(_j);\n } finally {\n if (e_4) throw e_4.error;\n }\n }\n\n var isDone = isInFinalState(state.configuration || [], this.machine);\n\n if (this.state.configuration && isDone) {\n // get final child state node\n var finalChildStateNode = state.configuration.find(function (sn) {\n return sn.type === 'final' && sn.parent === _this.machine;\n });\n var doneData = finalChildStateNode && finalChildStateNode.data ? mapContext(finalChildStateNode.data, state.context, _event) : undefined;\n\n try {\n for (var _l = __values(this.doneListeners), _m = _l.next(); !_m.done; _m = _l.next()) {\n var listener = _m.value;\n listener(doneInvoke(this.id, doneData));\n }\n } catch (e_5_1) {\n e_5 = {\n error: e_5_1\n };\n } finally {\n try {\n if (_m && !_m.done && (_d = _l[\"return\"])) _d.call(_l);\n } finally {\n if (e_5) throw e_5.error;\n }\n }\n\n this.stop();\n }\n };\n /*\r\n * Adds a listener that is notified whenever a state transition happens. The listener is called with\r\n * the next state and the event object that caused the state transition.\r\n *\r\n * @param listener The state listener\r\n */\n\n\n Interpreter.prototype.onTransition = function (listener) {\n this.listeners.add(listener); // Send current state to listener\n\n if (this._status === InterpreterStatus.Running) {\n listener(this.state, this.state.event);\n }\n\n return this;\n };\n\n Interpreter.prototype.subscribe = function (nextListenerOrObserver, // @ts-ignore\n errorListener, completeListener) {\n var _this = this;\n\n if (!nextListenerOrObserver) {\n return {\n unsubscribe: function unsubscribe() {\n return void 0;\n }\n };\n }\n\n var listener;\n var resolvedCompleteListener = completeListener;\n\n if (typeof nextListenerOrObserver === 'function') {\n listener = nextListenerOrObserver;\n } else {\n listener = nextListenerOrObserver.next.bind(nextListenerOrObserver);\n resolvedCompleteListener = nextListenerOrObserver.complete.bind(nextListenerOrObserver);\n }\n\n this.listeners.add(listener); // Send current state to listener\n\n if (this._status === InterpreterStatus.Running) {\n listener(this.state);\n }\n\n if (resolvedCompleteListener) {\n this.onDone(resolvedCompleteListener);\n }\n\n return {\n unsubscribe: function unsubscribe() {\n listener && _this.listeners[\"delete\"](listener);\n resolvedCompleteListener && _this.doneListeners[\"delete\"](resolvedCompleteListener);\n }\n };\n };\n /**\r\n * Adds an event listener that is notified whenever an event is sent to the running interpreter.\r\n * @param listener The event listener\r\n */\n\n\n Interpreter.prototype.onEvent = function (listener) {\n this.eventListeners.add(listener);\n return this;\n };\n /**\r\n * Adds an event listener that is notified whenever a `send` event occurs.\r\n * @param listener The event listener\r\n */\n\n\n Interpreter.prototype.onSend = function (listener) {\n this.sendListeners.add(listener);\n return this;\n };\n /**\r\n * Adds a context listener that is notified whenever the state context changes.\r\n * @param listener The context listener\r\n */\n\n\n Interpreter.prototype.onChange = function (listener) {\n this.contextListeners.add(listener);\n return this;\n };\n /**\r\n * Adds a listener that is notified when the machine is stopped.\r\n * @param listener The listener\r\n */\n\n\n Interpreter.prototype.onStop = function (listener) {\n this.stopListeners.add(listener);\n return this;\n };\n /**\r\n * Adds a state listener that is notified when the statechart has reached its final state.\r\n * @param listener The state listener\r\n */\n\n\n Interpreter.prototype.onDone = function (listener) {\n this.doneListeners.add(listener);\n return this;\n };\n /**\r\n * Removes a listener.\r\n * @param listener The listener to remove\r\n */\n\n\n Interpreter.prototype.off = function (listener) {\n this.listeners[\"delete\"](listener);\n this.eventListeners[\"delete\"](listener);\n this.sendListeners[\"delete\"](listener);\n this.stopListeners[\"delete\"](listener);\n this.doneListeners[\"delete\"](listener);\n this.contextListeners[\"delete\"](listener);\n return this;\n };\n /**\r\n * Starts the interpreter from the given state, or the initial state.\r\n * @param initialState The state to start the statechart from\r\n */\n\n\n Interpreter.prototype.start = function (initialState) {\n var _this = this;\n\n if (this._status === InterpreterStatus.Running) {\n // Do not restart the service if it is already started\n return this;\n }\n\n registry.register(this.sessionId, this);\n this.initialized = true;\n this._status = InterpreterStatus.Running;\n var resolvedState = initialState === undefined ? this.initialState : withServiceScope(this, function () {\n return isState(initialState) ? _this.machine.resolveState(initialState) : _this.machine.resolveState(State.from(initialState, _this.machine.context));\n });\n\n if (this.options.devTools) {\n this.attachDev();\n }\n\n this.scheduler.initialize(function () {\n _this.update(resolvedState, initEvent);\n });\n return this;\n };\n /**\r\n * Stops the interpreter and unsubscribe all listeners.\r\n *\r\n * This will also notify the `onStop` listeners.\r\n */\n\n\n Interpreter.prototype.stop = function () {\n var e_6, _a, e_7, _b, e_8, _c, e_9, _d, e_10, _e;\n\n try {\n for (var _f = __values(this.listeners), _g = _f.next(); !_g.done; _g = _f.next()) {\n var listener = _g.value;\n this.listeners[\"delete\"](listener);\n }\n } catch (e_6_1) {\n e_6 = {\n error: e_6_1\n };\n } finally {\n try {\n if (_g && !_g.done && (_a = _f[\"return\"])) _a.call(_f);\n } finally {\n if (e_6) throw e_6.error;\n }\n }\n\n try {\n for (var _h = __values(this.stopListeners), _j = _h.next(); !_j.done; _j = _h.next()) {\n var listener = _j.value; // call listener, then remove\n\n listener();\n this.stopListeners[\"delete\"](listener);\n }\n } catch (e_7_1) {\n e_7 = {\n error: e_7_1\n };\n } finally {\n try {\n if (_j && !_j.done && (_b = _h[\"return\"])) _b.call(_h);\n } finally {\n if (e_7) throw e_7.error;\n }\n }\n\n try {\n for (var _k = __values(this.contextListeners), _l = _k.next(); !_l.done; _l = _k.next()) {\n var listener = _l.value;\n this.contextListeners[\"delete\"](listener);\n }\n } catch (e_8_1) {\n e_8 = {\n error: e_8_1\n };\n } finally {\n try {\n if (_l && !_l.done && (_c = _k[\"return\"])) _c.call(_k);\n } finally {\n if (e_8) throw e_8.error;\n }\n }\n\n try {\n for (var _m = __values(this.doneListeners), _o = _m.next(); !_o.done; _o = _m.next()) {\n var listener = _o.value;\n this.doneListeners[\"delete\"](listener);\n }\n } catch (e_9_1) {\n e_9 = {\n error: e_9_1\n };\n } finally {\n try {\n if (_o && !_o.done && (_d = _m[\"return\"])) _d.call(_m);\n } finally {\n if (e_9) throw e_9.error;\n }\n } // Stop all children\n\n\n this.children.forEach(function (child) {\n if (isFunction(child.stop)) {\n child.stop();\n }\n });\n\n try {\n // Cancel all delayed events\n for (var _p = __values(keys(this.delayedEventsMap)), _q = _p.next(); !_q.done; _q = _p.next()) {\n var key = _q.value;\n this.clock.clearTimeout(this.delayedEventsMap[key]);\n }\n } catch (e_10_1) {\n e_10 = {\n error: e_10_1\n };\n } finally {\n try {\n if (_q && !_q.done && (_e = _p[\"return\"])) _e.call(_p);\n } finally {\n if (e_10) throw e_10.error;\n }\n }\n\n this.scheduler.clear();\n this.initialized = false;\n this._status = InterpreterStatus.Stopped;\n registry.free(this.sessionId);\n return this;\n };\n\n Interpreter.prototype.batch = function (events) {\n var _this = this;\n\n if (this._status === InterpreterStatus.NotStarted && this.options.deferEvents) {\n // tslint:disable-next-line:no-console\n if (!IS_PRODUCTION) {\n warn(false, events.length + \" event(s) were sent to uninitialized service \\\"\" + this.machine.id + \"\\\" and are deferred. Make sure .start() is called for this service.\\nEvent: \" + JSON.stringify(event));\n }\n } else if (this._status !== InterpreterStatus.Running) {\n throw new Error( // tslint:disable-next-line:max-line-length\n events.length + \" event(s) were sent to uninitialized service \\\"\" + this.machine.id + \"\\\". Make sure .start() is called for this service, or set { deferEvents: true } in the service options.\");\n }\n\n this.scheduler.schedule(function () {\n var e_11, _a;\n\n var nextState = _this.state;\n var batchChanged = false;\n var batchedActions = [];\n\n var _loop_1 = function _loop_1(event_1) {\n var _event = toSCXMLEvent(event_1);\n\n _this.forward(_event);\n\n nextState = withServiceScope(_this, function () {\n return _this.machine.transition(nextState, _event);\n });\n batchedActions.push.apply(batchedActions, __spread(nextState.actions.map(function (a) {\n return bindActionToState(a, nextState);\n })));\n batchChanged = batchChanged || !!nextState.changed;\n };\n\n try {\n for (var events_1 = __values(events), events_1_1 = events_1.next(); !events_1_1.done; events_1_1 = events_1.next()) {\n var event_1 = events_1_1.value;\n\n _loop_1(event_1);\n }\n } catch (e_11_1) {\n e_11 = {\n error: e_11_1\n };\n } finally {\n try {\n if (events_1_1 && !events_1_1.done && (_a = events_1[\"return\"])) _a.call(events_1);\n } finally {\n if (e_11) throw e_11.error;\n }\n }\n\n nextState.changed = batchChanged;\n nextState.actions = batchedActions;\n\n _this.update(nextState, toSCXMLEvent(events[events.length - 1]));\n });\n };\n /**\r\n * Returns a send function bound to this interpreter instance.\r\n *\r\n * @param event The event to be sent by the sender.\r\n */\n\n\n Interpreter.prototype.sender = function (event) {\n return this.send.bind(this, event);\n };\n /**\r\n * Returns the next state given the interpreter's current state and the event.\r\n *\r\n * This is a pure method that does _not_ update the interpreter's state.\r\n *\r\n * @param event The event to determine the next state\r\n */\n\n\n Interpreter.prototype.nextState = function (event) {\n var _this = this;\n\n var _event = toSCXMLEvent(event);\n\n if (_event.name.indexOf(errorPlatform) === 0 && !this.state.nextEvents.some(function (nextEvent) {\n return nextEvent.indexOf(errorPlatform) === 0;\n })) {\n throw _event.data.data;\n }\n\n var nextState = withServiceScope(this, function () {\n return _this.machine.transition(_this.state, _event);\n });\n return nextState;\n };\n\n Interpreter.prototype.forward = function (event) {\n var e_12, _a;\n\n try {\n for (var _b = __values(this.forwardTo), _c = _b.next(); !_c.done; _c = _b.next()) {\n var id = _c.value;\n var child = this.children.get(id);\n\n if (!child) {\n throw new Error(\"Unable to forward event '\" + event + \"' from interpreter '\" + this.id + \"' to nonexistant child '\" + id + \"'.\");\n }\n\n child.send(event);\n }\n } catch (e_12_1) {\n e_12 = {\n error: e_12_1\n };\n } finally {\n try {\n if (_c && !_c.done && (_a = _b[\"return\"])) _a.call(_b);\n } finally {\n if (e_12) throw e_12.error;\n }\n }\n };\n\n Interpreter.prototype.defer = function (sendAction) {\n var _this = this;\n\n this.delayedEventsMap[sendAction.id] = this.clock.setTimeout(function () {\n if (sendAction.to) {\n _this.sendTo(sendAction._event, sendAction.to);\n } else {\n _this.send(sendAction._event);\n }\n }, sendAction.delay);\n };\n\n Interpreter.prototype.cancel = function (sendId) {\n this.clock.clearTimeout(this.delayedEventsMap[sendId]);\n delete this.delayedEventsMap[sendId];\n };\n\n Interpreter.prototype.exec = function (action, state, actionFunctionMap) {\n var context = state.context,\n _event = state._event;\n var actionOrExec = getActionFunction(action.type, actionFunctionMap) || action.exec;\n var exec = isFunction(actionOrExec) ? actionOrExec : actionOrExec ? actionOrExec.exec : action.exec;\n\n if (exec) {\n try {\n return exec(context, _event.data, {\n action: action,\n state: this.state,\n _event: _event\n });\n } catch (err) {\n if (this.parent) {\n this.parent.send({\n type: 'xstate.error',\n data: err\n });\n }\n\n throw err;\n }\n }\n\n switch (action.type) {\n case send:\n var sendAction = action;\n\n if (typeof sendAction.delay === 'number') {\n this.defer(sendAction);\n return;\n } else {\n if (sendAction.to) {\n this.sendTo(sendAction._event, sendAction.to);\n } else {\n this.send(sendAction._event);\n }\n }\n\n break;\n\n case cancel:\n this.cancel(action.sendId);\n break;\n\n case start:\n {\n var activity = action.activity; // If the activity will be stopped right after it's started\n // (such as in transient states)\n // don't bother starting the activity.\n\n if (!this.state.activities[activity.type]) {\n break;\n } // Invoked services\n\n\n if (activity.type === ActionTypes.Invoke) {\n var serviceCreator = this.machine.options.services ? this.machine.options.services[activity.src] : undefined;\n var id = activity.id,\n data = activity.data;\n\n if (!IS_PRODUCTION) {\n warn(!('forward' in activity), // tslint:disable-next-line:max-line-length\n \"`forward` property is deprecated (found in invocation of '\" + activity.src + \"' in in machine '\" + this.machine.id + \"'). \" + \"Please use `autoForward` instead.\");\n }\n\n var autoForward = 'autoForward' in activity ? activity.autoForward : !!activity.forward;\n\n if (!serviceCreator) {\n // tslint:disable-next-line:no-console\n if (!IS_PRODUCTION) {\n warn(false, \"No service found for invocation '\" + activity.src + \"' in machine '\" + this.machine.id + \"'.\");\n }\n\n return;\n }\n\n var source = isFunction(serviceCreator) ? serviceCreator(context, _event.data) : serviceCreator;\n\n if (isPromiseLike(source)) {\n this.state.children[id] = this.spawnPromise(Promise.resolve(source), id);\n } else if (isFunction(source)) {\n this.state.children[id] = this.spawnCallback(source, id);\n } else if (isObservable(source)) {\n this.state.children[id] = this.spawnObservable(source, id);\n } else if (isMachine(source)) {\n // TODO: try/catch here\n this.state.children[id] = this.spawnMachine(data ? source.withContext(mapContext(data, context, _event)) : source, {\n id: id,\n autoForward: autoForward\n });\n }\n } else {\n this.spawnActivity(activity);\n }\n\n break;\n }\n\n case stop:\n {\n this.stopChild(action.activity.id);\n break;\n }\n\n case log:\n var label = action.label,\n value = action.value;\n\n if (label) {\n this.logger(label, value);\n } else {\n this.logger(value);\n }\n\n break;\n\n default:\n if (!IS_PRODUCTION) {\n warn(false, \"No implementation found for action type '\" + action.type + \"'\");\n }\n\n break;\n }\n\n return undefined;\n };\n\n Interpreter.prototype.stopChild = function (childId) {\n var child = this.children.get(childId);\n\n if (!child) {\n return;\n }\n\n this.children[\"delete\"](childId);\n this.forwardTo[\"delete\"](childId);\n delete this.state.children[childId];\n\n if (isFunction(child.stop)) {\n child.stop();\n }\n };\n\n Interpreter.prototype.spawn = function (entity, name, options) {\n if (isPromiseLike(entity)) {\n return this.spawnPromise(Promise.resolve(entity), name);\n } else if (isFunction(entity)) {\n return this.spawnCallback(entity, name);\n } else if (isActor(entity)) {\n return this.spawnActor(entity);\n } else if (isObservable(entity)) {\n return this.spawnObservable(entity, name);\n } else if (isMachine(entity)) {\n return this.spawnMachine(entity, __assign(__assign({}, options), {\n id: name\n }));\n } else {\n throw new Error(\"Unable to spawn entity \\\"\" + name + \"\\\" of type \\\"\" + _typeof(entity) + \"\\\".\");\n }\n };\n\n Interpreter.prototype.spawnMachine = function (machine, options) {\n var _this = this;\n\n if (options === void 0) {\n options = {};\n }\n\n var childService = new Interpreter(machine, __assign(__assign({}, this.options), {\n parent: this,\n id: options.id || machine.id\n }));\n\n var resolvedOptions = __assign(__assign({}, DEFAULT_SPAWN_OPTIONS), options);\n\n if (resolvedOptions.sync) {\n childService.onTransition(function (state) {\n _this.send(update, {\n state: state,\n id: childService.id\n });\n });\n }\n\n childService.onDone(function (doneEvent) {\n _this.send(toSCXMLEvent(doneEvent, {\n origin: childService.id\n }));\n }).start();\n var actor = childService;\n this.children.set(childService.id, actor);\n\n if (resolvedOptions.autoForward) {\n this.forwardTo.add(childService.id);\n }\n\n return actor;\n };\n\n Interpreter.prototype.spawnPromise = function (promise, id) {\n var _this = this;\n\n var canceled = false;\n promise.then(function (response) {\n if (!canceled) {\n _this.send(toSCXMLEvent(doneInvoke(id, response), {\n origin: id\n }));\n }\n }, function (errorData) {\n if (!canceled) {\n var errorEvent = error(id, errorData);\n\n try {\n // Send \"error.platform.id\" to this (parent).\n _this.send(toSCXMLEvent(errorEvent, {\n origin: id\n }));\n } catch (error) {\n reportUnhandledExceptionOnInvocation(errorData, error, id);\n\n if (_this.devTools) {\n _this.devTools.send(errorEvent, _this.state);\n }\n\n if (_this.machine.strict) {\n // it would be better to always stop the state machine if unhandled\n // exception/promise rejection happens but because we don't want to\n // break existing code so enforce it on strict mode only especially so\n // because documentation says that onError is optional\n _this.stop();\n }\n }\n }\n });\n var actor = {\n id: id,\n send: function send() {\n return void 0;\n },\n subscribe: function subscribe(next, handleError, complete) {\n var unsubscribed = false;\n promise.then(function (response) {\n if (unsubscribed) {\n return;\n }\n\n next && next(response);\n\n if (unsubscribed) {\n return;\n }\n\n complete && complete();\n }, function (err) {\n if (unsubscribed) {\n return;\n }\n\n handleError(err);\n });\n return {\n unsubscribe: function unsubscribe() {\n return unsubscribed = true;\n }\n };\n },\n stop: function stop() {\n canceled = true;\n },\n toJSON: function toJSON() {\n return {\n id: id\n };\n }\n };\n this.children.set(id, actor);\n return actor;\n };\n\n Interpreter.prototype.spawnCallback = function (callback, id) {\n var _this = this;\n\n var canceled = false;\n var receivers = new Set();\n var listeners = new Set();\n\n var receive = function receive(e) {\n listeners.forEach(function (listener) {\n return listener(e);\n });\n\n if (canceled) {\n return;\n }\n\n _this.send(e);\n };\n\n var callbackStop;\n\n try {\n callbackStop = callback(receive, function (newListener) {\n receivers.add(newListener);\n });\n } catch (err) {\n this.send(error(id, err));\n }\n\n if (isPromiseLike(callbackStop)) {\n // it turned out to be an async function, can't reliably check this before calling `callback`\n // because transpiled async functions are not recognizable\n return this.spawnPromise(callbackStop, id);\n }\n\n var actor = {\n id: id,\n send: function send(event) {\n return receivers.forEach(function (receiver) {\n return receiver(event);\n });\n },\n subscribe: function subscribe(next) {\n listeners.add(next);\n return {\n unsubscribe: function unsubscribe() {\n listeners[\"delete\"](next);\n }\n };\n },\n stop: function stop() {\n canceled = true;\n\n if (isFunction(callbackStop)) {\n callbackStop();\n }\n },\n toJSON: function toJSON() {\n return {\n id: id\n };\n }\n };\n this.children.set(id, actor);\n return actor;\n };\n\n Interpreter.prototype.spawnObservable = function (source, id) {\n var _this = this;\n\n var subscription = source.subscribe(function (value) {\n _this.send(toSCXMLEvent(value, {\n origin: id\n }));\n }, function (err) {\n _this.send(toSCXMLEvent(error(id, err), {\n origin: id\n }));\n }, function () {\n _this.send(toSCXMLEvent(doneInvoke(id), {\n origin: id\n }));\n });\n var actor = {\n id: id,\n send: function send() {\n return void 0;\n },\n subscribe: function subscribe(next, handleError, complete) {\n return source.subscribe(next, handleError, complete);\n },\n stop: function stop() {\n return subscription.unsubscribe();\n },\n toJSON: function toJSON() {\n return {\n id: id\n };\n }\n };\n this.children.set(id, actor);\n return actor;\n };\n\n Interpreter.prototype.spawnActor = function (actor) {\n this.children.set(actor.id, actor);\n return actor;\n };\n\n Interpreter.prototype.spawnActivity = function (activity) {\n var implementation = this.machine.options && this.machine.options.activities ? this.machine.options.activities[activity.type] : undefined;\n\n if (!implementation) {\n if (!IS_PRODUCTION) {\n warn(false, \"No implementation found for activity '\" + activity.type + \"'\");\n } // tslint:disable-next-line:no-console\n\n\n return;\n } // Start implementation\n\n\n var dispose = implementation(this.state.context, activity);\n this.spawnEffect(activity.id, dispose);\n };\n\n Interpreter.prototype.spawnEffect = function (id, dispose) {\n this.children.set(id, {\n id: id,\n send: function send() {\n return void 0;\n },\n subscribe: function subscribe() {\n return {\n unsubscribe: function unsubscribe() {\n return void 0;\n }\n };\n },\n stop: dispose || undefined,\n toJSON: function toJSON() {\n return {\n id: id\n };\n }\n });\n };\n\n Interpreter.prototype.attachDev = function () {\n if (this.options.devTools && typeof window !== 'undefined') {\n if (window.__REDUX_DEVTOOLS_EXTENSION__) {\n var devToolsOptions = _typeof(this.options.devTools) === 'object' ? this.options.devTools : undefined;\n this.devTools = window.__REDUX_DEVTOOLS_EXTENSION__.connect(__assign(__assign({\n name: this.id,\n autoPause: true,\n stateSanitizer: function stateSanitizer(state) {\n return {\n value: state.value,\n context: state.context,\n actions: state.actions\n };\n }\n }, devToolsOptions), {\n features: __assign({\n jump: false,\n skip: false\n }, devToolsOptions ? devToolsOptions.features : undefined)\n }), this.machine);\n this.devTools.init(this.state);\n } // add XState-specific dev tooling hook\n\n\n registerService(this);\n }\n };\n\n Interpreter.prototype.toJSON = function () {\n return {\n id: this.id\n };\n };\n\n Interpreter.prototype[symbolObservable] = function () {\n return this;\n };\n /**\r\n * The default interpreter options:\r\n *\r\n * - `clock` uses the global `setTimeout` and `clearTimeout` functions\r\n * - `logger` uses the global `console.log()` method\r\n */\n\n\n Interpreter.defaultOptions = /*#__PURE__*/function (global) {\n return {\n execute: true,\n deferEvents: true,\n clock: {\n setTimeout: function setTimeout(fn, ms) {\n return global.setTimeout.call(null, fn, ms);\n },\n clearTimeout: function clearTimeout(id) {\n return global.clearTimeout.call(null, id);\n }\n },\n logger: global.console.log.bind(console),\n devTools: false\n };\n }(typeof window === 'undefined' ? global : window);\n\n Interpreter.interpret = interpret;\n return Interpreter;\n}();\n\nvar createNullActor = function createNullActor(name) {\n if (name === void 0) {\n name = 'null';\n }\n\n return {\n id: name,\n send: function send() {\n return void 0;\n },\n subscribe: function subscribe() {\n // tslint:disable-next-line:no-empty\n return {\n unsubscribe: function unsubscribe() {}\n };\n },\n toJSON: function toJSON() {\n return {\n id: name\n };\n }\n };\n};\n\nvar resolveSpawnOptions = function resolveSpawnOptions(nameOrOptions) {\n if (isString(nameOrOptions)) {\n return __assign(__assign({}, DEFAULT_SPAWN_OPTIONS), {\n name: nameOrOptions\n });\n }\n\n return __assign(__assign(__assign({}, DEFAULT_SPAWN_OPTIONS), {\n name: uniqueId()\n }), nameOrOptions);\n};\n\nfunction spawn(entity, nameOrOptions) {\n var resolvedOptions = resolveSpawnOptions(nameOrOptions);\n return withServiceScope(undefined, function (service) {\n if (!IS_PRODUCTION) {\n warn(!!service, \"Attempted to spawn an Actor (ID: \\\"\" + (isMachine(entity) ? entity.id : 'undefined') + \"\\\") outside of a service. This will have no effect.\");\n }\n\n if (service) {\n return service.spawn(entity, resolvedOptions.name, resolvedOptions);\n } else {\n return createNullActor(resolvedOptions.name);\n }\n });\n}\n/**\r\n * Creates a new Interpreter instance for the given machine with the provided options, if any.\r\n *\r\n * @param machine The machine to interpret\r\n * @param options Interpreter options\r\n */\n\n\nfunction interpret(machine, options) {\n var interpreter = new Interpreter(machine, options);\n return interpreter;\n}\n\nexport { Interpreter, interpret, spawn };","import { StateNode } from './StateNode.js';\n\nfunction Machine(config, options, initialContext) {\n if (initialContext === void 0) {\n initialContext = config.context;\n }\n\n var resolvedInitialContext = typeof initialContext === 'function' ? initialContext() : initialContext;\n return new StateNode(config, options, resolvedInitialContext);\n}\n\nfunction createMachine(config, options) {\n var resolvedInitialContext = typeof config.context === 'function' ? config.context() : config.context;\n return new StateNode(config, options, resolvedInitialContext);\n}\n\nexport { Machine, createMachine };","import find from \"lodash/find\";\nimport isArray from \"lodash/isArray\";\n\nimport countriesData from \"@ats/src/lib/countries.json\";\nimport usStatesData from \"@ats/src/lib/usStates.json\";\nimport currencyCodes from \"@ats/src/lib/currencyCodes.json\";\n\nexport const findSelectOptionByValue = (options, value) => {\n if (isArray(value)) {\n return value.map((val) => find(options, (option) => option.value === val));\n }\n return find(options, (option) => option.value === value);\n};\n\nexport const findSelectOptionByLabel = (options, name) => {\n return find(options, (o) => o.label === name);\n};\n\nexport const getOptionLabel = (options, value) => {\n const option = findSelectOptionByValue(options, value);\n return option ? option.label : \"---\";\n};\n\n// Generic - Yes Or No\nexport const yesOrNoOptions = [\n { value: false, label: \"No\" },\n { value: true, label: \"Yes\" },\n];\n\n// Generic = Enabled or Disabled\nexport const enabledOrDisabledOptions = [\n { value: false, label: \"Disabled\" },\n { value: true, label: \"Enabled\" }\n]\n\n/* Questions\n--===================================================-- */\nexport const questionKindOptions = [\n { value: \"text_short\", label: \"Short answer\" },\n { value: \"text_long\", label: \"Long answer\" },\n { value: \"single_select\", label: \"Multiple-choice (single select)\" },\n { value: \"multi_select\", label: \"Multiple-choice (multi select)\" },\n { value: \"file_upload\", label: \"File upload\" },\n];\n\nexport const questionKindNames = (name) => {\n const option = findSelectOptionByValue(questionKindOptions, name);\n return option ? option.label : \"---\";\n};\n\n/* Default Job Form Settings\n--===================================================-- */\nexport const defaultJobSettings = {\n firstName: \"required\",\n lastName: \"required\",\n email: \"required\",\n phone: \"optional\",\n location: \"optional\",\n coverLetter: \"optional\",\n linkedinUrl: \"hidden\",\n githubUrl: \"hidden\",\n twitterUrl: \"hidden\",\n dribbbleUrl: \"hidden\",\n websiteUrl: \"hidden\",\n resume: \"required\",\n};\n\nexport const jobSettingOptions = [\n {\n value: \"required\",\n label: \"Required\",\n note: \"Candidates must fill this out\",\n },\n { value: \"optional\", label: \"Optional\", note: \"This field is optional\" },\n {\n value: \"hidden\",\n label: \"Hidden\",\n note: \"Candidates will not see this field\",\n },\n];\n\nexport const questionVisibilityOptions = [\n {\n value: \"visibility_public\",\n label: \"Entire hiring team\",\n note: \"Everyone on the hiring team and assigned interviewers can view the answer to this question\",\n },\n {\n value: \"visibility_private\",\n label: \"Admin only\",\n note: \"Only admins can view the answer to this question\",\n },\n];\n\nexport const jobSettingNames = (name) => {\n const option = findSelectOptionByValue(jobSettingOptions, name);\n return option ? option.label : \"---\";\n};\n\n/* careerNavigationOptions\n--===================================================-- */\nexport const careerNavigationOptions = [\n { value: false, label: \"Default\" },\n { value: true, label: \"Custom URL\" },\n];\n\nexport const careerNavigationNames = (name) => {\n const option = findSelectOptionByValue(careerNavigationOptions, name);\n return option ? option.label : \"---\";\n};\n\n/* jobBoardBrandingOptions\n--===================================================-- */\n\nexport const jobBoardLogoVisibilityOptions = [\n { value: \"logo_visibility_both_logo_and_name\", label: \"Show logo and name\" },\n { value: \"logo_visibility_logo_only\", label: \"Show logo only\" },\n { value: \"logo_visibility_name_only\", label: \"Show name only\" },\n];\n\nexport const socialShareImageTypeOptions = [\n { value: \"social_share_image_type_default\", label: \"Default\" },\n { value: \"social_share_image_type_custom\", label: \"Custom\" },\n { value: \"social_share_image_type_none\", label: \"None\" },\n];\n\nexport const jobOverrideSocialShareImageTypeOptions = [\n { value: \"default\", label: \"Default\" },\n { value: \"custom\", label: \"Custom\" },\n { value: \"none\", label: \"None\" },\n];\n\nexport const billboardMediaTypeOptions = [\n { value: \"billboard_media_type_none\", label: \"None\" },\n { value: \"billboard_media_type_image\", label: \"Image\" },\n { value: \"billboard_media_type_video\", label: \"Video\" },\n];\n\n// User - Roles\nexport const userRoleOptions = [\n {\n value: \"org_admin\",\n label: \"Admin\",\n roleAbilities:\n \"Admins can access all jobs, create jobs, assign members to jobs, invite new members, and change member roles.\",\n },\n {\n value: \"org_user\",\n label: \"Member\",\n roleAbilities:\n \"Members can only access jobs they have been assigned to. They cannot create jobs or invite new members.\",\n },\n {\n value: \"org_interviewer\",\n label: \"Interviewer\",\n roleAbilities:\n \"Interviewers can only submit candidate reviews. They can only access candidate information via the Review Kit\",\n },\n];\n\nexport const userRoleNames = (name) => {\n const option = findSelectOptionByValue(userRoleOptions, name);\n return option ? option.label : \"---\";\n};\n\n// Job - Kind\nexport const jobKindOptions = [\n { value: \"full_time\", label: \"Full-time\" },\n { value: \"part_time\", label: \"Part-time\" },\n { value: \"part_time_or_full_time\", label: \"Part-time or Full-time\" },\n { value: \"temporary\", label: \"Temporary\" },\n { value: \"contract\", label: \"Contract\" },\n { value: \"internship\", label: \"Internship\" },\n { value: \"volunteer\", label: \"Volunteer\" },\n { value: \"other\", label: \"Other\" },\n];\n\nexport const jobKindNames = (name) => {\n const option = findSelectOptionByValue(jobKindOptions, name);\n return option ? option.label : \"---\";\n};\n\n// Job - Category\nexport const jobCategoryOptions = [\n { value: \"category_sales_and_marketing\", label: \"Sales & Marketing\" },\n { value: \"category_design_and_ux\", label: \"Design & User Experience\" },\n { value: \"category_product_management\", label: \"Product Management\" },\n { value: \"category_customer_and_community\", label: \"Customer & Community\" },\n { value: \"category_content_and_copywriting\", label: \"Content & Copywriting\" },\n { value: \"category_software_development\", label: \"Software Development\" },\n { value: \"category_devops_and_sysadmin\", label: \"Dev Ops & Sysadmin\" },\n { value: \"category_operations_and_finance\", label: \"Operations & Finance\" },\n { value: \"category_quality_assurance\", label: \"Quality Assurance\" },\n { value: \"category_hr_and_recruiting\", label: \"HR & Recruiting\" },\n { value: \"category_security\", label: \"Security\" },\n { value: \"category_other\", label: \"Other\" },\n];\n\nexport const jobCategoryNames = (name) => {\n const option = findSelectOptionByValue(jobCategoryOptions, name);\n return option ? option.label : \"---\";\n};\n\n// Job - Status\nexport const jobStatusOptions = [\n { value: \"draft\", label: \"Draft\" },\n { value: \"published\", label: \"Published\" },\n { value: \"in_review\", label: \"In review\" },\n { value: \"status_archived\", label: \"Archived\" },\n];\n\nexport const jobStatusNames = (name) => {\n const option = findSelectOptionByValue(jobStatusOptions, name);\n return option ? option.label : \"---\";\n};\n\n// Organization - Kind\nexport const organizationKindOptions = [\n { value: \"kind_claimed\", label: \"Claimed\" },\n { value: \"kind_wrk_managed\", label: \"Polymer Managed\" },\n { value: \"kind_scrapable\", label: \"Scrapable\" },\n];\n\nexport const organizationKindNames = (name) => {\n const option = findSelectOptionByValue(organizationKindOptions, name);\n return option ? option.label : \"---\";\n};\n\n// Organization - Plan\nexport const organizationPlanOptions = [\n { value: \"plan_no_plan\", label: \"No Plan\" },\n { value: \"plan_simple_ats_free\", label: \"Free\" },\n { value: \"plan_simple_ats_paid\", label: \"Paid Unlimited Monthly\" },\n { value: \"plan_simple_ats_per_job\", label: \"Paid - Per Job\" },\n { value: \"plan_ats_tier_gemini\", label: \"Paid - Gemini\" },\n { value: \"plan_ats_tier_apollo\", label: \"Paid - Apollo\" },\n { value: \"plan_ats_tier_artemis\", label: \"Paid - Artemis\" },\n];\n\nexport const organizationPlanNames = (name) => {\n const option = findSelectOptionByValue(organizationPlanOptions, name);\n return option ? option.label : \"---\";\n};\n\nexport const adminOrganizationFlipperGroupOptions = [\n { value: \"flipper_group_all\", label: \"Default\" },\n { value: \"flipper_group_beta_testers\", label: \"Beta Testers\" },\n];\n\nexport const adminBooleanOptions = [\n { value: true, label: \"True\" },\n { value: false, label: \"False\" },\n];\n\n/* Interview - Venue\n--===================================================-- */\nexport const interviewVenueOptions = [\n { value: \"phone\", label: \"Phone\" },\n { value: \"video\", label: \"Video\" },\n { value: \"in_person\", label: \"In person\" },\n];\n\n/* Interview - Kind\n--===================================================-- */\nexport const interviewSynchronicityOptions = [\n { value: \"synchronous\", label: \"Live\" }, // Synchronous\n { value: \"asynchronous\", label: \"Take home\" }, // Asynchronous\n];\n\n// JobApplication - Stage\nexport const jobApplicationStageOptions = [\n { value: \"inbox\", label: \"Inbox\" },\n { value: \"application\", label: \"Application\" },\n { value: \"screen\", label: \"Screen\" },\n { value: \"interview\", label: \"Interview\" },\n { value: \"decide\", label: \"Decide\" },\n { value: \"offer\", label: \"Offer\" },\n];\n\nexport const interviewableJobApplicationStageOptions = [\n { value: \"screen\", label: \"Screen\" },\n { value: \"interview\", label: \"Interview\" },\n];\n\nexport const jobApplicationStageNames = (name) => {\n const option = findSelectOptionByValue(jobApplicationStageOptions, name);\n return option ? option.label : \"---\";\n};\n\n// JobApplication - Status\nexport const jobApplicationStatusOptions = [\n { value: \"status_in_process\", label: \"In process\" },\n { value: \"status_archived\", label: \"Archived\" },\n { value: \"status_hired\", label: \"Hired\" },\n];\n\nexport const jobApplicationStatusNames = (name) => {\n const option = findSelectOptionByValue(jobApplicationStatusOptions, name);\n return option ? option.label : \"---\";\n};\n\n// JobApplication - Archive Reason\nexport const jobApplicationArchiveReasonOptions = [\n { value: \"archive_position_filled\", label: \"Position filled\" },\n { value: \"archive_duplicate\", label: \"Duplicate\" },\n { value: \"archive_underqualified\", label: \"Underqualified\" },\n { value: \"archive_accepted_another_offer\", label: \"Accepted another offer\" },\n { value: \"archive_not_responding\", label: \"Not responding\" },\n { value: \"archive_not_interested\", label: \"Not interested\" },\n { value: \"archive_compensation\", label: \"Compensation\" },\n { value: \"archive_other\", label: \"Other\" },\n];\n\nexport const jobApplicationArchiveReasonNames = (name) => {\n const option = findSelectOptionByValue(jobApplicationArchiveReasonOptions, name);\n return option ? option.label : \"---\";\n};\n\n// Scorecard\nexport const scorecardRatingOptions = [\n { value: \"strong_yes\", label: \"Strong yes\" },\n { value: \"weak_yes\", label: \"Weak yes\" },\n { value: \"weak_no\", label: \"Weak no\" },\n { value: \"strong_no\", label: \"Strong no\" },\n];\n\nexport const scorecardRatingNames = (name) => {\n const option = findSelectOptionByValue(scorecardRatingOptions, name);\n return option ? option.label : \"---\";\n};\n\n// Interview\nexport const interviewStatusOptions = [\n { value: \"inactive\", label: \"Inactive\" },\n { value: \"active\", label: \"Open\" },\n { value: \"closed\", label: \"Closed\" },\n];\n\nexport const interviewStatusNames = (name) => {\n const option = findSelectOptionByValue(interviewStatusOptions, name);\n return option ? option.label : \"---\";\n};\n\n/* COUNTRY AND REGION DATA\n--===================================================-- */\n/* Country Data\n--===================================================-- */\nexport const countryOptions = () => {\n return countriesData.map((country) => {\n return { value: country.code, label: country.name };\n });\n};\n\n/* State/Region Data\n--===================================================-- */\nexport const unitedStatesOptions = () => {\n return usStatesData.map((state) => {\n return { value: state.code, label: state.name };\n });\n};\n\n// Organization - Remoteness\nexport const organizationRemotenessOptions = [\n // { value: \"remoteness_none\", label: \"No Remote\" },\n { value: \"remoteness_some\", label: \"Some remote\" },\n { value: \"remoteness_mostly\", label: \"Mostly remote\" },\n { value: \"remoteness_fully\", label: \"Fully distributed\" },\n];\n\nexport const organizationRemotenessNames = (name) => {\n const option = findSelectOptionByValue(organizationRemotenessOptions, name);\n return option ? option.label : \"---\";\n};\n\nexport const remoteRestrictionCountryResidencyIsRequiredNames = (name) => {\n const option = findSelectOptionByValue(yesOrNoOptions, name);\n return option ? option.label : \"---\";\n};\n\nexport const remoteRestrictionOverlapHoursIsRequiredNames = (name) => {\n const option = findSelectOptionByValue(yesOrNoOptions, name);\n return option ? option.label : \"---\";\n};\n\n// Job - Remoteness\nexport const jobRemotenessOptions = [\n { value: \"remoteness_none\", label: \"No remote\" },\n { value: \"remoteness_optional\", label: \"Remote friendly\" },\n { value: \"remoteness_hybrid\", label: \"Hybrid\" },\n { value: \"remoteness_only\", label: \"Remote (only)\" },\n];\n\nexport const jobRemotenessNames = (name) => {\n const option = findSelectOptionByValue(jobRemotenessOptions, name);\n return option ? option.label : \"---\";\n};\n\n// Job - applyThrough\nexport const applyThroughOptions = [\n { value: \"apply_through_hire\", label: \"Through a Polymer posting\" },\n { value: \"apply_through_third_party_ats\", label: \"Through your own link\" },\n];\n\nexport const applyThroughNames = (name) => {\n const option = findSelectOptionByValue(applyThroughOptions, name);\n return option ? option.label : \"---\";\n};\n\n// Job - remoteRestrictionOverlapHours\nexport const remoteRestrictionOverlapHoursOptions = [\n { value: 1, label: \"1 hour\" },\n { value: 2, label: \"2 hours\" },\n { value: 3, label: \"3 hours\" },\n { value: 4, label: \"4 hours\" },\n { value: 5, label: \"5 hours\" },\n { value: 6, label: \"6 hours\" },\n { value: 7, label: \"7 hours\" },\n { value: 8, label: \"8 hours\" },\n];\n\nexport const remoteRestrictionOverlapHoursNames = (name) => {\n const option = findSelectOptionByValue(remoteRestrictionOverlapHoursOptions, name);\n return option ? option.label : \"---\";\n};\n\n// Stripe\n\nexport const cardBrand = (brand) => {\n const cards = {\n amex: \"American Express\",\n diners: \"Diners\",\n discover: \"Discover\",\n jcb: \"JCB\",\n mastercard: \"Mastercard\",\n unionpay: \"Unionpay\",\n visa: \"Visa\",\n };\n\n return cards[brand] || \"Unknown\";\n};\n\n/* We Work Remotely WWR\n--===================================================-- */\nexport const wwrCategoryOptions = [\n { value: \"category_design\", label: \"Design\" },\n // { value: \"category_programming\", label: \"Programming\" },\n { value: \"category_fullstack_programming\", label: \"Full-Stack Programming\" },\n { value: \"category_frontend_programming\", label: \"Front-End Programming\" },\n { value: \"category_backend_programming\", label: \"Back-End Programming\" },\n { value: \"category_customer_support\", label: \"Customer Support\" },\n // { value: \"category_copywriting\", label: \"Copywriting\" },\n { value: \"category_devops_and_sysadmin\", label: \"DevOps and Sysadmin\" },\n { value: \"category_sales_and_marketing\", label: \"Sales and Marketing\" },\n {\n value: \"category_business_and_management\",\n label: \"Business, Management and Finance\",\n },\n { value: \"category_product\", label: \"Product\" },\n { value: \"category_all_other\", label: \"All Other Remote\" },\n // { value: \"category_finance_and_legal\", label: \"Finance & Legal\" },\n // { value: \"category_administrative\", label: \"Administrative\" },\n // { value: \"category_education\", label: \"Education\" },\n // {\n // value: \"category_translation_and_transcription\",\n // label: \"Translation & Transcription\",\n // },\n // { value: \"category_medical_and_health\", label: \"Medical/Health\" },\n];\n\nexport const wwrUpgradeCosts = {\n good: { price: \"59\", total: \"358\" },\n better: { price: \"99\", total: \"398\" },\n best: { price: \"149\", total: \"448\" },\n};\n\n/* Polymer Job Fields\n--===================================================-- */\n// export const webflowJobFieldMappingOptions = [\n// { value: \"title\", label: \"Title\", type: \"PlainText\" },\n// { value: \"description\", label: \"Description\", type: \"RichText\" },\n// { value: \"kind\", label: \"Employment type\", type: \"PlainText\" },\n// { value: \"category\", label: \"Category\", type: \"PlainText\" },\n// // { value: \"department\", label: \"Department\" },\n// { value: \"location\", label: \"Location\", type: \"PlainText\" },\n// { value: \"remoteness\", label: \"Remote friendliness\", type: \"PlainText\" },\n// { value: \"publishedAt\", label: \"Published at\", type: \"DateTime\" },\n// { value: \"applicationUrl\", label: \"Application form URL\", type: \"Link\" },\n// ];\nexport const webflowJobFieldMappingOptions = (isApiV2) => {\n const dateTimeType = isApiV2 ? \"DateTime\" : \"Date\";\n return [\n { value: \"title\", label: \"Title\", type: \"PlainText\" },\n { value: \"description\", label: \"Description\", type: \"RichText\" },\n { value: \"kind\", label: \"Employment type\", type: \"PlainText\" },\n { value: \"category\", label: \"Category\", type: \"PlainText\" },\n // { value: \"department\", label: \"Department\" },\n { value: \"location\", label: \"Location\", type: \"PlainText\" },\n { value: \"remoteness\", label: \"Remote friendliness\", type: \"PlainText\" },\n { value: \"publishedAt\", label: \"Published at\", type: dateTimeType },\n { value: \"applicationUrl\", label: \"Application form URL\", type: \"Link\" },\n ];\n};\n\n/* Review Rating Options\n--===================================================-- */\nexport const reviewRatingOptions = [\n { label: \"Strong yes\", value: \"strong_yes\" },\n { label: \"Weak yes\", value: \"weak_yes\" },\n { label: \"Weak no\", value: \"weak_no\" },\n { label: \"Strong no\", value: \"strong_no\" },\n { label: \"No rating\", value: \"opt_out\" },\n];\n\nexport const salaryUnitOptions = [\n { label: \"Hourly\", value: \"HOUR\" },\n { label: \"Daily\", value: \"DAY\" },\n { label: \"Weekly\", value: \"WEEK\" },\n { label: \"Monthly\", value: \"MONTH\" },\n { label: \"Yearly\", value: \"YEAR\" },\n];\n\nexport const salaryCurrencyCodeOptions = currencyCodes.map((code) => ({\n label: code.code,\n value: code.code,\n}));\n\nexport const localeCodeOptions = [\n { label: \"English (en)\", value: \"en\" },\n { label: \"Dutch (de)\", value: \"de\" },\n { label: \"Swedish (se)\", value: \"se\"}, \n];\n","import React, { Component } from \"react\";\n\nimport isEmpty from \"lodash/isEmpty\";\nimport isArray from \"lodash/isArray\";\nimport isObject from \"lodash/isObject\";\nimport lowerCase from \"lodash/lowerCase\";\nimport upperFirst from \"lodash/upperFirst\";\n\nimport styled from \"@emotion/styled\";\nimport { css } from \"@emotion/react\";\nimport { prettyErrorsArray } from \"@shared/lib/formHelpers\";\n\nclass FormContainer extends Component {\n static displayName = \"FormContainer\";\n\n formErrors = (errors) => {\n if (errors && isArray(errors) && !isEmpty(errors)) {\n return this.handleErrorsArray(errors);\n } else if (errors && isObject(errors) && !isEmpty(errors)) {\n return this.handleErrorsObject(errors);\n }\n };\n\n /* Likely used to handle Joi errors\n --===================================================-- */\n handleErrorsArray = (errors) => {\n return errors.map((error, index) => {\n const key = error.context ? error.context.key : error.key;\n const keyRegex = error.context ? new RegExp(`\"${key}\" `, \"gi\") : new RegExp(`${key} `, \"gi\");\n const message = error.message ? error.message.replace(keyRegex, \"\") : error;\n return {`${upperFirst(lowerCase(key))} ${message}`};\n });\n };\n\n /* Likely Used to handle Rails and Yup errors\n --===================================================-- */\n handleErrorsObject = (errors) => {\n let groupErrorText;\n if (errors && errors.customQuestionsErrors && !isEmpty(errors.customQuestionsErrors)) {\n return Questions are missing a response;\n } else {\n return prettyErrorsArray(errors).map((error, index) => {\n return {error};\n });\n }\n };\n\n // Note the second param \"ref\" provided by React.forwardRef.\n // We can pass it along to LogProps as a regular prop, e.g. \"forwardedRef\"\n // And it can then be attached to the Component.\n // return React.forwardRef((props, ref) => {\n // return ;\n // });\n\n render() {\n // window.logger(\"%c[FormContainer] props\", \"color: #1976D2\", this.props);\n const { id, children, buttons, errors, onSubmit, className } = this.props;\n const formErrors = this.formErrors(errors);\n\n return (\n \n );\n }\n}\n\nexport default FormContainer;\n\n/* Styled Components\n======================================================= */\nconst Styled = {};\n\nStyled.ErrorsContainer = styled.div((props) => {\n const t: any = props.theme;\n return css`\n label: FormContainer_ErrorsContainer;\n ${[t.p(2), t.my(6), t.rounded.sm]}\n border: 1px solid ${t.dark ? t.color.red[400] : t.color.red[600]};\n background-color: ${t.dark ? t.color.gray[800] : t.color.red[100]};\n color: ${t.dark ? t.color.red[400] : t.color.red[600]};\n\n ${t.mq[\"md\"]} {\n ${[t.px(2), t.py(1)]}\n }\n `;\n});\n\nStyled.ErrorsLabel = styled.span((props) => {\n const t: any = props.theme;\n return css`\n label: FormContainer_ErrorsLabel;\n ${[t.text.sm, t.text.medium]}\n\n ${t.mq[\"md\"]} {\n ${t.text.xs}\n }\n `;\n});\n\nStyled.ErrorsList = styled.ul((props) => {\n const t: any = props.theme;\n return css`\n label: FormContainer_ErrorsList;\n ${[t.text.base, t.mt(1), t.pl(6)]}\n list-style-type: disc;\n li {\n ${t.mb(1)}\n }\n\n ${t.mq[\"md\"]} {\n ${t.text.sm}\n }\n `;\n});\n\nStyled.Buttons = styled.ul((props) => {\n const t: any = props.theme;\n return css`\n label: FormContainer_Buttons;\n ${t.mt(10)}\n\n ${t.mq[\"md\"]} {\n ${t.mt(8)}\n }\n `;\n});\n","var baseGetTag = require('./_baseGetTag'),\n isArray = require('./isArray'),\n isObjectLike = require('./isObjectLike');\n/** `Object#toString` result references. */\n\n\nvar stringTag = '[object String]';\n/**\n * Checks if `value` is classified as a `String` primitive or object.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a string, else `false`.\n * @example\n *\n * _.isString('abc');\n * // => true\n *\n * _.isString(1);\n * // => false\n */\n\nfunction isString(value) {\n return typeof value == 'string' || !isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag;\n}\n\nmodule.exports = isString;","'use strict';\n\nmodule.exports = function (str) {\n return encodeURIComponent(str).replace(/[!'()*]/g, function (x) {\n return \"%\".concat(x.charCodeAt(0).toString(16).toUpperCase());\n });\n};","'use strict';\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nvar token = '%[a-f0-9]{2}';\nvar singleMatcher = new RegExp(token, 'gi');\nvar multiMatcher = new RegExp('(' + token + ')+', 'gi');\n\nfunction decodeComponents(components, split) {\n try {\n // Try to decode the entire string first\n return decodeURIComponent(components.join(''));\n } catch (err) {// Do nothing\n }\n\n if (components.length === 1) {\n return components;\n }\n\n split = split || 1; // Split the array in 2 parts\n\n var left = components.slice(0, split);\n var right = components.slice(split);\n return Array.prototype.concat.call([], decodeComponents(left), decodeComponents(right));\n}\n\nfunction decode(input) {\n try {\n return decodeURIComponent(input);\n } catch (err) {\n var tokens = input.match(singleMatcher);\n\n for (var i = 1; i < tokens.length; i++) {\n input = decodeComponents(tokens, i).join('');\n tokens = input.match(singleMatcher);\n }\n\n return input;\n }\n}\n\nfunction customDecodeURIComponent(input) {\n // Keep track of all the replacements and prefill the map with the `BOM`\n var replaceMap = {\n '%FE%FF': \"\\uFFFD\\uFFFD\",\n '%FF%FE': \"\\uFFFD\\uFFFD\"\n };\n var match = multiMatcher.exec(input);\n\n while (match) {\n try {\n // Decode as big chunks as possible\n replaceMap[match[0]] = decodeURIComponent(match[0]);\n } catch (err) {\n var result = decode(match[0]);\n\n if (result !== match[0]) {\n replaceMap[match[0]] = result;\n }\n }\n\n match = multiMatcher.exec(input);\n } // Add `%C2` at the end of the map to make sure it does not replace the combinator before everything else\n\n\n replaceMap['%C2'] = \"\\uFFFD\";\n var entries = Object.keys(replaceMap);\n\n for (var i = 0; i < entries.length; i++) {\n // Replace all decoded components\n var key = entries[i];\n input = input.replace(new RegExp(key, 'g'), replaceMap[key]);\n }\n\n return input;\n}\n\nmodule.exports = function (encodedURI) {\n if (typeof encodedURI !== 'string') {\n throw new TypeError('Expected `encodedURI` to be of type `string`, got `' + _typeof(encodedURI) + '`');\n }\n\n try {\n encodedURI = encodedURI.replace(/\\+/g, ' '); // Try the built in decoder first\n\n return decodeURIComponent(encodedURI);\n } catch (err) {\n // Fallback to a more advanced decoder\n return customDecodeURIComponent(encodedURI);\n }\n};","import { __assign } from './_virtual/_tslib.js';\nvar defaultOptions = {\n deferEvents: false\n};\n\nvar Scheduler =\n/*#__PURE__*/\n\n/** @class */\nfunction () {\n function Scheduler(options) {\n this.processingEvent = false;\n this.queue = [];\n this.initialized = false;\n this.options = __assign(__assign({}, defaultOptions), options);\n }\n\n Scheduler.prototype.initialize = function (callback) {\n this.initialized = true;\n\n if (callback) {\n if (!this.options.deferEvents) {\n this.schedule(callback);\n return;\n }\n\n this.process(callback);\n }\n\n this.flushEvents();\n };\n\n Scheduler.prototype.schedule = function (task) {\n if (!this.initialized || this.processingEvent) {\n this.queue.push(task);\n return;\n }\n\n if (this.queue.length !== 0) {\n throw new Error('Event queue should be empty when it is not processing events');\n }\n\n this.process(task);\n this.flushEvents();\n };\n\n Scheduler.prototype.clear = function () {\n this.queue = [];\n };\n\n Scheduler.prototype.flushEvents = function () {\n var nextCallback = this.queue.shift();\n\n while (nextCallback) {\n this.process(nextCallback);\n nextCallback = this.queue.shift();\n }\n };\n\n Scheduler.prototype.process = function (callback) {\n this.processingEvent = true;\n\n try {\n callback();\n } catch (e) {\n // there is no use to keep the future events\n // as the situation is not anymore the same\n this.clear();\n throw e;\n } finally {\n this.processingEvent = false;\n }\n };\n\n return Scheduler;\n}();\n\nexport { Scheduler };","import React from \"react\";\nimport PropTypes from \"prop-types\";\n\nimport styled from \"@emotion/styled\";\nimport { css } from \"@emotion/react\";\n\nconst FormLabel = (props) => {\n return (\n \n \n \n {props.isRequired && ({props.requiredLabel})}\n \n {props.error && {props.error}}\n \n );\n};\n\nFormLabel.propTypes = {\n label: PropTypes.string,\n for: PropTypes.string,\n isRequired: PropTypes.bool,\n error: PropTypes.string,\n requiredLabel: PropTypes.string,\n};\n\nFormLabel.defaultProps = {\n requiredLabel: \"required\",\n};\n\nexport default FormLabel;\n\n/* Styled Components\n======================================================= */\nconst Styled = {};\n\nStyled.Container = styled.div`\n label: FormLabel;\n display: flex;\n justify-content: space-between;\n align-items: baseline;\n`;\n\nStyled.Label = styled.div((props) => {\n const t: any = props.theme;\n return css`\n label: FormLabel_Label;\n ${[t.text.sm, t.text.bold]}\n color: ${t.dark ? t.color.gray[300] : t.color.black};\n display: inline-block;\n line-height: 1.4;\n margin-bottom: 0.375rem;\n\n ${t.mq[\"md\"]} {\n ${[t.text.xs]}\n }\n `;\n});\n\nStyled.RequiredLabel = styled.span((props) => {\n const t: any = props.theme;\n return css`\n label: FormLabel_RequiredLabel;\n ${[t.text.normal, t.ml(1)]}\n color: ${t.dark ? t.color.gray[400] : t.color.gray[600]};\n `;\n});\n\nStyled.Error = styled.div((props) => {\n const t: any = props.theme;\n return css`\n label: FormLabel_Error;\n ${t.text.sm}\n color: ${t.dark ? t.color.red[400] : t.color.red[600]};\n\n ${t.mq[\"md\"]} {\n ${[t.text.xs]}\n }\n `;\n});\n","import { ActionTypes } from './types.js'; // xstate-specific action types\n\nvar start = ActionTypes.Start;\nvar stop = ActionTypes.Stop;\nvar raise = ActionTypes.Raise;\nvar send = ActionTypes.Send;\nvar cancel = ActionTypes.Cancel;\nvar nullEvent = ActionTypes.NullEvent;\nvar assign = ActionTypes.Assign;\nvar after = ActionTypes.After;\nvar doneState = ActionTypes.DoneState;\nvar log = ActionTypes.Log;\nvar init = ActionTypes.Init;\nvar invoke = ActionTypes.Invoke;\nvar errorExecution = ActionTypes.ErrorExecution;\nvar errorPlatform = ActionTypes.ErrorPlatform;\nvar error = ActionTypes.ErrorCustom;\nvar update = ActionTypes.Update;\nvar pure = ActionTypes.Pure;\nexport { after, assign, cancel, doneState, error, errorExecution, errorPlatform, init, invoke, log, nullEvent, pure, raise, send, start, stop, update };","var ActionTypes;\n\n(function (ActionTypes) {\n ActionTypes[\"Start\"] = \"xstate.start\";\n ActionTypes[\"Stop\"] = \"xstate.stop\";\n ActionTypes[\"Raise\"] = \"xstate.raise\";\n ActionTypes[\"Send\"] = \"xstate.send\";\n ActionTypes[\"Cancel\"] = \"xstate.cancel\";\n ActionTypes[\"NullEvent\"] = \"\";\n ActionTypes[\"Assign\"] = \"xstate.assign\";\n ActionTypes[\"After\"] = \"xstate.after\";\n ActionTypes[\"DoneState\"] = \"done.state\";\n ActionTypes[\"DoneInvoke\"] = \"done.invoke\";\n ActionTypes[\"Log\"] = \"xstate.log\";\n ActionTypes[\"Init\"] = \"xstate.init\";\n ActionTypes[\"Invoke\"] = \"xstate.invoke\";\n ActionTypes[\"ErrorExecution\"] = \"error.execution\";\n ActionTypes[\"ErrorCommunication\"] = \"error.communication\";\n ActionTypes[\"ErrorPlatform\"] = \"error.platform\";\n ActionTypes[\"ErrorCustom\"] = \"xstate.error\";\n ActionTypes[\"Update\"] = \"xstate.update\";\n ActionTypes[\"Pure\"] = \"xstate.pure\";\n})(ActionTypes || (ActionTypes = {}));\n\nvar SpecialTargets;\n\n(function (SpecialTargets) {\n SpecialTargets[\"Parent\"] = \"#_parent\";\n SpecialTargets[\"Internal\"] = \"#_internal\";\n})(SpecialTargets || (SpecialTargets = {}));\n\nexport { ActionTypes, SpecialTargets };","import keys from \"lodash/keys\";\nimport isArray from \"lodash/isArray\";\nimport isObject from \"lodash/isObject\";\nimport lowerCase from \"lodash/lowerCase\";\nimport upperFirst from \"lodash/upperFirst\";\n\nexport const errorTextViaYupOrRailsOrJoi = (props: { errors: any; name: string }) => {\n const { errors, name } = props;\n if (errors == undefined) {\n return null;\n }\n // console.log(\"%c[formHelpers] errorTextViaYupOrRailsOrJoi\", \"background-color: #65FF92\", {\n // errors,\n // name,\n // });\n\n if (errors && isObject(errors) && errors[name]) {\n let error: { fieldError?: any } = errors[name];\n\n return isArray(error) && (error as string[]).length > 0\n ? (error as string[]).join(\", \") // Rails generated error\n : isObject(error) // isObject returns true for Arrays so must be checked second\n ? error.fieldError // Yup generated error\n : null;\n }\n};\n\n// export const processErrors = (errors) => {\n// if (errors && isArray(errors) && !isEmpty(errors)) {\n// return handleErrorsArray(errors);\n// } else if (errors && isObject(errors) && !isEmpty(errors)) {\n// console.log(\n// \"%c[formHelpers] ERRORS Object NOT HANDLED YET\",\n// \"background: red; color: white\",\n// errors,\n// );\n// return handleErrorsObject(errors);\n// }\n// };\n\n// const handleErrorsArray = (errors) => {\n// return errors.reduce((accumulator, error) => {\n// const key = error.context ? error.context.key : error.key;\n// const keyRegex = error.context ? new RegExp(`\"${key}\" `, \"gi\") : new RegExp(`${key} `, \"gi\");\n// const message = error.message ? error.message.replace(keyRegex, \"\") : error;\n// accumulator[key] = message;\n// return accumulator;\n// }, {});\n// };\n\n// const handleErrorsObject = (errors) => {\n// return errors;\n// };\n\nexport const prettyErrorsArray = (errors) => {\n return keys(errors)\n .map((key) => {\n console.log(\"%c[formHelpers] prettyErrorsArray\", \"background-color: #110378; color: white;\", {\n errors,\n key,\n });\n const error = errors[key];\n if (key === \"customQuestionsErrors\") {\n return null;\n }\n\n if (isArray(error)) {\n // Rails Errors\n return key !== \"general\" ? `${upperFirst(lowerCase(key))} ${error[0]}` : error[0];\n } else if (error.groupError != undefined) {\n // Yup Errors\n return error.groupError;\n } else {\n return null;\n }\n })\n .filter((error) => error != undefined);\n};\n","import keys from \"lodash/keys\";\nimport isString from \"lodash/isString\";\nimport isArray from \"lodash/isArray\";\nimport isPlainObject from \"lodash/isPlainObject\";\n\n/* standardizeQueryParamsObject\n--===================================================-- */\n// This ensures that search params are in an Array\nexport function standardizeQueryParamsObject(queryObject) {\n const queryKeys = keys(queryObject);\n let filterObject = queryObject;\n queryKeys.forEach((filterKey) => {\n if (isString(filterObject[filterKey])) {\n let value = filterObject[filterKey];\n filterObject[filterKey] = [value];\n }\n });\n return filterObject;\n}\n\nexport const trimFilename = (filename) => {\n let cutStart, cutEnd;\n\n if (filename.length > 20) {\n cutStart = 10;\n cutEnd = filename.length - 7;\n return filename.substr(0, cutStart) + \"...\" + filename.substr(cutEnd + 1);\n } else {\n return filename;\n }\n};\n\nexport const clearUrlParams = (history) => {\n history.push({ search: \"\" });\n};\n\n/* URLS\n--===================================================-- */\nexport const addHttpsPrefix = (url) => {\n if (url == undefined) {\n return null;\n }\n\n // return url.replace(/(^\\w+:|^)\\/\\//, \"\");\n return url.test(/(^\\w+:|^)\\/\\//, \"\");\n};\n\nexport const removeHttpPrefix = (url) => {\n if (url == undefined) {\n return null;\n }\n\n return url.replace(/(^\\w+:|^)\\/\\//, \"\"); // removes http:// or https://\n};\n\nexport const removeKnownUrlPrefix = (url) => {\n if (url == undefined) {\n return null;\n }\n\n return removeHttpPrefix(url) // removes http:// or https://\n .replace(/(^www\\.)/, \"\") // removes www\n .replace(/(^linkedin\\.com\\/in\\/)/, \"\") // removes linkedin.com\n .replace(/(^twitter\\.com\\/)/, \"\") // removes twitter.com\n .replace(/(^github\\.com\\/)/, \"\") // removes github.com\n .replace(/(^dribbble\\.com\\/)/, \"\"); // removes dribbble.com\n // .replace(/(\\/$)/, \"\"); // removes trailing slashes\n};\n\n/* Remove from Array\n--===================================================-- */\nexport const removeFromArray = (array, fn) => {\n const index = array.findIndex(fn);\n\n return removeFromArrayAtIndex(array, index);\n};\n\nexport const removeFromArrayAtIndex = (array, index) => {\n return [...array.slice(0, index), ...array.slice(index + 1, array.length)];\n};\n\nexport const insertIntoArrayAtIndex = (array, item, index) => {\n console.log(\"%c[utils] insertIntoArrayAtIndex\", \"color: #1976D2\", { array, item, index });\n return [...array.slice(0, index), item, ...array.slice(index, array.length)];\n};\n\nexport const moveFromIndexToIndex = (array, fromIndex, toIndex) => {\n const item = array[fromIndex];\n let newArray = removeFromArrayAtIndex(array, fromIndex);\n return insertIntoArrayAtIndex(newArray, item, toIndex);\n};\n\n/* Convert Array to Select Options\n--===================================================-- */\nexport const convertArrayToSelectOptions = (options) => {\n return options.map((option, index) => {\n return { value: option, label: option };\n });\n};\n\n/* FORMATTING\n--===================================================-- */\nexport const formatPhoneNumber = (str) => {\n //Filter only numbers from the input\n let cleaned = (\"\" + str).replace(/\\D/g, \"\");\n\n //Check if the input is of correct\n let match = cleaned.match(/^(1|)?(\\d{3})(\\d{3})(\\d{4})$/);\n\n if (match) {\n //Remove the matched extension code\n // TODO: Change this to format for any country code.\n let intlCode = match[1] ? \"+1 \" : \"\";\n return [intlCode, \"(\", match[2], \") \", match[3], \"-\", match[4]].join(\"\");\n }\n\n return str;\n};\n\n/* Check Object for Empty, Null, or Undefined Values\n--====================================================-- */\nexport const objectHasEmptyValues = (obj) => {\n return Object.values(obj).some((value) => {\n if (value === null || value === undefined || value === \"\") {\n return true;\n }\n if (isArray(value) && value.length === 0) {\n return true;\n }\n if (isPlainObject(value) && keys(value).length === 0) {\n return true;\n }\n\n return false;\n });\n};\n","import { __values } from './_virtual/_tslib.js';\nimport { keys, matchesState } from './utils.js';\n\nfunction mapState(stateMap, stateId) {\n var e_1, _a;\n\n var foundStateId;\n\n try {\n for (var _b = __values(keys(stateMap)), _c = _b.next(); !_c.done; _c = _b.next()) {\n var mappedStateId = _c.value;\n\n if (matchesState(mappedStateId, stateId) && (!foundStateId || stateId.length > foundStateId.length)) {\n foundStateId = mappedStateId;\n }\n }\n } catch (e_1_1) {\n e_1 = {\n error: e_1_1\n };\n } finally {\n try {\n if (_c && !_c.done && (_a = _b[\"return\"])) _a.call(_b);\n } finally {\n if (e_1) throw e_1.error;\n }\n }\n\n return stateMap[foundStateId];\n}\n\nexport { mapState };","import { __values, __read } from './_virtual/_tslib.js';\nimport { State } from './State.js';\n\nfunction matchState(state, patterns, defaultValue) {\n var e_1, _a;\n\n var resolvedState = State.from(state, state instanceof State ? state.context : undefined);\n\n try {\n for (var patterns_1 = __values(patterns), patterns_1_1 = patterns_1.next(); !patterns_1_1.done; patterns_1_1 = patterns_1.next()) {\n var _b = __read(patterns_1_1.value, 2),\n stateValue = _b[0],\n getValue = _b[1];\n\n if (resolvedState.matches(stateValue)) {\n return getValue(resolvedState);\n }\n }\n } catch (e_1_1) {\n e_1 = {\n error: e_1_1\n };\n } finally {\n try {\n if (patterns_1_1 && !patterns_1_1.done && (_a = patterns_1[\"return\"])) _a.call(patterns_1);\n } finally {\n if (e_1) throw e_1.error;\n }\n }\n\n return defaultValue(resolvedState);\n}\n\nexport { matchState };","export { matchesState } from './utils.js';\nexport { mapState } from './mapState.js';\nexport { ActionTypes, SpecialTargets } from './types.js';\nimport { raise, send, sendParent, sendUpdate, log, cancel, start, stop, assign, after, done, respond, forwardTo, escalate } from './actions.js';\nexport { assign, doneInvoke, forwardTo, send, sendParent, sendUpdate } from './actions.js';\nexport { State } from './State.js';\nexport { StateNode } from './StateNode.js';\nexport { Machine, createMachine } from './Machine.js';\nexport { Interpreter, interpret, spawn } from './interpreter.js';\nexport { matchState } from './match.js';\nvar actions = {\n raise: raise,\n send: send,\n sendParent: sendParent,\n sendUpdate: sendUpdate,\n log: log,\n cancel: cancel,\n start: start,\n stop: stop,\n assign: assign,\n after: after,\n done: done,\n respond: respond,\n forwardTo: forwardTo,\n escalate: escalate\n};\nexport { actions };","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nimport { __spread, __values, __read, __assign } from './_virtual/_tslib.js';\nimport { DEFAULT_GUARD_TYPE, TARGETLESS_KEY, STATE_DELIMITER } from './constants.js';\nimport { IS_PRODUCTION } from './environment.js';\n\nfunction keys(value) {\n return Object.keys(value);\n}\n\nfunction matchesState(parentStateId, childStateId, delimiter) {\n if (delimiter === void 0) {\n delimiter = STATE_DELIMITER;\n }\n\n var parentStateValue = toStateValue(parentStateId, delimiter);\n var childStateValue = toStateValue(childStateId, delimiter);\n\n if (isString(childStateValue)) {\n if (isString(parentStateValue)) {\n return childStateValue === parentStateValue;\n } // Parent more specific than child\n\n\n return false;\n }\n\n if (isString(parentStateValue)) {\n return parentStateValue in childStateValue;\n }\n\n return keys(parentStateValue).every(function (key) {\n if (!(key in childStateValue)) {\n return false;\n }\n\n return matchesState(parentStateValue[key], childStateValue[key]);\n });\n}\n\nfunction getEventType(event) {\n try {\n return isString(event) || typeof event === 'number' ? \"\" + event : event.type;\n } catch (e) {\n throw new Error('Events must be strings or objects with a string event.type property.');\n }\n}\n\nfunction toStatePath(stateId, delimiter) {\n try {\n if (isArray(stateId)) {\n return stateId;\n }\n\n return stateId.toString().split(delimiter);\n } catch (e) {\n throw new Error(\"'\" + stateId + \"' is not a valid state path.\");\n }\n}\n\nfunction isStateLike(state) {\n return _typeof(state) === 'object' && 'value' in state && 'context' in state && 'event' in state && '_event' in state;\n}\n\nfunction toStateValue(stateValue, delimiter) {\n if (isStateLike(stateValue)) {\n return stateValue.value;\n }\n\n if (isArray(stateValue)) {\n return pathToStateValue(stateValue);\n }\n\n if (typeof stateValue !== 'string') {\n return stateValue;\n }\n\n var statePath = toStatePath(stateValue, delimiter);\n return pathToStateValue(statePath);\n}\n\nfunction pathToStateValue(statePath) {\n if (statePath.length === 1) {\n return statePath[0];\n }\n\n var value = {};\n var marker = value;\n\n for (var i = 0; i < statePath.length - 1; i++) {\n if (i === statePath.length - 2) {\n marker[statePath[i]] = statePath[i + 1];\n } else {\n marker[statePath[i]] = {};\n marker = marker[statePath[i]];\n }\n }\n\n return value;\n}\n\nfunction mapValues(collection, iteratee) {\n var result = {};\n var collectionKeys = keys(collection);\n\n for (var i = 0; i < collectionKeys.length; i++) {\n var key = collectionKeys[i];\n result[key] = iteratee(collection[key], key, collection, i);\n }\n\n return result;\n}\n\nfunction mapFilterValues(collection, iteratee, predicate) {\n var e_1, _a;\n\n var result = {};\n\n try {\n for (var _b = __values(keys(collection)), _c = _b.next(); !_c.done; _c = _b.next()) {\n var key = _c.value;\n var item = collection[key];\n\n if (!predicate(item)) {\n continue;\n }\n\n result[key] = iteratee(item, key, collection);\n }\n } catch (e_1_1) {\n e_1 = {\n error: e_1_1\n };\n } finally {\n try {\n if (_c && !_c.done && (_a = _b[\"return\"])) _a.call(_b);\n } finally {\n if (e_1) throw e_1.error;\n }\n }\n\n return result;\n}\n/**\r\n * Retrieves a value at the given path.\r\n * @param props The deep path to the prop of the desired value\r\n */\n\n\nvar path = function path(props) {\n return function (object) {\n var e_2, _a;\n\n var result = object;\n\n try {\n for (var props_1 = __values(props), props_1_1 = props_1.next(); !props_1_1.done; props_1_1 = props_1.next()) {\n var prop = props_1_1.value;\n result = result[prop];\n }\n } catch (e_2_1) {\n e_2 = {\n error: e_2_1\n };\n } finally {\n try {\n if (props_1_1 && !props_1_1.done && (_a = props_1[\"return\"])) _a.call(props_1);\n } finally {\n if (e_2) throw e_2.error;\n }\n }\n\n return result;\n };\n};\n/**\r\n * Retrieves a value at the given path via the nested accessor prop.\r\n * @param props The deep path to the prop of the desired value\r\n */\n\n\nfunction nestedPath(props, accessorProp) {\n return function (object) {\n var e_3, _a;\n\n var result = object;\n\n try {\n for (var props_2 = __values(props), props_2_1 = props_2.next(); !props_2_1.done; props_2_1 = props_2.next()) {\n var prop = props_2_1.value;\n result = result[accessorProp][prop];\n }\n } catch (e_3_1) {\n e_3 = {\n error: e_3_1\n };\n } finally {\n try {\n if (props_2_1 && !props_2_1.done && (_a = props_2[\"return\"])) _a.call(props_2);\n } finally {\n if (e_3) throw e_3.error;\n }\n }\n\n return result;\n };\n}\n\nfunction toStatePaths(stateValue) {\n if (!stateValue) {\n return [[]];\n }\n\n if (isString(stateValue)) {\n return [[stateValue]];\n }\n\n var result = flatten(keys(stateValue).map(function (key) {\n var subStateValue = stateValue[key];\n\n if (typeof subStateValue !== 'string' && (!subStateValue || !Object.keys(subStateValue).length)) {\n return [[key]];\n }\n\n return toStatePaths(stateValue[key]).map(function (subPath) {\n return [key].concat(subPath);\n });\n }));\n return result;\n}\n\nfunction flatten(array) {\n var _a;\n\n return (_a = []).concat.apply(_a, __spread(array));\n}\n\nfunction toArrayStrict(value) {\n if (isArray(value)) {\n return value;\n }\n\n return [value];\n}\n\nfunction toArray(value) {\n if (value === undefined) {\n return [];\n }\n\n return toArrayStrict(value);\n}\n\nfunction mapContext(mapper, context, _event) {\n var e_5, _a;\n\n if (isFunction(mapper)) {\n return mapper(context, _event.data);\n }\n\n var result = {};\n\n try {\n for (var _b = __values(keys(mapper)), _c = _b.next(); !_c.done; _c = _b.next()) {\n var key = _c.value;\n var subMapper = mapper[key];\n\n if (isFunction(subMapper)) {\n result[key] = subMapper(context, _event.data);\n } else {\n result[key] = subMapper;\n }\n }\n } catch (e_5_1) {\n e_5 = {\n error: e_5_1\n };\n } finally {\n try {\n if (_c && !_c.done && (_a = _b[\"return\"])) _a.call(_b);\n } finally {\n if (e_5) throw e_5.error;\n }\n }\n\n return result;\n}\n\nfunction isBuiltInEvent(eventType) {\n return /^(done|error)\\./.test(eventType);\n}\n\nfunction isPromiseLike(value) {\n if (value instanceof Promise) {\n return true;\n } // Check if shape matches the Promise/A+ specification for a \"thenable\".\n\n\n if (value !== null && (isFunction(value) || _typeof(value) === 'object') && isFunction(value.then)) {\n return true;\n }\n\n return false;\n}\n\nfunction partition(items, predicate) {\n var e_6, _a;\n\n var _b = __read([[], []], 2),\n truthy = _b[0],\n falsy = _b[1];\n\n try {\n for (var items_1 = __values(items), items_1_1 = items_1.next(); !items_1_1.done; items_1_1 = items_1.next()) {\n var item = items_1_1.value;\n\n if (predicate(item)) {\n truthy.push(item);\n } else {\n falsy.push(item);\n }\n }\n } catch (e_6_1) {\n e_6 = {\n error: e_6_1\n };\n } finally {\n try {\n if (items_1_1 && !items_1_1.done && (_a = items_1[\"return\"])) _a.call(items_1);\n } finally {\n if (e_6) throw e_6.error;\n }\n }\n\n return [truthy, falsy];\n}\n\nfunction updateHistoryStates(hist, stateValue) {\n return mapValues(hist.states, function (subHist, key) {\n if (!subHist) {\n return undefined;\n }\n\n var subStateValue = (isString(stateValue) ? undefined : stateValue[key]) || (subHist ? subHist.current : undefined);\n\n if (!subStateValue) {\n return undefined;\n }\n\n return {\n current: subStateValue,\n states: updateHistoryStates(subHist, subStateValue)\n };\n });\n}\n\nfunction updateHistoryValue(hist, stateValue) {\n return {\n current: stateValue,\n states: updateHistoryStates(hist, stateValue)\n };\n}\n\nfunction updateContext(context, _event, assignActions, state) {\n if (!IS_PRODUCTION) {\n warn(!!context, 'Attempting to update undefined context');\n }\n\n var updatedContext = context ? assignActions.reduce(function (acc, assignAction) {\n var e_7, _a;\n\n var assignment = assignAction.assignment;\n var meta = {\n state: state,\n action: assignAction,\n _event: _event\n };\n var partialUpdate = {};\n\n if (isFunction(assignment)) {\n partialUpdate = assignment(acc, _event.data, meta);\n } else {\n try {\n for (var _b = __values(keys(assignment)), _c = _b.next(); !_c.done; _c = _b.next()) {\n var key = _c.value;\n var propAssignment = assignment[key];\n partialUpdate[key] = isFunction(propAssignment) ? propAssignment(acc, _event.data, meta) : propAssignment;\n }\n } catch (e_7_1) {\n e_7 = {\n error: e_7_1\n };\n } finally {\n try {\n if (_c && !_c.done && (_a = _b[\"return\"])) _a.call(_b);\n } finally {\n if (e_7) throw e_7.error;\n }\n }\n }\n\n return Object.assign({}, acc, partialUpdate);\n }, context) : context;\n return updatedContext;\n} // tslint:disable-next-line:no-empty\n\n\nvar warn = function warn() {};\n\nif (!IS_PRODUCTION) {\n warn = function warn(condition, message) {\n var error = condition instanceof Error ? condition : undefined;\n\n if (!error && condition) {\n return;\n }\n\n if (console !== undefined) {\n var args = [\"Warning: \" + message];\n\n if (error) {\n args.push(error);\n } // tslint:disable-next-line:no-console\n\n\n console.warn.apply(console, args);\n }\n };\n}\n\nfunction isArray(value) {\n return Array.isArray(value);\n} // tslint:disable-next-line:ban-types\n\n\nfunction isFunction(value) {\n return typeof value === 'function';\n}\n\nfunction isString(value) {\n return typeof value === 'string';\n} // export function memoizedGetter(\n// o: TP,\n// property: string,\n// getter: () => T\n// ): void {\n// Object.defineProperty(o.prototype, property, {\n// get: getter,\n// enumerable: false,\n// configurable: false\n// });\n// }\n\n\nfunction toGuard(condition, guardMap) {\n if (!condition) {\n return undefined;\n }\n\n if (isString(condition)) {\n return {\n type: DEFAULT_GUARD_TYPE,\n name: condition,\n predicate: guardMap ? guardMap[condition] : undefined\n };\n }\n\n if (isFunction(condition)) {\n return {\n type: DEFAULT_GUARD_TYPE,\n name: condition.name,\n predicate: condition\n };\n }\n\n return condition;\n}\n\nfunction isObservable(value) {\n try {\n return 'subscribe' in value && isFunction(value.subscribe);\n } catch (e) {\n return false;\n }\n}\n\nvar symbolObservable = /*#__PURE__*/function () {\n return typeof Symbol === 'function' && Symbol.observable || '@@observable';\n}();\n\nfunction isMachine(value) {\n try {\n return '__xstatenode' in value;\n } catch (e) {\n return false;\n }\n}\n\nvar uniqueId = /*#__PURE__*/function () {\n var currentId = 0;\n return function () {\n currentId++;\n return currentId.toString(16);\n };\n}();\n\nfunction toEventObject(event, payload // id?: TEvent['type']\n) {\n if (isString(event) || typeof event === 'number') {\n return __assign({\n type: event\n }, payload);\n }\n\n return event;\n}\n\nfunction toSCXMLEvent(event, scxmlEvent) {\n if (!isString(event) && '$$type' in event && event.$$type === 'scxml') {\n return event;\n }\n\n var eventObject = toEventObject(event);\n return __assign({\n name: eventObject.type,\n data: eventObject,\n $$type: 'scxml',\n type: 'external'\n }, scxmlEvent);\n}\n\nfunction toTransitionConfigArray(event, configLike) {\n var transitions = toArrayStrict(configLike).map(function (transitionLike) {\n if (typeof transitionLike === 'undefined' || typeof transitionLike === 'string' || isMachine(transitionLike)) {\n // @ts-ignore until Type instantiation is excessively deep and possibly infinite bug is fixed\n return {\n target: transitionLike,\n event: event\n };\n }\n\n return __assign(__assign({}, transitionLike), {\n event: event\n });\n });\n return transitions;\n}\n\nfunction normalizeTarget(target) {\n if (target === undefined || target === TARGETLESS_KEY) {\n return undefined;\n }\n\n return toArray(target);\n}\n\nfunction reportUnhandledExceptionOnInvocation(originalError, currentError, id) {\n if (!IS_PRODUCTION) {\n var originalStackTrace = originalError.stack ? \" Stacktrace was '\" + originalError.stack + \"'\" : '';\n\n if (originalError === currentError) {\n // tslint:disable-next-line:no-console\n console.error(\"Missing onError handler for invocation '\" + id + \"', error was '\" + originalError + \"'.\" + originalStackTrace);\n } else {\n var stackTrace = currentError.stack ? \" Stacktrace was '\" + currentError.stack + \"'\" : ''; // tslint:disable-next-line:no-console\n\n console.error(\"Missing onError handler and/or unhandled exception/promise rejection for invocation '\" + id + \"'. \" + (\"Original error: '\" + originalError + \"'. \" + originalStackTrace + \" Current error is '\" + currentError + \"'.\" + stackTrace));\n }\n }\n}\n\nexport { flatten, getEventType, isArray, isBuiltInEvent, isFunction, isMachine, isObservable, isPromiseLike, isStateLike, isString, keys, mapContext, mapFilterValues, mapValues, matchesState, nestedPath, normalizeTarget, partition, path, pathToStateValue, reportUnhandledExceptionOnInvocation, symbolObservable, toArray, toArrayStrict, toEventObject, toGuard, toSCXMLEvent, toStatePath, toStatePaths, toStateValue, toTransitionConfigArray, uniqueId, updateContext, updateHistoryStates, updateHistoryValue, warn };","\"use strict\";\n\nvar __assign = this && this.__assign || function () {\n __assign = Object.assign || function (t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n\n for (var p in s) {\n if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n }\n\n return t;\n };\n\n return __assign.apply(this, arguments);\n};\n\nvar __rest = this && this.__rest || function (s, e) {\n var t = {};\n\n for (var p in s) {\n if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\n }\n\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];\n }\n return t;\n};\n\nvar __read = this && this.__read || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o),\n r,\n ar = [],\n e;\n\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {\n ar.push(r.value);\n }\n } catch (error) {\n e = {\n error: error\n };\n } finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n } finally {\n if (e) throw e.error;\n }\n }\n\n return ar;\n};\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar react_1 = require(\"react\");\n\nvar xstate_1 = require(\"xstate\");\n\nvar defaultOptions = {\n immediate: false\n};\n\nfunction useMachine(machine, options) {\n if (options === void 0) {\n options = defaultOptions;\n }\n\n var context = options.context,\n guards = options.guards,\n actions = options.actions,\n activities = options.activities,\n services = options.services,\n delays = options.delays,\n immediate = options.immediate,\n rehydratedState = options.state,\n interpreterOptions = __rest(options, [\"context\", \"guards\", \"actions\", \"activities\", \"services\", \"delays\", \"immediate\", \"state\"]);\n\n var machineConfig = {\n context: context,\n guards: guards,\n actions: actions,\n activities: activities,\n services: services,\n delays: delays\n }; // Reference the machine\n\n var machineRef = react_1.useRef(null); // Create the machine only once\n // See https://reactjs.org/docs/hooks-faq.html#how-to-create-expensive-objects-lazily\n\n if (machineRef.current === null) {\n machineRef.current = machine.withConfig(machineConfig, __assign(__assign({}, machine.context), context));\n } // Reference the service\n\n\n var serviceRef = react_1.useRef(null); // Create the service only once\n\n if (serviceRef.current === null) {\n serviceRef.current = xstate_1.interpret(machineRef.current, interpreterOptions).onTransition(function (state) {\n // Update the current machine state when a transition occurs\n if (state.changed) {\n setCurrent(state);\n }\n });\n }\n\n var service = serviceRef.current; // Make sure actions and services are kept updated when they change.\n // This mutation assignment is safe because the service instance is only used\n // in one place -- this hook's caller.\n\n react_1.useEffect(function () {\n Object.assign(service.machine.options.actions, actions);\n }, [actions]);\n react_1.useEffect(function () {\n Object.assign(service.machine.options.services, services);\n }, [services]); // Keep track of the current machine state\n\n var initialState = rehydratedState ? xstate_1.State.create(rehydratedState) : service.initialState;\n\n var _a = __read(react_1.useState(function () {\n return initialState;\n }), 2),\n current = _a[0],\n setCurrent = _a[1]; // Start service immediately (before mount) if specified in options\n\n\n if (immediate) {\n service.start();\n }\n\n react_1.useEffect(function () {\n // Start the service when the component mounts.\n // Note: the service will start only if it hasn't started already.\n //\n // If a rehydrated state was provided, use the resolved `initialState`.\n service.start(rehydratedState ? initialState : undefined);\n return function () {\n // Stop the service when the component unmounts\n service.stop();\n };\n }, []);\n return [current, service.send, service];\n}\n\nexports.useMachine = useMachine;\n\nfunction useService(service) {\n var _a = __read(react_1.useState(service.state), 2),\n current = _a[0],\n setCurrent = _a[1];\n\n react_1.useEffect(function () {\n // Set to current service state as there is a possibility\n // of a transition occurring between the initial useState()\n // initialization and useEffect() commit.\n setCurrent(service.state);\n\n var listener = function listener(state) {\n if (state.changed) {\n setCurrent(state);\n }\n };\n\n var sub = service.subscribe(listener);\n return function () {\n sub.unsubscribe();\n };\n }, [service]);\n return [current, service.send, service];\n}\n\nexports.useService = useService;\n\nvar useActor_1 = require(\"./useActor\");\n\nexports.useActor = useActor_1.useActor;","import { IS_PRODUCTION } from './environment.js';\n\nfunction getDevTools() {\n var w = window;\n\n if (!!w.__xstate__) {\n return w.__xstate__;\n }\n\n return undefined;\n}\n\nfunction registerService(service) {\n if (IS_PRODUCTION || typeof window === 'undefined') {\n return;\n }\n\n var devTools = getDevTools();\n\n if (devTools) {\n devTools.register(service);\n }\n}\n\nexport { registerService };","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nif (process.env.NODE_ENV !== 'production') {\n var ReactIs = require('react-is'); // By explicitly using `prop-types` you are opting into new development behavior.\n // http://fb.me/prop-types-in-prod\n\n\n var throwOnDirectAccess = true;\n module.exports = require('./factoryWithTypeCheckers')(ReactIs.isElement, throwOnDirectAccess);\n} else {\n // By explicitly using `prop-types` you are opting into new production behavior.\n // http://fb.me/prop-types-in-prod\n module.exports = require('./factoryWithThrowingShims')();\n}","function _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}\n\nfunction _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nfunction _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}\n\nfunction _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}\n\nimport React from \"react\";\nimport PropTypes from \"prop-types\";\n\nvar ReCAPTCHA = /*#__PURE__*/function (_React$Component) {\n _inheritsLoose(ReCAPTCHA, _React$Component);\n\n function ReCAPTCHA() {\n var _this;\n\n _this = _React$Component.call(this) || this;\n _this.handleExpired = _this.handleExpired.bind(_assertThisInitialized(_this));\n _this.handleErrored = _this.handleErrored.bind(_assertThisInitialized(_this));\n _this.handleChange = _this.handleChange.bind(_assertThisInitialized(_this));\n _this.handleRecaptchaRef = _this.handleRecaptchaRef.bind(_assertThisInitialized(_this));\n return _this;\n }\n\n var _proto = ReCAPTCHA.prototype;\n\n _proto.getValue = function getValue() {\n if (this.props.grecaptcha && this._widgetId !== undefined) {\n return this.props.grecaptcha.getResponse(this._widgetId);\n }\n\n return null;\n };\n\n _proto.getWidgetId = function getWidgetId() {\n if (this.props.grecaptcha && this._widgetId !== undefined) {\n return this._widgetId;\n }\n\n return null;\n };\n\n _proto.execute = function execute() {\n var grecaptcha = this.props.grecaptcha;\n\n if (grecaptcha && this._widgetId !== undefined) {\n return grecaptcha.execute(this._widgetId);\n } else {\n this._executeRequested = true;\n }\n };\n\n _proto.executeAsync = function executeAsync() {\n var _this2 = this;\n\n return new Promise(function (resolve, reject) {\n _this2.executionResolve = resolve;\n _this2.executionReject = reject;\n\n _this2.execute();\n });\n };\n\n _proto.reset = function reset() {\n if (this.props.grecaptcha && this._widgetId !== undefined) {\n this.props.grecaptcha.reset(this._widgetId);\n }\n };\n\n _proto.handleExpired = function handleExpired() {\n if (this.props.onExpired) {\n this.props.onExpired();\n } else {\n this.handleChange(null);\n }\n };\n\n _proto.handleErrored = function handleErrored() {\n if (this.props.onErrored) {\n this.props.onErrored();\n }\n\n if (this.executionReject) {\n this.executionReject();\n delete this.executionResolve;\n delete this.executionReject;\n }\n };\n\n _proto.handleChange = function handleChange(token) {\n if (this.props.onChange) {\n this.props.onChange(token);\n }\n\n if (this.executionResolve) {\n this.executionResolve(token);\n delete this.executionReject;\n delete this.executionResolve;\n }\n };\n\n _proto.explicitRender = function explicitRender() {\n if (this.props.grecaptcha && this.props.grecaptcha.render && this._widgetId === undefined) {\n var wrapper = document.createElement(\"div\");\n this._widgetId = this.props.grecaptcha.render(wrapper, {\n sitekey: this.props.sitekey,\n callback: this.handleChange,\n theme: this.props.theme,\n type: this.props.type,\n tabindex: this.props.tabindex,\n \"expired-callback\": this.handleExpired,\n \"error-callback\": this.handleErrored,\n size: this.props.size,\n stoken: this.props.stoken,\n hl: this.props.hl,\n badge: this.props.badge\n });\n this.captcha.appendChild(wrapper);\n }\n\n if (this._executeRequested && this.props.grecaptcha && this._widgetId !== undefined) {\n this._executeRequested = false;\n this.execute();\n }\n };\n\n _proto.componentDidMount = function componentDidMount() {\n this.explicitRender();\n };\n\n _proto.componentDidUpdate = function componentDidUpdate() {\n this.explicitRender();\n };\n\n _proto.componentWillUnmount = function componentWillUnmount() {\n if (this._widgetId !== undefined) {\n this.delayOfCaptchaIframeRemoving();\n this.reset();\n }\n };\n\n _proto.delayOfCaptchaIframeRemoving = function delayOfCaptchaIframeRemoving() {\n var temporaryNode = document.createElement(\"div\");\n document.body.appendChild(temporaryNode);\n temporaryNode.style.display = \"none\"; // move of the recaptcha to a temporary node\n\n while (this.captcha.firstChild) {\n temporaryNode.appendChild(this.captcha.firstChild);\n } // delete the temporary node after reset will be done\n\n\n setTimeout(function () {\n document.body.removeChild(temporaryNode);\n }, 5000);\n };\n\n _proto.handleRecaptchaRef = function handleRecaptchaRef(elem) {\n this.captcha = elem;\n };\n\n _proto.render = function render() {\n // consume properties owned by the reCATPCHA, pass the rest to the div so the user can style it.\n\n /* eslint-disable no-unused-vars */\n var _this$props = this.props,\n sitekey = _this$props.sitekey,\n onChange = _this$props.onChange,\n theme = _this$props.theme,\n type = _this$props.type,\n tabindex = _this$props.tabindex,\n onExpired = _this$props.onExpired,\n onErrored = _this$props.onErrored,\n size = _this$props.size,\n stoken = _this$props.stoken,\n grecaptcha = _this$props.grecaptcha,\n badge = _this$props.badge,\n hl = _this$props.hl,\n childProps = _objectWithoutPropertiesLoose(_this$props, [\"sitekey\", \"onChange\", \"theme\", \"type\", \"tabindex\", \"onExpired\", \"onErrored\", \"size\", \"stoken\", \"grecaptcha\", \"badge\", \"hl\"]);\n /* eslint-enable no-unused-vars */\n\n\n return React.createElement(\"div\", _extends({}, childProps, {\n ref: this.handleRecaptchaRef\n }));\n };\n\n return ReCAPTCHA;\n}(React.Component);\n\nexport { ReCAPTCHA as default };\nReCAPTCHA.displayName = \"ReCAPTCHA\";\nReCAPTCHA.propTypes = {\n sitekey: PropTypes.string.isRequired,\n onChange: PropTypes.func,\n grecaptcha: PropTypes.object,\n theme: PropTypes.oneOf([\"dark\", \"light\"]),\n type: PropTypes.oneOf([\"image\", \"audio\"]),\n tabindex: PropTypes.number,\n onExpired: PropTypes.func,\n onErrored: PropTypes.func,\n size: PropTypes.oneOf([\"compact\", \"normal\", \"invisible\"]),\n stoken: PropTypes.string,\n hl: PropTypes.string,\n badge: PropTypes.oneOf([\"bottomright\", \"bottomleft\", \"inline\"])\n};\nReCAPTCHA.defaultProps = {\n onChange: function onChange() {},\n theme: \"light\",\n type: \"image\",\n tabindex: 0,\n size: \"normal\",\n badge: \"bottomright\"\n};","function _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}\n\nfunction _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nfunction _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}\n\nimport { Component, createElement, forwardRef } from \"react\";\nimport PropTypes from \"prop-types\";\nimport hoistStatics from \"hoist-non-react-statics\";\nvar SCRIPT_MAP = {}; // A counter used to generate a unique id for each component that uses the function\n\nvar idCount = 0;\nexport default function makeAsyncScript(getScriptURL, options) {\n options = options || {};\n return function wrapWithAsyncScript(WrappedComponent) {\n var wrappedComponentName = WrappedComponent.displayName || WrappedComponent.name || \"Component\";\n\n var AsyncScriptLoader = /*#__PURE__*/function (_Component) {\n _inheritsLoose(AsyncScriptLoader, _Component);\n\n function AsyncScriptLoader(props, context) {\n var _this;\n\n _this = _Component.call(this, props, context) || this;\n _this.state = {};\n _this.__scriptURL = \"\";\n return _this;\n }\n\n var _proto = AsyncScriptLoader.prototype;\n\n _proto.asyncScriptLoaderGetScriptLoaderID = function asyncScriptLoaderGetScriptLoaderID() {\n if (!this.__scriptLoaderID) {\n this.__scriptLoaderID = \"async-script-loader-\" + idCount++;\n }\n\n return this.__scriptLoaderID;\n };\n\n _proto.setupScriptURL = function setupScriptURL() {\n this.__scriptURL = typeof getScriptURL === \"function\" ? getScriptURL() : getScriptURL;\n return this.__scriptURL;\n };\n\n _proto.asyncScriptLoaderHandleLoad = function asyncScriptLoaderHandleLoad(state) {\n var _this2 = this; // use reacts setState callback to fire props.asyncScriptOnLoad with new state/entry\n\n\n this.setState(state, function () {\n return _this2.props.asyncScriptOnLoad && _this2.props.asyncScriptOnLoad(_this2.state);\n });\n };\n\n _proto.asyncScriptLoaderTriggerOnScriptLoaded = function asyncScriptLoaderTriggerOnScriptLoaded() {\n var mapEntry = SCRIPT_MAP[this.__scriptURL];\n\n if (!mapEntry || !mapEntry.loaded) {\n throw new Error(\"Script is not loaded.\");\n }\n\n for (var obsKey in mapEntry.observers) {\n mapEntry.observers[obsKey](mapEntry);\n }\n\n delete window[options.callbackName];\n };\n\n _proto.componentDidMount = function componentDidMount() {\n var _this3 = this;\n\n var scriptURL = this.setupScriptURL();\n var key = this.asyncScriptLoaderGetScriptLoaderID();\n var _options = options,\n globalName = _options.globalName,\n callbackName = _options.callbackName,\n scriptId = _options.scriptId; // check if global object already attached to window\n\n if (globalName && typeof window[globalName] !== \"undefined\") {\n SCRIPT_MAP[scriptURL] = {\n loaded: true,\n observers: {}\n };\n } // check if script loading already\n\n\n if (SCRIPT_MAP[scriptURL]) {\n var entry = SCRIPT_MAP[scriptURL]; // if loaded or errored then \"finish\"\n\n if (entry && (entry.loaded || entry.errored)) {\n this.asyncScriptLoaderHandleLoad(entry);\n return;\n } // if still loading then callback to observer queue\n\n\n entry.observers[key] = function (entry) {\n return _this3.asyncScriptLoaderHandleLoad(entry);\n };\n\n return;\n }\n /*\n * hasn't started loading\n * start the \"magic\"\n * setup script to load and observers\n */\n\n\n var observers = {};\n\n observers[key] = function (entry) {\n return _this3.asyncScriptLoaderHandleLoad(entry);\n };\n\n SCRIPT_MAP[scriptURL] = {\n loaded: false,\n observers: observers\n };\n var script = document.createElement(\"script\");\n script.src = scriptURL;\n script.async = true;\n\n for (var attribute in options.attributes) {\n script.setAttribute(attribute, options.attributes[attribute]);\n }\n\n if (scriptId) {\n script.id = scriptId;\n }\n\n var callObserverFuncAndRemoveObserver = function callObserverFuncAndRemoveObserver(func) {\n if (SCRIPT_MAP[scriptURL]) {\n var mapEntry = SCRIPT_MAP[scriptURL];\n var observersMap = mapEntry.observers;\n\n for (var obsKey in observersMap) {\n if (func(observersMap[obsKey])) {\n delete observersMap[obsKey];\n }\n }\n }\n };\n\n if (callbackName && typeof window !== \"undefined\") {\n window[callbackName] = function () {\n return _this3.asyncScriptLoaderTriggerOnScriptLoaded();\n };\n }\n\n script.onload = function () {\n var mapEntry = SCRIPT_MAP[scriptURL];\n\n if (mapEntry) {\n mapEntry.loaded = true;\n callObserverFuncAndRemoveObserver(function (observer) {\n if (callbackName) {\n return false;\n }\n\n observer(mapEntry);\n return true;\n });\n }\n };\n\n script.onerror = function () {\n var mapEntry = SCRIPT_MAP[scriptURL];\n\n if (mapEntry) {\n mapEntry.errored = true;\n callObserverFuncAndRemoveObserver(function (observer) {\n observer(mapEntry);\n return true;\n });\n }\n };\n\n document.body.appendChild(script);\n };\n\n _proto.componentWillUnmount = function componentWillUnmount() {\n // Remove tag script\n var scriptURL = this.__scriptURL;\n\n if (options.removeOnUnmount === true) {\n var allScripts = document.getElementsByTagName(\"script\");\n\n for (var i = 0; i < allScripts.length; i += 1) {\n if (allScripts[i].src.indexOf(scriptURL) > -1) {\n if (allScripts[i].parentNode) {\n allScripts[i].parentNode.removeChild(allScripts[i]);\n }\n }\n }\n } // Clean the observer entry\n\n\n var mapEntry = SCRIPT_MAP[scriptURL];\n\n if (mapEntry) {\n delete mapEntry.observers[this.asyncScriptLoaderGetScriptLoaderID()];\n\n if (options.removeOnUnmount === true) {\n delete SCRIPT_MAP[scriptURL];\n }\n }\n };\n\n _proto.render = function render() {\n var globalName = options.globalName; // remove asyncScriptOnLoad from childProps\n\n var _this$props = this.props,\n asyncScriptOnLoad = _this$props.asyncScriptOnLoad,\n forwardedRef = _this$props.forwardedRef,\n childProps = _objectWithoutPropertiesLoose(_this$props, [\"asyncScriptOnLoad\", \"forwardedRef\"]); // eslint-disable-line no-unused-vars\n\n\n if (globalName && typeof window !== \"undefined\") {\n childProps[globalName] = typeof window[globalName] !== \"undefined\" ? window[globalName] : undefined;\n }\n\n childProps.ref = forwardedRef;\n return createElement(WrappedComponent, childProps);\n };\n\n return AsyncScriptLoader;\n }(Component); // Note the second param \"ref\" provided by React.forwardRef.\n // We can pass it along to AsyncScriptLoader as a regular prop, e.g. \"forwardedRef\"\n // And it can then be attached to the Component.\n\n\n var ForwardedComponent = forwardRef(function (props, ref) {\n return createElement(AsyncScriptLoader, _extends({}, props, {\n forwardedRef: ref\n }));\n });\n ForwardedComponent.displayName = \"AsyncScriptLoader(\" + wrappedComponentName + \")\";\n ForwardedComponent.propTypes = {\n asyncScriptOnLoad: PropTypes.func\n };\n return hoistStatics(ForwardedComponent, WrappedComponent);\n };\n}","import ReCAPTCHA from \"./recaptcha\";\nimport makeAsyncScriptLoader from \"react-async-script\";\nvar callbackName = \"onloadcallback\";\nvar globalName = \"grecaptcha\";\n\nfunction getOptions() {\n return typeof window !== \"undefined\" && window.recaptchaOptions || {};\n}\n\nfunction getURL() {\n var dynamicOptions = getOptions();\n var hostname = dynamicOptions.useRecaptchaNet ? \"recaptcha.net\" : \"www.google.com\";\n return \"https://\" + hostname + \"/recaptcha/api.js?onload=\" + callbackName + \"&render=explicit\";\n}\n\nexport default makeAsyncScriptLoader(getURL, {\n callbackName: callbackName,\n globalName: globalName\n})(ReCAPTCHA);","import RecaptchaWrapper from \"./recaptcha-wrapper\";\nimport ReCAPTCHA from \"./recaptcha\";\nexport default RecaptchaWrapper;\nexport { ReCAPTCHA };","var IS_PRODUCTION = process.env.NODE_ENV === 'production';\nexport { IS_PRODUCTION };","\"use strict\";\n\nvar __read = this && this.__read || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o),\n r,\n ar = [],\n e;\n\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {\n ar.push(r.value);\n }\n } catch (error) {\n e = {\n error: error\n };\n } finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n } finally {\n if (e) throw e.error;\n }\n }\n\n return ar;\n};\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar react_1 = require(\"react\");\n\nfunction useActor(actor) {\n var _a = __read(react_1.useState(undefined), 2),\n current = _a[0],\n setCurrent = _a[1];\n\n var actorRef = react_1.useRef(actor);\n react_1.useEffect(function () {\n if (actor) {\n actorRef.current = actor;\n var sub_1 = actor.subscribe(setCurrent);\n return function () {\n sub_1.unsubscribe();\n };\n }\n }, [actor]);\n return [current, actorRef.current ? actorRef.current.send : function () {\n return void 0;\n }];\n}\n\nexports.useActor = useActor;","import React from \"react\";\n\nimport styled from \"@emotion/styled\";\nimport { css } from \"@emotion/react\";\nimport Icon from \"@ats/src/components/shared/Icon\";\n\ntype Props = {\n title?: string;\n message: string | object;\n icon?: string;\n borderless?: boolean;\n roomy?: boolean;\n};\n\nconst EmptyState = ({ title, message, icon, borderless, roomy }: Props) => {\n return (\n \n {icon && (\n \n \n \n )}\n {title && {title}
}\n {message && {message}
}\n \n );\n};\n\nexport default EmptyState;\n\n/* Styled Components\n======================================================= */\nconst Styled: any = {};\n\nStyled.Container = styled.div((props: any) => {\n const t: any = props.theme;\n return css`\n label: EmptyState;\n ${[t.px(6), t.rounded.md]}\n ${props.roomy ? t.py(8) : t.py(5)}\n display: flex;\n flex-direction: column;\n align-items: center;\n text-align: center;\n ${!props.borderless\n ? `\n border: 1px solid ${t.dark ? \"transparent\" : t.color.gray[200]};\n background-color: ${t.dark ? \"rgba(255,255,255,0.07)\" : \"transparent\"};\n `\n : \"\"}\n color: ${t.dark ? t.color.gray[200] : t.color.black};\n h2 {\n ${[t.text.sm, t.mb(1)]};\n }\n p {\n ${t.text.xs}\n color: ${t.dark ? t.color.gray[400] : t.color.gray[600]};\n }\n `;\n});\n\nStyled.IconWrapper = styled.div((props) => {\n const t: any = props.theme;\n return css`\n label: EmptyState_IconWrapper;\n ${[t.text.sm, t.mb(2)]}\n `;\n});\n"],"sourceRoot":""}