{"ast":null,"code":"import _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nimport _typeof from \"@babel/runtime/helpers/esm/typeof\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nvar _excluded = [\"name\"];\nimport { merge } from \"rc-util/es/utils/set\";\nimport warning from \"rc-util/es/warning\";\nimport * as React from 'react';\nimport { HOOK_MARK } from \"./FieldContext\";\nimport { allPromiseFinish } from \"./utils/asyncUtil\";\nimport { defaultValidateMessages } from \"./utils/messages\";\nimport NameMap from \"./utils/NameMap\";\nimport { cloneByNamePathList, containsNamePath, getNamePath, getValue, matchNamePath, setValue } from \"./utils/valueUtil\";\nexport var FormStore = /*#__PURE__*/_createClass(function FormStore(forceRootUpdate) {\n var _this = this;\n _classCallCheck(this, FormStore);\n _defineProperty(this, \"formHooked\", false);\n _defineProperty(this, \"forceRootUpdate\", void 0);\n _defineProperty(this, \"subscribable\", true);\n _defineProperty(this, \"store\", {});\n _defineProperty(this, \"fieldEntities\", []);\n _defineProperty(this, \"initialValues\", {});\n _defineProperty(this, \"callbacks\", {});\n _defineProperty(this, \"validateMessages\", null);\n _defineProperty(this, \"preserve\", null);\n _defineProperty(this, \"lastValidatePromise\", null);\n _defineProperty(this, \"getForm\", function () {\n return {\n getFieldValue: _this.getFieldValue,\n getFieldsValue: _this.getFieldsValue,\n getFieldError: _this.getFieldError,\n getFieldWarning: _this.getFieldWarning,\n getFieldsError: _this.getFieldsError,\n isFieldsTouched: _this.isFieldsTouched,\n isFieldTouched: _this.isFieldTouched,\n isFieldValidating: _this.isFieldValidating,\n isFieldsValidating: _this.isFieldsValidating,\n resetFields: _this.resetFields,\n setFields: _this.setFields,\n setFieldValue: _this.setFieldValue,\n setFieldsValue: _this.setFieldsValue,\n validateFields: _this.validateFields,\n submit: _this.submit,\n _init: true,\n getInternalHooks: _this.getInternalHooks\n };\n });\n // ======================== Internal Hooks ========================\n _defineProperty(this, \"getInternalHooks\", function (key) {\n if (key === HOOK_MARK) {\n _this.formHooked = true;\n return {\n dispatch: _this.dispatch,\n initEntityValue: _this.initEntityValue,\n registerField: _this.registerField,\n useSubscribe: _this.useSubscribe,\n setInitialValues: _this.setInitialValues,\n destroyForm: _this.destroyForm,\n setCallbacks: _this.setCallbacks,\n setValidateMessages: _this.setValidateMessages,\n getFields: _this.getFields,\n setPreserve: _this.setPreserve,\n getInitialValue: _this.getInitialValue,\n registerWatch: _this.registerWatch\n };\n }\n warning(false, '`getInternalHooks` is internal usage. Should not call directly.');\n return null;\n });\n _defineProperty(this, \"useSubscribe\", function (subscribable) {\n _this.subscribable = subscribable;\n });\n /**\n * Record prev Form unmount fieldEntities which config preserve false.\n * This need to be refill with initialValues instead of store value.\n */\n _defineProperty(this, \"prevWithoutPreserves\", null);\n /**\n * First time `setInitialValues` should update store with initial value\n */\n _defineProperty(this, \"setInitialValues\", function (initialValues, init) {\n _this.initialValues = initialValues || {};\n if (init) {\n var _this$prevWithoutPres;\n var nextStore = merge(initialValues, _this.store);\n\n // We will take consider prev form unmount fields.\n // When the field is not `preserve`, we need fill this with initialValues instead of store.\n // eslint-disable-next-line array-callback-return\n (_this$prevWithoutPres = _this.prevWithoutPreserves) === null || _this$prevWithoutPres === void 0 || _this$prevWithoutPres.map(function (_ref) {\n var namePath = _ref.key;\n nextStore = setValue(nextStore, namePath, getValue(initialValues, namePath));\n });\n _this.prevWithoutPreserves = null;\n _this.updateStore(nextStore);\n }\n });\n _defineProperty(this, \"destroyForm\", function (clearOnDestroy) {\n if (clearOnDestroy) {\n // destroy form reset store\n _this.updateStore({});\n } else {\n // Fill preserve fields\n var prevWithoutPreserves = new NameMap();\n _this.getFieldEntities(true).forEach(function (entity) {\n if (!_this.isMergedPreserve(entity.isPreserve())) {\n prevWithoutPreserves.set(entity.getNamePath(), true);\n }\n });\n _this.prevWithoutPreserves = prevWithoutPreserves;\n }\n });\n _defineProperty(this, \"getInitialValue\", function (namePath) {\n var initValue = getValue(_this.initialValues, namePath);\n\n // Not cloneDeep when without `namePath`\n return namePath.length ? merge(initValue) : initValue;\n });\n _defineProperty(this, \"setCallbacks\", function (callbacks) {\n _this.callbacks = callbacks;\n });\n _defineProperty(this, \"setValidateMessages\", function (validateMessages) {\n _this.validateMessages = validateMessages;\n });\n _defineProperty(this, \"setPreserve\", function (preserve) {\n _this.preserve = preserve;\n });\n // ============================= Watch ============================\n _defineProperty(this, \"watchList\", []);\n _defineProperty(this, \"registerWatch\", function (callback) {\n _this.watchList.push(callback);\n return function () {\n _this.watchList = _this.watchList.filter(function (fn) {\n return fn !== callback;\n });\n };\n });\n _defineProperty(this, \"notifyWatch\", function () {\n var namePath = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n // No need to cost perf when nothing need to watch\n if (_this.watchList.length) {\n var values = _this.getFieldsValue();\n var allValues = _this.getFieldsValue(true);\n _this.watchList.forEach(function (callback) {\n callback(values, allValues, namePath);\n });\n }\n });\n // ========================== Dev Warning =========================\n _defineProperty(this, \"timeoutId\", null);\n _defineProperty(this, \"warningUnhooked\", function () {\n if (process.env.NODE_ENV !== 'production' && !_this.timeoutId && typeof window !== 'undefined') {\n _this.timeoutId = setTimeout(function () {\n _this.timeoutId = null;\n if (!_this.formHooked) {\n warning(false, 'Instance created by `useForm` is not connected to any Form element. Forget to pass `form` prop?');\n }\n });\n }\n });\n // ============================ Store =============================\n _defineProperty(this, \"updateStore\", function (nextStore) {\n _this.store = nextStore;\n });\n // ============================ Fields ============================\n /**\n * Get registered field entities.\n * @param pure Only return field which has a `name`. Default: false\n */\n _defineProperty(this, \"getFieldEntities\", function () {\n var pure = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n if (!pure) {\n return _this.fieldEntities;\n }\n return _this.fieldEntities.filter(function (field) {\n return field.getNamePath().length;\n });\n });\n _defineProperty(this, \"getFieldsMap\", function () {\n var pure = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n var cache = new NameMap();\n _this.getFieldEntities(pure).forEach(function (field) {\n var namePath = field.getNamePath();\n cache.set(namePath, field);\n });\n return cache;\n });\n _defineProperty(this, \"getFieldEntitiesForNamePathList\", function (nameList) {\n if (!nameList) {\n return _this.getFieldEntities(true);\n }\n var cache = _this.getFieldsMap(true);\n return nameList.map(function (name) {\n var namePath = getNamePath(name);\n return cache.get(namePath) || {\n INVALIDATE_NAME_PATH: getNamePath(name)\n };\n });\n });\n _defineProperty(this, \"getFieldsValue\", function (nameList, filterFunc) {\n _this.warningUnhooked();\n\n // Fill args\n var mergedNameList;\n var mergedFilterFunc;\n var mergedStrict;\n if (nameList === true || Array.isArray(nameList)) {\n mergedNameList = nameList;\n mergedFilterFunc = filterFunc;\n } else if (nameList && _typeof(nameList) === 'object') {\n mergedStrict = nameList.strict;\n mergedFilterFunc = nameList.filter;\n }\n if (mergedNameList === true && !mergedFilterFunc) {\n return _this.store;\n }\n var fieldEntities = _this.getFieldEntitiesForNamePathList(Array.isArray(mergedNameList) ? mergedNameList : null);\n var filteredNameList = [];\n fieldEntities.forEach(function (entity) {\n var _isListField, _ref3;\n var namePath = 'INVALIDATE_NAME_PATH' in entity ? entity.INVALIDATE_NAME_PATH : entity.getNamePath();\n\n // Ignore when it's a list item and not specific the namePath,\n // since parent field is already take in count\n if (mergedStrict) {\n var _isList, _ref2;\n if ((_isList = (_ref2 = entity).isList) !== null && _isList !== void 0 && _isList.call(_ref2)) {\n return;\n }\n } else if (!mergedNameList && (_isListField = (_ref3 = entity).isListField) !== null && _isListField !== void 0 && _isListField.call(_ref3)) {\n return;\n }\n if (!mergedFilterFunc) {\n filteredNameList.push(namePath);\n } else {\n var meta = 'getMeta' in entity ? entity.getMeta() : null;\n if (mergedFilterFunc(meta)) {\n filteredNameList.push(namePath);\n }\n }\n });\n return cloneByNamePathList(_this.store, filteredNameList.map(getNamePath));\n });\n _defineProperty(this, \"getFieldValue\", function (name) {\n _this.warningUnhooked();\n var namePath = getNamePath(name);\n return getValue(_this.store, namePath);\n });\n _defineProperty(this, \"getFieldsError\", function (nameList) {\n _this.warningUnhooked();\n var fieldEntities = _this.getFieldEntitiesForNamePathList(nameList);\n return fieldEntities.map(function (entity, index) {\n if (entity && !('INVALIDATE_NAME_PATH' in entity)) {\n return {\n name: entity.getNamePath(),\n errors: entity.getErrors(),\n warnings: entity.getWarnings()\n };\n }\n return {\n name: getNamePath(nameList[index]),\n errors: [],\n warnings: []\n };\n });\n });\n _defineProperty(this, \"getFieldError\", function (name) {\n _this.warningUnhooked();\n var namePath = getNamePath(name);\n var fieldError = _this.getFieldsError([namePath])[0];\n return fieldError.errors;\n });\n _defineProperty(this, \"getFieldWarning\", function (name) {\n _this.warningUnhooked();\n var namePath = getNamePath(name);\n var fieldError = _this.getFieldsError([namePath])[0];\n return fieldError.warnings;\n });\n _defineProperty(this, \"isFieldsTouched\", function () {\n _this.warningUnhooked();\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n var arg0 = args[0],\n arg1 = args[1];\n var namePathList;\n var isAllFieldsTouched = false;\n if (args.length === 0) {\n namePathList = null;\n } else if (args.length === 1) {\n if (Array.isArray(arg0)) {\n namePathList = arg0.map(getNamePath);\n isAllFieldsTouched = false;\n } else {\n namePathList = null;\n isAllFieldsTouched = arg0;\n }\n } else {\n namePathList = arg0.map(getNamePath);\n isAllFieldsTouched = arg1;\n }\n var fieldEntities = _this.getFieldEntities(true);\n var isFieldTouched = function isFieldTouched(field) {\n return field.isFieldTouched();\n };\n\n // ===== Will get fully compare when not config namePathList =====\n if (!namePathList) {\n return isAllFieldsTouched ? fieldEntities.every(function (entity) {\n return isFieldTouched(entity) || entity.isList();\n }) : fieldEntities.some(isFieldTouched);\n }\n\n // Generate a nest tree for validate\n var map = new NameMap();\n namePathList.forEach(function (shortNamePath) {\n map.set(shortNamePath, []);\n });\n fieldEntities.forEach(function (field) {\n var fieldNamePath = field.getNamePath();\n\n // Find matched entity and put into list\n namePathList.forEach(function (shortNamePath) {\n if (shortNamePath.every(function (nameUnit, i) {\n return fieldNamePath[i] === nameUnit;\n })) {\n map.update(shortNamePath, function (list) {\n return [].concat(_toConsumableArray(list), [field]);\n });\n }\n });\n });\n\n // Check if NameMap value is touched\n var isNamePathListTouched = function isNamePathListTouched(entities) {\n return entities.some(isFieldTouched);\n };\n var namePathListEntities = map.map(function (_ref4) {\n var value = _ref4.value;\n return value;\n });\n return isAllFieldsTouched ? namePathListEntities.every(isNamePathListTouched) : namePathListEntities.some(isNamePathListTouched);\n });\n _defineProperty(this, \"isFieldTouched\", function (name) {\n _this.warningUnhooked();\n return _this.isFieldsTouched([name]);\n });\n _defineProperty(this, \"isFieldsValidating\", function (nameList) {\n _this.warningUnhooked();\n var fieldEntities = _this.getFieldEntities();\n if (!nameList) {\n return fieldEntities.some(function (testField) {\n return testField.isFieldValidating();\n });\n }\n var namePathList = nameList.map(getNamePath);\n return fieldEntities.some(function (testField) {\n var fieldNamePath = testField.getNamePath();\n return containsNamePath(namePathList, fieldNamePath) && testField.isFieldValidating();\n });\n });\n _defineProperty(this, \"isFieldValidating\", function (name) {\n _this.warningUnhooked();\n return _this.isFieldsValidating([name]);\n });\n /**\n * Reset Field with field `initialValue` prop.\n * Can pass `entities` or `namePathList` or just nothing.\n */\n _defineProperty(this, \"resetWithFieldInitialValue\", function () {\n var info = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n // Create cache\n var cache = new NameMap();\n var fieldEntities = _this.getFieldEntities(true);\n fieldEntities.forEach(function (field) {\n var initialValue = field.props.initialValue;\n var namePath = field.getNamePath();\n\n // Record only if has `initialValue`\n if (initialValue !== undefined) {\n var records = cache.get(namePath) || new Set();\n records.add({\n entity: field,\n value: initialValue\n });\n cache.set(namePath, records);\n }\n });\n\n // Reset\n var resetWithFields = function resetWithFields(entities) {\n entities.forEach(function (field) {\n var initialValue = field.props.initialValue;\n if (initialValue !== undefined) {\n var namePath = field.getNamePath();\n var formInitialValue = _this.getInitialValue(namePath);\n if (formInitialValue !== undefined) {\n // Warning if conflict with form initialValues and do not modify value\n warning(false, \"Form already set 'initialValues' with path '\".concat(namePath.join('.'), \"'. Field can not overwrite it.\"));\n } else {\n var records = cache.get(namePath);\n if (records && records.size > 1) {\n // Warning if multiple field set `initialValue`and do not modify value\n warning(false, \"Multiple Field with path '\".concat(namePath.join('.'), \"' set 'initialValue'. Can not decide which one to pick.\"));\n } else if (records) {\n var originValue = _this.getFieldValue(namePath);\n var isListField = field.isListField();\n\n // Set `initialValue`\n if (!isListField && (!info.skipExist || originValue === undefined)) {\n _this.updateStore(setValue(_this.store, namePath, _toConsumableArray(records)[0].value));\n }\n }\n }\n }\n });\n };\n var requiredFieldEntities;\n if (info.entities) {\n requiredFieldEntities = info.entities;\n } else if (info.namePathList) {\n requiredFieldEntities = [];\n info.namePathList.forEach(function (namePath) {\n var records = cache.get(namePath);\n if (records) {\n var _requiredFieldEntitie;\n (_requiredFieldEntitie = requiredFieldEntities).push.apply(_requiredFieldEntitie, _toConsumableArray(_toConsumableArray(records).map(function (r) {\n return r.entity;\n })));\n }\n });\n } else {\n requiredFieldEntities = fieldEntities;\n }\n resetWithFields(requiredFieldEntities);\n });\n _defineProperty(this, \"resetFields\", function (nameList) {\n _this.warningUnhooked();\n var prevStore = _this.store;\n if (!nameList) {\n _this.updateStore(merge(_this.initialValues));\n _this.resetWithFieldInitialValue();\n _this.notifyObservers(prevStore, null, {\n type: 'reset'\n });\n _this.notifyWatch();\n return;\n }\n\n // Reset by `nameList`\n var namePathList = nameList.map(getNamePath);\n namePathList.forEach(function (namePath) {\n var initialValue = _this.getInitialValue(namePath);\n _this.updateStore(setValue(_this.store, namePath, initialValue));\n });\n _this.resetWithFieldInitialValue({\n namePathList: namePathList\n });\n _this.notifyObservers(prevStore, namePathList, {\n type: 'reset'\n });\n _this.notifyWatch(namePathList);\n });\n _defineProperty(this, \"setFields\", function (fields) {\n _this.warningUnhooked();\n var prevStore = _this.store;\n var namePathList = [];\n fields.forEach(function (fieldData) {\n var name = fieldData.name,\n data = _objectWithoutProperties(fieldData, _excluded);\n var namePath = getNamePath(name);\n namePathList.push(namePath);\n\n // Value\n if ('value' in data) {\n _this.updateStore(setValue(_this.store, namePath, data.value));\n }\n _this.notifyObservers(prevStore, [namePath], {\n type: 'setField',\n data: fieldData\n });\n });\n _this.notifyWatch(namePathList);\n });\n _defineProperty(this, \"getFields\", function () {\n var entities = _this.getFieldEntities(true);\n var fields = entities.map(function (field) {\n var namePath = field.getNamePath();\n var meta = field.getMeta();\n var fieldData = _objectSpread(_objectSpread({}, meta), {}, {\n name: namePath,\n value: _this.getFieldValue(namePath)\n });\n Object.defineProperty(fieldData, 'originRCField', {\n value: true\n });\n return fieldData;\n });\n return fields;\n });\n // =========================== Observer ===========================\n /**\n * This only trigger when a field is on constructor to avoid we get initialValue too late\n */\n _defineProperty(this, \"initEntityValue\", function (entity) {\n var initialValue = entity.props.initialValue;\n if (initialValue !== undefined) {\n var namePath = entity.getNamePath();\n var prevValue = getValue(_this.store, namePath);\n if (prevValue === undefined) {\n _this.updateStore(setValue(_this.store, namePath, initialValue));\n }\n }\n });\n _defineProperty(this, \"isMergedPreserve\", function (fieldPreserve) {\n var mergedPreserve = fieldPreserve !== undefined ? fieldPreserve : _this.preserve;\n return mergedPreserve !== null && mergedPreserve !== void 0 ? mergedPreserve : true;\n });\n _defineProperty(this, \"registerField\", function (entity) {\n _this.fieldEntities.push(entity);\n var namePath = entity.getNamePath();\n _this.notifyWatch([namePath]);\n\n // Set initial values\n if (entity.props.initialValue !== undefined) {\n var prevStore = _this.store;\n _this.resetWithFieldInitialValue({\n entities: [entity],\n skipExist: true\n });\n _this.notifyObservers(prevStore, [entity.getNamePath()], {\n type: 'valueUpdate',\n source: 'internal'\n });\n }\n\n // un-register field callback\n return function (isListField, preserve) {\n var subNamePath = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];\n _this.fieldEntities = _this.fieldEntities.filter(function (item) {\n return item !== entity;\n });\n\n // Clean up store value if not preserve\n if (!_this.isMergedPreserve(preserve) && (!isListField || subNamePath.length > 1)) {\n var defaultValue = isListField ? undefined : _this.getInitialValue(namePath);\n if (namePath.length && _this.getFieldValue(namePath) !== defaultValue && _this.fieldEntities.every(function (field) {\n return (\n // Only reset when no namePath exist\n !matchNamePath(field.getNamePath(), namePath)\n );\n })) {\n var _prevStore = _this.store;\n _this.updateStore(setValue(_prevStore, namePath, defaultValue, true));\n\n // Notify that field is unmount\n _this.notifyObservers(_prevStore, [namePath], {\n type: 'remove'\n });\n\n // Dependencies update\n _this.triggerDependenciesUpdate(_prevStore, namePath);\n }\n }\n _this.notifyWatch([namePath]);\n };\n });\n _defineProperty(this, \"dispatch\", function (action) {\n switch (action.type) {\n case 'updateValue':\n {\n var namePath = action.namePath,\n value = action.value;\n _this.updateValue(namePath, value);\n break;\n }\n case 'validateField':\n {\n var _namePath = action.namePath,\n triggerName = action.triggerName;\n _this.validateFields([_namePath], {\n triggerName: triggerName\n });\n break;\n }\n default:\n // Currently we don't have other action. Do nothing.\n }\n });\n _defineProperty(this, \"notifyObservers\", function (prevStore, namePathList, info) {\n if (_this.subscribable) {\n var mergedInfo = _objectSpread(_objectSpread({}, info), {}, {\n store: _this.getFieldsValue(true)\n });\n _this.getFieldEntities().forEach(function (_ref5) {\n var onStoreChange = _ref5.onStoreChange;\n onStoreChange(prevStore, namePathList, mergedInfo);\n });\n } else {\n _this.forceRootUpdate();\n }\n });\n /**\n * Notify dependencies children with parent update\n * We need delay to trigger validate in case Field is under render props\n */\n _defineProperty(this, \"triggerDependenciesUpdate\", function (prevStore, namePath) {\n var childrenFields = _this.getDependencyChildrenFields(namePath);\n if (childrenFields.length) {\n _this.validateFields(childrenFields);\n }\n _this.notifyObservers(prevStore, childrenFields, {\n type: 'dependenciesUpdate',\n relatedFields: [namePath].concat(_toConsumableArray(childrenFields))\n });\n return childrenFields;\n });\n _defineProperty(this, \"updateValue\", function (name, value) {\n var namePath = getNamePath(name);\n var prevStore = _this.store;\n _this.updateStore(setValue(_this.store, namePath, value));\n _this.notifyObservers(prevStore, [namePath], {\n type: 'valueUpdate',\n source: 'internal'\n });\n _this.notifyWatch([namePath]);\n\n // Dependencies update\n var childrenFields = _this.triggerDependenciesUpdate(prevStore, namePath);\n\n // trigger callback function\n var onValuesChange = _this.callbacks.onValuesChange;\n if (onValuesChange) {\n var changedValues = cloneByNamePathList(_this.store, [namePath]);\n onValuesChange(changedValues, _this.getFieldsValue());\n }\n _this.triggerOnFieldsChange([namePath].concat(_toConsumableArray(childrenFields)));\n });\n // Let all child Field get update.\n _defineProperty(this, \"setFieldsValue\", function (store) {\n _this.warningUnhooked();\n var prevStore = _this.store;\n if (store) {\n var nextStore = merge(_this.store, store);\n _this.updateStore(nextStore);\n }\n _this.notifyObservers(prevStore, null, {\n type: 'valueUpdate',\n source: 'external'\n });\n _this.notifyWatch();\n });\n _defineProperty(this, \"setFieldValue\", function (name, value) {\n _this.setFields([{\n name: name,\n value: value\n }]);\n });\n _defineProperty(this, \"getDependencyChildrenFields\", function (rootNamePath) {\n var children = new Set();\n var childrenFields = [];\n var dependencies2fields = new NameMap();\n\n /**\n * Generate maps\n * Can use cache to save perf if user report performance issue with this\n */\n _this.getFieldEntities().forEach(function (field) {\n var dependencies = field.props.dependencies;\n (dependencies || []).forEach(function (dependency) {\n var dependencyNamePath = getNamePath(dependency);\n dependencies2fields.update(dependencyNamePath, function () {\n var fields = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Set();\n fields.add(field);\n return fields;\n });\n });\n });\n var fillChildren = function fillChildren(namePath) {\n var fields = dependencies2fields.get(namePath) || new Set();\n fields.forEach(function (field) {\n if (!children.has(field)) {\n children.add(field);\n var fieldNamePath = field.getNamePath();\n if (field.isFieldDirty() && fieldNamePath.length) {\n childrenFields.push(fieldNamePath);\n fillChildren(fieldNamePath);\n }\n }\n });\n };\n fillChildren(rootNamePath);\n return childrenFields;\n });\n _defineProperty(this, \"triggerOnFieldsChange\", function (namePathList, filedErrors) {\n var onFieldsChange = _this.callbacks.onFieldsChange;\n if (onFieldsChange) {\n var fields = _this.getFields();\n\n /**\n * Fill errors since `fields` may be replaced by controlled fields\n */\n if (filedErrors) {\n var cache = new NameMap();\n filedErrors.forEach(function (_ref6) {\n var name = _ref6.name,\n errors = _ref6.errors;\n cache.set(name, errors);\n });\n fields.forEach(function (field) {\n // eslint-disable-next-line no-param-reassign\n field.errors = cache.get(field.name) || field.errors;\n });\n }\n var changedFields = fields.filter(function (_ref7) {\n var fieldName = _ref7.name;\n return containsNamePath(namePathList, fieldName);\n });\n if (changedFields.length) {\n onFieldsChange(changedFields, fields);\n }\n }\n });\n // =========================== Validate ===========================\n _defineProperty(this, \"validateFields\", function (arg1, arg2) {\n _this.warningUnhooked();\n var nameList;\n var options;\n if (Array.isArray(arg1) || typeof arg1 === 'string' || typeof arg2 === 'string') {\n nameList = arg1;\n options = arg2;\n } else {\n options = arg1;\n }\n var provideNameList = !!nameList;\n var namePathList = provideNameList ? nameList.map(getNamePath) : [];\n\n // Collect result in promise list\n var promiseList = [];\n\n // We temp save the path which need trigger for `onFieldsChange`\n var TMP_SPLIT = String(Date.now());\n var validateNamePathList = new Set();\n var _ref8 = options || {},\n recursive = _ref8.recursive,\n dirty = _ref8.dirty;\n _this.getFieldEntities(true).forEach(function (field) {\n // Add field if not provide `nameList`\n if (!provideNameList) {\n namePathList.push(field.getNamePath());\n }\n\n // Skip if without rule\n if (!field.props.rules || !field.props.rules.length) {\n return;\n }\n\n // Skip if only validate dirty field\n if (dirty && !field.isFieldDirty()) {\n return;\n }\n var fieldNamePath = field.getNamePath();\n validateNamePathList.add(fieldNamePath.join(TMP_SPLIT));\n\n // Add field validate rule in to promise list\n if (!provideNameList || containsNamePath(namePathList, fieldNamePath, recursive)) {\n var promise = field.validateRules(_objectSpread({\n validateMessages: _objectSpread(_objectSpread({}, defaultValidateMessages), _this.validateMessages)\n }, options));\n\n // Wrap promise with field\n promiseList.push(promise.then(function () {\n return {\n name: fieldNamePath,\n errors: [],\n warnings: []\n };\n }).catch(function (ruleErrors) {\n var _ruleErrors$forEach;\n var mergedErrors = [];\n var mergedWarnings = [];\n (_ruleErrors$forEach = ruleErrors.forEach) === null || _ruleErrors$forEach === void 0 || _ruleErrors$forEach.call(ruleErrors, function (_ref9) {\n var warningOnly = _ref9.rule.warningOnly,\n errors = _ref9.errors;\n if (warningOnly) {\n mergedWarnings.push.apply(mergedWarnings, _toConsumableArray(errors));\n } else {\n mergedErrors.push.apply(mergedErrors, _toConsumableArray(errors));\n }\n });\n if (mergedErrors.length) {\n return Promise.reject({\n name: fieldNamePath,\n errors: mergedErrors,\n warnings: mergedWarnings\n });\n }\n return {\n name: fieldNamePath,\n errors: mergedErrors,\n warnings: mergedWarnings\n };\n }));\n }\n });\n var summaryPromise = allPromiseFinish(promiseList);\n _this.lastValidatePromise = summaryPromise;\n\n // Notify fields with rule that validate has finished and need update\n summaryPromise.catch(function (results) {\n return results;\n }).then(function (results) {\n var resultNamePathList = results.map(function (_ref10) {\n var name = _ref10.name;\n return name;\n });\n _this.notifyObservers(_this.store, resultNamePathList, {\n type: 'validateFinish'\n });\n _this.triggerOnFieldsChange(resultNamePathList, results);\n });\n var returnPromise = summaryPromise.then(function () {\n if (_this.lastValidatePromise === summaryPromise) {\n return Promise.resolve(_this.getFieldsValue(namePathList));\n }\n return Promise.reject([]);\n }).catch(function (results) {\n var errorList = results.filter(function (result) {\n return result && result.errors.length;\n });\n return Promise.reject({\n values: _this.getFieldsValue(namePathList),\n errorFields: errorList,\n outOfDate: _this.lastValidatePromise !== summaryPromise\n });\n });\n\n // Do not throw in console\n returnPromise.catch(function (e) {\n return e;\n });\n\n // `validating` changed. Trigger `onFieldsChange`\n var triggerNamePathList = namePathList.filter(function (namePath) {\n return validateNamePathList.has(namePath.join(TMP_SPLIT));\n });\n _this.triggerOnFieldsChange(triggerNamePathList);\n return returnPromise;\n });\n // ============================ Submit ============================\n _defineProperty(this, \"submit\", function () {\n _this.warningUnhooked();\n _this.validateFields().then(function (values) {\n var onFinish = _this.callbacks.onFinish;\n if (onFinish) {\n try {\n onFinish(values);\n } catch (err) {\n // Should print error if user `onFinish` callback failed\n console.error(err);\n }\n }\n }).catch(function (e) {\n var onFinishFailed = _this.callbacks.onFinishFailed;\n if (onFinishFailed) {\n onFinishFailed(e);\n }\n });\n });\n this.forceRootUpdate = forceRootUpdate;\n});\nfunction useForm(form) {\n var formRef = React.useRef();\n var _React$useState = React.useState({}),\n _React$useState2 = _slicedToArray(_React$useState, 2),\n forceUpdate = _React$useState2[1];\n if (!formRef.current) {\n if (form) {\n formRef.current = form;\n } else {\n // Create a new FormStore if not provided\n var forceReRender = function forceReRender() {\n forceUpdate({});\n };\n var formStore = new FormStore(forceReRender);\n formRef.current = formStore.getForm();\n }\n }\n return [formRef.current];\n}\nexport default useForm;","map":{"version":3,"names":["_slicedToArray","_objectSpread","_objectWithoutProperties","_toConsumableArray","_typeof","_createClass","_classCallCheck","_defineProperty","_excluded","merge","warning","React","HOOK_MARK","allPromiseFinish","defaultValidateMessages","NameMap","cloneByNamePathList","containsNamePath","getNamePath","getValue","matchNamePath","setValue","FormStore","forceRootUpdate","_this","getFieldValue","getFieldsValue","getFieldError","getFieldWarning","getFieldsError","isFieldsTouched","isFieldTouched","isFieldValidating","isFieldsValidating","resetFields","setFields","setFieldValue","setFieldsValue","validateFields","submit","_init","getInternalHooks","key","formHooked","dispatch","initEntityValue","registerField","useSubscribe","setInitialValues","destroyForm","setCallbacks","setValidateMessages","getFields","setPreserve","getInitialValue","registerWatch","subscribable","initialValues","init","_this$prevWithoutPres","nextStore","store","prevWithoutPreserves","map","_ref","namePath","updateStore","clearOnDestroy","getFieldEntities","forEach","entity","isMergedPreserve","isPreserve","set","initValue","length","callbacks","validateMessages","preserve","callback","watchList","push","filter","fn","arguments","undefined","values","allValues","process","env","NODE_ENV","timeoutId","window","setTimeout","pure","fieldEntities","field","cache","nameList","getFieldsMap","name","get","INVALIDATE_NAME_PATH","filterFunc","warningUnhooked","mergedNameList","mergedFilterFunc","mergedStrict","Array","isArray","strict","getFieldEntitiesForNamePathList","filteredNameList","_isListField","_ref3","_isList","_ref2","isList","call","isListField","meta","getMeta","index","errors","getErrors","warnings","getWarnings","fieldError","_len","args","_key","arg0","arg1","namePathList","isAllFieldsTouched","every","some","shortNamePath","fieldNamePath","nameUnit","i","update","list","concat","isNamePathListTouched","entities","namePathListEntities","_ref4","value","testField","info","initialValue","props","records","Set","add","resetWithFields","formInitialValue","join","size","originValue","skipExist","requiredFieldEntities","_requiredFieldEntitie","apply","r","prevStore","resetWithFieldInitialValue","notifyObservers","type","notifyWatch","fields","fieldData","data","Object","defineProperty","prevValue","fieldPreserve","mergedPreserve","source","subNamePath","item","defaultValue","_prevStore","triggerDependenciesUpdate","action","updateValue","_namePath","triggerName","mergedInfo","_ref5","onStoreChange","childrenFields","getDependencyChildrenFields","relatedFields","onValuesChange","changedValues","triggerOnFieldsChange","rootNamePath","children","dependencies2fields","dependencies","dependency","dependencyNamePath","fillChildren","has","isFieldDirty","filedErrors","onFieldsChange","_ref6","changedFields","_ref7","fieldName","arg2","options","provideNameList","promiseList","TMP_SPLIT","String","Date","now","validateNamePathList","_ref8","recursive","dirty","rules","promise","validateRules","then","catch","ruleErrors","_ruleErrors$forEach","mergedErrors","mergedWarnings","_ref9","warningOnly","rule","Promise","reject","summaryPromise","lastValidatePromise","results","resultNamePathList","_ref10","returnPromise","resolve","errorList","result","errorFields","outOfDate","e","triggerNamePathList","onFinish","err","console","error","onFinishFailed","useForm","form","formRef","useRef","_React$useState","useState","_React$useState2","forceUpdate","current","forceReRender","formStore","getForm"],"sources":["C:/Users/Аришина)/source/repos/PromoCursed/node_modules/rc-field-form/es/useForm.js"],"sourcesContent":["import _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nimport _typeof from \"@babel/runtime/helpers/esm/typeof\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nvar _excluded = [\"name\"];\nimport { merge } from \"rc-util/es/utils/set\";\nimport warning from \"rc-util/es/warning\";\nimport * as React from 'react';\nimport { HOOK_MARK } from \"./FieldContext\";\nimport { allPromiseFinish } from \"./utils/asyncUtil\";\nimport { defaultValidateMessages } from \"./utils/messages\";\nimport NameMap from \"./utils/NameMap\";\nimport { cloneByNamePathList, containsNamePath, getNamePath, getValue, matchNamePath, setValue } from \"./utils/valueUtil\";\nexport var FormStore = /*#__PURE__*/_createClass(function FormStore(forceRootUpdate) {\n var _this = this;\n _classCallCheck(this, FormStore);\n _defineProperty(this, \"formHooked\", false);\n _defineProperty(this, \"forceRootUpdate\", void 0);\n _defineProperty(this, \"subscribable\", true);\n _defineProperty(this, \"store\", {});\n _defineProperty(this, \"fieldEntities\", []);\n _defineProperty(this, \"initialValues\", {});\n _defineProperty(this, \"callbacks\", {});\n _defineProperty(this, \"validateMessages\", null);\n _defineProperty(this, \"preserve\", null);\n _defineProperty(this, \"lastValidatePromise\", null);\n _defineProperty(this, \"getForm\", function () {\n return {\n getFieldValue: _this.getFieldValue,\n getFieldsValue: _this.getFieldsValue,\n getFieldError: _this.getFieldError,\n getFieldWarning: _this.getFieldWarning,\n getFieldsError: _this.getFieldsError,\n isFieldsTouched: _this.isFieldsTouched,\n isFieldTouched: _this.isFieldTouched,\n isFieldValidating: _this.isFieldValidating,\n isFieldsValidating: _this.isFieldsValidating,\n resetFields: _this.resetFields,\n setFields: _this.setFields,\n setFieldValue: _this.setFieldValue,\n setFieldsValue: _this.setFieldsValue,\n validateFields: _this.validateFields,\n submit: _this.submit,\n _init: true,\n getInternalHooks: _this.getInternalHooks\n };\n });\n // ======================== Internal Hooks ========================\n _defineProperty(this, \"getInternalHooks\", function (key) {\n if (key === HOOK_MARK) {\n _this.formHooked = true;\n return {\n dispatch: _this.dispatch,\n initEntityValue: _this.initEntityValue,\n registerField: _this.registerField,\n useSubscribe: _this.useSubscribe,\n setInitialValues: _this.setInitialValues,\n destroyForm: _this.destroyForm,\n setCallbacks: _this.setCallbacks,\n setValidateMessages: _this.setValidateMessages,\n getFields: _this.getFields,\n setPreserve: _this.setPreserve,\n getInitialValue: _this.getInitialValue,\n registerWatch: _this.registerWatch\n };\n }\n warning(false, '`getInternalHooks` is internal usage. Should not call directly.');\n return null;\n });\n _defineProperty(this, \"useSubscribe\", function (subscribable) {\n _this.subscribable = subscribable;\n });\n /**\n * Record prev Form unmount fieldEntities which config preserve false.\n * This need to be refill with initialValues instead of store value.\n */\n _defineProperty(this, \"prevWithoutPreserves\", null);\n /**\n * First time `setInitialValues` should update store with initial value\n */\n _defineProperty(this, \"setInitialValues\", function (initialValues, init) {\n _this.initialValues = initialValues || {};\n if (init) {\n var _this$prevWithoutPres;\n var nextStore = merge(initialValues, _this.store);\n\n // We will take consider prev form unmount fields.\n // When the field is not `preserve`, we need fill this with initialValues instead of store.\n // eslint-disable-next-line array-callback-return\n (_this$prevWithoutPres = _this.prevWithoutPreserves) === null || _this$prevWithoutPres === void 0 || _this$prevWithoutPres.map(function (_ref) {\n var namePath = _ref.key;\n nextStore = setValue(nextStore, namePath, getValue(initialValues, namePath));\n });\n _this.prevWithoutPreserves = null;\n _this.updateStore(nextStore);\n }\n });\n _defineProperty(this, \"destroyForm\", function (clearOnDestroy) {\n if (clearOnDestroy) {\n // destroy form reset store\n _this.updateStore({});\n } else {\n // Fill preserve fields\n var prevWithoutPreserves = new NameMap();\n _this.getFieldEntities(true).forEach(function (entity) {\n if (!_this.isMergedPreserve(entity.isPreserve())) {\n prevWithoutPreserves.set(entity.getNamePath(), true);\n }\n });\n _this.prevWithoutPreserves = prevWithoutPreserves;\n }\n });\n _defineProperty(this, \"getInitialValue\", function (namePath) {\n var initValue = getValue(_this.initialValues, namePath);\n\n // Not cloneDeep when without `namePath`\n return namePath.length ? merge(initValue) : initValue;\n });\n _defineProperty(this, \"setCallbacks\", function (callbacks) {\n _this.callbacks = callbacks;\n });\n _defineProperty(this, \"setValidateMessages\", function (validateMessages) {\n _this.validateMessages = validateMessages;\n });\n _defineProperty(this, \"setPreserve\", function (preserve) {\n _this.preserve = preserve;\n });\n // ============================= Watch ============================\n _defineProperty(this, \"watchList\", []);\n _defineProperty(this, \"registerWatch\", function (callback) {\n _this.watchList.push(callback);\n return function () {\n _this.watchList = _this.watchList.filter(function (fn) {\n return fn !== callback;\n });\n };\n });\n _defineProperty(this, \"notifyWatch\", function () {\n var namePath = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n // No need to cost perf when nothing need to watch\n if (_this.watchList.length) {\n var values = _this.getFieldsValue();\n var allValues = _this.getFieldsValue(true);\n _this.watchList.forEach(function (callback) {\n callback(values, allValues, namePath);\n });\n }\n });\n // ========================== Dev Warning =========================\n _defineProperty(this, \"timeoutId\", null);\n _defineProperty(this, \"warningUnhooked\", function () {\n if (process.env.NODE_ENV !== 'production' && !_this.timeoutId && typeof window !== 'undefined') {\n _this.timeoutId = setTimeout(function () {\n _this.timeoutId = null;\n if (!_this.formHooked) {\n warning(false, 'Instance created by `useForm` is not connected to any Form element. Forget to pass `form` prop?');\n }\n });\n }\n });\n // ============================ Store =============================\n _defineProperty(this, \"updateStore\", function (nextStore) {\n _this.store = nextStore;\n });\n // ============================ Fields ============================\n /**\n * Get registered field entities.\n * @param pure Only return field which has a `name`. Default: false\n */\n _defineProperty(this, \"getFieldEntities\", function () {\n var pure = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n if (!pure) {\n return _this.fieldEntities;\n }\n return _this.fieldEntities.filter(function (field) {\n return field.getNamePath().length;\n });\n });\n _defineProperty(this, \"getFieldsMap\", function () {\n var pure = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n var cache = new NameMap();\n _this.getFieldEntities(pure).forEach(function (field) {\n var namePath = field.getNamePath();\n cache.set(namePath, field);\n });\n return cache;\n });\n _defineProperty(this, \"getFieldEntitiesForNamePathList\", function (nameList) {\n if (!nameList) {\n return _this.getFieldEntities(true);\n }\n var cache = _this.getFieldsMap(true);\n return nameList.map(function (name) {\n var namePath = getNamePath(name);\n return cache.get(namePath) || {\n INVALIDATE_NAME_PATH: getNamePath(name)\n };\n });\n });\n _defineProperty(this, \"getFieldsValue\", function (nameList, filterFunc) {\n _this.warningUnhooked();\n\n // Fill args\n var mergedNameList;\n var mergedFilterFunc;\n var mergedStrict;\n if (nameList === true || Array.isArray(nameList)) {\n mergedNameList = nameList;\n mergedFilterFunc = filterFunc;\n } else if (nameList && _typeof(nameList) === 'object') {\n mergedStrict = nameList.strict;\n mergedFilterFunc = nameList.filter;\n }\n if (mergedNameList === true && !mergedFilterFunc) {\n return _this.store;\n }\n var fieldEntities = _this.getFieldEntitiesForNamePathList(Array.isArray(mergedNameList) ? mergedNameList : null);\n var filteredNameList = [];\n fieldEntities.forEach(function (entity) {\n var _isListField, _ref3;\n var namePath = 'INVALIDATE_NAME_PATH' in entity ? entity.INVALIDATE_NAME_PATH : entity.getNamePath();\n\n // Ignore when it's a list item and not specific the namePath,\n // since parent field is already take in count\n if (mergedStrict) {\n var _isList, _ref2;\n if ((_isList = (_ref2 = entity).isList) !== null && _isList !== void 0 && _isList.call(_ref2)) {\n return;\n }\n } else if (!mergedNameList && (_isListField = (_ref3 = entity).isListField) !== null && _isListField !== void 0 && _isListField.call(_ref3)) {\n return;\n }\n if (!mergedFilterFunc) {\n filteredNameList.push(namePath);\n } else {\n var meta = 'getMeta' in entity ? entity.getMeta() : null;\n if (mergedFilterFunc(meta)) {\n filteredNameList.push(namePath);\n }\n }\n });\n return cloneByNamePathList(_this.store, filteredNameList.map(getNamePath));\n });\n _defineProperty(this, \"getFieldValue\", function (name) {\n _this.warningUnhooked();\n var namePath = getNamePath(name);\n return getValue(_this.store, namePath);\n });\n _defineProperty(this, \"getFieldsError\", function (nameList) {\n _this.warningUnhooked();\n var fieldEntities = _this.getFieldEntitiesForNamePathList(nameList);\n return fieldEntities.map(function (entity, index) {\n if (entity && !('INVALIDATE_NAME_PATH' in entity)) {\n return {\n name: entity.getNamePath(),\n errors: entity.getErrors(),\n warnings: entity.getWarnings()\n };\n }\n return {\n name: getNamePath(nameList[index]),\n errors: [],\n warnings: []\n };\n });\n });\n _defineProperty(this, \"getFieldError\", function (name) {\n _this.warningUnhooked();\n var namePath = getNamePath(name);\n var fieldError = _this.getFieldsError([namePath])[0];\n return fieldError.errors;\n });\n _defineProperty(this, \"getFieldWarning\", function (name) {\n _this.warningUnhooked();\n var namePath = getNamePath(name);\n var fieldError = _this.getFieldsError([namePath])[0];\n return fieldError.warnings;\n });\n _defineProperty(this, \"isFieldsTouched\", function () {\n _this.warningUnhooked();\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n var arg0 = args[0],\n arg1 = args[1];\n var namePathList;\n var isAllFieldsTouched = false;\n if (args.length === 0) {\n namePathList = null;\n } else if (args.length === 1) {\n if (Array.isArray(arg0)) {\n namePathList = arg0.map(getNamePath);\n isAllFieldsTouched = false;\n } else {\n namePathList = null;\n isAllFieldsTouched = arg0;\n }\n } else {\n namePathList = arg0.map(getNamePath);\n isAllFieldsTouched = arg1;\n }\n var fieldEntities = _this.getFieldEntities(true);\n var isFieldTouched = function isFieldTouched(field) {\n return field.isFieldTouched();\n };\n\n // ===== Will get fully compare when not config namePathList =====\n if (!namePathList) {\n return isAllFieldsTouched ? fieldEntities.every(function (entity) {\n return isFieldTouched(entity) || entity.isList();\n }) : fieldEntities.some(isFieldTouched);\n }\n\n // Generate a nest tree for validate\n var map = new NameMap();\n namePathList.forEach(function (shortNamePath) {\n map.set(shortNamePath, []);\n });\n fieldEntities.forEach(function (field) {\n var fieldNamePath = field.getNamePath();\n\n // Find matched entity and put into list\n namePathList.forEach(function (shortNamePath) {\n if (shortNamePath.every(function (nameUnit, i) {\n return fieldNamePath[i] === nameUnit;\n })) {\n map.update(shortNamePath, function (list) {\n return [].concat(_toConsumableArray(list), [field]);\n });\n }\n });\n });\n\n // Check if NameMap value is touched\n var isNamePathListTouched = function isNamePathListTouched(entities) {\n return entities.some(isFieldTouched);\n };\n var namePathListEntities = map.map(function (_ref4) {\n var value = _ref4.value;\n return value;\n });\n return isAllFieldsTouched ? namePathListEntities.every(isNamePathListTouched) : namePathListEntities.some(isNamePathListTouched);\n });\n _defineProperty(this, \"isFieldTouched\", function (name) {\n _this.warningUnhooked();\n return _this.isFieldsTouched([name]);\n });\n _defineProperty(this, \"isFieldsValidating\", function (nameList) {\n _this.warningUnhooked();\n var fieldEntities = _this.getFieldEntities();\n if (!nameList) {\n return fieldEntities.some(function (testField) {\n return testField.isFieldValidating();\n });\n }\n var namePathList = nameList.map(getNamePath);\n return fieldEntities.some(function (testField) {\n var fieldNamePath = testField.getNamePath();\n return containsNamePath(namePathList, fieldNamePath) && testField.isFieldValidating();\n });\n });\n _defineProperty(this, \"isFieldValidating\", function (name) {\n _this.warningUnhooked();\n return _this.isFieldsValidating([name]);\n });\n /**\n * Reset Field with field `initialValue` prop.\n * Can pass `entities` or `namePathList` or just nothing.\n */\n _defineProperty(this, \"resetWithFieldInitialValue\", function () {\n var info = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n // Create cache\n var cache = new NameMap();\n var fieldEntities = _this.getFieldEntities(true);\n fieldEntities.forEach(function (field) {\n var initialValue = field.props.initialValue;\n var namePath = field.getNamePath();\n\n // Record only if has `initialValue`\n if (initialValue !== undefined) {\n var records = cache.get(namePath) || new Set();\n records.add({\n entity: field,\n value: initialValue\n });\n cache.set(namePath, records);\n }\n });\n\n // Reset\n var resetWithFields = function resetWithFields(entities) {\n entities.forEach(function (field) {\n var initialValue = field.props.initialValue;\n if (initialValue !== undefined) {\n var namePath = field.getNamePath();\n var formInitialValue = _this.getInitialValue(namePath);\n if (formInitialValue !== undefined) {\n // Warning if conflict with form initialValues and do not modify value\n warning(false, \"Form already set 'initialValues' with path '\".concat(namePath.join('.'), \"'. Field can not overwrite it.\"));\n } else {\n var records = cache.get(namePath);\n if (records && records.size > 1) {\n // Warning if multiple field set `initialValue`and do not modify value\n warning(false, \"Multiple Field with path '\".concat(namePath.join('.'), \"' set 'initialValue'. Can not decide which one to pick.\"));\n } else if (records) {\n var originValue = _this.getFieldValue(namePath);\n var isListField = field.isListField();\n\n // Set `initialValue`\n if (!isListField && (!info.skipExist || originValue === undefined)) {\n _this.updateStore(setValue(_this.store, namePath, _toConsumableArray(records)[0].value));\n }\n }\n }\n }\n });\n };\n var requiredFieldEntities;\n if (info.entities) {\n requiredFieldEntities = info.entities;\n } else if (info.namePathList) {\n requiredFieldEntities = [];\n info.namePathList.forEach(function (namePath) {\n var records = cache.get(namePath);\n if (records) {\n var _requiredFieldEntitie;\n (_requiredFieldEntitie = requiredFieldEntities).push.apply(_requiredFieldEntitie, _toConsumableArray(_toConsumableArray(records).map(function (r) {\n return r.entity;\n })));\n }\n });\n } else {\n requiredFieldEntities = fieldEntities;\n }\n resetWithFields(requiredFieldEntities);\n });\n _defineProperty(this, \"resetFields\", function (nameList) {\n _this.warningUnhooked();\n var prevStore = _this.store;\n if (!nameList) {\n _this.updateStore(merge(_this.initialValues));\n _this.resetWithFieldInitialValue();\n _this.notifyObservers(prevStore, null, {\n type: 'reset'\n });\n _this.notifyWatch();\n return;\n }\n\n // Reset by `nameList`\n var namePathList = nameList.map(getNamePath);\n namePathList.forEach(function (namePath) {\n var initialValue = _this.getInitialValue(namePath);\n _this.updateStore(setValue(_this.store, namePath, initialValue));\n });\n _this.resetWithFieldInitialValue({\n namePathList: namePathList\n });\n _this.notifyObservers(prevStore, namePathList, {\n type: 'reset'\n });\n _this.notifyWatch(namePathList);\n });\n _defineProperty(this, \"setFields\", function (fields) {\n _this.warningUnhooked();\n var prevStore = _this.store;\n var namePathList = [];\n fields.forEach(function (fieldData) {\n var name = fieldData.name,\n data = _objectWithoutProperties(fieldData, _excluded);\n var namePath = getNamePath(name);\n namePathList.push(namePath);\n\n // Value\n if ('value' in data) {\n _this.updateStore(setValue(_this.store, namePath, data.value));\n }\n _this.notifyObservers(prevStore, [namePath], {\n type: 'setField',\n data: fieldData\n });\n });\n _this.notifyWatch(namePathList);\n });\n _defineProperty(this, \"getFields\", function () {\n var entities = _this.getFieldEntities(true);\n var fields = entities.map(function (field) {\n var namePath = field.getNamePath();\n var meta = field.getMeta();\n var fieldData = _objectSpread(_objectSpread({}, meta), {}, {\n name: namePath,\n value: _this.getFieldValue(namePath)\n });\n Object.defineProperty(fieldData, 'originRCField', {\n value: true\n });\n return fieldData;\n });\n return fields;\n });\n // =========================== Observer ===========================\n /**\n * This only trigger when a field is on constructor to avoid we get initialValue too late\n */\n _defineProperty(this, \"initEntityValue\", function (entity) {\n var initialValue = entity.props.initialValue;\n if (initialValue !== undefined) {\n var namePath = entity.getNamePath();\n var prevValue = getValue(_this.store, namePath);\n if (prevValue === undefined) {\n _this.updateStore(setValue(_this.store, namePath, initialValue));\n }\n }\n });\n _defineProperty(this, \"isMergedPreserve\", function (fieldPreserve) {\n var mergedPreserve = fieldPreserve !== undefined ? fieldPreserve : _this.preserve;\n return mergedPreserve !== null && mergedPreserve !== void 0 ? mergedPreserve : true;\n });\n _defineProperty(this, \"registerField\", function (entity) {\n _this.fieldEntities.push(entity);\n var namePath = entity.getNamePath();\n _this.notifyWatch([namePath]);\n\n // Set initial values\n if (entity.props.initialValue !== undefined) {\n var prevStore = _this.store;\n _this.resetWithFieldInitialValue({\n entities: [entity],\n skipExist: true\n });\n _this.notifyObservers(prevStore, [entity.getNamePath()], {\n type: 'valueUpdate',\n source: 'internal'\n });\n }\n\n // un-register field callback\n return function (isListField, preserve) {\n var subNamePath = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];\n _this.fieldEntities = _this.fieldEntities.filter(function (item) {\n return item !== entity;\n });\n\n // Clean up store value if not preserve\n if (!_this.isMergedPreserve(preserve) && (!isListField || subNamePath.length > 1)) {\n var defaultValue = isListField ? undefined : _this.getInitialValue(namePath);\n if (namePath.length && _this.getFieldValue(namePath) !== defaultValue && _this.fieldEntities.every(function (field) {\n return (\n // Only reset when no namePath exist\n !matchNamePath(field.getNamePath(), namePath)\n );\n })) {\n var _prevStore = _this.store;\n _this.updateStore(setValue(_prevStore, namePath, defaultValue, true));\n\n // Notify that field is unmount\n _this.notifyObservers(_prevStore, [namePath], {\n type: 'remove'\n });\n\n // Dependencies update\n _this.triggerDependenciesUpdate(_prevStore, namePath);\n }\n }\n _this.notifyWatch([namePath]);\n };\n });\n _defineProperty(this, \"dispatch\", function (action) {\n switch (action.type) {\n case 'updateValue':\n {\n var namePath = action.namePath,\n value = action.value;\n _this.updateValue(namePath, value);\n break;\n }\n case 'validateField':\n {\n var _namePath = action.namePath,\n triggerName = action.triggerName;\n _this.validateFields([_namePath], {\n triggerName: triggerName\n });\n break;\n }\n default:\n // Currently we don't have other action. Do nothing.\n }\n });\n _defineProperty(this, \"notifyObservers\", function (prevStore, namePathList, info) {\n if (_this.subscribable) {\n var mergedInfo = _objectSpread(_objectSpread({}, info), {}, {\n store: _this.getFieldsValue(true)\n });\n _this.getFieldEntities().forEach(function (_ref5) {\n var onStoreChange = _ref5.onStoreChange;\n onStoreChange(prevStore, namePathList, mergedInfo);\n });\n } else {\n _this.forceRootUpdate();\n }\n });\n /**\n * Notify dependencies children with parent update\n * We need delay to trigger validate in case Field is under render props\n */\n _defineProperty(this, \"triggerDependenciesUpdate\", function (prevStore, namePath) {\n var childrenFields = _this.getDependencyChildrenFields(namePath);\n if (childrenFields.length) {\n _this.validateFields(childrenFields);\n }\n _this.notifyObservers(prevStore, childrenFields, {\n type: 'dependenciesUpdate',\n relatedFields: [namePath].concat(_toConsumableArray(childrenFields))\n });\n return childrenFields;\n });\n _defineProperty(this, \"updateValue\", function (name, value) {\n var namePath = getNamePath(name);\n var prevStore = _this.store;\n _this.updateStore(setValue(_this.store, namePath, value));\n _this.notifyObservers(prevStore, [namePath], {\n type: 'valueUpdate',\n source: 'internal'\n });\n _this.notifyWatch([namePath]);\n\n // Dependencies update\n var childrenFields = _this.triggerDependenciesUpdate(prevStore, namePath);\n\n // trigger callback function\n var onValuesChange = _this.callbacks.onValuesChange;\n if (onValuesChange) {\n var changedValues = cloneByNamePathList(_this.store, [namePath]);\n onValuesChange(changedValues, _this.getFieldsValue());\n }\n _this.triggerOnFieldsChange([namePath].concat(_toConsumableArray(childrenFields)));\n });\n // Let all child Field get update.\n _defineProperty(this, \"setFieldsValue\", function (store) {\n _this.warningUnhooked();\n var prevStore = _this.store;\n if (store) {\n var nextStore = merge(_this.store, store);\n _this.updateStore(nextStore);\n }\n _this.notifyObservers(prevStore, null, {\n type: 'valueUpdate',\n source: 'external'\n });\n _this.notifyWatch();\n });\n _defineProperty(this, \"setFieldValue\", function (name, value) {\n _this.setFields([{\n name: name,\n value: value\n }]);\n });\n _defineProperty(this, \"getDependencyChildrenFields\", function (rootNamePath) {\n var children = new Set();\n var childrenFields = [];\n var dependencies2fields = new NameMap();\n\n /**\n * Generate maps\n * Can use cache to save perf if user report performance issue with this\n */\n _this.getFieldEntities().forEach(function (field) {\n var dependencies = field.props.dependencies;\n (dependencies || []).forEach(function (dependency) {\n var dependencyNamePath = getNamePath(dependency);\n dependencies2fields.update(dependencyNamePath, function () {\n var fields = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Set();\n fields.add(field);\n return fields;\n });\n });\n });\n var fillChildren = function fillChildren(namePath) {\n var fields = dependencies2fields.get(namePath) || new Set();\n fields.forEach(function (field) {\n if (!children.has(field)) {\n children.add(field);\n var fieldNamePath = field.getNamePath();\n if (field.isFieldDirty() && fieldNamePath.length) {\n childrenFields.push(fieldNamePath);\n fillChildren(fieldNamePath);\n }\n }\n });\n };\n fillChildren(rootNamePath);\n return childrenFields;\n });\n _defineProperty(this, \"triggerOnFieldsChange\", function (namePathList, filedErrors) {\n var onFieldsChange = _this.callbacks.onFieldsChange;\n if (onFieldsChange) {\n var fields = _this.getFields();\n\n /**\n * Fill errors since `fields` may be replaced by controlled fields\n */\n if (filedErrors) {\n var cache = new NameMap();\n filedErrors.forEach(function (_ref6) {\n var name = _ref6.name,\n errors = _ref6.errors;\n cache.set(name, errors);\n });\n fields.forEach(function (field) {\n // eslint-disable-next-line no-param-reassign\n field.errors = cache.get(field.name) || field.errors;\n });\n }\n var changedFields = fields.filter(function (_ref7) {\n var fieldName = _ref7.name;\n return containsNamePath(namePathList, fieldName);\n });\n if (changedFields.length) {\n onFieldsChange(changedFields, fields);\n }\n }\n });\n // =========================== Validate ===========================\n _defineProperty(this, \"validateFields\", function (arg1, arg2) {\n _this.warningUnhooked();\n var nameList;\n var options;\n if (Array.isArray(arg1) || typeof arg1 === 'string' || typeof arg2 === 'string') {\n nameList = arg1;\n options = arg2;\n } else {\n options = arg1;\n }\n var provideNameList = !!nameList;\n var namePathList = provideNameList ? nameList.map(getNamePath) : [];\n\n // Collect result in promise list\n var promiseList = [];\n\n // We temp save the path which need trigger for `onFieldsChange`\n var TMP_SPLIT = String(Date.now());\n var validateNamePathList = new Set();\n var _ref8 = options || {},\n recursive = _ref8.recursive,\n dirty = _ref8.dirty;\n _this.getFieldEntities(true).forEach(function (field) {\n // Add field if not provide `nameList`\n if (!provideNameList) {\n namePathList.push(field.getNamePath());\n }\n\n // Skip if without rule\n if (!field.props.rules || !field.props.rules.length) {\n return;\n }\n\n // Skip if only validate dirty field\n if (dirty && !field.isFieldDirty()) {\n return;\n }\n var fieldNamePath = field.getNamePath();\n validateNamePathList.add(fieldNamePath.join(TMP_SPLIT));\n\n // Add field validate rule in to promise list\n if (!provideNameList || containsNamePath(namePathList, fieldNamePath, recursive)) {\n var promise = field.validateRules(_objectSpread({\n validateMessages: _objectSpread(_objectSpread({}, defaultValidateMessages), _this.validateMessages)\n }, options));\n\n // Wrap promise with field\n promiseList.push(promise.then(function () {\n return {\n name: fieldNamePath,\n errors: [],\n warnings: []\n };\n }).catch(function (ruleErrors) {\n var _ruleErrors$forEach;\n var mergedErrors = [];\n var mergedWarnings = [];\n (_ruleErrors$forEach = ruleErrors.forEach) === null || _ruleErrors$forEach === void 0 || _ruleErrors$forEach.call(ruleErrors, function (_ref9) {\n var warningOnly = _ref9.rule.warningOnly,\n errors = _ref9.errors;\n if (warningOnly) {\n mergedWarnings.push.apply(mergedWarnings, _toConsumableArray(errors));\n } else {\n mergedErrors.push.apply(mergedErrors, _toConsumableArray(errors));\n }\n });\n if (mergedErrors.length) {\n return Promise.reject({\n name: fieldNamePath,\n errors: mergedErrors,\n warnings: mergedWarnings\n });\n }\n return {\n name: fieldNamePath,\n errors: mergedErrors,\n warnings: mergedWarnings\n };\n }));\n }\n });\n var summaryPromise = allPromiseFinish(promiseList);\n _this.lastValidatePromise = summaryPromise;\n\n // Notify fields with rule that validate has finished and need update\n summaryPromise.catch(function (results) {\n return results;\n }).then(function (results) {\n var resultNamePathList = results.map(function (_ref10) {\n var name = _ref10.name;\n return name;\n });\n _this.notifyObservers(_this.store, resultNamePathList, {\n type: 'validateFinish'\n });\n _this.triggerOnFieldsChange(resultNamePathList, results);\n });\n var returnPromise = summaryPromise.then(function () {\n if (_this.lastValidatePromise === summaryPromise) {\n return Promise.resolve(_this.getFieldsValue(namePathList));\n }\n return Promise.reject([]);\n }).catch(function (results) {\n var errorList = results.filter(function (result) {\n return result && result.errors.length;\n });\n return Promise.reject({\n values: _this.getFieldsValue(namePathList),\n errorFields: errorList,\n outOfDate: _this.lastValidatePromise !== summaryPromise\n });\n });\n\n // Do not throw in console\n returnPromise.catch(function (e) {\n return e;\n });\n\n // `validating` changed. Trigger `onFieldsChange`\n var triggerNamePathList = namePathList.filter(function (namePath) {\n return validateNamePathList.has(namePath.join(TMP_SPLIT));\n });\n _this.triggerOnFieldsChange(triggerNamePathList);\n return returnPromise;\n });\n // ============================ Submit ============================\n _defineProperty(this, \"submit\", function () {\n _this.warningUnhooked();\n _this.validateFields().then(function (values) {\n var onFinish = _this.callbacks.onFinish;\n if (onFinish) {\n try {\n onFinish(values);\n } catch (err) {\n // Should print error if user `onFinish` callback failed\n console.error(err);\n }\n }\n }).catch(function (e) {\n var onFinishFailed = _this.callbacks.onFinishFailed;\n if (onFinishFailed) {\n onFinishFailed(e);\n }\n });\n });\n this.forceRootUpdate = forceRootUpdate;\n});\nfunction useForm(form) {\n var formRef = React.useRef();\n var _React$useState = React.useState({}),\n _React$useState2 = _slicedToArray(_React$useState, 2),\n forceUpdate = _React$useState2[1];\n if (!formRef.current) {\n if (form) {\n formRef.current = form;\n } else {\n // Create a new FormStore if not provided\n var forceReRender = function forceReRender() {\n forceUpdate({});\n };\n var formStore = new FormStore(forceReRender);\n formRef.current = formStore.getForm();\n }\n }\n return [formRef.current];\n}\nexport default useForm;"],"mappings":"AAAA,OAAOA,cAAc,MAAM,0CAA0C;AACrE,OAAOC,aAAa,MAAM,0CAA0C;AACpE,OAAOC,wBAAwB,MAAM,oDAAoD;AACzF,OAAOC,kBAAkB,MAAM,8CAA8C;AAC7E,OAAOC,OAAO,MAAM,mCAAmC;AACvD,OAAOC,YAAY,MAAM,wCAAwC;AACjE,OAAOC,eAAe,MAAM,2CAA2C;AACvE,OAAOC,eAAe,MAAM,2CAA2C;AACvE,IAAIC,SAAS,GAAG,CAAC,MAAM,CAAC;AACxB,SAASC,KAAK,QAAQ,sBAAsB;AAC5C,OAAOC,OAAO,MAAM,oBAAoB;AACxC,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,SAASC,SAAS,QAAQ,gBAAgB;AAC1C,SAASC,gBAAgB,QAAQ,mBAAmB;AACpD,SAASC,uBA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