@fileflow/sdk 0.1.0

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.
@@ -0,0 +1,32 @@
1
+ "use strict";const l=require("react/jsx-runtime"),pe=require("react"),_=require("./index-BdodGzlO.js");/**
2
+ * @license lucide-react v0.321.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const Ft=_.createLucideIcon("Car",[["path",{d:"M19 17h2c.6 0 1-.4 1-1v-3c0-.9-.7-1.7-1.5-1.9C18.7 10.6 16 10 16 10s-1.3-1.4-2.2-2.3c-.5-.4-1.1-.7-1.8-.7H5c-.6 0-1.1.4-1.4.9l-1.4 2.9A3.7 3.7 0 0 0 2 12v4c0 .6.4 1 1 1h2",key:"5owen"}],["circle",{cx:"7",cy:"17",r:"2",key:"u2ysq9"}],["path",{d:"M9 17h6",key:"r8uit2"}],["circle",{cx:"17",cy:"17",r:"2",key:"axvx0g"}]]);/**
7
+ * @license lucide-react v0.321.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const Je=_.createLucideIcon("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
12
+ * @license lucide-react v0.321.0 - ISC
13
+ *
14
+ * This source code is licensed under the ISC license.
15
+ * See the LICENSE file in the root directory of this source tree.
16
+ */const ut=_.createLucideIcon("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
17
+ * @license lucide-react v0.321.0 - ISC
18
+ *
19
+ * This source code is licensed under the ISC license.
20
+ * See the LICENSE file in the root directory of this source tree.
21
+ */const Pt=_.createLucideIcon("Home",[["path",{d:"m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"y5dka4"}],["polyline",{points:"9 22 9 12 15 12 15 22",key:"e2us08"}]]);/**
22
+ * @license lucide-react v0.321.0 - ISC
23
+ *
24
+ * This source code is licensed under the ISC license.
25
+ * See the LICENSE file in the root directory of this source tree.
26
+ */const $t=_.createLucideIcon("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/**
27
+ * @license lucide-react v0.321.0 - ISC
28
+ *
29
+ * This source code is licensed under the ISC license.
30
+ * See the LICENSE file in the root directory of this source tree.
31
+ */const Qe=_.createLucideIcon("ShieldCheck",[["path",{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10",key:"1irkt0"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),Xe=r=>({id:null,type:r,status:"uploaded",file:null,previewUrl:null,extractedData:null,confidence:0,fraudFlags:[],error:null}),Ge={sessionId:null,status:"idle",step:"select",requiredDocuments:[],currentDocumentType:null,documents:new Map,isVerified:!1,verificationStatus:null,isLoading:!1,error:null},oe=_.create((r,e)=>({...Ge,setSessionId:t=>r({sessionId:t}),setRequiredDocuments:t=>{const s=new Map;for(const a of t)s.set(a,Xe(a));r({requiredDocuments:t,documents:s,currentDocumentType:t[0]||null})},setCurrentDocumentType:t=>r({currentDocumentType:t}),setDocumentFile:(t,s)=>{const{documents:a}=e(),i=a.get(t)||Xe(t),n=URL.createObjectURL(s),o=new Map(a);o.set(t,{...i,file:s,previewUrl:n,status:"uploaded",error:null}),r({documents:o})},setDocumentStatus:(t,s)=>{const{documents:a}=e(),i=a.get(t);if(i){const n=new Map(a);n.set(t,{...i,status:s}),r({documents:n})}},setDocumentData:(t,s)=>{const{documents:a}=e(),i=a.get(t);if(i){const n=new Map(a);n.set(t,{...i,...s}),r({documents:n})}},clearDocumentPreview:t=>{const{documents:s}=e(),a=s.get(t);a!=null&&a.previewUrl&&URL.revokeObjectURL(a.previewUrl)},setStep:t=>r({step:t}),nextDocument:()=>{const{requiredDocuments:t,currentDocumentType:s,documents:a}=e(),i=s?t.indexOf(s):-1;for(let n=i+1;n<t.length;n++){const o=t[n],d=a.get(o);if(!(d!=null&&d.file)){r({currentDocumentType:o});return}}r({currentDocumentType:null,step:"processing"})},setVerificationStatus:t=>r({verificationStatus:t}),setVerified:t=>r({isVerified:t}),setStatus:t=>r({status:t}),setLoading:t=>r({isLoading:t}),setError:t=>r({error:t}),getNextRequiredDocument:()=>{const{requiredDocuments:t,documents:s}=e();for(const a of t){const i=s.get(a);if(!(i!=null&&i.file))return a}return null},areAllDocumentsUploaded:()=>{const{requiredDocuments:t,documents:s}=e();return t.every(a=>{const i=s.get(a);return(i==null?void 0:i.file)!==null})},areAllDocumentsProcessed:()=>{const{requiredDocuments:t,documents:s}=e();return t.every(a=>{const i=s.get(a);return(i==null?void 0:i.status)==="completed"||(i==null?void 0:i.status)==="requires_review"})},reset:()=>{const{documents:t}=e();for(const s of t.values())s.previewUrl&&URL.revokeObjectURL(s.previewUrl);r(Ge)}}));var k;(function(r){r.assertEqual=a=>{};function e(a){}r.assertIs=e;function t(a){throw new Error}r.assertNever=t,r.arrayToEnum=a=>{const i={};for(const n of a)i[n]=n;return i},r.getValidEnumValues=a=>{const i=r.objectKeys(a).filter(o=>typeof a[a[o]]!="number"),n={};for(const o of i)n[o]=a[o];return r.objectValues(n)},r.objectValues=a=>r.objectKeys(a).map(function(i){return a[i]}),r.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{const i=[];for(const n in a)Object.prototype.hasOwnProperty.call(a,n)&&i.push(n);return i},r.find=(a,i)=>{for(const n of a)if(i(n))return n},r.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function s(a,i=" | "){return a.map(n=>typeof n=="string"?`'${n}'`:n).join(i)}r.joinValues=s,r.jsonStringifyReplacer=(a,i)=>typeof i=="bigint"?i.toString():i})(k||(k={}));var et;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(et||(et={}));const m=k.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),U=r=>{switch(typeof r){case"undefined":return m.undefined;case"string":return m.string;case"number":return Number.isNaN(r)?m.nan:m.number;case"boolean":return m.boolean;case"function":return m.function;case"bigint":return m.bigint;case"symbol":return m.symbol;case"object":return Array.isArray(r)?m.array:r===null?m.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?m.promise:typeof Map<"u"&&r instanceof Map?m.map:typeof Set<"u"&&r instanceof Set?m.set:typeof Date<"u"&&r instanceof Date?m.date:m.object;default:return m.unknown}},c=k.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"]);class B 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 t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(i){return i.message},s={_errors:[]},a=i=>{for(const n of i.issues)if(n.code==="invalid_union")n.unionErrors.map(a);else if(n.code==="invalid_return_type")a(n.returnTypeError);else if(n.code==="invalid_arguments")a(n.argumentsError);else if(n.path.length===0)s._errors.push(t(n));else{let o=s,d=0;for(;d<n.path.length;){const h=n.path[d];d===n.path.length-1?(o[h]=o[h]||{_errors:[]},o[h]._errors.push(t(n))):o[h]=o[h]||{_errors:[]},o=o[h],d++}}};return a(this),s}static assert(e){if(!(e instanceof B))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,k.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},s=[];for(const a of this.issues)if(a.path.length>0){const i=a.path[0];t[i]=t[i]||[],t[i].push(e(a))}else s.push(e(a));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}}B.create=r=>new B(r);const Oe=(r,e)=>{let t;switch(r.code){case c.invalid_type:r.received===m.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case c.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,k.jsonStringifyReplacer)}`;break;case c.unrecognized_keys:t=`Unrecognized key(s) in object: ${k.joinValues(r.keys,", ")}`;break;case c.invalid_union:t="Invalid input";break;case c.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${k.joinValues(r.options)}`;break;case c.invalid_enum_value:t=`Invalid enum value. Expected ${k.joinValues(r.options)}, received '${r.received}'`;break;case c.invalid_arguments:t="Invalid function arguments";break;case c.invalid_return_type:t="Invalid function return type";break;case c.invalid_date:t="Invalid date";break;case c.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:k.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case c.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="bigint"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case c.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case c.custom:t="Invalid input";break;case c.invalid_intersection_types:t="Intersection results could not be merged";break;case c.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case c.not_finite:t="Number must be finite";break;default:t=e.defaultError,k.assertNever(r)}return{message:t}};let Bt=Oe;function Ut(){return Bt}const Vt=r=>{const{data:e,path:t,errorMaps:s,issueData:a}=r,i=[...t,...a.path||[]],n={...a,path:i};if(a.message!==void 0)return{...a,path:i,message:a.message};let o="";const d=s.filter(h=>!!h).slice().reverse();for(const h of d)o=h(n,{data:e,defaultError:o}).message;return{...a,path:i,message:o}};function f(r,e){const t=Ut(),s=Vt({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===Oe?void 0:Oe].filter(a=>!!a)});r.common.issues.push(s)}class D{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const s=[];for(const a of t){if(a.status==="aborted")return y;a.status==="dirty"&&e.dirty(),s.push(a.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){const s=[];for(const a of t){const i=await a.key,n=await a.value;s.push({key:i,value:n})}return D.mergeObjectSync(e,s)}static mergeObjectSync(e,t){const s={};for(const a of t){const{key:i,value:n}=a;if(i.status==="aborted"||n.status==="aborted")return y;i.status==="dirty"&&e.dirty(),n.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof n.value<"u"||a.alwaysSet)&&(s[i.value]=n.value)}return{status:e.value,value:s}}}const y=Object.freeze({status:"aborted"}),ie=r=>({status:"dirty",value:r}),O=r=>({status:"valid",value:r}),tt=r=>r.status==="aborted",st=r=>r.status==="dirty",te=r=>r.status==="valid",he=r=>typeof Promise<"u"&&r instanceof Promise;var p;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(p||(p={}));class L{constructor(e,t,s,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=a}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 rt=(r,e)=>{if(te(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new B(r.common.issues);return this._error=t,this._error}}};function v(r){if(!r)return{};const{errorMap:e,invalid_type_error:t,required_error:s,description:a}=r;if(e&&(t||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:(n,o)=>{const{message:d}=r;return n.code==="invalid_enum_value"?{message:d??o.defaultError}:typeof o.data>"u"?{message:d??s??o.defaultError}:n.code!=="invalid_type"?{message:o.defaultError}:{message:d??t??o.defaultError}},description:a}}class b{get description(){return this._def.description}_getType(e){return U(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:U(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new D,ctx:{common:e.parent.common,data:e.data,parsedType:U(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(he(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){const s={common:{issues:[],async:(t==null?void 0:t.async)??!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:U(e)},a=this._parseSync({data:e,path:s.path,parent:s});return rt(s,a)}"~validate"(e){var s,a;const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:U(e)};if(!this["~standard"].async)try{const i=this._parseSync({data:e,path:[],parent:t});return te(i)?{value:i.value}:{issues:t.common.issues}}catch(i){(a=(s=i==null?void 0:i.message)==null?void 0:s.toLowerCase())!=null&&a.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(i=>te(i)?{value:i.value}:{issues:t.common.issues})}async parseAsync(e,t){const s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){const s={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:U(e)},a=this._parse({data:e,path:s.path,parent:s}),i=await(he(a)?a:Promise.resolve(a));return rt(s,i)}refine(e,t){const s=a=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(a):t;return this._refinement((a,i)=>{const n=e(a),o=()=>i.addIssue({code:c.custom,...s(a)});return typeof Promise<"u"&&n instanceof Promise?n.then(d=>d?!0:(o(),!1)):n?!0:(o(),!1)})}refinement(e,t){return this._refinement((s,a)=>e(s)?!0:(a.addIssue(typeof t=="function"?t(s,a):t),!1))}_refinement(e){return new J({schema:this,typeName:g.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:t=>this["~validate"](t)}}optional(){return $.create(this,this._def)}nullable(){return Q.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Z.create(this)}promise(){return ke.create(this,this._def)}or(e){return ve.create([this,e],this._def)}and(e){return xe.create(this,e,this._def)}transform(e){return new J({...v(this._def),schema:this,typeName:g.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new we({...v(this._def),innerType:this,defaultValue:t,typeName:g.ZodDefault})}brand(){return new yt({typeName:g.ZodBranded,type:this,...v(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new Ne({...v(this._def),innerType:this,catchValue:t,typeName:g.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Pe.create(this,e)}readonly(){return Ce.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const zt=/^c[^\s-]{8,}$/i,Yt=/^[0-9a-z]+$/,Wt=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ht=/^[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,Kt=/^[a-z0-9_-]{21}$/i,Jt=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Qt=/^[-+]?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)?)??$/,Xt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Gt="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Ie;const es=/^(?:(?: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])$/,ts=/^(?:(?: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])$/,ss=/^(([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]))$/,rs=/^(([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])$/,as=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,is=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,mt="((\\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])))",ns=new RegExp(`^${mt}$`);function pt(r){let e="[0-5]\\d";r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`);const t=r.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function os(r){return new RegExp(`^${pt(r)}$`)}function ls(r){let e=`${mt}T${pt(r)}`;const t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function cs(r,e){return!!((e==="v4"||!e)&&es.test(r)||(e==="v6"||!e)&&ss.test(r))}function ds(r,e){if(!Jt.test(r))return!1;try{const[t]=r.split(".");if(!t)return!1;const s=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),a=JSON.parse(atob(s));return!(typeof a!="object"||a===null||"typ"in a&&(a==null?void 0:a.typ)!=="JWT"||!a.alg||e&&a.alg!==e)}catch{return!1}}function fs(r,e){return!!((e==="v4"||!e)&&ts.test(r)||(e==="v6"||!e)&&rs.test(r))}class P extends b{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==m.string){const i=this._getOrReturnCtx(e);return f(i,{code:c.invalid_type,expected:m.string,received:i.parsedType}),y}const s=new D;let a;for(const i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(a=this._getOrReturnCtx(e,a),f(a,{code:c.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),s.dirty());else if(i.kind==="max")e.data.length>i.value&&(a=this._getOrReturnCtx(e,a),f(a,{code:c.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),s.dirty());else if(i.kind==="length"){const n=e.data.length>i.value,o=e.data.length<i.value;(n||o)&&(a=this._getOrReturnCtx(e,a),n?f(a,{code:c.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):o&&f(a,{code:c.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),s.dirty())}else if(i.kind==="email")Xt.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"email",code:c.invalid_string,message:i.message}),s.dirty());else if(i.kind==="emoji")Ie||(Ie=new RegExp(Gt,"u")),Ie.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"emoji",code:c.invalid_string,message:i.message}),s.dirty());else if(i.kind==="uuid")Ht.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"uuid",code:c.invalid_string,message:i.message}),s.dirty());else if(i.kind==="nanoid")Kt.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"nanoid",code:c.invalid_string,message:i.message}),s.dirty());else if(i.kind==="cuid")zt.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"cuid",code:c.invalid_string,message:i.message}),s.dirty());else if(i.kind==="cuid2")Yt.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"cuid2",code:c.invalid_string,message:i.message}),s.dirty());else if(i.kind==="ulid")Wt.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"ulid",code:c.invalid_string,message:i.message}),s.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),f(a,{validation:"url",code:c.invalid_string,message:i.message}),s.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"regex",code:c.invalid_string,message:i.message}),s.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(a=this._getOrReturnCtx(e,a),f(a,{code:c.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),s.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(a=this._getOrReturnCtx(e,a),f(a,{code:c.invalid_string,validation:{startsWith:i.value},message:i.message}),s.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(a=this._getOrReturnCtx(e,a),f(a,{code:c.invalid_string,validation:{endsWith:i.value},message:i.message}),s.dirty()):i.kind==="datetime"?ls(i).test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{code:c.invalid_string,validation:"datetime",message:i.message}),s.dirty()):i.kind==="date"?ns.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{code:c.invalid_string,validation:"date",message:i.message}),s.dirty()):i.kind==="time"?os(i).test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{code:c.invalid_string,validation:"time",message:i.message}),s.dirty()):i.kind==="duration"?Qt.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"duration",code:c.invalid_string,message:i.message}),s.dirty()):i.kind==="ip"?cs(e.data,i.version)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"ip",code:c.invalid_string,message:i.message}),s.dirty()):i.kind==="jwt"?ds(e.data,i.alg)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"jwt",code:c.invalid_string,message:i.message}),s.dirty()):i.kind==="cidr"?fs(e.data,i.version)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"cidr",code:c.invalid_string,message:i.message}),s.dirty()):i.kind==="base64"?as.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"base64",code:c.invalid_string,message:i.message}),s.dirty()):i.kind==="base64url"?is.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"base64url",code:c.invalid_string,message:i.message}),s.dirty()):k.assertNever(i);return{status:s.value,value:e.data}}_regex(e,t,s){return this.refinement(a=>e.test(a),{validation:t,code:c.invalid_string,...p.errToObj(s)})}_addCheck(e){return new P({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...p.errToObj(e)})}url(e){return this._addCheck({kind:"url",...p.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...p.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...p.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...p.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...p.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...p.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...p.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...p.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...p.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...p.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...p.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...p.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,...p.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,...p.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...p.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...p.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...p.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...p.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...p.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...p.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...p.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...p.errToObj(t)})}nonempty(e){return this.min(1,p.errToObj(e))}trim(){return new P({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new P({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new P({...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 t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}P.create=r=>new P({checks:[],typeName:g.ZodString,coerce:(r==null?void 0:r.coerce)??!1,...v(r)});function us(r,e){const t=(r.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,a=t>s?t:s,i=Number.parseInt(r.toFixed(a).replace(".","")),n=Number.parseInt(e.toFixed(a).replace(".",""));return i%n/10**a}class se extends b{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)!==m.number){const i=this._getOrReturnCtx(e);return f(i,{code:c.invalid_type,expected:m.number,received:i.parsedType}),y}let s;const a=new D;for(const i of this._def.checks)i.kind==="int"?k.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{code:c.invalid_type,expected:"integer",received:"float",message:i.message}),a.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(s=this._getOrReturnCtx(e,s),f(s,{code:c.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),a.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(s=this._getOrReturnCtx(e,s),f(s,{code:c.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),a.dirty()):i.kind==="multipleOf"?us(e.data,i.value)!==0&&(s=this._getOrReturnCtx(e,s),f(s,{code:c.not_multiple_of,multipleOf:i.value,message:i.message}),a.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{code:c.not_finite,message:i.message}),a.dirty()):k.assertNever(i);return{status:a.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,p.toString(t))}gt(e,t){return this.setLimit("min",e,!1,p.toString(t))}lte(e,t){return this.setLimit("max",e,!0,p.toString(t))}lt(e,t){return this.setLimit("max",e,!1,p.toString(t))}setLimit(e,t,s,a){return new se({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:p.toString(a)}]})}_addCheck(e){return new se({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:p.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:p.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:p.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:p.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:p.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:p.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:p.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:p.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:p.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&k.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(t===null||s.value>t)&&(t=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}}se.create=r=>new se({checks:[],typeName:g.ZodNumber,coerce:(r==null?void 0:r.coerce)||!1,...v(r)});class le extends b{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)!==m.bigint)return this._getInvalidInput(e);let s;const a=new D;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(s=this._getOrReturnCtx(e,s),f(s,{code:c.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),a.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(s=this._getOrReturnCtx(e,s),f(s,{code:c.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),a.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),f(s,{code:c.not_multiple_of,multipleOf:i.value,message:i.message}),a.dirty()):k.assertNever(i);return{status:a.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return f(t,{code:c.invalid_type,expected:m.bigint,received:t.parsedType}),y}gte(e,t){return this.setLimit("min",e,!0,p.toString(t))}gt(e,t){return this.setLimit("min",e,!1,p.toString(t))}lte(e,t){return this.setLimit("max",e,!0,p.toString(t))}lt(e,t){return this.setLimit("max",e,!1,p.toString(t))}setLimit(e,t,s,a){return new le({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:p.toString(a)}]})}_addCheck(e){return new le({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:p.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:p.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:p.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:p.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:p.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}le.create=r=>new le({checks:[],typeName:g.ZodBigInt,coerce:(r==null?void 0:r.coerce)??!1,...v(r)});class Re extends b{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==m.boolean){const s=this._getOrReturnCtx(e);return f(s,{code:c.invalid_type,expected:m.boolean,received:s.parsedType}),y}return O(e.data)}}Re.create=r=>new Re({typeName:g.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1,...v(r)});class ye extends b{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==m.date){const i=this._getOrReturnCtx(e);return f(i,{code:c.invalid_type,expected:m.date,received:i.parsedType}),y}if(Number.isNaN(e.data.getTime())){const i=this._getOrReturnCtx(e);return f(i,{code:c.invalid_date}),y}const s=new D;let a;for(const i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(a=this._getOrReturnCtx(e,a),f(a,{code:c.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),s.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(a=this._getOrReturnCtx(e,a),f(a,{code:c.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),s.dirty()):k.assertNever(i);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new ye({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:p.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:p.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}ye.create=r=>new ye({checks:[],coerce:(r==null?void 0:r.coerce)||!1,typeName:g.ZodDate,...v(r)});class at extends b{_parse(e){if(this._getType(e)!==m.symbol){const s=this._getOrReturnCtx(e);return f(s,{code:c.invalid_type,expected:m.symbol,received:s.parsedType}),y}return O(e.data)}}at.create=r=>new at({typeName:g.ZodSymbol,...v(r)});class Ee extends b{_parse(e){if(this._getType(e)!==m.undefined){const s=this._getOrReturnCtx(e);return f(s,{code:c.invalid_type,expected:m.undefined,received:s.parsedType}),y}return O(e.data)}}Ee.create=r=>new Ee({typeName:g.ZodUndefined,...v(r)});class ge extends b{_parse(e){if(this._getType(e)!==m.null){const s=this._getOrReturnCtx(e);return f(s,{code:c.invalid_type,expected:m.null,received:s.parsedType}),y}return O(e.data)}}ge.create=r=>new ge({typeName:g.ZodNull,...v(r)});class it extends b{constructor(){super(...arguments),this._any=!0}_parse(e){return O(e.data)}}it.create=r=>new it({typeName:g.ZodAny,...v(r)});class Me extends b{constructor(){super(...arguments),this._unknown=!0}_parse(e){return O(e.data)}}Me.create=r=>new Me({typeName:g.ZodUnknown,...v(r)});class V extends b{_parse(e){const t=this._getOrReturnCtx(e);return f(t,{code:c.invalid_type,expected:m.never,received:t.parsedType}),y}}V.create=r=>new V({typeName:g.ZodNever,...v(r)});class nt extends b{_parse(e){if(this._getType(e)!==m.undefined){const s=this._getOrReturnCtx(e);return f(s,{code:c.invalid_type,expected:m.void,received:s.parsedType}),y}return O(e.data)}}nt.create=r=>new nt({typeName:g.ZodVoid,...v(r)});class Z extends b{_parse(e){const{ctx:t,status:s}=this._processInputParams(e),a=this._def;if(t.parsedType!==m.array)return f(t,{code:c.invalid_type,expected:m.array,received:t.parsedType}),y;if(a.exactLength!==null){const n=t.data.length>a.exactLength.value,o=t.data.length<a.exactLength.value;(n||o)&&(f(t,{code:n?c.too_big:c.too_small,minimum:o?a.exactLength.value:void 0,maximum:n?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),s.dirty())}if(a.minLength!==null&&t.data.length<a.minLength.value&&(f(t,{code:c.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),s.dirty()),a.maxLength!==null&&t.data.length>a.maxLength.value&&(f(t,{code:c.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map((n,o)=>a.type._parseAsync(new L(t,n,t.path,o)))).then(n=>D.mergeArray(s,n));const i=[...t.data].map((n,o)=>a.type._parseSync(new L(t,n,t.path,o)));return D.mergeArray(s,i)}get element(){return this._def.type}min(e,t){return new Z({...this._def,minLength:{value:e,message:p.toString(t)}})}max(e,t){return new Z({...this._def,maxLength:{value:e,message:p.toString(t)}})}length(e,t){return new Z({...this._def,exactLength:{value:e,message:p.toString(t)}})}nonempty(e){return this.min(1,e)}}Z.create=(r,e)=>new Z({type:r,minLength:null,maxLength:null,exactLength:null,typeName:g.ZodArray,...v(e)});function ee(r){if(r instanceof j){const e={};for(const t in r.shape){const s=r.shape[t];e[t]=$.create(ee(s))}return new j({...r._def,shape:()=>e})}else return r instanceof Z?new Z({...r._def,type:ee(r.element)}):r instanceof $?$.create(ee(r.unwrap())):r instanceof Q?Q.create(ee(r.unwrap())):r instanceof H?H.create(r.items.map(e=>ee(e))):r}class j extends b{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(),t=k.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==m.object){const h=this._getOrReturnCtx(e);return f(h,{code:c.invalid_type,expected:m.object,received:h.parsedType}),y}const{status:s,ctx:a}=this._processInputParams(e),{shape:i,keys:n}=this._getCached(),o=[];if(!(this._def.catchall instanceof V&&this._def.unknownKeys==="strip"))for(const h in a.data)n.includes(h)||o.push(h);const d=[];for(const h of n){const x=i[h],R=a.data[h];d.push({key:{status:"valid",value:h},value:x._parse(new L(a,R,a.path,h)),alwaysSet:h in a.data})}if(this._def.catchall instanceof V){const h=this._def.unknownKeys;if(h==="passthrough")for(const x of o)d.push({key:{status:"valid",value:x},value:{status:"valid",value:a.data[x]}});else if(h==="strict")o.length>0&&(f(a,{code:c.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 x of o){const R=a.data[x];d.push({key:{status:"valid",value:x},value:h._parse(new L(a,R,a.path,x)),alwaysSet:x in a.data})}}return a.common.async?Promise.resolve().then(async()=>{const h=[];for(const x of d){const R=await x.key,re=await x.value;h.push({key:R,value:re,alwaysSet:x.alwaysSet})}return h}).then(h=>D.mergeObjectSync(s,h)):D.mergeObjectSync(s,d)}get shape(){return this._def.shape()}strict(e){return p.errToObj,new j({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{var i,n;const a=((n=(i=this._def).errorMap)==null?void 0:n.call(i,t,s).message)??s.defaultError;return t.code==="unrecognized_keys"?{message:p.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new j({...this._def,unknownKeys:"strip"})}passthrough(){return new j({...this._def,unknownKeys:"passthrough"})}extend(e){return new j({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new j({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:g.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new j({...this._def,catchall:e})}pick(e){const t={};for(const s of k.objectKeys(e))e[s]&&this.shape[s]&&(t[s]=this.shape[s]);return new j({...this._def,shape:()=>t})}omit(e){const t={};for(const s of k.objectKeys(this.shape))e[s]||(t[s]=this.shape[s]);return new j({...this._def,shape:()=>t})}deepPartial(){return ee(this)}partial(e){const t={};for(const s of k.objectKeys(this.shape)){const a=this.shape[s];e&&!e[s]?t[s]=a:t[s]=a.optional()}return new j({...this._def,shape:()=>t})}required(e){const t={};for(const s of k.objectKeys(this.shape))if(e&&!e[s])t[s]=this.shape[s];else{let i=this.shape[s];for(;i instanceof $;)i=i._def.innerType;t[s]=i}return new j({...this._def,shape:()=>t})}keyof(){return ht(k.objectKeys(this.shape))}}j.create=(r,e)=>new j({shape:()=>r,unknownKeys:"strip",catchall:V.create(),typeName:g.ZodObject,...v(e)});j.strictCreate=(r,e)=>new j({shape:()=>r,unknownKeys:"strict",catchall:V.create(),typeName:g.ZodObject,...v(e)});j.lazycreate=(r,e)=>new j({shape:r,unknownKeys:"strip",catchall:V.create(),typeName:g.ZodObject,...v(e)});class ve extends b{_parse(e){const{ctx:t}=this._processInputParams(e),s=this._def.options;function a(i){for(const o of i)if(o.result.status==="valid")return o.result;for(const o of i)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const n=i.map(o=>new B(o.ctx.common.issues));return f(t,{code:c.invalid_union,unionErrors:n}),y}if(t.common.async)return Promise.all(s.map(async i=>{const n={...t,common:{...t.common,issues:[]},parent:null};return{result:await i._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}})).then(a);{let i;const n=[];for(const d of s){const h={...t,common:{...t.common,issues:[]},parent:null},x=d._parseSync({data:t.data,path:t.path,parent:h});if(x.status==="valid")return x;x.status==="dirty"&&!i&&(i={result:x,ctx:h}),h.common.issues.length&&n.push(h.common.issues)}if(i)return t.common.issues.push(...i.ctx.common.issues),i.result;const o=n.map(d=>new B(d));return f(t,{code:c.invalid_union,unionErrors:o}),y}}get options(){return this._def.options}}ve.create=(r,e)=>new ve({options:r,typeName:g.ZodUnion,...v(e)});const F=r=>r instanceof Le?F(r.schema):r instanceof J?F(r.innerType()):r instanceof be?[r.value]:r instanceof K?r.options:r instanceof qe?k.objectValues(r.enum):r instanceof we?F(r._def.innerType):r instanceof Ee?[void 0]:r instanceof ge?[null]:r instanceof $?[void 0,...F(r.unwrap())]:r instanceof Q?[null,...F(r.unwrap())]:r instanceof yt||r instanceof Ce?F(r.unwrap()):r instanceof Ne?F(r._def.innerType):[];class Fe extends b{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.object)return f(t,{code:c.invalid_type,expected:m.object,received:t.parsedType}),y;const s=this.discriminator,a=t.data[s],i=this.optionsMap.get(a);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(f(t,{code:c.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),y)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){const a=new Map;for(const i of t){const n=F(i.shape[e]);if(!n.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of n){if(a.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);a.set(o,i)}}return new Fe({typeName:g.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,...v(s)})}}function Ze(r,e){const t=U(r),s=U(e);if(r===e)return{valid:!0,data:r};if(t===m.object&&s===m.object){const a=k.objectKeys(e),i=k.objectKeys(r).filter(o=>a.indexOf(o)!==-1),n={...r,...e};for(const o of i){const d=Ze(r[o],e[o]);if(!d.valid)return{valid:!1};n[o]=d.data}return{valid:!0,data:n}}else if(t===m.array&&s===m.array){if(r.length!==e.length)return{valid:!1};const a=[];for(let i=0;i<r.length;i++){const n=r[i],o=e[i],d=Ze(n,o);if(!d.valid)return{valid:!1};a.push(d.data)}return{valid:!0,data:a}}else return t===m.date&&s===m.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}class xe extends b{_parse(e){const{status:t,ctx:s}=this._processInputParams(e),a=(i,n)=>{if(tt(i)||tt(n))return y;const o=Ze(i.value,n.value);return o.valid?((st(i)||st(n))&&t.dirty(),{status:t.value,value:o.data}):(f(s,{code:c.invalid_intersection_types}),y)};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(([i,n])=>a(i,n)):a(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}xe.create=(r,e,t)=>new xe({left:r,right:e,typeName:g.ZodIntersection,...v(t)});class H extends b{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==m.array)return f(s,{code:c.invalid_type,expected:m.array,received:s.parsedType}),y;if(s.data.length<this._def.items.length)return f(s,{code:c.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),y;!this._def.rest&&s.data.length>this._def.items.length&&(f(s,{code:c.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const i=[...s.data].map((n,o)=>{const d=this._def.items[o]||this._def.rest;return d?d._parse(new L(s,n,s.path,o)):null}).filter(n=>!!n);return s.common.async?Promise.all(i).then(n=>D.mergeArray(t,n)):D.mergeArray(t,i)}get items(){return this._def.items}rest(e){return new H({...this._def,rest:e})}}H.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new H({items:r,typeName:g.ZodTuple,rest:null,...v(e)})};class _e extends b{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==m.object)return f(s,{code:c.invalid_type,expected:m.object,received:s.parsedType}),y;const a=[],i=this._def.keyType,n=this._def.valueType;for(const o in s.data)a.push({key:i._parse(new L(s,o,s.path,o)),value:n._parse(new L(s,s.data[o],s.path,o)),alwaysSet:o in s.data});return s.common.async?D.mergeObjectAsync(t,a):D.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof b?new _e({keyType:e,valueType:t,typeName:g.ZodRecord,...v(s)}):new _e({keyType:P.create(),valueType:e,typeName:g.ZodRecord,...v(t)})}}class ot extends b{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==m.map)return f(s,{code:c.invalid_type,expected:m.map,received:s.parsedType}),y;const a=this._def.keyType,i=this._def.valueType,n=[...s.data.entries()].map(([o,d],h)=>({key:a._parse(new L(s,o,s.path,[h,"key"])),value:i._parse(new L(s,d,s.path,[h,"value"]))}));if(s.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const d of n){const h=await d.key,x=await d.value;if(h.status==="aborted"||x.status==="aborted")return y;(h.status==="dirty"||x.status==="dirty")&&t.dirty(),o.set(h.value,x.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const d of n){const h=d.key,x=d.value;if(h.status==="aborted"||x.status==="aborted")return y;(h.status==="dirty"||x.status==="dirty")&&t.dirty(),o.set(h.value,x.value)}return{status:t.value,value:o}}}}ot.create=(r,e,t)=>new ot({valueType:e,keyType:r,typeName:g.ZodMap,...v(t)});class ce extends b{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==m.set)return f(s,{code:c.invalid_type,expected:m.set,received:s.parsedType}),y;const a=this._def;a.minSize!==null&&s.data.size<a.minSize.value&&(f(s,{code:c.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),a.maxSize!==null&&s.data.size>a.maxSize.value&&(f(s,{code:c.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());const i=this._def.valueType;function n(d){const h=new Set;for(const x of d){if(x.status==="aborted")return y;x.status==="dirty"&&t.dirty(),h.add(x.value)}return{status:t.value,value:h}}const o=[...s.data.values()].map((d,h)=>i._parse(new L(s,d,s.path,h)));return s.common.async?Promise.all(o).then(d=>n(d)):n(o)}min(e,t){return new ce({...this._def,minSize:{value:e,message:p.toString(t)}})}max(e,t){return new ce({...this._def,maxSize:{value:e,message:p.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}ce.create=(r,e)=>new ce({valueType:r,minSize:null,maxSize:null,typeName:g.ZodSet,...v(e)});class Le extends b{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}Le.create=(r,e)=>new Le({getter:r,typeName:g.ZodLazy,...v(e)});class be extends b{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return f(t,{received:t.data,code:c.invalid_literal,expected:this._def.value}),y}return{status:"valid",value:e.data}}get value(){return this._def.value}}be.create=(r,e)=>new be({value:r,typeName:g.ZodLiteral,...v(e)});function ht(r,e){return new K({values:r,typeName:g.ZodEnum,...v(e)})}class K extends b{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),s=this._def.values;return f(t,{expected:k.joinValues(s),received:t.parsedType,code:c.invalid_type}),y}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),s=this._def.values;return f(t,{received:t.data,code:c.invalid_enum_value,options:s}),y}return O(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return K.create(e,{...this._def,...t})}exclude(e,t=this._def){return K.create(this.options.filter(s=>!e.includes(s)),{...this._def,...t})}}K.create=ht;class qe extends b{_parse(e){const t=k.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==m.string&&s.parsedType!==m.number){const a=k.objectValues(t);return f(s,{expected:k.joinValues(a),received:s.parsedType,code:c.invalid_type}),y}if(this._cache||(this._cache=new Set(k.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const a=k.objectValues(t);return f(s,{received:s.data,code:c.invalid_enum_value,options:a}),y}return O(e.data)}get enum(){return this._def.values}}qe.create=(r,e)=>new qe({values:r,typeName:g.ZodNativeEnum,...v(e)});class ke extends b{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.promise&&t.common.async===!1)return f(t,{code:c.invalid_type,expected:m.promise,received:t.parsedType}),y;const s=t.parsedType===m.promise?t.data:Promise.resolve(t.data);return O(s.then(a=>this._def.type.parseAsync(a,{path:t.path,errorMap:t.common.contextualErrorMap})))}}ke.create=(r,e)=>new ke({type:r,typeName:g.ZodPromise,...v(e)});class J extends b{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===g.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:s}=this._processInputParams(e),a=this._def.effect||null,i={addIssue:n=>{f(s,n),n.fatal?t.abort():t.dirty()},get path(){return s.path}};if(i.addIssue=i.addIssue.bind(i),a.type==="preprocess"){const n=a.transform(s.data,i);if(s.common.async)return Promise.resolve(n).then(async o=>{if(t.value==="aborted")return y;const d=await this._def.schema._parseAsync({data:o,path:s.path,parent:s});return d.status==="aborted"?y:d.status==="dirty"||t.value==="dirty"?ie(d.value):d});{if(t.value==="aborted")return y;const o=this._def.schema._parseSync({data:n,path:s.path,parent:s});return o.status==="aborted"?y:o.status==="dirty"||t.value==="dirty"?ie(o.value):o}}if(a.type==="refinement"){const n=o=>{const d=a.refinement(o,i);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"?y:(o.status==="dirty"&&t.dirty(),n(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>o.status==="aborted"?y:(o.status==="dirty"&&t.dirty(),n(o.value).then(()=>({status:t.value,value:o.value}))))}if(a.type==="transform")if(s.common.async===!1){const n=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!te(n))return y;const o=a.transform(n.value,i);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(n=>te(n)?Promise.resolve(a.transform(n.value,i)).then(o=>({status:t.value,value:o})):y);k.assertNever(a)}}J.create=(r,e,t)=>new J({schema:r,typeName:g.ZodEffects,effect:e,...v(t)});J.createWithPreprocess=(r,e,t)=>new J({schema:e,effect:{type:"preprocess",transform:r},typeName:g.ZodEffects,...v(t)});class $ extends b{_parse(e){return this._getType(e)===m.undefined?O(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}$.create=(r,e)=>new $({innerType:r,typeName:g.ZodOptional,...v(e)});class Q extends b{_parse(e){return this._getType(e)===m.null?O(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Q.create=(r,e)=>new Q({innerType:r,typeName:g.ZodNullable,...v(e)});class we extends b{_parse(e){const{ctx:t}=this._processInputParams(e);let s=t.data;return t.parsedType===m.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}we.create=(r,e)=>new we({innerType:r,typeName:g.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...v(e)});class Ne extends b{_parse(e){const{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return he(a)?a.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new B(s.common.issues)},input:s.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new B(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}Ne.create=(r,e)=>new Ne({innerType:r,typeName:g.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...v(e)});class lt extends b{_parse(e){if(this._getType(e)!==m.nan){const s=this._getOrReturnCtx(e);return f(s,{code:c.invalid_type,expected:m.nan,received:s.parsedType}),y}return{status:"valid",value:e.data}}}lt.create=r=>new lt({typeName:g.ZodNaN,...v(r)});class yt extends b{_parse(e){const{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}}class Pe extends b{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return i.status==="aborted"?y:i.status==="dirty"?(t.dirty(),ie(i.value)):this._def.out._parseAsync({data:i.value,path:s.path,parent:s})})();{const a=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?y:a.status==="dirty"?(t.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:s.path,parent:s})}}static create(e,t){return new Pe({in:e,out:t,typeName:g.ZodPipeline})}}class Ce extends b{_parse(e){const t=this._def.innerType._parse(e),s=a=>(te(a)&&(a.value=Object.freeze(a.value)),a);return he(t)?t.then(a=>s(a)):s(t)}unwrap(){return this._def.innerType}}Ce.create=(r,e)=>new Ce({innerType:r,typeName:g.ZodReadonly,...v(e)});var g;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(g||(g={}));const u=P.create,w=se.create,E=Re.create,$e=ge.create,de=Me.create;V.create;const X=Z.create,N=j.create,Be=ve.create,ms=Fe.create;xe.create;H.create;const fe=_e.create,je=be.create,A=K.create;ke.create;$.create;Q.create;var ne={colors:{primary:"#6366f1",primaryHover:"#4f46e5",primaryLight:"#e0e7ff",background:"#f8fafc",backgroundSecondary:"#f1f5f9",backgroundTertiary:"#e2e8f0",surface:"#ffffff",surfaceHover:"#f8fafc",border:"#e2e8f0",borderHover:"#a5b4fc",textPrimary:"#0f172a",textSecondary:"#475569",textMuted:"#94a3b8",textInverse:"#ffffff",success:"#10b981",successLight:"#d1fae5",warning:"#f59e0b",warningLight:"#fef3c7",error:"#ef4444",errorLight:"#fee2e2",info:"#3b82f6",infoLight:"#dbeafe"}};({...ne.colors},{...ne.colors}),{...ne.colors},{...ne.colors};({...ne.colors});var ps=A(["string","number","integer","float","boolean","date","datetime","email","phone","url","enum"]),gt=A(["required","email","phone","url","date","number","integer","float","minLength","maxLength","min","max","pattern","enum","unique","custom"]),vt=A(["error","warning","info"]),hs=N({type:gt,params:fe(de()).optional(),message:u().optional(),severity:vt.optional().default("error")}),ys=A(["trim","lowercase","uppercase","capitalize","toNumber","toDate","toBoolean","replace","custom"]),gs=N({type:ys,params:fe(de()).optional()}),vs=N({key:u().min(1).max(100),label:u().min(1).max(200),type:ps,required:E().optional().default(!1),description:u().max(500).optional(),validators:X(hs).optional(),transform:gs.optional()}),xs=N({allowExtraColumns:E().optional().default(!1),skipEmptyRows:E().optional().default(!0),trimWhitespace:E().optional().default(!0),dateFormat:u().optional(),uniqueKeys:X(u()).optional(),maxRows:w().int().positive().optional().default(1e5)}),_s=N({columns:X(vs).min(1),options:xs.optional()});A(["created","file_uploaded","parsing","parsed","mapping","mapped","validating","validated","editing","completed","failed","cancelled"]);N({schema:_s,metadata:fe(de()).optional()});var bs=N({sourceColumn:u(),targetKey:u().nullable(),confidence:w().min(0).max(1),isAutoMapped:E(),reasoning:u().optional()});N({sessionId:u().uuid(),mappings:X(bs)});N({rowIndex:w().int().nonnegative(),columnKey:u(),value:Be([u(),w(),E(),$e()]),severity:vt,validatorType:gt,message:u(),suggestion:u().optional()});N({sessionId:u().uuid(),rowIndex:w().int().nonnegative(),columnKey:u(),value:Be([u(),w(),E(),$e()])});N({sessionId:u().uuid(),updates:X(N({rowIndex:w().int().nonnegative(),columnKey:u(),value:Be([u(),w(),E(),$e()])}))});N({sessionId:u().uuid(),skipInvalidRows:E().optional().default(!1),acknowledgeWarnings:E().optional().default(!1)});var ks=/^[ABCEGHJ-NPRSTVXY]\d[ABCEGHJ-NPRSTV-Z][ ]?\d[ABCEGHJ-NPRSTV-Z]\d$/i,ws=/^[A-Z]{2}\d{6}$/,Ue={AB:{code:"AB",name:"Alberta",nameInFrench:"Alberta",isTerritory:!1,licenseFormat:/^\d{6,9}$/,licenseFormatDescription:"6-9 digits",licenseExampleFormat:"123456789"},BC:{code:"BC",name:"British Columbia",nameInFrench:"Colombie-Britannique",isTerritory:!1,licenseFormat:/^\d{7}$/,licenseFormatDescription:"7 digits",licenseExampleFormat:"1234567"},MB:{code:"MB",name:"Manitoba",nameInFrench:"Manitoba",isTerritory:!1,licenseFormat:/^[A-Z]{2}\d{6}[A-Z]?$/,licenseFormatDescription:"2 letters + 6 digits + optional letter",licenseExampleFormat:"AB123456C"},NB:{code:"NB",name:"New Brunswick",nameInFrench:"Nouveau-Brunswick",isTerritory:!1,licenseFormat:/^\d{7}$/,licenseFormatDescription:"7 digits",licenseExampleFormat:"1234567"},NL:{code:"NL",name:"Newfoundland and Labrador",nameInFrench:"Terre-Neuve-et-Labrador",isTerritory:!1,licenseFormat:/^[A-Z]\d{9}$/,licenseFormatDescription:"1 letter + 9 digits",licenseExampleFormat:"A123456789"},NS:{code:"NS",name:"Nova Scotia",nameInFrench:"Nouvelle-Écosse",isTerritory:!1,licenseFormat:/^[A-Z]{5}\d{9}$/,licenseFormatDescription:"5 letters + 9 digits",licenseExampleFormat:"ABCDE123456789"},NT:{code:"NT",name:"Northwest Territories",nameInFrench:"Territoires du Nord-Ouest",isTerritory:!0,licenseFormat:/^\d{6}$/,licenseFormatDescription:"6 digits",licenseExampleFormat:"123456"},NU:{code:"NU",name:"Nunavut",nameInFrench:"Nunavut",isTerritory:!0,licenseFormat:/^\d{6}$/,licenseFormatDescription:"6 digits",licenseExampleFormat:"123456"},ON:{code:"ON",name:"Ontario",nameInFrench:"Ontario",isTerritory:!1,licenseFormat:/^[A-Z]\d{4}-\d{5}-\d{5}$|^[A-Z]\d{14}$/,licenseFormatDescription:"1 letter + 14 digits (with or without dashes)",licenseExampleFormat:"A1234-56789-01234"},PE:{code:"PE",name:"Prince Edward Island",nameInFrench:"Île-du-Prince-Édouard",isTerritory:!1,licenseFormat:/^\d{5,6}$/,licenseFormatDescription:"5-6 digits",licenseExampleFormat:"123456"},QC:{code:"QC",name:"Quebec",nameInFrench:"Québec",isTerritory:!1,licenseFormat:/^[A-Z]\d{12}$/,licenseFormatDescription:"1 letter + 12 digits",licenseExampleFormat:"A123456789012"},SK:{code:"SK",name:"Saskatchewan",nameInFrench:"Saskatchewan",isTerritory:!1,licenseFormat:/^\d{8}$/,licenseFormatDescription:"8 digits",licenseExampleFormat:"12345678"},YT:{code:"YT",name:"Yukon",nameInFrench:"Yukon",isTerritory:!0,licenseFormat:/^\d{6}$/,licenseFormatDescription:"6 digits",licenseExampleFormat:"123456"}};Object.fromEntries(Object.entries(Ue).map(([r,e])=>[r,e.name]));var xt=A(["AB","BC","MB","NB","NL","NS","NT","NU","ON","PE","QC","SK","YT"]),_t=N({streetLine1:u().min(1).max(200),streetLine2:u().max(200).optional(),city:u().min(1).max(100),province:xt,postalCode:u().regex(ks,"Invalid Canadian postal code format (A1A 1A1)"),country:je("Canada")}),Ve=A(["passport","drivers_license","proof_of_address"]),Ns=A(["uploaded","processing","completed","failed","requires_review"]),Cs=A(["excellent","good","fair","poor"]),Ss=A(["tesseract","textract","gpt4vision"]),bt=A(["M","F","X"]),js=A(["image_manipulation","poor_quality","inconsistent_data","expired_document","invalid_format","suspicious_pattern","missing_security_features","document_tampering"]),Ts=A(["high","medium","low"]),Ds=N({type:js,severity:Ts,message:u(),field:u().optional(),details:fe(de()).optional()}),As=N({fullName:w().min(0).max(1),passportNumber:w().min(0).max(1),dateOfBirth:w().min(0).max(1),dateOfIssue:w().min(0).max(1),dateOfExpiry:w().min(0).max(1),placeOfBirth:w().min(0).max(1),sex:w().min(0).max(1),nationality:w().min(0).max(1)}),Is=N({documentType:je("passport"),fullName:u().min(1),givenNames:u().min(1),surname:u().min(1),passportNumber:u().regex(ws,"Invalid Canadian passport number (format: AB123456)"),dateOfBirth:u().regex(/^\d{4}-\d{2}-\d{2}$/,"Date must be in YYYY-MM-DD format"),dateOfIssue:u().regex(/^\d{4}-\d{2}-\d{2}$/,"Date must be in YYYY-MM-DD format"),dateOfExpiry:u().regex(/^\d{4}-\d{2}-\d{2}$/,"Date must be in YYYY-MM-DD format"),placeOfBirth:u().min(1),sex:bt,nationality:u().min(1),photoBase64:u().optional(),mrzLine1:u().optional(),mrzLine2:u().optional(),confidence:As}),Os=N({fullName:w().min(0).max(1),licenseNumber:w().min(0).max(1),dateOfBirth:w().min(0).max(1),expiryDate:w().min(0).max(1),address:w().min(0).max(1),province:w().min(0).max(1),licenseClass:w().min(0).max(1)}),kt=N({documentType:je("drivers_license"),fullName:u().min(1),firstName:u().min(1),lastName:u().min(1),middleName:u().optional(),licenseNumber:u().min(1),dateOfBirth:u().regex(/^\d{4}-\d{2}-\d{2}$/,"Date must be in YYYY-MM-DD format"),expiryDate:u().regex(/^\d{4}-\d{2}-\d{2}$/,"Date must be in YYYY-MM-DD format"),issueDate:u().regex(/^\d{4}-\d{2}-\d{2}$/,"Date must be in YYYY-MM-DD format").optional(),address:_t,province:xt,licenseClass:u().min(1),restrictions:u().optional(),endorsements:u().optional(),sex:bt.optional(),height:u().optional(),eyeColor:u().optional(),photoBase64:u().optional(),confidence:Os});kt.refine(r=>Ue[r.province].licenseFormat.test(r.licenseNumber),{message:"License number format doesn't match the province requirements",path:["licenseNumber"]});var Rs=A(["utility_bill","bank_statement","government_letter","tax_statement","lease_agreement","insurance_statement","other"]),Es=N({fullName:w().min(0).max(1),address:w().min(0).max(1),documentSubType:w().min(0).max(1),issuer:w().min(0).max(1),documentDate:w().min(0).max(1)}),wt=N({documentType:je("proof_of_address"),fullName:u().min(1),address:_t,documentSubType:Rs,issuer:u().min(1),documentDate:u().regex(/^\d{4}-\d{2}-\d{2}$/,"Date must be in YYYY-MM-DD format"),accountNumber:u().max(4).optional(),statementPeriod:N({start:u(),end:u()}).optional(),confidence:Es});wt.refine(r=>{const e=new Date(r.documentDate);return(new Date().getTime()-e.getTime())/(1e3*60*60*24)<=90},{message:"Proof of address must be dated within the last 90 days",path:["documentDate"]});var Ms=ms("documentType",[Is,kt,wt]);A(["created","documents_pending","processing","review_required","completed","failed","cancelled"]);N({requiredDocuments:X(Ve).min(1),metadata:fe(de()).optional()});N({sessionId:u().uuid(),documentType:Ve});N({id:u().uuid(),sessionId:u().uuid(),type:Ve,status:Ns,uploadedAt:u().datetime(),processedAt:u().datetime().optional(),originalFilename:u(),fileSize:w().int().positive(),mimeType:u(),s3Key:u(),extractedData:Ms.optional(),confidence:w().min(0).max(1),ocrQuality:Cs,fraudFlags:X(Ds),processingTimeMs:w().int().optional(),ocrProvider:Ss.optional(),aiModel:u().optional()});N({sessionId:u().uuid(),acceptWarnings:E().optional().default(!1)});var ct=["payment","payout","subscription"],Se=["credit_card","digital_cheque","etransfer_request_money","etransfer_standard","interac_online","online_banking","apple_pay","google_pay","ach_payment","etransfer_send_money","visa_direct","credit_send","master_card_send","direct_deposit","rtp_payout","ach_payout","wire_transfer"],dt=["digital","physical"],ft=["daily","weekly","monthly","yearly"],Nt=[{key:"sid",label:"Site ID",type:"integer",required:!0,description:"Your site's unique ID (whole number)",validators:[{type:"required",message:"Site ID is required"},{type:"integer",message:"Site ID must be a whole number"},{type:"min",params:{value:1},message:"Site ID must be a positive number"}]},{key:"type",label:"Transaction Type",type:"enum",required:!0,description:"Type of transaction: payment, payout, or subscription",validators:[{type:"required",message:"Transaction type is required"},{type:"enum",params:{values:ct},message:`Transaction type must be one of: ${ct.join(", ")}`}],transform:{type:"lowercase"}},{key:"methods",label:"Payment Methods",type:"string",required:!0,description:"Payment methods (comma-separated): credit_card, interac_online, etc.",validators:[{type:"required",message:"At least one payment method is required"},{type:"custom",params:{validatorName:"commaSeparatedEnum",allowedValues:Se},message:`Payment methods must be comma-separated values from: ${Se.join(", ")}`}],transform:{type:"lowercase"}},{key:"email",label:"Customer Email",type:"email",required:!0,description:"Customer's email address",validators:[{type:"required",message:"Customer email is required"},{type:"email",message:"Must be a valid email address"}],transform:{type:"trim"}},{key:"item_name",label:"Item Name",type:"string",required:!0,description:"Name of the product or service",validators:[{type:"required",message:"Item name is required"},{type:"minLength",params:{value:1},message:"Item name cannot be empty"},{type:"maxLength",params:{value:255},message:"Item name must be 255 characters or less"}],transform:{type:"trim"}},{key:"item_quantity",label:"Item Quantity",type:"integer",required:!0,description:"Number of items (whole number)",validators:[{type:"required",message:"Item quantity is required"},{type:"integer",message:"Item quantity must be a whole number"},{type:"min",params:{value:1},message:"Item quantity must be at least 1"}]},{key:"item_unit_price",label:"Item Unit Price",type:"float",required:!0,description:"Price per item (decimal number, no currency symbols)",validators:[{type:"required",message:"Item unit price is required"},{type:"float",message:"Item unit price must be a number"},{type:"min",params:{value:0},message:"Item unit price cannot be negative"},{type:"pattern",params:{regex:"^[0-9]+(\\.[0-9]{1,2})?$"},message:"Item unit price must be a number with up to 2 decimal places (no currency symbols)",severity:"warning"}]},{key:"item_type",label:"Item Type",type:"enum",required:!0,description:"Type of item: digital or physical",validators:[{type:"required",message:"Item type is required"},{type:"enum",params:{values:dt},message:`Item type must be one of: ${dt.join(", ")}`}],transform:{type:"lowercase"}},{key:"udf1",label:"Custom Reference (UDF1)",type:"string",required:!0,description:"Your internal reference (invoice number, order ID, etc.)",validators:[{type:"required",message:"Custom reference (UDF1) is required"},{type:"maxLength",params:{value:255},message:"Custom reference must be 255 characters or less"}],transform:{type:"trim"}}],Zs=[{key:"preferred_method",label:"Preferred Payment Method",type:"enum",required:!1,description:"Default payment method selected for customer",validators:[{type:"enum",params:{values:Se},message:`Preferred method must be one of: ${Se.join(", ")}`}],transform:{type:"lowercase"}}],Ls=[{key:"phone",label:"Phone Number",type:"phone",required:!1,description:"Customer phone number",validators:[{type:"phone",message:"Must be a valid phone number",severity:"warning"}],transform:{type:"trim"}},{key:"billing_first_name",label:"Billing First Name",type:"string",required:!1,description:"Customer billing first name",validators:[{type:"maxLength",params:{value:100},message:"First name must be 100 characters or less"}],transform:{type:"trim"}},{key:"billing_last_name",label:"Billing Last Name",type:"string",required:!1,description:"Customer billing last name",validators:[{type:"maxLength",params:{value:100},message:"Last name must be 100 characters or less"}],transform:{type:"trim"}},{key:"billing_address",label:"Billing Address",type:"string",required:!1,description:"Customer billing street address",validators:[{type:"maxLength",params:{value:255},message:"Address must be 255 characters or less"}],transform:{type:"trim"}},{key:"billing_unit_number",label:"Billing Unit Number",type:"string",required:!1,description:"Apartment, suite, or unit number",validators:[{type:"maxLength",params:{value:50},message:"Unit number must be 50 characters or less"}],transform:{type:"trim"}},{key:"billing_city",label:"Billing City",type:"string",required:!1,description:"Customer billing city",validators:[{type:"maxLength",params:{value:100},message:"City must be 100 characters or less"}],transform:{type:"trim"}},{key:"billing_state",label:"Billing State/Province",type:"string",required:!1,description:"State or province code (e.g., ON, BC, CA)",validators:[{type:"maxLength",params:{value:50},message:"State/Province must be 50 characters or less"}],transform:{type:"trim"}},{key:"billing_country",label:"Billing Country",type:"string",required:!1,description:"Country name or code",validators:[{type:"maxLength",params:{value:100},message:"Country must be 100 characters or less"}],transform:{type:"trim"}},{key:"billing_zip_code",label:"Billing Postal/ZIP Code",type:"string",required:!1,description:"Postal or ZIP code",validators:[{type:"maxLength",params:{value:20},message:"Postal code must be 20 characters or less"}],transform:{type:"trim"}},{key:"billing_company",label:"Billing Company",type:"string",required:!1,description:"Company or business name",validators:[{type:"maxLength",params:{value:255},message:"Company name must be 255 characters or less"}],transform:{type:"trim"}}],qs=[{key:"shipping_first_name",label:"Shipping First Name",type:"string",required:!1,description:"Shipping recipient first name",transform:{type:"trim"}},{key:"shipping_last_name",label:"Shipping Last Name",type:"string",required:!1,description:"Shipping recipient last name",transform:{type:"trim"}},{key:"shipping_address",label:"Shipping Address",type:"string",required:!1,description:"Shipping street address",transform:{type:"trim"}},{key:"shipping_unit_number",label:"Shipping Unit Number",type:"string",required:!1,description:"Shipping apartment, suite, or unit number",transform:{type:"trim"}},{key:"shipping_city",label:"Shipping City",type:"string",required:!1,description:"Shipping city",transform:{type:"trim"}},{key:"shipping_state",label:"Shipping State/Province",type:"string",required:!1,description:"Shipping state or province",transform:{type:"trim"}},{key:"shipping_country",label:"Shipping Country",type:"string",required:!1,description:"Shipping country",transform:{type:"trim"}},{key:"shipping_zip_code",label:"Shipping Postal/ZIP Code",type:"string",required:!1,description:"Shipping postal or ZIP code",transform:{type:"trim"}}],Fs=[{key:"item_description",label:"Item Description",type:"string",required:!1,description:"Detailed description of the item",validators:[{type:"maxLength",params:{value:1e3},message:"Description must be 1000 characters or less"}],transform:{type:"trim"}},{key:"item_sku",label:"Item SKU",type:"string",required:!1,description:"Product SKU or identifier",validators:[{type:"maxLength",params:{value:100},message:"SKU must be 100 characters or less"}],transform:{type:"trim"}},{key:"item_image_url",label:"Item Image URL",type:"url",required:!1,description:"URL to product image (must start with http:// or https://)",validators:[{type:"url",message:"Must be a valid URL starting with http:// or https://"}],transform:{type:"trim"}},{key:"additional_items",label:"Additional Items",type:"string",required:!1,description:"Additional items in JSON format",transform:{type:"trim"}}],Ps=[{key:"email_recipients",label:"Email Recipients",type:"string",required:!1,description:"Additional email recipients for notifications",validators:[{type:"custom",params:{validatorName:"commaSeparatedEmails"},message:"Must be valid comma-separated email addresses",severity:"warning"}],transform:{type:"trim"}},{key:"phone_recipients",label:"Phone Recipients",type:"string",required:!1,description:"SMS notification recipients",transform:{type:"trim"}},{key:"notification_info",label:"Notification Info",type:"string",required:!1,description:"Additional notification information",transform:{type:"trim"}}],$s=[{key:"subscription_amount",label:"Subscription Amount",type:"float",required:!1,description:"Recurring subscription amount",validators:[{type:"float",message:"Subscription amount must be a number"},{type:"min",params:{value:0},message:"Amount cannot be negative"}]},{key:"billing_cycle_interval",label:"Billing Cycle Interval",type:"enum",required:!1,description:"Billing frequency: daily, weekly, monthly, yearly",validators:[{type:"enum",params:{values:ft},message:`Billing interval must be one of: ${ft.join(", ")}`}],transform:{type:"lowercase"}},{key:"billing_cycle_interval_count",label:"Billing Cycle Count",type:"integer",required:!1,description:"Number of intervals between billing",validators:[{type:"integer",message:"Must be a whole number"},{type:"min",params:{value:1},message:"Must be at least 1"}]},{key:"billing_cycle_month",label:"Billing Cycle Month",type:"integer",required:!1,description:"Month for yearly billing (1-12)",validators:[{type:"integer",message:"Must be a whole number"},{type:"min",params:{value:1},message:"Month must be 1-12"},{type:"max",params:{value:12},message:"Month must be 1-12"}]},{key:"billing_cycle_week",label:"Billing Cycle Week",type:"integer",required:!1,description:"Week number for billing",validators:[{type:"integer",message:"Must be a whole number"}]},{key:"billing_cycle_day_of_month",label:"Billing Day of Month",type:"integer",required:!1,description:"Day of month for billing (1-31)",validators:[{type:"integer",message:"Must be a whole number"},{type:"min",params:{value:1},message:"Day must be 1-31"},{type:"max",params:{value:31},message:"Day must be 1-31"}]},{key:"billing_cycle_day_of_week",label:"Billing Day of Week",type:"integer",required:!1,description:"Day of week for billing (0=Sunday, 6=Saturday)",validators:[{type:"integer",message:"Must be a whole number"},{type:"min",params:{value:0},message:"Day must be 0-6"},{type:"max",params:{value:6},message:"Day must be 0-6"}]},{key:"billing_cycle_expression",label:"Billing Cycle Expression",type:"string",required:!1,description:"Cron expression for custom billing schedule",transform:{type:"trim"}},{key:"billing_cycle_weekday",label:"Billing Cycle Weekday",type:"boolean",required:!1,description:"Whether to bill only on weekdays"},{key:"billing_cycle_start_at",label:"Billing Cycle Start Date",type:"datetime",required:!1,description:"Start date for billing cycle (ISO 8601 format)",validators:[{type:"date",message:"Must be a valid date/time"}]}],Bs=[{key:"return_url",label:"Return URL",type:"url",required:!1,description:"URL to redirect after successful payment",validators:[{type:"url",message:"Must be a valid URL starting with http:// or https://"}],transform:{type:"trim"}},{key:"failed_return_url",label:"Failed Return URL",type:"url",required:!1,description:"URL to redirect after failed payment",validators:[{type:"url",message:"Must be a valid URL starting with http:// or https://"}],transform:{type:"trim"}},{key:"merchant_ntf_url",label:"Merchant Notification URL",type:"url",required:!1,description:"Webhook URL for payment notifications",validators:[{type:"url",message:"Must be a valid URL starting with http:// or https://"}],transform:{type:"trim"}}],Us=[{key:"convinience_fee",label:"Convenience Fee",type:"float",required:!1,description:"Additional convenience fee amount",validators:[{type:"float",message:"Fee must be a number"},{type:"min",params:{value:0},message:"Fee cannot be negative"}]},{key:"udf2",label:"Custom Field 2 (UDF2)",type:"string",required:!1,description:"Additional custom reference field",validators:[{type:"maxLength",params:{value:255},message:"Must be 255 characters or less"}],transform:{type:"trim"}},{key:"udf3",label:"Custom Field 3 (UDF3)",type:"string",required:!1,description:"Additional custom reference field",validators:[{type:"maxLength",params:{value:255},message:"Must be 255 characters or less"}],transform:{type:"trim"}}],Vs={columns:[...Nt,...Zs,...Ls,...qs,...Fs,...Ps,...$s,...Bs,...Us]};Nt.map(r=>r.key);Vs.columns.map(r=>r.key);var Te={passport:{type:"passport",label:"Canadian Passport",description:"A valid Canadian passport (not expired)",acceptedFormats:[".pdf",".jpg",".jpeg",".png"],maxFileSize:10*1024*1024,estimatedProcessingTime:8,requiredFields:["fullName","passportNumber","dateOfBirth","dateOfIssue","dateOfExpiry","placeOfBirth","sex","nationality"]},drivers_license:{type:"drivers_license",label:"Canadian Driver's License",description:"A valid Canadian provincial or territorial driver's license",acceptedFormats:[".pdf",".jpg",".jpeg",".png"],maxFileSize:10*1024*1024,estimatedProcessingTime:8,requiredFields:["fullName","licenseNumber","dateOfBirth","expiryDate","address","province","licenseClass"]},proof_of_address:{type:"proof_of_address",label:"Proof of Address",description:"A document showing your current Canadian address (dated within 90 days)",acceptedFormats:[".pdf",".jpg",".jpeg",".png"],maxFileSize:10*1024*1024,estimatedProcessingTime:10,requiredFields:["fullName","address","documentSubType","issuer","documentDate"]}};const Ct=({documentType:r,onFileSelect:e})=>{const{documents:t,setDocumentFile:s,isLoading:a}=oe(),i=t.get(r),n=Te[r],o=pe.useCallback((T,ze)=>{if(!(ze.length>0)&&T.length>0){const M=T[0];s(r,M),e==null||e(M)}},[r,e,s]),{getRootProps:d,getInputProps:h,isDragActive:x}=_.useDropzone({onDrop:o,accept:{"application/pdf":[".pdf"],"image/jpeg":[".jpg",".jpeg"],"image/png":[".png"]},maxSize:n.maxFileSize,multiple:!1,disabled:a}),R=T=>T<1024?`${T} B`:T<1024*1024?`${(T/1024).toFixed(1)} KB`:`${(T/(1024*1024)).toFixed(1)} MB`,re=()=>{var T;return((T=i==null?void 0:i.file)==null?void 0:T.type)==="application/pdf"?l.jsx(ut,{className:"ff-w-6 ff-h-6"}):l.jsx($t,{className:"ff-w-6 ff-h-6"})},De=T=>{T.stopPropagation(),oe.getState().clearDocumentPreview(r),s(r,null)};return i!=null&&i.file&&i.previewUrl?l.jsxs("div",{className:"ff-space-y-4",children:[l.jsx("div",{className:"ff-bg-primary-50 ff-border ff-border-primary-200 ff-rounded-lg ff-p-4",children:l.jsxs("div",{className:"ff-flex ff-items-center ff-gap-3",children:[l.jsx("div",{className:"ff-p-2 ff-bg-primary-100 ff-rounded-lg ff-text-primary-600",children:re()}),l.jsxs("div",{className:"ff-flex-1 ff-min-w-0",children:[l.jsx("p",{className:"ff-font-medium ff-text-primary-900 ff-truncate",children:i.file.name}),l.jsx("p",{className:"ff-text-sm ff-text-primary-600",children:R(i.file.size)})]}),l.jsx("button",{onClick:De,className:"ff-p-1.5 ff-text-primary-600 hover:ff-text-primary-800 hover:ff-bg-primary-100 ff-rounded-full ff-transition-colors","aria-label":"Remove file",children:l.jsx(_.X,{className:"ff-w-5 ff-h-5"})})]})}),l.jsx("div",{className:"ff-document-preview ff-aspect-[3/4] ff-max-h-96",children:i.file.type==="application/pdf"?l.jsx("iframe",{src:i.previewUrl,className:"ff-w-full ff-h-full ff-rounded-lg",title:"Document preview"}):l.jsx("img",{src:i.previewUrl,alt:"Document preview",className:"ff-w-full ff-h-full ff-object-contain ff-rounded-lg"})})]}):l.jsxs("div",{className:"ff-space-y-4",children:[l.jsxs("div",{className:"ff-text-center ff-mb-4",children:[l.jsx("h3",{className:"ff-text-lg ff-font-semibold ff-text-gray-900",children:n.label}),l.jsx("p",{className:"ff-text-sm ff-text-gray-500 ff-mt-1",children:n.description})]}),l.jsxs("div",{...d(),className:_.clsx("ff-dropzone ff-min-h-[200px]",x&&"ff-dropzone-active",a&&"ff-opacity-50 ff-cursor-not-allowed"),children:[l.jsx("input",{...h()}),l.jsxs("div",{className:"ff-flex ff-flex-col ff-items-center ff-gap-4",children:[l.jsx("div",{className:_.clsx("ff-p-4 ff-rounded-full",x?"ff-bg-primary-100":"ff-bg-gray-100"),children:l.jsx(_.Upload,{className:_.clsx("ff-w-10 ff-h-10",x?"ff-text-primary-600":"ff-text-gray-400")})}),l.jsxs("div",{className:"ff-text-center",children:[l.jsx("p",{className:"ff-text-base ff-font-medium ff-text-gray-700",children:x?"Drop your document here":"Upload your document"}),l.jsxs("p",{className:"ff-text-sm ff-text-gray-500 ff-mt-1",children:["Drag & drop or"," ",l.jsx("span",{className:"ff-text-primary-600 ff-font-medium",children:"browse files"})]})]}),l.jsxs("div",{className:"ff-flex ff-flex-wrap ff-justify-center ff-gap-2 ff-text-xs ff-text-gray-400",children:[n.acceptedFormats.map(T=>l.jsx("span",{className:"ff-px-2 ff-py-1 ff-bg-gray-100 ff-rounded",children:T.toUpperCase()},T)),l.jsxs("span",{className:"ff-px-2 ff-py-1",children:["Max ",R(n.maxFileSize)]})]})]})]}),(i==null?void 0:i.error)&&l.jsxs("div",{className:"ff-flex ff-items-center ff-gap-2 ff-p-3 ff-bg-error-50 ff-text-error-700 ff-rounded-lg",children:[l.jsx(_.AlertCircle,{className:"ff-w-4 ff-h-4 ff-flex-shrink-0"}),l.jsx("p",{className:"ff-text-sm",children:i.error})]}),l.jsxs("div",{className:"ff-bg-gray-50 ff-rounded-lg ff-p-4",children:[l.jsx("h4",{className:"ff-text-sm ff-font-medium ff-text-gray-700 ff-mb-2",children:"Tips for best results:"}),l.jsxs("ul",{className:"ff-text-sm ff-text-gray-500 ff-space-y-1 ff-list-disc ff-list-inside",children:[l.jsx("li",{children:"Ensure all text is clearly visible and readable"}),l.jsx("li",{children:"Avoid glare, shadows, or blurry images"}),l.jsx("li",{children:"Include all four corners of the document"}),l.jsx("li",{children:"Use good lighting when taking photos"})]})]})]})},St=({documentType:r,showDetails:e=!0})=>{const{documents:t}=oe(),s=t.get(r),a=Te[r],n=(d=>{switch(d){case"completed":return{icon:_.CheckCircle,color:"ff-text-success-600",bgColor:"ff-bg-success-100",label:"Verified",description:"Document successfully processed"};case"requires_review":return{icon:_.AlertTriangle,color:"ff-text-warning-600",bgColor:"ff-bg-warning-100",label:"Review Required",description:"Manual verification may be needed"};case"failed":return{icon:_.XCircle,color:"ff-text-error-600",bgColor:"ff-bg-error-100",label:"Failed",description:"Unable to process document"};case"processing":return{icon:_.Loader2,color:"ff-text-primary-600",bgColor:"ff-bg-primary-100",label:"Processing",description:"Analyzing document..."};case"uploaded":return{icon:Je,color:"ff-text-gray-600",bgColor:"ff-bg-gray-100",label:"Pending",description:"Waiting to be processed"};default:return{icon:Je,color:"ff-text-gray-400",bgColor:"ff-bg-gray-100",label:"Not Uploaded",description:"Upload document to continue"}}})(s==null?void 0:s.status),o=n.icon;return l.jsxs("div",{className:"ff-space-y-3",children:[l.jsxs("div",{className:"ff-flex ff-items-center ff-gap-3",children:[l.jsx("div",{className:_.clsx("ff-p-2 ff-rounded-lg",n.bgColor),children:l.jsx(o,{className:_.clsx("ff-w-5 ff-h-5",n.color,(s==null?void 0:s.status)==="processing"&&"ff-animate-spin")})}),l.jsxs("div",{children:[l.jsx("p",{className:"ff-font-medium ff-text-gray-900",children:a.label}),l.jsx("p",{className:_.clsx("ff-text-sm",n.color),children:n.label})]})]}),(s==null?void 0:s.confidence)!==void 0&&s.confidence>0&&l.jsxs("div",{className:"ff-space-y-1",children:[l.jsxs("div",{className:"ff-flex ff-items-center ff-justify-between ff-text-sm",children:[l.jsx("span",{className:"ff-text-gray-600",children:"Confidence"}),l.jsxs("span",{className:_.clsx("ff-font-medium",s.confidence>=.8&&"ff-text-success-600",s.confidence>=.6&&s.confidence<.8&&"ff-text-warning-600",s.confidence<.6&&"ff-text-error-600"),children:[Math.round(s.confidence*100),"%"]})]}),l.jsx("div",{className:"ff-progress",children:l.jsx("div",{className:_.clsx("ff-progress-bar",s.confidence>=.8&&"ff-bg-success-500",s.confidence>=.6&&s.confidence<.8&&"ff-bg-warning-500",s.confidence<.6&&"ff-bg-error-500"),style:{width:`${s.confidence*100}%`}})})]}),e&&(s==null?void 0:s.fraudFlags)&&s.fraudFlags.length>0&&l.jsxs("div",{className:"ff-space-y-2",children:[l.jsx("p",{className:"ff-text-sm ff-font-medium ff-text-gray-700",children:"Issues Detected"}),l.jsx("div",{className:"ff-space-y-1",children:s.fraudFlags.map((d,h)=>l.jsxs("div",{className:_.clsx("ff-flex ff-items-start ff-gap-2 ff-p-2 ff-rounded ff-text-sm",d.severity==="high"&&"ff-bg-error-50 ff-text-error-700",d.severity==="medium"&&"ff-bg-warning-50 ff-text-warning-700",d.severity==="low"&&"ff-bg-gray-50 ff-text-gray-600"),children:[d.severity==="high"?l.jsx(_.XCircle,{className:"ff-w-4 ff-h-4 ff-flex-shrink-0 ff-mt-0.5"}):l.jsx(_.AlertTriangle,{className:"ff-w-4 ff-h-4 ff-flex-shrink-0 ff-mt-0.5"}),l.jsx("span",{children:d.message})]},h))})]}),e&&(s==null?void 0:s.extractedData)&&s.status==="completed"&&l.jsxs("div",{className:"ff-bg-gray-50 ff-rounded-lg ff-p-3",children:[l.jsx("p",{className:"ff-text-sm ff-font-medium ff-text-gray-700 ff-mb-2",children:"Extracted Information"}),l.jsxs("dl",{className:"ff-space-y-1 ff-text-sm",children:["fullName"in s.extractedData&&l.jsxs("div",{className:"ff-flex ff-justify-between",children:[l.jsx("dt",{className:"ff-text-gray-500",children:"Name"}),l.jsx("dd",{className:"ff-text-gray-900 ff-font-medium",children:s.extractedData.fullName})]}),"dateOfBirth"in s.extractedData&&l.jsxs("div",{className:"ff-flex ff-justify-between",children:[l.jsx("dt",{className:"ff-text-gray-500",children:"Date of Birth"}),l.jsx("dd",{className:"ff-text-gray-900",children:s.extractedData.dateOfBirth})]}),s.extractedData.documentType==="passport"&&"passportNumber"in s.extractedData&&l.jsxs("div",{className:"ff-flex ff-justify-between",children:[l.jsx("dt",{className:"ff-text-gray-500",children:"Passport #"}),l.jsx("dd",{className:"ff-text-gray-900 ff-font-mono",children:s.extractedData.passportNumber})]}),s.extractedData.documentType==="drivers_license"&&"licenseNumber"in s.extractedData&&l.jsxs("div",{className:"ff-flex ff-justify-between",children:[l.jsx("dt",{className:"ff-text-gray-500",children:"License #"}),l.jsx("dd",{className:"ff-text-gray-900 ff-font-mono",children:s.extractedData.licenseNumber})]}),"address"in s.extractedData&&s.extractedData.address&&l.jsxs("div",{className:"ff-flex ff-justify-between",children:[l.jsx("dt",{className:"ff-text-gray-500",children:"Address"}),l.jsxs("dd",{className:"ff-text-gray-900 ff-text-right",children:[s.extractedData.address.city,","," ",s.extractedData.address.province]})]})]})]})]})},zs={passport:ut,drivers_license:Ft,proof_of_address:Pt},Ys=({requiredDocuments:r,onComplete:e,onCancel:t,onError:s})=>{const{sessionId:a,step:i,currentDocumentType:n,documents:o,isVerified:d,verificationStatus:h,isLoading:x,error:R,setSessionId:re,setRequiredDocuments:De,setCurrentDocumentType:T,setDocumentStatus:ze,setDocumentData:M,setStep:z,nextDocument:jt,setVerificationStatus:Tt,setVerified:Dt,setLoading:G,setError:ue,areAllDocumentsUploaded:Ye,areAllDocumentsProcessed:We,reset:At}=oe(),[Ws,Y]=pe.useState(null);pe.useEffect(()=>(De(r),It(),()=>{Y(null)}),[r]);const It=async()=>{try{G(!0);const C=await _.getClient().createKYCSession(r);re(C.sessionId),z("upload")}catch(S){const C=S;ue(C.message),s==null||s(C)}finally{G(!1)}},Ot=pe.useCallback(async S=>{if(!(!a||!n))try{G(!0),ue(null);const I=await _.getClient().uploadKYCDocument(a,n,S);M(n,{id:I.documentId,status:"processing"}),Y(I.documentId),Rt(I.documentId)}catch(C){const I=C;M(n,{status:"failed",error:I.message}),s==null||s(I)}finally{G(!1)}},[a,n]),Rt=async S=>{let W=0,ae=0;const Ae=async()=>{var He;if(W>=30){Y(null),n&&M(n,{status:"failed",error:"Processing timed out. Please try again."});return}if(ae>=3){Y(null),n&&M(n,{status:"failed",error:"Failed to check document status. Please refresh and try again."});return}try{const q=(await _.getClient().getKYCDocument(S)).document;ae=0;const qt=q.type;if(M(qt,{id:q.id,status:q.status,extractedData:q.extractedData,confidence:q.confidence,fraudFlags:q.fraudFlags,error:null}),q.status==="completed"||q.status==="requires_review"||q.status==="failed"){Y(null),Ye()?We()&&z("review"):jt();return}W++,setTimeout(Ae,2e3)}catch(Ke){const me=Ke;if(ae++,W++,me.status===404||(He=me.message)!=null&&He.includes("not found")){Y(null),n&&M(n,{status:"failed",error:"Session not found or invalid state"});return}ae<3?setTimeout(Ae,3e3*ae):(Y(null),n&&M(n,{status:"failed",error:me.message||"Failed to process document"}))}};Ae()},Et=async()=>{if(a)try{G(!0),ue(null);const C=await _.getClient().verifyKYCSession(a,!0);Tt(C.verificationStatus);const I=C.verificationStatus;Dt(I.isVerified),z("complete"),e==null||e(C)}catch(S){const C=S;ue(C.message),s==null||s(C)}finally{G(!1)}},Mt=()=>{At(),t==null||t()},Zt=S=>{T(S),z("upload")},Lt=S=>{const C=o.get(S);return(C==null?void 0:C.status)==="completed"||(C==null?void 0:C.status)==="requires_review"};return l.jsxs("div",{className:"ff-container ff-bg-white ff-rounded-xl ff-shadow-xl ff-overflow-hidden ff-flex ff-flex-col ff-max-h-[90vh]",children:[l.jsxs("div",{className:"ff-flex ff-items-center ff-justify-between ff-px-6 ff-py-4 ff-border-b ff-border-gray-200 ff-bg-gray-50 ff-flex-shrink-0",children:[l.jsxs("div",{className:"ff-flex ff-items-center ff-gap-3",children:[l.jsx(Qe,{className:"ff-w-6 ff-h-6 ff-text-primary-600"}),l.jsx("h2",{className:"ff-text-xl ff-font-semibold ff-text-gray-900",children:"Identity Verification"})]}),l.jsx("button",{onClick:Mt,className:"ff-p-2 ff-text-gray-400 hover:ff-text-gray-600 ff-rounded-full hover:ff-bg-gray-100",children:l.jsx(_.X,{className:"ff-w-5 ff-h-5"})})]}),l.jsxs("div",{className:"ff-p-6 ff-overflow-y-auto ff-flex-1 ff-min-h-0",children:[R&&l.jsx("div",{className:"ff-mb-4 ff-p-4 ff-bg-error-50 ff-border ff-border-error-200 ff-rounded-lg ff-text-error-700",children:R}),i==="select"&&l.jsxs("div",{className:"ff-space-y-4",children:[l.jsx("p",{className:"ff-text-gray-600 ff-text-center ff-mb-6",children:"Please upload the following documents to verify your identity"}),l.jsx("div",{className:"ff-grid ff-gap-4",children:r.map(S=>{const C=zs[S],I=Te[S];o.get(S);const W=Lt(S);return l.jsxs("button",{onClick:()=>Zt(S),className:_.clsx("ff-flex ff-items-center ff-gap-4 ff-p-4 ff-rounded-lg ff-border-2 ff-text-left ff-transition-all",W?"ff-border-success-300 ff-bg-success-50":"ff-border-gray-200 hover:ff-border-primary-300 hover:ff-bg-primary-50"),children:[l.jsx("div",{className:_.clsx("ff-p-3 ff-rounded-lg",W?"ff-bg-success-100":"ff-bg-gray-100"),children:W?l.jsx(_.CheckCircle,{className:"ff-w-6 ff-h-6 ff-text-success-600"}):l.jsx(C,{className:"ff-w-6 ff-h-6 ff-text-gray-600"})}),l.jsxs("div",{className:"ff-flex-1",children:[l.jsx("p",{className:"ff-font-medium ff-text-gray-900",children:I.label}),l.jsx("p",{className:"ff-text-sm ff-text-gray-500",children:I.description})]}),l.jsx(_.ChevronRight,{className:"ff-w-5 ff-h-5 ff-text-gray-400"})]},S)})})]}),i==="upload"&&n&&l.jsx("div",{className:"ff-max-w-lg ff-mx-auto",children:l.jsx(Ct,{documentType:n,onFileSelect:Ot})}),i==="processing"&&l.jsxs("div",{className:"ff-flex ff-flex-col ff-items-center ff-justify-center ff-py-12",children:[l.jsx(_.Loader2,{className:"ff-w-12 ff-h-12 ff-text-primary-600 ff-animate-spin ff-mb-4"}),l.jsx("h3",{className:"ff-text-lg ff-font-semibold ff-text-gray-900 ff-mb-2",children:"Processing Documents"}),l.jsx("p",{className:"ff-text-gray-500 ff-text-center",children:"We're analyzing your documents. This may take a moment..."})]}),i==="review"&&l.jsxs("div",{className:"ff-space-y-6",children:[l.jsxs("div",{className:"ff-text-center ff-mb-6",children:[l.jsx("h3",{className:"ff-text-lg ff-font-semibold ff-text-gray-900",children:"Review Your Documents"}),l.jsx("p",{className:"ff-text-gray-500",children:"Please review the extracted information before completing verification"})]}),l.jsx("div",{className:"ff-grid ff-gap-4",children:r.map(S=>l.jsx("div",{className:"ff-border ff-border-gray-200 ff-rounded-lg ff-p-4",children:l.jsx(St,{documentType:S,showDetails:!0})},S))})]}),i==="complete"&&l.jsxs("div",{className:"ff-flex ff-flex-col ff-items-center ff-justify-center ff-py-12",children:[l.jsx("div",{className:_.clsx("ff-w-16 ff-h-16 ff-rounded-full ff-flex ff-items-center ff-justify-center ff-mb-4",d?"ff-bg-success-100":"ff-bg-warning-100"),children:d?l.jsx(_.CheckCircle,{className:"ff-w-10 ff-h-10 ff-text-success-600"}):l.jsx(Qe,{className:"ff-w-10 ff-h-10 ff-text-warning-600"})}),l.jsx("h3",{className:"ff-text-xl ff-font-semibold ff-text-gray-900 ff-mb-2",children:d?"Verification Complete!":"Review Required"}),l.jsx("p",{className:"ff-text-gray-500 ff-text-center",children:d?"Your identity has been successfully verified.":"Additional review may be required. We will contact you if needed."})]})]}),i!=="complete"&&l.jsxs("div",{className:"ff-flex ff-items-center ff-justify-between ff-px-6 ff-py-4 ff-border-t ff-border-gray-200 ff-bg-gray-50 ff-flex-shrink-0",children:[l.jsx("button",{onClick:()=>{(i==="upload"||i==="review")&&z("select")},disabled:x,className:"ff-btn ff-btn-secondary",children:"Back"}),i==="review"&&l.jsx("button",{onClick:Et,disabled:x||!We(),className:"ff-btn ff-btn-primary",children:x?l.jsxs(l.Fragment,{children:[l.jsx(_.Loader2,{className:"ff-w-4 ff-h-4 ff-mr-2 ff-animate-spin"}),"Verifying..."]}):"Complete Verification"}),i==="select"&&Ye()&&l.jsx("button",{onClick:()=>z("review"),className:"ff-btn ff-btn-primary",children:"Review & Verify"})]})]})};exports.CANADIAN_PROVINCES=Ue;exports.DOCUMENT_TYPES=Te;exports.DocumentStatus=St;exports.DocumentUploader=Ct;exports.KYCWizard=Ys;exports.useKYCStore=oe;
32
+ //# sourceMappingURL=KYCWizard-CRBXY9Np.js.map