{"version":3,"file":"useFormValidation-De8KVI0n.js","sources":["../../Client/node_modules/@react-aria/utils/dist/useFormReset.mjs","../../Client/node_modules/@react-aria/form/dist/useFormValidation.mjs"],"sourcesContent":["import {useEffectEvent as $8ae05eaa5c114e9c$export$7f54fc3180508a52} from \"./useEffectEvent.mjs\";\nimport {useRef as $8rM3G$useRef, useEffect as $8rM3G$useEffect} from \"react\";\n\n/*\n * Copyright 2023 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */ \n\nfunction $99facab73266f662$export$5add1d006293d136(ref, initialValue, onReset) {\n let resetValue = (0, $8rM3G$useRef)(initialValue);\n let handleReset = (0, $8ae05eaa5c114e9c$export$7f54fc3180508a52)(()=>{\n if (onReset) onReset(resetValue.current);\n });\n (0, $8rM3G$useEffect)(()=>{\n var _ref_current;\n let form = ref === null || ref === void 0 ? void 0 : (_ref_current = ref.current) === null || _ref_current === void 0 ? void 0 : _ref_current.form;\n form === null || form === void 0 ? void 0 : form.addEventListener('reset', handleReset);\n return ()=>{\n form === null || form === void 0 ? void 0 : form.removeEventListener('reset', handleReset);\n };\n }, [\n ref,\n handleReset\n ]);\n}\n\n\nexport {$99facab73266f662$export$5add1d006293d136 as useFormReset};\n//# sourceMappingURL=useFormReset.module.js.map\n","import {setInteractionModality as $9Gacy$setInteractionModality} from \"@react-aria/interactions\";\nimport {useEffect as $9Gacy$useEffect} from \"react\";\nimport {useLayoutEffect as $9Gacy$useLayoutEffect, useEffectEvent as $9Gacy$useEffectEvent} from \"@react-aria/utils\";\n\n/*\n * Copyright 2023 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */ \n\n\nfunction $e93e671b31057976$export$b8473d3665f3a75a(props, state, ref) {\n let { validationBehavior: validationBehavior, focus: focus } = props;\n // This is a useLayoutEffect so that it runs before the useEffect in useFormValidationState, which commits the validation change.\n (0, $9Gacy$useLayoutEffect)(()=>{\n if (validationBehavior === 'native' && (ref === null || ref === void 0 ? void 0 : ref.current)) {\n let errorMessage = state.realtimeValidation.isInvalid ? state.realtimeValidation.validationErrors.join(' ') || 'Invalid value.' : '';\n ref.current.setCustomValidity(errorMessage);\n // Prevent default tooltip for validation message.\n // https://bugzilla.mozilla.org/show_bug.cgi?id=605277\n if (!ref.current.hasAttribute('title')) ref.current.title = '';\n if (!state.realtimeValidation.isInvalid) state.updateValidation($e93e671b31057976$var$getNativeValidity(ref.current));\n }\n });\n let onReset = (0, $9Gacy$useEffectEvent)(()=>{\n state.resetValidation();\n });\n let onInvalid = (0, $9Gacy$useEffectEvent)((e)=>{\n var _ref_current;\n // Only commit validation if we are not already displaying one.\n // This avoids clearing server errors that the user didn't actually fix.\n if (!state.displayValidation.isInvalid) state.commitValidation();\n // Auto focus the first invalid input in a form, unless the error already had its default prevented.\n let form = ref === null || ref === void 0 ? void 0 : (_ref_current = ref.current) === null || _ref_current === void 0 ? void 0 : _ref_current.form;\n if (!e.defaultPrevented && ref && form && $e93e671b31057976$var$getFirstInvalidInput(form) === ref.current) {\n var _ref_current1;\n if (focus) focus();\n else (_ref_current1 = ref.current) === null || _ref_current1 === void 0 ? void 0 : _ref_current1.focus();\n // Always show focus ring.\n (0, $9Gacy$setInteractionModality)('keyboard');\n }\n // Prevent default browser error UI from appearing.\n e.preventDefault();\n });\n let onChange = (0, $9Gacy$useEffectEvent)(()=>{\n state.commitValidation();\n });\n (0, $9Gacy$useEffect)(()=>{\n let input = ref === null || ref === void 0 ? void 0 : ref.current;\n if (!input) return;\n let form = input.form;\n input.addEventListener('invalid', onInvalid);\n input.addEventListener('change', onChange);\n form === null || form === void 0 ? void 0 : form.addEventListener('reset', onReset);\n return ()=>{\n input.removeEventListener('invalid', onInvalid);\n input.removeEventListener('change', onChange);\n form === null || form === void 0 ? void 0 : form.removeEventListener('reset', onReset);\n };\n }, [\n ref,\n onInvalid,\n onChange,\n onReset,\n validationBehavior\n ]);\n}\nfunction $e93e671b31057976$var$getValidity(input) {\n // The native ValidityState object is live, meaning each property is a getter that returns the current state.\n // We need to create a snapshot of the validity state at the time this function is called to avoid unpredictable React renders.\n let validity = input.validity;\n return {\n badInput: validity.badInput,\n customError: validity.customError,\n patternMismatch: validity.patternMismatch,\n rangeOverflow: validity.rangeOverflow,\n rangeUnderflow: validity.rangeUnderflow,\n stepMismatch: validity.stepMismatch,\n tooLong: validity.tooLong,\n tooShort: validity.tooShort,\n typeMismatch: validity.typeMismatch,\n valueMissing: validity.valueMissing,\n valid: validity.valid\n };\n}\nfunction $e93e671b31057976$var$getNativeValidity(input) {\n return {\n isInvalid: !input.validity.valid,\n validationDetails: $e93e671b31057976$var$getValidity(input),\n validationErrors: input.validationMessage ? [\n input.validationMessage\n ] : []\n };\n}\nfunction $e93e671b31057976$var$getFirstInvalidInput(form) {\n for(let i = 0; i < form.elements.length; i++){\n let element = form.elements[i];\n if (!element.validity.valid) return element;\n }\n return null;\n}\n\n\nexport {$e93e671b31057976$export$b8473d3665f3a75a as useFormValidation};\n//# sourceMappingURL=useFormValidation.module.js.map\n"],"names":["$99facab73266f662$export$5add1d006293d136","ref","initialValue","onReset","resetValue","$8rM3G$useRef","handleReset","$8ae05eaa5c114e9c$export$7f54fc3180508a52","$8rM3G$useEffect","_ref_current","form","$e93e671b31057976$export$b8473d3665f3a75a","props","state","validationBehavior","focus","$9Gacy$useLayoutEffect","errorMessage","$e93e671b31057976$var$getNativeValidity","$9Gacy$useEffectEvent","onInvalid","e","$e93e671b31057976$var$getFirstInvalidInput","_ref_current1","$9Gacy$setInteractionModality","onChange","$9Gacy$useEffect","input","$e93e671b31057976$var$getValidity","validity","i","element"],"mappings":"8FAeA,SAASA,EAA0CC,EAAKC,EAAcC,EAAS,CAC3E,IAAIC,EAAiBC,EAAa,OAAEH,CAAY,EAC5CI,EAAkBC,EAA2C,IAAI,CAC7DJ,GAASA,EAAQC,EAAW,OAAO,CAC/C,CAAK,EACGI,EAAgB,UAAE,IAAI,CACtB,IAAIC,EACJ,IAAIC,EAAOT,GAAQ,OAAmCQ,EAAeR,EAAI,WAAa,MAAQQ,IAAiB,OAAnE,OAAqFA,EAAa,KAC9I,OAAAC,GAAS,MAAmCA,EAAK,iBAAiB,QAASJ,CAAW,EAC/E,IAAI,CACPI,GAAS,MAAmCA,EAAK,oBAAoB,QAASJ,CAAW,CAC5F,CACT,EAAO,CACCL,EACAK,CACR,CAAK,CACL,CCdA,SAASK,EAA0CC,EAAOC,EAAOZ,EAAK,CAClE,GAAI,CAAE,mBAAoBa,EAAoB,MAAOC,CAAO,EAAGH,EAE3DI,EAAwB,IAAI,CAC5B,GAAIF,IAAuB,WAAab,GAAQ,MAAkCA,EAAI,SAAU,CAC5F,IAAIgB,EAAeJ,EAAM,mBAAmB,UAAYA,EAAM,mBAAmB,iBAAiB,KAAK,GAAG,GAAK,iBAAmB,GAClIZ,EAAI,QAAQ,kBAAkBgB,CAAY,EAGrChB,EAAI,QAAQ,aAAa,OAAO,IAAGA,EAAI,QAAQ,MAAQ,IACvDY,EAAM,mBAAmB,WAAWA,EAAM,iBAAiBK,EAAwCjB,EAAI,OAAO,CAAC,CAChI,CACA,CAAK,EACD,IAAIE,EAAcgB,EAAuB,IAAI,CACzCN,EAAM,gBAAiB,CAC/B,CAAK,EACGO,EAAgBD,EAAwBE,GAAI,CAC5C,IAAIZ,EAGC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