UNPKG

formiojs

Version:

Common js library for client side interaction with <form.io>

121 lines (113 loc) • 1.18 MB
/******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); /******/ } /******/ }; /******/ /******/ // define __esModule on exports /******/ __webpack_require__.r = function(exports) { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = __webpack_require__(value); /******/ if(mode & 8) return value; /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); /******/ return ns; /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = "./lib/utils/utils.js"); /******/ }) /************************************************************************/ /******/ ({ /***/ "./lib/utils/formUtils.js": /*!********************************!*\ !*** ./lib/utils/formUtils.js ***! \********************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.isLayoutComponent = isLayoutComponent;\nexports.eachComponent = eachComponent;\nexports.matchComponent = matchComponent;\nexports.getComponent = getComponent;\nexports.findComponents = findComponents;\nexports.flattenComponents = flattenComponents;\nexports.hasCondition = hasCondition;\nexports.parseFloatExt = parseFloatExt;\nexports.formatAsCurrency = formatAsCurrency;\nexports.escapeRegExCharacters = escapeRegExCharacters;\nexports.getValue = getValue;\n\n__webpack_require__(/*! core-js/modules/es6.string.iterator */ \"./node_modules/core-js/modules/es6.string.iterator.js\");\n\n__webpack_require__(/*! core-js/modules/es6.array.from */ \"./node_modules/core-js/modules/es6.array.from.js\");\n\n__webpack_require__(/*! core-js/modules/es6.regexp.to-string */ \"./node_modules/core-js/modules/es6.regexp.to-string.js\");\n\n__webpack_require__(/*! core-js/modules/es6.regexp.split */ \"./node_modules/core-js/modules/es6.regexp.split.js\");\n\n__webpack_require__(/*! core-js/modules/es6.regexp.replace */ \"./node_modules/core-js/modules/es6.regexp.replace.js\");\n\n__webpack_require__(/*! core-js/modules/es7.array.includes */ \"./node_modules/core-js/modules/es7.array.includes.js\");\n\n__webpack_require__(/*! core-js/modules/es6.string.includes */ \"./node_modules/core-js/modules/es6.string.includes.js\");\n\n__webpack_require__(/*! core-js/modules/web.dom.iterable */ \"./node_modules/core-js/modules/web.dom.iterable.js\");\n\nvar _get = _interopRequireDefault(__webpack_require__(/*! lodash/get */ \"./node_modules/lodash/get.js\"));\n\nvar _has = _interopRequireDefault(__webpack_require__(/*! lodash/has */ \"./node_modules/lodash/has.js\"));\n\nvar _clone = _interopRequireDefault(__webpack_require__(/*! lodash/clone */ \"./node_modules/lodash/clone.js\"));\n\nvar _forOwn = _interopRequireDefault(__webpack_require__(/*! lodash/forOwn */ \"./node_modules/lodash/forOwn.js\"));\n\nvar _isString = _interopRequireDefault(__webpack_require__(/*! lodash/isString */ \"./node_modules/lodash/isString.js\"));\n\nvar _isNaN = _interopRequireDefault(__webpack_require__(/*! lodash/isNaN */ \"./node_modules/lodash/isNaN.js\"));\n\nvar _isNil = _interopRequireDefault(__webpack_require__(/*! lodash/isNil */ \"./node_modules/lodash/isNil.js\"));\n\nvar _isPlainObject = _interopRequireDefault(__webpack_require__(/*! lodash/isPlainObject */ \"./node_modules/lodash/isPlainObject.js\"));\n\nvar _round = _interopRequireDefault(__webpack_require__(/*! lodash/round */ \"./node_modules/lodash/round.js\"));\n\nvar _chunk = _interopRequireDefault(__webpack_require__(/*! lodash/chunk */ \"./node_modules/lodash/chunk.js\"));\n\nvar _pad = _interopRequireDefault(__webpack_require__(/*! lodash/pad */ \"./node_modules/lodash/pad.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * Determine if a component is a layout component or not.\n *\n * @param {Object} component\n * The component to check.\n *\n * @returns {Boolean}\n * Whether or not the component is a layout component.\n */\nfunction isLayoutComponent(component) {\n return Boolean(component.columns && Array.isArray(component.columns) || component.rows && Array.isArray(component.rows) || component.components && Array.isArray(component.components));\n}\n/**\n * Iterate through each component within a form.\n *\n * @param {Object} components\n * The components to iterate.\n * @param {Function} fn\n * The iteration function to invoke for each component.\n * @param {Boolean} includeAll\n * Whether or not to include layout components.\n * @param {String} path\n * The current data path of the element. Example: data.user.firstName\n * @param {Object} parent\n * The parent object.\n */\n\n\nfunction eachComponent(components, fn, includeAll, path, parent) {\n if (!components) return;\n path = path || '';\n components.forEach(function (component) {\n if (!component) {\n return;\n }\n\n var hasColumns = component.columns && Array.isArray(component.columns);\n var hasRows = component.rows && Array.isArray(component.rows);\n var hasComps = component.components && Array.isArray(component.components);\n var noRecurse = false;\n var newPath = component.key ? path ? \"\".concat(path, \".\").concat(component.key) : component.key : ''; // Keep track of parent references.\n\n if (parent) {\n // Ensure we don't create infinite JSON structures.\n component.parent = (0, _clone.default)(parent);\n delete component.parent.components;\n delete component.parent.componentMap;\n delete component.parent.columns;\n delete component.parent.rows;\n }\n\n if (includeAll || component.tree || !hasColumns && !hasRows && !hasComps) {\n noRecurse = fn(component, newPath);\n }\n\n var subPath = function subPath() {\n if (component.key && !['panel', 'table', 'well', 'columns', 'fieldset', 'tabs', 'form'].includes(component.type) && (['datagrid', 'container', 'editgrid'].includes(component.type) || component.tree)) {\n return newPath;\n } else if (component.key && component.type === 'form') {\n return \"\".concat(newPath, \".data\");\n }\n\n return path;\n };\n\n if (!noRecurse) {\n if (hasColumns) {\n component.columns.forEach(function (column) {\n return eachComponent(column.components, fn, includeAll, subPath(), parent ? component : null);\n });\n } else if (hasRows) {\n component.rows.forEach(function (row) {\n if (Array.isArray(row)) {\n row.forEach(function (column) {\n return eachComponent(column.components, fn, includeAll, subPath(), parent ? component : null);\n });\n }\n });\n } else if (hasComps) {\n eachComponent(component.components, fn, includeAll, subPath(), parent ? component : null);\n }\n }\n });\n}\n/**\n * Matches if a component matches the query.\n *\n * @param component\n * @param query\n * @return {boolean}\n */\n\n\nfunction matchComponent(component, query) {\n if ((0, _isString.default)(query)) {\n return component.key === query;\n } else {\n var matches = false;\n (0, _forOwn.default)(query, function (value, key) {\n matches = (0, _get.default)(component, key) === value;\n\n if (!matches) {\n return false;\n }\n });\n return matches;\n }\n}\n/**\n * Get a component by its key\n *\n * @param {Object} components\n * The components to iterate.\n * @param {String|Object} key\n * The key of the component to get, or a query of the component to search.\n *\n * @returns {Object}\n * The component that matches the given key, or undefined if not found.\n */\n\n\nfunction getComponent(components, key, includeAll) {\n var result;\n eachComponent(components, function (component, path) {\n if (path === key) {\n component.path = path;\n result = component;\n return true;\n }\n }, includeAll);\n return result;\n}\n/**\n * Finds a component provided a query of properties of that component.\n *\n * @param components\n * @param query\n * @return {*}\n */\n\n\nfunction findComponents(components, query) {\n var results = [];\n eachComponent(components, function (component, path) {\n if (matchComponent(component, query)) {\n component.path = path;\n results.push(component);\n }\n }, true);\n return results;\n}\n/**\n * Flatten the form components for data manipulation.\n *\n * @param {Object} components\n * The components to iterate.\n * @param {Boolean} includeAll\n * Whether or not to include layout components.\n *\n * @returns {Object}\n * The flattened components map.\n */\n\n\nfunction flattenComponents(components, includeAll) {\n var flattened = {};\n eachComponent(components, function (component, path) {\n flattened[path] = component;\n }, includeAll);\n return flattened;\n}\n/**\n * Returns if this component has a conditional statement.\n *\n * @param component - The component JSON schema.\n *\n * @returns {boolean} - TRUE - This component has a conditional, FALSE - No conditional provided.\n */\n\n\nfunction hasCondition(component) {\n return Boolean(component.customConditional || component.conditional && component.conditional.when || component.conditional && component.conditional.json);\n}\n/**\n * Extension of standard #parseFloat(value) function, that also clears input string.\n *\n * @param {any} value\n * The value to parse.\n *\n * @returns {Number}\n * Parsed value.\n */\n\n\nfunction parseFloatExt(value) {\n return parseFloat((0, _isString.default)(value) ? value.replace(/[^\\de.+-]/gi, '') : value);\n}\n/**\n * Formats provided value in way how Currency component uses it.\n *\n * @param {any} value\n * The value to format.\n *\n * @returns {String}\n * Value formatted for Currency component.\n */\n\n\nfunction formatAsCurrency(value) {\n var parsedValue = parseFloatExt(value);\n\n if ((0, _isNaN.default)(parsedValue)) {\n return '';\n }\n\n var parts = (0, _round.default)(parsedValue, 2).toString().split('.');\n parts[0] = (0, _chunk.default)(Array.from(parts[0]).reverse(), 3).reverse().map(function (part) {\n return part.reverse().join('');\n }).join(',');\n parts[1] = (0, _pad.default)(parts[1], 2, '0');\n return parts.join('.');\n}\n/**\n * Escapes RegEx characters in provided String value.\n *\n * @param {String} value\n * String for escaping RegEx characters.\n * @returns {string}\n * String with escaped RegEx characters.\n */\n\n\nfunction escapeRegExCharacters(value) {\n return value.replace(/[-[\\]/{}()*+?.\\\\^$|]/g, '\\\\$&');\n}\n/**\n * Get the value for a component key, in the given submission.\n *\n * @param {Object} submission\n * A submission object to search.\n * @param {String} key\n * A for components API key to search for.\n */\n\n\nfunction getValue(submission, key) {\n var search = function search(data) {\n if ((0, _isPlainObject.default)(data)) {\n if ((0, _has.default)(data, key)) {\n return data[key];\n }\n\n var value = null;\n (0, _forOwn.default)(data, function (prop) {\n var result = search(prop);\n\n if (!(0, _isNil.default)(result)) {\n value = result;\n return false;\n }\n });\n return value;\n } else {\n return null;\n }\n };\n\n return search(submission.data);\n}\n\n//# sourceURL=webpack:///./lib/utils/formUtils.js?"); /***/ }), /***/ "./lib/utils/jsonlogic/operators.js": /*!******************************************!*\ !*** ./lib/utils/jsonlogic/operators.js ***! \******************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.lodashOperators = void 0;\n// Use only immutable useful functions from Lodash.\n// Visit https://lodash.com/docs for more info.\nvar lodashOperators = [// Array\n'chunk', 'compact', 'concat', 'difference', 'differenceBy', 'differenceWith', 'drop', 'dropRight', 'dropRightWhile', 'dropWhile', 'findIndex', 'findLastIndex', 'first', 'flatten', 'flattenDeep', 'flattenDepth', 'fromPairs', 'head', 'indexOf', 'initial', 'intersection', 'intersectionBy', 'intersectionWith', 'join', 'last', 'lastIndexOf', 'nth', 'slice', 'sortedIndex', 'sortedIndexBy', 'sortedIndexOf', 'sortedLastIndex', 'sortedLastIndexBy', 'sortedLastIndexOf', 'sortedUniq', 'sortedUniqBy', 'tail', 'take', 'takeRight', 'takeRightWhile', 'takeWhile', 'union', 'unionBy', 'unionWith', 'uniq', 'uniqBy', 'uniqWith', 'unzip', 'unzipWith', 'without', 'xor', 'xorBy', 'xorWith', 'zip', 'zipObject', 'zipObjectDeep', 'zipWith', // Collection\n'countBy', 'every', 'filter', 'find', 'findLast', 'flatMap', 'flatMapDeep', 'flatMapDepth', 'groupBy', 'includes', 'invokeMap', 'keyBy', 'map', 'orderBy', 'partition', 'reduce', 'reduceRight', 'reject', 'sample', 'sampleSize', 'shuffle', 'size', 'some', 'sortBy', // Date\n'now', // Function\n'flip', 'negate', 'overArgs', 'partial', 'partialRight', 'rearg', 'rest', 'spread', // Lang\n'castArray', 'clone', 'cloneDeep', 'cloneDeepWith', 'cloneDeep', 'conformsTo', 'eq', 'gt', 'gte', 'isArguments', 'isArray', 'isArrayBuffer', 'isArrayLike', 'isArrayLikeObject', 'isBoolean', 'isBuffer', 'isDate', 'isElement', 'isEmpty', 'isEqual', 'isEqualWith', 'isError', 'isFinite', 'isFunction', 'isInteger', 'isLength', 'isMap', 'isMatch', 'isMatchWith', 'isNaN', 'isNative', 'isNil', 'isNull', 'isNumber', 'isObject', 'isObjectLike', 'isPlainObject', 'isRegExp', 'isSafeInteger', 'isSet', 'isString', 'isSymbol', 'isTypedArray', 'isUndefined', 'isWeakMap', 'isWeakSet', 'lt', 'lte', 'toArray', 'toFinite', 'toInteger', 'toLength', 'toNumber', 'toPlainObject', 'toSafeInteger', 'toString', // Math\n'add', 'ceil', 'divide', 'floor', 'max', 'maxBy', 'mean', 'meanBy', 'min', 'minBy', 'multiply', 'round', 'subtract', 'sum', 'sumBy', // Number\n'clamp', 'inRange', 'random', // Object\n'at', 'entries', 'entriesIn', 'findKey', 'findLastKey', 'functions', 'functionsIn', 'get', 'has', 'hasIn', 'invert', 'invertBy', 'invoke', 'keys', 'keysIn', 'mapKeys', 'mapValues', 'omit', 'omitBy', 'pick', 'pickBy', 'result', 'toPairs', 'toPairsIn', 'transform', 'values', 'valuesIn', // String\n'camelCase', 'capitalize', 'deburr', 'endsWith', 'escape', 'escapeRegExp', 'kebabCase', 'lowerCase', 'lowerFirst', 'pad', 'padEnd', 'padStart', 'parseInt', 'repeat', 'replace', 'snakeCase', 'split', 'startCase', 'startsWith', 'toLower', 'toUpper', 'trim', 'trimEnd', 'trimStart', 'truncate', 'unescape', 'upperCase', 'upperFirst', 'words', // Util\n'cond', 'conforms', 'constant', 'defaultTo', 'flow', 'flowRight', 'identity', 'iteratee', 'matches', 'matchesProperty', 'method', 'methodOf', 'nthArg', 'over', 'overEvery', 'overSome', 'property', 'propertyOf', 'range', 'rangeRight', 'stubArray', 'stubFalse', 'stubObject', 'stubString', 'stubTrue', 'times', 'toPath', 'uniqueId'];\nexports.lodashOperators = lodashOperators;\n\n//# sourceURL=webpack:///./lib/utils/jsonlogic/operators.js?"); /***/ }), /***/ "./lib/utils/utils.js": /*!****************************!*\ !*** ./lib/utils/utils.js ***! \****************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; eval("\n\n__webpack_require__(/*! core-js/modules/es6.object.keys */ \"./node_modules/core-js/modules/es6.object.keys.js\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nvar _exportNames = {\n evaluate: true,\n getRandomComponentId: true,\n getPropertyValue: true,\n getElementRect: true,\n boolValue: true,\n isMongoId: true,\n checkCalculated: true,\n checkSimpleConditional: true,\n checkCustomConditional: true,\n checkJsonConditional: true,\n checkCondition: true,\n checkTrigger: true,\n setActionProperty: true,\n interpolate: true,\n uniqueName: true,\n guid: true,\n getDateSetting: true,\n isValidDate: true,\n currentTimezone: true,\n offsetDate: true,\n loadZones: true,\n timezoneText: true,\n formatDate: true,\n formatOffset: true,\n getLocaleDateFormatInfo: true,\n convertFormatToFlatpickr: true,\n convertFormatToMoment: true,\n convertFormatToMask: true,\n getInputMask: true,\n matchInputMask: true,\n getNumberSeparators: true,\n getNumberDecimalLimit: true,\n getCurrencyAffixes: true,\n fieldData: true,\n delay: true,\n iterateKey: true,\n uniqueKey: true,\n bootstrapVersion: true,\n jsonLogic: true\n};\nexports.evaluate = evaluate;\nexports.getRandomComponentId = getRandomComponentId;\nexports.getPropertyValue = getPropertyValue;\nexports.getElementRect = getElementRect;\nexports.boolValue = boolValue;\nexports.isMongoId = isMongoId;\nexports.checkCalculated = checkCalculated;\nexports.checkSimpleConditional = checkSimpleConditional;\nexports.checkCustomConditional = checkCustomConditional;\nexports.checkJsonConditional = checkJsonConditional;\nexports.checkCondition = checkCondition;\nexports.checkTrigger = checkTrigger;\nexports.setActionProperty = setActionProperty;\nexports.interpolate = interpolate;\nexports.uniqueName = uniqueName;\nexports.guid = guid;\nexports.getDateSetting = getDateSetting;\nexports.isValidDate = isValidDate;\nexports.currentTimezone = currentTimezone;\nexports.offsetDate = offsetDate;\nexports.loadZones = loadZones;\nexports.timezoneText = timezoneText;\nexports.formatDate = formatDate;\nexports.formatOffset = formatOffset;\nexports.getLocaleDateFormatInfo = getLocaleDateFormatInfo;\nexports.convertFormatToFlatpickr = convertFormatToFlatpickr;\nexports.convertFormatToMoment = convertFormatToMoment;\nexports.convertFormatToMask = convertFormatToMask;\nexports.getInputMask = getInputMask;\nexports.matchInputMask = matchInputMask;\nexports.getNumberSeparators = getNumberSeparators;\nexports.getNumberDecimalLimit = getNumberDecimalLimit;\nexports.getCurrencyAffixes = getCurrencyAffixes;\nexports.fieldData = fieldData;\nexports.delay = delay;\nexports.iterateKey = iterateKey;\nexports.uniqueKey = uniqueKey;\nexports.bootstrapVersion = bootstrapVersion;\nObject.defineProperty(exports, \"jsonLogic\", {\n enumerable: true,\n get: function get() {\n return _jsonLogicJs.default;\n }\n});\n\n__webpack_require__(/*! core-js/modules/es6.reflect.construct */ \"./node_modules/core-js/modules/es6.reflect.construct.js\");\n\n__webpack_require__(/*! core-js/modules/es6.string.iterator */ \"./node_modules/core-js/modules/es6.string.iterator.js\");\n\n__webpack_require__(/*! core-js/modules/es6.array.from */ \"./node_modules/core-js/modules/es6.array.from.js\");\n\n__webpack_require__(/*! core-js/modules/es7.symbol.async-iterator */ \"./node_modules/core-js/modules/es7.symbol.async-iterator.js\");\n\n__webpack_require__(/*! core-js/modules/es6.symbol */ \"./node_modules/core-js/modules/es6.symbol.js\");\n\n__webpack_require__(/*! core-js/modules/es6.number.constructor */ \"./node_modules/core-js/modules/es6.number.constructor.js\");\n\n__webpack_require__(/*! core-js/modules/es6.regexp.constructor */ \"./node_modules/core-js/modules/es6.regexp.constructor.js\");\n\n__webpack_require__(/*! core-js/modules/es6.regexp.split */ \"./node_modules/core-js/modules/es6.regexp.split.js\");\n\n__webpack_require__(/*! core-js/modules/es7.array.includes */ \"./node_modules/core-js/modules/es7.array.includes.js\");\n\n__webpack_require__(/*! core-js/modules/es6.string.includes */ \"./node_modules/core-js/modules/es6.string.includes.js\");\n\n__webpack_require__(/*! core-js/modules/es6.regexp.match */ \"./node_modules/core-js/modules/es6.regexp.match.js\");\n\n__webpack_require__(/*! core-js/modules/es6.regexp.to-string */ \"./node_modules/core-js/modules/es6.regexp.to-string.js\");\n\n__webpack_require__(/*! core-js/modules/es6.regexp.replace */ \"./node_modules/core-js/modules/es6.regexp.replace.js\");\n\n__webpack_require__(/*! core-js/modules/es6.array.iterator */ \"./node_modules/core-js/modules/es6.array.iterator.js\");\n\n__webpack_require__(/*! core-js/modules/es6.function.name */ \"./node_modules/core-js/modules/es6.function.name.js\");\n\n__webpack_require__(/*! core-js/modules/web.dom.iterable */ \"./node_modules/core-js/modules/web.dom.iterable.js\");\n\nvar _lodash = _interopRequireDefault(__webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\"));\n\n__webpack_require__(/*! whatwg-fetch */ \"./node_modules/whatwg-fetch/fetch.js\");\n\nvar _jsonLogicJs = _interopRequireDefault(__webpack_require__(/*! json-logic-js */ \"./node_modules/json-logic-js/logic.js\"));\n\nvar _momentTimezone = _interopRequireDefault(__webpack_require__(/*! moment-timezone/moment-timezone */ \"./node_modules/moment-timezone/moment-timezone.js\"));\n\nvar _jstimezonedetect = _interopRequireDefault(__webpack_require__(/*! jstimezonedetect */ \"./node_modules/jstimezonedetect/dist/jstz.js\"));\n\nvar _operators = __webpack_require__(/*! ./jsonlogic/operators */ \"./lib/utils/jsonlogic/operators.js\");\n\nvar _nativePromiseOnly = _interopRequireDefault(__webpack_require__(/*! native-promise-only */ \"./node_modules/native-promise-only/lib/npo.src.js\"));\n\nvar _formUtils = __webpack_require__(/*! ./formUtils */ \"./lib/utils/formUtils.js\");\n\nObject.keys(_formUtils).forEach(function (key) {\n if (key === \"default\" || key === \"__esModule\") return;\n if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;\n Object.defineProperty(exports, key, {\n enumerable: true,\n get: function get() {\n return _formUtils[key];\n }\n });\n});\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _typeof(obj) { 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\nfunction isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _construct(Parent, args, Class) { if (isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }\n\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance\"); }\n\nfunction _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === \"[object Arguments]\") return Array.from(iter); }\n\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }\n\n// Configure JsonLogic\n_operators.lodashOperators.forEach(function (name) {\n return _jsonLogicJs.default.add_operation(\"_\".concat(name), _lodash.default[name]);\n}); // Retrieve Any Date\n\n\n_jsonLogicJs.default.add_operation('getDate', function (date) {\n return (0, _momentTimezone.default)(date).toISOString();\n}); // Set Relative Minimum Date\n\n\n_jsonLogicJs.default.add_operation('relativeMinDate', function (relativeMinDate) {\n return (0, _momentTimezone.default)().subtract(relativeMinDate, 'days').toISOString();\n}); // Set Relative Maximum Date\n\n\n_jsonLogicJs.default.add_operation('relativeMaxDate', function (relativeMaxDate) {\n return (0, _momentTimezone.default)().add(relativeMaxDate, 'days').toISOString();\n});\n\n/**\n * Evaluate a method.\n *\n * @param func\n * @param args\n * @return {*}\n */\nfunction evaluate(func, args, ret, tokenize) {\n var returnVal = null;\n var component = args.component ? args.component : {\n key: 'unknown'\n };\n\n if (!args.form && args.instance) {\n args.form = _lodash.default.get(args.instance, 'root._form', {});\n }\n\n if (typeof func === 'string') {\n if (ret) {\n func += \";return \".concat(ret);\n }\n\n var params = _lodash.default.keys(args);\n\n if (tokenize) {\n // Replace all {{ }} references with actual data.\n func = func.replace(/({{\\s+(.*)\\s+}})/, function (match, $1, $2) {\n if ($2.indexOf('data.') === 0) {\n return _lodash.default.get(args.data, $2.replace('data.', ''));\n } else if ($2.indexOf('row.') === 0) {\n return _lodash.default.get(args.row, $2.replace('row.', ''));\n } // Support legacy...\n\n\n return _lodash.default.get(args.data, $2);\n });\n }\n\n try {\n func = _construct(Function, _toConsumableArray(params).concat([func]));\n args = _lodash.default.values(args);\n } catch (err) {\n console.warn(\"An error occured within the custom function for \".concat(component.key), err);\n returnVal = null;\n func = false;\n }\n }\n\n if (typeof func === 'function') {\n try {\n returnVal = Array.isArray(args) ? func.apply(void 0, _toConsumableArray(args)) : func(args);\n } catch (err) {\n returnVal = null;\n console.warn(\"An error occured within custom function for \".concat(component.key), err);\n }\n } else if (_typeof(func) === 'object') {\n try {\n returnVal = _jsonLogicJs.default.apply(func, args);\n } catch (err) {\n returnVal = null;\n console.warn(\"An error occured within custom function for \".concat(component.key), err);\n }\n } else if (func) {\n console.warn(\"Unknown function type for \".concat(component.key));\n }\n\n return returnVal;\n}\n\nfunction getRandomComponentId() {\n return \"e\".concat(Math.random().toString(36).substring(7));\n}\n/**\n * Get a property value of an element.\n *\n * @param style\n * @param prop\n * @return {number}\n */\n\n\nfunction getPropertyValue(style, prop) {\n var value = style.getPropertyValue(prop);\n value = value ? value.replace(/[^0-9.]/g, '') : '0';\n return parseFloat(value);\n}\n/**\n * Get an elements bounding rectagle.\n *\n * @param element\n * @return {{x: string, y: string, width: string, height: string}}\n */\n\n\nfunction getElementRect(element) {\n var style = window.getComputedStyle(element, null);\n return {\n x: getPropertyValue(style, 'left'),\n y: getPropertyValue(style, 'top'),\n width: getPropertyValue(style, 'width'),\n height: getPropertyValue(style, 'height')\n };\n}\n/**\n * Determines the boolean value of a setting.\n *\n * @param value\n * @return {boolean}\n */\n\n\nfunction boolValue(value) {\n if (_lodash.default.isBoolean(value)) {\n return value;\n } else if (_lodash.default.isString(value)) {\n return value.toLowerCase() === 'true';\n } else {\n return !!value;\n }\n}\n/**\n * Check to see if an ID is a mongoID.\n * @param text\n * @return {Array|{index: number, input: string}|Boolean|*}\n */\n\n\nfunction isMongoId(text) {\n return text.toString().match(/^[0-9a-fA-F]{24}$/);\n}\n/**\n * Checks the calculated value for a provided component and data.\n *\n * @param {Object} component\n * The component to check for the calculated value.\n * @param {Object} submission\n * A submission object.\n * @param data\n * The full submission data.\n */\n\n\nfunction checkCalculated(component, submission, rowData) {\n // Process calculated value stuff if present.\n if (component.calculateValue) {\n _lodash.default.set(rowData, component.key, evaluate(component.calculateValue, {\n value: undefined,\n data: submission ? submission.data : rowData,\n row: rowData,\n util: this,\n component: component\n }, 'value'));\n }\n}\n/**\n * Check if a simple conditional evaluates to true.\n *\n * @param condition\n * @param condition\n * @param row\n * @param data\n * @returns {boolean}\n */\n\n\nfunction checkSimpleConditional(component, condition, row, data) {\n var value = null;\n\n if (row) {\n value = (0, _formUtils.getValue)({\n data: row\n }, condition.when);\n }\n\n if (data && _lodash.default.isNil(value)) {\n value = (0, _formUtils.getValue)({\n data: data\n }, condition.when);\n } // FOR-400 - Fix issue where falsey values were being evaluated as show=true\n\n\n if (_lodash.default.isNil(value)) {\n value = '';\n }\n\n var eq = String(condition.eq);\n var show = String(condition.show); // Special check for selectboxes component.\n\n if (_lodash.default.isObject(value) && _lodash.default.has(value, condition.eq)) {\n return String(value[condition.eq]) === show;\n } // FOR-179 - Check for multiple values.\n\n\n if (Array.isArray(value) && value.map(String).includes(eq)) {\n return show === 'true';\n }\n\n return String(value) === eq === (show === 'true');\n}\n/**\n * Check custom javascript conditional.\n *\n * @param component\n * @param custom\n * @param row\n * @param data\n * @returns {*}\n */\n\n\nfunction checkCustomConditional(component, custom, row, data, form, variable, onError, instance) {\n if (typeof custom === 'string') {\n custom = \"var \".concat(variable, \" = true; \").concat(custom, \"; return \").concat(variable, \";\");\n }\n\n var value = instance && instance.evaluate ? instance.evaluate(custom) : evaluate(custom, {\n row: row,\n data: data,\n form: form\n });\n\n if (value === null) {\n return onError;\n }\n\n return value;\n}\n\nfunction checkJsonConditional(component, json, row, data, form, onError) {\n try {\n return _jsonLogicJs.default.apply(json, {\n data: data,\n row: row,\n form: form,\n _: _lodash.default\n });\n } catch (err) {\n console.warn(\"An error occurred in jsonLogic advanced condition for \".concat(component.key), err);\n return onError;\n }\n}\n/**\n * Checks the conditions for a provided component and data.\n *\n * @param component\n * The component to check for the condition.\n * @param row\n * The data within a row\n * @param data\n * The full submission data.\n *\n * @returns {boolean}\n */\n\n\nfunction checkCondition(component, row, data, form, instance) {\n if (component.customConditional) {\n return checkCustomConditional(component, component.customConditional, row, data, form, 'show', true, instance);\n } else if (component.conditional && component.conditional.when) {\n return checkSimpleConditional(component, component.conditional, row, data, true);\n } else if (component.conditional && component.conditional.json) {\n return checkJsonConditional(component, component.conditional.json, row, data, form, instance);\n } // Default to show.\n\n\n return true;\n}\n/**\n * Test a trigger on a component.\n *\n * @param component\n * @param action\n * @param data\n * @param row\n * @returns {mixed}\n */\n\n\nfunction checkTrigger(component, trigger, row, data, form, instance) {\n switch (trigger.type) {\n case 'simple':\n return checkSimpleConditional(component, trigger.simple, row, data);\n\n case 'javascript':\n return checkCustomConditional(component, trigger.javascript, row, data, form, 'result', false, instance);\n\n case 'json':\n return checkJsonConditional(component, trigger.json, row, data, form, false);\n } // If none of the types matched, don't fire the trigger.\n\n\n return false;\n}\n\nfunction setActionProperty(component, action, row, data, result, instance) {\n switch (action.property.type) {\n case 'boolean':\n if (_lodash.default.get(component, action.property.value, false).toString() !== action.state.toString()) {\n _lodash.default.set(component, action.property.value, action.state.toString() === 'true');\n }\n\n break;\n\n case 'string':\n {\n var evalData = {\n data: data,\n row: row,\n component: component,\n result: result\n };\n var newValue = instance && instance.interpolate ? instance.interpolate(action.text, evalData) : interpolate(action.text, evalData);\n\n if (newValue !== _lodash.default.get(component, action.property.value, '')) {\n _lodash.default.set(component, action.property.value, newValue);\n }\n\n break;\n }\n }\n\n return component;\n}\n/**\n * Interpolate a string and add data replacements.\n *\n * @param string\n * @param data\n * @returns {XML|string|*|void}\n */\n\n\nfunction interpolate(string, data) {\n var templateSettings = {\n evaluate: /\\{%(.+?)%\\}/g,\n interpolate: /\\{\\{(.+?)\\}\\}/g,\n escape: /\\{\\{\\{(.+?)\\}\\}\\}/g\n };\n\n try {\n return _lodash.default.template(string, templateSettings)(data);\n } catch (err) {\n console.warn('Error interpolating template', err, string, data);\n }\n}\n/**\n * Make a filename guaranteed to be unique.\n * @param name\n * @returns {string}\n */\n\n\nfunction uniqueName(name) {\n var parts = name.toLowerCase().replace(/[^0-9a-z.]/g, '').split('.');\n var fileName = parts[0];\n var ext = parts.length > 1 ? \".\".concat(_lodash.default.last(parts)) : '';\n return \"\".concat(fileName.substr(0, 10), \"-\").concat(guid()).concat(ext);\n}\n\nfunction guid() {\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\n var r = Math.random() * 16 | 0;\n var v = c === 'x' ? r : r & 0x3 | 0x8;\n return v.toString(16);\n });\n}\n/**\n * Return a translated date setting.\n *\n * @param date\n * @return {*}\n */\n\n\nfunction getDateSetting(date) {\n if (_lodash.default.isNil(date) || _lodash.default.isNaN(date) || date === '') {\n return null;\n }\n\n if (date instanceof Date) {\n return date;\n } else if (typeof date.toDate === 'function') {\n return date.isValid() ? date.toDate() : null;\n }\n\n var dateSetting = typeof date !== 'string' || date.indexOf('moment(') === -1 ? (0, _momentTimezone.default)(date) : null;\n\n if (dateSetting && dateSetting.isValid()) {\n return dateSetting.toDate();\n }\n\n dateSetting = null;\n\n try {\n var value = new Function('moment', \"return \".concat(date, \";\"))(_momentTimezone.default);\n\n if (typeof value === 'string') {\n dateSetting = (0, _momentTimezone.default)(value);\n } else if (typeof value.toDate === 'function') {\n dateSetting = (0, _momentTimezone.default)(value.toDate().toUTCString());\n } else if (value instanceof Date) {\n dateSetting = (0, _momentTimezone.default)(value);\n }\n } catch (e) {\n return null;\n }\n\n if (!dateSetting) {\n return null;\n } // Ensure this is a date.\n\n\n if (!dateSetting.isValid()) {\n return null;\n }\n\n return dateSetting.toDate();\n}\n\nfunction isValidDate(date) {\n return _lodash.default.isDate(date) && !_lodash.default.isNaN(date.getDate());\n}\n/**\n * Get the current timezone string.\n *\n * @return {string}\n */\n\n\nfunction currentTimezone() {\n if (_momentTimezone.default.currentTimezone) {\n return _momentTimezone.default.currentTimezone;\n }\n\n _momentTimezone.default.currentTimezone = _jstimezonedetect.default.determine().name();\n return _momentTimezone.default.currentTimezone;\n}\n/**\n * Get an offset date provided a date object and timezone object.\n *\n * @param date\n * @param timezone\n * @return {Date}\n */\n\n\nfunction offsetDate(date, timezone) {\n if (timezone === 'UTC') {\n return {\n date: new Date(date.getTime() + date.getTimezoneOffset() * 60000),\n abbr: 'UTC'\n };\n }\n\n var dateMoment = (0, _momentTimezone.default)(date).tz(timezone);\n return {\n date: new Date(date.getTime() + (dateMoment.utcOffset() + date.getTimezoneOffset()) * 60000),\n abbr: dateMoment.format('z')\n };\n}\n/**\n * Externally load the timezone data.\n *\n * @return {Promise<any> | *}\n */\n\n\nfunction loadZones(timezone) {\n if (timezone === currentTimezone()) {\n // Return non-resolving promise.\n return new _nativePromiseOnly.default(_lodash.default.noop);\n }\n\n if (timezone === 'UTC') {\n // Return non-resolving promise.\n return new _nativePromiseOnly.default(_lodash.default.noop);\n }\n\n if (_momentTimezone.default.zonesPromise) {\n return _momentTimezone.default.zonesPromise;\n }\n\n return _momentTimezone.default.zonesPromise = fetch('https://cdn.rawgit.com/moment/moment-timezone/develop/data/packed/latest.json').then(function (resp) {\n return resp.json().then(function (zones) {\n _momentTimezone.default.tz.load(zones);\n\n _momentTimezone.default.zonesLoaded = true;\n });\n });\n}\n/**\n * Set the timezone text and replace once timezones have loaded.\n *\n * @param offsetFormat\n * @param stdFormat\n * @return {*}\n */\n\n\nfunction timezoneText(offsetFormat, stdFormat) {\n loadZones();\n\n if (_momentTimezone.default.zonesLoaded) {\n return offsetFormat();\n }\n\n var id = getRandomComponentId();\n var tries = 0;\n\n _momentTimezone.default.zonesPromise.then(function replaceZone() {\n var element = document.getElementById(id);\n\n if (element) {\n element.innerHTML = offsetFormat();\n } else if (tries++ < 5) {\n setTimeout(replaceZone, 100);\n }\n }); // For now just return the current format, and replace once zones are loaded.\n\n\n return \"<span id='\".concat(id, \"'>\").concat(stdFormat(), \"</span>\");\n}\n/**\n * Format a date provided a value, format, and timezone object.\n *\n * @param value\n * @param format\n * @param timezone\n * @return {string}\n */\n\n\nfunction formatDate(value, format, timezone) {\n var momentDate = (0, _momentTimezone.default)(value);\n\n if (timezone === currentTimezone()) {\n // See if our format contains a \"z\" timezone character.\n if (format.match(/\\s(z$|z\\s)/)) {\n // Return the timezoneText.\n return timezoneText(function () {\n return momentDate.tz(timezone).format(convertFormatToMoment(format));\n }, function () {\n return momentDate.format(convertFormatToMoment(format.replace(/\\s(z$|z\\s)/, '')));\n });\n } // Return the standard format.\n\n\n return momentDate.format(convertFormatToMoment(format));\n }\n\n if (timezone === 'UTC') {\n var offset = offsetDate(momentDate.toDate(), 'UTC');\n return \"\".concat((0, _momentTimezone.default)(offset.date).format(convertFormatToMoment(format)), \" UTC\");\n } // Return the timezoneText.\n\n\n return timezoneText(function () {\n return momentDate.tz(timezone).format(\"\".concat(convertFormatToMoment(format), \" z\"));\n }, function () {\n return momentDate.format(convertFormatToMoment(format));\n });\n}\n/**\n * Pass a format function to format within a timezone.\n *\n * @param formatFn\n * @param date\n * @param format\n * @param timezone\n * @return {string}\n */\n\n\nfunction formatOffset(formatFn, date, format, timezone) {\n if (timezone === currentTimezone()) {\n return formatFn(date, format);\n }\n\n if (timezone === 'UTC') {\n return \"\".concat(formatFn(offsetDate(date, 'UTC').date, format), \" UTC\");\n } // Return the timezone text.\n\n\n return timezoneText(function () {\n var offset = offsetDate(date, timezone);\n return \"\".concat(formatFn(offset.date, format), \" \").concat(offset.abbr);\n }, function () {\n return formatFn(date, format);\n });\n}\n\nfunction getLocaleDateFormatInfo(locale) {\n var formatInfo = {};\n var day = 21;\n var exampleDate = new Date(2017, 11, day);\n var localDateString = exampleDate.toLocaleDateString(locale);\n formatInfo.dayFirst = localDateString.slice(0, 2) === day.toString();\n return formatInfo;\n}\n/**\n * Convert the format from the angular-datepicker module to flatpickr format.\n * @param format\n * @return {string}\n */\n\n\nfunction convertFormatToFlatpickr(format) {\n return format // Remove the Z timezone offset, not supported by flatpickr.\n .replace(/Z/g, '') // Year conversion.\n .replace(/y/g, 'Y').replace('YYYY', 'Y').replace('YY', 'y') // Month conversion.\n .replace('MMMM', 'F').replace(/M/g, 'n').replace('nnn', 'M').replace('nn', 'm') // Day in month.\n .replace(/d/g, 'j').replace(/jj/g, 'd') // Day in week.\n .replace('EEEE', 'l').replace('EEE', 'D') // Hours, minutes, seconds\n .replace('HH', 'H').replace('hh', 'h').replace('mm', 'i').replace('ss', 'S').replace(/a/g, 'K');\n}\n/**\n * Convert the format from the angular-datepicker module to moment format.\n * @param format\n * @return {string}\n */\n\n\nfunction convertFormatToMoment(format) {\n return format // Year conversion.\n .replace(/y/g, 'Y') // Day in month.\n .replace(/d/g, 'D') // Day in week.\n .replace(/E/g, 'd') // AM/PM marker\n .replace(/a/g, 'A');\n}\n\nfunction convertFormatToMask(format) {\n return format // Short and long month replacement.\n .replace(/(MMM|MMMM)/g, 'MM') // Year conversion\n .replace(/[ydhmsHM]/g, '9') // AM/PM conversion\n .replace(/a/g, 'AA');\n}\n/**\n * Returns an input mask that is compatible with the input mask library.\n * @param {string} mask - The Form.io input mask.\n * @returns {Array} - The input mask for the mask library.\n */\n\n\nfunction getInputMask(mask) {\n if (mask instanceof Array) {\n return mask;\n }\n\n var maskArray = [];\n maskArray.numeric = true;\n\n for (var i = 0; i < mask.length; i++) {\n switch (mask[i]) {\n case '9':\n maskArray.push(/\\d/);\n break;\n\n case 'A':\n maskArray.numeric = false;\n maskArray.push(/[a-zA-Z]/);\n break;\n\n case 'a':\n maskArray.numeric = false;\n maskArray.push(/[a-z]/);\n break;\n\n case '*':\n maskArray.numeric = false;\n maskArray.push(/[a-zA-Z0-9]/);\n break;\n\n default:\n maskArray.push(mask[i]);\n break;\n }\n }\n\n return maskArray;\n}\n\nfunction matchInputMask(value, inputMask) {\n if (!inputMask) {\n return true;\n }\n\n for (var i = 0; i < inputMask.length; i++) {\n var char = value[i];\n var charPart = inputMask[i];\n\n if (!(_lodash.default.isRegExp(charPart) && charPart.test(char) || charPart === char)) {\n return false;\n }\n }\n\n return true;\n}\n\nfunction getNumberSeparators() {\n var lang = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'en';\n var formattedNumberString = 12345.6789.toLocaleString(lang);\n var delimeters = formattedNumberString.match(/..(.)...(.)../);\n\n if (!delimeters) {\n return {\n delimiter: ',',\n decimalSeparator: '.'\n };\n }\n\n return {\n delimiter: delimeters.length > 1 ? delimeters[1] : ',',\n decimalSeparator: delimeters.length > 2 ? delimeters[2] : '.'\n };\n}\n\nfunction getNumberDecimalLimit(component) {\n // Determine the decimal limit. Defaults to 20 but can be overridden by validate.step or decimalLimit settings.\n var decimalLimit = 20;\n\n var step = _lodash.default.get(component, 'validate.step', 'any');\n\n if (step !== 'any') {\n var parts = step.toString().split('.');\n\n if (parts.length > 1) {\n decimalLimit = parts[1].length;\n }\n }\n\n return decimalLimit;\n}\n\nfunction getCurrencyAffixes(_ref) {\n var _ref$currency = _ref.currency,\n currency = _ref$currency === void 0 ? 'USD' : _ref$currency,\n decimalLimit = _ref.decimalLimit,\n decimalSeparator = _ref.decimalSeparator,\n lang = _ref.lang;\n // Get the prefix and suffix from the localized string.\n var regex = '(.*)?100';\n\n if (decimalLimit) {\n regex += \"\".concat(decimalSeparator === '.' ? '\\\\.' : decimalSeparator, \"0{\").concat(decimalLimit, \"}\");\n }\n\n regex += '(.*)?';\n var parts = 100 .toLocaleString(lang, {\n style: 'currency',\n currency: currency,\n useGrouping: true,\n maximumFractionDigits: decimalLimit,\n minimumFractionDigits: decimalLimit\n }).replace('.', decimalSeparator).match(new RegExp(regex));\n return {\n prefix: parts[1] || '',\n suffix: parts[2] || ''\n };\n}\n/**\n * Fetch the field data provided a component.\n *\n * @param data\n * @param component\n * @return {*}\n */\n\n\nfunction fieldData(data, component) {\n if (!data) {\n return '';\n }\n\n if (!component || !component.key) {\n return data;\n }\n\n if (component.key.includes('.')) {\n var value = data;\n var parts = component.key.split('.');\n var key = '';\n\n for (var i = 0; i < parts.length; i++) {\n key = parts[i]; // Handle nested resources\n\n if (value.hasOwnProperty('_id')) {\n value = value.data;\n } // Return if the key is not found on the value.\n\n\n if (!value.hasOwnProperty(key)) {\n return;\n } // Convert old single field data in submissions to multiple\n\n\n if (key === parts[parts.length - 1] && component.multiple && !Array.isArray(value[key])) {\n value[key] = [value[key]];\n } // Set the value of this key.\n\n\n value = value[key];\n }\n\n return value;\n } else {\n // Convert old single field data in submissions to multiple\n if (component.multiple && !Array.isArray(data[component.key])) {\n data[component.key] = [data[component.key]];\n }\n\n return data[component.key];\n }\n}\n/**\n * Delays function execution with possibility to execute function synchronously or cancel it.\n *\n * @param fn Function to delay\n * @param delay Delay time\n * @return {*}\n */\n\n\nfunction delay(fn) {\n var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n\n for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {\n args[_key - 2] = arguments[_key];\n }\n\n var timer = setTimeout.apply(void 0, [fn, delay].concat(args));\n\n function cancel() {\n clearTimeout(timer);\n }\n\n function earlyCall() {\n cancel();\n return fn.apply(void 0, args);\n }\n\n earlyCall.timer = timer;\n earlyCall.cancel = cancel;\n return earlyCall;\n}\n/**\n * Iterate the given key to make it unique.\n *\n * @param {String} key\n * Modify the component key to be unique.\n *\n * @returns {String}\n * The new component key.\n */\n\n\nfunction iterateKey(key) {\n if (!key.match(/(\\d+)$/)) {\n return \"\".concat(key, \"2\");\n }\n\n return key.replace(/(\\d+)$/, function (suffix) {\n return Number(suffix) + 1;\n });\n}\n/**\n * Determines a unique key within a map provided t