@jsdev_ninja/core 0.14.9 → 0.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core.cjs +1 -1
- package/dist/core.cjs.map +1 -1
- package/dist/core.es.js +497 -531
- package/dist/core.es.js.map +1 -1
- package/dist/core.umd.js +1 -1
- package/dist/core.umd.js.map +1 -1
- package/dist/lib/entities/Budget.d.ts +68 -59
- package/dist/lib/entities/Budget.d.ts.map +1 -1
- package/dist/lib/entities/Budget.js +47 -36
- package/dist/lib/entities/Cart.d.ts +2257 -10
- package/dist/lib/entities/Cart.d.ts.map +1 -1
- package/dist/lib/entities/Cart.js +16 -0
- package/dist/lib/entities/DeliveryNote.d.ts +0 -1
- package/dist/lib/entities/DeliveryNote.d.ts.map +1 -1
- package/dist/lib/entities/Discount/index.d.ts +0 -1
- package/dist/lib/entities/Discount/index.d.ts.map +1 -1
- package/dist/lib/entities/Discount/index.js +0 -1
- package/dist/lib/entities/Invoice.d.ts +0 -2
- package/dist/lib/entities/Invoice.d.ts.map +1 -1
- package/dist/lib/entities/Locale.d.ts +0 -10
- package/dist/lib/entities/Locale.d.ts.map +1 -1
- package/dist/lib/entities/Locale.js +0 -1
- package/dist/lib/entities/Order.d.ts +1143 -2
- package/dist/lib/entities/Order.d.ts.map +1 -1
- package/dist/lib/entities/Order.js +3 -0
- package/dist/lib/entities/Profile.d.ts +5 -0
- package/dist/lib/entities/Profile.d.ts.map +1 -1
- package/dist/lib/entities/Profile.js +3 -0
- package/dist/lib/entities/SupplierInvoice.d.ts +0 -1
- package/dist/lib/entities/SupplierInvoice.d.ts.map +1 -1
- package/dist/lib/entities/index.d.ts +0 -1
- package/dist/lib/entities/index.d.ts.map +1 -1
- package/dist/lib/entities/index.js +0 -1
- package/dist/lib/firebase-api/index.d.ts +15 -0
- package/dist/lib/firebase-api/index.d.ts.map +1 -1
- package/dist/lib/firebase-api/index.js +5 -0
- package/dist/lib/index.d.ts +1 -1
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/package.json +58 -58
- package/dist/lib/entities/Chatbot/index.d.ts +0 -96
- package/dist/lib/entities/Chatbot/index.d.ts.map +0 -1
- package/dist/lib/entities/Chatbot/index.js +0 -37
- package/dist/lib/entities/Discount/__tests__/utils.test.d.ts +0 -2
- package/dist/lib/entities/Discount/__tests__/utils.test.d.ts.map +0 -1
- package/dist/lib/entities/Discount/__tests__/utils.test.js +0 -55
- package/dist/lib/entities/Discount/utils.d.ts +0 -29
- package/dist/lib/entities/Discount/utils.d.ts.map +0 -1
- package/dist/lib/entities/Discount/utils.js +0 -39
- package/dist/lib/firebase-api/app.d.ts +0 -2
- package/dist/lib/firebase-api/app.d.ts.map +0 -1
- package/dist/lib/firebase-api/app.js +0 -16
package/dist/core.umd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(p,_){typeof exports=="object"&&typeof module<"u"?_(exports):typeof define=="function"&&define.amd?define(["exports"],_):(p=typeof globalThis<"u"?globalThis:p||self,_(p.core={}))})(this,function(p){"use strict";var tr=Object.defineProperty;var nr=(p,_,V)=>_ in p?tr(p,_,{enumerable:!0,configurable:!0,writable:!0,value:V}):p[_]=V;var yt=(p,_,V)=>nr(p,typeof _!="symbol"?_+"":_,V);var _;(function(n){n.assertEqual=i=>i;function e(i){}n.assertIs=e;function t(i){throw new Error}n.assertNever=t,n.arrayToEnum=i=>{const s={};for(const c of i)s[c]=c;return s},n.getValidEnumValues=i=>{const s=n.objectKeys(i).filter(o=>typeof i[i[o]]!="number"),c={};for(const o of s)c[o]=i[o];return n.objectValues(c)},n.objectValues=i=>n.objectKeys(i).map(function(s){return i[s]}),n.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const s=[];for(const c in i)Object.prototype.hasOwnProperty.call(i,c)&&s.push(c);return s},n.find=(i,s)=>{for(const c of i)if(s(c))return c},n.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function r(i,s=" | "){return i.map(c=>typeof c=="string"?`'${c}'`:c).join(s)}n.joinValues=r,n.jsonStringifyReplacer=(i,s)=>typeof s=="bigint"?s.toString():s})(_||(_={}));var V;(function(n){n.mergeShapes=(e,t)=>({...e,...t})})(V||(V={}));const f=_.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),R=n=>{switch(typeof n){case"undefined":return f.undefined;case"string":return f.string;case"number":return isNaN(n)?f.nan:f.number;case"boolean":return f.boolean;case"function":return f.function;case"bigint":return f.bigint;case"symbol":return f.symbol;case"object":return Array.isArray(n)?f.array:n===null?f.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?f.promise:typeof Map<"u"&&n instanceof Map?f.map:typeof Set<"u"&&n instanceof Set?f.set:typeof Date<"u"&&n instanceof Date?f.date:f.object;default:return f.unknown}},u=_.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"]),vt=n=>JSON.stringify(n,null,2).replace(/"([^"]+)":/g,"$1:");class C extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};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(s){return s.message},r={_errors:[]},i=s=>{for(const c of s.issues)if(c.code==="invalid_union")c.unionErrors.map(i);else if(c.code==="invalid_return_type")i(c.returnTypeError);else if(c.code==="invalid_arguments")i(c.argumentsError);else if(c.path.length===0)r._errors.push(t(c));else{let o=r,l=0;for(;l<c.path.length;){const d=c.path[l];l===c.path.length-1?(o[d]=o[d]||{_errors:[]},o[d]._errors.push(t(c))):o[d]=o[d]||{_errors:[]},o=o[d],l++}}};return i(this),r}static assert(e){if(!(e instanceof C))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,_.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},r=[];for(const i of this.issues)i.path.length>0?(t[i.path[0]]=t[i.path[0]]||[],t[i.path[0]].push(e(i))):r.push(e(i));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}C.create=n=>new C(n);const Y=(n,e)=>{let t;switch(n.code){case u.invalid_type:n.received===f.undefined?t="Required":t=`Expected ${n.expected}, received ${n.received}`;break;case u.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(n.expected,_.jsonStringifyReplacer)}`;break;case u.unrecognized_keys:t=`Unrecognized key(s) in object: ${_.joinValues(n.keys,", ")}`;break;case u.invalid_union:t="Invalid input";break;case u.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${_.joinValues(n.options)}`;break;case u.invalid_enum_value:t=`Invalid enum value. Expected ${_.joinValues(n.options)}, received '${n.received}'`;break;case u.invalid_arguments:t="Invalid function arguments";break;case u.invalid_return_type:t="Invalid function return type";break;case u.invalid_date:t="Invalid date";break;case u.invalid_string:typeof n.validation=="object"?"includes"in n.validation?(t=`Invalid input: must include "${n.validation.includes}"`,typeof n.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${n.validation.position}`)):"startsWith"in n.validation?t=`Invalid input: must start with "${n.validation.startsWith}"`:"endsWith"in n.validation?t=`Invalid input: must end with "${n.validation.endsWith}"`:_.assertNever(n.validation):n.validation!=="regex"?t=`Invalid ${n.validation}`:t="Invalid";break;case u.too_small:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at least":"more than"} ${n.minimum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at least":"over"} ${n.minimum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(n.minimum))}`:t="Invalid input";break;case u.too_big:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at most":"less than"} ${n.maximum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at most":"under"} ${n.maximum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="bigint"?t=`BigInt must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly":n.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(n.maximum))}`:t="Invalid input";break;case u.custom:t="Invalid input";break;case u.invalid_intersection_types:t="Intersection results could not be merged";break;case u.not_multiple_of:t=`Number must be a multiple of ${n.multipleOf}`;break;case u.not_finite:t="Number must be finite";break;default:t=e.defaultError,_.assertNever(n)}return{message:t}};let We=Y;function _t(n){We=n}function ke(){return We}const xe=n=>{const{data:e,path:t,errorMaps:r,issueData:i}=n,s=[...t,...i.path||[]],c={...i,path:s};if(i.message!==void 0)return{...i,path:s,message:i.message};let o="";const l=r.filter(d=>!!d).slice().reverse();for(const d of l)o=d(c,{data:e,defaultError:o}).message;return{...i,path:s,message:o}},bt=[];function m(n,e){const t=ke(),r=xe({issueData:e,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,t,t===Y?void 0:Y].filter(i=>!!i)});n.common.issues.push(r)}class I{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const r=[];for(const i of t){if(i.status==="aborted")return v;i.status==="dirty"&&e.dirty(),r.push(i.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){const r=[];for(const i of t){const s=await i.key,c=await i.value;r.push({key:s,value:c})}return I.mergeObjectSync(e,r)}static mergeObjectSync(e,t){const r={};for(const i of t){const{key:s,value:c}=i;if(s.status==="aborted"||c.status==="aborted")return v;s.status==="dirty"&&e.dirty(),c.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof c.value<"u"||i.alwaysSet)&&(r[s.value]=c.value)}return{status:e.value,value:r}}}const v=Object.freeze({status:"aborted"}),G=n=>({status:"dirty",value:n}),N=n=>({status:"valid",value:n}),je=n=>n.status==="aborted",De=n=>n.status==="dirty",q=n=>n.status==="valid",te=n=>typeof Promise<"u"&&n instanceof Promise;function Se(n,e,t,r){if(typeof e=="function"?n!==e||!0:!e.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(n)}function Qe(n,e,t,r,i){if(typeof e=="function"?n!==e||!0:!e.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(n,t),t}typeof SuppressedError=="function"&&SuppressedError;var g;(function(n){n.errToObj=e=>typeof e=="string"?{message:e}:e||{},n.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(g||(g={}));var ne,re;class Z{constructor(e,t,r,i){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Ye=(n,e)=>{if(q(e))return{success:!0,data:e.value};if(!n.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 C(n.common.issues);return this._error=t,this._error}}};function b(n){if(!n)return{};const{errorMap:e,invalid_type_error:t,required_error:r,description:i}=n;if(e&&(t||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(c,o)=>{var l,d;const{message:h}=n;return c.code==="invalid_enum_value"?{message:h??o.defaultError}:typeof o.data>"u"?{message:(l=h??r)!==null&&l!==void 0?l:o.defaultError}:c.code!=="invalid_type"?{message:o.defaultError}:{message:(d=h??t)!==null&&d!==void 0?d:o.defaultError}},description:i}}class k{get description(){return this._def.description}_getType(e){return R(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:R(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new I,ctx:{common:e.parent.common,data:e.data,parsedType:R(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(te(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 r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){var r;const i={common:{issues:[],async:(r=t==null?void 0:t.async)!==null&&r!==void 0?r:!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:R(e)},s=this._parseSync({data:e,path:i.path,parent:i});return Ye(i,s)}"~validate"(e){var t,r;const i={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:R(e)};if(!this["~standard"].async)try{const s=this._parseSync({data:e,path:[],parent:i});return q(s)?{value:s.value}:{issues:i.common.issues}}catch(s){!((r=(t=s==null?void 0:s.message)===null||t===void 0?void 0:t.toLowerCase())===null||r===void 0)&&r.includes("encountered")&&(this["~standard"].async=!0),i.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:i}).then(s=>q(s)?{value:s.value}:{issues:i.common.issues})}async parseAsync(e,t){const r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){const r={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:R(e)},i=this._parse({data:e,path:r.path,parent:r}),s=await(te(i)?i:Promise.resolve(i));return Ye(r,s)}refine(e,t){const r=i=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(i):t;return this._refinement((i,s)=>{const c=e(i),o=()=>s.addIssue({code:u.custom,...r(i)});return typeof Promise<"u"&&c instanceof Promise?c.then(l=>l?!0:(o(),!1)):c?!0:(o(),!1)})}refinement(e,t){return this._refinement((r,i)=>e(r)?!0:(i.addIssue(typeof t=="function"?t(r,i):t),!1))}_refinement(e){return new D({schema:this,typeName:y.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 P.create(this,this._def)}nullable(){return U.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return j.create(this)}promise(){return K.create(this,this._def)}or(e){return oe.create([this,e],this._def)}and(e){return ce.create(this,e,this._def)}transform(e){return new D({...b(this._def),schema:this,typeName:y.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new fe({...b(this._def),innerType:this,defaultValue:t,typeName:y.ZodDefault})}brand(){return new Pe({typeName:y.ZodBranded,type:this,...b(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new he({...b(this._def),innerType:this,catchValue:t,typeName:y.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return pe.create(this,e)}readonly(){return ge.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const kt=/^c[^\s-]{8,}$/i,xt=/^[0-9a-z]+$/,St=/^[0-9A-HJKMNP-TV-Z]{26}$/i,wt=/^[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,Tt=/^[a-z0-9_-]{21}$/i,It=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Nt=/^[-+]?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)?)??$/,Ct=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,At="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Ze;const jt=/^(?:(?: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])$/,Dt=/^(?:(?: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])$/,Zt=/^(([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]))$/,Ot=/^(([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])$/,Pt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Et=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Ge="((\\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])))",Rt=new RegExp(`^${Ge}$`);function Xe(n){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return n.precision?e=`${e}\\.\\d{${n.precision}}`:n.precision==null&&(e=`${e}(\\.\\d+)?`),e}function Mt(n){return new RegExp(`^${Xe(n)}$`)}function Je(n){let e=`${Ge}T${Xe(n)}`;const t=[];return t.push(n.local?"Z?":"Z"),n.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function $t(n,e){return!!((e==="v4"||!e)&&jt.test(n)||(e==="v6"||!e)&&Zt.test(n))}function Vt(n,e){if(!It.test(n))return!1;try{const[t]=n.split("."),r=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),i=JSON.parse(atob(r));return!(typeof i!="object"||i===null||!i.typ||!i.alg||e&&i.alg!==e)}catch{return!1}}function zt(n,e){return!!((e==="v4"||!e)&&Dt.test(n)||(e==="v6"||!e)&&Ot.test(n))}class A extends k{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==f.string){const s=this._getOrReturnCtx(e);return m(s,{code:u.invalid_type,expected:f.string,received:s.parsedType}),v}const r=new I;let i;for(const s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(i=this._getOrReturnCtx(e,i),m(i,{code:u.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="max")e.data.length>s.value&&(i=this._getOrReturnCtx(e,i),m(i,{code:u.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){const c=e.data.length>s.value,o=e.data.length<s.value;(c||o)&&(i=this._getOrReturnCtx(e,i),c?m(i,{code:u.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):o&&m(i,{code:u.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")Ct.test(e.data)||(i=this._getOrReturnCtx(e,i),m(i,{validation:"email",code:u.invalid_string,message:s.message}),r.dirty());else if(s.kind==="emoji")Ze||(Ze=new RegExp(At,"u")),Ze.test(e.data)||(i=this._getOrReturnCtx(e,i),m(i,{validation:"emoji",code:u.invalid_string,message:s.message}),r.dirty());else if(s.kind==="uuid")wt.test(e.data)||(i=this._getOrReturnCtx(e,i),m(i,{validation:"uuid",code:u.invalid_string,message:s.message}),r.dirty());else if(s.kind==="nanoid")Tt.test(e.data)||(i=this._getOrReturnCtx(e,i),m(i,{validation:"nanoid",code:u.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")kt.test(e.data)||(i=this._getOrReturnCtx(e,i),m(i,{validation:"cuid",code:u.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")xt.test(e.data)||(i=this._getOrReturnCtx(e,i),m(i,{validation:"cuid2",code:u.invalid_string,message:s.message}),r.dirty());else if(s.kind==="ulid")St.test(e.data)||(i=this._getOrReturnCtx(e,i),m(i,{validation:"ulid",code:u.invalid_string,message:s.message}),r.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),m(i,{validation:"url",code:u.invalid_string,message:s.message}),r.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),m(i,{validation:"regex",code:u.invalid_string,message:s.message}),r.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(i=this._getOrReturnCtx(e,i),m(i,{code:u.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),r.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(i=this._getOrReturnCtx(e,i),m(i,{code:u.invalid_string,validation:{startsWith:s.value},message:s.message}),r.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(i=this._getOrReturnCtx(e,i),m(i,{code:u.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?Je(s).test(e.data)||(i=this._getOrReturnCtx(e,i),m(i,{code:u.invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="date"?Rt.test(e.data)||(i=this._getOrReturnCtx(e,i),m(i,{code:u.invalid_string,validation:"date",message:s.message}),r.dirty()):s.kind==="time"?Mt(s).test(e.data)||(i=this._getOrReturnCtx(e,i),m(i,{code:u.invalid_string,validation:"time",message:s.message}),r.dirty()):s.kind==="duration"?Nt.test(e.data)||(i=this._getOrReturnCtx(e,i),m(i,{validation:"duration",code:u.invalid_string,message:s.message}),r.dirty()):s.kind==="ip"?$t(e.data,s.version)||(i=this._getOrReturnCtx(e,i),m(i,{validation:"ip",code:u.invalid_string,message:s.message}),r.dirty()):s.kind==="jwt"?Vt(e.data,s.alg)||(i=this._getOrReturnCtx(e,i),m(i,{validation:"jwt",code:u.invalid_string,message:s.message}),r.dirty()):s.kind==="cidr"?zt(e.data,s.version)||(i=this._getOrReturnCtx(e,i),m(i,{validation:"cidr",code:u.invalid_string,message:s.message}),r.dirty()):s.kind==="base64"?Pt.test(e.data)||(i=this._getOrReturnCtx(e,i),m(i,{validation:"base64",code:u.invalid_string,message:s.message}),r.dirty()):s.kind==="base64url"?Et.test(e.data)||(i=this._getOrReturnCtx(e,i),m(i,{validation:"base64url",code:u.invalid_string,message:s.message}),r.dirty()):_.assertNever(s);return{status:r.value,value:e.data}}_regex(e,t,r){return this.refinement(i=>e.test(i),{validation:t,code:u.invalid_string,...g.errToObj(r)})}_addCheck(e){return new A({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...g.errToObj(e)})}url(e){return this._addCheck({kind:"url",...g.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...g.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...g.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...g.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...g.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...g.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...g.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...g.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...g.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...g.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...g.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...g.errToObj(e)})}datetime(e){var t,r;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:(t=e==null?void 0:e.offset)!==null&&t!==void 0?t:!1,local:(r=e==null?void 0:e.local)!==null&&r!==void 0?r:!1,...g.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,...g.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...g.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...g.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...g.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...g.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...g.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...g.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...g.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...g.errToObj(t)})}nonempty(e){return this.min(1,g.errToObj(e))}trim(){return new A({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new A({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new A({...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}}A.create=n=>{var e;return new A({checks:[],typeName:y.ZodString,coerce:(e=n==null?void 0:n.coerce)!==null&&e!==void 0?e:!1,...b(n)})};function Ft(n,e){const t=(n.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,i=t>r?t:r,s=parseInt(n.toFixed(i).replace(".","")),c=parseInt(e.toFixed(i).replace(".",""));return s%c/Math.pow(10,i)}class z extends k{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)!==f.number){const s=this._getOrReturnCtx(e);return m(s,{code:u.invalid_type,expected:f.number,received:s.parsedType}),v}let r;const i=new I;for(const s of this._def.checks)s.kind==="int"?_.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),m(r,{code:u.invalid_type,expected:"integer",received:"float",message:s.message}),i.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),m(r,{code:u.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),m(r,{code:u.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?Ft(e.data,s.value)!==0&&(r=this._getOrReturnCtx(e,r),m(r,{code:u.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),m(r,{code:u.not_finite,message:s.message}),i.dirty()):_.assertNever(s);return{status:i.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,g.toString(t))}gt(e,t){return this.setLimit("min",e,!1,g.toString(t))}lte(e,t){return this.setLimit("max",e,!0,g.toString(t))}lt(e,t){return this.setLimit("max",e,!1,g.toString(t))}setLimit(e,t,r,i){return new z({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:g.toString(i)}]})}_addCheck(e){return new z({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:g.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:g.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:g.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:g.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:g.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:g.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:g.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:g.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:g.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"&&_.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(t===null||r.value>t)&&(t=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}}z.create=n=>new z({checks:[],typeName:y.ZodNumber,coerce:(n==null?void 0:n.coerce)||!1,...b(n)});class F extends k{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)!==f.bigint)return this._getInvalidInput(e);let r;const i=new I;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),m(r,{code:u.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),m(r,{code:u.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),m(r,{code:u.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):_.assertNever(s);return{status:i.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return m(t,{code:u.invalid_type,expected:f.bigint,received:t.parsedType}),v}gte(e,t){return this.setLimit("min",e,!0,g.toString(t))}gt(e,t){return this.setLimit("min",e,!1,g.toString(t))}lte(e,t){return this.setLimit("max",e,!0,g.toString(t))}lt(e,t){return this.setLimit("max",e,!1,g.toString(t))}setLimit(e,t,r,i){return new F({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:g.toString(i)}]})}_addCheck(e){return new F({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:g.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:g.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:g.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:g.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:g.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}}F.create=n=>{var e;return new F({checks:[],typeName:y.ZodBigInt,coerce:(e=n==null?void 0:n.coerce)!==null&&e!==void 0?e:!1,...b(n)})};class ae extends k{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==f.boolean){const r=this._getOrReturnCtx(e);return m(r,{code:u.invalid_type,expected:f.boolean,received:r.parsedType}),v}return N(e.data)}}ae.create=n=>new ae({typeName:y.ZodBoolean,coerce:(n==null?void 0:n.coerce)||!1,...b(n)});class B extends k{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==f.date){const s=this._getOrReturnCtx(e);return m(s,{code:u.invalid_type,expected:f.date,received:s.parsedType}),v}if(isNaN(e.data.getTime())){const s=this._getOrReturnCtx(e);return m(s,{code:u.invalid_date}),v}const r=new I;let i;for(const s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(i=this._getOrReturnCtx(e,i),m(i,{code:u.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(i=this._getOrReturnCtx(e,i),m(i,{code:u.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):_.assertNever(s);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new B({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:g.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:g.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}}B.create=n=>new B({checks:[],coerce:(n==null?void 0:n.coerce)||!1,typeName:y.ZodDate,...b(n)});class we extends k{_parse(e){if(this._getType(e)!==f.symbol){const r=this._getOrReturnCtx(e);return m(r,{code:u.invalid_type,expected:f.symbol,received:r.parsedType}),v}return N(e.data)}}we.create=n=>new we({typeName:y.ZodSymbol,...b(n)});class ie extends k{_parse(e){if(this._getType(e)!==f.undefined){const r=this._getOrReturnCtx(e);return m(r,{code:u.invalid_type,expected:f.undefined,received:r.parsedType}),v}return N(e.data)}}ie.create=n=>new ie({typeName:y.ZodUndefined,...b(n)});class se extends k{_parse(e){if(this._getType(e)!==f.null){const r=this._getOrReturnCtx(e);return m(r,{code:u.invalid_type,expected:f.null,received:r.parsedType}),v}return N(e.data)}}se.create=n=>new se({typeName:y.ZodNull,...b(n)});class X extends k{constructor(){super(...arguments),this._any=!0}_parse(e){return N(e.data)}}X.create=n=>new X({typeName:y.ZodAny,...b(n)});class W extends k{constructor(){super(...arguments),this._unknown=!0}_parse(e){return N(e.data)}}W.create=n=>new W({typeName:y.ZodUnknown,...b(n)});class M extends k{_parse(e){const t=this._getOrReturnCtx(e);return m(t,{code:u.invalid_type,expected:f.never,received:t.parsedType}),v}}M.create=n=>new M({typeName:y.ZodNever,...b(n)});class Te extends k{_parse(e){if(this._getType(e)!==f.undefined){const r=this._getOrReturnCtx(e);return m(r,{code:u.invalid_type,expected:f.void,received:r.parsedType}),v}return N(e.data)}}Te.create=n=>new Te({typeName:y.ZodVoid,...b(n)});class j extends k{_parse(e){const{ctx:t,status:r}=this._processInputParams(e),i=this._def;if(t.parsedType!==f.array)return m(t,{code:u.invalid_type,expected:f.array,received:t.parsedType}),v;if(i.exactLength!==null){const c=t.data.length>i.exactLength.value,o=t.data.length<i.exactLength.value;(c||o)&&(m(t,{code:c?u.too_big:u.too_small,minimum:o?i.exactLength.value:void 0,maximum:c?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),r.dirty())}if(i.minLength!==null&&t.data.length<i.minLength.value&&(m(t,{code:u.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),r.dirty()),i.maxLength!==null&&t.data.length>i.maxLength.value&&(m(t,{code:u.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((c,o)=>i.type._parseAsync(new Z(t,c,t.path,o)))).then(c=>I.mergeArray(r,c));const s=[...t.data].map((c,o)=>i.type._parseSync(new Z(t,c,t.path,o)));return I.mergeArray(r,s)}get element(){return this._def.type}min(e,t){return new j({...this._def,minLength:{value:e,message:g.toString(t)}})}max(e,t){return new j({...this._def,maxLength:{value:e,message:g.toString(t)}})}length(e,t){return new j({...this._def,exactLength:{value:e,message:g.toString(t)}})}nonempty(e){return this.min(1,e)}}j.create=(n,e)=>new j({type:n,minLength:null,maxLength:null,exactLength:null,typeName:y.ZodArray,...b(e)});function J(n){if(n instanceof S){const e={};for(const t in n.shape){const r=n.shape[t];e[t]=P.create(J(r))}return new S({...n._def,shape:()=>e})}else return n instanceof j?new j({...n._def,type:J(n.element)}):n instanceof P?P.create(J(n.unwrap())):n instanceof U?U.create(J(n.unwrap())):n instanceof O?O.create(n.items.map(e=>J(e))):n}class S extends k{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=_.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==f.object){const d=this._getOrReturnCtx(e);return m(d,{code:u.invalid_type,expected:f.object,received:d.parsedType}),v}const{status:r,ctx:i}=this._processInputParams(e),{shape:s,keys:c}=this._getCached(),o=[];if(!(this._def.catchall instanceof M&&this._def.unknownKeys==="strip"))for(const d in i.data)c.includes(d)||o.push(d);const l=[];for(const d of c){const h=s[d],x=i.data[d];l.push({key:{status:"valid",value:d},value:h._parse(new Z(i,x,i.path,d)),alwaysSet:d in i.data})}if(this._def.catchall instanceof M){const d=this._def.unknownKeys;if(d==="passthrough")for(const h of o)l.push({key:{status:"valid",value:h},value:{status:"valid",value:i.data[h]}});else if(d==="strict")o.length>0&&(m(i,{code:u.unrecognized_keys,keys:o}),r.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const d=this._def.catchall;for(const h of o){const x=i.data[h];l.push({key:{status:"valid",value:h},value:d._parse(new Z(i,x,i.path,h)),alwaysSet:h in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const d=[];for(const h of l){const x=await h.key,T=await h.value;d.push({key:x,value:T,alwaysSet:h.alwaysSet})}return d}).then(d=>I.mergeObjectSync(r,d)):I.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return g.errToObj,new S({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{var i,s,c,o;const l=(c=(s=(i=this._def).errorMap)===null||s===void 0?void 0:s.call(i,t,r).message)!==null&&c!==void 0?c:r.defaultError;return t.code==="unrecognized_keys"?{message:(o=g.errToObj(e).message)!==null&&o!==void 0?o:l}:{message:l}}}:{}})}strip(){return new S({...this._def,unknownKeys:"strip"})}passthrough(){return new S({...this._def,unknownKeys:"passthrough"})}extend(e){return new S({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new S({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:y.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new S({...this._def,catchall:e})}pick(e){const t={};return _.objectKeys(e).forEach(r=>{e[r]&&this.shape[r]&&(t[r]=this.shape[r])}),new S({...this._def,shape:()=>t})}omit(e){const t={};return _.objectKeys(this.shape).forEach(r=>{e[r]||(t[r]=this.shape[r])}),new S({...this._def,shape:()=>t})}deepPartial(){return J(this)}partial(e){const t={};return _.objectKeys(this.shape).forEach(r=>{const i=this.shape[r];e&&!e[r]?t[r]=i:t[r]=i.optional()}),new S({...this._def,shape:()=>t})}required(e){const t={};return _.objectKeys(this.shape).forEach(r=>{if(e&&!e[r])t[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof P;)s=s._def.innerType;t[r]=s}}),new S({...this._def,shape:()=>t})}keyof(){return He(_.objectKeys(this.shape))}}S.create=(n,e)=>new S({shape:()=>n,unknownKeys:"strip",catchall:M.create(),typeName:y.ZodObject,...b(e)}),S.strictCreate=(n,e)=>new S({shape:()=>n,unknownKeys:"strict",catchall:M.create(),typeName:y.ZodObject,...b(e)}),S.lazycreate=(n,e)=>new S({shape:n,unknownKeys:"strip",catchall:M.create(),typeName:y.ZodObject,...b(e)});class oe extends k{_parse(e){const{ctx:t}=this._processInputParams(e),r=this._def.options;function i(s){for(const o of s)if(o.result.status==="valid")return o.result;for(const o of s)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const c=s.map(o=>new C(o.ctx.common.issues));return m(t,{code:u.invalid_union,unionErrors:c}),v}if(t.common.async)return Promise.all(r.map(async s=>{const c={...t,common:{...t.common,issues:[]},parent:null};return{result:await s._parseAsync({data:t.data,path:t.path,parent:c}),ctx:c}})).then(i);{let s;const c=[];for(const l of r){const d={...t,common:{...t.common,issues:[]},parent:null},h=l._parseSync({data:t.data,path:t.path,parent:d});if(h.status==="valid")return h;h.status==="dirty"&&!s&&(s={result:h,ctx:d}),d.common.issues.length&&c.push(d.common.issues)}if(s)return t.common.issues.push(...s.ctx.common.issues),s.result;const o=c.map(l=>new C(l));return m(t,{code:u.invalid_union,unionErrors:o}),v}}get options(){return this._def.options}}oe.create=(n,e)=>new oe({options:n,typeName:y.ZodUnion,...b(e)});const $=n=>n instanceof de?$(n.schema):n instanceof D?$(n.innerType()):n instanceof le?[n.value]:n instanceof L?n.options:n instanceof me?_.objectValues(n.enum):n instanceof fe?$(n._def.innerType):n instanceof ie?[void 0]:n instanceof se?[null]:n instanceof P?[void 0,...$(n.unwrap())]:n instanceof U?[null,...$(n.unwrap())]:n instanceof Pe||n instanceof ge?$(n.unwrap()):n instanceof he?$(n._def.innerType):[];class Ie extends k{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.object)return m(t,{code:u.invalid_type,expected:f.object,received:t.parsedType}),v;const r=this.discriminator,i=t.data[r],s=this.optionsMap.get(i);return s?t.common.async?s._parseAsync({data:t.data,path:t.path,parent:t}):s._parseSync({data:t.data,path:t.path,parent:t}):(m(t,{code:u.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),v)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){const i=new Map;for(const s of t){const c=$(s.shape[e]);if(!c.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of c){if(i.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);i.set(o,s)}}return new Ie({typeName:y.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:i,...b(r)})}}function Oe(n,e){const t=R(n),r=R(e);if(n===e)return{valid:!0,data:n};if(t===f.object&&r===f.object){const i=_.objectKeys(e),s=_.objectKeys(n).filter(o=>i.indexOf(o)!==-1),c={...n,...e};for(const o of s){const l=Oe(n[o],e[o]);if(!l.valid)return{valid:!1};c[o]=l.data}return{valid:!0,data:c}}else if(t===f.array&&r===f.array){if(n.length!==e.length)return{valid:!1};const i=[];for(let s=0;s<n.length;s++){const c=n[s],o=e[s],l=Oe(c,o);if(!l.valid)return{valid:!1};i.push(l.data)}return{valid:!0,data:i}}else return t===f.date&&r===f.date&&+n==+e?{valid:!0,data:n}:{valid:!1}}class ce extends k{_parse(e){const{status:t,ctx:r}=this._processInputParams(e),i=(s,c)=>{if(je(s)||je(c))return v;const o=Oe(s.value,c.value);return o.valid?((De(s)||De(c))&&t.dirty(),{status:t.value,value:o.data}):(m(r,{code:u.invalid_intersection_types}),v)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([s,c])=>i(s,c)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}ce.create=(n,e,t)=>new ce({left:n,right:e,typeName:y.ZodIntersection,...b(t)});class O extends k{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==f.array)return m(r,{code:u.invalid_type,expected:f.array,received:r.parsedType}),v;if(r.data.length<this._def.items.length)return m(r,{code:u.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),v;!this._def.rest&&r.data.length>this._def.items.length&&(m(r,{code:u.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const s=[...r.data].map((c,o)=>{const l=this._def.items[o]||this._def.rest;return l?l._parse(new Z(r,c,r.path,o)):null}).filter(c=>!!c);return r.common.async?Promise.all(s).then(c=>I.mergeArray(t,c)):I.mergeArray(t,s)}get items(){return this._def.items}rest(e){return new O({...this._def,rest:e})}}O.create=(n,e)=>{if(!Array.isArray(n))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new O({items:n,typeName:y.ZodTuple,rest:null,...b(e)})};class ue extends k{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==f.object)return m(r,{code:u.invalid_type,expected:f.object,received:r.parsedType}),v;const i=[],s=this._def.keyType,c=this._def.valueType;for(const o in r.data)i.push({key:s._parse(new Z(r,o,r.path,o)),value:c._parse(new Z(r,r.data[o],r.path,o)),alwaysSet:o in r.data});return r.common.async?I.mergeObjectAsync(t,i):I.mergeObjectSync(t,i)}get element(){return this._def.valueType}static create(e,t,r){return t instanceof k?new ue({keyType:e,valueType:t,typeName:y.ZodRecord,...b(r)}):new ue({keyType:A.create(),valueType:e,typeName:y.ZodRecord,...b(t)})}}class Ne extends k{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==f.map)return m(r,{code:u.invalid_type,expected:f.map,received:r.parsedType}),v;const i=this._def.keyType,s=this._def.valueType,c=[...r.data.entries()].map(([o,l],d)=>({key:i._parse(new Z(r,o,r.path,[d,"key"])),value:s._parse(new Z(r,l,r.path,[d,"value"]))}));if(r.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const l of c){const d=await l.key,h=await l.value;if(d.status==="aborted"||h.status==="aborted")return v;(d.status==="dirty"||h.status==="dirty")&&t.dirty(),o.set(d.value,h.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const l of c){const d=l.key,h=l.value;if(d.status==="aborted"||h.status==="aborted")return v;(d.status==="dirty"||h.status==="dirty")&&t.dirty(),o.set(d.value,h.value)}return{status:t.value,value:o}}}}Ne.create=(n,e,t)=>new Ne({valueType:e,keyType:n,typeName:y.ZodMap,...b(t)});class Q extends k{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==f.set)return m(r,{code:u.invalid_type,expected:f.set,received:r.parsedType}),v;const i=this._def;i.minSize!==null&&r.data.size<i.minSize.value&&(m(r,{code:u.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),t.dirty()),i.maxSize!==null&&r.data.size>i.maxSize.value&&(m(r,{code:u.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),t.dirty());const s=this._def.valueType;function c(l){const d=new Set;for(const h of l){if(h.status==="aborted")return v;h.status==="dirty"&&t.dirty(),d.add(h.value)}return{status:t.value,value:d}}const o=[...r.data.values()].map((l,d)=>s._parse(new Z(r,l,r.path,d)));return r.common.async?Promise.all(o).then(l=>c(l)):c(o)}min(e,t){return new Q({...this._def,minSize:{value:e,message:g.toString(t)}})}max(e,t){return new Q({...this._def,maxSize:{value:e,message:g.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Q.create=(n,e)=>new Q({valueType:n,minSize:null,maxSize:null,typeName:y.ZodSet,...b(e)});class H extends k{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.function)return m(t,{code:u.invalid_type,expected:f.function,received:t.parsedType}),v;function r(o,l){return xe({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ke(),Y].filter(d=>!!d),issueData:{code:u.invalid_arguments,argumentsError:l}})}function i(o,l){return xe({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ke(),Y].filter(d=>!!d),issueData:{code:u.invalid_return_type,returnTypeError:l}})}const s={errorMap:t.common.contextualErrorMap},c=t.data;if(this._def.returns instanceof K){const o=this;return N(async function(...l){const d=new C([]),h=await o._def.args.parseAsync(l,s).catch(w=>{throw d.addIssue(r(l,w)),d}),x=await Reflect.apply(c,this,h);return await o._def.returns._def.type.parseAsync(x,s).catch(w=>{throw d.addIssue(i(x,w)),d})})}else{const o=this;return N(function(...l){const d=o._def.args.safeParse(l,s);if(!d.success)throw new C([r(l,d.error)]);const h=Reflect.apply(c,this,d.data),x=o._def.returns.safeParse(h,s);if(!x.success)throw new C([i(h,x.error)]);return x.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new H({...this._def,args:O.create(e).rest(W.create())})}returns(e){return new H({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new H({args:e||O.create([]).rest(W.create()),returns:t||W.create(),typeName:y.ZodFunction,...b(r)})}}class de extends k{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})}}de.create=(n,e)=>new de({getter:n,typeName:y.ZodLazy,...b(e)});class le extends k{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return m(t,{received:t.data,code:u.invalid_literal,expected:this._def.value}),v}return{status:"valid",value:e.data}}get value(){return this._def.value}}le.create=(n,e)=>new le({value:n,typeName:y.ZodLiteral,...b(e)});function He(n,e){return new L({values:n,typeName:y.ZodEnum,...b(e)})}class L extends k{constructor(){super(...arguments),ne.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),r=this._def.values;return m(t,{expected:_.joinValues(r),received:t.parsedType,code:u.invalid_type}),v}if(Se(this,ne)||Qe(this,ne,new Set(this._def.values)),!Se(this,ne).has(e.data)){const t=this._getOrReturnCtx(e),r=this._def.values;return m(t,{received:t.data,code:u.invalid_enum_value,options:r}),v}return N(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 L.create(e,{...this._def,...t})}exclude(e,t=this._def){return L.create(this.options.filter(r=>!e.includes(r)),{...this._def,...t})}}ne=new WeakMap,L.create=He;class me extends k{constructor(){super(...arguments),re.set(this,void 0)}_parse(e){const t=_.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==f.string&&r.parsedType!==f.number){const i=_.objectValues(t);return m(r,{expected:_.joinValues(i),received:r.parsedType,code:u.invalid_type}),v}if(Se(this,re)||Qe(this,re,new Set(_.getValidEnumValues(this._def.values))),!Se(this,re).has(e.data)){const i=_.objectValues(t);return m(r,{received:r.data,code:u.invalid_enum_value,options:i}),v}return N(e.data)}get enum(){return this._def.values}}re=new WeakMap,me.create=(n,e)=>new me({values:n,typeName:y.ZodNativeEnum,...b(e)});class K extends k{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.promise&&t.common.async===!1)return m(t,{code:u.invalid_type,expected:f.promise,received:t.parsedType}),v;const r=t.parsedType===f.promise?t.data:Promise.resolve(t.data);return N(r.then(i=>this._def.type.parseAsync(i,{path:t.path,errorMap:t.common.contextualErrorMap})))}}K.create=(n,e)=>new K({type:n,typeName:y.ZodPromise,...b(e)});class D extends k{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===y.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:r}=this._processInputParams(e),i=this._def.effect||null,s={addIssue:c=>{m(r,c),c.fatal?t.abort():t.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),i.type==="preprocess"){const c=i.transform(r.data,s);if(r.common.async)return Promise.resolve(c).then(async o=>{if(t.value==="aborted")return v;const l=await this._def.schema._parseAsync({data:o,path:r.path,parent:r});return l.status==="aborted"?v:l.status==="dirty"||t.value==="dirty"?G(l.value):l});{if(t.value==="aborted")return v;const o=this._def.schema._parseSync({data:c,path:r.path,parent:r});return o.status==="aborted"?v:o.status==="dirty"||t.value==="dirty"?G(o.value):o}}if(i.type==="refinement"){const c=o=>{const l=i.refinement(o,s);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?v:(o.status==="dirty"&&t.dirty(),c(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>o.status==="aborted"?v:(o.status==="dirty"&&t.dirty(),c(o.value).then(()=>({status:t.value,value:o.value}))))}if(i.type==="transform")if(r.common.async===!1){const c=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!q(c))return c;const o=i.transform(c.value,s);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:r.data,path:r.path,parent:r}).then(c=>q(c)?Promise.resolve(i.transform(c.value,s)).then(o=>({status:t.value,value:o})):c);_.assertNever(i)}}D.create=(n,e,t)=>new D({schema:n,typeName:y.ZodEffects,effect:e,...b(t)}),D.createWithPreprocess=(n,e,t)=>new D({schema:e,effect:{type:"preprocess",transform:n},typeName:y.ZodEffects,...b(t)});class P extends k{_parse(e){return this._getType(e)===f.undefined?N(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}P.create=(n,e)=>new P({innerType:n,typeName:y.ZodOptional,...b(e)});class U extends k{_parse(e){return this._getType(e)===f.null?N(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}U.create=(n,e)=>new U({innerType:n,typeName:y.ZodNullable,...b(e)});class fe extends k{_parse(e){const{ctx:t}=this._processInputParams(e);let r=t.data;return t.parsedType===f.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}fe.create=(n,e)=>new fe({innerType:n,typeName:y.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...b(e)});class he extends k{_parse(e){const{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return te(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new C(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new C(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}he.create=(n,e)=>new he({innerType:n,typeName:y.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...b(e)});class Ce extends k{_parse(e){if(this._getType(e)!==f.nan){const r=this._getOrReturnCtx(e);return m(r,{code:u.invalid_type,expected:f.nan,received:r.parsedType}),v}return{status:"valid",value:e.data}}}Ce.create=n=>new Ce({typeName:y.ZodNaN,...b(n)});const Lt=Symbol("zod_brand");class Pe extends k{_parse(e){const{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class pe extends k{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?v:s.status==="dirty"?(t.dirty(),G(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})})();{const i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?v:i.status==="dirty"?(t.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(e,t){return new pe({in:e,out:t,typeName:y.ZodPipeline})}}class ge extends k{_parse(e){const t=this._def.innerType._parse(e),r=i=>(q(i)&&(i.value=Object.freeze(i.value)),i);return te(t)?t.then(i=>r(i)):r(t)}unwrap(){return this._def.innerType}}ge.create=(n,e)=>new ge({innerType:n,typeName:y.ZodReadonly,...b(e)});function Ke(n,e){const t=typeof n=="function"?n(e):typeof n=="string"?{message:n}:n;return typeof t=="string"?{message:t}:t}function et(n,e={},t){return n?X.create().superRefine((r,i)=>{var s,c;const o=n(r);if(o instanceof Promise)return o.then(l=>{var d,h;if(!l){const x=Ke(e,r),T=(h=(d=x.fatal)!==null&&d!==void 0?d:t)!==null&&h!==void 0?h:!0;i.addIssue({code:"custom",...x,fatal:T})}});if(!o){const l=Ke(e,r),d=(c=(s=l.fatal)!==null&&s!==void 0?s:t)!==null&&c!==void 0?c:!0;i.addIssue({code:"custom",...l,fatal:d})}}):X.create()}const Ut={object:S.lazycreate};var y;(function(n){n.ZodString="ZodString",n.ZodNumber="ZodNumber",n.ZodNaN="ZodNaN",n.ZodBigInt="ZodBigInt",n.ZodBoolean="ZodBoolean",n.ZodDate="ZodDate",n.ZodSymbol="ZodSymbol",n.ZodUndefined="ZodUndefined",n.ZodNull="ZodNull",n.ZodAny="ZodAny",n.ZodUnknown="ZodUnknown",n.ZodNever="ZodNever",n.ZodVoid="ZodVoid",n.ZodArray="ZodArray",n.ZodObject="ZodObject",n.ZodUnion="ZodUnion",n.ZodDiscriminatedUnion="ZodDiscriminatedUnion",n.ZodIntersection="ZodIntersection",n.ZodTuple="ZodTuple",n.ZodRecord="ZodRecord",n.ZodMap="ZodMap",n.ZodSet="ZodSet",n.ZodFunction="ZodFunction",n.ZodLazy="ZodLazy",n.ZodLiteral="ZodLiteral",n.ZodEnum="ZodEnum",n.ZodEffects="ZodEffects",n.ZodNativeEnum="ZodNativeEnum",n.ZodOptional="ZodOptional",n.ZodNullable="ZodNullable",n.ZodDefault="ZodDefault",n.ZodCatch="ZodCatch",n.ZodPromise="ZodPromise",n.ZodBranded="ZodBranded",n.ZodPipeline="ZodPipeline",n.ZodReadonly="ZodReadonly"})(y||(y={}));const qt=(n,e={message:`Input not instance of ${n.name}`})=>et(t=>t instanceof n,e),tt=A.create,nt=z.create,Bt=Ce.create,Wt=F.create,rt=ae.create,Qt=B.create,Yt=we.create,Gt=ie.create,Xt=se.create,Jt=X.create,Ht=W.create,Kt=M.create,en=Te.create,tn=j.create,nn=S.create,rn=S.strictCreate,an=oe.create,sn=Ie.create,on=ce.create,cn=O.create,un=ue.create,dn=Ne.create,ln=Q.create,mn=H.create,fn=de.create,hn=le.create,pn=L.create,gn=me.create,yn=K.create,at=D.create,vn=P.create,_n=U.create,bn=D.createWithPreprocess,kn=pe.create;var a=Object.freeze({__proto__:null,defaultErrorMap:Y,setErrorMap:_t,getErrorMap:ke,makeIssue:xe,EMPTY_PATH:bt,addIssueToContext:m,ParseStatus:I,INVALID:v,DIRTY:G,OK:N,isAborted:je,isDirty:De,isValid:q,isAsync:te,get util(){return _},get objectUtil(){return V},ZodParsedType:f,getParsedType:R,ZodType:k,datetimeRegex:Je,ZodString:A,ZodNumber:z,ZodBigInt:F,ZodBoolean:ae,ZodDate:B,ZodSymbol:we,ZodUndefined:ie,ZodNull:se,ZodAny:X,ZodUnknown:W,ZodNever:M,ZodVoid:Te,ZodArray:j,ZodObject:S,ZodUnion:oe,ZodDiscriminatedUnion:Ie,ZodIntersection:ce,ZodTuple:O,ZodRecord:ue,ZodMap:Ne,ZodSet:Q,ZodFunction:H,ZodLazy:de,ZodLiteral:le,ZodEnum:L,ZodNativeEnum:me,ZodPromise:K,ZodEffects:D,ZodTransformer:D,ZodOptional:P,ZodNullable:U,ZodDefault:fe,ZodCatch:he,ZodNaN:Ce,BRAND:Lt,ZodBranded:Pe,ZodPipeline:pe,ZodReadonly:ge,custom:et,Schema:k,ZodSchema:k,late:Ut,get ZodFirstPartyTypeKind(){return y},coerce:{string:n=>A.create({...n,coerce:!0}),number:n=>z.create({...n,coerce:!0}),boolean:n=>ae.create({...n,coerce:!0}),bigint:n=>F.create({...n,coerce:!0}),date:n=>B.create({...n,coerce:!0})},any:Jt,array:tn,bigint:Wt,boolean:rt,date:Qt,discriminatedUnion:sn,effect:at,enum:pn,function:mn,instanceof:qt,intersection:on,lazy:fn,literal:hn,map:dn,nan:Bt,nativeEnum:gn,never:Kt,null:Xt,nullable:_n,number:nt,object:nn,oboolean:()=>rt().optional(),onumber:()=>nt().optional(),optional:vn,ostring:()=>tt().optional(),pipeline:kn,preprocess:bn,promise:yn,record:un,set:ln,strictObject:rn,string:tt,symbol:Yt,transformer:at,tuple:cn,undefined:Gt,union:an,unknown:Ht,void:en,NEVER:v,ZodIssueCode:u,quotelessJson:vt,ZodError:C});const ye=a.object({country:a.string().optional(),city:a.string().optional(),street:a.string().optional(),streetNumber:a.string().optional(),floor:a.string().optional(),apartmentEnterNumber:a.string().optional(),apartmentNumber:a.string().optional()}),E=a.string().min(1,{message:"שדה חובה"}),xn=a.string().regex(/^\d+$/,"Must be a numeric string"),Sn=a.object({url:a.string().url(),id:a.string()});function wn(n){return!!(n!=null&&n.url)}const ee=a.object({lang:a.enum(["he"]),value:a.string()}),Tn=a.array(ee),Ee=a.object({id:a.string().min(1),companyId:a.string().min(1),storeId:a.string().min(1),parentId:a.string().nullish(),tag:a.string().optional(),locales:a.array(ee),depth:a.number()}),Ae=Ee.extend({children:a.lazy(()=>Ae.array())}),In=Ee.extend({index:a.number(),depth:a.number(),collapsed:a.boolean().optional(),children:a.array(Ae)}),ve=a.string().min(1),Re=a.object({type:a.literal("Product"),storeId:ve,companyId:ve,id:ve,objectID:ve,sku:ve,name:a.array(ee),description:a.array(ee),isPublished:a.boolean(),vat:a.boolean(),priceType:a.object({type:a.enum(["unit","kg","gram","liter","ml"]),value:a.number()}),price:a.number().positive(),purchasePrice:a.number().optional(),profitPercentage:a.number().optional(),currency:a.literal("ILS"),discount:a.object({type:a.enum(["number","percent","none"]),value:a.number()}),isDiscountable:a.boolean({description:"included in store discounts"}).optional(),weight:a.object({value:a.number(),unit:a.enum(["kg","gram","none"])}),volume:a.object({value:a.number(),unit:a.enum(["liter","ml","none"])}),images:a.array(a.object({url:a.string().url(),id:a.string()})),manufacturer:a.string(),brand:a.string(),importer:a.string(),supplier:a.string(),ingredients:a.array(ee),created_at:a.number(),updated_at:a.number(),categoryIds:a.array(a.string().nonempty()),stock:a.object({quantity:a.number().min(0),unit:a.enum(["piece","kg","gram","liter","ml"])}).optional(),categoryList:a.array(Ae).optional(),categories:a.object({lvl0:a.array(a.string()),lvl1:a.array(a.string()),lvl2:a.array(a.string()),lvl3:a.array(a.string()),lvl4:a.array(a.string())}).optional(),categoryNames:a.array(a.string()).optional()}),Nn=Re.extend({image:a.instanceof(File).optional()}),Me=a.object({product:Re,originalPrice:a.number().optional(),finalPrice:a.number().optional(),finalDiscount:a.number().optional(),amount:a.number().positive({message:"Quantity must be a positive number."})}),Cn=a.object({type:a.literal("Cart"),id:a.string().uuid(),companyId:a.string().uuid(),storeId:a.string().uuid(),userId:a.string().uuid(),status:a.enum(["active","draft","completed"]),items:a.array(Me)}),An=a.object({id:a.string(),name:a.string(),websiteDomains:a.array(a.string())}),jn=a.object({type:a.literal("FavoriteProduct"),id:a.string().uuid(),companyId:a.string().uuid(),storeId:a.string().uuid(),userId:a.string().uuid(),productId:a.string().uuid()}),_e=a.enum(["external","j5","none"]),it=a.object({type:a.literal("Profile"),id:E,companyId:E,storeId:E,tenantId:E,clientType:a.enum(["user","company"]),companyName:a.string().optional(),displayName:E,email:a.string().email(),phoneNumber:a.string().optional(),address:ye.optional(),isAnonymous:a.boolean(),createdDate:a.number(),lastActivityDate:a.number(),paymentType:_e.optional(),organizationId:a.string().optional().nullable()}),$e=a.object({_COMMENT:a.string().optional(),transaction_id:a.string(),date:a.string().regex(/^\d{4}-\d{2}-\d{2}$/,"Date must be in YYYY-MM-DD format"),currency:a.string().length(3,"Currency must be 3 characters"),rate:a.number().positive(),vat:a.string().regex(/^\d+\.\d{2}$/,"VAT must be in format XX.XX"),vat_price:a.number().positive(),price_discount:a.number(),price_discount_in_currency:a.number(),price_total:a.string().regex(/^\d+\.\d{2}$/,"Price total must be in format XX.XX"),price_total_in_currency:a.number().positive()}),st=a.object({doc_uuid:a.string().uuid("Document UUID must be a valid UUID"),pdf_link:a.string().url("PDF link must be a valid URL"),pdf_link_copy:a.string().url("PDF copy link must be a valid URL"),doc_number:a.string().min(1,"Document number is required"),sent_mails:a.array(a.string().email("Each email must be valid")),success:a.boolean(),ua_uuid:a.string().uuid("UA UUID must be a valid UUID"),calculatedData:$e,warning:a.string().optional(),date:a.number().optional()}),ot=a.object({id:a.string().min(1,"ID is required"),number:a.string().min(1,"Number is required"),date:a.number().min(1,"Date is required"),createdAt:a.number().min(1,"Created at is required"),status:a.enum(["pending","paid","cancelled"]),companyDetails:a.object({name:a.string().min(1,"Name is required").optional(),address:a.string().min(1,"Address is required").optional(),phone:a.string().min(1,"Phone is required").optional(),email:a.string().email("Email must be valid").optional()}).optional(),clientDetails:a.object({name:a.string().min(1,"Name is required").optional(),address:a.string().min(1,"Address is required").optional(),phone:a.string().min(1,"Phone is required").optional(),email:a.string().email("Email must be valid").optional()}).optional(),items:a.array(a.object({name:a.string().min(1,"Name is required").optional(),price:a.number().min(1,"Price is required").optional(),quantity:a.number().min(1,"Quantity is required").optional(),total:a.number().min(1,"Total is required").optional()})).optional(),total:a.number().min(1,"Total is required").optional(),vat:a.number().min(1,"VAT is required").optional(),link:a.string().url("Link must be a valid URL").optional()}),Ve=a.object({number:a.string(),name:a.string(),id:a.string()}),ct=a.object({id:a.string(),name:a.string(),discountPercentage:a.number().positive().min(0).max(100).optional(),nameOnInvoice:a.string().optional(),billingAccounts:a.array(Ve),paymentType:_e,companyNumber:a.string().optional(),address:ye.optional(),groupId:a.string().optional()}),Dn=ct.omit({id:!0}),Zn=a.object({doc_uuid:a.string().uuid("Document UUID must be a valid UUID"),pdf_link:a.string().url("PDF link must be a valid URL"),pdf_link_copy:a.string().url("PDF copy link must be a valid URL"),doc_number:a.string().min(1,"Document number is required"),sent_mails:a.array(a.string().email("Each email must be valid")),success:a.boolean(),ua_uuid:a.string().uuid("UA UUID must be a valid UUID"),calculatedData:$e,warning:a.string().optional(),date:a.number().optional()}),On=a.object({id:a.string().min(1,"ID is required"),number:a.string().min(1,"Number is required"),date:a.string().min(1,"Date is required"),createdAt:a.number().min(1,"Created at is required"),status:a.enum(["pending","paid","cancelled"]),companyDetails:a.object({name:a.string().min(1,"Name is required").optional(),address:a.string().min(1,"Address is required").optional(),phone:a.string().min(1,"Phone is required").optional(),email:a.string().email("Email must be valid").optional()}).optional(),clientDetails:a.object({name:a.string().min(1,"Name is required").optional(),address:a.string().min(1,"Address is required").optional(),phone:a.string().min(1,"Phone is required").optional(),email:a.string().email("Email must be valid").optional()}).optional(),items:a.array(a.object({name:a.string().min(1,"Name is required").optional(),price:a.number().min(1,"Price is required").optional(),quantity:a.number().min(1,"Quantity is required").optional(),total:a.number().min(1,"Total is required").optional()})).optional(),total:a.number().min(1,"Total is required").optional(),vat:a.number().min(1,"VAT is required").optional(),link:a.string().url("Link must be a valid URL").optional()}),Pn=a.object({type:a.literal("Order"),createdBy:a.enum(["user","admin"]).optional(),id:E,companyId:E,storeId:E,userId:E,status:a.enum(["draft","pending","processing","in_delivery","delivered","cancelled","completed","refunded"]),paymentType:_e.optional(),paymentStatus:a.enum(["pending","pending_j5","external","completed","failed","refunded"]),cart:a.object({id:a.string(),items:a.array(Me),cartDiscount:a.number(),cartTotal:a.number(),cartVat:a.number(),deliveryPrice:a.number().optional()}),storeOptions:a.object({deliveryPrice:a.number().optional(),freeDeliveryPrice:a.number().optional(),isVatIncludedInPrice:a.boolean().optional()}).optional(),originalAmount:a.number().positive().optional(),actualAmount:a.number().positive().optional(),date:a.number(),deliveryDate:a.coerce.number(),client:it.optional(),address:ye.optional(),nameOnInvoice:a.string().optional(),emailOnInvoice:a.string().email().optional(),phoneNumberOnInvoice:a.string().optional(),clientComment:a.string().optional(),organizationId:a.string().optional(),billingAccount:Ve.optional(),deliveryNote:ot.optional(),invoice:On.optional(),ezInvoice:Zn.optional(),ezDeliveryNote:st.optional()}),ut=a.enum(["individual","company"]),En=a.object({id:a.string(),companyId:a.string(),name:a.string(),urls:a.array(a.string()),logoUrl:a.string(),tenantId:a.string(),paymentType:_e,allowAnonymousClients:a.boolean(),isVatIncludedInPrice:a.boolean(),clientTypes:a.array(ut),minimumOrder:a.number().optional(),freeDeliveryPrice:a.number().optional(),deliveryPrice:a.number().optional(),address:ye.optional(),companyNumber:a.string().optional()}),dt=a.object({minSpend:a.number().positive().optional(),stackable:a.boolean().default(!1)}).optional(),lt=a.discriminatedUnion("variantType",[a.object({variantType:a.literal("bundle"),productsId:a.array(a.string().nonempty()).min(1),requiredQuantity:a.number().positive(),bundlePrice:a.number().positive()})]),Rn=a.object({type:a.literal("Discount"),storeId:a.string().min(1),companyId:a.string().min(1),id:a.string().min(1),name:a.array(a.object({lang:a.enum(["he"]),value:a.string().nonempty()})),active:a.boolean(),startDate:a.number(),endDate:a.number(),variant:lt,conditions:dt});class mt{canApply(e,t){if(e.variant.variantType!=="bundle"||!this.isDiscountActive(e))return!1;const{productsId:r,requiredQuantity:i}=e.variant;return this.getTotalQuantity(t.cart,r)>=i}calculate(e,t){if(e.variant.variantType!=="bundle")return{applicable:!1,discountAmount:0,affectedItems:[]};const{productsId:r,requiredQuantity:i,bundlePrice:s}=e.variant,c=t.cart.filter(be=>r.includes(be.product.id)),o=this.getTotalQuantity(t.cart,r),l=Math.floor(o/i);if(l===0)return{applicable:!1,discountAmount:0,affectedItems:[]};const d=this.calculateOriginalPrice(c),h=this.getTotalQuantity(t.cart,r),x=this.calculateDiscountedPrice(d,s,l,i,h),T=d-x,w=this.distributeDiscount(c,T,d);return{applicable:!0,discountAmount:Number(T.toFixed(2)),affectedItems:w}}isDiscountActive(e){const t=Date.now();return e.active&&e.startDate<=t&&e.endDate>=t}getTotalQuantity(e,t){return e.filter(r=>t.includes(r.product.id)).reduce((r,i)=>r+i.amount,0)}calculateOriginalPrice(e){return e.reduce((t,r)=>t+r.product.price*r.amount,0)}calculateDiscountedPrice(e,t,r,i,s){const c=t*r,o=r*i,d=Math.max(0,s-o)/s*e;return c+d}distributeDiscount(e,t,r){const i=t/r;return e.map(s=>{const c=s.product.price*s.amount*i;return{productId:s.product.id,quantity:s.amount,originalPrice:Number(s.product.price.toFixed(2)),discountedPrice:Number((s.product.price-c/s.amount).toFixed(2)),discountAmount:Number(c.toFixed(2))}})}}class ze{static getStrategy(e){return this.strategies.get(e.variant.variantType)||null}static registerStrategy(e,t){this.strategies.set(e,t)}static getRegisteredTypes(){return Array.from(this.strategies.keys())}static clearStrategies(){this.strategies.clear()}}yt(ze,"strategies",new Map([["bundle",new mt]]));class Mn{static calculateDiscounts(e,t,r){var d,h;const i={cart:e,user:r,appliedDiscounts:[]},s=this.filterActiveDiscounts(t),c=[];for(const x of s){const T=ze.getStrategy(x);if(!T||!T.canApply(x,i)||!((d=x.conditions)!=null&&d.stackable)&&c.length>0)continue;const w=T.calculate(x,i);w.applicable&&(c.push({discountId:x.id,discountName:((h=x.name[0])==null?void 0:h.value)||"Discount",discountAmount:Number(w.discountAmount.toFixed(2)),affectedItems:w.affectedItems}),i.appliedDiscounts=c)}const o=this.calculateFinalPrices(e,c),l=c.reduce((x,T)=>x+T.discountAmount,0);return{items:o,totalDiscount:Number(l.toFixed(2)),appliedDiscounts:c}}static filterActiveDiscounts(e){const t=Date.now();return e.filter(r=>r.active&&r.startDate<=t&&r.endDate>=t)}static calculateFinalPrices(e,t){return e.map(r=>{const i=t.filter(l=>l.affectedItems.some(d=>d.productId===r.product.id)),s=i.reduce((l,d)=>{const h=d.affectedItems.find(x=>x.productId===r.product.id);return l+((h==null?void 0:h.discountAmount)||0)},0),c=s/r.amount,o=r.product.price-c;return{amount:r.amount,product:r.product,originalPrice:Number(r.product.price.toFixed(2)),finalPrice:Number(Math.max(0,o).toFixed(2)),finalDiscount:Number(s.toFixed(2)),appliedDiscounts:i.map(l=>l.discountId)}})}static isDiscountActive(e){const t=Date.now();return e.active&&e.startDate<=t&&e.endDate>=t}static getActiveDiscounts(e){return this.filterActiveDiscounts(e)}}function Fe(n){return Number(n.toFixed(2))}function $n(n){return n.toFixed(2)}function Vn(n){return Math.max(0,Fe(n))}function zn(n,e){if(n<=0)return 0;const t=n-e;return Fe(t/n*100)}const ft=a.object({id:a.string(),name:a.string()}),Fn=ft.omit({id:!0}),Le=a.object({type:a.literal("Supplier"),id:a.string(),name:a.string(),code:a.string()}),Ln=Le.omit({id:!0}),ht=a.object({type:a.literal("SupplierInvoice"),id:a.string(),supplier:Le,invoiceNumber:a.string(),date:a.number(),rows:a.array(a.object({id:a.string(),rowNumber:a.number(),sku:a.string(),itemName:a.string(),quantity:a.number(),purchasePrice:a.number(),lineDiscount:a.number(),profitPercentage:a.number(),price:a.number(),totalPurchasePrice:a.number(),vat:a.boolean(),originalProduct:a.object({purchasePrice:a.number(),price:a.number(),profitPercentage:a.number()}).optional()})),productsToUpdate:a.array(a.object({sku:a.string(),itemName:a.string(),oldPurchasePrice:a.number(),newPurchasePrice:a.number(),oldPrice:a.number(),newPrice:a.number(),oldProfitPercentage:a.number(),newProfitPercentage:a.number()})),total:a.number().optional(),totalBeforeVat:a.number().optional(),vat:a.number().optional()}),Un=ht.omit({id:!0}),qn=a.object({type:a.literal("ChatSession"),id:a.string(),storeId:a.string(),companyId:a.string(),tenantId:a.string(),userId:a.string().nullable(),userType:a.enum(["anonymous","client","admin","superAdmin"]),createdAt:a.number(),updatedAt:a.number(),messageCount:a.number(),status:a.enum(["active","archived"])}),Bn=a.discriminatedUnion("type",[a.object({type:a.literal("message"),id:a.string(),role:a.enum(["user","assistant","system"]),content:a.string(),timestamp:a.number()}),a.object({type:a.literal("function_call"),id:a.string(),name:a.string(),arguments:a.record(a.string(),a.any()),timestamp:a.number()}),a.object({type:a.literal("tool_result"),id:a.string(),name:a.string(),result:a.any(),timestamp:a.number()})]),pt=a.enum(["delivery_note","payment_received","credit_note","debit_note","order_created","order_cancelled","order_refunded"]),gt=a.enum(["check","bank_transfer","cash","credit_card","other"]),Wn=a.object({id:a.string(),type:pt,debt:a.number(),runningBalance:a.number(),orderId:a.string().nullable(),orderTotal:a.number().nullable(),deliveryNoteId:a.string().nullable(),deliveryNoteNumber:a.string().nullable(),billingAccountId:a.string().nullable(),billingAccountName:a.string().nullable(),billingAccountNumber:a.string().nullable(),paymentReference:a.string().nullable(),paymentDate:a.number().nullable(),paymentMethod:gt.nullable(),note:a.string().nullable(),createdAt:a.number(),createdBy:a.string()}),Qn=a.object({id:a.string(),organizationId:a.string(),organizationName:a.string(),companyId:a.string(),storeId:a.string(),totalDebits:a.number(),totalCredits:a.number(),balance:a.number(),currency:a.literal("ILS"),updatedAt:a.number()}),Ue={VAT:18};function Yn(n,e){var t,r;return((t=n.discount)==null?void 0:t.type)==="percent"?n.price*(n.discount.value??100)/100:((r=n.discount)==null?void 0:r.type)==="number"?n.discount.value??0:0}function Gn(n,e){var r,i;const t=e&&n.vat?n.price+n.price*Ue.VAT/100:n.price;if(((r=n.discount)==null?void 0:r.type)==="percent"){const s=t*n.discount.value/100;return n.price-s}return((i=n.discount)==null?void 0:i.type)==="number"?t-n.discount.value:t}function Xn({cart:n,discounts:e,deliveryPrice:t=0,freeDeliveryPrice:r=0,isVatIncludedInPrice:i=!1}){const s=n.map((o,l)=>({amount:o.amount,product:{...o.product},originalPrice:o.product.price,finalPrice:Gn(o.product,i),finalDiscount:Yn(o.product)})),c=s.reduce((o,l)=>{const{product:d,amount:h,finalPrice:x,finalDiscount:T}=l;let w=0;if(d.vat){let Be=0;if(i){const Kn=Number((x/(1+Ue.VAT/100)).toFixed(2)),er=x-Kn;w=Number(er.toFixed(2)),w=w*h,Be=Number(w.toFixed(2))}else w=x*Ue.VAT/100,w=w*h,Be=Number(w.toFixed(2));o.vat=Number((o.vat+Be).toFixed(2))}const be=Number(x.toFixed(2));return o.cost+=h*be,o.discount+=T&&h*T,o.finalCost+=h*be+(i?0:w),o.productsCost+=h*be+(i?0:w),o.cost=Number(o.cost.toFixed(2)),o.discount=Number(o.discount.toFixed(2)),o.finalCost=Number(o.finalCost.toFixed(2)),o.productsCost=Number(o.productsCost.toFixed(2)),o},{discount:0,cost:0,finalCost:0,vat:0,productsCost:0,deliveryPrice:t});return c.deliveryPrice&&c.productsCost>=r?c.deliveryPrice=0:c.finalCost+=c.deliveryPrice,{items:s,...c}}const Jn={firestore:{systemCollections:{stores:"STORES",companies:"COMPANIES"},storeCollections:{products:"products","favorite-products":"favorite-products",profiles:"profiles",cart:"cart",clients:"clients",orders:"orders",categories:"categories",payments:"payments",settings:"settings",discounts:"discounts",organizations:"organizations",organizationGroups:"organizationGroups",invoices:"invoices",suppliers:"suppliers",supplierInvoices:"supplierInvoices",chatSessions:"chatSessions",chatSessionMessages:"chatSessionMessages",contactSubmissions:"contactSubmissions",budgetAccounts:"budgetAccounts",budgetTransactions:"budgetTransactions"},getPath:({companyId:n,storeId:e,collectionName:t,id:r})=>`${n}/${e}/${t}${r?`/${r}`:""}`,getSubPath:({companyId:n,storeId:e,collectionName:t,subCollectionName:r,id:i,subId:s})=>`${n}/${e}/${t}/${i}/${r}${s?`/${s}`:""}`,getDocPath:n=>`{companyId}/{storeId}/${n}/{id}`,getSubDocPath:(n,e,t)=>`{companyId}/{storeId}/${n}/${e}/${t}/{id}`}},qe={round:(n,e=2)=>{const t=10**e;return Math.round((n+Number.EPSILON)*t)/t}},Hn={calcSalePriceFromMargin:(n,e)=>n<=0||e<=0||n>=100?e:qe.round(e/(1-n/100)),calcMarginFromSalePrice:(n,e)=>n<=0||e<=0?0:qe.round((n-e)/n*100)};p.AddressSchema=ye,p.BaseCategorySchema=Ee,p.BillingAccountSchema=Ve,p.BudgetAccountSchema=Qn,p.BudgetTransactionSchema=Wn,p.BudgetTransactionTypeSchema=pt,p.BundleDiscountStrategy=mt,p.CalculatedDataSchema=$e,p.CartItemProductSchema=Me,p.CartSchema=Cn,p.CategorySchema=Ae,p.ChatSessionMessageSchema=Bn,p.ChatSessionSchema=qn,p.CompanySchema=An,p.DeliveryNoteSchema=ot,p.DiscountConditionsSchema=dt,p.DiscountEngine=Mn,p.DiscountSchema=Rn,p.DiscountStrategyFactory=ze,p.DiscountVariantSchema=lt,p.EzDeliveryNoteSchema=st,p.FavoriteProductSchema=jn,p.FileSchema=Sn,p.FirebaseAPI=Jn,p.LocaleSchema=ee,p.LocaleValueSchema=Tn,p.NewOrganizationGroupSchema=Fn,p.NewOrganizationSchema=Dn,p.NewProductSchema=Nn,p.NewSupplierInvoiceSchema=Un,p.NewSupplierSchema=Ln,p.OrderSchema=Pn,p.OrganizationGroupSchema=ft,p.OrganizationSchema=ct,p.PaymentMethodSchema=gt,p.PaymentTypeSchema=_e,p.ProductSchema=Re,p.ProfileSchema=it,p.StoreSchema=En,p.SupplierInvoiceSchema=ht,p.SupplierSchema=Le,p.TFlattenCategorySchema=In,p.calculatePercentageDiscount=zn,p.clientTypesSchema=ut,p.ensureNonNegative=Vn,p.formatCurrency=Fe,p.formatCurrencyString=$n,p.getCartCost=Xn,p.isFile=wn,p.math=qe,p.notEmptyTextSchema=E,p.numericTextSchema=xn,p.storeCalculator=Hn,Object.defineProperty(p,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(p,_){typeof exports=="object"&&typeof module<"u"?_(exports):typeof define=="function"&&define.amd?define(["exports"],_):(p=typeof globalThis<"u"?globalThis:p||self,_(p.core={}))})(this,function(p){"use strict";var Kn=Object.defineProperty;var er=(p,_,z)=>_ in p?Kn(p,_,{enumerable:!0,configurable:!0,writable:!0,value:z}):p[_]=z;var _t=(p,_,z)=>er(p,typeof _!="symbol"?_+"":_,z);var _;(function(n){n.assertEqual=i=>i;function e(i){}n.assertIs=e;function t(i){throw new Error}n.assertNever=t,n.arrayToEnum=i=>{const s={};for(const c of i)s[c]=c;return s},n.getValidEnumValues=i=>{const s=n.objectKeys(i).filter(o=>typeof i[i[o]]!="number"),c={};for(const o of s)c[o]=i[o];return n.objectValues(c)},n.objectValues=i=>n.objectKeys(i).map(function(s){return i[s]}),n.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const s=[];for(const c in i)Object.prototype.hasOwnProperty.call(i,c)&&s.push(c);return s},n.find=(i,s)=>{for(const c of i)if(s(c))return c},n.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function r(i,s=" | "){return i.map(c=>typeof c=="string"?`'${c}'`:c).join(s)}n.joinValues=r,n.jsonStringifyReplacer=(i,s)=>typeof s=="bigint"?s.toString():s})(_||(_={}));var z;(function(n){n.mergeShapes=(e,t)=>({...e,...t})})(z||(z={}));const f=_.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),R=n=>{switch(typeof n){case"undefined":return f.undefined;case"string":return f.string;case"number":return isNaN(n)?f.nan:f.number;case"boolean":return f.boolean;case"function":return f.function;case"bigint":return f.bigint;case"symbol":return f.symbol;case"object":return Array.isArray(n)?f.array:n===null?f.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?f.promise:typeof Map<"u"&&n instanceof Map?f.map:typeof Set<"u"&&n instanceof Set?f.set:typeof Date<"u"&&n instanceof Date?f.date:f.object;default:return f.unknown}},u=_.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"]),bt=n=>JSON.stringify(n,null,2).replace(/"([^"]+)":/g,"$1:");class A extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};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(s){return s.message},r={_errors:[]},i=s=>{for(const c of s.issues)if(c.code==="invalid_union")c.unionErrors.map(i);else if(c.code==="invalid_return_type")i(c.returnTypeError);else if(c.code==="invalid_arguments")i(c.argumentsError);else if(c.path.length===0)r._errors.push(t(c));else{let o=r,l=0;for(;l<c.path.length;){const d=c.path[l];l===c.path.length-1?(o[d]=o[d]||{_errors:[]},o[d]._errors.push(t(c))):o[d]=o[d]||{_errors:[]},o=o[d],l++}}};return i(this),r}static assert(e){if(!(e instanceof A))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,_.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},r=[];for(const i of this.issues)i.path.length>0?(t[i.path[0]]=t[i.path[0]]||[],t[i.path[0]].push(e(i))):r.push(e(i));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}A.create=n=>new A(n);const Y=(n,e)=>{let t;switch(n.code){case u.invalid_type:n.received===f.undefined?t="Required":t=`Expected ${n.expected}, received ${n.received}`;break;case u.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(n.expected,_.jsonStringifyReplacer)}`;break;case u.unrecognized_keys:t=`Unrecognized key(s) in object: ${_.joinValues(n.keys,", ")}`;break;case u.invalid_union:t="Invalid input";break;case u.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${_.joinValues(n.options)}`;break;case u.invalid_enum_value:t=`Invalid enum value. Expected ${_.joinValues(n.options)}, received '${n.received}'`;break;case u.invalid_arguments:t="Invalid function arguments";break;case u.invalid_return_type:t="Invalid function return type";break;case u.invalid_date:t="Invalid date";break;case u.invalid_string:typeof n.validation=="object"?"includes"in n.validation?(t=`Invalid input: must include "${n.validation.includes}"`,typeof n.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${n.validation.position}`)):"startsWith"in n.validation?t=`Invalid input: must start with "${n.validation.startsWith}"`:"endsWith"in n.validation?t=`Invalid input: must end with "${n.validation.endsWith}"`:_.assertNever(n.validation):n.validation!=="regex"?t=`Invalid ${n.validation}`:t="Invalid";break;case u.too_small:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at least":"more than"} ${n.minimum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at least":"over"} ${n.minimum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(n.minimum))}`:t="Invalid input";break;case u.too_big:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at most":"less than"} ${n.maximum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at most":"under"} ${n.maximum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="bigint"?t=`BigInt must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly":n.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(n.maximum))}`:t="Invalid input";break;case u.custom:t="Invalid input";break;case u.invalid_intersection_types:t="Intersection results could not be merged";break;case u.not_multiple_of:t=`Number must be a multiple of ${n.multipleOf}`;break;case u.not_finite:t="Number must be finite";break;default:t=e.defaultError,_.assertNever(n)}return{message:t}};let Be=Y;function kt(n){Be=n}function ke(){return Be}const xe=n=>{const{data:e,path:t,errorMaps:r,issueData:i}=n,s=[...t,...i.path||[]],c={...i,path:s};if(i.message!==void 0)return{...i,path:s,message:i.message};let o="";const l=r.filter(d=>!!d).slice().reverse();for(const d of l)o=d(c,{data:e,defaultError:o}).message;return{...i,path:s,message:o}},xt=[];function m(n,e){const t=ke(),r=xe({issueData:e,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,t,t===Y?void 0:Y].filter(i=>!!i)});n.common.issues.push(r)}class I{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const r=[];for(const i of t){if(i.status==="aborted")return v;i.status==="dirty"&&e.dirty(),r.push(i.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){const r=[];for(const i of t){const s=await i.key,c=await i.value;r.push({key:s,value:c})}return I.mergeObjectSync(e,r)}static mergeObjectSync(e,t){const r={};for(const i of t){const{key:s,value:c}=i;if(s.status==="aborted"||c.status==="aborted")return v;s.status==="dirty"&&e.dirty(),c.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof c.value<"u"||i.alwaysSet)&&(r[s.value]=c.value)}return{status:e.value,value:r}}}const v=Object.freeze({status:"aborted"}),G=n=>({status:"dirty",value:n}),N=n=>({status:"valid",value:n}),Oe=n=>n.status==="aborted",Ze=n=>n.status==="dirty",q=n=>n.status==="valid",ee=n=>typeof Promise<"u"&&n instanceof Promise;function Se(n,e,t,r){if(typeof e=="function"?n!==e||!0:!e.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(n)}function We(n,e,t,r,i){if(typeof e=="function"?n!==e||!0:!e.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(n,t),t}typeof SuppressedError=="function"&&SuppressedError;var g;(function(n){n.errToObj=e=>typeof e=="string"?{message:e}:e||{},n.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(g||(g={}));var te,ne;class Z{constructor(e,t,r,i){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Qe=(n,e)=>{if(q(e))return{success:!0,data:e.value};if(!n.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 A(n.common.issues);return this._error=t,this._error}}};function b(n){if(!n)return{};const{errorMap:e,invalid_type_error:t,required_error:r,description:i}=n;if(e&&(t||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(c,o)=>{var l,d;const{message:h}=n;return c.code==="invalid_enum_value"?{message:h??o.defaultError}:typeof o.data>"u"?{message:(l=h??r)!==null&&l!==void 0?l:o.defaultError}:c.code!=="invalid_type"?{message:o.defaultError}:{message:(d=h??t)!==null&&d!==void 0?d:o.defaultError}},description:i}}class k{get description(){return this._def.description}_getType(e){return R(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:R(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new I,ctx:{common:e.parent.common,data:e.data,parsedType:R(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(ee(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 r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){var r;const i={common:{issues:[],async:(r=t==null?void 0:t.async)!==null&&r!==void 0?r:!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:R(e)},s=this._parseSync({data:e,path:i.path,parent:i});return Qe(i,s)}"~validate"(e){var t,r;const i={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:R(e)};if(!this["~standard"].async)try{const s=this._parseSync({data:e,path:[],parent:i});return q(s)?{value:s.value}:{issues:i.common.issues}}catch(s){!((r=(t=s==null?void 0:s.message)===null||t===void 0?void 0:t.toLowerCase())===null||r===void 0)&&r.includes("encountered")&&(this["~standard"].async=!0),i.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:i}).then(s=>q(s)?{value:s.value}:{issues:i.common.issues})}async parseAsync(e,t){const r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){const r={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:R(e)},i=this._parse({data:e,path:r.path,parent:r}),s=await(ee(i)?i:Promise.resolve(i));return Qe(r,s)}refine(e,t){const r=i=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(i):t;return this._refinement((i,s)=>{const c=e(i),o=()=>s.addIssue({code:u.custom,...r(i)});return typeof Promise<"u"&&c instanceof Promise?c.then(l=>l?!0:(o(),!1)):c?!0:(o(),!1)})}refinement(e,t){return this._refinement((r,i)=>e(r)?!0:(i.addIssue(typeof t=="function"?t(r,i):t),!1))}_refinement(e){return new O({schema:this,typeName:y.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 P.create(this,this._def)}nullable(){return U.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return j.create(this)}promise(){return K.create(this,this._def)}or(e){return se.create([this,e],this._def)}and(e){return oe.create(this,e,this._def)}transform(e){return new O({...b(this._def),schema:this,typeName:y.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new me({...b(this._def),innerType:this,defaultValue:t,typeName:y.ZodDefault})}brand(){return new Ee({typeName:y.ZodBranded,type:this,...b(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new fe({...b(this._def),innerType:this,catchValue:t,typeName:y.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return he.create(this,e)}readonly(){return pe.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const St=/^c[^\s-]{8,}$/i,wt=/^[0-9a-z]+$/,Tt=/^[0-9A-HJKMNP-TV-Z]{26}$/i,It=/^[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,Nt=/^[a-z0-9_-]{21}$/i,At=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Ct=/^[-+]?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)?)??$/,jt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Ot="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let De;const Zt=/^(?:(?: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])$/,Dt=/^(?:(?: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])$/,Pt=/^(([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]))$/,Et=/^(([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])$/,Rt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,$t=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Ye="((\\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])))",Mt=new RegExp(`^${Ye}$`);function Ge(n){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return n.precision?e=`${e}\\.\\d{${n.precision}}`:n.precision==null&&(e=`${e}(\\.\\d+)?`),e}function zt(n){return new RegExp(`^${Ge(n)}$`)}function Xe(n){let e=`${Ye}T${Ge(n)}`;const t=[];return t.push(n.local?"Z?":"Z"),n.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Vt(n,e){return!!((e==="v4"||!e)&&Zt.test(n)||(e==="v6"||!e)&&Pt.test(n))}function Ft(n,e){if(!At.test(n))return!1;try{const[t]=n.split("."),r=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),i=JSON.parse(atob(r));return!(typeof i!="object"||i===null||!i.typ||!i.alg||e&&i.alg!==e)}catch{return!1}}function Lt(n,e){return!!((e==="v4"||!e)&&Dt.test(n)||(e==="v6"||!e)&&Et.test(n))}class C extends k{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==f.string){const s=this._getOrReturnCtx(e);return m(s,{code:u.invalid_type,expected:f.string,received:s.parsedType}),v}const r=new I;let i;for(const s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(i=this._getOrReturnCtx(e,i),m(i,{code:u.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="max")e.data.length>s.value&&(i=this._getOrReturnCtx(e,i),m(i,{code:u.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){const c=e.data.length>s.value,o=e.data.length<s.value;(c||o)&&(i=this._getOrReturnCtx(e,i),c?m(i,{code:u.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):o&&m(i,{code:u.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")jt.test(e.data)||(i=this._getOrReturnCtx(e,i),m(i,{validation:"email",code:u.invalid_string,message:s.message}),r.dirty());else if(s.kind==="emoji")De||(De=new RegExp(Ot,"u")),De.test(e.data)||(i=this._getOrReturnCtx(e,i),m(i,{validation:"emoji",code:u.invalid_string,message:s.message}),r.dirty());else if(s.kind==="uuid")It.test(e.data)||(i=this._getOrReturnCtx(e,i),m(i,{validation:"uuid",code:u.invalid_string,message:s.message}),r.dirty());else if(s.kind==="nanoid")Nt.test(e.data)||(i=this._getOrReturnCtx(e,i),m(i,{validation:"nanoid",code:u.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")St.test(e.data)||(i=this._getOrReturnCtx(e,i),m(i,{validation:"cuid",code:u.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")wt.test(e.data)||(i=this._getOrReturnCtx(e,i),m(i,{validation:"cuid2",code:u.invalid_string,message:s.message}),r.dirty());else if(s.kind==="ulid")Tt.test(e.data)||(i=this._getOrReturnCtx(e,i),m(i,{validation:"ulid",code:u.invalid_string,message:s.message}),r.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),m(i,{validation:"url",code:u.invalid_string,message:s.message}),r.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),m(i,{validation:"regex",code:u.invalid_string,message:s.message}),r.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(i=this._getOrReturnCtx(e,i),m(i,{code:u.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),r.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(i=this._getOrReturnCtx(e,i),m(i,{code:u.invalid_string,validation:{startsWith:s.value},message:s.message}),r.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(i=this._getOrReturnCtx(e,i),m(i,{code:u.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?Xe(s).test(e.data)||(i=this._getOrReturnCtx(e,i),m(i,{code:u.invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="date"?Mt.test(e.data)||(i=this._getOrReturnCtx(e,i),m(i,{code:u.invalid_string,validation:"date",message:s.message}),r.dirty()):s.kind==="time"?zt(s).test(e.data)||(i=this._getOrReturnCtx(e,i),m(i,{code:u.invalid_string,validation:"time",message:s.message}),r.dirty()):s.kind==="duration"?Ct.test(e.data)||(i=this._getOrReturnCtx(e,i),m(i,{validation:"duration",code:u.invalid_string,message:s.message}),r.dirty()):s.kind==="ip"?Vt(e.data,s.version)||(i=this._getOrReturnCtx(e,i),m(i,{validation:"ip",code:u.invalid_string,message:s.message}),r.dirty()):s.kind==="jwt"?Ft(e.data,s.alg)||(i=this._getOrReturnCtx(e,i),m(i,{validation:"jwt",code:u.invalid_string,message:s.message}),r.dirty()):s.kind==="cidr"?Lt(e.data,s.version)||(i=this._getOrReturnCtx(e,i),m(i,{validation:"cidr",code:u.invalid_string,message:s.message}),r.dirty()):s.kind==="base64"?Rt.test(e.data)||(i=this._getOrReturnCtx(e,i),m(i,{validation:"base64",code:u.invalid_string,message:s.message}),r.dirty()):s.kind==="base64url"?$t.test(e.data)||(i=this._getOrReturnCtx(e,i),m(i,{validation:"base64url",code:u.invalid_string,message:s.message}),r.dirty()):_.assertNever(s);return{status:r.value,value:e.data}}_regex(e,t,r){return this.refinement(i=>e.test(i),{validation:t,code:u.invalid_string,...g.errToObj(r)})}_addCheck(e){return new C({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...g.errToObj(e)})}url(e){return this._addCheck({kind:"url",...g.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...g.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...g.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...g.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...g.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...g.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...g.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...g.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...g.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...g.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...g.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...g.errToObj(e)})}datetime(e){var t,r;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:(t=e==null?void 0:e.offset)!==null&&t!==void 0?t:!1,local:(r=e==null?void 0:e.local)!==null&&r!==void 0?r:!1,...g.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,...g.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...g.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...g.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...g.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...g.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...g.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...g.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...g.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...g.errToObj(t)})}nonempty(e){return this.min(1,g.errToObj(e))}trim(){return new C({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new C({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new C({...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}}C.create=n=>{var e;return new C({checks:[],typeName:y.ZodString,coerce:(e=n==null?void 0:n.coerce)!==null&&e!==void 0?e:!1,...b(n)})};function Ut(n,e){const t=(n.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,i=t>r?t:r,s=parseInt(n.toFixed(i).replace(".","")),c=parseInt(e.toFixed(i).replace(".",""));return s%c/Math.pow(10,i)}class V extends k{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)!==f.number){const s=this._getOrReturnCtx(e);return m(s,{code:u.invalid_type,expected:f.number,received:s.parsedType}),v}let r;const i=new I;for(const s of this._def.checks)s.kind==="int"?_.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),m(r,{code:u.invalid_type,expected:"integer",received:"float",message:s.message}),i.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),m(r,{code:u.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),m(r,{code:u.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?Ut(e.data,s.value)!==0&&(r=this._getOrReturnCtx(e,r),m(r,{code:u.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),m(r,{code:u.not_finite,message:s.message}),i.dirty()):_.assertNever(s);return{status:i.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,g.toString(t))}gt(e,t){return this.setLimit("min",e,!1,g.toString(t))}lte(e,t){return this.setLimit("max",e,!0,g.toString(t))}lt(e,t){return this.setLimit("max",e,!1,g.toString(t))}setLimit(e,t,r,i){return new V({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:g.toString(i)}]})}_addCheck(e){return new V({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:g.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:g.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:g.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:g.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:g.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:g.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:g.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:g.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:g.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"&&_.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(t===null||r.value>t)&&(t=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}}V.create=n=>new V({checks:[],typeName:y.ZodNumber,coerce:(n==null?void 0:n.coerce)||!1,...b(n)});class F extends k{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)!==f.bigint)return this._getInvalidInput(e);let r;const i=new I;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),m(r,{code:u.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),m(r,{code:u.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),m(r,{code:u.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):_.assertNever(s);return{status:i.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return m(t,{code:u.invalid_type,expected:f.bigint,received:t.parsedType}),v}gte(e,t){return this.setLimit("min",e,!0,g.toString(t))}gt(e,t){return this.setLimit("min",e,!1,g.toString(t))}lte(e,t){return this.setLimit("max",e,!0,g.toString(t))}lt(e,t){return this.setLimit("max",e,!1,g.toString(t))}setLimit(e,t,r,i){return new F({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:g.toString(i)}]})}_addCheck(e){return new F({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:g.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:g.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:g.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:g.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:g.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}}F.create=n=>{var e;return new F({checks:[],typeName:y.ZodBigInt,coerce:(e=n==null?void 0:n.coerce)!==null&&e!==void 0?e:!1,...b(n)})};class re extends k{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==f.boolean){const r=this._getOrReturnCtx(e);return m(r,{code:u.invalid_type,expected:f.boolean,received:r.parsedType}),v}return N(e.data)}}re.create=n=>new re({typeName:y.ZodBoolean,coerce:(n==null?void 0:n.coerce)||!1,...b(n)});class B extends k{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==f.date){const s=this._getOrReturnCtx(e);return m(s,{code:u.invalid_type,expected:f.date,received:s.parsedType}),v}if(isNaN(e.data.getTime())){const s=this._getOrReturnCtx(e);return m(s,{code:u.invalid_date}),v}const r=new I;let i;for(const s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(i=this._getOrReturnCtx(e,i),m(i,{code:u.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(i=this._getOrReturnCtx(e,i),m(i,{code:u.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):_.assertNever(s);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new B({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:g.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:g.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}}B.create=n=>new B({checks:[],coerce:(n==null?void 0:n.coerce)||!1,typeName:y.ZodDate,...b(n)});class we extends k{_parse(e){if(this._getType(e)!==f.symbol){const r=this._getOrReturnCtx(e);return m(r,{code:u.invalid_type,expected:f.symbol,received:r.parsedType}),v}return N(e.data)}}we.create=n=>new we({typeName:y.ZodSymbol,...b(n)});class ae extends k{_parse(e){if(this._getType(e)!==f.undefined){const r=this._getOrReturnCtx(e);return m(r,{code:u.invalid_type,expected:f.undefined,received:r.parsedType}),v}return N(e.data)}}ae.create=n=>new ae({typeName:y.ZodUndefined,...b(n)});class ie extends k{_parse(e){if(this._getType(e)!==f.null){const r=this._getOrReturnCtx(e);return m(r,{code:u.invalid_type,expected:f.null,received:r.parsedType}),v}return N(e.data)}}ie.create=n=>new ie({typeName:y.ZodNull,...b(n)});class X extends k{constructor(){super(...arguments),this._any=!0}_parse(e){return N(e.data)}}X.create=n=>new X({typeName:y.ZodAny,...b(n)});class W extends k{constructor(){super(...arguments),this._unknown=!0}_parse(e){return N(e.data)}}W.create=n=>new W({typeName:y.ZodUnknown,...b(n)});class $ extends k{_parse(e){const t=this._getOrReturnCtx(e);return m(t,{code:u.invalid_type,expected:f.never,received:t.parsedType}),v}}$.create=n=>new $({typeName:y.ZodNever,...b(n)});class Te extends k{_parse(e){if(this._getType(e)!==f.undefined){const r=this._getOrReturnCtx(e);return m(r,{code:u.invalid_type,expected:f.void,received:r.parsedType}),v}return N(e.data)}}Te.create=n=>new Te({typeName:y.ZodVoid,...b(n)});class j extends k{_parse(e){const{ctx:t,status:r}=this._processInputParams(e),i=this._def;if(t.parsedType!==f.array)return m(t,{code:u.invalid_type,expected:f.array,received:t.parsedType}),v;if(i.exactLength!==null){const c=t.data.length>i.exactLength.value,o=t.data.length<i.exactLength.value;(c||o)&&(m(t,{code:c?u.too_big:u.too_small,minimum:o?i.exactLength.value:void 0,maximum:c?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),r.dirty())}if(i.minLength!==null&&t.data.length<i.minLength.value&&(m(t,{code:u.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),r.dirty()),i.maxLength!==null&&t.data.length>i.maxLength.value&&(m(t,{code:u.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((c,o)=>i.type._parseAsync(new Z(t,c,t.path,o)))).then(c=>I.mergeArray(r,c));const s=[...t.data].map((c,o)=>i.type._parseSync(new Z(t,c,t.path,o)));return I.mergeArray(r,s)}get element(){return this._def.type}min(e,t){return new j({...this._def,minLength:{value:e,message:g.toString(t)}})}max(e,t){return new j({...this._def,maxLength:{value:e,message:g.toString(t)}})}length(e,t){return new j({...this._def,exactLength:{value:e,message:g.toString(t)}})}nonempty(e){return this.min(1,e)}}j.create=(n,e)=>new j({type:n,minLength:null,maxLength:null,exactLength:null,typeName:y.ZodArray,...b(e)});function J(n){if(n instanceof S){const e={};for(const t in n.shape){const r=n.shape[t];e[t]=P.create(J(r))}return new S({...n._def,shape:()=>e})}else return n instanceof j?new j({...n._def,type:J(n.element)}):n instanceof P?P.create(J(n.unwrap())):n instanceof U?U.create(J(n.unwrap())):n instanceof D?D.create(n.items.map(e=>J(e))):n}class S extends k{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=_.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==f.object){const d=this._getOrReturnCtx(e);return m(d,{code:u.invalid_type,expected:f.object,received:d.parsedType}),v}const{status:r,ctx:i}=this._processInputParams(e),{shape:s,keys:c}=this._getCached(),o=[];if(!(this._def.catchall instanceof $&&this._def.unknownKeys==="strip"))for(const d in i.data)c.includes(d)||o.push(d);const l=[];for(const d of c){const h=s[d],x=i.data[d];l.push({key:{status:"valid",value:d},value:h._parse(new Z(i,x,i.path,d)),alwaysSet:d in i.data})}if(this._def.catchall instanceof $){const d=this._def.unknownKeys;if(d==="passthrough")for(const h of o)l.push({key:{status:"valid",value:h},value:{status:"valid",value:i.data[h]}});else if(d==="strict")o.length>0&&(m(i,{code:u.unrecognized_keys,keys:o}),r.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const d=this._def.catchall;for(const h of o){const x=i.data[h];l.push({key:{status:"valid",value:h},value:d._parse(new Z(i,x,i.path,h)),alwaysSet:h in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const d=[];for(const h of l){const x=await h.key,T=await h.value;d.push({key:x,value:T,alwaysSet:h.alwaysSet})}return d}).then(d=>I.mergeObjectSync(r,d)):I.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return g.errToObj,new S({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{var i,s,c,o;const l=(c=(s=(i=this._def).errorMap)===null||s===void 0?void 0:s.call(i,t,r).message)!==null&&c!==void 0?c:r.defaultError;return t.code==="unrecognized_keys"?{message:(o=g.errToObj(e).message)!==null&&o!==void 0?o:l}:{message:l}}}:{}})}strip(){return new S({...this._def,unknownKeys:"strip"})}passthrough(){return new S({...this._def,unknownKeys:"passthrough"})}extend(e){return new S({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new S({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:y.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new S({...this._def,catchall:e})}pick(e){const t={};return _.objectKeys(e).forEach(r=>{e[r]&&this.shape[r]&&(t[r]=this.shape[r])}),new S({...this._def,shape:()=>t})}omit(e){const t={};return _.objectKeys(this.shape).forEach(r=>{e[r]||(t[r]=this.shape[r])}),new S({...this._def,shape:()=>t})}deepPartial(){return J(this)}partial(e){const t={};return _.objectKeys(this.shape).forEach(r=>{const i=this.shape[r];e&&!e[r]?t[r]=i:t[r]=i.optional()}),new S({...this._def,shape:()=>t})}required(e){const t={};return _.objectKeys(this.shape).forEach(r=>{if(e&&!e[r])t[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof P;)s=s._def.innerType;t[r]=s}}),new S({...this._def,shape:()=>t})}keyof(){return Je(_.objectKeys(this.shape))}}S.create=(n,e)=>new S({shape:()=>n,unknownKeys:"strip",catchall:$.create(),typeName:y.ZodObject,...b(e)}),S.strictCreate=(n,e)=>new S({shape:()=>n,unknownKeys:"strict",catchall:$.create(),typeName:y.ZodObject,...b(e)}),S.lazycreate=(n,e)=>new S({shape:n,unknownKeys:"strip",catchall:$.create(),typeName:y.ZodObject,...b(e)});class se extends k{_parse(e){const{ctx:t}=this._processInputParams(e),r=this._def.options;function i(s){for(const o of s)if(o.result.status==="valid")return o.result;for(const o of s)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const c=s.map(o=>new A(o.ctx.common.issues));return m(t,{code:u.invalid_union,unionErrors:c}),v}if(t.common.async)return Promise.all(r.map(async s=>{const c={...t,common:{...t.common,issues:[]},parent:null};return{result:await s._parseAsync({data:t.data,path:t.path,parent:c}),ctx:c}})).then(i);{let s;const c=[];for(const l of r){const d={...t,common:{...t.common,issues:[]},parent:null},h=l._parseSync({data:t.data,path:t.path,parent:d});if(h.status==="valid")return h;h.status==="dirty"&&!s&&(s={result:h,ctx:d}),d.common.issues.length&&c.push(d.common.issues)}if(s)return t.common.issues.push(...s.ctx.common.issues),s.result;const o=c.map(l=>new A(l));return m(t,{code:u.invalid_union,unionErrors:o}),v}}get options(){return this._def.options}}se.create=(n,e)=>new se({options:n,typeName:y.ZodUnion,...b(e)});const M=n=>n instanceof ue?M(n.schema):n instanceof O?M(n.innerType()):n instanceof de?[n.value]:n instanceof L?n.options:n instanceof le?_.objectValues(n.enum):n instanceof me?M(n._def.innerType):n instanceof ae?[void 0]:n instanceof ie?[null]:n instanceof P?[void 0,...M(n.unwrap())]:n instanceof U?[null,...M(n.unwrap())]:n instanceof Ee||n instanceof pe?M(n.unwrap()):n instanceof fe?M(n._def.innerType):[];class Ie extends k{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.object)return m(t,{code:u.invalid_type,expected:f.object,received:t.parsedType}),v;const r=this.discriminator,i=t.data[r],s=this.optionsMap.get(i);return s?t.common.async?s._parseAsync({data:t.data,path:t.path,parent:t}):s._parseSync({data:t.data,path:t.path,parent:t}):(m(t,{code:u.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),v)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){const i=new Map;for(const s of t){const c=M(s.shape[e]);if(!c.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of c){if(i.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);i.set(o,s)}}return new Ie({typeName:y.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:i,...b(r)})}}function Pe(n,e){const t=R(n),r=R(e);if(n===e)return{valid:!0,data:n};if(t===f.object&&r===f.object){const i=_.objectKeys(e),s=_.objectKeys(n).filter(o=>i.indexOf(o)!==-1),c={...n,...e};for(const o of s){const l=Pe(n[o],e[o]);if(!l.valid)return{valid:!1};c[o]=l.data}return{valid:!0,data:c}}else if(t===f.array&&r===f.array){if(n.length!==e.length)return{valid:!1};const i=[];for(let s=0;s<n.length;s++){const c=n[s],o=e[s],l=Pe(c,o);if(!l.valid)return{valid:!1};i.push(l.data)}return{valid:!0,data:i}}else return t===f.date&&r===f.date&&+n==+e?{valid:!0,data:n}:{valid:!1}}class oe extends k{_parse(e){const{status:t,ctx:r}=this._processInputParams(e),i=(s,c)=>{if(Oe(s)||Oe(c))return v;const o=Pe(s.value,c.value);return o.valid?((Ze(s)||Ze(c))&&t.dirty(),{status:t.value,value:o.data}):(m(r,{code:u.invalid_intersection_types}),v)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([s,c])=>i(s,c)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}oe.create=(n,e,t)=>new oe({left:n,right:e,typeName:y.ZodIntersection,...b(t)});class D extends k{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==f.array)return m(r,{code:u.invalid_type,expected:f.array,received:r.parsedType}),v;if(r.data.length<this._def.items.length)return m(r,{code:u.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),v;!this._def.rest&&r.data.length>this._def.items.length&&(m(r,{code:u.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const s=[...r.data].map((c,o)=>{const l=this._def.items[o]||this._def.rest;return l?l._parse(new Z(r,c,r.path,o)):null}).filter(c=>!!c);return r.common.async?Promise.all(s).then(c=>I.mergeArray(t,c)):I.mergeArray(t,s)}get items(){return this._def.items}rest(e){return new D({...this._def,rest:e})}}D.create=(n,e)=>{if(!Array.isArray(n))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new D({items:n,typeName:y.ZodTuple,rest:null,...b(e)})};class ce extends k{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==f.object)return m(r,{code:u.invalid_type,expected:f.object,received:r.parsedType}),v;const i=[],s=this._def.keyType,c=this._def.valueType;for(const o in r.data)i.push({key:s._parse(new Z(r,o,r.path,o)),value:c._parse(new Z(r,r.data[o],r.path,o)),alwaysSet:o in r.data});return r.common.async?I.mergeObjectAsync(t,i):I.mergeObjectSync(t,i)}get element(){return this._def.valueType}static create(e,t,r){return t instanceof k?new ce({keyType:e,valueType:t,typeName:y.ZodRecord,...b(r)}):new ce({keyType:C.create(),valueType:e,typeName:y.ZodRecord,...b(t)})}}class Ne extends k{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==f.map)return m(r,{code:u.invalid_type,expected:f.map,received:r.parsedType}),v;const i=this._def.keyType,s=this._def.valueType,c=[...r.data.entries()].map(([o,l],d)=>({key:i._parse(new Z(r,o,r.path,[d,"key"])),value:s._parse(new Z(r,l,r.path,[d,"value"]))}));if(r.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const l of c){const d=await l.key,h=await l.value;if(d.status==="aborted"||h.status==="aborted")return v;(d.status==="dirty"||h.status==="dirty")&&t.dirty(),o.set(d.value,h.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const l of c){const d=l.key,h=l.value;if(d.status==="aborted"||h.status==="aborted")return v;(d.status==="dirty"||h.status==="dirty")&&t.dirty(),o.set(d.value,h.value)}return{status:t.value,value:o}}}}Ne.create=(n,e,t)=>new Ne({valueType:e,keyType:n,typeName:y.ZodMap,...b(t)});class Q extends k{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==f.set)return m(r,{code:u.invalid_type,expected:f.set,received:r.parsedType}),v;const i=this._def;i.minSize!==null&&r.data.size<i.minSize.value&&(m(r,{code:u.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),t.dirty()),i.maxSize!==null&&r.data.size>i.maxSize.value&&(m(r,{code:u.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),t.dirty());const s=this._def.valueType;function c(l){const d=new Set;for(const h of l){if(h.status==="aborted")return v;h.status==="dirty"&&t.dirty(),d.add(h.value)}return{status:t.value,value:d}}const o=[...r.data.values()].map((l,d)=>s._parse(new Z(r,l,r.path,d)));return r.common.async?Promise.all(o).then(l=>c(l)):c(o)}min(e,t){return new Q({...this._def,minSize:{value:e,message:g.toString(t)}})}max(e,t){return new Q({...this._def,maxSize:{value:e,message:g.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Q.create=(n,e)=>new Q({valueType:n,minSize:null,maxSize:null,typeName:y.ZodSet,...b(e)});class H extends k{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.function)return m(t,{code:u.invalid_type,expected:f.function,received:t.parsedType}),v;function r(o,l){return xe({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ke(),Y].filter(d=>!!d),issueData:{code:u.invalid_arguments,argumentsError:l}})}function i(o,l){return xe({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ke(),Y].filter(d=>!!d),issueData:{code:u.invalid_return_type,returnTypeError:l}})}const s={errorMap:t.common.contextualErrorMap},c=t.data;if(this._def.returns instanceof K){const o=this;return N(async function(...l){const d=new A([]),h=await o._def.args.parseAsync(l,s).catch(w=>{throw d.addIssue(r(l,w)),d}),x=await Reflect.apply(c,this,h);return await o._def.returns._def.type.parseAsync(x,s).catch(w=>{throw d.addIssue(i(x,w)),d})})}else{const o=this;return N(function(...l){const d=o._def.args.safeParse(l,s);if(!d.success)throw new A([r(l,d.error)]);const h=Reflect.apply(c,this,d.data),x=o._def.returns.safeParse(h,s);if(!x.success)throw new A([i(h,x.error)]);return x.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new H({...this._def,args:D.create(e).rest(W.create())})}returns(e){return new H({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new H({args:e||D.create([]).rest(W.create()),returns:t||W.create(),typeName:y.ZodFunction,...b(r)})}}class ue extends k{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})}}ue.create=(n,e)=>new ue({getter:n,typeName:y.ZodLazy,...b(e)});class de extends k{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return m(t,{received:t.data,code:u.invalid_literal,expected:this._def.value}),v}return{status:"valid",value:e.data}}get value(){return this._def.value}}de.create=(n,e)=>new de({value:n,typeName:y.ZodLiteral,...b(e)});function Je(n,e){return new L({values:n,typeName:y.ZodEnum,...b(e)})}class L extends k{constructor(){super(...arguments),te.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),r=this._def.values;return m(t,{expected:_.joinValues(r),received:t.parsedType,code:u.invalid_type}),v}if(Se(this,te)||We(this,te,new Set(this._def.values)),!Se(this,te).has(e.data)){const t=this._getOrReturnCtx(e),r=this._def.values;return m(t,{received:t.data,code:u.invalid_enum_value,options:r}),v}return N(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 L.create(e,{...this._def,...t})}exclude(e,t=this._def){return L.create(this.options.filter(r=>!e.includes(r)),{...this._def,...t})}}te=new WeakMap,L.create=Je;class le extends k{constructor(){super(...arguments),ne.set(this,void 0)}_parse(e){const t=_.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==f.string&&r.parsedType!==f.number){const i=_.objectValues(t);return m(r,{expected:_.joinValues(i),received:r.parsedType,code:u.invalid_type}),v}if(Se(this,ne)||We(this,ne,new Set(_.getValidEnumValues(this._def.values))),!Se(this,ne).has(e.data)){const i=_.objectValues(t);return m(r,{received:r.data,code:u.invalid_enum_value,options:i}),v}return N(e.data)}get enum(){return this._def.values}}ne=new WeakMap,le.create=(n,e)=>new le({values:n,typeName:y.ZodNativeEnum,...b(e)});class K extends k{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.promise&&t.common.async===!1)return m(t,{code:u.invalid_type,expected:f.promise,received:t.parsedType}),v;const r=t.parsedType===f.promise?t.data:Promise.resolve(t.data);return N(r.then(i=>this._def.type.parseAsync(i,{path:t.path,errorMap:t.common.contextualErrorMap})))}}K.create=(n,e)=>new K({type:n,typeName:y.ZodPromise,...b(e)});class O extends k{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===y.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:r}=this._processInputParams(e),i=this._def.effect||null,s={addIssue:c=>{m(r,c),c.fatal?t.abort():t.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),i.type==="preprocess"){const c=i.transform(r.data,s);if(r.common.async)return Promise.resolve(c).then(async o=>{if(t.value==="aborted")return v;const l=await this._def.schema._parseAsync({data:o,path:r.path,parent:r});return l.status==="aborted"?v:l.status==="dirty"||t.value==="dirty"?G(l.value):l});{if(t.value==="aborted")return v;const o=this._def.schema._parseSync({data:c,path:r.path,parent:r});return o.status==="aborted"?v:o.status==="dirty"||t.value==="dirty"?G(o.value):o}}if(i.type==="refinement"){const c=o=>{const l=i.refinement(o,s);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?v:(o.status==="dirty"&&t.dirty(),c(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>o.status==="aborted"?v:(o.status==="dirty"&&t.dirty(),c(o.value).then(()=>({status:t.value,value:o.value}))))}if(i.type==="transform")if(r.common.async===!1){const c=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!q(c))return c;const o=i.transform(c.value,s);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:r.data,path:r.path,parent:r}).then(c=>q(c)?Promise.resolve(i.transform(c.value,s)).then(o=>({status:t.value,value:o})):c);_.assertNever(i)}}O.create=(n,e,t)=>new O({schema:n,typeName:y.ZodEffects,effect:e,...b(t)}),O.createWithPreprocess=(n,e,t)=>new O({schema:e,effect:{type:"preprocess",transform:n},typeName:y.ZodEffects,...b(t)});class P extends k{_parse(e){return this._getType(e)===f.undefined?N(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}P.create=(n,e)=>new P({innerType:n,typeName:y.ZodOptional,...b(e)});class U extends k{_parse(e){return this._getType(e)===f.null?N(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}U.create=(n,e)=>new U({innerType:n,typeName:y.ZodNullable,...b(e)});class me extends k{_parse(e){const{ctx:t}=this._processInputParams(e);let r=t.data;return t.parsedType===f.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}me.create=(n,e)=>new me({innerType:n,typeName:y.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...b(e)});class fe extends k{_parse(e){const{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return ee(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new A(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new A(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}fe.create=(n,e)=>new fe({innerType:n,typeName:y.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...b(e)});class Ae extends k{_parse(e){if(this._getType(e)!==f.nan){const r=this._getOrReturnCtx(e);return m(r,{code:u.invalid_type,expected:f.nan,received:r.parsedType}),v}return{status:"valid",value:e.data}}}Ae.create=n=>new Ae({typeName:y.ZodNaN,...b(n)});const qt=Symbol("zod_brand");class Ee extends k{_parse(e){const{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class he extends k{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?v:s.status==="dirty"?(t.dirty(),G(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})})();{const i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?v:i.status==="dirty"?(t.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(e,t){return new he({in:e,out:t,typeName:y.ZodPipeline})}}class pe extends k{_parse(e){const t=this._def.innerType._parse(e),r=i=>(q(i)&&(i.value=Object.freeze(i.value)),i);return ee(t)?t.then(i=>r(i)):r(t)}unwrap(){return this._def.innerType}}pe.create=(n,e)=>new pe({innerType:n,typeName:y.ZodReadonly,...b(e)});function He(n,e){const t=typeof n=="function"?n(e):typeof n=="string"?{message:n}:n;return typeof t=="string"?{message:t}:t}function Ke(n,e={},t){return n?X.create().superRefine((r,i)=>{var s,c;const o=n(r);if(o instanceof Promise)return o.then(l=>{var d,h;if(!l){const x=He(e,r),T=(h=(d=x.fatal)!==null&&d!==void 0?d:t)!==null&&h!==void 0?h:!0;i.addIssue({code:"custom",...x,fatal:T})}});if(!o){const l=He(e,r),d=(c=(s=l.fatal)!==null&&s!==void 0?s:t)!==null&&c!==void 0?c:!0;i.addIssue({code:"custom",...l,fatal:d})}}):X.create()}const Bt={object:S.lazycreate};var y;(function(n){n.ZodString="ZodString",n.ZodNumber="ZodNumber",n.ZodNaN="ZodNaN",n.ZodBigInt="ZodBigInt",n.ZodBoolean="ZodBoolean",n.ZodDate="ZodDate",n.ZodSymbol="ZodSymbol",n.ZodUndefined="ZodUndefined",n.ZodNull="ZodNull",n.ZodAny="ZodAny",n.ZodUnknown="ZodUnknown",n.ZodNever="ZodNever",n.ZodVoid="ZodVoid",n.ZodArray="ZodArray",n.ZodObject="ZodObject",n.ZodUnion="ZodUnion",n.ZodDiscriminatedUnion="ZodDiscriminatedUnion",n.ZodIntersection="ZodIntersection",n.ZodTuple="ZodTuple",n.ZodRecord="ZodRecord",n.ZodMap="ZodMap",n.ZodSet="ZodSet",n.ZodFunction="ZodFunction",n.ZodLazy="ZodLazy",n.ZodLiteral="ZodLiteral",n.ZodEnum="ZodEnum",n.ZodEffects="ZodEffects",n.ZodNativeEnum="ZodNativeEnum",n.ZodOptional="ZodOptional",n.ZodNullable="ZodNullable",n.ZodDefault="ZodDefault",n.ZodCatch="ZodCatch",n.ZodPromise="ZodPromise",n.ZodBranded="ZodBranded",n.ZodPipeline="ZodPipeline",n.ZodReadonly="ZodReadonly"})(y||(y={}));const Wt=(n,e={message:`Input not instance of ${n.name}`})=>Ke(t=>t instanceof n,e),et=C.create,tt=V.create,Qt=Ae.create,Yt=F.create,nt=re.create,Gt=B.create,Xt=we.create,Jt=ae.create,Ht=ie.create,Kt=X.create,en=W.create,tn=$.create,nn=Te.create,rn=j.create,an=S.create,sn=S.strictCreate,on=se.create,cn=Ie.create,un=oe.create,dn=D.create,ln=ce.create,mn=Ne.create,fn=Q.create,hn=H.create,pn=ue.create,gn=de.create,yn=L.create,vn=le.create,_n=K.create,rt=O.create,bn=P.create,kn=U.create,xn=O.createWithPreprocess,Sn=he.create;var a=Object.freeze({__proto__:null,defaultErrorMap:Y,setErrorMap:kt,getErrorMap:ke,makeIssue:xe,EMPTY_PATH:xt,addIssueToContext:m,ParseStatus:I,INVALID:v,DIRTY:G,OK:N,isAborted:Oe,isDirty:Ze,isValid:q,isAsync:ee,get util(){return _},get objectUtil(){return z},ZodParsedType:f,getParsedType:R,ZodType:k,datetimeRegex:Xe,ZodString:C,ZodNumber:V,ZodBigInt:F,ZodBoolean:re,ZodDate:B,ZodSymbol:we,ZodUndefined:ae,ZodNull:ie,ZodAny:X,ZodUnknown:W,ZodNever:$,ZodVoid:Te,ZodArray:j,ZodObject:S,ZodUnion:se,ZodDiscriminatedUnion:Ie,ZodIntersection:oe,ZodTuple:D,ZodRecord:ce,ZodMap:Ne,ZodSet:Q,ZodFunction:H,ZodLazy:ue,ZodLiteral:de,ZodEnum:L,ZodNativeEnum:le,ZodPromise:K,ZodEffects:O,ZodTransformer:O,ZodOptional:P,ZodNullable:U,ZodDefault:me,ZodCatch:fe,ZodNaN:Ae,BRAND:qt,ZodBranded:Ee,ZodPipeline:he,ZodReadonly:pe,custom:Ke,Schema:k,ZodSchema:k,late:Bt,get ZodFirstPartyTypeKind(){return y},coerce:{string:n=>C.create({...n,coerce:!0}),number:n=>V.create({...n,coerce:!0}),boolean:n=>re.create({...n,coerce:!0}),bigint:n=>F.create({...n,coerce:!0}),date:n=>B.create({...n,coerce:!0})},any:Kt,array:rn,bigint:Yt,boolean:nt,date:Gt,discriminatedUnion:cn,effect:rt,enum:yn,function:hn,instanceof:Wt,intersection:un,lazy:pn,literal:gn,map:mn,nan:Qt,nativeEnum:vn,never:tn,null:Ht,nullable:kn,number:tt,object:an,oboolean:()=>nt().optional(),onumber:()=>tt().optional(),optional:bn,ostring:()=>et().optional(),pipeline:Sn,preprocess:xn,promise:_n,record:ln,set:fn,strictObject:sn,string:et,symbol:Xt,transformer:rt,tuple:dn,undefined:Jt,union:on,unknown:en,void:nn,NEVER:v,ZodIssueCode:u,quotelessJson:bt,ZodError:A});const ge=a.object({country:a.string().optional(),city:a.string().optional(),street:a.string().optional(),streetNumber:a.string().optional(),floor:a.string().optional(),apartmentEnterNumber:a.string().optional(),apartmentNumber:a.string().optional()}),E=a.string().min(1,{message:"שדה חובה"}),wn=a.string().regex(/^\d+$/,"Must be a numeric string"),Tn=a.object({url:a.string().url(),id:a.string()});function In(n){return!!(n!=null&&n.url)}const ye=a.object({lang:a.enum(["he"]),value:a.string()}),Re=a.object({id:a.string().min(1),companyId:a.string().min(1),storeId:a.string().min(1),parentId:a.string().nullish(),tag:a.string().optional(),locales:a.array(ye),depth:a.number()}),Ce=Re.extend({children:a.lazy(()=>Ce.array())}),Nn=Re.extend({index:a.number(),depth:a.number(),collapsed:a.boolean().optional(),children:a.array(Ce)}),ve=a.string().min(1),je=a.object({type:a.literal("Product"),storeId:ve,companyId:ve,id:ve,objectID:ve,sku:ve,name:a.array(ye),description:a.array(ye),isPublished:a.boolean(),vat:a.boolean(),priceType:a.object({type:a.enum(["unit","kg","gram","liter","ml"]),value:a.number()}),price:a.number().positive(),purchasePrice:a.number().optional(),profitPercentage:a.number().optional(),currency:a.literal("ILS"),discount:a.object({type:a.enum(["number","percent","none"]),value:a.number()}),isDiscountable:a.boolean({description:"included in store discounts"}).optional(),weight:a.object({value:a.number(),unit:a.enum(["kg","gram","none"])}),volume:a.object({value:a.number(),unit:a.enum(["liter","ml","none"])}),images:a.array(a.object({url:a.string().url(),id:a.string()})),manufacturer:a.string(),brand:a.string(),importer:a.string(),supplier:a.string(),ingredients:a.array(ye),created_at:a.number(),updated_at:a.number(),categoryIds:a.array(a.string().nonempty()),stock:a.object({quantity:a.number().min(0),unit:a.enum(["piece","kg","gram","liter","ml"])}).optional(),categoryList:a.array(Ce).optional(),categories:a.object({lvl0:a.array(a.string()),lvl1:a.array(a.string()),lvl2:a.array(a.string()),lvl3:a.array(a.string()),lvl4:a.array(a.string())}).optional(),categoryNames:a.array(a.string()).optional()}),An=je.extend({image:a.instanceof(File).optional()}),at=a.enum(["delivered","missing","substituted"]),it=a.object({product:je,amount:a.number().positive(),price:a.number()}),$e=a.object({product:je,originalPrice:a.number().optional(),finalPrice:a.number().optional(),finalDiscount:a.number().optional(),amount:a.number().positive({message:"Quantity must be a positive number."}),status:at.optional(),substitutedWith:it.nullable().optional()}),Cn=a.object({type:a.literal("Cart"),id:a.string().uuid(),companyId:a.string().uuid(),storeId:a.string().uuid(),userId:a.string().uuid(),status:a.enum(["active","draft","completed"]),items:a.array($e)}),jn=a.object({id:a.string(),name:a.string(),websiteDomains:a.array(a.string())}),On=a.object({type:a.literal("FavoriteProduct"),id:a.string().uuid(),companyId:a.string().uuid(),storeId:a.string().uuid(),userId:a.string().uuid(),productId:a.string().uuid()}),_e=a.enum(["external","j5","none"]),st=a.object({type:a.literal("Profile"),id:E,companyId:E,storeId:E,tenantId:E,clientType:a.enum(["user","company"]),companyName:a.string().optional(),displayName:E,email:a.string().email(),phoneNumber:a.string().optional(),address:ge.optional(),isAnonymous:a.boolean(),createdDate:a.number(),lastActivityDate:a.number(),paymentType:_e.optional(),organizationId:a.string().optional().nullable(),organizationIds:a.array(a.string()).optional()}),Me=a.object({_COMMENT:a.string().optional(),transaction_id:a.string(),date:a.string().regex(/^\d{4}-\d{2}-\d{2}$/,"Date must be in YYYY-MM-DD format"),currency:a.string().length(3,"Currency must be 3 characters"),rate:a.number().positive(),vat:a.string().regex(/^\d+\.\d{2}$/,"VAT must be in format XX.XX"),vat_price:a.number().positive(),price_discount:a.number(),price_discount_in_currency:a.number(),price_total:a.string().regex(/^\d+\.\d{2}$/,"Price total must be in format XX.XX"),price_total_in_currency:a.number().positive()}),ot=a.object({doc_uuid:a.string().uuid("Document UUID must be a valid UUID"),pdf_link:a.string().url("PDF link must be a valid URL"),pdf_link_copy:a.string().url("PDF copy link must be a valid URL"),doc_number:a.string().min(1,"Document number is required"),sent_mails:a.array(a.string().email("Each email must be valid")),success:a.boolean(),ua_uuid:a.string().uuid("UA UUID must be a valid UUID"),calculatedData:Me,warning:a.string().optional(),date:a.number().optional()}),ct=a.object({id:a.string().min(1,"ID is required"),number:a.string().min(1,"Number is required"),date:a.number().min(1,"Date is required"),createdAt:a.number().min(1,"Created at is required"),status:a.enum(["pending","paid","cancelled"]),companyDetails:a.object({name:a.string().min(1,"Name is required").optional(),address:a.string().min(1,"Address is required").optional(),phone:a.string().min(1,"Phone is required").optional(),email:a.string().email("Email must be valid").optional()}).optional(),clientDetails:a.object({name:a.string().min(1,"Name is required").optional(),address:a.string().min(1,"Address is required").optional(),phone:a.string().min(1,"Phone is required").optional(),email:a.string().email("Email must be valid").optional()}).optional(),items:a.array(a.object({name:a.string().min(1,"Name is required").optional(),price:a.number().min(1,"Price is required").optional(),quantity:a.number().min(1,"Quantity is required").optional(),total:a.number().min(1,"Total is required").optional()})).optional(),total:a.number().min(1,"Total is required").optional(),vat:a.number().min(1,"VAT is required").optional(),link:a.string().url("Link must be a valid URL").optional()}),ze=a.object({number:a.string(),name:a.string(),id:a.string()}),ut=a.object({id:a.string(),name:a.string(),discountPercentage:a.number().positive().min(0).max(100).optional(),nameOnInvoice:a.string().optional(),billingAccounts:a.array(ze),paymentType:_e,companyNumber:a.string().optional(),address:ge.optional(),groupId:a.string().optional()}),Zn=ut.omit({id:!0}),Dn=a.object({doc_uuid:a.string().uuid("Document UUID must be a valid UUID"),pdf_link:a.string().url("PDF link must be a valid URL"),pdf_link_copy:a.string().url("PDF copy link must be a valid URL"),doc_number:a.string().min(1,"Document number is required"),sent_mails:a.array(a.string().email("Each email must be valid")),success:a.boolean(),ua_uuid:a.string().uuid("UA UUID must be a valid UUID"),calculatedData:Me,warning:a.string().optional(),date:a.number().optional()}),Pn=a.object({id:a.string().min(1,"ID is required"),number:a.string().min(1,"Number is required"),date:a.string().min(1,"Date is required"),createdAt:a.number().min(1,"Created at is required"),status:a.enum(["pending","paid","cancelled"]),companyDetails:a.object({name:a.string().min(1,"Name is required").optional(),address:a.string().min(1,"Address is required").optional(),phone:a.string().min(1,"Phone is required").optional(),email:a.string().email("Email must be valid").optional()}).optional(),clientDetails:a.object({name:a.string().min(1,"Name is required").optional(),address:a.string().min(1,"Address is required").optional(),phone:a.string().min(1,"Phone is required").optional(),email:a.string().email("Email must be valid").optional()}).optional(),items:a.array(a.object({name:a.string().min(1,"Name is required").optional(),price:a.number().min(1,"Price is required").optional(),quantity:a.number().min(1,"Quantity is required").optional(),total:a.number().min(1,"Total is required").optional()})).optional(),total:a.number().min(1,"Total is required").optional(),vat:a.number().min(1,"VAT is required").optional(),link:a.string().url("Link must be a valid URL").optional()}),En=a.object({type:a.literal("Order"),createdBy:a.enum(["user","admin"]).optional(),id:E,companyId:E,storeId:E,userId:E,status:a.enum(["draft","pending","processing","in_delivery","delivered","cancelled","completed","refunded"]),paymentType:_e.optional(),paymentStatus:a.enum(["pending","pending_j5","external","completed","failed","refunded"]),cart:a.object({id:a.string(),items:a.array($e),cartDiscount:a.number(),cartTotal:a.number(),cartVat:a.number(),deliveryPrice:a.number().optional()}),storeOptions:a.object({deliveryPrice:a.number().optional(),freeDeliveryPrice:a.number().optional(),isVatIncludedInPrice:a.boolean().optional()}).optional(),originalAmount:a.number().positive().optional(),actualAmount:a.number().positive().optional(),date:a.number(),deliveryDate:a.coerce.number(),client:st.optional(),address:ge.optional(),nameOnInvoice:a.string().optional(),emailOnInvoice:a.string().email().optional(),phoneNumberOnInvoice:a.string().optional(),clientComment:a.string().optional(),organizationId:a.string().optional(),billingAccount:ze.optional(),deliveryNote:ct.optional(),invoice:Pn.optional(),ezInvoice:Dn.optional(),ezDeliveryNote:ot.optional(),updatedBy:a.string().optional(),updatedAt:a.number().optional()}),dt=a.enum(["individual","company"]),Rn=a.object({id:a.string(),companyId:a.string(),name:a.string(),urls:a.array(a.string()),logoUrl:a.string(),tenantId:a.string(),paymentType:_e,allowAnonymousClients:a.boolean(),isVatIncludedInPrice:a.boolean(),clientTypes:a.array(dt),minimumOrder:a.number().optional(),freeDeliveryPrice:a.number().optional(),deliveryPrice:a.number().optional(),address:ge.optional(),companyNumber:a.string().optional()}),lt=a.object({minSpend:a.number().positive().optional(),stackable:a.boolean().default(!1)}).optional(),mt=a.discriminatedUnion("variantType",[a.object({variantType:a.literal("bundle"),productsId:a.array(a.string().nonempty()).min(1),requiredQuantity:a.number().positive(),bundlePrice:a.number().positive()})]),$n=a.object({type:a.literal("Discount"),storeId:a.string().min(1),companyId:a.string().min(1),id:a.string().min(1),name:a.array(a.object({lang:a.enum(["he"]),value:a.string().nonempty()})),active:a.boolean(),startDate:a.number(),endDate:a.number(),variant:mt,conditions:lt});class ft{canApply(e,t){if(e.variant.variantType!=="bundle"||!this.isDiscountActive(e))return!1;const{productsId:r,requiredQuantity:i}=e.variant;return this.getTotalQuantity(t.cart,r)>=i}calculate(e,t){if(e.variant.variantType!=="bundle")return{applicable:!1,discountAmount:0,affectedItems:[]};const{productsId:r,requiredQuantity:i,bundlePrice:s}=e.variant,c=t.cart.filter(be=>r.includes(be.product.id)),o=this.getTotalQuantity(t.cart,r),l=Math.floor(o/i);if(l===0)return{applicable:!1,discountAmount:0,affectedItems:[]};const d=this.calculateOriginalPrice(c),h=this.getTotalQuantity(t.cart,r),x=this.calculateDiscountedPrice(d,s,l,i,h),T=d-x,w=this.distributeDiscount(c,T,d);return{applicable:!0,discountAmount:Number(T.toFixed(2)),affectedItems:w}}isDiscountActive(e){const t=Date.now();return e.active&&e.startDate<=t&&e.endDate>=t}getTotalQuantity(e,t){return e.filter(r=>t.includes(r.product.id)).reduce((r,i)=>r+i.amount,0)}calculateOriginalPrice(e){return e.reduce((t,r)=>t+r.product.price*r.amount,0)}calculateDiscountedPrice(e,t,r,i,s){const c=t*r,o=r*i,d=Math.max(0,s-o)/s*e;return c+d}distributeDiscount(e,t,r){const i=t/r;return e.map(s=>{const c=s.product.price*s.amount*i;return{productId:s.product.id,quantity:s.amount,originalPrice:Number(s.product.price.toFixed(2)),discountedPrice:Number((s.product.price-c/s.amount).toFixed(2)),discountAmount:Number(c.toFixed(2))}})}}class Ve{static getStrategy(e){return this.strategies.get(e.variant.variantType)||null}static registerStrategy(e,t){this.strategies.set(e,t)}static getRegisteredTypes(){return Array.from(this.strategies.keys())}static clearStrategies(){this.strategies.clear()}}_t(Ve,"strategies",new Map([["bundle",new ft]]));class Mn{static calculateDiscounts(e,t,r){var d,h;const i={cart:e,user:r,appliedDiscounts:[]},s=this.filterActiveDiscounts(t),c=[];for(const x of s){const T=Ve.getStrategy(x);if(!T||!T.canApply(x,i)||!((d=x.conditions)!=null&&d.stackable)&&c.length>0)continue;const w=T.calculate(x,i);w.applicable&&(c.push({discountId:x.id,discountName:((h=x.name[0])==null?void 0:h.value)||"Discount",discountAmount:Number(w.discountAmount.toFixed(2)),affectedItems:w.affectedItems}),i.appliedDiscounts=c)}const o=this.calculateFinalPrices(e,c),l=c.reduce((x,T)=>x+T.discountAmount,0);return{items:o,totalDiscount:Number(l.toFixed(2)),appliedDiscounts:c}}static filterActiveDiscounts(e){const t=Date.now();return e.filter(r=>r.active&&r.startDate<=t&&r.endDate>=t)}static calculateFinalPrices(e,t){return e.map(r=>{const i=t.filter(l=>l.affectedItems.some(d=>d.productId===r.product.id)),s=i.reduce((l,d)=>{const h=d.affectedItems.find(x=>x.productId===r.product.id);return l+((h==null?void 0:h.discountAmount)||0)},0),c=s/r.amount,o=r.product.price-c;return{amount:r.amount,product:r.product,originalPrice:Number(r.product.price.toFixed(2)),finalPrice:Number(Math.max(0,o).toFixed(2)),finalDiscount:Number(s.toFixed(2)),appliedDiscounts:i.map(l=>l.discountId)}})}static isDiscountActive(e){const t=Date.now();return e.active&&e.startDate<=t&&e.endDate>=t}static getActiveDiscounts(e){return this.filterActiveDiscounts(e)}}const ht=a.object({id:a.string(),name:a.string()}),zn=ht.omit({id:!0}),Fe=a.object({type:a.literal("Supplier"),id:a.string(),name:a.string(),code:a.string()}),Vn=Fe.omit({id:!0}),pt=a.object({type:a.literal("SupplierInvoice"),id:a.string(),supplier:Fe,invoiceNumber:a.string(),date:a.number(),rows:a.array(a.object({id:a.string(),rowNumber:a.number(),sku:a.string(),itemName:a.string(),quantity:a.number(),purchasePrice:a.number(),lineDiscount:a.number(),profitPercentage:a.number(),price:a.number(),totalPurchasePrice:a.number(),vat:a.boolean(),originalProduct:a.object({purchasePrice:a.number(),price:a.number(),profitPercentage:a.number()}).optional()})),productsToUpdate:a.array(a.object({sku:a.string(),itemName:a.string(),oldPurchasePrice:a.number(),newPurchasePrice:a.number(),oldPrice:a.number(),newPrice:a.number(),oldProfitPercentage:a.number(),newProfitPercentage:a.number()})),total:a.number().optional(),totalBeforeVat:a.number().optional(),vat:a.number().optional()}),Fn=pt.omit({id:!0}),gt=a.enum(["debt_increase","debt_reduction"]),Ln=a.object({recordId:a.string().min(1),organizationId:a.string().min(1),customerId:a.string(),customerName:a.string(),billingAccountId:a.string().nullable(),type:gt,amount:a.number().int().positive(),currency:a.literal("ILS"),relatedId:a.string().min(1),source:a.enum(["order","ledger","manual"]),causedByEventId:a.string().nullable(),createdAt:a.number().int().positive(),year:a.number().int(),month:a.number().int().min(1).max(12),yearMonth:a.string(),companyId:a.string().min(1),storeId:a.string().min(1)}),Un=a.object({organizationId:a.string().min(1),organizationName:a.string(),totalCurrentDebt:a.number().int(),totalDebits:a.number().int(),totalCredits:a.number().int(),currency:a.literal("ILS"),updatedAt:a.number().int().positive(),companyId:a.string().min(1),storeId:a.string().min(1)}),qn=a.enum(["delivery_note","payment_received","credit_note","debit_note","order_created","order_cancelled","order_refunded"]),Bn=a.enum(["check","bank_transfer","cash","credit_card","other"]),Le={VAT:18};function Wn(n,e){var t,r;return((t=n.discount)==null?void 0:t.type)==="percent"?n.price*(n.discount.value??100)/100:((r=n.discount)==null?void 0:r.type)==="number"?n.discount.value??0:0}function Qn(n,e){var r,i;const t=e&&n.vat?n.price+n.price*Le.VAT/100:n.price;if(((r=n.discount)==null?void 0:r.type)==="percent"){const s=t*n.discount.value/100;return n.price-s}return((i=n.discount)==null?void 0:i.type)==="number"?t-n.discount.value:t}function Yn({cart:n,discounts:e,deliveryPrice:t=0,freeDeliveryPrice:r=0,isVatIncludedInPrice:i=!1}){const s=n.map((o,l)=>({amount:o.amount,product:{...o.product},originalPrice:o.product.price,finalPrice:Qn(o.product,i),finalDiscount:Wn(o.product)})),c=s.reduce((o,l)=>{const{product:d,amount:h,finalPrice:x,finalDiscount:T}=l;let w=0;if(d.vat){let qe=0;if(i){const Jn=Number((x/(1+Le.VAT/100)).toFixed(2)),Hn=x-Jn;w=Number(Hn.toFixed(2)),w=w*h,qe=Number(w.toFixed(2))}else w=x*Le.VAT/100,w=w*h,qe=Number(w.toFixed(2));o.vat=Number((o.vat+qe).toFixed(2))}const be=Number(x.toFixed(2));return o.cost+=h*be,o.discount+=T&&h*T,o.finalCost+=h*be+(i?0:w),o.productsCost+=h*be+(i?0:w),o.cost=Number(o.cost.toFixed(2)),o.discount=Number(o.discount.toFixed(2)),o.finalCost=Number(o.finalCost.toFixed(2)),o.productsCost=Number(o.productsCost.toFixed(2)),o},{discount:0,cost:0,finalCost:0,vat:0,productsCost:0,deliveryPrice:t});return c.deliveryPrice&&c.productsCost>=r?c.deliveryPrice=0:c.finalCost+=c.deliveryPrice,{items:s,...c}}const yt={stores:"STORES",companies:"COMPANIES"},vt={products:"products","favorite-products":"favorite-products",profiles:"profiles",cart:"cart",clients:"clients",orders:"orders",categories:"categories",payments:"payments",settings:"settings",discounts:"discounts",organizations:"organizations",organizationGroups:"organizationGroups",invoices:"invoices",suppliers:"suppliers",supplierInvoices:"supplierInvoices",chatSessions:"chatSessions",chatSessionMessages:"chatSessionMessages",contactSubmissions:"contactSubmissions",budgetAccounts:"budgetAccounts",budgetTransactions:"budgetTransactions",budgetRecords:"budgetRecords",organizationBudgets:"organizationBudgets",transactions:"transactions",paymentLinks:"paymentLinks",duplicateChargeAlerts:"duplicateChargeAlerts"},Gn={firestore:{systemCollections:yt,storeCollections:vt,getPath:({companyId:n,storeId:e,collectionName:t,id:r})=>`${n}/${e}/${t}${r?`/${r}`:""}`,getSubPath:({companyId:n,storeId:e,collectionName:t,subCollectionName:r,id:i,subId:s})=>`${n}/${e}/${t}/${i}/${r}${s?`/${s}`:""}`,getDocPath:n=>`{companyId}/{storeId}/${n}/{id}`,getSubDocPath:(n,e,t)=>`{companyId}/{storeId}/${n}/${e}/${t}/{id}`}},Ue={round:(n,e=2)=>{const t=10**e;return Math.round((n+Number.EPSILON)*t)/t}},Xn={calcSalePriceFromMargin:(n,e)=>n<=0||e<=0||n>=100?e:Ue.round(e/(1-n/100)),calcMarginFromSalePrice:(n,e)=>n<=0||e<=0?0:Ue.round((n-e)/n*100)};p.AddressSchema=ge,p.BaseCategorySchema=Re,p.BillingAccountSchema=ze,p.BudgetRecordSchema=Ln,p.BudgetRecordTypeSchema=gt,p.BudgetTransactionTypeSchema=qn,p.BundleDiscountStrategy=ft,p.CalculatedDataSchema=Me,p.CartItemProductSchema=$e,p.CartSchema=Cn,p.CategorySchema=Ce,p.CompanySchema=jn,p.DeliveryNoteSchema=ct,p.DiscountConditionsSchema=lt,p.DiscountEngine=Mn,p.DiscountSchema=$n,p.DiscountStrategyFactory=Ve,p.DiscountVariantSchema=mt,p.EzDeliveryNoteSchema=ot,p.FavoriteProductSchema=On,p.FileSchema=Tn,p.FirebaseAPI=Gn,p.FulfillmentStatusSchema=at,p.LocaleSchema=ye,p.NewOrganizationGroupSchema=zn,p.NewOrganizationSchema=Zn,p.NewProductSchema=An,p.NewSupplierInvoiceSchema=Fn,p.NewSupplierSchema=Vn,p.OrderSchema=En,p.OrganizationBudgetSchema=Un,p.OrganizationGroupSchema=ht,p.OrganizationSchema=ut,p.PaymentMethodSchema=Bn,p.PaymentTypeSchema=_e,p.ProductSchema=je,p.ProfileSchema=st,p.StoreSchema=Rn,p.SubstitutedWithSchema=it,p.SupplierInvoiceSchema=pt,p.SupplierSchema=Fe,p.TFlattenCategorySchema=Nn,p.clientTypesSchema=dt,p.getCartCost=Yn,p.isFile=In,p.math=Ue,p.notEmptyTextSchema=E,p.numericTextSchema=wn,p.storeCalculator=Xn,p.storeCollections=vt,p.systemCollections=yt,Object.defineProperty(p,Symbol.toStringTag,{value:"Module"})});
|
|
2
2
|
//# sourceMappingURL=core.umd.js.map
|