@invoice-sdk/widget 1.6.6 → 1.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/App.d.ts.map +1 -1
- package/dist/components/layout.d.ts +2 -1
- package/dist/components/layout.d.ts.map +1 -1
- package/dist/index.cjs.js +5 -5
- package/dist/index.es.js +1357 -1357
- package/dist/pages/register.d.ts.map +1 -1
- package/dist/pages/select-plan.d.ts.map +1 -1
- package/dist/pages/select-provider.d.ts.map +1 -1
- package/dist/widget.css +1 -1
- package/package.json +3 -3
package/dist/App.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../src/App.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../src/App.tsx"],"names":[],"mappings":"AAAA,OAAO,WAAW,CAAC;AAQnB,iBAAS,qBAAqB,4CAgB7B;AAED,eAAe,qBAAqB,CAAA"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { PropsWithChildren } from "react";
|
|
2
|
+
declare const MainLayout: ({ children }: PropsWithChildren) => import("react/jsx-runtime").JSX.Element;
|
|
2
3
|
export default MainLayout;
|
|
3
4
|
//# sourceMappingURL=layout.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../src/components/layout.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../src/components/layout.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAIzC,QAAA,MAAM,UAAU,GAAI,cAAa,iBAAiB,4CAOjD,CAAA;AAED,eAAe,UAAU,CAAA"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const O=require("react");function hs(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const s=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,s.get?s:{enumerable:!0,get:()=>t[r]})}}return e.default=t,Object.freeze(e)}const pr=hs(O);var Rt={exports:{}},ct={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var
|
|
9
|
+
*/var yr;function ms(){if(yr)return ct;yr=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function r(s,n,a){var i=null;if(a!==void 0&&(i=""+a),n.key!==void 0&&(i=""+n.key),"key"in n){a={};for(var o in n)o!=="key"&&(a[o]=n[o])}else a=n;return n=a.ref,{$$typeof:t,type:s,key:i,ref:n!==void 0?n:null,props:a}}return ct.Fragment=e,ct.jsx=r,ct.jsxs=r,ct}var lt={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var
|
|
17
|
+
*/var gr;function ps(){return gr||(gr=1,process.env.NODE_ENV!=="production"&&function(){function t(m){if(m==null)return null;if(typeof m=="function")return m.$$typeof===je?null:m.displayName||m.name||null;if(typeof m=="string")return m;switch(m){case Z:return"Fragment";case pe:return"Profiler";case z:return"StrictMode";case q:return"Suspense";case Xe:return"SuspenseList";case le:return"Activity"}if(typeof m=="object")switch(typeof m.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),m.$$typeof){case te:return"Portal";case ce:return(m.displayName||"Context")+".Provider";case R:return(m._context.displayName||"Context")+".Consumer";case re:var C=m.render;return m=m.displayName,m||(m=C.displayName||C.name||"",m=m!==""?"ForwardRef("+m+")":"ForwardRef"),m;case xe:return C=m.displayName||null,C!==null?C:t(m.type)||"Memo";case Qe:C=m._payload,m=m._init;try{return t(m(C))}catch{}}return null}function e(m){return""+m}function r(m){try{e(m);var C=!1}catch{C=!0}if(C){C=console;var U=C.error,H=typeof Symbol=="function"&&Symbol.toStringTag&&m[Symbol.toStringTag]||m.constructor.name||"Object";return U.call(C,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",H),e(m)}}function s(m){if(m===Z)return"<>";if(typeof m=="object"&&m!==null&&m.$$typeof===Qe)return"<...>";try{var C=t(m);return C?"<"+C+">":"<...>"}catch{return"<...>"}}function n(){var m=ie.A;return m===null?null:m.getOwner()}function a(){return Error("react-stack-top-frame")}function i(m){if(F.call(m,"key")){var C=Object.getOwnPropertyDescriptor(m,"key").get;if(C&&C.isReactWarning)return!1}return m.key!==void 0}function o(m,C){function U(){Q||(Q=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",C))}U.isReactWarning=!0,Object.defineProperty(m,"key",{get:U,configurable:!0})}function d(){var m=t(this.type);return K[m]||(K[m]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),m=this.props.ref,m!==void 0?m:null}function h(m,C,U,H,ke,de,ot,Be){return U=de.ref,m={$$typeof:W,type:m,key:C,props:de,_owner:ke},(U!==void 0?U:null)!==null?Object.defineProperty(m,"ref",{enumerable:!1,get:d}):Object.defineProperty(m,"ref",{enumerable:!1,value:null}),m._store={},Object.defineProperty(m._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(m,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(m,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:ot}),Object.defineProperty(m,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:Be}),Object.freeze&&(Object.freeze(m.props),Object.freeze(m)),m}function f(m,C,U,H,ke,de,ot,Be){var G=C.children;if(G!==void 0)if(H)if(I(G)){for(H=0;H<G.length;H++)x(G[H]);Object.freeze&&Object.freeze(G)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else x(G);if(F.call(C,"key")){G=t(m);var we=Object.keys(C).filter(function(qt){return qt!=="key"});H=0<we.length?"{key: someKey, "+we.join(": ..., ")+": ...}":"{key: someKey}",Ne[G+H]||(we=0<we.length?"{"+we.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
18
18
|
let props = %s;
|
|
19
19
|
<%s {...props} />
|
|
20
20
|
React keys must be passed directly to JSX without using spread:
|
|
21
21
|
let props = %s;
|
|
22
|
-
<%s key={someKey} {...props} />`,H,G,Se,G),Ce[G+H]=!0)}if(G=null,U!==void 0&&(r(U),G=""+U),i(C)&&(r(C.key),G=""+C.key),"key"in C){U={};for(var Ke in C)Ke!=="key"&&(U[Ke]=C[Ke])}else U=C;return G&&o(U,typeof h=="function"?h.displayName||h.name||"Unknown":h),f(h,G,fe,we,n(),U,ot,We)}function y(h){typeof h=="object"&&h!==null&&h.$$typeof===W&&h._store&&(h._store.validated=1)}var v=V,W=Symbol.for("react.transitional.element"),te=Symbol.for("react.portal"),Z=Symbol.for("react.fragment"),B=Symbol.for("react.strict_mode"),ye=Symbol.for("react.profiler"),R=Symbol.for("react.consumer"),le=Symbol.for("react.context"),re=Symbol.for("react.forward_ref"),q=Symbol.for("react.suspense"),Xe=Symbol.for("react.suspense_list"),ke=Symbol.for("react.memo"),Qe=Symbol.for("react.lazy"),ue=Symbol.for("react.activity"),Ee=Symbol.for("react.client.reference"),oe=v.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=Object.prototype.hasOwnProperty,I=Array.isArray,$=console.createTask?console.createTask:function(){return null};v={"react-stack-bottom-frame":function(h){return h()}};var Q,K={},de=v["react-stack-bottom-frame"].bind(v,a)(),Ie=$(s(a)),Ce={};lt.Fragment=Z,lt.jsx=function(h,C,U,H,we){var fe=1e4>oe.recentlyCreatedOwnerStacks++;return _(h,C,U,!1,H,we,fe?Error("react-stack-top-frame"):de,fe?$(s(h)):Ie)},lt.jsxs=function(h,C,U,H,we){var fe=1e4>oe.recentlyCreatedOwnerStacks++;return _(h,C,U,!0,H,we,fe?Error("react-stack-top-frame"):de,fe?$(s(h)):Ie)}}()),lt}var _r;function gs(){return _r||(_r=1,process.env.NODE_ENV==="production"?Ot.exports=ps():Ot.exports=ys()),Ot.exports}var p=gs();const br=t=>{let e;const r=new Set,s=(f,_)=>{const y=typeof f=="function"?f(e):f;if(!Object.is(y,e)){const v=e;e=_??(typeof y!="object"||y===null)?y:Object.assign({},e,y),r.forEach(W=>W(e,v))}},n=()=>e,o={setState:s,getState:n,getInitialState:()=>d,subscribe:f=>(r.add(f),()=>r.delete(f))},d=e=t(s,n,o);return o},vs=t=>t?br(t):br,_s=t=>t;function bs(t,e=_s){const r=V.useSyncExternalStore(t.subscribe,()=>e(t.getState()),()=>e(t.getInitialState()));return V.useDebugValue(r),r}const xr=t=>{const e=vs(t),r=s=>bs(e,s);return Object.assign(r,e),r},Mr=t=>t?xr(t):xr,mt=Mr(t=>({step:1,nextStep:()=>t(e=>({step:e.step+1})),prevStep:()=>t(e=>({step:Math.max(e.step-1,1)})),reset:()=>t({step:1})})),xs=4,ks=()=>{const{step:t}=mt();return p.jsx("div",{className:"w-full relative h-3 bg-gray-200 rounded-full",children:p.jsx("div",{className:"absolute rounded-full bg-green-500",style:{width:`${t/xs*100}%`,height:"100%",transition:"width 0.3s ease-in-out"}})})},ws=()=>p.jsxs("div",{className:"max-w-[800px] mx-auto py-10 flex flex-col gap-8",children:[p.jsx(ks,{}),p.jsx(ce.Outlet,{})]});var Et=t=>t.type==="checkbox",qe=t=>t instanceof Date,ae=t=>t==null;const Zr=t=>typeof t=="object";var J=t=>!ae(t)&&!Array.isArray(t)&&Zr(t)&&!qe(t),Lr=t=>J(t)&&t.target?Et(t.target)?t.target.checked:t.target.value:t,Ss=t=>t.substring(0,t.search(/\.\d+(\.|$)/))||t,$r=(t,e)=>t.has(Ss(e)),Ts=t=>{const e=t.constructor&&t.constructor.prototype;return J(e)&&e.hasOwnProperty("isPrototypeOf")},sr=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function ee(t){let e;const r=Array.isArray(t),s=typeof FileList<"u"?t instanceof FileList:!1;if(t instanceof Date)e=new Date(t);else if(t instanceof Set)e=new Set(t);else if(!(sr&&(t instanceof Blob||s))&&(r||J(t)))if(e=r?[]:{},!r&&!Ts(t))e=t;else for(const n in t)t.hasOwnProperty(n)&&(e[n]=ee(t[n]));else return t;return e}var Wt=t=>Array.isArray(t)?t.filter(Boolean):[],Y=t=>t===void 0,x=(t,e,r)=>{if(!e||!J(t))return r;const s=Wt(e.split(/[,[\].]+?/)).reduce((n,a)=>ae(n)?n:n[a],t);return Y(s)||s===t?Y(t[e])?r:t[e]:s},he=t=>typeof t=="boolean",nr=t=>/^\w*$/.test(t),Ur=t=>Wt(t.replace(/["|']|\]/g,"").split(/\.|\[/)),D=(t,e,r)=>{let s=-1;const n=nr(e)?[e]:Ur(e),a=n.length,i=a-1;for(;++s<a;){const o=n[s];let d=r;if(s!==i){const f=t[o];d=J(f)||Array.isArray(f)?f:isNaN(+n[s+1])?{}:[]}if(o==="__proto__"||o==="constructor"||o==="prototype")return;t[o]=d,t=t[o]}};const Ft={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},ge={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Re={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},js=V.createContext(null),ar=()=>V.useContext(js);var zr=(t,e,r,s=!0)=>{const n={defaultValues:e._defaultValues};for(const a in t)Object.defineProperty(n,a,{get:()=>{const i=a;return e._proxyFormState[i]!==ge.all&&(e._proxyFormState[i]=!s||ge.all),r&&(r[i]=!0),t[i]}});return n};const ir=typeof window<"u"?yr.useLayoutEffect:yr.useEffect;function As(t){const e=ar(),{control:r=e.control,disabled:s,name:n,exact:a}=t||{},[i,o]=V.useState(r._formState),d=V.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return ir(()=>r._subscribe({name:n,formState:d.current,exact:a,callback:f=>{!s&&o({...r._formState,...f})}}),[n,s,a]),V.useEffect(()=>{d.current.isValid&&r._setValid(!0)},[r]),V.useMemo(()=>zr(i,r,d.current,!1),[i,r])}var Te=t=>typeof t=="string",Br=(t,e,r,s,n)=>Te(t)?(s&&e.watch.add(t),x(r,t,n)):Array.isArray(t)?t.map(a=>(s&&e.watch.add(a),x(r,a))):(s&&(e.watchAll=!0),r);function Ns(t){const e=ar(),{control:r=e.control,name:s,defaultValue:n,disabled:a,exact:i}=t||{},o=V.useRef(n),[d,f]=V.useState(r._getWatch(s,o.current));return ir(()=>r._subscribe({name:s,formState:{values:!0},exact:i,callback:_=>!a&&f(Br(s,r._names,_.values||r._formValues,!1,o.current))}),[s,r,a,i]),V.useEffect(()=>r._removeUnmounted()),d}function Es(t){const e=ar(),{name:r,disabled:s,control:n=e.control,shouldUnregister:a}=t,i=$r(n._names.array,r),o=Ns({control:n,name:r,defaultValue:x(n._formValues,r,x(n._defaultValues,r,t.defaultValue)),exact:!0}),d=As({control:n,name:r,exact:!0}),f=V.useRef(t),_=V.useRef(n.register(r,{...t.rules,value:o,...he(t.disabled)?{disabled:t.disabled}:{}})),y=V.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!x(d.errors,r)},isDirty:{enumerable:!0,get:()=>!!x(d.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!x(d.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!x(d.validatingFields,r)},error:{enumerable:!0,get:()=>x(d.errors,r)}}),[d,r]),v=V.useCallback(B=>_.current.onChange({target:{value:Lr(B),name:r},type:Ft.CHANGE}),[r]),W=V.useCallback(()=>_.current.onBlur({target:{value:x(n._formValues,r),name:r},type:Ft.BLUR}),[r,n._formValues]),te=V.useCallback(B=>{const ye=x(n._fields,r);ye&&B&&(ye._f.ref={focus:()=>B.focus(),select:()=>B.select(),setCustomValidity:R=>B.setCustomValidity(R),reportValidity:()=>B.reportValidity()})},[n._fields,r]),Z=V.useMemo(()=>({name:r,value:o,...he(s)||d.disabled?{disabled:d.disabled||s}:{},onChange:v,onBlur:W,ref:te}),[r,s,d.disabled,v,W,te,o]);return V.useEffect(()=>{const B=n._options.shouldUnregister||a;n.register(r,{...f.current.rules,...he(f.current.disabled)?{disabled:f.current.disabled}:{}});const ye=(R,le)=>{const re=x(n._fields,R);re&&re._f&&(re._f.mount=le)};if(ye(r,!0),B){const R=ee(x(n._options.defaultValues,r));D(n._defaultValues,r,R),Y(x(n._formValues,r))&&D(n._formValues,r,R)}return!i&&n.register(r),()=>{(i?B&&!n._state.action:B)?n.unregister(r):ye(r,!1)}},[r,n,i,a]),V.useEffect(()=>{n._setDisabledField({disabled:s,name:r})},[s,r,n]),V.useMemo(()=>({field:Z,formState:d,fieldState:y}),[Z,d,y])}const Me=t=>t.render(Es(t));var Wr=(t,e,r,s,n)=>e?{...r[t],types:{...r[t]&&r[t].types?r[t].types:{},[s]:n||!0}}:{},ft=t=>Array.isArray(t)?t:[t],kr=()=>{let t=[];return{get observers(){return t},next:n=>{for(const a of t)a.next&&a.next(n)},subscribe:n=>(t.push(n),{unsubscribe:()=>{t=t.filter(a=>a!==n)}}),unsubscribe:()=>{t=[]}}},Qt=t=>ae(t)||!Zr(t);function Le(t,e){if(Qt(t)||Qt(e))return t===e;if(qe(t)&&qe(e))return t.getTime()===e.getTime();const r=Object.keys(t),s=Object.keys(e);if(r.length!==s.length)return!1;for(const n of r){const a=t[n];if(!s.includes(n))return!1;if(n!=="ref"){const i=e[n];if(qe(a)&&qe(i)||J(a)&&J(i)||Array.isArray(a)&&Array.isArray(i)?!Le(a,i):a!==i)return!1}}return!0}var ne=t=>J(t)&&!Object.keys(t).length,or=t=>t.type==="file",ve=t=>typeof t=="function",Pt=t=>{if(!sr)return!1;const e=t?t.ownerDocument:0;return t instanceof(e&&e.defaultView?e.defaultView.HTMLElement:HTMLElement)},qr=t=>t.type==="select-multiple",cr=t=>t.type==="radio",Cs=t=>cr(t)||Et(t),Gt=t=>Pt(t)&&t.isConnected;function Rs(t,e){const r=e.slice(0,-1).length;let s=0;for(;s<r;)t=Y(t)?s++:t[e[s++]];return t}function Os(t){for(const e in t)if(t.hasOwnProperty(e)&&!Y(t[e]))return!1;return!0}function X(t,e){const r=Array.isArray(e)?e:nr(e)?[e]:Ur(e),s=r.length===1?t:Rs(t,r),n=r.length-1,a=r[n];return s&&delete s[a],n!==0&&(J(s)&&ne(s)||Array.isArray(s)&&Os(s))&&X(t,r.slice(0,-1)),t}var Yr=t=>{for(const e in t)if(ve(t[e]))return!0;return!1};function It(t,e={}){const r=Array.isArray(t);if(J(t)||r)for(const s in t)Array.isArray(t[s])||J(t[s])&&!Yr(t[s])?(e[s]=Array.isArray(t[s])?[]:{},It(t[s],e[s])):ae(t[s])||(e[s]=!0);return e}function Jr(t,e,r){const s=Array.isArray(t);if(J(t)||s)for(const n in t)Array.isArray(t[n])||J(t[n])&&!Yr(t[n])?Y(e)||Qt(r[n])?r[n]=Array.isArray(t[n])?It(t[n],[]):{...It(t[n])}:Jr(t[n],ae(e)?{}:e[n],r[n]):r[n]=!Le(t[n],e[n]);return r}var ut=(t,e)=>Jr(t,e,It(e));const wr={value:!1,isValid:!1},Sr={value:!0,isValid:!0};var Hr=t=>{if(Array.isArray(t)){if(t.length>1){const e=t.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:e,isValid:!!e.length}}return t[0].checked&&!t[0].disabled?t[0].attributes&&!Y(t[0].attributes.value)?Y(t[0].value)||t[0].value===""?Sr:{value:t[0].value,isValid:!0}:Sr:wr}return wr},Gr=(t,{valueAsNumber:e,valueAsDate:r,setValueAs:s})=>Y(t)?t:e?t===""?NaN:t&&+t:r&&Te(t)?new Date(t):s?s(t):t;const Tr={isValid:!1,value:null};var Xr=t=>Array.isArray(t)?t.reduce((e,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:e,Tr):Tr;function jr(t){const e=t.ref;return or(e)?e.files:cr(e)?Xr(t.refs).value:qr(e)?[...e.selectedOptions].map(({value:r})=>r):Et(e)?Hr(t.refs).value:Gr(Y(e.value)?t.ref.value:e.value,t)}var Vs=(t,e,r,s)=>{const n={};for(const a of t){const i=x(e,a);i&&D(n,a,i._f)}return{criteriaMode:r,names:[...t],fields:n,shouldUseNativeValidation:s}},Dt=t=>t instanceof RegExp,dt=t=>Y(t)?t:Dt(t)?t.source:J(t)?Dt(t.value)?t.value.source:t.value:t,Ar=t=>({isOnSubmit:!t||t===ge.onSubmit,isOnBlur:t===ge.onBlur,isOnChange:t===ge.onChange,isOnAll:t===ge.all,isOnTouch:t===ge.onTouched});const Nr="AsyncFunction";var Fs=t=>!!t&&!!t.validate&&!!(ve(t.validate)&&t.validate.constructor.name===Nr||J(t.validate)&&Object.values(t.validate).find(e=>e.constructor.name===Nr)),Ps=t=>t.mount&&(t.required||t.min||t.max||t.maxLength||t.minLength||t.pattern||t.validate),Er=(t,e,r)=>!r&&(e.watchAll||e.watch.has(t)||[...e.watch].some(s=>t.startsWith(s)&&/^\.\w+/.test(t.slice(s.length))));const ht=(t,e,r,s)=>{for(const n of r||Object.keys(t)){const a=x(t,n);if(a){const{_f:i,...o}=a;if(i){if(i.refs&&i.refs[0]&&e(i.refs[0],n)&&!s)return!0;if(i.ref&&e(i.ref,i.name)&&!s)return!0;if(ht(o,e))break}else if(J(o)&&ht(o,e))break}}};function Cr(t,e,r){const s=x(t,r);if(s||nr(r))return{error:s,name:r};const n=r.split(".");for(;n.length;){const a=n.join("."),i=x(e,a),o=x(t,a);if(i&&!Array.isArray(i)&&r!==a)return{name:r};if(o&&o.type)return{name:a,error:o};n.pop()}return{name:r}}var Is=(t,e,r,s)=>{r(t);const{name:n,...a}=t;return ne(a)||Object.keys(a).length>=Object.keys(e).length||Object.keys(a).find(i=>e[i]===(!s||ge.all))},Ds=(t,e,r)=>!t||!e||t===e||ft(t).some(s=>s&&(r?s===e:s.startsWith(e)||e.startsWith(s))),Ms=(t,e,r,s,n)=>n.isOnAll?!1:!r&&n.isOnTouch?!(e||t):(r?s.isOnBlur:n.isOnBlur)?!t:(r?s.isOnChange:n.isOnChange)?t:!0,Zs=(t,e)=>!Wt(x(t,e)).length&&X(t,e),Ls=(t,e,r)=>{const s=ft(x(t,r));return D(s,"root",e[r]),D(t,r,s),t},Vt=t=>Te(t);function Rr(t,e,r="validate"){if(Vt(t)||Array.isArray(t)&&t.every(Vt)||he(t)&&!t)return{type:r,message:Vt(t)?t:"",ref:e}}var et=t=>J(t)&&!Dt(t)?t:{value:t,message:""},Or=async(t,e,r,s,n,a)=>{const{ref:i,refs:o,required:d,maxLength:f,minLength:_,min:y,max:v,pattern:W,validate:te,name:Z,valueAsNumber:B,mount:ye}=t._f,R=x(r,Z);if(!ye||e.has(Z))return{};const le=o?o[0]:i,re=F=>{n&&le.reportValidity&&(le.setCustomValidity(he(F)?"":F||""),le.reportValidity())},q={},Xe=cr(i),ke=Et(i),Qe=Xe||ke,ue=(B||or(i))&&Y(i.value)&&Y(R)||Pt(i)&&i.value===""||R===""||Array.isArray(R)&&!R.length,Ee=Wr.bind(null,Z,s,q),oe=(F,I,$,Q=Re.maxLength,K=Re.minLength)=>{const de=F?I:$;q[Z]={type:F?Q:K,message:de,ref:i,...Ee(F?Q:K,de)}};if(a?!Array.isArray(R)||!R.length:d&&(!Qe&&(ue||ae(R))||he(R)&&!R||ke&&!Hr(o).isValid||Xe&&!Xr(o).isValid)){const{value:F,message:I}=Vt(d)?{value:!!d,message:d}:et(d);if(F&&(q[Z]={type:Re.required,message:I,ref:le,...Ee(Re.required,I)},!s))return re(I),q}if(!ue&&(!ae(y)||!ae(v))){let F,I;const $=et(v),Q=et(y);if(!ae(R)&&!isNaN(R)){const K=i.valueAsNumber||R&&+R;ae($.value)||(F=K>$.value),ae(Q.value)||(I=K<Q.value)}else{const K=i.valueAsDate||new Date(R),de=h=>new Date(new Date().toDateString()+" "+h),Ie=i.type=="time",Ce=i.type=="week";Te($.value)&&R&&(F=Ie?de(R)>de($.value):Ce?R>$.value:K>new Date($.value)),Te(Q.value)&&R&&(I=Ie?de(R)<de(Q.value):Ce?R<Q.value:K<new Date(Q.value))}if((F||I)&&(oe(!!F,$.message,Q.message,Re.max,Re.min),!s))return re(q[Z].message),q}if((f||_)&&!ue&&(Te(R)||a&&Array.isArray(R))){const F=et(f),I=et(_),$=!ae(F.value)&&R.length>+F.value,Q=!ae(I.value)&&R.length<+I.value;if(($||Q)&&(oe($,F.message,I.message),!s))return re(q[Z].message),q}if(W&&!ue&&Te(R)){const{value:F,message:I}=et(W);if(Dt(F)&&!R.match(F)&&(q[Z]={type:Re.pattern,message:I,ref:i,...Ee(Re.pattern,I)},!s))return re(I),q}if(te){if(ve(te)){const F=await te(R,r),I=Rr(F,le);if(I&&(q[Z]={...I,...Ee(Re.validate,I.message)},!s))return re(I.message),q}else if(J(te)){let F={};for(const I in te){if(!ne(F)&&!s)break;const $=Rr(await te[I](R,r),le,I);$&&(F={...$,...Ee(I,$.message)},re($.message),s&&(q[Z]=F))}if(!ne(F)&&(q[Z]={ref:le,...F},!s))return q}}return re(!0),q};const $s={mode:ge.onSubmit,reValidateMode:ge.onChange,shouldFocusError:!0};function Us(t={}){let e={...$s,...t},r={submitCount:0,isDirty:!1,isReady:!1,isLoading:ve(e.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1};const s={};let n=J(e.defaultValues)||J(e.values)?ee(e.defaultValues||e.values)||{}:{},a=e.shouldUnregister?{}:ee(n),i={action:!1,mount:!1,watch:!1},o={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},d,f=0;const _={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let y={..._};const v={array:kr(),state:kr()},W=e.criteriaMode===ge.all,te=c=>l=>{clearTimeout(f),f=setTimeout(c,l)},Z=async c=>{if(!e.disabled&&(_.isValid||y.isValid||c)){const l=e.resolver?ne((await ke()).errors):await ue(s,!0);l!==r.isValid&&v.state.next({isValid:l})}},B=(c,l)=>{!e.disabled&&(_.isValidating||_.validatingFields||y.isValidating||y.validatingFields)&&((c||Array.from(o.mount)).forEach(u=>{u&&(l?D(r.validatingFields,u,l):X(r.validatingFields,u))}),v.state.next({validatingFields:r.validatingFields,isValidating:!ne(r.validatingFields)}))},ye=(c,l=[],u,w,b=!0,g=!0)=>{if(w&&u&&!e.disabled){if(i.action=!0,g&&Array.isArray(x(s,c))){const j=u(x(s,c),w.argA,w.argB);b&&D(s,c,j)}if(g&&Array.isArray(x(r.errors,c))){const j=u(x(r.errors,c),w.argA,w.argB);b&&D(r.errors,c,j),Zs(r.errors,c)}if((_.touchedFields||y.touchedFields)&&g&&Array.isArray(x(r.touchedFields,c))){const j=u(x(r.touchedFields,c),w.argA,w.argB);b&&D(r.touchedFields,c,j)}(_.dirtyFields||y.dirtyFields)&&(r.dirtyFields=ut(n,a)),v.state.next({name:c,isDirty:oe(c,l),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else D(a,c,l)},R=(c,l)=>{D(r.errors,c,l),v.state.next({errors:r.errors})},le=c=>{r.errors=c,v.state.next({errors:r.errors,isValid:!1})},re=(c,l,u,w)=>{const b=x(s,c);if(b){const g=x(a,c,Y(u)?x(n,c):u);Y(g)||w&&w.defaultChecked||l?D(a,c,l?g:jr(b._f)):$(c,g),i.mount&&Z()}},q=(c,l,u,w,b)=>{let g=!1,j=!1;const M={name:c};if(!e.disabled){if(!u||w){(_.isDirty||y.isDirty)&&(j=r.isDirty,r.isDirty=M.isDirty=oe(),g=j!==M.isDirty);const L=Le(x(n,c),l);j=!!x(r.dirtyFields,c),L?X(r.dirtyFields,c):D(r.dirtyFields,c,!0),M.dirtyFields=r.dirtyFields,g=g||(_.dirtyFields||y.dirtyFields)&&j!==!L}if(u){const L=x(r.touchedFields,c);L||(D(r.touchedFields,c,u),M.touchedFields=r.touchedFields,g=g||(_.touchedFields||y.touchedFields)&&L!==u)}g&&b&&v.state.next(M)}return g?M:{}},Xe=(c,l,u,w)=>{const b=x(r.errors,c),g=(_.isValid||y.isValid)&&he(l)&&r.isValid!==l;if(e.delayError&&u?(d=te(()=>R(c,u)),d(e.delayError)):(clearTimeout(f),d=null,u?D(r.errors,c,u):X(r.errors,c)),(u?!Le(b,u):b)||!ne(w)||g){const j={...w,...g&&he(l)?{isValid:l}:{},errors:r.errors,name:c};r={...r,...j},v.state.next(j)}},ke=async c=>{B(c,!0);const l=await e.resolver(a,e.context,Vs(c||o.mount,s,e.criteriaMode,e.shouldUseNativeValidation));return B(c),l},Qe=async c=>{const{errors:l}=await ke(c);if(c)for(const u of c){const w=x(l,u);w?D(r.errors,u,w):X(r.errors,u)}else r.errors=l;return l},ue=async(c,l,u={valid:!0})=>{for(const w in c){const b=c[w];if(b){const{_f:g,...j}=b;if(g){const M=o.array.has(g.name),L=b._f&&Fs(b._f);L&&_.validatingFields&&B([w],!0);const pe=await Or(b,o.disabled,a,W,e.shouldUseNativeValidation&&!l,M);if(L&&_.validatingFields&&B([w]),pe[g.name]&&(u.valid=!1,l))break;!l&&(x(pe,g.name)?M?Ls(r.errors,pe,g.name):D(r.errors,g.name,pe[g.name]):X(r.errors,g.name))}!ne(j)&&await ue(j,l,u)}}return u.valid},Ee=()=>{for(const c of o.unMount){const l=x(s,c);l&&(l._f.refs?l._f.refs.every(u=>!Gt(u)):!Gt(l._f.ref))&&We(c)}o.unMount=new Set},oe=(c,l)=>!e.disabled&&(c&&l&&D(a,c,l),!Le(h(),n)),F=(c,l,u)=>Br(c,o,{...i.mount?a:Y(l)?n:Te(c)?{[c]:l}:l},u,l),I=c=>Wt(x(i.mount?a:n,c,e.shouldUnregister?x(n,c,[]):[])),$=(c,l,u={})=>{const w=x(s,c);let b=l;if(w){const g=w._f;g&&(!g.disabled&&D(a,c,Gr(l,g)),b=Pt(g.ref)&&ae(l)?"":l,qr(g.ref)?[...g.ref.options].forEach(j=>j.selected=b.includes(j.value)):g.refs?Et(g.ref)?g.refs.forEach(j=>{(!j.defaultChecked||!j.disabled)&&(Array.isArray(b)?j.checked=!!b.find(M=>M===j.value):j.checked=b===j.value||!!b)}):g.refs.forEach(j=>j.checked=j.value===b):or(g.ref)?g.ref.value="":(g.ref.value=b,g.ref.type||v.state.next({name:c,values:ee(a)})))}(u.shouldDirty||u.shouldTouch)&&q(c,b,u.shouldTouch,u.shouldDirty,!0),u.shouldValidate&&Ce(c)},Q=(c,l,u)=>{for(const w in l){if(!l.hasOwnProperty(w))return;const b=l[w],g=`${c}.${w}`,j=x(s,g);(o.array.has(c)||J(b)||j&&!j._f)&&!qe(b)?Q(g,b,u):$(g,b,u)}},K=(c,l,u={})=>{const w=x(s,c),b=o.array.has(c),g=ee(l);D(a,c,g),b?(v.array.next({name:c,values:ee(a)}),(_.isDirty||_.dirtyFields||y.isDirty||y.dirtyFields)&&u.shouldDirty&&v.state.next({name:c,dirtyFields:ut(n,a),isDirty:oe(c,g)})):w&&!w._f&&!ae(g)?Q(c,g,u):$(c,g,u),Er(c,o)&&v.state.next({...r}),v.state.next({name:i.mount?c:void 0,values:ee(a)})},de=async c=>{i.mount=!0;const l=c.target;let u=l.name,w=!0;const b=x(s,u),g=L=>{w=Number.isNaN(L)||qe(L)&&isNaN(L.getTime())||Le(L,x(a,u,L))},j=Ar(e.mode),M=Ar(e.reValidateMode);if(b){let L,pe;const Rt=l.type?jr(b._f):Lr(c),De=c.type===Ft.BLUR||c.type===Ft.FOCUS_OUT,ds=!Ps(b._f)&&!e.resolver&&!x(r.errors,u)&&!b._f.deps||Ms(De,x(r.touchedFields,u),r.isSubmitted,M,j),Jt=Er(u,o,De);D(a,u,Rt),De?(b._f.onBlur&&b._f.onBlur(c),d&&d(0)):b._f.onChange&&b._f.onChange(c);const Ht=q(u,Rt,De),fs=!ne(Ht)||Jt;if(!De&&v.state.next({name:u,type:c.type,values:ee(a)}),ds)return(_.isValid||y.isValid)&&(e.mode==="onBlur"?De&&Z():De||Z()),fs&&v.state.next({name:u,...Jt?{}:Ht});if(!De&&Jt&&v.state.next({...r}),e.resolver){const{errors:mr}=await ke([u]);if(g(Rt),w){const hs=Cr(r.errors,s,u),pr=Cr(mr,s,hs.name||u);L=pr.error,u=pr.name,pe=ne(mr)}}else B([u],!0),L=(await Or(b,o.disabled,a,W,e.shouldUseNativeValidation))[u],B([u]),g(Rt),w&&(L?pe=!1:(_.isValid||y.isValid)&&(pe=await ue(s,!0)));w&&(b._f.deps&&Ce(b._f.deps),Xe(u,pe,L,Ht))}},Ie=(c,l)=>{if(x(r.errors,l)&&c.focus)return c.focus(),1},Ce=async(c,l={})=>{let u,w;const b=ft(c);if(e.resolver){const g=await Qe(Y(c)?c:b);u=ne(g),w=c?!b.some(j=>x(g,j)):u}else c?(w=(await Promise.all(b.map(async g=>{const j=x(s,g);return await ue(j&&j._f?{[g]:j}:j)}))).every(Boolean),!(!w&&!r.isValid)&&Z()):w=u=await ue(s);return v.state.next({...!Te(c)||(_.isValid||y.isValid)&&u!==r.isValid?{}:{name:c},...e.resolver||!c?{isValid:u}:{},errors:r.errors}),l.shouldFocus&&!w&&ht(s,Ie,c?b:o.mount),w},h=c=>{const l={...i.mount?a:n};return Y(c)?l:Te(c)?x(l,c):c.map(u=>x(l,u))},C=(c,l)=>({invalid:!!x((l||r).errors,c),isDirty:!!x((l||r).dirtyFields,c),error:x((l||r).errors,c),isValidating:!!x(r.validatingFields,c),isTouched:!!x((l||r).touchedFields,c)}),U=c=>{c&&ft(c).forEach(l=>X(r.errors,l)),v.state.next({errors:c?r.errors:{}})},H=(c,l,u)=>{const w=(x(s,c,{_f:{}})._f||{}).ref,b=x(r.errors,c)||{},{ref:g,message:j,type:M,...L}=b;D(r.errors,c,{...L,...l,ref:w}),v.state.next({name:c,errors:r.errors,isValid:!1}),u&&u.shouldFocus&&w&&w.focus&&w.focus()},we=(c,l)=>ve(c)?v.state.subscribe({next:u=>c(F(void 0,l),u)}):F(c,l,!0),fe=c=>v.state.subscribe({next:l=>{Ds(c.name,l.name,c.exact)&&Is(l,c.formState||_,us,c.reRenderRoot)&&c.callback({values:{...a},...r,...l})}}).unsubscribe,ot=c=>(i.mount=!0,y={...y,...c.formState},fe({...c,formState:y})),We=(c,l={})=>{for(const u of c?ft(c):o.mount)o.mount.delete(u),o.array.delete(u),l.keepValue||(X(s,u),X(a,u)),!l.keepError&&X(r.errors,u),!l.keepDirty&&X(r.dirtyFields,u),!l.keepTouched&&X(r.touchedFields,u),!l.keepIsValidating&&X(r.validatingFields,u),!e.shouldUnregister&&!l.keepDefaultValue&&X(n,u);v.state.next({values:ee(a)}),v.state.next({...r,...l.keepDirty?{isDirty:oe()}:{}}),!l.keepIsValid&&Z()},G=({disabled:c,name:l})=>{(he(c)&&i.mount||c||o.disabled.has(l))&&(c?o.disabled.add(l):o.disabled.delete(l))},Se=(c,l={})=>{let u=x(s,c);const w=he(l.disabled)||he(e.disabled);return D(s,c,{...u||{},_f:{...u&&u._f?u._f:{ref:{name:c}},name:c,mount:!0,...l}}),o.mount.add(c),u?G({disabled:he(l.disabled)?l.disabled:e.disabled,name:c}):re(c,!0,l.value),{...w?{disabled:l.disabled||e.disabled}:{},...e.progressive?{required:!!l.required,min:dt(l.min),max:dt(l.max),minLength:dt(l.minLength),maxLength:dt(l.maxLength),pattern:dt(l.pattern)}:{},name:c,onChange:de,onBlur:de,ref:b=>{if(b){Se(c,l),u=x(s,c);const g=Y(b.value)&&b.querySelectorAll&&b.querySelectorAll("input,select,textarea")[0]||b,j=Cs(g),M=u._f.refs||[];if(j?M.find(L=>L===g):g===u._f.ref)return;D(s,c,{_f:{...u._f,...j?{refs:[...M.filter(Gt),g,...Array.isArray(x(n,c))?[{}]:[]],ref:{type:g.type,name:c}}:{ref:g}}}),re(c,!1,void 0,g)}else u=x(s,c,{}),u._f&&(u._f.mount=!1),(e.shouldUnregister||l.shouldUnregister)&&!($r(o.array,c)&&i.action)&&o.unMount.add(c)}}},Ke=()=>e.shouldFocusError&&ht(s,Ie,o.mount),Yt=c=>{he(c)&&(v.state.next({disabled:c}),ht(s,(l,u)=>{const w=x(s,u);w&&(l.disabled=w._f.disabled||c,Array.isArray(w._f.refs)&&w._f.refs.forEach(b=>{b.disabled=w._f.disabled||c}))},0,!1))},ur=(c,l)=>async u=>{let w;u&&(u.preventDefault&&u.preventDefault(),u.persist&&u.persist());let b=ee(a);if(v.state.next({isSubmitting:!0}),e.resolver){const{errors:g,values:j}=await ke();r.errors=g,b=j}else await ue(s);if(o.disabled.size)for(const g of o.disabled)D(b,g,void 0);if(X(r.errors,"root"),ne(r.errors)){v.state.next({errors:{}});try{await c(b,u)}catch(g){w=g}}else l&&await l({...r.errors},u),Ke(),setTimeout(Ke);if(v.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:ne(r.errors)&&!w,submitCount:r.submitCount+1,errors:r.errors}),w)throw w},cs=(c,l={})=>{x(s,c)&&(Y(l.defaultValue)?K(c,ee(x(n,c))):(K(c,l.defaultValue),D(n,c,ee(l.defaultValue))),l.keepTouched||X(r.touchedFields,c),l.keepDirty||(X(r.dirtyFields,c),r.isDirty=l.defaultValue?oe(c,ee(x(n,c))):oe()),l.keepError||(X(r.errors,c),_.isValid&&Z()),v.state.next({...r}))},dr=(c,l={})=>{const u=c?ee(c):n,w=ee(u),b=ne(c),g=b?n:w;if(l.keepDefaultValues||(n=u),!l.keepValues){if(l.keepDirtyValues){const j=new Set([...o.mount,...Object.keys(ut(n,a))]);for(const M of Array.from(j))x(r.dirtyFields,M)?D(g,M,x(a,M)):K(M,x(g,M))}else{if(sr&&Y(c))for(const j of o.mount){const M=x(s,j);if(M&&M._f){const L=Array.isArray(M._f.refs)?M._f.refs[0]:M._f.ref;if(Pt(L)){const pe=L.closest("form");if(pe){pe.reset();break}}}}for(const j of o.mount)K(j,x(g,j))}a=ee(g),v.array.next({values:{...g}}),v.state.next({values:{...g}})}o={mount:l.keepDirtyValues?o.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},i.mount=!_.isValid||!!l.keepIsValid||!!l.keepDirtyValues,i.watch=!!e.shouldUnregister,v.state.next({submitCount:l.keepSubmitCount?r.submitCount:0,isDirty:b?!1:l.keepDirty?r.isDirty:!!(l.keepDefaultValues&&!Le(c,n)),isSubmitted:l.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:b?{}:l.keepDirtyValues?l.keepDefaultValues&&a?ut(n,a):r.dirtyFields:l.keepDefaultValues&&c?ut(n,c):l.keepDirty?r.dirtyFields:{},touchedFields:l.keepTouched?r.touchedFields:{},errors:l.keepErrors?r.errors:{},isSubmitSuccessful:l.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1})},fr=(c,l)=>dr(ve(c)?c(a):c,l),ls=(c,l={})=>{const u=x(s,c),w=u&&u._f;if(w){const b=w.refs?w.refs[0]:w.ref;b.focus&&(b.focus(),l.shouldSelect&&ve(b.select)&&b.select())}},us=c=>{r={...r,...c}},hr={control:{register:Se,unregister:We,getFieldState:C,handleSubmit:ur,setError:H,_subscribe:fe,_runSchema:ke,_getWatch:F,_getDirty:oe,_setValid:Z,_setFieldArray:ye,_setDisabledField:G,_setErrors:le,_getFieldArray:I,_reset:dr,_resetDefaultValues:()=>ve(e.defaultValues)&&e.defaultValues().then(c=>{fr(c,e.resetOptions),v.state.next({isLoading:!1})}),_removeUnmounted:Ee,_disableForm:Yt,_subjects:v,_proxyFormState:_,get _fields(){return s},get _formValues(){return a},get _state(){return i},set _state(c){i=c},get _defaultValues(){return n},get _names(){return o},set _names(c){o=c},get _formState(){return r},get _options(){return e},set _options(c){e={...e,...c}}},subscribe:ot,trigger:Ce,register:Se,handleSubmit:ur,watch:we,setValue:K,getValues:h,reset:fr,resetField:cs,clearErrors:U,unregister:We,setError:H,setFocus:ls,getFieldState:C};return{...hr,formControl:hr}}function zs(t={}){const e=V.useRef(void 0),r=V.useRef(void 0),[s,n]=V.useState({isDirty:!1,isValidating:!1,isLoading:ve(t.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1,isReady:!1,defaultValues:ve(t.defaultValues)?void 0:t.defaultValues});e.current||(e.current={...t.formControl?t.formControl:Us(t),formState:s},t.formControl&&t.defaultValues&&!ve(t.defaultValues)&&t.formControl.reset(t.defaultValues,t.resetOptions));const a=e.current.control;return a._options=t,ir(()=>{const i=a._subscribe({formState:a._proxyFormState,callback:()=>n({...a._formState}),reRenderRoot:!0});return n(o=>({...o,isReady:!0})),a._formState.isReady=!0,i},[a]),V.useEffect(()=>a._disableForm(t.disabled),[a,t.disabled]),V.useEffect(()=>{t.mode&&(a._options.mode=t.mode),t.reValidateMode&&(a._options.reValidateMode=t.reValidateMode),t.errors&&!ne(t.errors)&&a._setErrors(t.errors)},[a,t.errors,t.mode,t.reValidateMode]),V.useEffect(()=>{t.shouldUnregister&&a._subjects.state.next({values:a._getWatch()})},[a,t.shouldUnregister]),V.useEffect(()=>{if(a._proxyFormState.isDirty){const i=a._getDirty();i!==s.isDirty&&a._subjects.state.next({isDirty:i})}},[a,s.isDirty]),V.useEffect(()=>{t.values&&!Le(t.values,r.current)?(a._reset(t.values,a._options.resetOptions),r.current=t.values,n(i=>({...i}))):a._resetDefaultValues()},[a,t.values]),V.useEffect(()=>{a._state.mount||(a._setValid(),a._state.mount=!0),a._state.watch&&(a._state.watch=!1,a._subjects.state.next({...a._formState})),a._removeUnmounted()}),e.current.formState=zr(s,a),e.current}const Vr=(t,e,r)=>{if(t&&"reportValidity"in t){const s=x(r,e);t.setCustomValidity(s&&s.message||""),t.reportValidity()}},Qr=(t,e)=>{for(const r in e.fields){const s=e.fields[r];s&&s.ref&&"reportValidity"in s.ref?Vr(s.ref,r,t):s&&s.refs&&s.refs.forEach(n=>Vr(n,r,t))}},Bs=(t,e)=>{e.shouldUseNativeValidation&&Qr(t,e);const r={};for(const s in t){const n=x(e.fields,s),a=Object.assign(t[s]||{},{ref:n&&n.ref});if(Ws(e.names||Object.keys(t),s)){const i=Object.assign({},x(r,s));D(i,"root",a),D(r,s,i)}else D(r,s,a)}return r},Ws=(t,e)=>{const r=Fr(e);return t.some(s=>Fr(s).match(`^${r}\\.\\d+`))};function Fr(t){return t.replace(/\]|\[/g,"")}function qs(t,e){for(var r={};t.length;){var s=t[0],n=s.code,a=s.message,i=s.path.join(".");if(!r[i])if("unionErrors"in s){var o=s.unionErrors[0].errors[0];r[i]={message:o.message,type:o.code}}else r[i]={message:a,type:n};if("unionErrors"in s&&s.unionErrors.forEach(function(_){return _.errors.forEach(function(y){return t.push(y)})}),e){var d=r[i].types,f=d&&d[s.code];r[i]=Wr(i,e,r,n,f?[].concat(f,s.message):s.message)}t.shift()}return r}function Ys(t,e,r){return r===void 0&&(r={}),function(s,n,a){try{return Promise.resolve(function(i,o){try{var d=Promise.resolve(t[r.mode==="sync"?"parse":"parseAsync"](s,e)).then(function(f){return a.shouldUseNativeValidation&&Qr({},a),{errors:{},values:r.raw?Object.assign({},s):f}})}catch(f){return o(f)}return d&&d.then?d.then(void 0,o):d}(0,function(i){if(function(o){return Array.isArray(o==null?void 0:o.errors)}(i))return{values:{},errors:Bs(qs(i.errors,!a.shouldUseNativeValidation&&a.criteriaMode==="all"),a)};throw i}))}catch(i){return Promise.reject(i)}}}var P;(function(t){t.assertEqual=n=>{};function e(n){}t.assertIs=e;function r(n){throw new Error}t.assertNever=r,t.arrayToEnum=n=>{const a={};for(const i of n)a[i]=i;return a},t.getValidEnumValues=n=>{const a=t.objectKeys(n).filter(o=>typeof n[n[o]]!="number"),i={};for(const o of a)i[o]=n[o];return t.objectValues(i)},t.objectValues=n=>t.objectKeys(n).map(function(a){return n[a]}),t.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{const a=[];for(const i in n)Object.prototype.hasOwnProperty.call(n,i)&&a.push(i);return a},t.find=(n,a)=>{for(const i of n)if(a(i))return i},t.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function s(n,a=" | "){return n.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}t.joinValues=s,t.jsonStringifyReplacer=(n,a)=>typeof a=="bigint"?a.toString():a})(P||(P={}));var Kt;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(Kt||(Kt={}));const S=P.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Fe=t=>{switch(typeof t){case"undefined":return S.undefined;case"string":return S.string;case"number":return Number.isNaN(t)?S.nan:S.number;case"boolean":return S.boolean;case"function":return S.function;case"bigint":return S.bigint;case"symbol":return S.symbol;case"object":return Array.isArray(t)?S.array:t===null?S.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?S.promise:typeof Map<"u"&&t instanceof Map?S.map:typeof Set<"u"&&t instanceof Set?S.set:typeof Date<"u"&&t instanceof Date?S.date:S.object;default:return S.unknown}},m=P.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Js=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");class me extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){const r=e||function(a){return a.message},s={_errors:[]},n=a=>{for(const i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(n);else if(i.code==="invalid_return_type")n(i.returnTypeError);else if(i.code==="invalid_arguments")n(i.argumentsError);else if(i.path.length===0)s._errors.push(r(i));else{let o=s,d=0;for(;d<i.path.length;){const f=i.path[d];d===i.path.length-1?(o[f]=o[f]||{_errors:[]},o[f]._errors.push(r(i))):o[f]=o[f]||{_errors:[]},o=o[f],d++}}};return n(this),s}static assert(e){if(!(e instanceof me))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,P.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){const r={},s=[];for(const n of this.issues)n.path.length>0?(r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(e(n))):s.push(e(n));return{formErrors:s,fieldErrors:r}}get formErrors(){return this.flatten()}}me.create=t=>new me(t);const nt=(t,e)=>{let r;switch(t.code){case m.invalid_type:t.received===S.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case m.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,P.jsonStringifyReplacer)}`;break;case m.unrecognized_keys:r=`Unrecognized key(s) in object: ${P.joinValues(t.keys,", ")}`;break;case m.invalid_union:r="Invalid input";break;case m.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${P.joinValues(t.options)}`;break;case m.invalid_enum_value:r=`Invalid enum value. Expected ${P.joinValues(t.options)}, received '${t.received}'`;break;case m.invalid_arguments:r="Invalid function arguments";break;case m.invalid_return_type:r="Invalid function return type";break;case m.invalid_date:r="Invalid date";break;case m.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:P.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case m.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case m.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case m.custom:r="Invalid input";break;case m.invalid_intersection_types:r="Intersection results could not be merged";break;case m.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case m.not_finite:r="Number must be finite";break;default:r=e.defaultError,P.assertNever(t)}return{message:r}};let Kr=nt;function Hs(t){Kr=t}function Mt(){return Kr}const Zt=t=>{const{data:e,path:r,errorMaps:s,issueData:n}=t,a=[...r,...n.path||[]],i={...n,path:a};if(n.message!==void 0)return{...n,path:a,message:n.message};let o="";const d=s.filter(f=>!!f).slice().reverse();for(const f of d)o=f(i,{data:e,defaultError:o}).message;return{...n,path:a,message:o}},Gs=[];function k(t,e){const r=Mt(),s=Zt({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===nt?void 0:nt].filter(n=>!!n)});t.common.issues.push(s)}class se{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){const s=[];for(const n of r){if(n.status==="aborted")return A;n.status==="dirty"&&e.dirty(),s.push(n.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,r){const s=[];for(const n of r){const a=await n.key,i=await n.value;s.push({key:a,value:i})}return se.mergeObjectSync(e,s)}static mergeObjectSync(e,r){const s={};for(const n of r){const{key:a,value:i}=n;if(a.status==="aborted"||i.status==="aborted")return A;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||n.alwaysSet)&&(s[a.value]=i.value)}return{status:e.value,value:s}}}const A=Object.freeze({status:"aborted"}),rt=t=>({status:"dirty",value:t}),ie=t=>({status:"valid",value:t}),er=t=>t.status==="aborted",tr=t=>t.status==="dirty",Je=t=>t.status==="valid",pt=t=>typeof Promise<"u"&&t instanceof Promise;var T;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(T||(T={}));class Ae{constructor(e,r,s,n){this._cachedPath=[],this.parent=e,this.data=r,this._path=s,this._key=n}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Pr=(t,e)=>{if(Je(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const r=new me(t.common.issues);return this._error=r,this._error}}};function E(t){if(!t)return{};const{errorMap:e,invalid_type_error:r,required_error:s,description:n}=t;if(e&&(r||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(i,o)=>{const{message:d}=t;return i.code==="invalid_enum_value"?{message:d??o.defaultError}:typeof o.data>"u"?{message:d??s??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:d??r??o.defaultError}},description:n}}class O{get description(){return this._def.description}_getType(e){return Fe(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Fe(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new se,ctx:{common:e.parent.common,data:e.data,parsedType:Fe(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const r=this._parse(e);if(pt(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){const r=this._parse(e);return Promise.resolve(r)}parse(e,r){const s=this.safeParse(e,r);if(s.success)return s.data;throw s.error}safeParse(e,r){const s={common:{issues:[],async:(r==null?void 0:r.async)??!1,contextualErrorMap:r==null?void 0:r.errorMap},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Fe(e)},n=this._parseSync({data:e,path:s.path,parent:s});return Pr(s,n)}"~validate"(e){var s,n;const r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Fe(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:r});return Je(a)?{value:a.value}:{issues:r.common.issues}}catch(a){(n=(s=a==null?void 0:a.message)==null?void 0:s.toLowerCase())!=null&&n.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(a=>Je(a)?{value:a.value}:{issues:r.common.issues})}async parseAsync(e,r){const s=await this.safeParseAsync(e,r);if(s.success)return s.data;throw s.error}async safeParseAsync(e,r){const s={common:{issues:[],contextualErrorMap:r==null?void 0:r.errorMap,async:!0},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Fe(e)},n=this._parse({data:e,path:s.path,parent:s}),a=await(pt(n)?n:Promise.resolve(n));return Pr(s,a)}refine(e,r){const s=n=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(n):r;return this._refinement((n,a)=>{const i=e(n),o=()=>a.addIssue({code:m.custom,...s(n)});return typeof Promise<"u"&&i instanceof Promise?i.then(d=>d?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,r){return this._refinement((s,n)=>e(s)?!0:(n.addIssue(typeof r=="function"?r(s,n):r),!1))}_refinement(e){return new xe({schema:this,typeName:N.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return je.create(this,this._def)}nullable(){return Be.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return be.create(this)}promise(){return it.create(this,this._def)}or(e){return _t.create([this,e],this._def)}and(e){return bt.create(this,e,this._def)}transform(e){return new xe({...E(this._def),schema:this,typeName:N.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const r=typeof e=="function"?e:()=>e;return new Tt({...E(this._def),innerType:this,defaultValue:r,typeName:N.ZodDefault})}brand(){return new lr({typeName:N.ZodBranded,type:this,...E(this._def)})}catch(e){const r=typeof e=="function"?e:()=>e;return new jt({...E(this._def),innerType:this,catchValue:r,typeName:N.ZodCatch})}describe(e){const r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Ct.create(this,e)}readonly(){return At.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Xs=/^c[^\s-]{8,}$/i,Qs=/^[0-9a-z]+$/,Ks=/^[0-9A-HJKMNP-TV-Z]{26}$/i,en=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,tn=/^[a-z0-9_-]{21}$/i,rn=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,sn=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,nn=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,an="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Xt;const on=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,cn=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ln=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,un=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,dn=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,fn=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,es="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",hn=new RegExp(`^${es}$`);function ts(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);const r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function mn(t){return new RegExp(`^${ts(t)}$`)}function rs(t){let e=`${es}T${ts(t)}`;const r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function pn(t,e){return!!((e==="v4"||!e)&&on.test(t)||(e==="v6"||!e)&&ln.test(t))}function yn(t,e){if(!rn.test(t))return!1;try{const[r]=t.split("."),s=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),n=JSON.parse(atob(s));return!(typeof n!="object"||n===null||"typ"in n&&(n==null?void 0:n.typ)!=="JWT"||!n.alg||e&&n.alg!==e)}catch{return!1}}function gn(t,e){return!!((e==="v4"||!e)&&cn.test(t)||(e==="v6"||!e)&&un.test(t))}class _e extends O{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==S.string){const a=this._getOrReturnCtx(e);return k(a,{code:m.invalid_type,expected:S.string,received:a.parsedType}),A}const s=new se;let n;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(n=this._getOrReturnCtx(e,n),k(n,{code:m.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="max")e.data.length>a.value&&(n=this._getOrReturnCtx(e,n),k(n,{code:m.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="length"){const i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(n=this._getOrReturnCtx(e,n),i?k(n,{code:m.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&k(n,{code:m.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),s.dirty())}else if(a.kind==="email")nn.test(e.data)||(n=this._getOrReturnCtx(e,n),k(n,{validation:"email",code:m.invalid_string,message:a.message}),s.dirty());else if(a.kind==="emoji")Xt||(Xt=new RegExp(an,"u")),Xt.test(e.data)||(n=this._getOrReturnCtx(e,n),k(n,{validation:"emoji",code:m.invalid_string,message:a.message}),s.dirty());else if(a.kind==="uuid")en.test(e.data)||(n=this._getOrReturnCtx(e,n),k(n,{validation:"uuid",code:m.invalid_string,message:a.message}),s.dirty());else if(a.kind==="nanoid")tn.test(e.data)||(n=this._getOrReturnCtx(e,n),k(n,{validation:"nanoid",code:m.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid")Xs.test(e.data)||(n=this._getOrReturnCtx(e,n),k(n,{validation:"cuid",code:m.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid2")Qs.test(e.data)||(n=this._getOrReturnCtx(e,n),k(n,{validation:"cuid2",code:m.invalid_string,message:a.message}),s.dirty());else if(a.kind==="ulid")Ks.test(e.data)||(n=this._getOrReturnCtx(e,n),k(n,{validation:"ulid",code:m.invalid_string,message:a.message}),s.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),k(n,{validation:"url",code:m.invalid_string,message:a.message}),s.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),k(n,{validation:"regex",code:m.invalid_string,message:a.message}),s.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(n=this._getOrReturnCtx(e,n),k(n,{code:m.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),s.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(n=this._getOrReturnCtx(e,n),k(n,{code:m.invalid_string,validation:{startsWith:a.value},message:a.message}),s.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(n=this._getOrReturnCtx(e,n),k(n,{code:m.invalid_string,validation:{endsWith:a.value},message:a.message}),s.dirty()):a.kind==="datetime"?rs(a).test(e.data)||(n=this._getOrReturnCtx(e,n),k(n,{code:m.invalid_string,validation:"datetime",message:a.message}),s.dirty()):a.kind==="date"?hn.test(e.data)||(n=this._getOrReturnCtx(e,n),k(n,{code:m.invalid_string,validation:"date",message:a.message}),s.dirty()):a.kind==="time"?mn(a).test(e.data)||(n=this._getOrReturnCtx(e,n),k(n,{code:m.invalid_string,validation:"time",message:a.message}),s.dirty()):a.kind==="duration"?sn.test(e.data)||(n=this._getOrReturnCtx(e,n),k(n,{validation:"duration",code:m.invalid_string,message:a.message}),s.dirty()):a.kind==="ip"?pn(e.data,a.version)||(n=this._getOrReturnCtx(e,n),k(n,{validation:"ip",code:m.invalid_string,message:a.message}),s.dirty()):a.kind==="jwt"?yn(e.data,a.alg)||(n=this._getOrReturnCtx(e,n),k(n,{validation:"jwt",code:m.invalid_string,message:a.message}),s.dirty()):a.kind==="cidr"?gn(e.data,a.version)||(n=this._getOrReturnCtx(e,n),k(n,{validation:"cidr",code:m.invalid_string,message:a.message}),s.dirty()):a.kind==="base64"?dn.test(e.data)||(n=this._getOrReturnCtx(e,n),k(n,{validation:"base64",code:m.invalid_string,message:a.message}),s.dirty()):a.kind==="base64url"?fn.test(e.data)||(n=this._getOrReturnCtx(e,n),k(n,{validation:"base64url",code:m.invalid_string,message:a.message}),s.dirty()):P.assertNever(a);return{status:s.value,value:e.data}}_regex(e,r,s){return this.refinement(n=>e.test(n),{validation:r,code:m.invalid_string,...T.errToObj(s)})}_addCheck(e){return new _e({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...T.errToObj(e)})}url(e){return this._addCheck({kind:"url",...T.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...T.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...T.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...T.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...T.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...T.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...T.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...T.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...T.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...T.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...T.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...T.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...T.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...T.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...T.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...T.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r==null?void 0:r.position,...T.errToObj(r==null?void 0:r.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...T.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...T.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...T.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...T.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...T.errToObj(r)})}nonempty(e){return this.min(1,T.errToObj(e))}trim(){return new _e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new _e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new _e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}}_e.create=t=>new _e({checks:[],typeName:N.ZodString,coerce:(t==null?void 0:t.coerce)??!1,...E(t)});function vn(t,e){const r=(t.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,n=r>s?r:s,a=Number.parseInt(t.toFixed(n).replace(".","")),i=Number.parseInt(e.toFixed(n).replace(".",""));return a%i/10**n}class $e extends O{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==S.number){const a=this._getOrReturnCtx(e);return k(a,{code:m.invalid_type,expected:S.number,received:a.parsedType}),A}let s;const n=new se;for(const a of this._def.checks)a.kind==="int"?P.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),k(s,{code:m.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),k(s,{code:m.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),k(s,{code:m.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="multipleOf"?vn(e.data,a.value)!==0&&(s=this._getOrReturnCtx(e,s),k(s,{code:m.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),k(s,{code:m.not_finite,message:a.message}),n.dirty()):P.assertNever(a);return{status:n.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,T.toString(r))}gt(e,r){return this.setLimit("min",e,!1,T.toString(r))}lte(e,r){return this.setLimit("max",e,!0,T.toString(r))}lt(e,r){return this.setLimit("max",e,!1,T.toString(r))}setLimit(e,r,s,n){return new $e({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:s,message:T.toString(n)}]})}_addCheck(e){return new $e({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:T.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:T.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:T.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:T.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:T.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:T.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:T.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:T.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:T.toString(e)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&P.isInteger(e.value))}get isFinite(){let e=null,r=null;for(const s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(r===null||s.value>r)&&(r=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(r)&&Number.isFinite(e)}}$e.create=t=>new $e({checks:[],typeName:N.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...E(t)});class Ue extends O{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==S.bigint)return this._getInvalidInput(e);let s;const n=new se;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),k(s,{code:m.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),k(s,{code:m.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),k(s,{code:m.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):P.assertNever(a);return{status:n.value,value:e.data}}_getInvalidInput(e){const r=this._getOrReturnCtx(e);return k(r,{code:m.invalid_type,expected:S.bigint,received:r.parsedType}),A}gte(e,r){return this.setLimit("min",e,!0,T.toString(r))}gt(e,r){return this.setLimit("min",e,!1,T.toString(r))}lte(e,r){return this.setLimit("max",e,!0,T.toString(r))}lt(e,r){return this.setLimit("max",e,!1,T.toString(r))}setLimit(e,r,s,n){return new Ue({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:s,message:T.toString(n)}]})}_addCheck(e){return new Ue({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:T.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:T.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:T.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:T.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:T.toString(r)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}}Ue.create=t=>new Ue({checks:[],typeName:N.ZodBigInt,coerce:(t==null?void 0:t.coerce)??!1,...E(t)});class yt extends O{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==S.boolean){const s=this._getOrReturnCtx(e);return k(s,{code:m.invalid_type,expected:S.boolean,received:s.parsedType}),A}return ie(e.data)}}yt.create=t=>new yt({typeName:N.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...E(t)});class He extends O{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==S.date){const a=this._getOrReturnCtx(e);return k(a,{code:m.invalid_type,expected:S.date,received:a.parsedType}),A}if(Number.isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return k(a,{code:m.invalid_date}),A}const s=new se;let n;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(n=this._getOrReturnCtx(e,n),k(n,{code:m.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),s.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(n=this._getOrReturnCtx(e,n),k(n,{code:m.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),s.dirty()):P.assertNever(a);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new He({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:T.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:T.toString(r)})}get minDate(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}}He.create=t=>new He({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:N.ZodDate,...E(t)});class Lt extends O{_parse(e){if(this._getType(e)!==S.symbol){const s=this._getOrReturnCtx(e);return k(s,{code:m.invalid_type,expected:S.symbol,received:s.parsedType}),A}return ie(e.data)}}Lt.create=t=>new Lt({typeName:N.ZodSymbol,...E(t)});class gt extends O{_parse(e){if(this._getType(e)!==S.undefined){const s=this._getOrReturnCtx(e);return k(s,{code:m.invalid_type,expected:S.undefined,received:s.parsedType}),A}return ie(e.data)}}gt.create=t=>new gt({typeName:N.ZodUndefined,...E(t)});class vt extends O{_parse(e){if(this._getType(e)!==S.null){const s=this._getOrReturnCtx(e);return k(s,{code:m.invalid_type,expected:S.null,received:s.parsedType}),A}return ie(e.data)}}vt.create=t=>new vt({typeName:N.ZodNull,...E(t)});class at extends O{constructor(){super(...arguments),this._any=!0}_parse(e){return ie(e.data)}}at.create=t=>new at({typeName:N.ZodAny,...E(t)});class Ye extends O{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ie(e.data)}}Ye.create=t=>new Ye({typeName:N.ZodUnknown,...E(t)});class Pe extends O{_parse(e){const r=this._getOrReturnCtx(e);return k(r,{code:m.invalid_type,expected:S.never,received:r.parsedType}),A}}Pe.create=t=>new Pe({typeName:N.ZodNever,...E(t)});class $t extends O{_parse(e){if(this._getType(e)!==S.undefined){const s=this._getOrReturnCtx(e);return k(s,{code:m.invalid_type,expected:S.void,received:s.parsedType}),A}return ie(e.data)}}$t.create=t=>new $t({typeName:N.ZodVoid,...E(t)});class be extends O{_parse(e){const{ctx:r,status:s}=this._processInputParams(e),n=this._def;if(r.parsedType!==S.array)return k(r,{code:m.invalid_type,expected:S.array,received:r.parsedType}),A;if(n.exactLength!==null){const i=r.data.length>n.exactLength.value,o=r.data.length<n.exactLength.value;(i||o)&&(k(r,{code:i?m.too_big:m.too_small,minimum:o?n.exactLength.value:void 0,maximum:i?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),s.dirty())}if(n.minLength!==null&&r.data.length<n.minLength.value&&(k(r,{code:m.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),s.dirty()),n.maxLength!==null&&r.data.length>n.maxLength.value&&(k(r,{code:m.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),s.dirty()),r.common.async)return Promise.all([...r.data].map((i,o)=>n.type._parseAsync(new Ae(r,i,r.path,o)))).then(i=>se.mergeArray(s,i));const a=[...r.data].map((i,o)=>n.type._parseSync(new Ae(r,i,r.path,o)));return se.mergeArray(s,a)}get element(){return this._def.type}min(e,r){return new be({...this._def,minLength:{value:e,message:T.toString(r)}})}max(e,r){return new be({...this._def,maxLength:{value:e,message:T.toString(r)}})}length(e,r){return new be({...this._def,exactLength:{value:e,message:T.toString(r)}})}nonempty(e){return this.min(1,e)}}be.create=(t,e)=>new be({type:t,minLength:null,maxLength:null,exactLength:null,typeName:N.ZodArray,...E(e)});function tt(t){if(t instanceof z){const e={};for(const r in t.shape){const s=t.shape[r];e[r]=je.create(tt(s))}return new z({...t._def,shape:()=>e})}else return t instanceof be?new be({...t._def,type:tt(t.element)}):t instanceof je?je.create(tt(t.unwrap())):t instanceof Be?Be.create(tt(t.unwrap())):t instanceof Ne?Ne.create(t.items.map(e=>tt(e))):t}class z extends O{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),r=P.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==S.object){const f=this._getOrReturnCtx(e);return k(f,{code:m.invalid_type,expected:S.object,received:f.parsedType}),A}const{status:s,ctx:n}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof Pe&&this._def.unknownKeys==="strip"))for(const f in n.data)i.includes(f)||o.push(f);const d=[];for(const f of i){const _=a[f],y=n.data[f];d.push({key:{status:"valid",value:f},value:_._parse(new Ae(n,y,n.path,f)),alwaysSet:f in n.data})}if(this._def.catchall instanceof Pe){const f=this._def.unknownKeys;if(f==="passthrough")for(const _ of o)d.push({key:{status:"valid",value:_},value:{status:"valid",value:n.data[_]}});else if(f==="strict")o.length>0&&(k(n,{code:m.unrecognized_keys,keys:o}),s.dirty());else if(f!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const f=this._def.catchall;for(const _ of o){const y=n.data[_];d.push({key:{status:"valid",value:_},value:f._parse(new Ae(n,y,n.path,_)),alwaysSet:_ in n.data})}}return n.common.async?Promise.resolve().then(async()=>{const f=[];for(const _ of d){const y=await _.key,v=await _.value;f.push({key:y,value:v,alwaysSet:_.alwaysSet})}return f}).then(f=>se.mergeObjectSync(s,f)):se.mergeObjectSync(s,d)}get shape(){return this._def.shape()}strict(e){return T.errToObj,new z({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,s)=>{var a,i;const n=((i=(a=this._def).errorMap)==null?void 0:i.call(a,r,s).message)??s.defaultError;return r.code==="unrecognized_keys"?{message:T.errToObj(e).message??n}:{message:n}}}:{}})}strip(){return new z({...this._def,unknownKeys:"strip"})}passthrough(){return new z({...this._def,unknownKeys:"passthrough"})}extend(e){return new z({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new z({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:N.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new z({...this._def,catchall:e})}pick(e){const r={};for(const s of P.objectKeys(e))e[s]&&this.shape[s]&&(r[s]=this.shape[s]);return new z({...this._def,shape:()=>r})}omit(e){const r={};for(const s of P.objectKeys(this.shape))e[s]||(r[s]=this.shape[s]);return new z({...this._def,shape:()=>r})}deepPartial(){return tt(this)}partial(e){const r={};for(const s of P.objectKeys(this.shape)){const n=this.shape[s];e&&!e[s]?r[s]=n:r[s]=n.optional()}return new z({...this._def,shape:()=>r})}required(e){const r={};for(const s of P.objectKeys(this.shape))if(e&&!e[s])r[s]=this.shape[s];else{let a=this.shape[s];for(;a instanceof je;)a=a._def.innerType;r[s]=a}return new z({...this._def,shape:()=>r})}keyof(){return ss(P.objectKeys(this.shape))}}z.create=(t,e)=>new z({shape:()=>t,unknownKeys:"strip",catchall:Pe.create(),typeName:N.ZodObject,...E(e)});z.strictCreate=(t,e)=>new z({shape:()=>t,unknownKeys:"strict",catchall:Pe.create(),typeName:N.ZodObject,...E(e)});z.lazycreate=(t,e)=>new z({shape:t,unknownKeys:"strip",catchall:Pe.create(),typeName:N.ZodObject,...E(e)});class _t extends O{_parse(e){const{ctx:r}=this._processInputParams(e),s=this._def.options;function n(a){for(const o of a)if(o.result.status==="valid")return o.result;for(const o of a)if(o.result.status==="dirty")return r.common.issues.push(...o.ctx.common.issues),o.result;const i=a.map(o=>new me(o.ctx.common.issues));return k(r,{code:m.invalid_union,unionErrors:i}),A}if(r.common.async)return Promise.all(s.map(async a=>{const i={...r,common:{...r.common,issues:[]},parent:null};return{result:await a._parseAsync({data:r.data,path:r.path,parent:i}),ctx:i}})).then(n);{let a;const i=[];for(const d of s){const f={...r,common:{...r.common,issues:[]},parent:null},_=d._parseSync({data:r.data,path:r.path,parent:f});if(_.status==="valid")return _;_.status==="dirty"&&!a&&(a={result:_,ctx:f}),f.common.issues.length&&i.push(f.common.issues)}if(a)return r.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(d=>new me(d));return k(r,{code:m.invalid_union,unionErrors:o}),A}}get options(){return this._def.options}}_t.create=(t,e)=>new _t({options:t,typeName:N.ZodUnion,...E(e)});const Ve=t=>t instanceof kt?Ve(t.schema):t instanceof xe?Ve(t.innerType()):t instanceof wt?[t.value]:t instanceof ze?t.options:t instanceof St?P.objectValues(t.enum):t instanceof Tt?Ve(t._def.innerType):t instanceof gt?[void 0]:t instanceof vt?[null]:t instanceof je?[void 0,...Ve(t.unwrap())]:t instanceof Be?[null,...Ve(t.unwrap())]:t instanceof lr||t instanceof At?Ve(t.unwrap()):t instanceof jt?Ve(t._def.innerType):[];class qt extends O{_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==S.object)return k(r,{code:m.invalid_type,expected:S.object,received:r.parsedType}),A;const s=this.discriminator,n=r.data[s],a=this.optionsMap.get(n);return a?r.common.async?a._parseAsync({data:r.data,path:r.path,parent:r}):a._parseSync({data:r.data,path:r.path,parent:r}):(k(r,{code:m.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),A)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,s){const n=new Map;for(const a of r){const i=Ve(a.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of i){if(n.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);n.set(o,a)}}return new qt({typeName:N.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:n,...E(s)})}}function rr(t,e){const r=Fe(t),s=Fe(e);if(t===e)return{valid:!0,data:t};if(r===S.object&&s===S.object){const n=P.objectKeys(e),a=P.objectKeys(t).filter(o=>n.indexOf(o)!==-1),i={...t,...e};for(const o of a){const d=rr(t[o],e[o]);if(!d.valid)return{valid:!1};i[o]=d.data}return{valid:!0,data:i}}else if(r===S.array&&s===S.array){if(t.length!==e.length)return{valid:!1};const n=[];for(let a=0;a<t.length;a++){const i=t[a],o=e[a],d=rr(i,o);if(!d.valid)return{valid:!1};n.push(d.data)}return{valid:!0,data:n}}else return r===S.date&&s===S.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class bt extends O{_parse(e){const{status:r,ctx:s}=this._processInputParams(e),n=(a,i)=>{if(er(a)||er(i))return A;const o=rr(a.value,i.value);return o.valid?((tr(a)||tr(i))&&r.dirty(),{status:r.value,value:o.data}):(k(s,{code:m.invalid_intersection_types}),A)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([a,i])=>n(a,i)):n(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}bt.create=(t,e,r)=>new bt({left:t,right:e,typeName:N.ZodIntersection,...E(r)});class Ne extends O{_parse(e){const{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==S.array)return k(s,{code:m.invalid_type,expected:S.array,received:s.parsedType}),A;if(s.data.length<this._def.items.length)return k(s,{code:m.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),A;!this._def.rest&&s.data.length>this._def.items.length&&(k(s,{code:m.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const a=[...s.data].map((i,o)=>{const d=this._def.items[o]||this._def.rest;return d?d._parse(new Ae(s,i,s.path,o)):null}).filter(i=>!!i);return s.common.async?Promise.all(a).then(i=>se.mergeArray(r,i)):se.mergeArray(r,a)}get items(){return this._def.items}rest(e){return new Ne({...this._def,rest:e})}}Ne.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ne({items:t,typeName:N.ZodTuple,rest:null,...E(e)})};class xt extends O{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==S.object)return k(s,{code:m.invalid_type,expected:S.object,received:s.parsedType}),A;const n=[],a=this._def.keyType,i=this._def.valueType;for(const o in s.data)n.push({key:a._parse(new Ae(s,o,s.path,o)),value:i._parse(new Ae(s,s.data[o],s.path,o)),alwaysSet:o in s.data});return s.common.async?se.mergeObjectAsync(r,n):se.mergeObjectSync(r,n)}get element(){return this._def.valueType}static create(e,r,s){return r instanceof O?new xt({keyType:e,valueType:r,typeName:N.ZodRecord,...E(s)}):new xt({keyType:_e.create(),valueType:e,typeName:N.ZodRecord,...E(r)})}}class Ut extends O{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==S.map)return k(s,{code:m.invalid_type,expected:S.map,received:s.parsedType}),A;const n=this._def.keyType,a=this._def.valueType,i=[...s.data.entries()].map(([o,d],f)=>({key:n._parse(new Ae(s,o,s.path,[f,"key"])),value:a._parse(new Ae(s,d,s.path,[f,"value"]))}));if(s.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const d of i){const f=await d.key,_=await d.value;if(f.status==="aborted"||_.status==="aborted")return A;(f.status==="dirty"||_.status==="dirty")&&r.dirty(),o.set(f.value,_.value)}return{status:r.value,value:o}})}else{const o=new Map;for(const d of i){const f=d.key,_=d.value;if(f.status==="aborted"||_.status==="aborted")return A;(f.status==="dirty"||_.status==="dirty")&&r.dirty(),o.set(f.value,_.value)}return{status:r.value,value:o}}}}Ut.create=(t,e,r)=>new Ut({valueType:e,keyType:t,typeName:N.ZodMap,...E(r)});class Ge extends O{_parse(e){const{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==S.set)return k(s,{code:m.invalid_type,expected:S.set,received:s.parsedType}),A;const n=this._def;n.minSize!==null&&s.data.size<n.minSize.value&&(k(s,{code:m.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),r.dirty()),n.maxSize!==null&&s.data.size>n.maxSize.value&&(k(s,{code:m.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),r.dirty());const a=this._def.valueType;function i(d){const f=new Set;for(const _ of d){if(_.status==="aborted")return A;_.status==="dirty"&&r.dirty(),f.add(_.value)}return{status:r.value,value:f}}const o=[...s.data.values()].map((d,f)=>a._parse(new Ae(s,d,s.path,f)));return s.common.async?Promise.all(o).then(d=>i(d)):i(o)}min(e,r){return new Ge({...this._def,minSize:{value:e,message:T.toString(r)}})}max(e,r){return new Ge({...this._def,maxSize:{value:e,message:T.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}}Ge.create=(t,e)=>new Ge({valueType:t,minSize:null,maxSize:null,typeName:N.ZodSet,...E(e)});class st extends O{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==S.function)return k(r,{code:m.invalid_type,expected:S.function,received:r.parsedType}),A;function s(o,d){return Zt({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Mt(),nt].filter(f=>!!f),issueData:{code:m.invalid_arguments,argumentsError:d}})}function n(o,d){return Zt({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Mt(),nt].filter(f=>!!f),issueData:{code:m.invalid_return_type,returnTypeError:d}})}const a={errorMap:r.common.contextualErrorMap},i=r.data;if(this._def.returns instanceof it){const o=this;return ie(async function(...d){const f=new me([]),_=await o._def.args.parseAsync(d,a).catch(W=>{throw f.addIssue(s(d,W)),f}),y=await Reflect.apply(i,this,_);return await o._def.returns._def.type.parseAsync(y,a).catch(W=>{throw f.addIssue(n(y,W)),f})})}else{const o=this;return ie(function(...d){const f=o._def.args.safeParse(d,a);if(!f.success)throw new me([s(d,f.error)]);const _=Reflect.apply(i,this,f.data),y=o._def.returns.safeParse(_,a);if(!y.success)throw new me([n(_,y.error)]);return y.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new st({...this._def,args:Ne.create(e).rest(Ye.create())})}returns(e){return new st({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,s){return new st({args:e||Ne.create([]).rest(Ye.create()),returns:r||Ye.create(),typeName:N.ZodFunction,...E(s)})}}class kt extends O{get schema(){return this._def.getter()}_parse(e){const{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}}kt.create=(t,e)=>new kt({getter:t,typeName:N.ZodLazy,...E(e)});class wt extends O{_parse(e){if(e.data!==this._def.value){const r=this._getOrReturnCtx(e);return k(r,{received:r.data,code:m.invalid_literal,expected:this._def.value}),A}return{status:"valid",value:e.data}}get value(){return this._def.value}}wt.create=(t,e)=>new wt({value:t,typeName:N.ZodLiteral,...E(e)});function ss(t,e){return new ze({values:t,typeName:N.ZodEnum,...E(e)})}class ze extends O{_parse(e){if(typeof e.data!="string"){const r=this._getOrReturnCtx(e),s=this._def.values;return k(r,{expected:P.joinValues(s),received:r.parsedType,code:m.invalid_type}),A}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const r=this._getOrReturnCtx(e),s=this._def.values;return k(r,{received:r.data,code:m.invalid_enum_value,options:s}),A}return ie(e.data)}get options(){return this._def.values}get enum(){const e={};for(const r of this._def.values)e[r]=r;return e}get Values(){const e={};for(const r of this._def.values)e[r]=r;return e}get Enum(){const e={};for(const r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return ze.create(e,{...this._def,...r})}exclude(e,r=this._def){return ze.create(this.options.filter(s=>!e.includes(s)),{...this._def,...r})}}ze.create=ss;class St extends O{_parse(e){const r=P.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==S.string&&s.parsedType!==S.number){const n=P.objectValues(r);return k(s,{expected:P.joinValues(n),received:s.parsedType,code:m.invalid_type}),A}if(this._cache||(this._cache=new Set(P.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const n=P.objectValues(r);return k(s,{received:s.data,code:m.invalid_enum_value,options:n}),A}return ie(e.data)}get enum(){return this._def.values}}St.create=(t,e)=>new St({values:t,typeName:N.ZodNativeEnum,...E(e)});class it extends O{unwrap(){return this._def.type}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==S.promise&&r.common.async===!1)return k(r,{code:m.invalid_type,expected:S.promise,received:r.parsedType}),A;const s=r.parsedType===S.promise?r.data:Promise.resolve(r.data);return ie(s.then(n=>this._def.type.parseAsync(n,{path:r.path,errorMap:r.common.contextualErrorMap})))}}it.create=(t,e)=>new it({type:t,typeName:N.ZodPromise,...E(e)});class xe extends O{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===N.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:r,ctx:s}=this._processInputParams(e),n=this._def.effect||null,a={addIssue:i=>{k(s,i),i.fatal?r.abort():r.dirty()},get path(){return s.path}};if(a.addIssue=a.addIssue.bind(a),n.type==="preprocess"){const i=n.transform(s.data,a);if(s.common.async)return Promise.resolve(i).then(async o=>{if(r.value==="aborted")return A;const d=await this._def.schema._parseAsync({data:o,path:s.path,parent:s});return d.status==="aborted"?A:d.status==="dirty"||r.value==="dirty"?rt(d.value):d});{if(r.value==="aborted")return A;const o=this._def.schema._parseSync({data:i,path:s.path,parent:s});return o.status==="aborted"?A:o.status==="dirty"||r.value==="dirty"?rt(o.value):o}}if(n.type==="refinement"){const i=o=>{const d=n.refinement(o,a);if(s.common.async)return Promise.resolve(d);if(d instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(s.common.async===!1){const o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return o.status==="aborted"?A:(o.status==="dirty"&&r.dirty(),i(o.value),{status:r.value,value:o.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>o.status==="aborted"?A:(o.status==="dirty"&&r.dirty(),i(o.value).then(()=>({status:r.value,value:o.value}))))}if(n.type==="transform")if(s.common.async===!1){const i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!Je(i))return A;const o=n.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:o}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>Je(i)?Promise.resolve(n.transform(i.value,a)).then(o=>({status:r.value,value:o})):A);P.assertNever(n)}}xe.create=(t,e,r)=>new xe({schema:t,typeName:N.ZodEffects,effect:e,...E(r)});xe.createWithPreprocess=(t,e,r)=>new xe({schema:e,effect:{type:"preprocess",transform:t},typeName:N.ZodEffects,...E(r)});class je extends O{_parse(e){return this._getType(e)===S.undefined?ie(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}je.create=(t,e)=>new je({innerType:t,typeName:N.ZodOptional,...E(e)});class Be extends O{_parse(e){return this._getType(e)===S.null?ie(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Be.create=(t,e)=>new Be({innerType:t,typeName:N.ZodNullable,...E(e)});class Tt extends O{_parse(e){const{ctx:r}=this._processInputParams(e);let s=r.data;return r.parsedType===S.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}Tt.create=(t,e)=>new Tt({innerType:t,typeName:N.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...E(e)});class jt extends O{_parse(e){const{ctx:r}=this._processInputParams(e),s={...r,common:{...r.common,issues:[]}},n=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return pt(n)?n.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new me(s.common.issues)},input:s.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new me(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}jt.create=(t,e)=>new jt({innerType:t,typeName:N.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...E(e)});class zt extends O{_parse(e){if(this._getType(e)!==S.nan){const s=this._getOrReturnCtx(e);return k(s,{code:m.invalid_type,expected:S.nan,received:s.parsedType}),A}return{status:"valid",value:e.data}}}zt.create=t=>new zt({typeName:N.ZodNaN,...E(t)});const _n=Symbol("zod_brand");class lr extends O{_parse(e){const{ctx:r}=this._processInputParams(e),s=r.data;return this._def.type._parse({data:s,path:r.path,parent:r})}unwrap(){return this._def.type}}class Ct extends O{_parse(e){const{status:r,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?A:a.status==="dirty"?(r.dirty(),rt(a.value)):this._def.out._parseAsync({data:a.value,path:s.path,parent:s})})();{const n=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?A:n.status==="dirty"?(r.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:s.path,parent:s})}}static create(e,r){return new Ct({in:e,out:r,typeName:N.ZodPipeline})}}class At extends O{_parse(e){const r=this._def.innerType._parse(e),s=n=>(Je(n)&&(n.value=Object.freeze(n.value)),n);return pt(r)?r.then(n=>s(n)):s(r)}unwrap(){return this._def.innerType}}At.create=(t,e)=>new At({innerType:t,typeName:N.ZodReadonly,...E(e)});function Ir(t,e){const r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function ns(t,e={},r){return t?at.create().superRefine((s,n)=>{const a=t(s);if(a instanceof Promise)return a.then(i=>{if(!i){const o=Ir(e,s),d=o.fatal??r??!0;n.addIssue({code:"custom",...o,fatal:d})}});if(!a){const i=Ir(e,s),o=i.fatal??r??!0;n.addIssue({code:"custom",...i,fatal:o})}}):at.create()}const bn={object:z.lazycreate};var N;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(N||(N={}));const xn=(t,e={message:`Input not instance of ${t.name}`})=>ns(r=>r instanceof t,e),as=_e.create,is=$e.create,kn=zt.create,wn=Ue.create,os=yt.create,Sn=He.create,Tn=Lt.create,jn=gt.create,An=vt.create,Nn=at.create,En=Ye.create,Cn=Pe.create,Rn=$t.create,On=be.create,Vn=z.create,Fn=z.strictCreate,Pn=_t.create,In=qt.create,Dn=bt.create,Mn=Ne.create,Zn=xt.create,Ln=Ut.create,$n=Ge.create,Un=st.create,zn=kt.create,Bn=wt.create,Wn=ze.create,qn=St.create,Yn=it.create,Dr=xe.create,Jn=je.create,Hn=Be.create,Gn=xe.createWithPreprocess,Xn=Ct.create,Qn=()=>as().optional(),Kn=()=>is().optional(),ea=()=>os().optional(),ta={string:t=>_e.create({...t,coerce:!0}),number:t=>$e.create({...t,coerce:!0}),boolean:t=>yt.create({...t,coerce:!0}),bigint:t=>Ue.create({...t,coerce:!0}),date:t=>He.create({...t,coerce:!0})},ra=A,Oe=Object.freeze(Object.defineProperty({__proto__:null,BRAND:_n,DIRTY:rt,EMPTY_PATH:Gs,INVALID:A,NEVER:ra,OK:ie,ParseStatus:se,Schema:O,ZodAny:at,ZodArray:be,ZodBigInt:Ue,ZodBoolean:yt,ZodBranded:lr,ZodCatch:jt,ZodDate:He,ZodDefault:Tt,ZodDiscriminatedUnion:qt,ZodEffects:xe,ZodEnum:ze,ZodError:me,get ZodFirstPartyTypeKind(){return N},ZodFunction:st,ZodIntersection:bt,ZodIssueCode:m,ZodLazy:kt,ZodLiteral:wt,ZodMap:Ut,ZodNaN:zt,ZodNativeEnum:St,ZodNever:Pe,ZodNull:vt,ZodNullable:Be,ZodNumber:$e,ZodObject:z,ZodOptional:je,ZodParsedType:S,ZodPipeline:Ct,ZodPromise:it,ZodReadonly:At,ZodRecord:xt,ZodSchema:O,ZodSet:Ge,ZodString:_e,ZodSymbol:Lt,ZodTransformer:xe,ZodTuple:Ne,ZodType:O,ZodUndefined:gt,ZodUnion:_t,ZodUnknown:Ye,ZodVoid:$t,addIssueToContext:k,any:Nn,array:On,bigint:wn,boolean:os,coerce:ta,custom:ns,date:Sn,datetimeRegex:rs,defaultErrorMap:nt,discriminatedUnion:In,effect:Dr,enum:Wn,function:Un,getErrorMap:Mt,getParsedType:Fe,instanceof:xn,intersection:Dn,isAborted:er,isAsync:pt,isDirty:tr,isValid:Je,late:bn,lazy:zn,literal:Bn,makeIssue:Zt,map:Ln,nan:kn,nativeEnum:qn,never:Cn,null:An,nullable:Hn,number:is,object:Vn,get objectUtil(){return Kt},oboolean:ea,onumber:Kn,optional:Jn,ostring:Qn,pipeline:Xn,preprocess:Gn,promise:Yn,quotelessJson:Js,record:Zn,set:$n,setErrorMap:Hs,strictObject:Fn,string:as,symbol:Tn,transformer:Dr,tuple:Mn,undefined:jn,union:Pn,unknown:En,get util(){return P},void:Rn},Symbol.toStringTag,{value:"Module"})),Bt=t=>p.jsx("button",{type:t.type||"button",disabled:t.isDisabled,className:`bg-green-500 hover:bg-green-600 text-white px-6 py-2 rounded disabled:opacity-50 *:disabled:cursor-not-allowed ${t.className}`,onClick:t.handleClick,children:t.title}),sa=({label:t,required:e=!1,file:r,onFileChange:s,error:n})=>{const a=V.useRef(null),[i,o]=V.useState(null),[d,f]=V.useState(!1),_=v=>{var te;const W=(te=v.target.files)==null?void 0:te[0];W&&(s(W),o(URL.createObjectURL(W)))},y=V.useCallback(()=>{var v;(v=a.current)==null||v.click()},[]);return V.useEffect(()=>{r&&o(URL.createObjectURL(r))},[r]),p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"flex flex-col",children:[p.jsxs("label",{className:"font-medium mb-1 text-gray-700",children:[t,e&&p.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),p.jsxs("div",{className:"flex items-center",children:[p.jsx("button",{type:"button",onClick:y,className:"bg-green-500 hover:bg-green-600 text-white px-4 py-2 rounded",children:"Upload file"}),p.jsx("input",{ref:a,type:"file",accept:"image/*,.pdf",className:"hidden",onChange:_})]}),p.jsx("div",{className:"mt-2 h-40 w-full bg-gray-200 rounded overflow-hidden flex items-center justify-center cursor-pointer",onClick:()=>i&&f(!0),children:i?(r==null?void 0:r.type)==="application/pdf"?p.jsx("object",{data:i,type:"application/pdf",width:"100%",height:"100%",children:p.jsxs("p",{className:"text-gray-600 text-sm",children:["Cannot preview PDF."," ",p.jsx("a",{href:i,target:"_blank",rel:"noreferrer",className:"text-blue-600 underline",children:"Download PDF"})]})}):p.jsx("img",{src:i,alt:"Preview",className:"h-full object-contain"}):p.jsx("span",{className:"text-gray-500",children:"No file selected"})}),n&&p.jsx("span",{className:"text-red-500 text-sm mt-1",children:n})]}),d&&i&&p.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-75 z-50 flex items-center justify-center",onClick:()=>f(!1),children:p.jsxs("div",{className:"relative w-full h-full",onClick:v=>v.stopPropagation(),children:[p.jsx("button",{onClick:()=>f(!1),className:"absolute top-2 right-2 text-white text-2xl","aria-label":"Close preview",children:"×"}),(r==null?void 0:r.type)==="application/pdf"?p.jsx("object",{data:i,type:"application/pdf",className:"w-full h-full object-contain"}):p.jsx("img",{src:i,alt:"Full Preview",className:"w-full h-full object-contain"})]})})]})},Ze=V.forwardRef(({label:t,required:e=!1,error:r,...s},n)=>p.jsxs("div",{className:"flex flex-col",children:[p.jsxs("label",{htmlFor:s.name,className:"font-medium mb-1 text-gray-700",children:[t,e&&p.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),p.jsx("input",{id:s.name,ref:n,...s,className:`border rounded px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500 ${r?"border-red-500":"border-gray-300"}`}),r&&p.jsx("span",{className:"text-red-500 text-sm mt-1",children:r})]}));Ze.displayName="InputField";const Nt=Mr(t=>({selectedProvider:null,form:{taxCode:"",companyName:"",representative:"",position:"",email:"",phoneNumber:null,address:"",license:null},selectedPlan:null,setSelectedProvider:e=>t({selectedProvider:e}),setForm:e=>t(r=>({form:{...r.form,...e}})),setSelectedPlan:e=>t({selectedPlan:e}),reset:()=>t({selectedProvider:null,form:{taxCode:"",companyName:"",representative:"",position:"",email:"",phoneNumber:null,address:"",license:null},selectedPlan:null})})),na=Oe.object({taxCode:Oe.string().nonempty("Mã số thuế là bắt buộc"),representative:Oe.string().nonempty("Người đại diện là bắt buộc"),email:Oe.string().nonempty("Email là bắt buộc").email("Email không hợp lệ"),address:Oe.string().nonempty("Địa chỉ là bắt buộc"),companyName:Oe.string().nonempty("Tên công ty là bắt buộc"),position:Oe.string().optional(),phone:Oe.string().regex(/^[0-9()+\-\s]+$/,"SĐT không hợp lệ").optional(),license:Oe.instanceof(File,{message:"Giấy phép đăng ký kinh doanh là bắt buộc"}).optional()}),aa=()=>{const t=ce.useNavigate(),e=Nt(y=>y.form),{control:r,handleSubmit:s,formState:{errors:n,isSubmitting:a,isValid:i}}=zs({resolver:Ys(na),defaultValues:{taxCode:e.taxCode||"",representative:e.representative||"",email:e.email||"",address:e.address||"",companyName:e.companyName||"",position:e.position||"",phone:e.phoneNumber||"",license:e.license||void 0}}),o=Nt(y=>y.setForm),d=mt(y=>y.nextStep),f=mt(y=>y.prevStep),_=y=>{console.log(y),o({taxCode:y.taxCode,representative:y.representative,email:y.email,address:y.address,companyName:y.companyName,position:y.position,phoneNumber:y.phone||null,license:y.license||null})};return p.jsxs("form",{onSubmit:s(_),className:"w-full mx-auto p-6 bg-white shadow rounded",children:[p.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:[p.jsxs("div",{className:"space-y-4",children:[p.jsx(Me,{name:"taxCode",control:r,render:({field:y})=>{var v;return p.jsx(Ze,{...y,label:"Mã số thuế",required:!0,error:(v=n.taxCode)==null?void 0:v.message})}}),p.jsx(Me,{name:"representative",control:r,render:({field:y})=>{var v;return p.jsx(Ze,{...y,label:"Người đại diện",required:!0,error:(v=n.representative)==null?void 0:v.message})}}),p.jsx(Me,{name:"email",control:r,render:({field:y})=>{var v;return p.jsx(Ze,{...y,label:"Email",type:"email",required:!0,error:(v=n.email)==null?void 0:v.message})}}),p.jsx(Me,{name:"address",control:r,render:({field:y})=>{var v;return p.jsx(Ze,{...y,label:"Địa chỉ",required:!0,error:(v=n.address)==null?void 0:v.message})}}),p.jsx(Me,{name:"license",control:r,render:({field:y})=>{var v;return p.jsx(sa,{label:"Giấy phép đăng ký kinh doanh",required:!0,file:y.value??null,onFileChange:y.onChange,error:(v=n.license)==null?void 0:v.message})}})]}),p.jsxs("div",{className:"space-y-4",children:[p.jsx(Me,{name:"companyName",control:r,render:({field:y})=>{var v;return p.jsx(Ze,{...y,label:"Tên công ty",required:!0,error:(v=n.companyName)==null?void 0:v.message})}}),p.jsx(Me,{name:"position",control:r,render:({field:y})=>{var v;return p.jsx(Ze,{...y,label:"Chức vụ",error:(v=n.position)==null?void 0:v.message})}}),p.jsx(Me,{name:"phone",control:r,render:({field:y})=>{var v;return p.jsx(Ze,{...y,label:"SĐT",type:"tel",error:(v=n.phone)==null?void 0:v.message})}})]})]}),p.jsxs("div",{className:"flex items-center justify-end gap-2",children:[p.jsx(Bt,{title:"Back",handleClick:()=>{f(),t("/select-provider")},className:" !bg-gray-200 !text-gray-700 hover:!bg-gray-300 disabled:!bg-gray-200 disabled:!text-gray-500"}),p.jsx(Bt,{type:"submit",title:a?"Submitting...":"Submit",isDisabled:a||Object.keys(n).length>0||!i,handleClick:()=>{d(),t("/select-plan")}})]})]})},ia=({options:t,value:e,onChange:r})=>p.jsx("fieldset",{role:"radiogroup","aria-label":"Chọn gói đăng ký",className:"flex flex-col md:flex-row gap-4 md:gap-20",children:t.map(s=>{const n=s.value===e;return p.jsxs("label",{className:["flex items-center cursor-pointer rounded-lg border p-4 transition",n?"border-green-500 bg-green-50":"border-gray-300 bg-white hover:bg-gray-50"].join(" "),children:[p.jsx("input",{type:"radio",name:"subscription",value:s.value,checked:n,onChange:()=>r(s.value),className:"sr-only"}),p.jsx("span",{className:["flex-shrink-0 flex items-center justify-center rounded-full mr-3",n?"w-5 h-5 border-2 border-green-500 bg-green-500":"w-4 h-4 border border-gray-400"].join(" "),children:n&&p.jsx("span",{className:"block w-2 h-2 bg-white rounded-full"})}),p.jsx("span",{className:n?"text-green-700 font-medium":"text-gray-700",children:s.label})]},s.value)})}),oa=()=>{const t=ce.useNavigate(),e=mt(a=>a.nextStep),[r,s]=V.useState("300"),n=[{value:"100",label:"100 đơn/tháng"},{value:"300",label:"300 đơn/tháng"},{value:"500",label:"500 đơn/tháng"}];return p.jsxs("div",{className:"w-full flex flex-col gap-6",children:[p.jsx("h2",{className:"heading",children:"Select subscription package"}),p.jsx(ia,{options:n,value:r,onChange:s}),p.jsx("div",{className:"text-right",children:p.jsx(Bt,{title:"Next",isDisabled:!r,handleClick:()=>{e(),t("/status")}})})]})},ca=({checked:t,setChecked:e})=>p.jsxs("label",{className:"relative inline-flex cursor-pointer items-center",children:[p.jsx("input",{type:"checkbox",className:"peer sr-only",checked:t,onChange:r=>e(r.target.checked)}),p.jsx("div",{className:"border-[#ACADAE] relative h-5 w-5 rounded-full border-2 before:absolute before:left-1/2 before:top-1/2 before:hidden before:h-2.5 before:w-2.5 before:-translate-x-1/2 before:-translate-y-1/2 before:rounded-full before:bg-green-500 peer-checked:border-green-500 peer-checked:before:block"})]}),la=[{name:"M-Invoice",route:"m-invoice"},{name:"FPT",route:"fpt"},{name:"Misa",route:"misa"}],ua=({provider:t,handleProviderChange:e})=>{const r=Nt(s=>s.selectedProvider);return p.jsxs("div",{"data-checked":r===t.route,className:`flex items-center justify-center gap-2 px-4 py-2 border border-gray-300 rounded-md hover:bg-gray-100 cursor-pointer\r
|
|
22
|
+
<%s key={someKey} {...props} />`,H,G,we,G),Ne[G+H]=!0)}if(G=null,U!==void 0&&(r(U),G=""+U),i(C)&&(r(C.key),G=""+C.key),"key"in C){U={};for(var We in C)We!=="key"&&(U[We]=C[We])}else U=C;return G&&o(U,typeof m=="function"?m.displayName||m.name||"Unknown":m),h(m,G,de,ke,n(),U,ot,Be)}function x(m){typeof m=="object"&&m!==null&&m.$$typeof===W&&m._store&&(m._store.validated=1)}var T=O,W=Symbol.for("react.transitional.element"),te=Symbol.for("react.portal"),Z=Symbol.for("react.fragment"),z=Symbol.for("react.strict_mode"),pe=Symbol.for("react.profiler"),R=Symbol.for("react.consumer"),ce=Symbol.for("react.context"),re=Symbol.for("react.forward_ref"),q=Symbol.for("react.suspense"),Xe=Symbol.for("react.suspense_list"),xe=Symbol.for("react.memo"),Qe=Symbol.for("react.lazy"),le=Symbol.for("react.activity"),je=Symbol.for("react.client.reference"),ie=T.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=Object.prototype.hasOwnProperty,I=Array.isArray,$=console.createTask?console.createTask:function(){return null};T={"react-stack-bottom-frame":function(m){return m()}};var Q,K={},ue=T["react-stack-bottom-frame"].bind(T,a)(),Pe=$(s(a)),Ne={};lt.Fragment=Z,lt.jsx=function(m,C,U,H,ke){var de=1e4>ie.recentlyCreatedOwnerStacks++;return f(m,C,U,!1,H,ke,de?Error("react-stack-top-frame"):ue,de?$(s(m)):Pe)},lt.jsxs=function(m,C,U,H,ke){var de=1e4>ie.recentlyCreatedOwnerStacks++;return f(m,C,U,!0,H,ke,de?Error("react-stack-top-frame"):ue,de?$(s(m)):Pe)}}()),lt}var vr;function ys(){return vr||(vr=1,process.env.NODE_ENV==="production"?Rt.exports=ms():Rt.exports=ps()),Rt.exports}var y=ys();const _r=t=>{let e;const r=new Set,s=(h,f)=>{const x=typeof h=="function"?h(e):h;if(!Object.is(x,e)){const T=e;e=f??(typeof x!="object"||x===null)?x:Object.assign({},e,x),r.forEach(W=>W(e,T))}},n=()=>e,o={setState:s,getState:n,getInitialState:()=>d,subscribe:h=>(r.add(h),()=>r.delete(h))},d=e=t(s,n,o);return o},gs=t=>t?_r(t):_r,vs=t=>t;function _s(t,e=vs){const r=O.useSyncExternalStore(t.subscribe,()=>e(t.getState()),()=>e(t.getInitialState()));return O.useDebugValue(r),r}const br=t=>{const e=gs(t),r=s=>_s(e,s);return Object.assign(r,e),r},Dr=t=>t?br(t):br,st=Dr(t=>({step:1,nextStep:()=>t(e=>({step:e.step+1})),prevStep:()=>t(e=>({step:Math.max(e.step-1,1)})),reset:()=>t({step:1})})),bs=4,xs=()=>{const{step:t}=st();return y.jsx("div",{className:"w-full relative h-3 bg-gray-200 rounded-full",children:y.jsx("div",{className:"absolute rounded-full bg-green-500",style:{width:`${t/bs*100}%`,height:"100%",transition:"width 0.3s ease-in-out"}})})},ks=({children:t})=>y.jsxs("div",{className:"max-w-[800px] mx-auto py-10 flex flex-col gap-8",children:[y.jsx(xs,{}),t]});var jt=t=>t.type==="checkbox",qe=t=>t instanceof Date,ne=t=>t==null;const Mr=t=>typeof t=="object";var J=t=>!ne(t)&&!Array.isArray(t)&&Mr(t)&&!qe(t),Zr=t=>J(t)&&t.target?jt(t.target)?t.target.checked:t.target.value:t,ws=t=>t.substring(0,t.search(/\.\d+(\.|$)/))||t,Lr=(t,e)=>t.has(ws(e)),Ss=t=>{const e=t.constructor&&t.constructor.prototype;return J(e)&&e.hasOwnProperty("isPrototypeOf")},rr=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function ee(t){let e;const r=Array.isArray(t),s=typeof FileList<"u"?t instanceof FileList:!1;if(t instanceof Date)e=new Date(t);else if(t instanceof Set)e=new Set(t);else if(!(rr&&(t instanceof Blob||s))&&(r||J(t)))if(e=r?[]:{},!r&&!Ss(t))e=t;else for(const n in t)t.hasOwnProperty(n)&&(e[n]=ee(t[n]));else return t;return e}var Bt=t=>Array.isArray(t)?t.filter(Boolean):[],Y=t=>t===void 0,_=(t,e,r)=>{if(!e||!J(t))return r;const s=Bt(e.split(/[,[\].]+?/)).reduce((n,a)=>ne(n)?n:n[a],t);return Y(s)||s===t?Y(t[e])?r:t[e]:s},fe=t=>typeof t=="boolean",sr=t=>/^\w*$/.test(t),$r=t=>Bt(t.replace(/["|']|\]/g,"").split(/\.|\[/)),D=(t,e,r)=>{let s=-1;const n=sr(e)?[e]:$r(e),a=n.length,i=a-1;for(;++s<a;){const o=n[s];let d=r;if(s!==i){const h=t[o];d=J(h)||Array.isArray(h)?h:isNaN(+n[s+1])?{}:[]}if(o==="__proto__"||o==="constructor"||o==="prototype")return;t[o]=d,t=t[o]}};const Vt={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},ye={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Ce={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Ts=O.createContext(null),nr=()=>O.useContext(Ts);var Ur=(t,e,r,s=!0)=>{const n={defaultValues:e._defaultValues};for(const a in t)Object.defineProperty(n,a,{get:()=>{const i=a;return e._proxyFormState[i]!==ye.all&&(e._proxyFormState[i]=!s||ye.all),r&&(r[i]=!0),t[i]}});return n};const ar=typeof window<"u"?pr.useLayoutEffect:pr.useEffect;function As(t){const e=nr(),{control:r=e.control,disabled:s,name:n,exact:a}=t||{},[i,o]=O.useState(r._formState),d=O.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return ar(()=>r._subscribe({name:n,formState:d.current,exact:a,callback:h=>{!s&&o({...r._formState,...h})}}),[n,s,a]),O.useEffect(()=>{d.current.isValid&&r._setValid(!0)},[r]),O.useMemo(()=>Ur(i,r,d.current,!1),[i,r])}var Se=t=>typeof t=="string",zr=(t,e,r,s,n)=>Se(t)?(s&&e.watch.add(t),_(r,t,n)):Array.isArray(t)?t.map(a=>(s&&e.watch.add(a),_(r,a))):(s&&(e.watchAll=!0),r);function Es(t){const e=nr(),{control:r=e.control,name:s,defaultValue:n,disabled:a,exact:i}=t||{},o=O.useRef(n),[d,h]=O.useState(r._getWatch(s,o.current));return ar(()=>r._subscribe({name:s,formState:{values:!0},exact:i,callback:f=>!a&&h(zr(s,r._names,f.values||r._formValues,!1,o.current))}),[s,r,a,i]),O.useEffect(()=>r._removeUnmounted()),d}function js(t){const e=nr(),{name:r,disabled:s,control:n=e.control,shouldUnregister:a}=t,i=Lr(n._names.array,r),o=Es({control:n,name:r,defaultValue:_(n._formValues,r,_(n._defaultValues,r,t.defaultValue)),exact:!0}),d=As({control:n,name:r,exact:!0}),h=O.useRef(t),f=O.useRef(n.register(r,{...t.rules,value:o,...fe(t.disabled)?{disabled:t.disabled}:{}})),x=O.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!_(d.errors,r)},isDirty:{enumerable:!0,get:()=>!!_(d.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!_(d.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!_(d.validatingFields,r)},error:{enumerable:!0,get:()=>_(d.errors,r)}}),[d,r]),T=O.useCallback(z=>f.current.onChange({target:{value:Zr(z),name:r},type:Vt.CHANGE}),[r]),W=O.useCallback(()=>f.current.onBlur({target:{value:_(n._formValues,r),name:r},type:Vt.BLUR}),[r,n._formValues]),te=O.useCallback(z=>{const pe=_(n._fields,r);pe&&z&&(pe._f.ref={focus:()=>z.focus&&z.focus(),select:()=>z.select&&z.select(),setCustomValidity:R=>z.setCustomValidity(R),reportValidity:()=>z.reportValidity()})},[n._fields,r]),Z=O.useMemo(()=>({name:r,value:o,...fe(s)||d.disabled?{disabled:d.disabled||s}:{},onChange:T,onBlur:W,ref:te}),[r,s,d.disabled,T,W,te,o]);return O.useEffect(()=>{const z=n._options.shouldUnregister||a;n.register(r,{...h.current.rules,...fe(h.current.disabled)?{disabled:h.current.disabled}:{}});const pe=(R,ce)=>{const re=_(n._fields,R);re&&re._f&&(re._f.mount=ce)};if(pe(r,!0),z){const R=ee(_(n._options.defaultValues,r));D(n._defaultValues,r,R),Y(_(n._formValues,r))&&D(n._formValues,r,R)}return!i&&n.register(r),()=>{(i?z&&!n._state.action:z)?n.unregister(r):pe(r,!1)}},[r,n,i,a]),O.useEffect(()=>{n._setDisabledField({disabled:s,name:r})},[s,r,n]),O.useMemo(()=>({field:Z,formState:d,fieldState:x}),[Z,d,x])}const De=t=>t.render(js(t));var Br=(t,e,r,s,n)=>e?{...r[t],types:{...r[t]&&r[t].types?r[t].types:{},[s]:n||!0}}:{},ft=t=>Array.isArray(t)?t:[t],xr=()=>{let t=[];return{get observers(){return t},next:n=>{for(const a of t)a.next&&a.next(n)},subscribe:n=>(t.push(n),{unsubscribe:()=>{t=t.filter(a=>a!==n)}}),unsubscribe:()=>{t=[]}}},Xt=t=>ne(t)||!Mr(t);function Ze(t,e){if(Xt(t)||Xt(e))return t===e;if(qe(t)&&qe(e))return t.getTime()===e.getTime();const r=Object.keys(t),s=Object.keys(e);if(r.length!==s.length)return!1;for(const n of r){const a=t[n];if(!s.includes(n))return!1;if(n!=="ref"){const i=e[n];if(qe(a)&&qe(i)||J(a)&&J(i)||Array.isArray(a)&&Array.isArray(i)?!Ze(a,i):a!==i)return!1}}return!0}var oe=t=>J(t)&&!Object.keys(t).length,ir=t=>t.type==="file",ge=t=>typeof t=="function",Ft=t=>{if(!rr)return!1;const e=t?t.ownerDocument:0;return t instanceof(e&&e.defaultView?e.defaultView.HTMLElement:HTMLElement)},Wr=t=>t.type==="select-multiple",or=t=>t.type==="radio",Ns=t=>or(t)||jt(t),Ht=t=>Ft(t)&&t.isConnected;function Cs(t,e){const r=e.slice(0,-1).length;let s=0;for(;s<r;)t=Y(t)?s++:t[e[s++]];return t}function Rs(t){for(const e in t)if(t.hasOwnProperty(e)&&!Y(t[e]))return!1;return!0}function X(t,e){const r=Array.isArray(e)?e:sr(e)?[e]:$r(e),s=r.length===1?t:Cs(t,r),n=r.length-1,a=r[n];return s&&delete s[a],n!==0&&(J(s)&&oe(s)||Array.isArray(s)&&Rs(s))&&X(t,r.slice(0,-1)),t}var qr=t=>{for(const e in t)if(ge(t[e]))return!0;return!1};function Pt(t,e={}){const r=Array.isArray(t);if(J(t)||r)for(const s in t)Array.isArray(t[s])||J(t[s])&&!qr(t[s])?(e[s]=Array.isArray(t[s])?[]:{},Pt(t[s],e[s])):ne(t[s])||(e[s]=!0);return e}function Yr(t,e,r){const s=Array.isArray(t);if(J(t)||s)for(const n in t)Array.isArray(t[n])||J(t[n])&&!qr(t[n])?Y(e)||Xt(r[n])?r[n]=Array.isArray(t[n])?Pt(t[n],[]):{...Pt(t[n])}:Yr(t[n],ne(e)?{}:e[n],r[n]):r[n]=!Ze(t[n],e[n]);return r}var ut=(t,e)=>Yr(t,e,Pt(e));const kr={value:!1,isValid:!1},wr={value:!0,isValid:!0};var Jr=t=>{if(Array.isArray(t)){if(t.length>1){const e=t.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:e,isValid:!!e.length}}return t[0].checked&&!t[0].disabled?t[0].attributes&&!Y(t[0].attributes.value)?Y(t[0].value)||t[0].value===""?wr:{value:t[0].value,isValid:!0}:wr:kr}return kr},Hr=(t,{valueAsNumber:e,valueAsDate:r,setValueAs:s})=>Y(t)?t:e?t===""?NaN:t&&+t:r&&Se(t)?new Date(t):s?s(t):t;const Sr={isValid:!1,value:null};var Gr=t=>Array.isArray(t)?t.reduce((e,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:e,Sr):Sr;function Tr(t){const e=t.ref;return ir(e)?e.files:or(e)?Gr(t.refs).value:Wr(e)?[...e.selectedOptions].map(({value:r})=>r):jt(e)?Jr(t.refs).value:Hr(Y(e.value)?t.ref.value:e.value,t)}var Os=(t,e,r,s)=>{const n={};for(const a of t){const i=_(e,a);i&&D(n,a,i._f)}return{criteriaMode:r,names:[...t],fields:n,shouldUseNativeValidation:s}},It=t=>t instanceof RegExp,dt=t=>Y(t)?t:It(t)?t.source:J(t)?It(t.value)?t.value.source:t.value:t,Ar=t=>({isOnSubmit:!t||t===ye.onSubmit,isOnBlur:t===ye.onBlur,isOnChange:t===ye.onChange,isOnAll:t===ye.all,isOnTouch:t===ye.onTouched});const Er="AsyncFunction";var Vs=t=>!!t&&!!t.validate&&!!(ge(t.validate)&&t.validate.constructor.name===Er||J(t.validate)&&Object.values(t.validate).find(e=>e.constructor.name===Er)),Fs=t=>t.mount&&(t.required||t.min||t.max||t.maxLength||t.minLength||t.pattern||t.validate),jr=(t,e,r)=>!r&&(e.watchAll||e.watch.has(t)||[...e.watch].some(s=>t.startsWith(s)&&/^\.\w+/.test(t.slice(s.length))));const ht=(t,e,r,s)=>{for(const n of r||Object.keys(t)){const a=_(t,n);if(a){const{_f:i,...o}=a;if(i){if(i.refs&&i.refs[0]&&e(i.refs[0],n)&&!s)return!0;if(i.ref&&e(i.ref,i.name)&&!s)return!0;if(ht(o,e))break}else if(J(o)&&ht(o,e))break}}};function Nr(t,e,r){const s=_(t,r);if(s||sr(r))return{error:s,name:r};const n=r.split(".");for(;n.length;){const a=n.join("."),i=_(e,a),o=_(t,a);if(i&&!Array.isArray(i)&&r!==a)return{name:r};if(o&&o.type)return{name:a,error:o};if(o&&o.root&&o.root.type)return{name:`${a}.root`,error:o.root};n.pop()}return{name:r}}var Ps=(t,e,r,s)=>{r(t);const{name:n,...a}=t;return oe(a)||Object.keys(a).length>=Object.keys(e).length||Object.keys(a).find(i=>e[i]===(!s||ye.all))},Is=(t,e,r)=>!t||!e||t===e||ft(t).some(s=>s&&(r?s===e:s.startsWith(e)||e.startsWith(s))),Ds=(t,e,r,s,n)=>n.isOnAll?!1:!r&&n.isOnTouch?!(e||t):(r?s.isOnBlur:n.isOnBlur)?!t:(r?s.isOnChange:n.isOnChange)?t:!0,Ms=(t,e)=>!Bt(_(t,e)).length&&X(t,e),Zs=(t,e,r)=>{const s=ft(_(t,r));return D(s,"root",e[r]),D(t,r,s),t},Ot=t=>Se(t);function Cr(t,e,r="validate"){if(Ot(t)||Array.isArray(t)&&t.every(Ot)||fe(t)&&!t)return{type:r,message:Ot(t)?t:"",ref:e}}var Ke=t=>J(t)&&!It(t)?t:{value:t,message:""},Rr=async(t,e,r,s,n,a)=>{const{ref:i,refs:o,required:d,maxLength:h,minLength:f,min:x,max:T,pattern:W,validate:te,name:Z,valueAsNumber:z,mount:pe}=t._f,R=_(r,Z);if(!pe||e.has(Z))return{};const ce=o?o[0]:i,re=F=>{n&&ce.reportValidity&&(ce.setCustomValidity(fe(F)?"":F||""),ce.reportValidity())},q={},Xe=or(i),xe=jt(i),Qe=Xe||xe,le=(z||ir(i))&&Y(i.value)&&Y(R)||Ft(i)&&i.value===""||R===""||Array.isArray(R)&&!R.length,je=Br.bind(null,Z,s,q),ie=(F,I,$,Q=Ce.maxLength,K=Ce.minLength)=>{const ue=F?I:$;q[Z]={type:F?Q:K,message:ue,ref:i,...je(F?Q:K,ue)}};if(a?!Array.isArray(R)||!R.length:d&&(!Qe&&(le||ne(R))||fe(R)&&!R||xe&&!Jr(o).isValid||Xe&&!Gr(o).isValid)){const{value:F,message:I}=Ot(d)?{value:!!d,message:d}:Ke(d);if(F&&(q[Z]={type:Ce.required,message:I,ref:ce,...je(Ce.required,I)},!s))return re(I),q}if(!le&&(!ne(x)||!ne(T))){let F,I;const $=Ke(T),Q=Ke(x);if(!ne(R)&&!isNaN(R)){const K=i.valueAsNumber||R&&+R;ne($.value)||(F=K>$.value),ne(Q.value)||(I=K<Q.value)}else{const K=i.valueAsDate||new Date(R),ue=m=>new Date(new Date().toDateString()+" "+m),Pe=i.type=="time",Ne=i.type=="week";Se($.value)&&R&&(F=Pe?ue(R)>ue($.value):Ne?R>$.value:K>new Date($.value)),Se(Q.value)&&R&&(I=Pe?ue(R)<ue(Q.value):Ne?R<Q.value:K<new Date(Q.value))}if((F||I)&&(ie(!!F,$.message,Q.message,Ce.max,Ce.min),!s))return re(q[Z].message),q}if((h||f)&&!le&&(Se(R)||a&&Array.isArray(R))){const F=Ke(h),I=Ke(f),$=!ne(F.value)&&R.length>+F.value,Q=!ne(I.value)&&R.length<+I.value;if(($||Q)&&(ie($,F.message,I.message),!s))return re(q[Z].message),q}if(W&&!le&&Se(R)){const{value:F,message:I}=Ke(W);if(It(F)&&!R.match(F)&&(q[Z]={type:Ce.pattern,message:I,ref:i,...je(Ce.pattern,I)},!s))return re(I),q}if(te){if(ge(te)){const F=await te(R,r),I=Cr(F,ce);if(I&&(q[Z]={...I,...je(Ce.validate,I.message)},!s))return re(I.message),q}else if(J(te)){let F={};for(const I in te){if(!oe(F)&&!s)break;const $=Cr(await te[I](R,r),ce,I);$&&(F={...$,...je(I,$.message)},re($.message),s&&(q[Z]=F))}if(!oe(F)&&(q[Z]={ref:ce,...F},!s))return q}}return re(!0),q};const Ls={mode:ye.onSubmit,reValidateMode:ye.onChange,shouldFocusError:!0};function $s(t={}){let e={...Ls,...t},r={submitCount:0,isDirty:!1,isReady:!1,isLoading:ge(e.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1};const s={};let n=J(e.defaultValues)||J(e.values)?ee(e.defaultValues||e.values)||{}:{},a=e.shouldUnregister?{}:ee(n),i={action:!1,mount:!1,watch:!1},o={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},d,h=0;const f={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let x={...f};const T={array:xr(),state:xr()},W=e.criteriaMode===ye.all,te=c=>l=>{clearTimeout(h),h=setTimeout(c,l)},Z=async c=>{if(!e.disabled&&(f.isValid||x.isValid||c)){const l=e.resolver?oe((await xe()).errors):await le(s,!0);l!==r.isValid&&T.state.next({isValid:l})}},z=(c,l)=>{!e.disabled&&(f.isValidating||f.validatingFields||x.isValidating||x.validatingFields)&&((c||Array.from(o.mount)).forEach(u=>{u&&(l?D(r.validatingFields,u,l):X(r.validatingFields,u))}),T.state.next({validatingFields:r.validatingFields,isValidating:!oe(r.validatingFields)}))},pe=(c,l=[],u,k,v=!0,g=!0)=>{if(k&&u&&!e.disabled){if(i.action=!0,g&&Array.isArray(_(s,c))){const A=u(_(s,c),k.argA,k.argB);v&&D(s,c,A)}if(g&&Array.isArray(_(r.errors,c))){const A=u(_(r.errors,c),k.argA,k.argB);v&&D(r.errors,c,A),Ms(r.errors,c)}if((f.touchedFields||x.touchedFields)&&g&&Array.isArray(_(r.touchedFields,c))){const A=u(_(r.touchedFields,c),k.argA,k.argB);v&&D(r.touchedFields,c,A)}(f.dirtyFields||x.dirtyFields)&&(r.dirtyFields=ut(n,a)),T.state.next({name:c,isDirty:ie(c,l),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else D(a,c,l)},R=(c,l)=>{D(r.errors,c,l),T.state.next({errors:r.errors})},ce=c=>{r.errors=c,T.state.next({errors:r.errors,isValid:!1})},re=(c,l,u,k)=>{const v=_(s,c);if(v){const g=_(a,c,Y(u)?_(n,c):u);Y(g)||k&&k.defaultChecked||l?D(a,c,l?g:Tr(v._f)):$(c,g),i.mount&&Z()}},q=(c,l,u,k,v)=>{let g=!1,A=!1;const M={name:c};if(!e.disabled){if(!u||k){(f.isDirty||x.isDirty)&&(A=r.isDirty,r.isDirty=M.isDirty=ie(),g=A!==M.isDirty);const L=Ze(_(n,c),l);A=!!_(r.dirtyFields,c),L?X(r.dirtyFields,c):D(r.dirtyFields,c,!0),M.dirtyFields=r.dirtyFields,g=g||(f.dirtyFields||x.dirtyFields)&&A!==!L}if(u){const L=_(r.touchedFields,c);L||(D(r.touchedFields,c,u),M.touchedFields=r.touchedFields,g=g||(f.touchedFields||x.touchedFields)&&L!==u)}g&&v&&T.state.next(M)}return g?M:{}},Xe=(c,l,u,k)=>{const v=_(r.errors,c),g=(f.isValid||x.isValid)&&fe(l)&&r.isValid!==l;if(e.delayError&&u?(d=te(()=>R(c,u)),d(e.delayError)):(clearTimeout(h),d=null,u?D(r.errors,c,u):X(r.errors,c)),(u?!Ze(v,u):v)||!oe(k)||g){const A={...k,...g&&fe(l)?{isValid:l}:{},errors:r.errors,name:c};r={...r,...A},T.state.next(A)}},xe=async c=>{z(c,!0);const l=await e.resolver(a,e.context,Os(c||o.mount,s,e.criteriaMode,e.shouldUseNativeValidation));return z(c),l},Qe=async c=>{const{errors:l}=await xe(c);if(c)for(const u of c){const k=_(l,u);k?D(r.errors,u,k):X(r.errors,u)}else r.errors=l;return l},le=async(c,l,u={valid:!0})=>{for(const k in c){const v=c[k];if(v){const{_f:g,...A}=v;if(g){const M=o.array.has(g.name),L=v._f&&Vs(v._f);L&&f.validatingFields&&z([k],!0);const me=await Rr(v,o.disabled,a,W,e.shouldUseNativeValidation&&!l,M);if(L&&f.validatingFields&&z([k]),me[g.name]&&(u.valid=!1,l))break;!l&&(_(me,g.name)?M?Zs(r.errors,me,g.name):D(r.errors,g.name,me[g.name]):X(r.errors,g.name))}!oe(A)&&await le(A,l,u)}}return u.valid},je=()=>{for(const c of o.unMount){const l=_(s,c);l&&(l._f.refs?l._f.refs.every(u=>!Ht(u)):!Ht(l._f.ref))&&Be(c)}o.unMount=new Set},ie=(c,l)=>!e.disabled&&(c&&l&&D(a,c,l),!Ze(m(),n)),F=(c,l,u)=>zr(c,o,{...i.mount?a:Y(l)?n:Se(c)?{[c]:l}:l},u,l),I=c=>Bt(_(i.mount?a:n,c,e.shouldUnregister?_(n,c,[]):[])),$=(c,l,u={})=>{const k=_(s,c);let v=l;if(k){const g=k._f;g&&(!g.disabled&&D(a,c,Hr(l,g)),v=Ft(g.ref)&&ne(l)?"":l,Wr(g.ref)?[...g.ref.options].forEach(A=>A.selected=v.includes(A.value)):g.refs?jt(g.ref)?g.refs.forEach(A=>{(!A.defaultChecked||!A.disabled)&&(Array.isArray(v)?A.checked=!!v.find(M=>M===A.value):A.checked=v===A.value||!!v)}):g.refs.forEach(A=>A.checked=A.value===v):ir(g.ref)?g.ref.value="":(g.ref.value=v,g.ref.type||T.state.next({name:c,values:ee(a)})))}(u.shouldDirty||u.shouldTouch)&&q(c,v,u.shouldTouch,u.shouldDirty,!0),u.shouldValidate&&Ne(c)},Q=(c,l,u)=>{for(const k in l){if(!l.hasOwnProperty(k))return;const v=l[k],g=c+"."+k,A=_(s,g);(o.array.has(c)||J(v)||A&&!A._f)&&!qe(v)?Q(g,v,u):$(g,v,u)}},K=(c,l,u={})=>{const k=_(s,c),v=o.array.has(c),g=ee(l);D(a,c,g),v?(T.array.next({name:c,values:ee(a)}),(f.isDirty||f.dirtyFields||x.isDirty||x.dirtyFields)&&u.shouldDirty&&T.state.next({name:c,dirtyFields:ut(n,a),isDirty:ie(c,g)})):k&&!k._f&&!ne(g)?Q(c,g,u):$(c,g,u),jr(c,o)&&T.state.next({...r}),T.state.next({name:i.mount?c:void 0,values:ee(a)})},ue=async c=>{i.mount=!0;const l=c.target;let u=l.name,k=!0;const v=_(s,u),g=L=>{k=Number.isNaN(L)||qe(L)&&isNaN(L.getTime())||Ze(L,_(a,u,L))},A=Ar(e.mode),M=Ar(e.reValidateMode);if(v){let L,me;const Ct=l.type?Tr(v._f):Zr(c),Ie=c.type===Vt.BLUR||c.type===Vt.FOCUS_OUT,us=!Fs(v._f)&&!e.resolver&&!_(r.errors,u)&&!v._f.deps||Ds(Ie,_(r.touchedFields,u),r.isSubmitted,M,A),Yt=jr(u,o,Ie);D(a,u,Ct),Ie?(v._f.onBlur&&v._f.onBlur(c),d&&d(0)):v._f.onChange&&v._f.onChange(c);const Jt=q(u,Ct,Ie),ds=!oe(Jt)||Yt;if(!Ie&&T.state.next({name:u,type:c.type,values:ee(a)}),us)return(f.isValid||x.isValid)&&(e.mode==="onBlur"?Ie&&Z():Ie||Z()),ds&&T.state.next({name:u,...Yt?{}:Jt});if(!Ie&&Yt&&T.state.next({...r}),e.resolver){const{errors:hr}=await xe([u]);if(g(Ct),k){const fs=Nr(r.errors,s,u),mr=Nr(hr,s,fs.name||u);L=mr.error,u=mr.name,me=oe(hr)}}else z([u],!0),L=(await Rr(v,o.disabled,a,W,e.shouldUseNativeValidation))[u],z([u]),g(Ct),k&&(L?me=!1:(f.isValid||x.isValid)&&(me=await le(s,!0)));k&&(v._f.deps&&Ne(v._f.deps),Xe(u,me,L,Jt))}},Pe=(c,l)=>{if(_(r.errors,l)&&c.focus)return c.focus(),1},Ne=async(c,l={})=>{let u,k;const v=ft(c);if(e.resolver){const g=await Qe(Y(c)?c:v);u=oe(g),k=c?!v.some(A=>_(g,A)):u}else c?(k=(await Promise.all(v.map(async g=>{const A=_(s,g);return await le(A&&A._f?{[g]:A}:A)}))).every(Boolean),!(!k&&!r.isValid)&&Z()):k=u=await le(s);return T.state.next({...!Se(c)||(f.isValid||x.isValid)&&u!==r.isValid?{}:{name:c},...e.resolver||!c?{isValid:u}:{},errors:r.errors}),l.shouldFocus&&!k&&ht(s,Pe,c?v:o.mount),k},m=c=>{const l={...i.mount?a:n};return Y(c)?l:Se(c)?_(l,c):c.map(u=>_(l,u))},C=(c,l)=>({invalid:!!_((l||r).errors,c),isDirty:!!_((l||r).dirtyFields,c),error:_((l||r).errors,c),isValidating:!!_(r.validatingFields,c),isTouched:!!_((l||r).touchedFields,c)}),U=c=>{c&&ft(c).forEach(l=>X(r.errors,l)),T.state.next({errors:c?r.errors:{}})},H=(c,l,u)=>{const k=(_(s,c,{_f:{}})._f||{}).ref,v=_(r.errors,c)||{},{ref:g,message:A,type:M,...L}=v;D(r.errors,c,{...L,...l,ref:k}),T.state.next({name:c,errors:r.errors,isValid:!1}),u&&u.shouldFocus&&k&&k.focus&&k.focus()},ke=(c,l)=>ge(c)?T.state.subscribe({next:u=>c(F(void 0,l),u)}):F(c,l,!0),de=c=>T.state.subscribe({next:l=>{Is(c.name,l.name,c.exact)&&Ps(l,c.formState||f,ls,c.reRenderRoot)&&c.callback({values:{...a},...r,...l})}}).unsubscribe,ot=c=>(i.mount=!0,x={...x,...c.formState},de({...c,formState:x})),Be=(c,l={})=>{for(const u of c?ft(c):o.mount)o.mount.delete(u),o.array.delete(u),l.keepValue||(X(s,u),X(a,u)),!l.keepError&&X(r.errors,u),!l.keepDirty&&X(r.dirtyFields,u),!l.keepTouched&&X(r.touchedFields,u),!l.keepIsValidating&&X(r.validatingFields,u),!e.shouldUnregister&&!l.keepDefaultValue&&X(n,u);T.state.next({values:ee(a)}),T.state.next({...r,...l.keepDirty?{isDirty:ie()}:{}}),!l.keepIsValid&&Z()},G=({disabled:c,name:l})=>{(fe(c)&&i.mount||c||o.disabled.has(l))&&(c?o.disabled.add(l):o.disabled.delete(l))},we=(c,l={})=>{let u=_(s,c);const k=fe(l.disabled)||fe(e.disabled);return D(s,c,{...u||{},_f:{...u&&u._f?u._f:{ref:{name:c}},name:c,mount:!0,...l}}),o.mount.add(c),u?G({disabled:fe(l.disabled)?l.disabled:e.disabled,name:c}):re(c,!0,l.value),{...k?{disabled:l.disabled||e.disabled}:{},...e.progressive?{required:!!l.required,min:dt(l.min),max:dt(l.max),minLength:dt(l.minLength),maxLength:dt(l.maxLength),pattern:dt(l.pattern)}:{},name:c,onChange:ue,onBlur:ue,ref:v=>{if(v){we(c,l),u=_(s,c);const g=Y(v.value)&&v.querySelectorAll&&v.querySelectorAll("input,select,textarea")[0]||v,A=Ns(g),M=u._f.refs||[];if(A?M.find(L=>L===g):g===u._f.ref)return;D(s,c,{_f:{...u._f,...A?{refs:[...M.filter(Ht),g,...Array.isArray(_(n,c))?[{}]:[]],ref:{type:g.type,name:c}}:{ref:g}}}),re(c,!1,void 0,g)}else u=_(s,c,{}),u._f&&(u._f.mount=!1),(e.shouldUnregister||l.shouldUnregister)&&!(Lr(o.array,c)&&i.action)&&o.unMount.add(c)}}},We=()=>e.shouldFocusError&&ht(s,Pe,o.mount),qt=c=>{fe(c)&&(T.state.next({disabled:c}),ht(s,(l,u)=>{const k=_(s,u);k&&(l.disabled=k._f.disabled||c,Array.isArray(k._f.refs)&&k._f.refs.forEach(v=>{v.disabled=k._f.disabled||c}))},0,!1))},lr=(c,l)=>async u=>{let k;u&&(u.preventDefault&&u.preventDefault(),u.persist&&u.persist());let v=ee(a);if(T.state.next({isSubmitting:!0}),e.resolver){const{errors:g,values:A}=await xe();r.errors=g,v=A}else await le(s);if(o.disabled.size)for(const g of o.disabled)D(v,g,void 0);if(X(r.errors,"root"),oe(r.errors)){T.state.next({errors:{}});try{await c(v,u)}catch(g){k=g}}else l&&await l({...r.errors},u),We(),setTimeout(We);if(T.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:oe(r.errors)&&!k,submitCount:r.submitCount+1,errors:r.errors}),k)throw k},os=(c,l={})=>{_(s,c)&&(Y(l.defaultValue)?K(c,ee(_(n,c))):(K(c,l.defaultValue),D(n,c,ee(l.defaultValue))),l.keepTouched||X(r.touchedFields,c),l.keepDirty||(X(r.dirtyFields,c),r.isDirty=l.defaultValue?ie(c,ee(_(n,c))):ie()),l.keepError||(X(r.errors,c),f.isValid&&Z()),T.state.next({...r}))},ur=(c,l={})=>{const u=c?ee(c):n,k=ee(u),v=oe(c),g=v?n:k;if(l.keepDefaultValues||(n=u),!l.keepValues){if(l.keepDirtyValues){const A=new Set([...o.mount,...Object.keys(ut(n,a))]);for(const M of Array.from(A))_(r.dirtyFields,M)?D(g,M,_(a,M)):K(M,_(g,M))}else{if(rr&&Y(c))for(const A of o.mount){const M=_(s,A);if(M&&M._f){const L=Array.isArray(M._f.refs)?M._f.refs[0]:M._f.ref;if(Ft(L)){const me=L.closest("form");if(me){me.reset();break}}}}for(const A of o.mount)K(A,_(g,A))}a=ee(g),T.array.next({values:{...g}}),T.state.next({values:{...g}})}o={mount:l.keepDirtyValues?o.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},i.mount=!f.isValid||!!l.keepIsValid||!!l.keepDirtyValues,i.watch=!!e.shouldUnregister,T.state.next({submitCount:l.keepSubmitCount?r.submitCount:0,isDirty:v?!1:l.keepDirty?r.isDirty:!!(l.keepDefaultValues&&!Ze(c,n)),isSubmitted:l.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:v?{}:l.keepDirtyValues?l.keepDefaultValues&&a?ut(n,a):r.dirtyFields:l.keepDefaultValues&&c?ut(n,c):l.keepDirty?r.dirtyFields:{},touchedFields:l.keepTouched?r.touchedFields:{},errors:l.keepErrors?r.errors:{},isSubmitSuccessful:l.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1})},dr=(c,l)=>ur(ge(c)?c(a):c,l),cs=(c,l={})=>{const u=_(s,c),k=u&&u._f;if(k){const v=k.refs?k.refs[0]:k.ref;v.focus&&(v.focus(),l.shouldSelect&&ge(v.select)&&v.select())}},ls=c=>{r={...r,...c}},fr={control:{register:we,unregister:Be,getFieldState:C,handleSubmit:lr,setError:H,_subscribe:de,_runSchema:xe,_focusError:We,_getWatch:F,_getDirty:ie,_setValid:Z,_setFieldArray:pe,_setDisabledField:G,_setErrors:ce,_getFieldArray:I,_reset:ur,_resetDefaultValues:()=>ge(e.defaultValues)&&e.defaultValues().then(c=>{dr(c,e.resetOptions),T.state.next({isLoading:!1})}),_removeUnmounted:je,_disableForm:qt,_subjects:T,_proxyFormState:f,get _fields(){return s},get _formValues(){return a},get _state(){return i},set _state(c){i=c},get _defaultValues(){return n},get _names(){return o},set _names(c){o=c},get _formState(){return r},get _options(){return e},set _options(c){e={...e,...c}}},subscribe:ot,trigger:Ne,register:we,handleSubmit:lr,watch:ke,setValue:K,getValues:m,reset:dr,resetField:os,clearErrors:U,unregister:Be,setError:H,setFocus:cs,getFieldState:C};return{...fr,formControl:fr}}function Us(t={}){const e=O.useRef(void 0),r=O.useRef(void 0),[s,n]=O.useState({isDirty:!1,isValidating:!1,isLoading:ge(t.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1,isReady:!1,defaultValues:ge(t.defaultValues)?void 0:t.defaultValues});e.current||(e.current={...t.formControl?t.formControl:$s(t),formState:s},t.formControl&&t.defaultValues&&!ge(t.defaultValues)&&t.formControl.reset(t.defaultValues,t.resetOptions));const a=e.current.control;return a._options=t,ar(()=>{const i=a._subscribe({formState:a._proxyFormState,callback:()=>n({...a._formState}),reRenderRoot:!0});return n(o=>({...o,isReady:!0})),a._formState.isReady=!0,i},[a]),O.useEffect(()=>a._disableForm(t.disabled),[a,t.disabled]),O.useEffect(()=>{t.mode&&(a._options.mode=t.mode),t.reValidateMode&&(a._options.reValidateMode=t.reValidateMode)},[a,t.mode,t.reValidateMode]),O.useEffect(()=>{t.errors&&(a._setErrors(t.errors),a._focusError())},[a,t.errors]),O.useEffect(()=>{t.shouldUnregister&&a._subjects.state.next({values:a._getWatch()})},[a,t.shouldUnregister]),O.useEffect(()=>{if(a._proxyFormState.isDirty){const i=a._getDirty();i!==s.isDirty&&a._subjects.state.next({isDirty:i})}},[a,s.isDirty]),O.useEffect(()=>{t.values&&!Ze(t.values,r.current)?(a._reset(t.values,a._options.resetOptions),r.current=t.values,n(i=>({...i}))):a._resetDefaultValues()},[a,t.values]),O.useEffect(()=>{a._state.mount||(a._setValid(),a._state.mount=!0),a._state.watch&&(a._state.watch=!1,a._subjects.state.next({...a._formState})),a._removeUnmounted()}),e.current.formState=Ur(s,a),e.current}const Or=(t,e,r)=>{if(t&&"reportValidity"in t){const s=_(r,e);t.setCustomValidity(s&&s.message||""),t.reportValidity()}},Xr=(t,e)=>{for(const r in e.fields){const s=e.fields[r];s&&s.ref&&"reportValidity"in s.ref?Or(s.ref,r,t):s&&s.refs&&s.refs.forEach(n=>Or(n,r,t))}},zs=(t,e)=>{e.shouldUseNativeValidation&&Xr(t,e);const r={};for(const s in t){const n=_(e.fields,s),a=Object.assign(t[s]||{},{ref:n&&n.ref});if(Bs(e.names||Object.keys(t),s)){const i=Object.assign({},_(r,s));D(i,"root",a),D(r,s,i)}else D(r,s,a)}return r},Bs=(t,e)=>{const r=Vr(e);return t.some(s=>Vr(s).match(`^${r}\\.\\d+`))};function Vr(t){return t.replace(/\]|\[/g,"")}function Ws(t,e){for(var r={};t.length;){var s=t[0],n=s.code,a=s.message,i=s.path.join(".");if(!r[i])if("unionErrors"in s){var o=s.unionErrors[0].errors[0];r[i]={message:o.message,type:o.code}}else r[i]={message:a,type:n};if("unionErrors"in s&&s.unionErrors.forEach(function(f){return f.errors.forEach(function(x){return t.push(x)})}),e){var d=r[i].types,h=d&&d[s.code];r[i]=Br(i,e,r,n,h?[].concat(h,s.message):s.message)}t.shift()}return r}function qs(t,e,r){return r===void 0&&(r={}),function(s,n,a){try{return Promise.resolve(function(i,o){try{var d=Promise.resolve(t[r.mode==="sync"?"parse":"parseAsync"](s,e)).then(function(h){return a.shouldUseNativeValidation&&Xr({},a),{errors:{},values:r.raw?Object.assign({},s):h}})}catch(h){return o(h)}return d&&d.then?d.then(void 0,o):d}(0,function(i){if(function(o){return Array.isArray(o==null?void 0:o.errors)}(i))return{values:{},errors:zs(Ws(i.errors,!a.shouldUseNativeValidation&&a.criteriaMode==="all"),a)};throw i}))}catch(i){return Promise.reject(i)}}}var P;(function(t){t.assertEqual=n=>{};function e(n){}t.assertIs=e;function r(n){throw new Error}t.assertNever=r,t.arrayToEnum=n=>{const a={};for(const i of n)a[i]=i;return a},t.getValidEnumValues=n=>{const a=t.objectKeys(n).filter(o=>typeof n[n[o]]!="number"),i={};for(const o of a)i[o]=n[o];return t.objectValues(i)},t.objectValues=n=>t.objectKeys(n).map(function(a){return n[a]}),t.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{const a=[];for(const i in n)Object.prototype.hasOwnProperty.call(n,i)&&a.push(i);return a},t.find=(n,a)=>{for(const i of n)if(a(i))return i},t.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function s(n,a=" | "){return n.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}t.joinValues=s,t.jsonStringifyReplacer=(n,a)=>typeof a=="bigint"?a.toString():a})(P||(P={}));var Qt;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(Qt||(Qt={}));const w=P.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ve=t=>{switch(typeof t){case"undefined":return w.undefined;case"string":return w.string;case"number":return Number.isNaN(t)?w.nan:w.number;case"boolean":return w.boolean;case"function":return w.function;case"bigint":return w.bigint;case"symbol":return w.symbol;case"object":return Array.isArray(t)?w.array:t===null?w.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?w.promise:typeof Map<"u"&&t instanceof Map?w.map:typeof Set<"u"&&t instanceof Set?w.set:typeof Date<"u"&&t instanceof Date?w.date:w.object;default:return w.unknown}},p=P.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Ys=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");class he extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){const r=e||function(a){return a.message},s={_errors:[]},n=a=>{for(const i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(n);else if(i.code==="invalid_return_type")n(i.returnTypeError);else if(i.code==="invalid_arguments")n(i.argumentsError);else if(i.path.length===0)s._errors.push(r(i));else{let o=s,d=0;for(;d<i.path.length;){const h=i.path[d];d===i.path.length-1?(o[h]=o[h]||{_errors:[]},o[h]._errors.push(r(i))):o[h]=o[h]||{_errors:[]},o=o[h],d++}}};return n(this),s}static assert(e){if(!(e instanceof he))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,P.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){const r={},s=[];for(const n of this.issues)n.path.length>0?(r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(e(n))):s.push(e(n));return{formErrors:s,fieldErrors:r}}get formErrors(){return this.flatten()}}he.create=t=>new he(t);const nt=(t,e)=>{let r;switch(t.code){case p.invalid_type:t.received===w.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case p.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,P.jsonStringifyReplacer)}`;break;case p.unrecognized_keys:r=`Unrecognized key(s) in object: ${P.joinValues(t.keys,", ")}`;break;case p.invalid_union:r="Invalid input";break;case p.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${P.joinValues(t.options)}`;break;case p.invalid_enum_value:r=`Invalid enum value. Expected ${P.joinValues(t.options)}, received '${t.received}'`;break;case p.invalid_arguments:r="Invalid function arguments";break;case p.invalid_return_type:r="Invalid function return type";break;case p.invalid_date:r="Invalid date";break;case p.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:P.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case p.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case p.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case p.custom:r="Invalid input";break;case p.invalid_intersection_types:r="Intersection results could not be merged";break;case p.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case p.not_finite:r="Number must be finite";break;default:r=e.defaultError,P.assertNever(t)}return{message:r}};let Qr=nt;function Js(t){Qr=t}function Dt(){return Qr}const Mt=t=>{const{data:e,path:r,errorMaps:s,issueData:n}=t,a=[...r,...n.path||[]],i={...n,path:a};if(n.message!==void 0)return{...n,path:a,message:n.message};let o="";const d=s.filter(h=>!!h).slice().reverse();for(const h of d)o=h(i,{data:e,defaultError:o}).message;return{...n,path:a,message:o}},Hs=[];function b(t,e){const r=Dt(),s=Mt({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===nt?void 0:nt].filter(n=>!!n)});t.common.issues.push(s)}class se{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){const s=[];for(const n of r){if(n.status==="aborted")return E;n.status==="dirty"&&e.dirty(),s.push(n.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,r){const s=[];for(const n of r){const a=await n.key,i=await n.value;s.push({key:a,value:i})}return se.mergeObjectSync(e,s)}static mergeObjectSync(e,r){const s={};for(const n of r){const{key:a,value:i}=n;if(a.status==="aborted"||i.status==="aborted")return E;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||n.alwaysSet)&&(s[a.value]=i.value)}return{status:e.value,value:s}}}const E=Object.freeze({status:"aborted"}),tt=t=>({status:"dirty",value:t}),ae=t=>({status:"valid",value:t}),Kt=t=>t.status==="aborted",er=t=>t.status==="dirty",Je=t=>t.status==="valid",mt=t=>typeof Promise<"u"&&t instanceof Promise;var S;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(S||(S={}));class Ae{constructor(e,r,s,n){this._cachedPath=[],this.parent=e,this.data=r,this._path=s,this._key=n}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Fr=(t,e)=>{if(Je(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const r=new he(t.common.issues);return this._error=r,this._error}}};function N(t){if(!t)return{};const{errorMap:e,invalid_type_error:r,required_error:s,description:n}=t;if(e&&(r||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(i,o)=>{const{message:d}=t;return i.code==="invalid_enum_value"?{message:d??o.defaultError}:typeof o.data>"u"?{message:d??s??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:d??r??o.defaultError}},description:n}}class V{get description(){return this._def.description}_getType(e){return Ve(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Ve(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new se,ctx:{common:e.parent.common,data:e.data,parsedType:Ve(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const r=this._parse(e);if(mt(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){const r=this._parse(e);return Promise.resolve(r)}parse(e,r){const s=this.safeParse(e,r);if(s.success)return s.data;throw s.error}safeParse(e,r){const s={common:{issues:[],async:(r==null?void 0:r.async)??!1,contextualErrorMap:r==null?void 0:r.errorMap},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ve(e)},n=this._parseSync({data:e,path:s.path,parent:s});return Fr(s,n)}"~validate"(e){var s,n;const r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ve(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:r});return Je(a)?{value:a.value}:{issues:r.common.issues}}catch(a){(n=(s=a==null?void 0:a.message)==null?void 0:s.toLowerCase())!=null&&n.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(a=>Je(a)?{value:a.value}:{issues:r.common.issues})}async parseAsync(e,r){const s=await this.safeParseAsync(e,r);if(s.success)return s.data;throw s.error}async safeParseAsync(e,r){const s={common:{issues:[],contextualErrorMap:r==null?void 0:r.errorMap,async:!0},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ve(e)},n=this._parse({data:e,path:s.path,parent:s}),a=await(mt(n)?n:Promise.resolve(n));return Fr(s,a)}refine(e,r){const s=n=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(n):r;return this._refinement((n,a)=>{const i=e(n),o=()=>a.addIssue({code:p.custom,...s(n)});return typeof Promise<"u"&&i instanceof Promise?i.then(d=>d?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,r){return this._refinement((s,n)=>e(s)?!0:(n.addIssue(typeof r=="function"?r(s,n):r),!1))}_refinement(e){return new be({schema:this,typeName:j.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return Te.create(this,this._def)}nullable(){return ze.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return _e.create(this)}promise(){return it.create(this,this._def)}or(e){return vt.create([this,e],this._def)}and(e){return _t.create(this,e,this._def)}transform(e){return new be({...N(this._def),schema:this,typeName:j.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const r=typeof e=="function"?e:()=>e;return new St({...N(this._def),innerType:this,defaultValue:r,typeName:j.ZodDefault})}brand(){return new cr({typeName:j.ZodBranded,type:this,...N(this._def)})}catch(e){const r=typeof e=="function"?e:()=>e;return new Tt({...N(this._def),innerType:this,catchValue:r,typeName:j.ZodCatch})}describe(e){const r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Nt.create(this,e)}readonly(){return At.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Gs=/^c[^\s-]{8,}$/i,Xs=/^[0-9a-z]+$/,Qs=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ks=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,en=/^[a-z0-9_-]{21}$/i,tn=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,rn=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,sn=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,nn="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Gt;const an=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,on=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,cn=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,ln=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,un=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,dn=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Kr="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",fn=new RegExp(`^${Kr}$`);function es(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);const r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function hn(t){return new RegExp(`^${es(t)}$`)}function ts(t){let e=`${Kr}T${es(t)}`;const r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function mn(t,e){return!!((e==="v4"||!e)&&an.test(t)||(e==="v6"||!e)&&cn.test(t))}function pn(t,e){if(!tn.test(t))return!1;try{const[r]=t.split("."),s=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),n=JSON.parse(atob(s));return!(typeof n!="object"||n===null||"typ"in n&&(n==null?void 0:n.typ)!=="JWT"||!n.alg||e&&n.alg!==e)}catch{return!1}}function yn(t,e){return!!((e==="v4"||!e)&&on.test(t)||(e==="v6"||!e)&&ln.test(t))}class ve extends V{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==w.string){const a=this._getOrReturnCtx(e);return b(a,{code:p.invalid_type,expected:w.string,received:a.parsedType}),E}const s=new se;let n;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(n=this._getOrReturnCtx(e,n),b(n,{code:p.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="max")e.data.length>a.value&&(n=this._getOrReturnCtx(e,n),b(n,{code:p.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="length"){const i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(n=this._getOrReturnCtx(e,n),i?b(n,{code:p.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&b(n,{code:p.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),s.dirty())}else if(a.kind==="email")sn.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"email",code:p.invalid_string,message:a.message}),s.dirty());else if(a.kind==="emoji")Gt||(Gt=new RegExp(nn,"u")),Gt.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"emoji",code:p.invalid_string,message:a.message}),s.dirty());else if(a.kind==="uuid")Ks.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"uuid",code:p.invalid_string,message:a.message}),s.dirty());else if(a.kind==="nanoid")en.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"nanoid",code:p.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid")Gs.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"cuid",code:p.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid2")Xs.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"cuid2",code:p.invalid_string,message:a.message}),s.dirty());else if(a.kind==="ulid")Qs.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"ulid",code:p.invalid_string,message:a.message}),s.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),b(n,{validation:"url",code:p.invalid_string,message:a.message}),s.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"regex",code:p.invalid_string,message:a.message}),s.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(n=this._getOrReturnCtx(e,n),b(n,{code:p.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),s.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(n=this._getOrReturnCtx(e,n),b(n,{code:p.invalid_string,validation:{startsWith:a.value},message:a.message}),s.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(n=this._getOrReturnCtx(e,n),b(n,{code:p.invalid_string,validation:{endsWith:a.value},message:a.message}),s.dirty()):a.kind==="datetime"?ts(a).test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{code:p.invalid_string,validation:"datetime",message:a.message}),s.dirty()):a.kind==="date"?fn.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{code:p.invalid_string,validation:"date",message:a.message}),s.dirty()):a.kind==="time"?hn(a).test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{code:p.invalid_string,validation:"time",message:a.message}),s.dirty()):a.kind==="duration"?rn.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"duration",code:p.invalid_string,message:a.message}),s.dirty()):a.kind==="ip"?mn(e.data,a.version)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"ip",code:p.invalid_string,message:a.message}),s.dirty()):a.kind==="jwt"?pn(e.data,a.alg)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"jwt",code:p.invalid_string,message:a.message}),s.dirty()):a.kind==="cidr"?yn(e.data,a.version)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"cidr",code:p.invalid_string,message:a.message}),s.dirty()):a.kind==="base64"?un.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"base64",code:p.invalid_string,message:a.message}),s.dirty()):a.kind==="base64url"?dn.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"base64url",code:p.invalid_string,message:a.message}),s.dirty()):P.assertNever(a);return{status:s.value,value:e.data}}_regex(e,r,s){return this.refinement(n=>e.test(n),{validation:r,code:p.invalid_string,...S.errToObj(s)})}_addCheck(e){return new ve({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...S.errToObj(e)})}url(e){return this._addCheck({kind:"url",...S.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...S.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...S.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...S.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...S.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...S.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...S.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...S.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...S.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...S.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...S.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...S.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...S.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...S.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...S.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...S.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r==null?void 0:r.position,...S.errToObj(r==null?void 0:r.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...S.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...S.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...S.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...S.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...S.errToObj(r)})}nonempty(e){return this.min(1,S.errToObj(e))}trim(){return new ve({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ve({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ve({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}}ve.create=t=>new ve({checks:[],typeName:j.ZodString,coerce:(t==null?void 0:t.coerce)??!1,...N(t)});function gn(t,e){const r=(t.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,n=r>s?r:s,a=Number.parseInt(t.toFixed(n).replace(".","")),i=Number.parseInt(e.toFixed(n).replace(".",""));return a%i/10**n}class Le extends V{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==w.number){const a=this._getOrReturnCtx(e);return b(a,{code:p.invalid_type,expected:w.number,received:a.parsedType}),E}let s;const n=new se;for(const a of this._def.checks)a.kind==="int"?P.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),b(s,{code:p.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),b(s,{code:p.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),b(s,{code:p.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="multipleOf"?gn(e.data,a.value)!==0&&(s=this._getOrReturnCtx(e,s),b(s,{code:p.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),b(s,{code:p.not_finite,message:a.message}),n.dirty()):P.assertNever(a);return{status:n.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,S.toString(r))}gt(e,r){return this.setLimit("min",e,!1,S.toString(r))}lte(e,r){return this.setLimit("max",e,!0,S.toString(r))}lt(e,r){return this.setLimit("max",e,!1,S.toString(r))}setLimit(e,r,s,n){return new Le({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:s,message:S.toString(n)}]})}_addCheck(e){return new Le({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:S.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:S.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:S.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:S.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:S.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:S.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:S.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:S.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:S.toString(e)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&P.isInteger(e.value))}get isFinite(){let e=null,r=null;for(const s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(r===null||s.value>r)&&(r=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(r)&&Number.isFinite(e)}}Le.create=t=>new Le({checks:[],typeName:j.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...N(t)});class $e extends V{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==w.bigint)return this._getInvalidInput(e);let s;const n=new se;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),b(s,{code:p.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),b(s,{code:p.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),b(s,{code:p.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):P.assertNever(a);return{status:n.value,value:e.data}}_getInvalidInput(e){const r=this._getOrReturnCtx(e);return b(r,{code:p.invalid_type,expected:w.bigint,received:r.parsedType}),E}gte(e,r){return this.setLimit("min",e,!0,S.toString(r))}gt(e,r){return this.setLimit("min",e,!1,S.toString(r))}lte(e,r){return this.setLimit("max",e,!0,S.toString(r))}lt(e,r){return this.setLimit("max",e,!1,S.toString(r))}setLimit(e,r,s,n){return new $e({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:s,message:S.toString(n)}]})}_addCheck(e){return new $e({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:S.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:S.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:S.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:S.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:S.toString(r)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}}$e.create=t=>new $e({checks:[],typeName:j.ZodBigInt,coerce:(t==null?void 0:t.coerce)??!1,...N(t)});class pt extends V{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==w.boolean){const s=this._getOrReturnCtx(e);return b(s,{code:p.invalid_type,expected:w.boolean,received:s.parsedType}),E}return ae(e.data)}}pt.create=t=>new pt({typeName:j.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...N(t)});class He extends V{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==w.date){const a=this._getOrReturnCtx(e);return b(a,{code:p.invalid_type,expected:w.date,received:a.parsedType}),E}if(Number.isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return b(a,{code:p.invalid_date}),E}const s=new se;let n;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(n=this._getOrReturnCtx(e,n),b(n,{code:p.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),s.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(n=this._getOrReturnCtx(e,n),b(n,{code:p.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),s.dirty()):P.assertNever(a);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new He({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:S.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:S.toString(r)})}get minDate(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}}He.create=t=>new He({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:j.ZodDate,...N(t)});class Zt extends V{_parse(e){if(this._getType(e)!==w.symbol){const s=this._getOrReturnCtx(e);return b(s,{code:p.invalid_type,expected:w.symbol,received:s.parsedType}),E}return ae(e.data)}}Zt.create=t=>new Zt({typeName:j.ZodSymbol,...N(t)});class yt extends V{_parse(e){if(this._getType(e)!==w.undefined){const s=this._getOrReturnCtx(e);return b(s,{code:p.invalid_type,expected:w.undefined,received:s.parsedType}),E}return ae(e.data)}}yt.create=t=>new yt({typeName:j.ZodUndefined,...N(t)});class gt extends V{_parse(e){if(this._getType(e)!==w.null){const s=this._getOrReturnCtx(e);return b(s,{code:p.invalid_type,expected:w.null,received:s.parsedType}),E}return ae(e.data)}}gt.create=t=>new gt({typeName:j.ZodNull,...N(t)});class at extends V{constructor(){super(...arguments),this._any=!0}_parse(e){return ae(e.data)}}at.create=t=>new at({typeName:j.ZodAny,...N(t)});class Ye extends V{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ae(e.data)}}Ye.create=t=>new Ye({typeName:j.ZodUnknown,...N(t)});class Fe extends V{_parse(e){const r=this._getOrReturnCtx(e);return b(r,{code:p.invalid_type,expected:w.never,received:r.parsedType}),E}}Fe.create=t=>new Fe({typeName:j.ZodNever,...N(t)});class Lt extends V{_parse(e){if(this._getType(e)!==w.undefined){const s=this._getOrReturnCtx(e);return b(s,{code:p.invalid_type,expected:w.void,received:s.parsedType}),E}return ae(e.data)}}Lt.create=t=>new Lt({typeName:j.ZodVoid,...N(t)});class _e extends V{_parse(e){const{ctx:r,status:s}=this._processInputParams(e),n=this._def;if(r.parsedType!==w.array)return b(r,{code:p.invalid_type,expected:w.array,received:r.parsedType}),E;if(n.exactLength!==null){const i=r.data.length>n.exactLength.value,o=r.data.length<n.exactLength.value;(i||o)&&(b(r,{code:i?p.too_big:p.too_small,minimum:o?n.exactLength.value:void 0,maximum:i?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),s.dirty())}if(n.minLength!==null&&r.data.length<n.minLength.value&&(b(r,{code:p.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),s.dirty()),n.maxLength!==null&&r.data.length>n.maxLength.value&&(b(r,{code:p.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),s.dirty()),r.common.async)return Promise.all([...r.data].map((i,o)=>n.type._parseAsync(new Ae(r,i,r.path,o)))).then(i=>se.mergeArray(s,i));const a=[...r.data].map((i,o)=>n.type._parseSync(new Ae(r,i,r.path,o)));return se.mergeArray(s,a)}get element(){return this._def.type}min(e,r){return new _e({...this._def,minLength:{value:e,message:S.toString(r)}})}max(e,r){return new _e({...this._def,maxLength:{value:e,message:S.toString(r)}})}length(e,r){return new _e({...this._def,exactLength:{value:e,message:S.toString(r)}})}nonempty(e){return this.min(1,e)}}_e.create=(t,e)=>new _e({type:t,minLength:null,maxLength:null,exactLength:null,typeName:j.ZodArray,...N(e)});function et(t){if(t instanceof B){const e={};for(const r in t.shape){const s=t.shape[r];e[r]=Te.create(et(s))}return new B({...t._def,shape:()=>e})}else return t instanceof _e?new _e({...t._def,type:et(t.element)}):t instanceof Te?Te.create(et(t.unwrap())):t instanceof ze?ze.create(et(t.unwrap())):t instanceof Ee?Ee.create(t.items.map(e=>et(e))):t}class B extends V{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),r=P.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==w.object){const h=this._getOrReturnCtx(e);return b(h,{code:p.invalid_type,expected:w.object,received:h.parsedType}),E}const{status:s,ctx:n}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof Fe&&this._def.unknownKeys==="strip"))for(const h in n.data)i.includes(h)||o.push(h);const d=[];for(const h of i){const f=a[h],x=n.data[h];d.push({key:{status:"valid",value:h},value:f._parse(new Ae(n,x,n.path,h)),alwaysSet:h in n.data})}if(this._def.catchall instanceof Fe){const h=this._def.unknownKeys;if(h==="passthrough")for(const f of o)d.push({key:{status:"valid",value:f},value:{status:"valid",value:n.data[f]}});else if(h==="strict")o.length>0&&(b(n,{code:p.unrecognized_keys,keys:o}),s.dirty());else if(h!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const h=this._def.catchall;for(const f of o){const x=n.data[f];d.push({key:{status:"valid",value:f},value:h._parse(new Ae(n,x,n.path,f)),alwaysSet:f in n.data})}}return n.common.async?Promise.resolve().then(async()=>{const h=[];for(const f of d){const x=await f.key,T=await f.value;h.push({key:x,value:T,alwaysSet:f.alwaysSet})}return h}).then(h=>se.mergeObjectSync(s,h)):se.mergeObjectSync(s,d)}get shape(){return this._def.shape()}strict(e){return S.errToObj,new B({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,s)=>{var a,i;const n=((i=(a=this._def).errorMap)==null?void 0:i.call(a,r,s).message)??s.defaultError;return r.code==="unrecognized_keys"?{message:S.errToObj(e).message??n}:{message:n}}}:{}})}strip(){return new B({...this._def,unknownKeys:"strip"})}passthrough(){return new B({...this._def,unknownKeys:"passthrough"})}extend(e){return new B({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new B({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:j.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new B({...this._def,catchall:e})}pick(e){const r={};for(const s of P.objectKeys(e))e[s]&&this.shape[s]&&(r[s]=this.shape[s]);return new B({...this._def,shape:()=>r})}omit(e){const r={};for(const s of P.objectKeys(this.shape))e[s]||(r[s]=this.shape[s]);return new B({...this._def,shape:()=>r})}deepPartial(){return et(this)}partial(e){const r={};for(const s of P.objectKeys(this.shape)){const n=this.shape[s];e&&!e[s]?r[s]=n:r[s]=n.optional()}return new B({...this._def,shape:()=>r})}required(e){const r={};for(const s of P.objectKeys(this.shape))if(e&&!e[s])r[s]=this.shape[s];else{let a=this.shape[s];for(;a instanceof Te;)a=a._def.innerType;r[s]=a}return new B({...this._def,shape:()=>r})}keyof(){return rs(P.objectKeys(this.shape))}}B.create=(t,e)=>new B({shape:()=>t,unknownKeys:"strip",catchall:Fe.create(),typeName:j.ZodObject,...N(e)});B.strictCreate=(t,e)=>new B({shape:()=>t,unknownKeys:"strict",catchall:Fe.create(),typeName:j.ZodObject,...N(e)});B.lazycreate=(t,e)=>new B({shape:t,unknownKeys:"strip",catchall:Fe.create(),typeName:j.ZodObject,...N(e)});class vt extends V{_parse(e){const{ctx:r}=this._processInputParams(e),s=this._def.options;function n(a){for(const o of a)if(o.result.status==="valid")return o.result;for(const o of a)if(o.result.status==="dirty")return r.common.issues.push(...o.ctx.common.issues),o.result;const i=a.map(o=>new he(o.ctx.common.issues));return b(r,{code:p.invalid_union,unionErrors:i}),E}if(r.common.async)return Promise.all(s.map(async a=>{const i={...r,common:{...r.common,issues:[]},parent:null};return{result:await a._parseAsync({data:r.data,path:r.path,parent:i}),ctx:i}})).then(n);{let a;const i=[];for(const d of s){const h={...r,common:{...r.common,issues:[]},parent:null},f=d._parseSync({data:r.data,path:r.path,parent:h});if(f.status==="valid")return f;f.status==="dirty"&&!a&&(a={result:f,ctx:h}),h.common.issues.length&&i.push(h.common.issues)}if(a)return r.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(d=>new he(d));return b(r,{code:p.invalid_union,unionErrors:o}),E}}get options(){return this._def.options}}vt.create=(t,e)=>new vt({options:t,typeName:j.ZodUnion,...N(e)});const Oe=t=>t instanceof xt?Oe(t.schema):t instanceof be?Oe(t.innerType()):t instanceof kt?[t.value]:t instanceof Ue?t.options:t instanceof wt?P.objectValues(t.enum):t instanceof St?Oe(t._def.innerType):t instanceof yt?[void 0]:t instanceof gt?[null]:t instanceof Te?[void 0,...Oe(t.unwrap())]:t instanceof ze?[null,...Oe(t.unwrap())]:t instanceof cr||t instanceof At?Oe(t.unwrap()):t instanceof Tt?Oe(t._def.innerType):[];class Wt extends V{_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==w.object)return b(r,{code:p.invalid_type,expected:w.object,received:r.parsedType}),E;const s=this.discriminator,n=r.data[s],a=this.optionsMap.get(n);return a?r.common.async?a._parseAsync({data:r.data,path:r.path,parent:r}):a._parseSync({data:r.data,path:r.path,parent:r}):(b(r,{code:p.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),E)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,s){const n=new Map;for(const a of r){const i=Oe(a.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of i){if(n.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);n.set(o,a)}}return new Wt({typeName:j.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:n,...N(s)})}}function tr(t,e){const r=Ve(t),s=Ve(e);if(t===e)return{valid:!0,data:t};if(r===w.object&&s===w.object){const n=P.objectKeys(e),a=P.objectKeys(t).filter(o=>n.indexOf(o)!==-1),i={...t,...e};for(const o of a){const d=tr(t[o],e[o]);if(!d.valid)return{valid:!1};i[o]=d.data}return{valid:!0,data:i}}else if(r===w.array&&s===w.array){if(t.length!==e.length)return{valid:!1};const n=[];for(let a=0;a<t.length;a++){const i=t[a],o=e[a],d=tr(i,o);if(!d.valid)return{valid:!1};n.push(d.data)}return{valid:!0,data:n}}else return r===w.date&&s===w.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class _t extends V{_parse(e){const{status:r,ctx:s}=this._processInputParams(e),n=(a,i)=>{if(Kt(a)||Kt(i))return E;const o=tr(a.value,i.value);return o.valid?((er(a)||er(i))&&r.dirty(),{status:r.value,value:o.data}):(b(s,{code:p.invalid_intersection_types}),E)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([a,i])=>n(a,i)):n(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}_t.create=(t,e,r)=>new _t({left:t,right:e,typeName:j.ZodIntersection,...N(r)});class Ee extends V{_parse(e){const{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==w.array)return b(s,{code:p.invalid_type,expected:w.array,received:s.parsedType}),E;if(s.data.length<this._def.items.length)return b(s,{code:p.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),E;!this._def.rest&&s.data.length>this._def.items.length&&(b(s,{code:p.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const a=[...s.data].map((i,o)=>{const d=this._def.items[o]||this._def.rest;return d?d._parse(new Ae(s,i,s.path,o)):null}).filter(i=>!!i);return s.common.async?Promise.all(a).then(i=>se.mergeArray(r,i)):se.mergeArray(r,a)}get items(){return this._def.items}rest(e){return new Ee({...this._def,rest:e})}}Ee.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ee({items:t,typeName:j.ZodTuple,rest:null,...N(e)})};class bt extends V{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==w.object)return b(s,{code:p.invalid_type,expected:w.object,received:s.parsedType}),E;const n=[],a=this._def.keyType,i=this._def.valueType;for(const o in s.data)n.push({key:a._parse(new Ae(s,o,s.path,o)),value:i._parse(new Ae(s,s.data[o],s.path,o)),alwaysSet:o in s.data});return s.common.async?se.mergeObjectAsync(r,n):se.mergeObjectSync(r,n)}get element(){return this._def.valueType}static create(e,r,s){return r instanceof V?new bt({keyType:e,valueType:r,typeName:j.ZodRecord,...N(s)}):new bt({keyType:ve.create(),valueType:e,typeName:j.ZodRecord,...N(r)})}}class $t extends V{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==w.map)return b(s,{code:p.invalid_type,expected:w.map,received:s.parsedType}),E;const n=this._def.keyType,a=this._def.valueType,i=[...s.data.entries()].map(([o,d],h)=>({key:n._parse(new Ae(s,o,s.path,[h,"key"])),value:a._parse(new Ae(s,d,s.path,[h,"value"]))}));if(s.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const d of i){const h=await d.key,f=await d.value;if(h.status==="aborted"||f.status==="aborted")return E;(h.status==="dirty"||f.status==="dirty")&&r.dirty(),o.set(h.value,f.value)}return{status:r.value,value:o}})}else{const o=new Map;for(const d of i){const h=d.key,f=d.value;if(h.status==="aborted"||f.status==="aborted")return E;(h.status==="dirty"||f.status==="dirty")&&r.dirty(),o.set(h.value,f.value)}return{status:r.value,value:o}}}}$t.create=(t,e,r)=>new $t({valueType:e,keyType:t,typeName:j.ZodMap,...N(r)});class Ge extends V{_parse(e){const{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==w.set)return b(s,{code:p.invalid_type,expected:w.set,received:s.parsedType}),E;const n=this._def;n.minSize!==null&&s.data.size<n.minSize.value&&(b(s,{code:p.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),r.dirty()),n.maxSize!==null&&s.data.size>n.maxSize.value&&(b(s,{code:p.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),r.dirty());const a=this._def.valueType;function i(d){const h=new Set;for(const f of d){if(f.status==="aborted")return E;f.status==="dirty"&&r.dirty(),h.add(f.value)}return{status:r.value,value:h}}const o=[...s.data.values()].map((d,h)=>a._parse(new Ae(s,d,s.path,h)));return s.common.async?Promise.all(o).then(d=>i(d)):i(o)}min(e,r){return new Ge({...this._def,minSize:{value:e,message:S.toString(r)}})}max(e,r){return new Ge({...this._def,maxSize:{value:e,message:S.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}}Ge.create=(t,e)=>new Ge({valueType:t,minSize:null,maxSize:null,typeName:j.ZodSet,...N(e)});class rt extends V{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==w.function)return b(r,{code:p.invalid_type,expected:w.function,received:r.parsedType}),E;function s(o,d){return Mt({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Dt(),nt].filter(h=>!!h),issueData:{code:p.invalid_arguments,argumentsError:d}})}function n(o,d){return Mt({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Dt(),nt].filter(h=>!!h),issueData:{code:p.invalid_return_type,returnTypeError:d}})}const a={errorMap:r.common.contextualErrorMap},i=r.data;if(this._def.returns instanceof it){const o=this;return ae(async function(...d){const h=new he([]),f=await o._def.args.parseAsync(d,a).catch(W=>{throw h.addIssue(s(d,W)),h}),x=await Reflect.apply(i,this,f);return await o._def.returns._def.type.parseAsync(x,a).catch(W=>{throw h.addIssue(n(x,W)),h})})}else{const o=this;return ae(function(...d){const h=o._def.args.safeParse(d,a);if(!h.success)throw new he([s(d,h.error)]);const f=Reflect.apply(i,this,h.data),x=o._def.returns.safeParse(f,a);if(!x.success)throw new he([n(f,x.error)]);return x.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new rt({...this._def,args:Ee.create(e).rest(Ye.create())})}returns(e){return new rt({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,s){return new rt({args:e||Ee.create([]).rest(Ye.create()),returns:r||Ye.create(),typeName:j.ZodFunction,...N(s)})}}class xt extends V{get schema(){return this._def.getter()}_parse(e){const{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}}xt.create=(t,e)=>new xt({getter:t,typeName:j.ZodLazy,...N(e)});class kt extends V{_parse(e){if(e.data!==this._def.value){const r=this._getOrReturnCtx(e);return b(r,{received:r.data,code:p.invalid_literal,expected:this._def.value}),E}return{status:"valid",value:e.data}}get value(){return this._def.value}}kt.create=(t,e)=>new kt({value:t,typeName:j.ZodLiteral,...N(e)});function rs(t,e){return new Ue({values:t,typeName:j.ZodEnum,...N(e)})}class Ue extends V{_parse(e){if(typeof e.data!="string"){const r=this._getOrReturnCtx(e),s=this._def.values;return b(r,{expected:P.joinValues(s),received:r.parsedType,code:p.invalid_type}),E}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const r=this._getOrReturnCtx(e),s=this._def.values;return b(r,{received:r.data,code:p.invalid_enum_value,options:s}),E}return ae(e.data)}get options(){return this._def.values}get enum(){const e={};for(const r of this._def.values)e[r]=r;return e}get Values(){const e={};for(const r of this._def.values)e[r]=r;return e}get Enum(){const e={};for(const r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return Ue.create(e,{...this._def,...r})}exclude(e,r=this._def){return Ue.create(this.options.filter(s=>!e.includes(s)),{...this._def,...r})}}Ue.create=rs;class wt extends V{_parse(e){const r=P.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==w.string&&s.parsedType!==w.number){const n=P.objectValues(r);return b(s,{expected:P.joinValues(n),received:s.parsedType,code:p.invalid_type}),E}if(this._cache||(this._cache=new Set(P.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const n=P.objectValues(r);return b(s,{received:s.data,code:p.invalid_enum_value,options:n}),E}return ae(e.data)}get enum(){return this._def.values}}wt.create=(t,e)=>new wt({values:t,typeName:j.ZodNativeEnum,...N(e)});class it extends V{unwrap(){return this._def.type}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==w.promise&&r.common.async===!1)return b(r,{code:p.invalid_type,expected:w.promise,received:r.parsedType}),E;const s=r.parsedType===w.promise?r.data:Promise.resolve(r.data);return ae(s.then(n=>this._def.type.parseAsync(n,{path:r.path,errorMap:r.common.contextualErrorMap})))}}it.create=(t,e)=>new it({type:t,typeName:j.ZodPromise,...N(e)});class be extends V{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===j.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:r,ctx:s}=this._processInputParams(e),n=this._def.effect||null,a={addIssue:i=>{b(s,i),i.fatal?r.abort():r.dirty()},get path(){return s.path}};if(a.addIssue=a.addIssue.bind(a),n.type==="preprocess"){const i=n.transform(s.data,a);if(s.common.async)return Promise.resolve(i).then(async o=>{if(r.value==="aborted")return E;const d=await this._def.schema._parseAsync({data:o,path:s.path,parent:s});return d.status==="aborted"?E:d.status==="dirty"||r.value==="dirty"?tt(d.value):d});{if(r.value==="aborted")return E;const o=this._def.schema._parseSync({data:i,path:s.path,parent:s});return o.status==="aborted"?E:o.status==="dirty"||r.value==="dirty"?tt(o.value):o}}if(n.type==="refinement"){const i=o=>{const d=n.refinement(o,a);if(s.common.async)return Promise.resolve(d);if(d instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(s.common.async===!1){const o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return o.status==="aborted"?E:(o.status==="dirty"&&r.dirty(),i(o.value),{status:r.value,value:o.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>o.status==="aborted"?E:(o.status==="dirty"&&r.dirty(),i(o.value).then(()=>({status:r.value,value:o.value}))))}if(n.type==="transform")if(s.common.async===!1){const i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!Je(i))return E;const o=n.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:o}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>Je(i)?Promise.resolve(n.transform(i.value,a)).then(o=>({status:r.value,value:o})):E);P.assertNever(n)}}be.create=(t,e,r)=>new be({schema:t,typeName:j.ZodEffects,effect:e,...N(r)});be.createWithPreprocess=(t,e,r)=>new be({schema:e,effect:{type:"preprocess",transform:t},typeName:j.ZodEffects,...N(r)});class Te extends V{_parse(e){return this._getType(e)===w.undefined?ae(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Te.create=(t,e)=>new Te({innerType:t,typeName:j.ZodOptional,...N(e)});class ze extends V{_parse(e){return this._getType(e)===w.null?ae(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ze.create=(t,e)=>new ze({innerType:t,typeName:j.ZodNullable,...N(e)});class St extends V{_parse(e){const{ctx:r}=this._processInputParams(e);let s=r.data;return r.parsedType===w.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}St.create=(t,e)=>new St({innerType:t,typeName:j.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...N(e)});class Tt extends V{_parse(e){const{ctx:r}=this._processInputParams(e),s={...r,common:{...r.common,issues:[]}},n=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return mt(n)?n.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new he(s.common.issues)},input:s.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new he(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}Tt.create=(t,e)=>new Tt({innerType:t,typeName:j.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...N(e)});class Ut extends V{_parse(e){if(this._getType(e)!==w.nan){const s=this._getOrReturnCtx(e);return b(s,{code:p.invalid_type,expected:w.nan,received:s.parsedType}),E}return{status:"valid",value:e.data}}}Ut.create=t=>new Ut({typeName:j.ZodNaN,...N(t)});const vn=Symbol("zod_brand");class cr extends V{_parse(e){const{ctx:r}=this._processInputParams(e),s=r.data;return this._def.type._parse({data:s,path:r.path,parent:r})}unwrap(){return this._def.type}}class Nt extends V{_parse(e){const{status:r,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?E:a.status==="dirty"?(r.dirty(),tt(a.value)):this._def.out._parseAsync({data:a.value,path:s.path,parent:s})})();{const n=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?E:n.status==="dirty"?(r.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:s.path,parent:s})}}static create(e,r){return new Nt({in:e,out:r,typeName:j.ZodPipeline})}}class At extends V{_parse(e){const r=this._def.innerType._parse(e),s=n=>(Je(n)&&(n.value=Object.freeze(n.value)),n);return mt(r)?r.then(n=>s(n)):s(r)}unwrap(){return this._def.innerType}}At.create=(t,e)=>new At({innerType:t,typeName:j.ZodReadonly,...N(e)});function Pr(t,e){const r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function ss(t,e={},r){return t?at.create().superRefine((s,n)=>{const a=t(s);if(a instanceof Promise)return a.then(i=>{if(!i){const o=Pr(e,s),d=o.fatal??r??!0;n.addIssue({code:"custom",...o,fatal:d})}});if(!a){const i=Pr(e,s),o=i.fatal??r??!0;n.addIssue({code:"custom",...i,fatal:o})}}):at.create()}const _n={object:B.lazycreate};var j;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(j||(j={}));const bn=(t,e={message:`Input not instance of ${t.name}`})=>ss(r=>r instanceof t,e),ns=ve.create,as=Le.create,xn=Ut.create,kn=$e.create,is=pt.create,wn=He.create,Sn=Zt.create,Tn=yt.create,An=gt.create,En=at.create,jn=Ye.create,Nn=Fe.create,Cn=Lt.create,Rn=_e.create,On=B.create,Vn=B.strictCreate,Fn=vt.create,Pn=Wt.create,In=_t.create,Dn=Ee.create,Mn=bt.create,Zn=$t.create,Ln=Ge.create,$n=rt.create,Un=xt.create,zn=kt.create,Bn=Ue.create,Wn=wt.create,qn=it.create,Ir=be.create,Yn=Te.create,Jn=ze.create,Hn=be.createWithPreprocess,Gn=Nt.create,Xn=()=>ns().optional(),Qn=()=>as().optional(),Kn=()=>is().optional(),ea={string:t=>ve.create({...t,coerce:!0}),number:t=>Le.create({...t,coerce:!0}),boolean:t=>pt.create({...t,coerce:!0}),bigint:t=>$e.create({...t,coerce:!0}),date:t=>He.create({...t,coerce:!0})},ta=E,Re=Object.freeze(Object.defineProperty({__proto__:null,BRAND:vn,DIRTY:tt,EMPTY_PATH:Hs,INVALID:E,NEVER:ta,OK:ae,ParseStatus:se,Schema:V,ZodAny:at,ZodArray:_e,ZodBigInt:$e,ZodBoolean:pt,ZodBranded:cr,ZodCatch:Tt,ZodDate:He,ZodDefault:St,ZodDiscriminatedUnion:Wt,ZodEffects:be,ZodEnum:Ue,ZodError:he,get ZodFirstPartyTypeKind(){return j},ZodFunction:rt,ZodIntersection:_t,ZodIssueCode:p,ZodLazy:xt,ZodLiteral:kt,ZodMap:$t,ZodNaN:Ut,ZodNativeEnum:wt,ZodNever:Fe,ZodNull:gt,ZodNullable:ze,ZodNumber:Le,ZodObject:B,ZodOptional:Te,ZodParsedType:w,ZodPipeline:Nt,ZodPromise:it,ZodReadonly:At,ZodRecord:bt,ZodSchema:V,ZodSet:Ge,ZodString:ve,ZodSymbol:Zt,ZodTransformer:be,ZodTuple:Ee,ZodType:V,ZodUndefined:yt,ZodUnion:vt,ZodUnknown:Ye,ZodVoid:Lt,addIssueToContext:b,any:En,array:Rn,bigint:kn,boolean:is,coerce:ea,custom:ss,date:wn,datetimeRegex:ts,defaultErrorMap:nt,discriminatedUnion:Pn,effect:Ir,enum:Bn,function:$n,getErrorMap:Dt,getParsedType:Ve,instanceof:bn,intersection:In,isAborted:Kt,isAsync:mt,isDirty:er,isValid:Je,late:_n,lazy:Un,literal:zn,makeIssue:Mt,map:Zn,nan:xn,nativeEnum:Wn,never:Nn,null:An,nullable:Jn,number:as,object:On,get objectUtil(){return Qt},oboolean:Kn,onumber:Qn,optional:Yn,ostring:Xn,pipeline:Gn,preprocess:Hn,promise:qn,quotelessJson:Ys,record:Mn,set:Ln,setErrorMap:Js,strictObject:Vn,string:ns,symbol:Sn,transformer:Ir,tuple:Dn,undefined:Tn,union:Fn,unknown:jn,get util(){return P},void:Cn},Symbol.toStringTag,{value:"Module"})),zt=t=>y.jsx("button",{type:t.type||"button",disabled:t.isDisabled,className:`bg-green-500 hover:bg-green-600 text-white px-6 py-2 rounded disabled:opacity-50 *:disabled:cursor-not-allowed ${t.className}`,onClick:t.handleClick,children:t.title}),ra=({label:t,required:e=!1,file:r,onFileChange:s,error:n})=>{const a=O.useRef(null),[i,o]=O.useState(null),[d,h]=O.useState(!1),f=T=>{var te;const W=(te=T.target.files)==null?void 0:te[0];W&&(s(W),o(URL.createObjectURL(W)))},x=O.useCallback(()=>{var T;(T=a.current)==null||T.click()},[]);return O.useEffect(()=>{r&&o(URL.createObjectURL(r))},[r]),y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"flex flex-col",children:[y.jsxs("label",{className:"font-medium mb-1 text-gray-700",children:[t,e&&y.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),y.jsxs("div",{className:"flex items-center",children:[y.jsx("button",{type:"button",onClick:x,className:"bg-green-500 hover:bg-green-600 text-white px-4 py-2 rounded",children:"Upload file"}),y.jsx("input",{ref:a,type:"file",accept:"image/*,.pdf",className:"hidden",onChange:f})]}),y.jsx("div",{className:"mt-2 h-40 w-full bg-gray-200 rounded overflow-hidden flex items-center justify-center cursor-pointer",onClick:()=>i&&h(!0),children:i?(r==null?void 0:r.type)==="application/pdf"?y.jsx("object",{data:i,type:"application/pdf",width:"100%",height:"100%",children:y.jsxs("p",{className:"text-gray-600 text-sm",children:["Cannot preview PDF."," ",y.jsx("a",{href:i,target:"_blank",rel:"noreferrer",className:"text-blue-600 underline",children:"Download PDF"})]})}):y.jsx("img",{src:i,alt:"Preview",className:"h-full object-contain"}):y.jsx("span",{className:"text-gray-500",children:"No file selected"})}),n&&y.jsx("span",{className:"text-red-500 text-sm mt-1",children:n})]}),d&&i&&y.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-75 z-50 flex items-center justify-center",onClick:()=>h(!1),children:y.jsxs("div",{className:"relative w-full h-full",onClick:T=>T.stopPropagation(),children:[y.jsx("button",{onClick:()=>h(!1),className:"absolute top-2 right-2 text-white text-2xl","aria-label":"Close preview",children:"×"}),(r==null?void 0:r.type)==="application/pdf"?y.jsx("object",{data:i,type:"application/pdf",className:"w-full h-full object-contain"}):y.jsx("img",{src:i,alt:"Full Preview",className:"w-full h-full object-contain"})]})})]})},Me=O.forwardRef(({label:t,required:e=!1,error:r,...s},n)=>y.jsxs("div",{className:"flex flex-col",children:[y.jsxs("label",{htmlFor:s.name,className:"font-medium mb-1 text-gray-700",children:[t,e&&y.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),y.jsx("input",{id:s.name,ref:n,...s,className:`border rounded px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500 ${r?"border-red-500":"border-gray-300"}`}),r&&y.jsx("span",{className:"text-red-500 text-sm mt-1",children:r})]}));Me.displayName="InputField";const Et=Dr(t=>({selectedProvider:null,form:{taxCode:"",companyName:"",representative:"",position:"",email:"",phoneNumber:null,address:"",license:null},selectedPlan:null,setSelectedProvider:e=>t({selectedProvider:e}),setForm:e=>t(r=>({form:{...r.form,...e}})),setSelectedPlan:e=>t({selectedPlan:e}),reset:()=>t({selectedProvider:null,form:{taxCode:"",companyName:"",representative:"",position:"",email:"",phoneNumber:null,address:"",license:null},selectedPlan:null})})),sa=Re.object({taxCode:Re.string().nonempty("Mã số thuế là bắt buộc"),representative:Re.string().nonempty("Người đại diện là bắt buộc"),email:Re.string().nonempty("Email là bắt buộc").email("Email không hợp lệ"),address:Re.string().nonempty("Địa chỉ là bắt buộc"),companyName:Re.string().nonempty("Tên công ty là bắt buộc"),position:Re.string().optional(),phone:Re.string().regex(/^[0-9()+\-\s]+$/,"SĐT không hợp lệ").optional(),license:Re.instanceof(File,{message:"Giấy phép đăng ký kinh doanh là bắt buộc"}).optional()}),na=()=>{const t=Et(f=>f.form),{control:e,handleSubmit:r,formState:{errors:s,isSubmitting:n,isValid:a}}=Us({resolver:qs(sa),defaultValues:{taxCode:t.taxCode||"",representative:t.representative||"",email:t.email||"",address:t.address||"",companyName:t.companyName||"",position:t.position||"",phone:t.phoneNumber||"",license:t.license||void 0}}),i=Et(f=>f.setForm),o=st(f=>f.nextStep),d=st(f=>f.prevStep),h=f=>{console.log(f),i({taxCode:f.taxCode,representative:f.representative,email:f.email,address:f.address,companyName:f.companyName,position:f.position,phoneNumber:f.phone||null,license:f.license||null})};return y.jsxs("form",{onSubmit:r(h),className:"w-full mx-auto p-6 bg-white shadow rounded",children:[y.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:[y.jsxs("div",{className:"space-y-4",children:[y.jsx(De,{name:"taxCode",control:e,render:({field:f})=>{var x;return y.jsx(Me,{...f,label:"Mã số thuế",required:!0,error:(x=s.taxCode)==null?void 0:x.message})}}),y.jsx(De,{name:"representative",control:e,render:({field:f})=>{var x;return y.jsx(Me,{...f,label:"Người đại diện",required:!0,error:(x=s.representative)==null?void 0:x.message})}}),y.jsx(De,{name:"email",control:e,render:({field:f})=>{var x;return y.jsx(Me,{...f,label:"Email",type:"email",required:!0,error:(x=s.email)==null?void 0:x.message})}}),y.jsx(De,{name:"address",control:e,render:({field:f})=>{var x;return y.jsx(Me,{...f,label:"Địa chỉ",required:!0,error:(x=s.address)==null?void 0:x.message})}}),y.jsx(De,{name:"license",control:e,render:({field:f})=>{var x;return y.jsx(ra,{label:"Giấy phép đăng ký kinh doanh",required:!0,file:f.value??null,onFileChange:f.onChange,error:(x=s.license)==null?void 0:x.message})}})]}),y.jsxs("div",{className:"space-y-4",children:[y.jsx(De,{name:"companyName",control:e,render:({field:f})=>{var x;return y.jsx(Me,{...f,label:"Tên công ty",required:!0,error:(x=s.companyName)==null?void 0:x.message})}}),y.jsx(De,{name:"position",control:e,render:({field:f})=>{var x;return y.jsx(Me,{...f,label:"Chức vụ",error:(x=s.position)==null?void 0:x.message})}}),y.jsx(De,{name:"phone",control:e,render:({field:f})=>{var x;return y.jsx(Me,{...f,label:"SĐT",type:"tel",error:(x=s.phone)==null?void 0:x.message})}})]})]}),y.jsxs("div",{className:"flex items-center justify-end gap-2",children:[y.jsx(zt,{title:"Back",handleClick:()=>{d()},className:" !bg-gray-200 !text-gray-700 hover:!bg-gray-300 disabled:!bg-gray-200 disabled:!text-gray-500"}),y.jsx(zt,{type:"submit",title:n?"Submitting...":"Submit",isDisabled:n||Object.keys(s).length>0||!a,handleClick:()=>{o()}})]})]})},aa=({options:t,value:e,onChange:r})=>y.jsx("fieldset",{role:"radiogroup","aria-label":"Chọn gói đăng ký",className:"flex flex-col md:flex-row gap-4 md:gap-20",children:t.map(s=>{const n=s.value===e;return y.jsxs("label",{className:["flex items-center cursor-pointer rounded-lg border p-4 transition",n?"border-green-500 bg-green-50":"border-gray-300 bg-white hover:bg-gray-50"].join(" "),children:[y.jsx("input",{type:"radio",name:"subscription",value:s.value,checked:n,onChange:()=>r(s.value),className:"sr-only"}),y.jsx("span",{className:["flex-shrink-0 flex items-center justify-center rounded-full mr-3",n?"w-5 h-5 border-2 border-green-500 bg-green-500":"w-4 h-4 border border-gray-400"].join(" "),children:n&&y.jsx("span",{className:"block w-2 h-2 bg-white rounded-full"})}),y.jsx("span",{className:n?"text-green-700 font-medium":"text-gray-700",children:s.label})]},s.value)})}),ia=()=>{const t=st(n=>n.nextStep),[e,r]=O.useState("300"),s=[{value:"100",label:"100 đơn/tháng"},{value:"300",label:"300 đơn/tháng"},{value:"500",label:"500 đơn/tháng"}];return y.jsxs("div",{className:"w-full flex flex-col gap-6",children:[y.jsx("h2",{className:"heading",children:"Select subscription package"}),y.jsx(aa,{options:s,value:e,onChange:r}),y.jsx("div",{className:"text-right",children:y.jsx(zt,{title:"Next",isDisabled:!e,handleClick:()=>{t()}})})]})},oa=({checked:t,setChecked:e})=>y.jsxs("label",{className:"relative inline-flex cursor-pointer items-center",children:[y.jsx("input",{type:"checkbox",className:"peer sr-only",checked:t,onChange:r=>e(r.target.checked)}),y.jsx("div",{className:"border-[#ACADAE] relative h-5 w-5 rounded-full border-2 before:absolute before:left-1/2 before:top-1/2 before:hidden before:h-2.5 before:w-2.5 before:-translate-x-1/2 before:-translate-y-1/2 before:rounded-full before:bg-green-500 peer-checked:border-green-500 peer-checked:before:block"})]}),ca=[{name:"M-Invoice",route:"m-invoice"},{name:"FPT",route:"fpt"},{name:"Misa",route:"misa"}],la=({provider:t,handleProviderChange:e})=>{const r=Et(s=>s.selectedProvider);return y.jsxs("div",{"data-checked":r===t.route,className:`flex items-center justify-center gap-2 px-4 py-2 border border-gray-300 rounded-md hover:bg-gray-100 cursor-pointer\r
|
|
23
23
|
transition-colors duration-200 data-[checked=true]:border-green-500 data-[checked=true]:text-green-700\r
|
|
24
|
-
`,onClick:()=>e(t.route),children:[
|
|
24
|
+
`,onClick:()=>e(t.route),children:[y.jsx(oa,{checked:r===t.route,setChecked:()=>e(t.route)}),y.jsx("label",{className:"",children:t.name})]})},ua=()=>{const t=Et(n=>n.selectedProvider),e=Et(n=>n.setSelectedProvider),r=st(n=>n.nextStep),s=n=>{e(n)};return y.jsxs("div",{className:"w-full flex flex-col gap-6",children:[y.jsx("h2",{className:"heading",children:"Select Provider"}),y.jsx("div",{className:"flex gap-20",children:ca.map(n=>y.jsx(la,{provider:n,handleProviderChange:s},n.route))}),y.jsx("div",{className:"text-right",children:y.jsx(zt,{title:"Next",isDisabled:!t,handleClick:()=>{r()}})})]})},da=()=>y.jsx("div",{children:"Status"});function fa(){const t=st(e=>e.step);return y.jsx(y.Fragment,{children:y.jsx(ks,{children:{1:y.jsx(ua,{}),2:y.jsx(na,{}),3:y.jsx(ia,{}),4:y.jsx(da,{})}[t]})})}module.exports=fa;
|