@zuplo/core 6.30.2 → 6.30.6

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.
@@ -612,7 +612,7 @@ Did you specify these with the most recent transformation maps first?`);let d=O7
612
612
  //# sourceMappingURL=data:application/json;base64,`,uvt=dp(()=>process.sourceMapsEnabled??!0,"shouldApplySourceMap"),fvt=dp(({code:a,map:s})=>a+ySr+Buffer.from(JSON.stringify(s),"utf8").toString("base64"),"inlineSourceMap"),vSr=[".cts",".mts",".ts",".tsx",".jsx"],bSr=[".js",".cjs",".mjs"],_vt=[".ts",".tsx",".jsx"],L7e=dp((a,s,c,f)=>{let d=Object.getOwnPropertyDescriptor(a,s);d?.set?a[s]=c:(!d||d.configurable)&&Object.defineProperty(a,s,{value:c,enumerable:d?.enumerable||f?.enumerable,writable:f?.writable??(d?d.writable:!0),configurable:f?.configurable??(d?d.configurable:!0)})},"safeSet"),SSr=dp((a,s,c)=>{let f=s[".js"],d=dp((v,E)=>{if(a.enabled===!1)return f(v,E);let[A,O]=E.split("?");if((new URLSearchParams(O).get("namespace")??void 0)!==c)return f(v,E);v.id.startsWith("data:text/javascript,")&&(v.path=bS.dirname(A)),fpe?.send&&fpe.send({type:"dependency",path:A});let M=vSr.some(Q=>A.endsWith(Q)),W=bSr.some(Q=>A.endsWith(Q));if(!M&&!W)return f(v,A);let $=pSr.readFileSync(A,"utf8");if(A.endsWith(".cjs")){let Q=upe(E,$);Q&&($=uvt()?fvt(Q):Q.code)}else if(M||C1t($)){let Q=cvt($,E,{tsconfigRaw:Svt?.(A)});$=uvt()?fvt(Q):Q.code}v._compile($,A)},"transformer");L7e(s,".js",d);for(let v of _vt)L7e(s,v,d,{enumerable:!c,writable:!0,configurable:!0});return L7e(s,".mjs",d,{writable:!0,configurable:!0}),()=>{s[".js"]===d&&(s[".js"]=f);for(let v of[..._vt,".mjs"])s[v]===d&&delete s[v]}},"createExtensions"),TSr=dp(a=>s=>{if((s==="."||s===".."||s.endsWith("/.."))&&(s+="/"),yvt.test(s)){let c=bS.join(s,"index.js");s.startsWith("./")&&(c=`./${c}`);try{return a(c)}catch{}}try{return a(s)}catch(c){let f=c;if(f.code==="MODULE_NOT_FOUND")try{return a(`${s}${bS.sep}index.js`)}catch{}throw f}},"createImplicitResolver"),Cvt=[".js",".json"],Evt=[".ts",".tsx",".jsx"],CSr=[...Evt,...Cvt],ESr=[...Cvt,...Evt],zK=Object.create(null);zK[".js"]=[".ts",".tsx",".js",".jsx"],zK[".jsx"]=[".tsx",".ts",".jsx",".js"],zK[".cjs"]=[".cts"],zK[".mjs"]=[".mts"];var xSr=dp(a=>{let s=a.split("?"),c=s[1]?`?${s[1]}`:"",[f]=s,d=bS.extname(f),v=[],E=zK[d];if(E){let O=f.slice(0,-d.length);v.push(...E.map(M=>O+M+c))}let A=!(a.startsWith(VK)||ppe(f))||f.includes(bvt)||f.includes("/node_modules/")?ESr:CSr;return v.push(...A.map(O=>f+O+c)),v},"mapTsExtensions"),_pe=dp((a,s,c)=>{if(yvt.test(s)||!c&&!Tvt)return;let f=xSr(s);if(f)for(let d of f)try{return a(d)}catch(v){let{code:E}=v;if(E!=="MODULE_NOT_FOUND"&&E!=="ERR_PACKAGE_PATH_NOT_EXPORTED")throw v}},"resolveTsFilename"),DSr=dp((a,s)=>c=>{if(ppe(c)){let f=_pe(a,c,s);if(f)return f}try{return a(c)}catch(f){let d=f;if(d.code==="MODULE_NOT_FOUND"){if(typeof d.path=="string"&&d.path.endsWith(`${bS.sep}package.json`)){let E=d.message.match(/^Cannot find module '([^']+)'$/);if(E){let O=E[1],M=_pe(a,O,s);if(M)return M}let A=d.message.match(/^Cannot find module '([^']+)'. Please verify that the package.json has a valid "main" entry$/);if(A){let O=A[1],M=_pe(a,O,s);if(M)return M}}let v=_pe(a,c,s);if(v)return v}throw d}},"createTsExtensionResolver"),pvt="at cjsPreparseModuleExports (node:internal",ASr=dp(a=>{let s=a.stack.split(`
613
613
  `).slice(1);return s[1].includes(pvt)||s[2].includes(pvt)},"isFromCjsLexer"),kSr=dp((a,s)=>{let c=a.split("?"),f=new URLSearchParams(c[1]);if(s?.filename){let d=hvt(s.filename),v;if(d){let A=d.split("?"),O=A[0];v=A[1],s.filename=O,s.path=bS.dirname(O),s.paths=HA._nodeModulePaths(s.path),HA._cache[O]=s}v||(v=s.filename.split("?")[1]);let E=new URLSearchParams(v).get("namespace");E&&f.append("namespace",E)}return[c[0],f,(d,v)=>(bS.isAbsolute(d)&&!d.endsWith(".json")&&!d.endsWith(".node")&&!(v===0&&ASr(new Error))&&(d+=M7e(f)),d)]},"preserveQuery"),wSr=dp((a,s,c)=>{if(a.startsWith(VK)&&(a=mvt(a)),R7e&&!ppe(a)&&!s?.filename?.includes(bvt)){let f=R7e(a);for(let d of f)try{return c(d)}catch{}}return c(a)},"resolveTsPaths"),PSr=dp((a,s,c)=>(f,d,...v)=>{if(a.enabled===!1)return s(f,d,...v);f=j7e(f);let[E,A,O]=kSr(f,d);if((A.get("namespace")??void 0)!==c)return s(f,d,...v);let M=dp($=>s($,d,...v),"nextResolveSimple");M=DSr(M,!!(c||d?.filename&&hSr.test(d.filename))),M=TSr(M);let W=wSr(E,d,M);return O(W,v.length)},"createResolveFilename"),dvt=dp((a,s)=>{if(!s)throw new Error("The current file path (__filename or import.meta.url) must be provided in the second argument of tsx.require()");return a.startsWith(".")?((typeof s=="string"&&s.startsWith(VK)||s instanceof URL)&&(s=mvt(s)),bS.resolve(bS.dirname(s),a)):a},"resolveContext"),WK=dp(a=>{let{sourceMapsEnabled:s}=process,c={enabled:!0};gSr(process.env.TSX_TSCONFIG_PATH),process.setSourceMapsEnabled(!0);let f=HA._resolveFilename,d=PSr(c,f,a?.namespace);HA._resolveFilename=d;let v=SSr(c,HA._extensions,a?.namespace),E=dp(()=>{s===!1&&process.setSourceMapsEnabled(!1),c.enabled=!1,HA._resolveFilename===d&&(HA._resolveFilename=f),v()},"unregister");if(a?.namespace){let A=dp((M,W)=>{let $=dvt(M,W),[Q,Pe]=$.split("?"),De=new URLSearchParams(Pe);return a.namespace&&!Q.startsWith("node:")&&De.set("namespace",a.namespace),ZF(Q+M7e(De))},"scopedRequire");E.require=A;let O=dp((M,W,$)=>{let Q=dvt(M,W),[Pe,De]=Q.split("?"),Se=new URLSearchParams(De);return a.namespace&&!Pe.startsWith("node:")&&Se.set("namespace",a.namespace),d(Pe+M7e(Se),module,!1,$)},"scopedResolve");E.resolve=O,E.unregister=E}return E},"register");import{pathToFileURL as OSr}from"url";var NSr=Object.defineProperty,mpe=t((a,s)=>NSr(a,"name",{value:s,configurable:!0}),"o"),FSr=mpe(a=>(s,c)=>{if(!c)throw new Error("The current file path (import.meta.url) must be provided in the second argument of tsImport()");let f=c.startsWith(VK)?c:OSr(c).toString();return import(`tsx://${JSON.stringify({specifier:s,parentURL:f,namespace:a})}`)},"createScopedImport"),xvt=!1,Dvt=mpe(a=>{if(!dpe.register)throw new Error(`This version of Node.js (${process.version}) does not support module.register(). Please upgrade to Node v18.19 or v20.6 and above.`);if(!xvt){let{_resolveFilename:A}=dpe;dpe._resolveFilename=(O,...M)=>A(j7e(O),...M),xvt=!0}let{sourceMapsEnabled:s}=process;process.setSourceMapsEnabled(!0);let{port1:c,port2:f}=new ISr;dpe.register(`./esm/index.mjs?${Date.now()}`,{parentURL:import.meta.url,data:{port:f,namespace:a?.namespace,tsconfig:a?.tsconfig},transferList:[f]});let d=a?.onImport,v=d&&(A=>{A.type==="load"&&d(A.url)});v&&(c.on("message",v),c.unref());let E=mpe(()=>(s===!1&&process.setSourceMapsEnabled(!1),v&&c.off("message",v),c.postMessage("deactivate"),new Promise(A=>{let O=mpe(M=>{M.type==="deactivated"&&(A(),c.off("message",O))},"onDeactivated");c.on("message",O)})),"unregister");return a?.namespace&&(E.import=FSr(a.namespace),E.unregister=E),E},"register");var LSr=Object.defineProperty,kvt=t((a,s)=>LSr(a,"name",{value:s,configurable:!0}),"a"),OB,hpe=kvt((a,s)=>(OB||(OB=WK({namespace:Date.now().toString()})),OB.require(a,s)),"tsxRequire"),Avt=kvt((a,s,c)=>(OB||(OB=WK({namespace:Date.now().toString()})),OB.resolve(a,s,c)),"resolve");Avt.paths=ZF.resolve.paths,hpe.resolve=Avt,hpe.main=ZF.main,hpe.extensions=ZF.extensions,hpe.cache=ZF.cache;var RSr=Object.defineProperty,wvt=t((a,s)=>RSr(a,"name",{value:s,configurable:!0}),"o"),MSr=wvt((a,s)=>{let c=a[0]-s[0];if(c===0){let f=a[1]-s[1];return f===0?a[2]>=s[2]:f>0}return c>0},"isVersionGreaterOrEqual"),jSr=process.versions.node.split(".").map(Number),Pvt=wvt((a,s=jSr)=>{for(let c=0;c<a.length;c+=1){let f=a[c];if(c===a.length-1||s[0]===f[0])return MSr(s,f)}return!1},"isFeatureSupported");var Nvt=[[20,11,0],[21,3,0]];import"esbuild";var BSr=Object.defineProperty,USr=t((a,s)=>BSr(a,"name",{value:s,configurable:!0}),"i"),Ivt=USr((a,s)=>{if(!s||typeof s=="object"&&!s.parentURL)throw new Error("The current file path (import.meta.url) must be provided in the second argument of tsImport()");let c=typeof s=="string",f=c?s:s.parentURL,d=Date.now().toString(),v=WK({namespace:d});return!Pvt(Nvt)&&!vvt.test(a)&&gvt.test(a)?Promise.resolve(v.require(a,f)):Dvt({namespace:d,...c?{}:s}).import(a,f)},"tsImport");var sf;(function(a){a.assertEqual=d=>d;function s(d){}t(s,"assertIs"),a.assertIs=s;function c(d){throw new Error}t(c,"assertNever"),a.assertNever=c,a.arrayToEnum=d=>{let v={};for(let E of d)v[E]=E;return v},a.getValidEnumValues=d=>{let v=a.objectKeys(d).filter(A=>typeof d[d[A]]!="number"),E={};for(let A of v)E[A]=d[A];return a.objectValues(E)},a.objectValues=d=>a.objectKeys(d).map(function(v){return d[v]}),a.objectKeys=typeof Object.keys=="function"?d=>Object.keys(d):d=>{let v=[];for(let E in d)Object.prototype.hasOwnProperty.call(d,E)&&v.push(E);return v},a.find=(d,v)=>{for(let E of d)if(v(E))return E},a.isInteger=typeof Number.isInteger=="function"?d=>Number.isInteger(d):d=>typeof d=="number"&&isFinite(d)&&Math.floor(d)===d;function f(d,v=" | "){return d.map(E=>typeof E=="string"?`'${E}'`:E).join(v)}t(f,"joinValues"),a.joinValues=f,a.jsonStringifyReplacer=(d,v)=>typeof v=="bigint"?v.toString():v})(sf||(sf={}));var U7e;(function(a){a.mergeShapes=(s,c)=>({...s,...c})})(U7e||(U7e={}));var Ka=sf.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),xN=t(a=>{switch(typeof a){case"undefined":return Ka.undefined;case"string":return Ka.string;case"number":return isNaN(a)?Ka.nan:Ka.number;case"boolean":return Ka.boolean;case"function":return Ka.function;case"bigint":return Ka.bigint;case"symbol":return Ka.symbol;case"object":return Array.isArray(a)?Ka.array:a===null?Ka.null:a.then&&typeof a.then=="function"&&a.catch&&typeof a.catch=="function"?Ka.promise:typeof Map<"u"&&a instanceof Map?Ka.map:typeof Set<"u"&&a instanceof Set?Ka.set:typeof Date<"u"&&a instanceof Date?Ka.date:Ka.object;default:return Ka.unknown}},"getParsedType"),Ds=sf.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"]),$Sr=t(a=>JSON.stringify(a,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),SS=class a extends Error{static{t(this,"ZodError")}constructor(s){super(),this.issues=[],this.addIssue=f=>{this.issues=[...this.issues,f]},this.addIssues=(f=[])=>{this.issues=[...this.issues,...f]};let c=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,c):this.__proto__=c,this.name="ZodError",this.issues=s}get errors(){return this.issues}format(s){let c=s||function(v){return v.message},f={_errors:[]},d=t(v=>{for(let E of v.issues)if(E.code==="invalid_union")E.unionErrors.map(d);else if(E.code==="invalid_return_type")d(E.returnTypeError);else if(E.code==="invalid_arguments")d(E.argumentsError);else if(E.path.length===0)f._errors.push(c(E));else{let A=f,O=0;for(;O<E.path.length;){let M=E.path[O];O===E.path.length-1?(A[M]=A[M]||{_errors:[]},A[M]._errors.push(c(E))):A[M]=A[M]||{_errors:[]},A=A[M],O++}}},"processError");return d(this),f}static assert(s){if(!(s instanceof a))throw new Error(`Not a ZodError: ${s}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,sf.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(s=c=>c.message){let c={},f=[];for(let d of this.issues)d.path.length>0?(c[d.path[0]]=c[d.path[0]]||[],c[d.path[0]].push(s(d))):f.push(s(d));return{formErrors:f,fieldErrors:c}}get formErrors(){return this.flatten()}};SS.create=a=>new SS(a);var RB=t((a,s)=>{let c;switch(a.code){case Ds.invalid_type:a.received===Ka.undefined?c="Required":c=`Expected ${a.expected}, received ${a.received}`;break;case Ds.invalid_literal:c=`Invalid literal value, expected ${JSON.stringify(a.expected,sf.jsonStringifyReplacer)}`;break;case Ds.unrecognized_keys:c=`Unrecognized key(s) in object: ${sf.joinValues(a.keys,", ")}`;break;case Ds.invalid_union:c="Invalid input";break;case Ds.invalid_union_discriminator:c=`Invalid discriminator value. Expected ${sf.joinValues(a.options)}`;break;case Ds.invalid_enum_value:c=`Invalid enum value. Expected ${sf.joinValues(a.options)}, received '${a.received}'`;break;case Ds.invalid_arguments:c="Invalid function arguments";break;case Ds.invalid_return_type:c="Invalid function return type";break;case Ds.invalid_date:c="Invalid date";break;case Ds.invalid_string:typeof a.validation=="object"?"includes"in a.validation?(c=`Invalid input: must include "${a.validation.includes}"`,typeof a.validation.position=="number"&&(c=`${c} at one or more positions greater than or equal to ${a.validation.position}`)):"startsWith"in a.validation?c=`Invalid input: must start with "${a.validation.startsWith}"`:"endsWith"in a.validation?c=`Invalid input: must end with "${a.validation.endsWith}"`:sf.assertNever(a.validation):a.validation!=="regex"?c=`Invalid ${a.validation}`:c="Invalid";break;case Ds.too_small:a.type==="array"?c=`Array must contain ${a.exact?"exactly":a.inclusive?"at least":"more than"} ${a.minimum} element(s)`:a.type==="string"?c=`String must contain ${a.exact?"exactly":a.inclusive?"at least":"over"} ${a.minimum} character(s)`:a.type==="number"?c=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="date"?c=`Date must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(a.minimum))}`:c="Invalid input";break;case Ds.too_big:a.type==="array"?c=`Array must contain ${a.exact?"exactly":a.inclusive?"at most":"less than"} ${a.maximum} element(s)`:a.type==="string"?c=`String must contain ${a.exact?"exactly":a.inclusive?"at most":"under"} ${a.maximum} character(s)`:a.type==="number"?c=`Number must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="bigint"?c=`BigInt must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="date"?c=`Date must be ${a.exact?"exactly":a.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(a.maximum))}`:c="Invalid input";break;case Ds.custom:c="Invalid input";break;case Ds.invalid_intersection_types:c="Intersection results could not be merged";break;case Ds.not_multiple_of:c=`Number must be a multiple of ${a.multipleOf}`;break;case Ds.not_finite:c="Number must be finite";break;default:c=s.defaultError,sf.assertNever(a)}return{message:c}},"errorMap"),Lvt=RB;function JSr(a){Lvt=a}t(JSr,"setErrorMap");function gpe(){return Lvt}t(gpe,"getErrorMap");var ype=t(a=>{let{data:s,path:c,errorMaps:f,issueData:d}=a,v=[...c,...d.path||[]],E={...d,path:v};if(d.message!==void 0)return{...d,path:v,message:d.message};let A="",O=f.filter(M=>!!M).slice().reverse();for(let M of O)A=M(E,{data:s,defaultError:A}).message;return{...d,path:v,message:A}},"makeIssue"),qSr=[];function ja(a,s){let c=gpe(),f=ype({issueData:s,data:a.data,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,c,c===RB?void 0:RB].filter(d=>!!d)});a.common.issues.push(f)}t(ja,"addIssueToContext");var d1=class a{static{t(this,"ParseStatus")}constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(s,c){let f=[];for(let d of c){if(d.status==="aborted")return Bc;d.status==="dirty"&&s.dirty(),f.push(d.value)}return{status:s.value,value:f}}static async mergeObjectAsync(s,c){let f=[];for(let d of c){let v=await d.key,E=await d.value;f.push({key:v,value:E})}return a.mergeObjectSync(s,f)}static mergeObjectSync(s,c){let f={};for(let d of c){let{key:v,value:E}=d;if(v.status==="aborted"||E.status==="aborted")return Bc;v.status==="dirty"&&s.dirty(),E.status==="dirty"&&s.dirty(),v.value!=="__proto__"&&(typeof E.value<"u"||d.alwaysSet)&&(f[v.value]=E.value)}return{status:s.value,value:f}}},Bc=Object.freeze({status:"aborted"}),LB=t(a=>({status:"dirty",value:a}),"DIRTY"),Tv=t(a=>({status:"valid",value:a}),"OK"),$7e=t(a=>a.status==="aborted","isAborted"),J7e=t(a=>a.status==="dirty","isDirty"),QK=t(a=>a.status==="valid","isValid"),KK=t(a=>typeof Promise<"u"&&a instanceof Promise,"isAsync");function vpe(a,s,c,f){if(c==="a"&&!f)throw new TypeError("Private accessor was defined without a getter");if(typeof s=="function"?a!==s||!f:!s.has(a))throw new TypeError("Cannot read private member from an object whose class did not declare it");return c==="m"?f:c==="a"?f.call(a):f?f.value:s.get(a)}t(vpe,"__classPrivateFieldGet");function Rvt(a,s,c,f,d){if(f==="m")throw new TypeError("Private method is not writable");if(f==="a"&&!d)throw new TypeError("Private accessor was defined without a setter");if(typeof s=="function"?a!==s||!d:!s.has(a))throw new TypeError("Cannot write private member to an object whose class did not declare it");return f==="a"?d.call(a,c):d?d.value=c:s.set(a,c),c}t(Rvt,"__classPrivateFieldSet");var zo;(function(a){a.errToObj=s=>typeof s=="string"?{message:s}:s||{},a.toString=s=>typeof s=="string"?s:s?.message})(zo||(zo={}));var HK,GK,bC=class{static{t(this,"ParseInputLazyPath")}constructor(s,c,f,d){this._cachedPath=[],this.parent=s,this.data=c,this._path=f,this._key=d}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}},Ovt=t((a,s)=>{if(QK(s))return{success:!0,data:s.value};if(!a.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let c=new SS(a.common.issues);return this._error=c,this._error}}},"handleResult");function Dl(a){if(!a)return{};let{errorMap:s,invalid_type_error:c,required_error:f,description:d}=a;if(s&&(c||f))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return s?{errorMap:s,description:d}:{errorMap:t((E,A)=>{var O,M;let{message:W}=a;return E.code==="invalid_enum_value"?{message:W??A.defaultError}:typeof A.data>"u"?{message:(O=W??f)!==null&&O!==void 0?O:A.defaultError}:E.code!=="invalid_type"?{message:A.defaultError}:{message:(M=W??c)!==null&&M!==void 0?M:A.defaultError}},"customMap"),description:d}}t(Dl,"processCreateParams");var Al=class{static{t(this,"ZodType")}constructor(s){this.spa=this.safeParseAsync,this._def=s,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)}get description(){return this._def.description}_getType(s){return xN(s.data)}_getOrReturnCtx(s,c){return c||{common:s.parent.common,data:s.data,parsedType:xN(s.data),schemaErrorMap:this._def.errorMap,path:s.path,parent:s.parent}}_processInputParams(s){return{status:new d1,ctx:{common:s.parent.common,data:s.data,parsedType:xN(s.data),schemaErrorMap:this._def.errorMap,path:s.path,parent:s.parent}}}_parseSync(s){let c=this._parse(s);if(KK(c))throw new Error("Synchronous parse encountered promise.");return c}_parseAsync(s){let c=this._parse(s);return Promise.resolve(c)}parse(s,c){let f=this.safeParse(s,c);if(f.success)return f.data;throw f.error}safeParse(s,c){var f;let d={common:{issues:[],async:(f=c?.async)!==null&&f!==void 0?f:!1,contextualErrorMap:c?.errorMap},path:c?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:s,parsedType:xN(s)},v=this._parseSync({data:s,path:d.path,parent:d});return Ovt(d,v)}async parseAsync(s,c){let f=await this.safeParseAsync(s,c);if(f.success)return f.data;throw f.error}async safeParseAsync(s,c){let f={common:{issues:[],contextualErrorMap:c?.errorMap,async:!0},path:c?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:s,parsedType:xN(s)},d=this._parse({data:s,path:f.path,parent:f}),v=await(KK(d)?d:Promise.resolve(d));return Ovt(f,v)}refine(s,c){let f=t(d=>typeof c=="string"||typeof c>"u"?{message:c}:typeof c=="function"?c(d):c,"getIssueProperties");return this._refinement((d,v)=>{let E=s(d),A=t(()=>v.addIssue({code:Ds.custom,...f(d)}),"setError");return typeof Promise<"u"&&E instanceof Promise?E.then(O=>O?!0:(A(),!1)):E?!0:(A(),!1)})}refinement(s,c){return this._refinement((f,d)=>s(f)?!0:(d.addIssue(typeof c=="function"?c(f,d):c),!1))}_refinement(s){return new TS({schema:this,typeName:Oc.ZodEffects,effect:{type:"refinement",refinement:s}})}superRefine(s){return this._refinement(s)}optional(){return vC.create(this,this._def)}nullable(){return QA.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return a6.create(this,this._def)}promise(){return kN.create(this,this._def)}or(s){return c7.create([this,s],this._def)}and(s){return l7.create(this,s,this._def)}transform(s){return new TS({...Dl(this._def),schema:this,typeName:Oc.ZodEffects,effect:{type:"transform",transform:s}})}default(s){let c=typeof s=="function"?s:()=>s;return new d7({...Dl(this._def),innerType:this,defaultValue:c,typeName:Oc.ZodDefault})}brand(){return new YK({typeName:Oc.ZodBranded,type:this,...Dl(this._def)})}catch(s){let c=typeof s=="function"?s:()=>s;return new m7({...Dl(this._def),innerType:this,catchValue:c,typeName:Oc.ZodCatch})}describe(s){let c=this.constructor;return new c({...this._def,description:s})}pipe(s){return XK.create(this,s)}readonly(){return h7.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},zSr=/^c[^\s-]{8,}$/i,VSr=/^[0-9a-z]+$/,WSr=/^[0-9A-HJKMNP-TV-Z]{26}$/,HSr=/^[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,GSr=/^[a-z0-9_-]{21}$/i,QSr=/^[-+]?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)?)??$/,KSr=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,YSr="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",B7e,XSr=/^(?:(?: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])$/,ZSr=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,eTr=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Mvt="((\\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])))",tTr=new RegExp(`^${Mvt}$`);function jvt(a){let s="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return a.precision?s=`${s}\\.\\d{${a.precision}}`:a.precision==null&&(s=`${s}(\\.\\d+)?`),s}t(jvt,"timeRegexSource");function rTr(a){return new RegExp(`^${jvt(a)}$`)}t(rTr,"timeRegex");function Bvt(a){let s=`${Mvt}T${jvt(a)}`,c=[];return c.push(a.local?"Z?":"Z"),a.offset&&c.push("([+-]\\d{2}:?\\d{2})"),s=`${s}(${c.join("|")})`,new RegExp(`^${s}$`)}t(Bvt,"datetimeRegex");function nTr(a,s){return!!((s==="v4"||!s)&&XSr.test(a)||(s==="v6"||!s)&&ZSr.test(a))}t(nTr,"isValidIP");var DN=class a extends Al{static{t(this,"ZodString")}_parse(s){if(this._def.coerce&&(s.data=String(s.data)),this._getType(s)!==Ka.string){let v=this._getOrReturnCtx(s);return ja(v,{code:Ds.invalid_type,expected:Ka.string,received:v.parsedType}),Bc}let f=new d1,d;for(let v of this._def.checks)if(v.kind==="min")s.data.length<v.value&&(d=this._getOrReturnCtx(s,d),ja(d,{code:Ds.too_small,minimum:v.value,type:"string",inclusive:!0,exact:!1,message:v.message}),f.dirty());else if(v.kind==="max")s.data.length>v.value&&(d=this._getOrReturnCtx(s,d),ja(d,{code:Ds.too_big,maximum:v.value,type:"string",inclusive:!0,exact:!1,message:v.message}),f.dirty());else if(v.kind==="length"){let E=s.data.length>v.value,A=s.data.length<v.value;(E||A)&&(d=this._getOrReturnCtx(s,d),E?ja(d,{code:Ds.too_big,maximum:v.value,type:"string",inclusive:!0,exact:!0,message:v.message}):A&&ja(d,{code:Ds.too_small,minimum:v.value,type:"string",inclusive:!0,exact:!0,message:v.message}),f.dirty())}else if(v.kind==="email")KSr.test(s.data)||(d=this._getOrReturnCtx(s,d),ja(d,{validation:"email",code:Ds.invalid_string,message:v.message}),f.dirty());else if(v.kind==="emoji")B7e||(B7e=new RegExp(YSr,"u")),B7e.test(s.data)||(d=this._getOrReturnCtx(s,d),ja(d,{validation:"emoji",code:Ds.invalid_string,message:v.message}),f.dirty());else if(v.kind==="uuid")HSr.test(s.data)||(d=this._getOrReturnCtx(s,d),ja(d,{validation:"uuid",code:Ds.invalid_string,message:v.message}),f.dirty());else if(v.kind==="nanoid")GSr.test(s.data)||(d=this._getOrReturnCtx(s,d),ja(d,{validation:"nanoid",code:Ds.invalid_string,message:v.message}),f.dirty());else if(v.kind==="cuid")zSr.test(s.data)||(d=this._getOrReturnCtx(s,d),ja(d,{validation:"cuid",code:Ds.invalid_string,message:v.message}),f.dirty());else if(v.kind==="cuid2")VSr.test(s.data)||(d=this._getOrReturnCtx(s,d),ja(d,{validation:"cuid2",code:Ds.invalid_string,message:v.message}),f.dirty());else if(v.kind==="ulid")WSr.test(s.data)||(d=this._getOrReturnCtx(s,d),ja(d,{validation:"ulid",code:Ds.invalid_string,message:v.message}),f.dirty());else if(v.kind==="url")try{new URL(s.data)}catch{d=this._getOrReturnCtx(s,d),ja(d,{validation:"url",code:Ds.invalid_string,message:v.message}),f.dirty()}else v.kind==="regex"?(v.regex.lastIndex=0,v.regex.test(s.data)||(d=this._getOrReturnCtx(s,d),ja(d,{validation:"regex",code:Ds.invalid_string,message:v.message}),f.dirty())):v.kind==="trim"?s.data=s.data.trim():v.kind==="includes"?s.data.includes(v.value,v.position)||(d=this._getOrReturnCtx(s,d),ja(d,{code:Ds.invalid_string,validation:{includes:v.value,position:v.position},message:v.message}),f.dirty()):v.kind==="toLowerCase"?s.data=s.data.toLowerCase():v.kind==="toUpperCase"?s.data=s.data.toUpperCase():v.kind==="startsWith"?s.data.startsWith(v.value)||(d=this._getOrReturnCtx(s,d),ja(d,{code:Ds.invalid_string,validation:{startsWith:v.value},message:v.message}),f.dirty()):v.kind==="endsWith"?s.data.endsWith(v.value)||(d=this._getOrReturnCtx(s,d),ja(d,{code:Ds.invalid_string,validation:{endsWith:v.value},message:v.message}),f.dirty()):v.kind==="datetime"?Bvt(v).test(s.data)||(d=this._getOrReturnCtx(s,d),ja(d,{code:Ds.invalid_string,validation:"datetime",message:v.message}),f.dirty()):v.kind==="date"?tTr.test(s.data)||(d=this._getOrReturnCtx(s,d),ja(d,{code:Ds.invalid_string,validation:"date",message:v.message}),f.dirty()):v.kind==="time"?rTr(v).test(s.data)||(d=this._getOrReturnCtx(s,d),ja(d,{code:Ds.invalid_string,validation:"time",message:v.message}),f.dirty()):v.kind==="duration"?QSr.test(s.data)||(d=this._getOrReturnCtx(s,d),ja(d,{validation:"duration",code:Ds.invalid_string,message:v.message}),f.dirty()):v.kind==="ip"?nTr(s.data,v.version)||(d=this._getOrReturnCtx(s,d),ja(d,{validation:"ip",code:Ds.invalid_string,message:v.message}),f.dirty()):v.kind==="base64"?eTr.test(s.data)||(d=this._getOrReturnCtx(s,d),ja(d,{validation:"base64",code:Ds.invalid_string,message:v.message}),f.dirty()):sf.assertNever(v);return{status:f.value,value:s.data}}_regex(s,c,f){return this.refinement(d=>s.test(d),{validation:c,code:Ds.invalid_string,...zo.errToObj(f)})}_addCheck(s){return new a({...this._def,checks:[...this._def.checks,s]})}email(s){return this._addCheck({kind:"email",...zo.errToObj(s)})}url(s){return this._addCheck({kind:"url",...zo.errToObj(s)})}emoji(s){return this._addCheck({kind:"emoji",...zo.errToObj(s)})}uuid(s){return this._addCheck({kind:"uuid",...zo.errToObj(s)})}nanoid(s){return this._addCheck({kind:"nanoid",...zo.errToObj(s)})}cuid(s){return this._addCheck({kind:"cuid",...zo.errToObj(s)})}cuid2(s){return this._addCheck({kind:"cuid2",...zo.errToObj(s)})}ulid(s){return this._addCheck({kind:"ulid",...zo.errToObj(s)})}base64(s){return this._addCheck({kind:"base64",...zo.errToObj(s)})}ip(s){return this._addCheck({kind:"ip",...zo.errToObj(s)})}datetime(s){var c,f;return typeof s=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:s}):this._addCheck({kind:"datetime",precision:typeof s?.precision>"u"?null:s?.precision,offset:(c=s?.offset)!==null&&c!==void 0?c:!1,local:(f=s?.local)!==null&&f!==void 0?f:!1,...zo.errToObj(s?.message)})}date(s){return this._addCheck({kind:"date",message:s})}time(s){return typeof s=="string"?this._addCheck({kind:"time",precision:null,message:s}):this._addCheck({kind:"time",precision:typeof s?.precision>"u"?null:s?.precision,...zo.errToObj(s?.message)})}duration(s){return this._addCheck({kind:"duration",...zo.errToObj(s)})}regex(s,c){return this._addCheck({kind:"regex",regex:s,...zo.errToObj(c)})}includes(s,c){return this._addCheck({kind:"includes",value:s,position:c?.position,...zo.errToObj(c?.message)})}startsWith(s,c){return this._addCheck({kind:"startsWith",value:s,...zo.errToObj(c)})}endsWith(s,c){return this._addCheck({kind:"endsWith",value:s,...zo.errToObj(c)})}min(s,c){return this._addCheck({kind:"min",value:s,...zo.errToObj(c)})}max(s,c){return this._addCheck({kind:"max",value:s,...zo.errToObj(c)})}length(s,c){return this._addCheck({kind:"length",value:s,...zo.errToObj(c)})}nonempty(s){return this.min(1,zo.errToObj(s))}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(s=>s.kind==="datetime")}get isDate(){return!!this._def.checks.find(s=>s.kind==="date")}get isTime(){return!!this._def.checks.find(s=>s.kind==="time")}get isDuration(){return!!this._def.checks.find(s=>s.kind==="duration")}get isEmail(){return!!this._def.checks.find(s=>s.kind==="email")}get isURL(){return!!this._def.checks.find(s=>s.kind==="url")}get isEmoji(){return!!this._def.checks.find(s=>s.kind==="emoji")}get isUUID(){return!!this._def.checks.find(s=>s.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(s=>s.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(s=>s.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(s=>s.kind==="cuid2")}get isULID(){return!!this._def.checks.find(s=>s.kind==="ulid")}get isIP(){return!!this._def.checks.find(s=>s.kind==="ip")}get isBase64(){return!!this._def.checks.find(s=>s.kind==="base64")}get minLength(){let s=null;for(let c of this._def.checks)c.kind==="min"&&(s===null||c.value>s)&&(s=c.value);return s}get maxLength(){let s=null;for(let c of this._def.checks)c.kind==="max"&&(s===null||c.value<s)&&(s=c.value);return s}};DN.create=a=>{var s;return new DN({checks:[],typeName:Oc.ZodString,coerce:(s=a?.coerce)!==null&&s!==void 0?s:!1,...Dl(a)})};function iTr(a,s){let c=(a.toString().split(".")[1]||"").length,f=(s.toString().split(".")[1]||"").length,d=c>f?c:f,v=parseInt(a.toFixed(d).replace(".","")),E=parseInt(s.toFixed(d).replace(".",""));return v%E/Math.pow(10,d)}t(iTr,"floatSafeRemainder");var r7=class a extends Al{static{t(this,"ZodNumber")}constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(s){if(this._def.coerce&&(s.data=Number(s.data)),this._getType(s)!==Ka.number){let v=this._getOrReturnCtx(s);return ja(v,{code:Ds.invalid_type,expected:Ka.number,received:v.parsedType}),Bc}let f,d=new d1;for(let v of this._def.checks)v.kind==="int"?sf.isInteger(s.data)||(f=this._getOrReturnCtx(s,f),ja(f,{code:Ds.invalid_type,expected:"integer",received:"float",message:v.message}),d.dirty()):v.kind==="min"?(v.inclusive?s.data<v.value:s.data<=v.value)&&(f=this._getOrReturnCtx(s,f),ja(f,{code:Ds.too_small,minimum:v.value,type:"number",inclusive:v.inclusive,exact:!1,message:v.message}),d.dirty()):v.kind==="max"?(v.inclusive?s.data>v.value:s.data>=v.value)&&(f=this._getOrReturnCtx(s,f),ja(f,{code:Ds.too_big,maximum:v.value,type:"number",inclusive:v.inclusive,exact:!1,message:v.message}),d.dirty()):v.kind==="multipleOf"?iTr(s.data,v.value)!==0&&(f=this._getOrReturnCtx(s,f),ja(f,{code:Ds.not_multiple_of,multipleOf:v.value,message:v.message}),d.dirty()):v.kind==="finite"?Number.isFinite(s.data)||(f=this._getOrReturnCtx(s,f),ja(f,{code:Ds.not_finite,message:v.message}),d.dirty()):sf.assertNever(v);return{status:d.value,value:s.data}}gte(s,c){return this.setLimit("min",s,!0,zo.toString(c))}gt(s,c){return this.setLimit("min",s,!1,zo.toString(c))}lte(s,c){return this.setLimit("max",s,!0,zo.toString(c))}lt(s,c){return this.setLimit("max",s,!1,zo.toString(c))}setLimit(s,c,f,d){return new a({...this._def,checks:[...this._def.checks,{kind:s,value:c,inclusive:f,message:zo.toString(d)}]})}_addCheck(s){return new a({...this._def,checks:[...this._def.checks,s]})}int(s){return this._addCheck({kind:"int",message:zo.toString(s)})}positive(s){return this._addCheck({kind:"min",value:0,inclusive:!1,message:zo.toString(s)})}negative(s){return this._addCheck({kind:"max",value:0,inclusive:!1,message:zo.toString(s)})}nonpositive(s){return this._addCheck({kind:"max",value:0,inclusive:!0,message:zo.toString(s)})}nonnegative(s){return this._addCheck({kind:"min",value:0,inclusive:!0,message:zo.toString(s)})}multipleOf(s,c){return this._addCheck({kind:"multipleOf",value:s,message:zo.toString(c)})}finite(s){return this._addCheck({kind:"finite",message:zo.toString(s)})}safe(s){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:zo.toString(s)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:zo.toString(s)})}get minValue(){let s=null;for(let c of this._def.checks)c.kind==="min"&&(s===null||c.value>s)&&(s=c.value);return s}get maxValue(){let s=null;for(let c of this._def.checks)c.kind==="max"&&(s===null||c.value<s)&&(s=c.value);return s}get isInt(){return!!this._def.checks.find(s=>s.kind==="int"||s.kind==="multipleOf"&&sf.isInteger(s.value))}get isFinite(){let s=null,c=null;for(let f of this._def.checks){if(f.kind==="finite"||f.kind==="int"||f.kind==="multipleOf")return!0;f.kind==="min"?(c===null||f.value>c)&&(c=f.value):f.kind==="max"&&(s===null||f.value<s)&&(s=f.value)}return Number.isFinite(c)&&Number.isFinite(s)}};r7.create=a=>new r7({checks:[],typeName:Oc.ZodNumber,coerce:a?.coerce||!1,...Dl(a)});var n7=class a extends Al{static{t(this,"ZodBigInt")}constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(s){if(this._def.coerce&&(s.data=BigInt(s.data)),this._getType(s)!==Ka.bigint){let v=this._getOrReturnCtx(s);return ja(v,{code:Ds.invalid_type,expected:Ka.bigint,received:v.parsedType}),Bc}let f,d=new d1;for(let v of this._def.checks)v.kind==="min"?(v.inclusive?s.data<v.value:s.data<=v.value)&&(f=this._getOrReturnCtx(s,f),ja(f,{code:Ds.too_small,type:"bigint",minimum:v.value,inclusive:v.inclusive,message:v.message}),d.dirty()):v.kind==="max"?(v.inclusive?s.data>v.value:s.data>=v.value)&&(f=this._getOrReturnCtx(s,f),ja(f,{code:Ds.too_big,type:"bigint",maximum:v.value,inclusive:v.inclusive,message:v.message}),d.dirty()):v.kind==="multipleOf"?s.data%v.value!==BigInt(0)&&(f=this._getOrReturnCtx(s,f),ja(f,{code:Ds.not_multiple_of,multipleOf:v.value,message:v.message}),d.dirty()):sf.assertNever(v);return{status:d.value,value:s.data}}gte(s,c){return this.setLimit("min",s,!0,zo.toString(c))}gt(s,c){return this.setLimit("min",s,!1,zo.toString(c))}lte(s,c){return this.setLimit("max",s,!0,zo.toString(c))}lt(s,c){return this.setLimit("max",s,!1,zo.toString(c))}setLimit(s,c,f,d){return new a({...this._def,checks:[...this._def.checks,{kind:s,value:c,inclusive:f,message:zo.toString(d)}]})}_addCheck(s){return new a({...this._def,checks:[...this._def.checks,s]})}positive(s){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:zo.toString(s)})}negative(s){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:zo.toString(s)})}nonpositive(s){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:zo.toString(s)})}nonnegative(s){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:zo.toString(s)})}multipleOf(s,c){return this._addCheck({kind:"multipleOf",value:s,message:zo.toString(c)})}get minValue(){let s=null;for(let c of this._def.checks)c.kind==="min"&&(s===null||c.value>s)&&(s=c.value);return s}get maxValue(){let s=null;for(let c of this._def.checks)c.kind==="max"&&(s===null||c.value<s)&&(s=c.value);return s}};n7.create=a=>{var s;return new n7({checks:[],typeName:Oc.ZodBigInt,coerce:(s=a?.coerce)!==null&&s!==void 0?s:!1,...Dl(a)})};var i7=class extends Al{static{t(this,"ZodBoolean")}_parse(s){if(this._def.coerce&&(s.data=!!s.data),this._getType(s)!==Ka.boolean){let f=this._getOrReturnCtx(s);return ja(f,{code:Ds.invalid_type,expected:Ka.boolean,received:f.parsedType}),Bc}return Tv(s.data)}};i7.create=a=>new i7({typeName:Oc.ZodBoolean,coerce:a?.coerce||!1,...Dl(a)});var s7=class a extends Al{static{t(this,"ZodDate")}_parse(s){if(this._def.coerce&&(s.data=new Date(s.data)),this._getType(s)!==Ka.date){let v=this._getOrReturnCtx(s);return ja(v,{code:Ds.invalid_type,expected:Ka.date,received:v.parsedType}),Bc}if(isNaN(s.data.getTime())){let v=this._getOrReturnCtx(s);return ja(v,{code:Ds.invalid_date}),Bc}let f=new d1,d;for(let v of this._def.checks)v.kind==="min"?s.data.getTime()<v.value&&(d=this._getOrReturnCtx(s,d),ja(d,{code:Ds.too_small,message:v.message,inclusive:!0,exact:!1,minimum:v.value,type:"date"}),f.dirty()):v.kind==="max"?s.data.getTime()>v.value&&(d=this._getOrReturnCtx(s,d),ja(d,{code:Ds.too_big,message:v.message,inclusive:!0,exact:!1,maximum:v.value,type:"date"}),f.dirty()):sf.assertNever(v);return{status:f.value,value:new Date(s.data.getTime())}}_addCheck(s){return new a({...this._def,checks:[...this._def.checks,s]})}min(s,c){return this._addCheck({kind:"min",value:s.getTime(),message:zo.toString(c)})}max(s,c){return this._addCheck({kind:"max",value:s.getTime(),message:zo.toString(c)})}get minDate(){let s=null;for(let c of this._def.checks)c.kind==="min"&&(s===null||c.value>s)&&(s=c.value);return s!=null?new Date(s):null}get maxDate(){let s=null;for(let c of this._def.checks)c.kind==="max"&&(s===null||c.value<s)&&(s=c.value);return s!=null?new Date(s):null}};s7.create=a=>new s7({checks:[],coerce:a?.coerce||!1,typeName:Oc.ZodDate,...Dl(a)});var MB=class extends Al{static{t(this,"ZodSymbol")}_parse(s){if(this._getType(s)!==Ka.symbol){let f=this._getOrReturnCtx(s);return ja(f,{code:Ds.invalid_type,expected:Ka.symbol,received:f.parsedType}),Bc}return Tv(s.data)}};MB.create=a=>new MB({typeName:Oc.ZodSymbol,...Dl(a)});var a7=class extends Al{static{t(this,"ZodUndefined")}_parse(s){if(this._getType(s)!==Ka.undefined){let f=this._getOrReturnCtx(s);return ja(f,{code:Ds.invalid_type,expected:Ka.undefined,received:f.parsedType}),Bc}return Tv(s.data)}};a7.create=a=>new a7({typeName:Oc.ZodUndefined,...Dl(a)});var o7=class extends Al{static{t(this,"ZodNull")}_parse(s){if(this._getType(s)!==Ka.null){let f=this._getOrReturnCtx(s);return ja(f,{code:Ds.invalid_type,expected:Ka.null,received:f.parsedType}),Bc}return Tv(s.data)}};o7.create=a=>new o7({typeName:Oc.ZodNull,...Dl(a)});var AN=class extends Al{static{t(this,"ZodAny")}constructor(){super(...arguments),this._any=!0}_parse(s){return Tv(s.data)}};AN.create=a=>new AN({typeName:Oc.ZodAny,...Dl(a)});var s6=class extends Al{static{t(this,"ZodUnknown")}constructor(){super(...arguments),this._unknown=!0}_parse(s){return Tv(s.data)}};s6.create=a=>new s6({typeName:Oc.ZodUnknown,...Dl(a)});var Ix=class extends Al{static{t(this,"ZodNever")}_parse(s){let c=this._getOrReturnCtx(s);return ja(c,{code:Ds.invalid_type,expected:Ka.never,received:c.parsedType}),Bc}};Ix.create=a=>new Ix({typeName:Oc.ZodNever,...Dl(a)});var jB=class extends Al{static{t(this,"ZodVoid")}_parse(s){if(this._getType(s)!==Ka.undefined){let f=this._getOrReturnCtx(s);return ja(f,{code:Ds.invalid_type,expected:Ka.void,received:f.parsedType}),Bc}return Tv(s.data)}};jB.create=a=>new jB({typeName:Oc.ZodVoid,...Dl(a)});var a6=class a extends Al{static{t(this,"ZodArray")}_parse(s){let{ctx:c,status:f}=this._processInputParams(s),d=this._def;if(c.parsedType!==Ka.array)return ja(c,{code:Ds.invalid_type,expected:Ka.array,received:c.parsedType}),Bc;if(d.exactLength!==null){let E=c.data.length>d.exactLength.value,A=c.data.length<d.exactLength.value;(E||A)&&(ja(c,{code:E?Ds.too_big:Ds.too_small,minimum:A?d.exactLength.value:void 0,maximum:E?d.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:d.exactLength.message}),f.dirty())}if(d.minLength!==null&&c.data.length<d.minLength.value&&(ja(c,{code:Ds.too_small,minimum:d.minLength.value,type:"array",inclusive:!0,exact:!1,message:d.minLength.message}),f.dirty()),d.maxLength!==null&&c.data.length>d.maxLength.value&&(ja(c,{code:Ds.too_big,maximum:d.maxLength.value,type:"array",inclusive:!0,exact:!1,message:d.maxLength.message}),f.dirty()),c.common.async)return Promise.all([...c.data].map((E,A)=>d.type._parseAsync(new bC(c,E,c.path,A)))).then(E=>d1.mergeArray(f,E));let v=[...c.data].map((E,A)=>d.type._parseSync(new bC(c,E,c.path,A)));return d1.mergeArray(f,v)}get element(){return this._def.type}min(s,c){return new a({...this._def,minLength:{value:s,message:zo.toString(c)}})}max(s,c){return new a({...this._def,maxLength:{value:s,message:zo.toString(c)}})}length(s,c){return new a({...this._def,exactLength:{value:s,message:zo.toString(c)}})}nonempty(s){return this.min(1,s)}};a6.create=(a,s)=>new a6({type:a,minLength:null,maxLength:null,exactLength:null,typeName:Oc.ZodArray,...Dl(s)});function FB(a){if(a instanceof Mb){let s={};for(let c in a.shape){let f=a.shape[c];s[c]=vC.create(FB(f))}return new Mb({...a._def,shape:t(()=>s,"shape")})}else return a instanceof a6?new a6({...a._def,type:FB(a.element)}):a instanceof vC?vC.create(FB(a.unwrap())):a instanceof QA?QA.create(FB(a.unwrap())):a instanceof GA?GA.create(a.items.map(s=>FB(s))):a}t(FB,"deepPartialify");var Mb=class a extends Al{static{t(this,"ZodObject")}constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let s=this._def.shape(),c=sf.objectKeys(s);return this._cached={shape:s,keys:c}}_parse(s){if(this._getType(s)!==Ka.object){let M=this._getOrReturnCtx(s);return ja(M,{code:Ds.invalid_type,expected:Ka.object,received:M.parsedType}),Bc}let{status:f,ctx:d}=this._processInputParams(s),{shape:v,keys:E}=this._getCached(),A=[];if(!(this._def.catchall instanceof Ix&&this._def.unknownKeys==="strip"))for(let M in d.data)E.includes(M)||A.push(M);let O=[];for(let M of E){let W=v[M],$=d.data[M];O.push({key:{status:"valid",value:M},value:W._parse(new bC(d,$,d.path,M)),alwaysSet:M in d.data})}if(this._def.catchall instanceof Ix){let M=this._def.unknownKeys;if(M==="passthrough")for(let W of A)O.push({key:{status:"valid",value:W},value:{status:"valid",value:d.data[W]}});else if(M==="strict")A.length>0&&(ja(d,{code:Ds.unrecognized_keys,keys:A}),f.dirty());else if(M!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let M=this._def.catchall;for(let W of A){let $=d.data[W];O.push({key:{status:"valid",value:W},value:M._parse(new bC(d,$,d.path,W)),alwaysSet:W in d.data})}}return d.common.async?Promise.resolve().then(async()=>{let M=[];for(let W of O){let $=await W.key,Q=await W.value;M.push({key:$,value:Q,alwaysSet:W.alwaysSet})}return M}).then(M=>d1.mergeObjectSync(f,M)):d1.mergeObjectSync(f,O)}get shape(){return this._def.shape()}strict(s){return zo.errToObj,new a({...this._def,unknownKeys:"strict",...s!==void 0?{errorMap:t((c,f)=>{var d,v,E,A;let O=(E=(v=(d=this._def).errorMap)===null||v===void 0?void 0:v.call(d,c,f).message)!==null&&E!==void 0?E:f.defaultError;return c.code==="unrecognized_keys"?{message:(A=zo.errToObj(s).message)!==null&&A!==void 0?A:O}:{message:O}},"errorMap")}:{}})}strip(){return new a({...this._def,unknownKeys:"strip"})}passthrough(){return new a({...this._def,unknownKeys:"passthrough"})}extend(s){return new a({...this._def,shape:t(()=>({...this._def.shape(),...s}),"shape")})}merge(s){return new a({unknownKeys:s._def.unknownKeys,catchall:s._def.catchall,shape:t(()=>({...this._def.shape(),...s._def.shape()}),"shape"),typeName:Oc.ZodObject})}setKey(s,c){return this.augment({[s]:c})}catchall(s){return new a({...this._def,catchall:s})}pick(s){let c={};return sf.objectKeys(s).forEach(f=>{s[f]&&this.shape[f]&&(c[f]=this.shape[f])}),new a({...this._def,shape:t(()=>c,"shape")})}omit(s){let c={};return sf.objectKeys(this.shape).forEach(f=>{s[f]||(c[f]=this.shape[f])}),new a({...this._def,shape:t(()=>c,"shape")})}deepPartial(){return FB(this)}partial(s){let c={};return sf.objectKeys(this.shape).forEach(f=>{let d=this.shape[f];s&&!s[f]?c[f]=d:c[f]=d.optional()}),new a({...this._def,shape:t(()=>c,"shape")})}required(s){let c={};return sf.objectKeys(this.shape).forEach(f=>{if(s&&!s[f])c[f]=this.shape[f];else{let v=this.shape[f];for(;v instanceof vC;)v=v._def.innerType;c[f]=v}}),new a({...this._def,shape:t(()=>c,"shape")})}keyof(){return Uvt(sf.objectKeys(this.shape))}};Mb.create=(a,s)=>new Mb({shape:t(()=>a,"shape"),unknownKeys:"strip",catchall:Ix.create(),typeName:Oc.ZodObject,...Dl(s)});Mb.strictCreate=(a,s)=>new Mb({shape:t(()=>a,"shape"),unknownKeys:"strict",catchall:Ix.create(),typeName:Oc.ZodObject,...Dl(s)});Mb.lazycreate=(a,s)=>new Mb({shape:a,unknownKeys:"strip",catchall:Ix.create(),typeName:Oc.ZodObject,...Dl(s)});var c7=class extends Al{static{t(this,"ZodUnion")}_parse(s){let{ctx:c}=this._processInputParams(s),f=this._def.options;function d(v){for(let A of v)if(A.result.status==="valid")return A.result;for(let A of v)if(A.result.status==="dirty")return c.common.issues.push(...A.ctx.common.issues),A.result;let E=v.map(A=>new SS(A.ctx.common.issues));return ja(c,{code:Ds.invalid_union,unionErrors:E}),Bc}if(t(d,"handleResults"),c.common.async)return Promise.all(f.map(async v=>{let E={...c,common:{...c.common,issues:[]},parent:null};return{result:await v._parseAsync({data:c.data,path:c.path,parent:E}),ctx:E}})).then(d);{let v,E=[];for(let O of f){let M={...c,common:{...c.common,issues:[]},parent:null},W=O._parseSync({data:c.data,path:c.path,parent:M});if(W.status==="valid")return W;W.status==="dirty"&&!v&&(v={result:W,ctx:M}),M.common.issues.length&&E.push(M.common.issues)}if(v)return c.common.issues.push(...v.ctx.common.issues),v.result;let A=E.map(O=>new SS(O));return ja(c,{code:Ds.invalid_union,unionErrors:A}),Bc}}get options(){return this._def.options}};c7.create=(a,s)=>new c7({options:a,typeName:Oc.ZodUnion,...Dl(s)});var i6=t(a=>a instanceof u7?i6(a.schema):a instanceof TS?i6(a.innerType()):a instanceof f7?[a.value]:a instanceof _7?a.options:a instanceof p7?sf.objectValues(a.enum):a instanceof d7?i6(a._def.innerType):a instanceof a7?[void 0]:a instanceof o7?[null]:a instanceof vC?[void 0,...i6(a.unwrap())]:a instanceof QA?[null,...i6(a.unwrap())]:a instanceof YK||a instanceof h7?i6(a.unwrap()):a instanceof m7?i6(a._def.innerType):[],"getDiscriminator"),bpe=class a extends Al{static{t(this,"ZodDiscriminatedUnion")}_parse(s){let{ctx:c}=this._processInputParams(s);if(c.parsedType!==Ka.object)return ja(c,{code:Ds.invalid_type,expected:Ka.object,received:c.parsedType}),Bc;let f=this.discriminator,d=c.data[f],v=this.optionsMap.get(d);return v?c.common.async?v._parseAsync({data:c.data,path:c.path,parent:c}):v._parseSync({data:c.data,path:c.path,parent:c}):(ja(c,{code:Ds.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[f]}),Bc)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(s,c,f){let d=new Map;for(let v of c){let E=i6(v.shape[s]);if(!E.length)throw new Error(`A discriminator value for key \`${s}\` could not be extracted from all schema options`);for(let A of E){if(d.has(A))throw new Error(`Discriminator property ${String(s)} has duplicate value ${String(A)}`);d.set(A,v)}}return new a({typeName:Oc.ZodDiscriminatedUnion,discriminator:s,options:c,optionsMap:d,...Dl(f)})}};function q7e(a,s){let c=xN(a),f=xN(s);if(a===s)return{valid:!0,data:a};if(c===Ka.object&&f===Ka.object){let d=sf.objectKeys(s),v=sf.objectKeys(a).filter(A=>d.indexOf(A)!==-1),E={...a,...s};for(let A of v){let O=q7e(a[A],s[A]);if(!O.valid)return{valid:!1};E[A]=O.data}return{valid:!0,data:E}}else if(c===Ka.array&&f===Ka.array){if(a.length!==s.length)return{valid:!1};let d=[];for(let v=0;v<a.length;v++){let E=a[v],A=s[v],O=q7e(E,A);if(!O.valid)return{valid:!1};d.push(O.data)}return{valid:!0,data:d}}else return c===Ka.date&&f===Ka.date&&+a==+s?{valid:!0,data:a}:{valid:!1}}t(q7e,"mergeValues");var l7=class extends Al{static{t(this,"ZodIntersection")}_parse(s){let{status:c,ctx:f}=this._processInputParams(s),d=t((v,E)=>{if($7e(v)||$7e(E))return Bc;let A=q7e(v.value,E.value);return A.valid?((J7e(v)||J7e(E))&&c.dirty(),{status:c.value,value:A.data}):(ja(f,{code:Ds.invalid_intersection_types}),Bc)},"handleParsed");return f.common.async?Promise.all([this._def.left._parseAsync({data:f.data,path:f.path,parent:f}),this._def.right._parseAsync({data:f.data,path:f.path,parent:f})]).then(([v,E])=>d(v,E)):d(this._def.left._parseSync({data:f.data,path:f.path,parent:f}),this._def.right._parseSync({data:f.data,path:f.path,parent:f}))}};l7.create=(a,s,c)=>new l7({left:a,right:s,typeName:Oc.ZodIntersection,...Dl(c)});var GA=class a extends Al{static{t(this,"ZodTuple")}_parse(s){let{status:c,ctx:f}=this._processInputParams(s);if(f.parsedType!==Ka.array)return ja(f,{code:Ds.invalid_type,expected:Ka.array,received:f.parsedType}),Bc;if(f.data.length<this._def.items.length)return ja(f,{code:Ds.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Bc;!this._def.rest&&f.data.length>this._def.items.length&&(ja(f,{code:Ds.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),c.dirty());let v=[...f.data].map((E,A)=>{let O=this._def.items[A]||this._def.rest;return O?O._parse(new bC(f,E,f.path,A)):null}).filter(E=>!!E);return f.common.async?Promise.all(v).then(E=>d1.mergeArray(c,E)):d1.mergeArray(c,v)}get items(){return this._def.items}rest(s){return new a({...this._def,rest:s})}};GA.create=(a,s)=>{if(!Array.isArray(a))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new GA({items:a,typeName:Oc.ZodTuple,rest:null,...Dl(s)})};var Spe=class a extends Al{static{t(this,"ZodRecord")}get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(s){let{status:c,ctx:f}=this._processInputParams(s);if(f.parsedType!==Ka.object)return ja(f,{code:Ds.invalid_type,expected:Ka.object,received:f.parsedType}),Bc;let d=[],v=this._def.keyType,E=this._def.valueType;for(let A in f.data)d.push({key:v._parse(new bC(f,A,f.path,A)),value:E._parse(new bC(f,f.data[A],f.path,A)),alwaysSet:A in f.data});return f.common.async?d1.mergeObjectAsync(c,d):d1.mergeObjectSync(c,d)}get element(){return this._def.valueType}static create(s,c,f){return c instanceof Al?new a({keyType:s,valueType:c,typeName:Oc.ZodRecord,...Dl(f)}):new a({keyType:DN.create(),valueType:s,typeName:Oc.ZodRecord,...Dl(c)})}},BB=class extends Al{static{t(this,"ZodMap")}get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(s){let{status:c,ctx:f}=this._processInputParams(s);if(f.parsedType!==Ka.map)return ja(f,{code:Ds.invalid_type,expected:Ka.map,received:f.parsedType}),Bc;let d=this._def.keyType,v=this._def.valueType,E=[...f.data.entries()].map(([A,O],M)=>({key:d._parse(new bC(f,A,f.path,[M,"key"])),value:v._parse(new bC(f,O,f.path,[M,"value"]))}));if(f.common.async){let A=new Map;return Promise.resolve().then(async()=>{for(let O of E){let M=await O.key,W=await O.value;if(M.status==="aborted"||W.status==="aborted")return Bc;(M.status==="dirty"||W.status==="dirty")&&c.dirty(),A.set(M.value,W.value)}return{status:c.value,value:A}})}else{let A=new Map;for(let O of E){let M=O.key,W=O.value;if(M.status==="aborted"||W.status==="aborted")return Bc;(M.status==="dirty"||W.status==="dirty")&&c.dirty(),A.set(M.value,W.value)}return{status:c.value,value:A}}}};BB.create=(a,s,c)=>new BB({valueType:s,keyType:a,typeName:Oc.ZodMap,...Dl(c)});var UB=class a extends Al{static{t(this,"ZodSet")}_parse(s){let{status:c,ctx:f}=this._processInputParams(s);if(f.parsedType!==Ka.set)return ja(f,{code:Ds.invalid_type,expected:Ka.set,received:f.parsedType}),Bc;let d=this._def;d.minSize!==null&&f.data.size<d.minSize.value&&(ja(f,{code:Ds.too_small,minimum:d.minSize.value,type:"set",inclusive:!0,exact:!1,message:d.minSize.message}),c.dirty()),d.maxSize!==null&&f.data.size>d.maxSize.value&&(ja(f,{code:Ds.too_big,maximum:d.maxSize.value,type:"set",inclusive:!0,exact:!1,message:d.maxSize.message}),c.dirty());let v=this._def.valueType;function E(O){let M=new Set;for(let W of O){if(W.status==="aborted")return Bc;W.status==="dirty"&&c.dirty(),M.add(W.value)}return{status:c.value,value:M}}t(E,"finalizeSet");let A=[...f.data.values()].map((O,M)=>v._parse(new bC(f,O,f.path,M)));return f.common.async?Promise.all(A).then(O=>E(O)):E(A)}min(s,c){return new a({...this._def,minSize:{value:s,message:zo.toString(c)}})}max(s,c){return new a({...this._def,maxSize:{value:s,message:zo.toString(c)}})}size(s,c){return this.min(s,c).max(s,c)}nonempty(s){return this.min(1,s)}};UB.create=(a,s)=>new UB({valueType:a,minSize:null,maxSize:null,typeName:Oc.ZodSet,...Dl(s)});var Tpe=class a extends Al{static{t(this,"ZodFunction")}constructor(){super(...arguments),this.validate=this.implement}_parse(s){let{ctx:c}=this._processInputParams(s);if(c.parsedType!==Ka.function)return ja(c,{code:Ds.invalid_type,expected:Ka.function,received:c.parsedType}),Bc;function f(A,O){return ype({data:A,path:c.path,errorMaps:[c.common.contextualErrorMap,c.schemaErrorMap,gpe(),RB].filter(M=>!!M),issueData:{code:Ds.invalid_arguments,argumentsError:O}})}t(f,"makeArgsIssue");function d(A,O){return ype({data:A,path:c.path,errorMaps:[c.common.contextualErrorMap,c.schemaErrorMap,gpe(),RB].filter(M=>!!M),issueData:{code:Ds.invalid_return_type,returnTypeError:O}})}t(d,"makeReturnsIssue");let v={errorMap:c.common.contextualErrorMap},E=c.data;if(this._def.returns instanceof kN){let A=this;return Tv(async function(...O){let M=new SS([]),W=await A._def.args.parseAsync(O,v).catch(Pe=>{throw M.addIssue(f(O,Pe)),M}),$=await Reflect.apply(E,this,W);return await A._def.returns._def.type.parseAsync($,v).catch(Pe=>{throw M.addIssue(d($,Pe)),M})})}else{let A=this;return Tv(function(...O){let M=A._def.args.safeParse(O,v);if(!M.success)throw new SS([f(O,M.error)]);let W=Reflect.apply(E,this,M.data),$=A._def.returns.safeParse(W,v);if(!$.success)throw new SS([d(W,$.error)]);return $.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...s){return new a({...this._def,args:GA.create(s).rest(s6.create())})}returns(s){return new a({...this._def,returns:s})}implement(s){return this.parse(s)}strictImplement(s){return this.parse(s)}static create(s,c,f){return new a({args:s||GA.create([]).rest(s6.create()),returns:c||s6.create(),typeName:Oc.ZodFunction,...Dl(f)})}},u7=class extends Al{static{t(this,"ZodLazy")}get schema(){return this._def.getter()}_parse(s){let{ctx:c}=this._processInputParams(s);return this._def.getter()._parse({data:c.data,path:c.path,parent:c})}};u7.create=(a,s)=>new u7({getter:a,typeName:Oc.ZodLazy,...Dl(s)});var f7=class extends Al{static{t(this,"ZodLiteral")}_parse(s){if(s.data!==this._def.value){let c=this._getOrReturnCtx(s);return ja(c,{received:c.data,code:Ds.invalid_literal,expected:this._def.value}),Bc}return{status:"valid",value:s.data}}get value(){return this._def.value}};f7.create=(a,s)=>new f7({value:a,typeName:Oc.ZodLiteral,...Dl(s)});function Uvt(a,s){return new _7({values:a,typeName:Oc.ZodEnum,...Dl(s)})}t(Uvt,"createZodEnum");var _7=class a extends Al{static{t(this,"ZodEnum")}constructor(){super(...arguments),HK.set(this,void 0)}_parse(s){if(typeof s.data!="string"){let c=this._getOrReturnCtx(s),f=this._def.values;return ja(c,{expected:sf.joinValues(f),received:c.parsedType,code:Ds.invalid_type}),Bc}if(vpe(this,HK,"f")||Rvt(this,HK,new Set(this._def.values),"f"),!vpe(this,HK,"f").has(s.data)){let c=this._getOrReturnCtx(s),f=this._def.values;return ja(c,{received:c.data,code:Ds.invalid_enum_value,options:f}),Bc}return Tv(s.data)}get options(){return this._def.values}get enum(){let s={};for(let c of this._def.values)s[c]=c;return s}get Values(){let s={};for(let c of this._def.values)s[c]=c;return s}get Enum(){let s={};for(let c of this._def.values)s[c]=c;return s}extract(s,c=this._def){return a.create(s,{...this._def,...c})}exclude(s,c=this._def){return a.create(this.options.filter(f=>!s.includes(f)),{...this._def,...c})}};HK=new WeakMap;_7.create=Uvt;var p7=class extends Al{static{t(this,"ZodNativeEnum")}constructor(){super(...arguments),GK.set(this,void 0)}_parse(s){let c=sf.getValidEnumValues(this._def.values),f=this._getOrReturnCtx(s);if(f.parsedType!==Ka.string&&f.parsedType!==Ka.number){let d=sf.objectValues(c);return ja(f,{expected:sf.joinValues(d),received:f.parsedType,code:Ds.invalid_type}),Bc}if(vpe(this,GK,"f")||Rvt(this,GK,new Set(sf.getValidEnumValues(this._def.values)),"f"),!vpe(this,GK,"f").has(s.data)){let d=sf.objectValues(c);return ja(f,{received:f.data,code:Ds.invalid_enum_value,options:d}),Bc}return Tv(s.data)}get enum(){return this._def.values}};GK=new WeakMap;p7.create=(a,s)=>new p7({values:a,typeName:Oc.ZodNativeEnum,...Dl(s)});var kN=class extends Al{static{t(this,"ZodPromise")}unwrap(){return this._def.type}_parse(s){let{ctx:c}=this._processInputParams(s);if(c.parsedType!==Ka.promise&&c.common.async===!1)return ja(c,{code:Ds.invalid_type,expected:Ka.promise,received:c.parsedType}),Bc;let f=c.parsedType===Ka.promise?c.data:Promise.resolve(c.data);return Tv(f.then(d=>this._def.type.parseAsync(d,{path:c.path,errorMap:c.common.contextualErrorMap})))}};kN.create=(a,s)=>new kN({type:a,typeName:Oc.ZodPromise,...Dl(s)});var TS=class extends Al{static{t(this,"ZodEffects")}innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Oc.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(s){let{status:c,ctx:f}=this._processInputParams(s),d=this._def.effect||null,v={addIssue:t(E=>{ja(f,E),E.fatal?c.abort():c.dirty()},"addIssue"),get path(){return f.path}};if(v.addIssue=v.addIssue.bind(v),d.type==="preprocess"){let E=d.transform(f.data,v);if(f.common.async)return Promise.resolve(E).then(async A=>{if(c.value==="aborted")return Bc;let O=await this._def.schema._parseAsync({data:A,path:f.path,parent:f});return O.status==="aborted"?Bc:O.status==="dirty"||c.value==="dirty"?LB(O.value):O});{if(c.value==="aborted")return Bc;let A=this._def.schema._parseSync({data:E,path:f.path,parent:f});return A.status==="aborted"?Bc:A.status==="dirty"||c.value==="dirty"?LB(A.value):A}}if(d.type==="refinement"){let E=t(A=>{let O=d.refinement(A,v);if(f.common.async)return Promise.resolve(O);if(O instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return A},"executeRefinement");if(f.common.async===!1){let A=this._def.schema._parseSync({data:f.data,path:f.path,parent:f});return A.status==="aborted"?Bc:(A.status==="dirty"&&c.dirty(),E(A.value),{status:c.value,value:A.value})}else return this._def.schema._parseAsync({data:f.data,path:f.path,parent:f}).then(A=>A.status==="aborted"?Bc:(A.status==="dirty"&&c.dirty(),E(A.value).then(()=>({status:c.value,value:A.value}))))}if(d.type==="transform")if(f.common.async===!1){let E=this._def.schema._parseSync({data:f.data,path:f.path,parent:f});if(!QK(E))return E;let A=d.transform(E.value,v);if(A instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:c.value,value:A}}else return this._def.schema._parseAsync({data:f.data,path:f.path,parent:f}).then(E=>QK(E)?Promise.resolve(d.transform(E.value,v)).then(A=>({status:c.value,value:A})):E);sf.assertNever(d)}};TS.create=(a,s,c)=>new TS({schema:a,typeName:Oc.ZodEffects,effect:s,...Dl(c)});TS.createWithPreprocess=(a,s,c)=>new TS({schema:s,effect:{type:"preprocess",transform:a},typeName:Oc.ZodEffects,...Dl(c)});var vC=class extends Al{static{t(this,"ZodOptional")}_parse(s){return this._getType(s)===Ka.undefined?Tv(void 0):this._def.innerType._parse(s)}unwrap(){return this._def.innerType}};vC.create=(a,s)=>new vC({innerType:a,typeName:Oc.ZodOptional,...Dl(s)});var QA=class extends Al{static{t(this,"ZodNullable")}_parse(s){return this._getType(s)===Ka.null?Tv(null):this._def.innerType._parse(s)}unwrap(){return this._def.innerType}};QA.create=(a,s)=>new QA({innerType:a,typeName:Oc.ZodNullable,...Dl(s)});var d7=class extends Al{static{t(this,"ZodDefault")}_parse(s){let{ctx:c}=this._processInputParams(s),f=c.data;return c.parsedType===Ka.undefined&&(f=this._def.defaultValue()),this._def.innerType._parse({data:f,path:c.path,parent:c})}removeDefault(){return this._def.innerType}};d7.create=(a,s)=>new d7({innerType:a,typeName:Oc.ZodDefault,defaultValue:typeof s.default=="function"?s.default:()=>s.default,...Dl(s)});var m7=class extends Al{static{t(this,"ZodCatch")}_parse(s){let{ctx:c}=this._processInputParams(s),f={...c,common:{...c.common,issues:[]}},d=this._def.innerType._parse({data:f.data,path:f.path,parent:{...f}});return KK(d)?d.then(v=>({status:"valid",value:v.status==="valid"?v.value:this._def.catchValue({get error(){return new SS(f.common.issues)},input:f.data})})):{status:"valid",value:d.status==="valid"?d.value:this._def.catchValue({get error(){return new SS(f.common.issues)},input:f.data})}}removeCatch(){return this._def.innerType}};m7.create=(a,s)=>new m7({innerType:a,typeName:Oc.ZodCatch,catchValue:typeof s.catch=="function"?s.catch:()=>s.catch,...Dl(s)});var $B=class extends Al{static{t(this,"ZodNaN")}_parse(s){if(this._getType(s)!==Ka.nan){let f=this._getOrReturnCtx(s);return ja(f,{code:Ds.invalid_type,expected:Ka.nan,received:f.parsedType}),Bc}return{status:"valid",value:s.data}}};$B.create=a=>new $B({typeName:Oc.ZodNaN,...Dl(a)});var sTr=Symbol("zod_brand"),YK=class extends Al{static{t(this,"ZodBranded")}_parse(s){let{ctx:c}=this._processInputParams(s),f=c.data;return this._def.type._parse({data:f,path:c.path,parent:c})}unwrap(){return this._def.type}},XK=class a extends Al{static{t(this,"ZodPipeline")}_parse(s){let{status:c,ctx:f}=this._processInputParams(s);if(f.common.async)return t(async()=>{let v=await this._def.in._parseAsync({data:f.data,path:f.path,parent:f});return v.status==="aborted"?Bc:v.status==="dirty"?(c.dirty(),LB(v.value)):this._def.out._parseAsync({data:v.value,path:f.path,parent:f})},"handleAsync")();{let d=this._def.in._parseSync({data:f.data,path:f.path,parent:f});return d.status==="aborted"?Bc:d.status==="dirty"?(c.dirty(),{status:"dirty",value:d.value}):this._def.out._parseSync({data:d.value,path:f.path,parent:f})}}static create(s,c){return new a({in:s,out:c,typeName:Oc.ZodPipeline})}},h7=class extends Al{static{t(this,"ZodReadonly")}_parse(s){let c=this._def.innerType._parse(s),f=t(d=>(QK(d)&&(d.value=Object.freeze(d.value)),d),"freeze");return KK(c)?c.then(d=>f(d)):f(c)}unwrap(){return this._def.innerType}};h7.create=(a,s)=>new h7({innerType:a,typeName:Oc.ZodReadonly,...Dl(s)});function $vt(a,s={},c){return a?AN.create().superRefine((f,d)=>{var v,E;if(!a(f)){let A=typeof s=="function"?s(f):typeof s=="string"?{message:s}:s,O=(E=(v=A.fatal)!==null&&v!==void 0?v:c)!==null&&E!==void 0?E:!0,M=typeof A=="string"?{message:A}:A;d.addIssue({code:"custom",...M,fatal:O})}}):AN.create()}t($vt,"custom");var aTr={object:Mb.lazycreate},Oc;(function(a){a.ZodString="ZodString",a.ZodNumber="ZodNumber",a.ZodNaN="ZodNaN",a.ZodBigInt="ZodBigInt",a.ZodBoolean="ZodBoolean",a.ZodDate="ZodDate",a.ZodSymbol="ZodSymbol",a.ZodUndefined="ZodUndefined",a.ZodNull="ZodNull",a.ZodAny="ZodAny",a.ZodUnknown="ZodUnknown",a.ZodNever="ZodNever",a.ZodVoid="ZodVoid",a.ZodArray="ZodArray",a.ZodObject="ZodObject",a.ZodUnion="ZodUnion",a.ZodDiscriminatedUnion="ZodDiscriminatedUnion",a.ZodIntersection="ZodIntersection",a.ZodTuple="ZodTuple",a.ZodRecord="ZodRecord",a.ZodMap="ZodMap",a.ZodSet="ZodSet",a.ZodFunction="ZodFunction",a.ZodLazy="ZodLazy",a.ZodLiteral="ZodLiteral",a.ZodEnum="ZodEnum",a.ZodEffects="ZodEffects",a.ZodNativeEnum="ZodNativeEnum",a.ZodOptional="ZodOptional",a.ZodNullable="ZodNullable",a.ZodDefault="ZodDefault",a.ZodCatch="ZodCatch",a.ZodPromise="ZodPromise",a.ZodBranded="ZodBranded",a.ZodPipeline="ZodPipeline",a.ZodReadonly="ZodReadonly"})(Oc||(Oc={}));var oTr=t((a,s={message:`Input not instance of ${a.name}`})=>$vt(c=>c instanceof a,s),"instanceOfType"),Jvt=DN.create,qvt=r7.create,cTr=$B.create,lTr=n7.create,zvt=i7.create,uTr=s7.create,fTr=MB.create,_Tr=a7.create,pTr=o7.create,dTr=AN.create,mTr=s6.create,hTr=Ix.create,gTr=jB.create,yTr=a6.create,vTr=Mb.create,bTr=Mb.strictCreate,STr=c7.create,TTr=bpe.create,CTr=l7.create,ETr=GA.create,xTr=Spe.create,DTr=BB.create,ATr=UB.create,kTr=Tpe.create,wTr=u7.create,PTr=f7.create,NTr=_7.create,ITr=p7.create,OTr=kN.create,Fvt=TS.create,FTr=vC.create,LTr=QA.create,RTr=TS.createWithPreprocess,MTr=XK.create,jTr=t(()=>Jvt().optional(),"ostring"),BTr=t(()=>qvt().optional(),"onumber"),UTr=t(()=>zvt().optional(),"oboolean"),$Tr={string:t(a=>DN.create({...a,coerce:!0}),"string"),number:t(a=>r7.create({...a,coerce:!0}),"number"),boolean:t(a=>i7.create({...a,coerce:!0}),"boolean"),bigint:t(a=>n7.create({...a,coerce:!0}),"bigint"),date:t(a=>s7.create({...a,coerce:!0}),"date")},JTr=Bc,qr=Object.freeze({__proto__:null,defaultErrorMap:RB,setErrorMap:JSr,getErrorMap:gpe,makeIssue:ype,EMPTY_PATH:qSr,addIssueToContext:ja,ParseStatus:d1,INVALID:Bc,DIRTY:LB,OK:Tv,isAborted:$7e,isDirty:J7e,isValid:QK,isAsync:KK,get util(){return sf},get objectUtil(){return U7e},ZodParsedType:Ka,getParsedType:xN,ZodType:Al,datetimeRegex:Bvt,ZodString:DN,ZodNumber:r7,ZodBigInt:n7,ZodBoolean:i7,ZodDate:s7,ZodSymbol:MB,ZodUndefined:a7,ZodNull:o7,ZodAny:AN,ZodUnknown:s6,ZodNever:Ix,ZodVoid:jB,ZodArray:a6,ZodObject:Mb,ZodUnion:c7,ZodDiscriminatedUnion:bpe,ZodIntersection:l7,ZodTuple:GA,ZodRecord:Spe,ZodMap:BB,ZodSet:UB,ZodFunction:Tpe,ZodLazy:u7,ZodLiteral:f7,ZodEnum:_7,ZodNativeEnum:p7,ZodPromise:kN,ZodEffects:TS,ZodTransformer:TS,ZodOptional:vC,ZodNullable:QA,ZodDefault:d7,ZodCatch:m7,ZodNaN:$B,BRAND:sTr,ZodBranded:YK,ZodPipeline:XK,ZodReadonly:h7,custom:$vt,Schema:Al,ZodSchema:Al,late:aTr,get ZodFirstPartyTypeKind(){return Oc},coerce:$Tr,any:dTr,array:yTr,bigint:lTr,boolean:zvt,date:uTr,discriminatedUnion:TTr,effect:Fvt,enum:NTr,function:kTr,instanceof:oTr,intersection:CTr,lazy:wTr,literal:PTr,map:DTr,nan:cTr,nativeEnum:ITr,never:hTr,null:pTr,nullable:LTr,number:qvt,object:vTr,oboolean:UTr,onumber:BTr,optional:FTr,ostring:jTr,pipeline:MTr,preprocess:RTr,promise:OTr,record:xTr,set:ATr,strictObject:bTr,string:Jvt,symbol:fTr,transformer:Fvt,tuple:ETr,undefined:_Tr,union:STr,unknown:mTr,void:gTr,NEVER:JTr,ZodIssueCode:Ds,quotelessJson:$Sr,ZodError:SS});function Vvt(a){return a instanceof Error&&a.name==="ZodError"&&"issues"in a&&Array.isArray(a.issues)}t(Vvt,"isZodErrorLike");var z7e=class extends Error{static{t(this,"ValidationError")}name;details;constructor(a,s){super(a,s),this.name="ZodValidationError",this.details=zTr(s)}toString(){return this.message}};function zTr(a){if(a){let s=a.cause;if(Vvt(s))return s.issues}return[]}t(zTr,"getIssuesFromErrorOptions");function Wvt(a){return a.length!==0}t(Wvt,"isNonEmptyArray");var VTr=/[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*/u;function WTr(a){return a.length===1?a[0].toString():a.reduce((s,c)=>{if(typeof c=="number")return s+"["+c.toString()+"]";if(c.includes('"'))return s+'["'+HTr(c)+'"]';if(!VTr.test(c))return s+'["'+c+'"]';let f=s.length===0?"":".";return s+f+c},"")}t(WTr,"joinPath");function HTr(a){return a.replace(/"/g,'\\"')}t(HTr,"escapeQuotes");var GTr="; ",QTr=99,Hvt="Validation error",KTr=": ",YTr=", or ";function XTr(a={}){let{issueSeparator:s=GTr,unionSeparator:c=YTr,prefixSeparator:f=KTr,prefix:d=Hvt,includePath:v=!0,maxIssuesInMessage:E=QTr}=a;return A=>{let O=A.slice(0,E).map(M=>Cpe({issue:M,issueSeparator:s,unionSeparator:c,includePath:v})).join(s);return ZTr(O,d,f)}}t(XTr,"createMessageBuilder");function Cpe(a){let{issue:s,issueSeparator:c,unionSeparator:f,includePath:d}=a;if(s.code===Ds.invalid_union)return s.unionErrors.reduce((v,E)=>{let A=E.issues.map(O=>Cpe({issue:O,issueSeparator:c,unionSeparator:f,includePath:d})).join(c);return v.includes(A)||v.push(A),v},[]).join(f);if(s.code===Ds.invalid_arguments)return[s.message,...s.argumentsError.issues.map(v=>Cpe({issue:v,issueSeparator:c,unionSeparator:f,includePath:d}))].join(c);if(s.code===Ds.invalid_return_type)return[s.message,...s.returnTypeError.issues.map(v=>Cpe({issue:v,issueSeparator:c,unionSeparator:f,includePath:d}))].join(c);if(d&&Wvt(s.path)){if(s.path.length===1){let v=s.path[0];if(typeof v=="number")return`${s.message} at index ${v}`}return`${s.message} at "${WTr(s.path)}"`}return s.message}t(Cpe,"getMessageFromZodIssue");function ZTr(a,s,c){return s!==null?a.length>0?[s,a].join(c):s:a.length>0?a:Hvt}t(ZTr,"prefixMessage");function eCr(a,s={}){let c=a.errors,f;return Wvt(c)?f=tCr(s)(c):f=a.message,new z7e(f,{cause:a})}t(eCr,"fromZodErrorWithoutRuntimeCheck");function tCr(a){return"messageBuilder"in a?a.messageBuilder:XTr(a)}t(tCr,"createMessageBuilderFromOptions2");var rCr=t((a={})=>s=>Vvt(s)?eCr(s,a):s instanceof Error?new z7e(s.message,{cause:s}):new z7e("Unknown error"),"toValidationError");function Epe(a,s={}){return rCr(s)(a)}t(Epe,"fromError");var xpe=t((a,s)=>{let c={};for(let[f,d]of Object.entries(a))Array.isArray(d)?c[f]=d.map(v=>typeof v=="object"&&v!==null?xpe(v,s):v):typeof d=="object"&&d!==null?c[f]=xpe(d,s):c[f]=d;return s(c)},"traverse"),aCr=t(({keys:a}={})=>s=>xpe(s,c=>{let f={};for(let[d,v]of Object.entries(c))d.startsWith("x-")&&(a===void 0||a.includes(d))||(f[d]=v);return f}),"removeExtensions"),oCr=t(({paths:a={},shouldRemove:s})=>c=>xpe(c,f=>{if(!f.paths)return f;let d={};for(let[v,E]of Object.entries(f.paths)){let A=f.paths[v];if(a[v]!==!0&&!s?.({path:v,method:!0,operation:A}))if(typeof E=="object"&&E!==null){let O=Object.fromEntries(Object.entries(E).filter(([M])=>{let W=f.paths[v][M],$=Array.isArray(a[v])&&a[v].includes(M),Q=s?.({path:v,method:M,operation:W});return!$&&!Q}));d[v]=O}else d[v]=E}return{...f,paths:d}}),"removePaths");function cCr(a){return a.apis&&(Array.isArray(a.apis)?a.apis=a.apis.map(Kvt):a.apis=Kvt(a.apis)),a}t(cCr,"withZuplo");function Kvt(a){return a.type==="file"&&(a.postProcessors=[aCr({keys:["x-zuplo-route","x-zuplo-path"]}),oCr({shouldRemove:t(({operation:s})=>s["x-internal"],"shouldRemove")}),...a.postProcessors??[]]),a}t(Kvt,"configureApis");var lCr=cCr,rbt=qr.object({label:qr.string(),color:qr.enum(["green","blue","yellow","red","purple","indigo","gray"]),placement:qr.enum(["start","end"]).optional()}),uCr=qr.object({type:qr.literal("doc"),id:qr.string(),label:qr.string().optional()}),fCr=qr.union([uCr,qr.string()]),_Cr=qr.object({type:qr.literal("doc"),id:qr.string(),icon:qr.custom().optional(),label:qr.string().optional(),badge:rbt.optional()}),pCr=qr.union([_Cr,qr.string()]),dCr=qr.object({type:qr.literal("link"),label:qr.string(),href:qr.string(),description:qr.string().optional(),badge:rbt.optional()}),mCr=qr.object({type:qr.literal("category"),icon:qr.custom().optional(),label:qr.string(),description:qr.string().optional(),collapsible:qr.boolean().optional(),collapsed:qr.boolean().optional(),link:fCr.optional()}),nbt=qr.lazy(()=>qr.union([pCr,dCr,hCr])),hCr=mCr.extend({items:nbt.array()}),gCr=nbt.array(),V7e=qr.object({}).passthrough(),Yvt=qr.object({background:qr.string(),foreground:qr.string(),card:qr.string(),cardForeground:qr.string(),popover:qr.string(),popoverForeground:qr.string(),primary:qr.string(),primaryForeground:qr.string(),secondary:qr.string(),secondaryForeground:qr.string(),muted:qr.string(),mutedForeground:qr.string(),accent:qr.string(),accentForeground:qr.string(),destructive:qr.string(),destructiveForeground:qr.string(),border:qr.string(),input:qr.string(),ring:qr.string(),radius:qr.string()}).partial(),yCr=qr.object({label:qr.string(),tags:qr.array(qr.string())}),W7e=qr.object({id:qr.string().optional(),server:qr.string().optional(),navigationId:qr.string().optional(),categories:qr.array(yCr).optional()}),vCr=qr.function().args(V7e).returns(qr.union([V7e,qr.promise(V7e)])),Xvt=qr.union([qr.object({type:qr.literal("url"),input:qr.string()}).merge(W7e),qr.object({type:qr.literal("file"),input:qr.string()}).merge(W7e).merge(qr.object({postProcessors:vCr.array().optional()})),qr.object({type:qr.literal("raw"),input:qr.string()}).merge(W7e)]),bCr=qr.union([qr.object({enabled:qr.boolean(),endpoint:qr.string()}),qr.object({enabled:qr.boolean(),getKeys:qr.custom(a=>typeof a=="function"),rollKey:qr.custom(a=>typeof a=="function").optional(),deleteKey:qr.custom(a=>typeof a=="function").optional(),updateKeyDescription:qr.custom(a=>typeof a=="function").optional(),createKey:qr.custom(a=>typeof a=="function").optional()})]),SCr=qr.object({src:qr.object({light:qr.string(),dark:qr.string()}),alt:qr.string().optional(),width:qr.string().optional()}),TCr=qr.object({siteUrl:qr.string(),changefreq:qr.optional(qr.enum(["always","hourly","daily","weekly","monthly","yearly","never"])),priority:qr.optional(qr.number()),outDir:qr.string().optional(),autoLastmod:qr.boolean().optional(),exclude:qr.union([qr.function().returns(qr.promise(qr.array(qr.string()))),qr.array(qr.string())]).optional()}).optional(),Zvt=qr.object({files:qr.string(),defaultOptions:qr.object({toc:qr.boolean(),disablePager:qr.boolean()}).partial().optional()}),CCr=qr.object({label:qr.string(),id:qr.string(),default:qr.string().optional(),display:qr.enum(["auth","anon","always"]).default("always").optional()}),ECr=qr.object({from:qr.string(),to:qr.string()}),xCr=qr.object({type:qr.literal("inkeep"),apiKey:qr.string(),integrationId:qr.string(),organizationId:qr.string(),primaryBrandColor:qr.string(),organizationDisplayName:qr.string()}).optional(),DCr=qr.union([qr.object({type:qr.literal("clerk"),clerkPubKey:qr.custom(a=>typeof a=="string"?/^pk_(test|live)_\w+$/.test(a):!1),redirectToAfterSignUp:qr.string().optional(),redirectToAfterSignIn:qr.string().optional(),redirectToAfterSignOut:qr.string().optional()}),qr.object({type:qr.literal("openid"),clientId:qr.string(),issuer:qr.string(),audience:qr.string().optional(),scopes:qr.array(qr.string()).optional(),redirectToAfterSignUp:qr.string().optional(),redirectToAfterSignIn:qr.string().optional(),redirectToAfterSignOut:qr.string().optional()}),qr.object({type:qr.literal("auth0"),clientId:qr.string(),domain:qr.string(),audience:qr.string().optional(),redirectToAfterSignUp:qr.string().optional(),redirectToAfterSignIn:qr.string().optional(),redirectToAfterSignOut:qr.string().optional()})]),ACr=qr.object({title:qr.string(),description:qr.string(),logo:qr.string(),favicon:qr.string(),generator:qr.string(),applicationName:qr.string(),referrer:qr.string(),keywords:qr.array(qr.string()),authors:qr.array(qr.string()),creator:qr.string(),publisher:qr.string()}).partial(),ebt=qr.object({url:qr.string(),fontFamily:qr.string()}),kCr=qr.object({sans:ebt.optional(),mono:ebt.optional()}),wCr=qr.object({pageTitle:qr.string(),logoUrl:qr.string(),logo:SCr,banner:qr.object({message:qr.custom(),color:qr.enum(["note","tip","info","caution","danger"]).or(qr.string()).optional(),dismissible:qr.boolean().optional()})}).partial(),tbt=qr.object({navigationId:qr.string(),label:qr.string(),items:qr.array(qr.string()).optional()}),ibt=qr.object({basePath:qr.string().optional(),page:wCr,topNavigation:qr.array(CCr),sidebar:qr.record(gCr),theme:qr.object({light:Yvt,dark:Yvt,fonts:kCr}).partial(),metadata:ACr,authentication:DCr,search:xCr,docs:qr.union([Zvt,qr.array(Zvt)]),apis:qr.union([Xvt,qr.array(Xvt)]),catalog:qr.union([tbt,qr.array(tbt)]),apiKeys:bCr,redirects:qr.array(ECr),sitemap:TCr}),sbt=t((a,s)=>{if(!a.sidebar||!a.topNavigation)return;let c=a.topNavigation.map(d=>d.id),f=Object.keys(a.sidebar).filter(d=>!c.includes(d));f.length>0&&s.addIssue({code:qr.ZodIssueCode.custom,message:`Sidebar ID [${f.map(d=>`"${d}"`).join(", ")}] not found in top navigation.
614
614
  Following IDs are available: ${c.join(", ")}`})},"refine"),PCr=ibt.partial(),NCr=PCr.superRefine(sbt);function ICr(a){let s=NCr.safeParse(a);s.success||(console.log("Validation errors:"),console.log(Epe(s.error).toString()))}t(ICr,"validateCommonConfig");var OCr=qr.object({UNSAFE_slotlets:qr.record(qr.string(),qr.custom()),mdx:qr.object({components:qr.custom()}).partial(),customPages:qr.array(qr.object({path:qr.string(),element:qr.custom().optional(),render:qr.custom().optional(),prose:qr.boolean().optional()})),plugins:qr.array(qr.custom()),build:qr.custom()}),FCr=ibt.merge(OCr).partial().superRefine(sbt);function LCr(a){let s=FCr.safeParse(a);s.success||(console.log("Validation errors:"),console.log(Epe(s.error).toString()))}t(LCr,"validateConfig");var RCr=["zudoku.config.js","zudoku.config.jsx","zudoku.config.ts","zudoku.config.tsx","zudoku.config.mjs"],MCr="dev-portal.json",H7e=t(a=>iCr(a).then(()=>!0).catch(()=>!1),"fileExists"),o6,wN;async function Q7e(a){if(o6&&wN&&await H7e(o6))return{configPath:o6,configType:wN};let s=Gvt.join(a,MCr);if(await H7e(s))return o6=s,wN="dev-portal",{configPath:o6,configType:wN};for(let c of RCr){let f=Gvt.join(a,c);if(await H7e(f))return o6=f,wN="zudoku",{configPath:o6,configType:wN}}return o6=void 0,wN=void 0,{configPath:o6,configType:wN}}t(Q7e,"findConfigFilePath");async function jCr(a){let s=await Q7e(a);if(s.configType)return s;throw new Error("No zudoku config file found in project root.")}t(jCr,"getConfigFilePath");async function BCr(a,s,c){let f=Qvt(s).href,d=[],v=await Ivt(f,{parentURL:import.meta.url,onImport:t(E=>{let A=sCr(E.startsWith("file://")?E:Qvt(E).href);A.startsWith(a)&&d.push(A)},"onImport")}).then(E=>E.default);if(!v)throw new Error(`Failed to load config file: ${s}`);return{dependencies:d,config:v}}t(BCr,"loadZudokuCodeConfig");async function UCr(a,s){let c=await nCr(a,"utf-8"),f;try{f=JSON.parse(c)}catch{throw new Error("Failed to parse dev-portal.json. Check that the file is valid JSON.")}return ICr(f),f=G7e(f,s),f=lCr(f),f}t(UCr,"loadDevPortalConfig");function G7e(a,s){if(typeof a=="string"){let c=a.match(/^\$env\(([^)]+)\)$/);if(c){let f=c[1];return s[f]}return a}else{if(Array.isArray(a))return a.map(c=>G7e(c,s));if(typeof a=="object"&&a!==null){let c={};for(let f in a)Object.hasOwn(a,f)&&(c[f]=G7e(a[f],s));return c}}return a}t(G7e,"replaceEnvVariables");async function abt(a,s,c){let{configPath:f,configType:d}=await jCr(a),v,E;return d==="dev-portal"?(v=await UCr(f,s),E=[]):({config:v,dependencies:E}=await(c?.loadZudokuCodeConfig??BCr)(a,f,s),LCr(v)),{...v,__meta:{dependencies:E,path:f,registerDependency:t((...O)=>E.push(...O),"registerDependency")}}}t(abt,"tryLoadZudokuConfig");import lbt from"fs/promises";import g7 from"path";import{writeFile as $Cr}from"fs/promises";async function KA(a,s){await Ul.mkdirForFilePathIfNotExits(a);let c=await import("prettier"),f=s;try{f=await c.format(s,{parser:"babel"})}catch{}await $Cr(a,f,"utf-8")}t(KA,"writeDebugSourceFile");import K7e from"path";async function obt(a){if(await Ul.fileExists(`${a}/config/dev-portal.json`))return"dev-portal";if((await Q7e(K7e.join(a,"docs")))?.configType)return"zudoku"}t(obt,"getDevPortalType");function JB(a,s){let c=K7e.relative(process.cwd(),K7e.join(a,gj));return Object.keys(s?.outputs??{}).map(d=>`.${d.replace(c,"")}`)}t(JB,"getBuildModules");var cbt="/docs",qCr="/__zuplo/dev-portal";function zCr(a){let s=a.trim().toLowerCase();return s.endsWith("/")&&(s=s.slice(0,-1)),s}t(zCr,"normalizePathname");function VCr(a){let s={sitePathname:a?.sitePathname===qCr?cbt:a?.sitePathname?zCr(a.sitePathname):cbt,enabled:a?a.enabled??!0:!1,version:a?.version??"legacy"};return`const devPortal = ${JSON.stringify(s)};
615
- export default devPortal;`}t(VCr,"generateSource");function ubt(a){return{name:"dev-portal-config",setup(s){s.onResolve({filter:/dev-portal.json$/},c=>({namespace:"dev-portal-json",path:g7.isAbsolute(c.path)?c.path:g7.join(c.resolveDir,c.path),pluginName:"dev-portal"})),s.onLoad({filter:/.*/,namespace:"dev-portal-json"},async c=>__.timeFn("Generating dev-portal.json data",async()=>{let f,d,v=[],E=await obt(a.sourceDirectory);if(E==="zudoku")try{let O=g7.join(g7.resolve(g7.dirname(c.path),".."),Gct);f={version:"zudoku",enabled:!0,sitePathname:(await abt(O,{},{loadZudokuCodeConfig:WCr(a.sourceDirectory)})).basePath}}catch(O){v.push({id:"dev-portal-build-error",text:"Could not load developer portal configuration.",location:{file:"docs/dev-portal.json",namespace:"",line:1,column:0,length:0,lineText:"",suggestion:""},detail:O.message,pluginName:"dev-portal",notes:[]})}else if(E==="dev-portal"){d=await lbt.readFile(c.path,"utf-8");try{f=JSON.parse(d)}catch(O){v.push({id:"dev-portal-build-error",text:"Could not parse dev-portal.json. Ensure that the file is valid JSON.",location:{file:"config/dev-portal.json",namespace:"",line:1,column:0,length:0,lineText:"",suggestion:""},detail:"DevPortalValidationError",pluginName:"dev-portal",notes:[{text:O.message,location:null}]})}}let A;try{if(A=VCr(f),Uh.DEBUG_BUILD_MODE&&A){let O=g7.join(a.sourceDirectory,".zuplo","dev-portal.js");await KA(O,A)}}catch(O){v.push({id:"dev-portal-build-error",text:O.message,location:{file:"dev-portal.json",namespace:"dev-portal-json",line:1,column:0,length:0,lineText:"issue",suggestion:""},detail:"DevPortalValidationError",pluginName:"dev-portal",notes:[{text:O.message,location:null}]})}return{contents:A,errors:v,pluginName:"dev-portal",loader:"js",resolveDir:g7.dirname(c.path),watchFiles:[c.path]}}))}}}t(ubt,"devPortalConfigPlugin");function WCr(a){return t(async function(c,f,d){let v=Ul.safePath(a).resolve(f),E=await lbt.readFile(v,"utf-8"),A=await JCr(E,{target:"esnext",syntax:"typescript",tsx:!0}),O=HCr(A);return{dependencies:[],config:{basePath:O??"/docs"}}},"loadZudokuCodeConfig")}t(WCr,"createLoadDevPortalConfigFunction");function HCr(a){let s;return a.body.forEach(c=>{if(c.type==="VariableDeclaration"){let f=c.declarations[0];f.id.type==="Identifier"&&f.id.value==="config"&&f.init&&f.init.type==="ObjectExpression"&&f.init.properties.forEach(v=>{v.type==="KeyValueProperty"&&(v.key.type==="Identifier"&&v.key.value==="basePath"||v.key.type==="StringLiteral"&&v.key.value==="basePath")&&v.value.type==="StringLiteral"&&(s=v.value.value)})}}),s}t(HCr,"getBasePathFromConfig");import fbt from"path";var _bt="legacy-environment",pbt="legacy-environment",GCr=`import { environment } from "@zuplo/runtime";
615
+ export default devPortal;`}t(VCr,"generateSource");function ubt(a){return{name:"dev-portal-config",setup(s){s.onResolve({filter:/dev-portal.json$/},c=>({namespace:"dev-portal-json",path:g7.isAbsolute(c.path)?c.path:g7.join(c.resolveDir,c.path),pluginName:"dev-portal"})),s.onLoad({filter:/.*/,namespace:"dev-portal-json"},async c=>__.timeFn("Generating dev-portal.json data",async()=>{let f,d,v=[],E=await obt(a.sourceDirectory);if(E==="zudoku")try{let O=g7.join(g7.resolve(g7.dirname(c.path),".."),Gct);f={version:"zudoku",enabled:!0,sitePathname:(await abt(O,{},{loadZudokuCodeConfig:WCr(a.sourceDirectory)})).basePath}}catch(O){a.logger.error(O,"Failed to load developer portal configuration"),v.push({id:"dev-portal-build-error",text:"Could not load developer portal configuration.",location:{file:"docs/dev-portal.json",namespace:"",line:1,column:0,length:0,lineText:"",suggestion:""},detail:O.message,pluginName:"dev-portal",notes:[]})}else if(E==="dev-portal"){d=await lbt.readFile(c.path,"utf-8");try{f=JSON.parse(d)}catch(O){v.push({id:"dev-portal-build-error",text:"Could not parse dev-portal.json. Ensure that the file is valid JSON.",location:{file:"config/dev-portal.json",namespace:"",line:1,column:0,length:0,lineText:"",suggestion:""},detail:"DevPortalValidationError",pluginName:"dev-portal",notes:[{text:O.message,location:null}]})}}let A;try{if(A=VCr(f),Uh.DEBUG_BUILD_MODE&&A){let O=g7.join(a.sourceDirectory,".zuplo","dev-portal.js");await KA(O,A)}}catch(O){v.push({id:"dev-portal-build-error",text:O.message,location:{file:"dev-portal.json",namespace:"dev-portal-json",line:1,column:0,length:0,lineText:"issue",suggestion:""},detail:"DevPortalValidationError",pluginName:"dev-portal",notes:[{text:O.message,location:null}]})}return{contents:A,errors:v,pluginName:"dev-portal",loader:"js",resolveDir:g7.dirname(c.path),watchFiles:[c.path]}}))}}}t(ubt,"devPortalConfigPlugin");function WCr(a){return t(async function(c,f,d){let v=Ul.safePath(a).resolve(f),E=await lbt.readFile(v,"utf-8"),A=await JCr(E,{target:"esnext",syntax:"typescript",tsx:!0}),O=HCr(A);return{dependencies:[],config:{basePath:O??"/docs"}}},"loadZudokuCodeConfig")}t(WCr,"createLoadDevPortalConfigFunction");function HCr(a){let s;return a.body.forEach(c=>{if(c.type==="VariableDeclaration"){let f=c.declarations[0];f.id.type==="Identifier"&&f.id.value==="config"&&f.init&&f.init.type==="ObjectExpression"&&f.init.properties.forEach(v=>{v.type==="KeyValueProperty"&&(v.key.type==="Identifier"&&v.key.value==="basePath"||v.key.type==="StringLiteral"&&v.key.value==="basePath")&&v.value.type==="StringLiteral"&&(s=v.value.value)})}}),s}t(HCr,"getBasePathFromConfig");import fbt from"path";var _bt="legacy-environment",pbt="legacy-environment",GCr=`import { environment } from "@zuplo/runtime";
616
616
  export default environment;`;function dbt(a){return{name:"environment",setup(s){s.onResolve({filter:/@app\/environment$/},()=>({namespace:pbt,pluginName:_bt,path:fbt.join(a.sourceDirectory,Q3,"environment.js")})),s.onLoad({filter:/.*/,namespace:pbt},async c=>({contents:GCr,loader:"ts",resolveDir:fbt.dirname(c.path),pluginName:_bt}))}}}t(dbt,"environmentPlugin");var xTt=Mp(B9e(),1),DTt=Mp(HSt(),1),ATt=Mp(uLe(),1),kTt=Mp(fLe(),1);import HPr from"fs/promises";import CS from"path";var nk="schemas",ode="json-schema";function wTt(a){return{name:nk,async setup(s){let c=new ATt.Ajv2020({code:{source:!0},allErrors:!0,strict:!1,verbose:!0,meta:!0});(0,DTt.default)(c,{mode:"fast"}),c.opts.code.formats=xTt._`require("ajv-formats/dist/formats").fastFormats`;let f=CS.join(a.sourceDirectory,HG),d,v=[],E=[];if(await Ul.dirExists(f)&&(c.addKeyword("faker"),d=await Ul.listFolderContents(f,HG),await Promise.all(d.map(async A=>{try{let O=Ul.safePath(a.sourceDirectory).resolve(f,A);if(!O.startsWith(f))throw new Error("All schemas must be in the schemas directory");let M=await HPr.readFile(O,"utf-8");if(M===""||M===void 0)throw new Error(`Schema 'schemas/${A}' is empty and will be ignored.`);let W=JSON.parse(M);if(W.$schema&&W.$schema!=="https://json-schema.org/draft/2020-12/schema")throw new Error(`Error in ${A}: All JSON schemas must use version 2020-12. See release notes for changes: https://json-schema.org/draft/2020-12/release-notes.html`);if(c.$dataMetaSchema,c.addSchema(W,A),c.errors?.length){let $=c.errors[0];v.push({id:"json-schema-validation-error",pluginName:nk,text:`Error: ${$.message}`,location:{file:CS.join(HG,A)},detail:{params:$.params,propertyName:$.propertyName,schemaPath:$.schemaPath,data:$.data}})}}catch(O){if(O.message.endsWith("is empty and will be ignored.")){E.push({id:"empty-json-schema-file",pluginName:nk,text:`Schema 'schemas/${A}' is empty and will be ignored.`,location:{file:`schemas/${A}`,suggestion:"Add schema details or remove the file from the project."},detail:"EmptyJSONSchemaFile",notes:[{text:`Schema 'schemas/${A}' is empty and will be ignored.`,location:{file:`schemas/${A}`,suggestion:"Add schema details or remove the file from the project."}}]});return}let M=await BFe(A,a.sourceDirectory,O.message);v.push({id:"json-schema-add-error",pluginName:nk,text:`Error: ${O.message}`,location:M,detail:"InvalidAddSchemaError",notes:[{text:O.message}]})}})),await Promise.all(d.map(async A=>{try{let O=c.getSchema(A);O&&c.compile(O.schema).errors?.forEach(W=>{v.push({text:`Failed to compile ${A}: ${W.message}`})})}catch(O){let M=await BFe(A,a.sourceDirectory,O.message);v.push({id:"json-schema-compile-error",pluginName:nk,text:`The schema file '${A}' is not valid. Error: ${O.message}`,location:M,detail:"InvalidSchemaError",notes:[{text:O.message}]})}})),Uh.DEBUG_BUILD_MODE)){let A=CS.resolve(a.outputDirectory,HG);await Ul.mkdirIfNotExists(A)}s.onStart(async()=>{if(d)return{errors:v,warnings:E}}),s.onResolve({filter:/schemas\/.*\.json$/},async A=>{let O=CS.isAbsolute(A.path)?A.path:CS.join(A.resolveDir,A.path);if(A.importer&&A.importer!==CS.join(a.sourceDirectory,"config/routes.json"))return{path:O};if(!await Ul.fileExists(O)){let M="policies.json";return{errors:[{id:"json-schema-build-error",text:`Unable to resolve reference to '${A.path}' from ${M}`,location:{file:CS.join(A.resolveDir,M),namespace:ode,line:1,column:0,length:0,lineText:`Invalid JSON schema reference in ${M}`,suggestion:""},detail:"RouteReferenceError",pluginName:nk,notes:[{text:`Unable to resolve reference to '${A.path}' from ${M}`,location:null}]}],namespace:ode,path:O,pluginName:nk}}return{path:O,namespace:ode,pluginName:nk}}),s.onLoad({filter:/.*/,namespace:ode},async A=>__.timeFn(`Generating json schema data: ${CS.basename(A.path)}`,async()=>{let O=[],M;try{let W=CS.relative(f,A.path),$=c.getSchema(W);if(!$)throw new Error(`Could not load schema at ${A.path}`);M=$.source?.validateCode;let Q=c.compile($.schema);M=(0,kTt.default)(c,Q)}catch(W){O.push({pluginName:nk,text:`Cannot parse project's schemas/${CS.basename(A.path)} file. Error: ${W.message}`,location:null,notes:[{text:W.message,location:null}],detail:W})}if(Uh.DEBUG_BUILD_MODE&&M){let W=CS.relative(f,A.path),$=CS.join(a.sourceDirectory,".zuplo",`${W}.js`);await KA($,M)}return{contents:M,errors:O,pluginName:nk,resolveDir:CS.dirname(A.path),watchFiles:[A.path]}}))}}}t(wTt,"jsonSchemaPlugin");import{relative as GPr}from"path";var PTt=["node:assert","node:async_hooks","node:buffer","node:crypto","node:diagnostics_channel","node:events","node:path","node:process","node:stream","node:string_decoder","node:util"],QPr="nodejs-compat-plugin";function NTt({sourceDirectory:a}){return{name:QPr,setup(s){let c=new Set;s.onStart(()=>{c.clear()}),s.onResolve({filter:/node:.*/},async({path:f,kind:d,resolveDir:v,...E})=>{let A=`${f}:${d}:${v}:${E.importer}`;if(c.has(A))return;c.add(A);let O=await s.resolve(f,{kind:d,resolveDir:v,importer:E.importer});return O.errors.length>0?PTt.includes(f)||f.includes("/")&&PTt.includes(f.split("/")[0])?{external:!0}:{external:!0,warnings:O.errors.map(W=>({...W,location:{file:GPr(a,E.importer),line:0,column:0,namespace:"",length:0,lineText:"",suggestion:"Remove the imported node module"},detail:`The package "${f}" wasn't found on the file system but is built into node. If this code is executed it will fail.`}))}:O})}}}t(NTt,"nodejsCompatPlugin");import ITt from"fs/promises";import Bx from"path";var uU="open-api-routes-plugin",cde="open-api-routes-json";function OTt(a){return{name:"open-api-routes-plugin",setup(s){s.onResolve({filter:/routes.json$/},c=>({watchFiles:[..._Le(Bx.join(a.sourceDirectory,mS),[".oas.json"],!0),Bx.join(a.sourceDirectory,mS,lue)],namespace:cde,path:Bx.isAbsolute(c.path)?c.path:Bx.join(c.resolveDir,c.path),pluginName:uU})),s.onResolve({filter:/^\.\.\/modules\/.*/,namespace:cde},async c=>{let f=Bx.join(c.resolveDir,`${c.path}.ts`);if(!await Ul.fileExists(f)){let d=`$import(.${c.path.replace(/^../,"")})`,v=Bx.resolve(a.sourceDirectory,"config"),E=await xF(v),A=await But(E,d,"Update your route configuration to use code from the 'modules' folder");return{errors:[{id:"route-build-error",text:`Invalid handler reference in routes.json. Unable to resolve reference to '${d}' from routes.json`,location:A,detail:"RouteReferenceError",pluginName:uU}],namespace:cde,path:c.path,pluginName:uU}}}),s.onLoad({filter:/.*/,namespace:cde},async c=>__.timeFn("Generating route.json data",async()=>{let f=Bx.resolve(a.sourceDirectory,"config"),d=await xF(f),v=await Promise.all(d.map(async M=>({content:await ITt.readFile(M,"utf-8"),fileName:M}))),E=Bx.resolve(f,"policies.json");if(!await Ul.fileExists(E))return{errors:[{text:"The project must include a policies file ('/config/policies.json')",detail:"OASPoliciesFileMissing",pluginName:uU,location:{line:0,column:0,file:"/config/policies.json"}}],pluginName:uU};let A={content:await ITt.readFile(E,"utf-8"),fileName:E},O;try{O=await LFe({sourceDirectory:a.sourceDirectory,oasContent:v,policiesContent:A})}catch(M){throw new Error("Error compiling routes: "+M.message)}if(Uh.DEBUG_BUILD_MODE&&O.content){let M=Bx.join(a.sourceDirectory,".zuplo"),W=Bx.resolve(M,"routes.js");await KA(W,O.content)}return{contents:O.content,errors:O.errors,pluginName:uU,resolveDir:Bx.dirname(c.path),watchFiles:[c.path]}}))}}}t(OTt,"openApiRoutesPlugin");import lde from"path";var NY="raw-route-plugin",FTt="raw-route";function LTt(a){return{name:"raw-route-plugin",setup(s){s.onResolve({filter:/raw.json$/},c=>({namespace:FTt,path:c.path,pluginName:NY})),s.onLoad({filter:/.*/,namespace:FTt},async c=>{let f=lde.resolve(a.sourceDirectory,mS);if(!await Ul.dirExists(f))return{loader:"js",resolveDir:lde.dirname(c.path),pluginName:NY};let d=await xF(f);try{let v=await jFe({oasFiles:d,sourceDirectory:a.sourceDirectory,logger:a.logger});if(Uh.DEBUG_BUILD_MODE&&v){let E=lde.join(a.sourceDirectory,".zuplo","raw-routes.js");await KA(E,v)}return{contents:v,loader:"js",resolveDir:lde.dirname(c.path),pluginName:NY}}catch(v){if(v instanceof pv)return{contents:"",loader:"ts",errors:[{id:"route-build-error",text:v.issue.text,location:v.issue.location,detail:v.issue.detail,pluginName:NY}],pluginName:NY};throw v}})}}}t(LTt,"rawRoutePlugin");import KPr from"fs/promises";import pLe from"path";var ude="runtime-config",RTt="runtime-config-plugin";function MTt(){return{name:ude,setup(a){a.onResolve({filter:/^\.\.\/modules\/zuplo.runtime.ts$/},s=>({namespace:RTt,path:pLe.isAbsolute(s.path)?s.path:pLe.join(s.resolveDir,s.path),pluginName:ude})),a.onLoad({filter:/.*/,namespace:RTt},async s=>__.timeFn("Generating zuplo.runtime.ts data",async()=>{let c="export const runtimeInit = undefined;",f=[];return await Ul.fileExists(s.path)?(c=await KPr.readFile(s.path,"utf-8"),{contents:c,loader:"ts",resolveDir:pLe.dirname(s.path),errors:f,pluginName:ude,watchFiles:[s.path]}):{contents:c,loader:"ts",errors:f,pluginName:ude}}))}}}t(MTt,"runtimeConfigPlugin");var BTt=Mp(uLe(),1),UTt=Mp(fLe(),1);import hLe from"fs/promises";import w7 from"path";var dLe="schema-validation-plugin",jTt="schema-validation",YPr="module.exports = {}";function $Tt(a){return{name:"schema-validation-plugin",setup(s){s.onResolve({filter:/ajv-schema.json$/},c=>({namespace:jTt,path:c.path,pluginName:dLe})),s.onLoad({filter:/.*/,namespace:jTt},async c=>{let f=w7.resolve(a.sourceDirectory,mS,"policies.json");if(!await Ul.fileExists(f))return{contents:YPr,loader:"js",resolveDir:w7.dirname(c.path),pluginName:dLe};let d=await ZPr(a.sourceDirectory),v=w7.resolve(a.sourceDirectory,mS),E=await xF(v),A=await n6r(E,d),O=await XPr({oasFiles:E,routesWithSchemaValidation:A,sourceDirectory:a.sourceDirectory,logger:a.logger});if(Uh.DEBUG_BUILD_MODE&&O){let M=w7.join(a.sourceDirectory,".zuplo","schema-validation.js");await KA(M,O)}return{contents:O,loader:"js",resolveDir:w7.dirname(c.path),pluginName:dLe}})}}}t($Tt,"schemaValidationPlugin");async function XPr({oasFiles:a,routesWithSchemaValidation:s,sourceDirectory:c,logger:f}){let d="",v=new cN(c,f);if(s.length===0)return d;let E=new BTt.Ajv2020({code:{source:!0},allErrors:!0,strict:!1,verbose:!0,meta:!0});for(let A of a){let O=await hLe.readFile(A,"utf-8"),M=w7.basename(A,".oas.json"),W=s.filter(Se=>Se.fileName===M),$=await v.resolve(A),Q=JSON.parse(O),Pe=[],De=new Map;W.forEach(Se=>{let Tt=Q.paths[Se.path][Se.method];if(Tt.requestBody){let wt;if(Tt.requestBody.$ref){let _r=Tt.requestBody.$ref;wt=$.get(_r)?.content}else Tt.requestBody.content&&(wt=Tt.requestBody.content);if(wt)for(let _r in wt){let lr=wt[_r].schema,Or=yIe(Se.path,Se.method,_r);lr.$id=Or,E.addSchema(lr),mLe(lr,A,M,E,$,Pe,De)}}if(Tt.parameters)for(let wt of Tt.parameters){let _r=wt.$ref?$.get(wt.$ref):wt,lr=_r.schema.$ref?$.get(_r.schema.$ref):_r.schema,Or=gIe(Se.path,Se.method,_r.in,_r.name);lr.$id=Or,E.addSchema(lr),mLe(_r,A,M,E,$,Pe,De)}});for(let Se of Pe){let Tt=$.get(Se),wt=jQ(M,Se);E.addSchema(Tt,wt)}}return d=(0,UTt.default)(E),d}t(XPr,"schemaValidationSource");function mLe(a,s,c,f,d,v,E){for(let A in a){let O=a[A];if(A==="$ref"){let M=jQ(c,Z3(s,O));a[A]=M,vQ(s,c,Z3(s,O),d,v,E,(W,$)=>jQ(W,Z3(s,$)))}else typeof O=="object"&&mLe(O,s,c,f,d,v,E)}}t(mLe,"addRefsToSchema");async function ZPr(a){let s=new Set(["RequestValidationInboundPolicy"]),c=await hLe.readFile(`${a}/config/policies.json`,"utf-8"),f=JSON.parse(c);return e6r(f,s)}t(ZPr,"getPolicyNamesUsingSchemaValidationPolicies");function e6r(a,s){let c=new Set;a.policies?.forEach(d=>{d.handler?.export&&s.has(d.handler.export)&&d.handler.module==="$import(@zuplo/runtime)"&&c.add(d.name)});let f=t6r(a,c);return new Set([...c,...f])}t(e6r,"getPolicyNamesReferencingPolicyHandlers");function t6r(a,s){let c=new Set;return a.policies?.forEach(f=>{f.handler?.export==="CompositeInboundPolicy"&&f.handler?.options?.policies?.forEach(d=>{s.has(d)&&c.add(f.name)})}),c}t(t6r,"getCompositePoliciesContainingPolicy");function r6r(a,s){if(!a["x-zuplo-route"]||!a["x-zuplo-route"].policies)return!1;let c=a["x-zuplo-route"].policies.inbound;if(c){for(let d of c)if(s.has(d))return!0}let f=a["x-zuplo-route"].policies.outbound;if(f){for(let d of f)if(s.has(d))return!0}return!1}t(r6r,"isPolicyPresentInOperation");async function n6r(a,s){let c=[];for(let f of a){let d=await hLe.readFile(f,"utf-8"),E=JSON.parse(d).paths;for(let A in E){let O=E[A];for(let M in O){let W=O[M];r6r(W,s)&&c.push({fileName:w7.basename(f,".oas.json"),path:A,method:M})}}}return c}t(n6r,"getRoutesContainingPolicies");import{mkdirSync as i6r,writeFileSync as s6r}from"fs";import a6r from"path";function JTt(a){return{name:"write-modules-plugin",setup(s){s.onEnd(async c=>{if(c){let f=JB(a.sourceDirectory,c.metafile);i6r(a.outputDirectory,{recursive:!0}),s6r(a6r.join(a.outputDirectory,"modules.json"),JSON.stringify(f,null,2))}})}}}t(JTt,"writeModulesPlugin");var o6r=Tyt("zuplo:core:build"),c6r=["workerd","worker","browser"],VTt=[...process.env.GLOBAL_MODULE_LOCATION?[process.env.GLOBAL_MODULE_LOCATION]:[],gLe.resolve(qTt(zTt(import.meta.url)),"..","..","..","node_modules"),gLe.resolve(qTt(zTt(import.meta.url)),"..","..","..","..","..","node_modules")];async function IY({systemDirectory:a,outputDirectory:s,sourceDirectory:c,cacheDirectory:f,logger:d,minify:v=!0,command:E,flags:A}){let O=gLe.join(a,fue);o6r(`Building with node paths: ${VTt.join(", ")}`);let M=v&&E!=="dev"&&!process.env.DEBUG_BUILD_DISABLE_MINIFY?{minify:!0,chunkNames:"[hash]"}:{minify:!1,keepNames:!0,chunkNames:"[name]-[hash]"},W={sourceDirectory:c,outputDirectory:s,cacheDirectory:f,logger:d,debugMode:Uh.DEBUG_BUILD_MODE,flags:A};return{platform:"browser",target:"es2022",outdir:s,splitting:!0,metafile:!0,format:"esm",nodePaths:VTt,entryPoints:[O],sourcemap:"linked",legalComments:"none",treeShaking:!0,bundle:!0,...M,external:[],logLevel:"silent",conditions:c6r,plugins:[dbt(W),Cyt(W),OTt(W),LTt(W),$Tt(W),MTt(),ubt(W),wTt(W),NTt(W),JTt(W)]}}t(IY,"getBaseESBuildConfig");var P7="run-esbuild",HTt=t(async function({systemDirectory:a,outputDirectory:s,sourceDirectory:c,cacheDirectory:f,buildId:d,logger:v,config:E,command:A,minify:O},{data:M}){return __.timeFn("Running esbuild",async()=>{v.debug("Running esbuild");let W=await IY({command:A,minify:O,systemDirectory:a,outputDirectory:s,cacheDirectory:f,sourceDirectory:c,logger:v,flags:E.flags}),$;try{if(!await Pj(c))throw new Error("Failed to build project because no open-api file was found on the 'config' folder");$=await WTt.build(W),M.set("metafile",$.metafile)}catch(De){if(v.error(De),De.errors||De.warnings)$=De;else if(De.message.includes("Failed to build project because no open-api file was found on the 'config' folder"))$={warnings:[],errors:[{id:"missing-open-api-file",text:"Failed to build project because no open-api file was found on the 'config' folder",pluginName:P7,location:null,notes:[],detail:"Failed to build project because no open-api file was found on the 'config' folder"}],outputFiles:void 0,metafile:void 0,mangleCache:void 0};else throw De}$.errors.length>0&&$.errors.length>1&&($.errors.length=1);let{errors:Q,warnings:Pe}=yLe({buildId:d,result:$});return{errors:Q,warnings:Pe}})},"runEsbuild");function yLe({buildId:a,result:s}){return{status:s.errors.length>0?"Failed":s.warnings.length>0?"Warnings":"Good",runtimeVersion:"0.0.0",buildTime:"",buildTimeMs:0,buildId:a,warnings:s.warnings.map(f=>f.text==="Using direct eval with a bundler is not recommended and may cause problems"?{location:f.location,detail:f.detail,id:f.id,notes:f.notes,message:"We do not support the use of 'eval' or 'new Function(...)'",severity:aue,pluginName:f.pluginName||P7}:{location:f.location,detail:f.detail,id:f.id,notes:f.notes,message:f.text,severity:aue,pluginName:f.pluginName||P7}),errors:s.errors.map(f=>({location:f.location,detail:f.detail,id:f.id,notes:f.notes,message:f.text,severity:o3e,pluginName:f.pluginName||P7})),metafile:s.metafile}}t(yLe,"esbuildResultToBuildResult");var l6r=t((a,s)=>{let c=s;if(s.includes(a)){let f=new RegExp(`.*(${a})`,"g");c=s.replace(f,"")}return c.match(/^(\/)?(\.\.(\/)?)+/)&&(c=c.replace(/^(\/)?(\.\.(\/)?)+/,"/")),c},"removePrefixFromString"),u6r=t((a,s)=>{let c=s;if(c.includes(a)){let f=new RegExp(`[a-zA-Z0-9-_.\\/]+(${a})`,"g");c=c.replace(f,"")}return c},"cleanFilePathsInMessage"),GTt=t((a,s,c)=>{if(!a||a.length<=0)return a;let f=a.filter(d=>d.message!=='Could not resolve "@zuplo/runtime"');return f&&f.length>0&&f.forEach(d=>{try{d.location&&d.location.file&&(d.location.file=l6r(s,d.location.file)),d.location&&d.location.lineText&&d.location.lineText.includes("@zuplo/core/index.minified.js")&&(d.location.lineText=d.location.lineText.substring(0,200)+"...<Truncated>"),d.message=u6r(s,d.message),d.notes&&d.notes.length>0&&delete d.notes,d.text&&delete d.text,d.pluginName===""&&(d.pluginName=c)}catch{}}),f},"cleanDataOnBuildIssue");function QTt(a,s){let c=vLe.basename(s);a.errors&&(a.errors=GTt(a.errors,c,P7)),a.warnings&&(a.warnings=GTt(a.warnings,c,P7))}t(QTt,"formatBuildResult");var f6r=t(a=>vLe.basename(a).startsWith("."),"isHiddenOnUnix"),_6r=t((a,s=[])=>s.map(c=>c.startsWith(".")?c:`.${c}`).some(c=>a.endsWith(c)),"hasMatchingExtname");function _Le(a,s=[],c=!1){let f=[],d;if(!fde.existsSync(a)){let v;if(mQ.hasMagic(a))v=a;else{let E=s.map(A=>A.startsWith(".")?A:`.${A}`).join("|");v=`${a}+(${E})`}if(f.push(...mQ.sync(v,{nodir:!0})),!f.length)throw Error(`Cannot find any files matching pattern "${a}"`);return f}try{if(d=fde.statSync(a),d.isFile())return[a]}catch{return[]}return fde.readdirSync(a).forEach(v=>{let E=vLe.join(a,v),A;try{if(A=fde.statSync(E),A.isDirectory()){c&&f.push(..._Le(E,s,c));return}}catch{return}if(!s.length)throw Error(`Argument '${s}' required when argument '${a}' is a directory`);!A.isFile()||!_6r(E,s)||f6r(E)||f.push(E)}),f}t(_Le,"lookupFiles");var N7=new hue({level:process.env.FORCE_BUILD_COLORS?2:void 0}),jN=` ${N7.gray("|")} `;function bLe({output:a,buildId:s,runtimeVersion:c,compatibilityDate:f}){let d=["Building Zuplo API...",`${jN}Build ID: ${s}`,`${jN}Runtime Version: ${c}`];f&&d.push(`${jN}Compatibility Date: ${f}`),a.info(d.join(`
617
617
  `))}t(bLe,"outputApiBuildStart");async function _de(a,s,c){QTt(c,a),await Promise.all(c.warnings.map(async f=>KTt(a,s,f))),await Promise.all(c.errors.map(async f=>KTt(a,s,f))),c.status==="Good"?s.info(N7.green("Build succeeded"),{status:"success"}):c.status==="Warnings"?s.warn(N7.yellow("Build succeeded with warnings"),{status:"success"}):c.status==="Failed"&&s.error(N7.red("Build failed."),{status:"failed"})}t(_de,"outputBuildResult");async function KTt(a,s,c){let f=[],d=c.severity??"error",v=d==="error"?N7.red:N7.yellow,E=v(`${d.toUpperCase()}: ${c.message}${c.detail?`
618
618
  ${jN}${c.detail.toString().split(`
package/index.minified.js CHANGED
@@ -612,7 +612,7 @@ Did you specify these with the most recent transformation maps first?`);let d=B7
612
612
  //# sourceMappingURL=data:application/json;base64,`,hvt=mp(()=>process.sourceMapsEnabled??!0,"shouldApplySourceMap"),gvt=mp(({code:a,map:s})=>a+qSr+Buffer.from(JSON.stringify(s),"utf8").toString("base64"),"inlineSourceMap"),zSr=[".cts",".mts",".ts",".tsx",".jsx"],VSr=[".js",".cjs",".mjs"],yvt=[".ts",".tsx",".jsx"],$7e=mp((a,s,c,f)=>{let d=Object.getOwnPropertyDescriptor(a,s);d?.set?a[s]=c:(!d||d.configurable)&&Object.defineProperty(a,s,{value:c,enumerable:d?.enumerable||f?.enumerable,writable:f?.writable??(d?d.writable:!0),configurable:f?.configurable??(d?d.configurable:!0)})},"safeSet"),WSr=mp((a,s,c)=>{let f=s[".js"],d=mp((v,E)=>{if(a.enabled===!1)return f(v,E);let[A,O]=E.split("?");if((new URLSearchParams(O).get("namespace")??void 0)!==c)return f(v,E);v.id.startsWith("data:text/javascript,")&&(v.path=bS.dirname(A)),_pe?.send&&_pe.send({type:"dependency",path:A});let M=zSr.some(Q=>A.endsWith(Q)),W=VSr.some(Q=>A.endsWith(Q));if(!M&&!W)return f(v,A);let $=jSr.readFileSync(A,"utf8");if(A.endsWith(".cjs")){let Q=fpe(E,$);Q&&($=hvt()?gvt(Q):Q.code)}else if(M||w1t($)){let Q=dvt($,E,{tsconfigRaw:Avt?.(A)});$=hvt()?gvt(Q):Q.code}v._compile($,A)},"transformer");$7e(s,".js",d);for(let v of yvt)$7e(s,v,d,{enumerable:!c,writable:!0,configurable:!0});return $7e(s,".mjs",d,{writable:!0,configurable:!0}),()=>{s[".js"]===d&&(s[".js"]=f);for(let v of[...yvt,".mjs"])s[v]===d&&delete s[v]}},"createExtensions"),HSr=mp(a=>s=>{if((s==="."||s===".."||s.endsWith("/.."))&&(s+="/"),Evt.test(s)){let c=bS.join(s,"index.js");s.startsWith("./")&&(c=`./${c}`);try{return a(c)}catch{}}try{return a(s)}catch(c){let f=c;if(f.code==="MODULE_NOT_FOUND")try{return a(`${s}${bS.sep}index.js`)}catch{}throw f}},"createImplicitResolver"),wvt=[".js",".json"],Pvt=[".ts",".tsx",".jsx"],GSr=[...Pvt,...wvt],QSr=[...wvt,...Pvt],zK=Object.create(null);zK[".js"]=[".ts",".tsx",".js",".jsx"],zK[".jsx"]=[".tsx",".ts",".jsx",".js"],zK[".cjs"]=[".cts"],zK[".mjs"]=[".mts"];var KSr=mp(a=>{let s=a.split("?"),c=s[1]?`?${s[1]}`:"",[f]=s,d=bS.extname(f),v=[],E=zK[d];if(E){let O=f.slice(0,-d.length);v.push(...E.map(M=>O+M+c))}let A=!(a.startsWith(VK)||dpe(f))||f.includes(Dvt)||f.includes("/node_modules/")?QSr:GSr;return v.push(...A.map(O=>f+O+c)),v},"mapTsExtensions"),ppe=mp((a,s,c)=>{if(Evt.test(s)||!c&&!kvt)return;let f=KSr(s);if(f)for(let d of f)try{return a(d)}catch(v){let{code:E}=v;if(E!=="MODULE_NOT_FOUND"&&E!=="ERR_PACKAGE_PATH_NOT_EXPORTED")throw v}},"resolveTsFilename"),YSr=mp((a,s)=>c=>{if(dpe(c)){let f=ppe(a,c,s);if(f)return f}try{return a(c)}catch(f){let d=f;if(d.code==="MODULE_NOT_FOUND"){if(typeof d.path=="string"&&d.path.endsWith(`${bS.sep}package.json`)){let E=d.message.match(/^Cannot find module '([^']+)'$/);if(E){let O=E[1],M=ppe(a,O,s);if(M)return M}let A=d.message.match(/^Cannot find module '([^']+)'. Please verify that the package.json has a valid "main" entry$/);if(A){let O=A[1],M=ppe(a,O,s);if(M)return M}}let v=ppe(a,c,s);if(v)return v}throw d}},"createTsExtensionResolver"),vvt="at cjsPreparseModuleExports (node:internal",XSr=mp(a=>{let s=a.stack.split(`
613
613
  `).slice(1);return s[1].includes(vvt)||s[2].includes(vvt)},"isFromCjsLexer"),ZSr=mp((a,s)=>{let c=a.split("?"),f=new URLSearchParams(c[1]);if(s?.filename){let d=Tvt(s.filename),v;if(d){let A=d.split("?"),O=A[0];v=A[1],s.filename=O,s.path=bS.dirname(O),s.paths=GA._nodeModulePaths(s.path),GA._cache[O]=s}v||(v=s.filename.split("?")[1]);let E=new URLSearchParams(v).get("namespace");E&&f.append("namespace",E)}return[c[0],f,(d,v)=>(bS.isAbsolute(d)&&!d.endsWith(".json")&&!d.endsWith(".node")&&!(v===0&&XSr(new Error))&&(d+=q7e(f)),d)]},"preserveQuery"),eTr=mp((a,s,c)=>{if(a.startsWith(VK)&&(a=Svt(a)),J7e&&!dpe(a)&&!s?.filename?.includes(Dvt)){let f=J7e(a);for(let d of f)try{return c(d)}catch{}}return c(a)},"resolveTsPaths"),tTr=mp((a,s,c)=>(f,d,...v)=>{if(a.enabled===!1)return s(f,d,...v);f=z7e(f);let[E,A,O]=ZSr(f,d);if((A.get("namespace")??void 0)!==c)return s(f,d,...v);let M=mp($=>s($,d,...v),"nextResolveSimple");M=YSr(M,!!(c||d?.filename&&$Sr.test(d.filename))),M=HSr(M);let W=eTr(E,d,M);return O(W,v.length)},"createResolveFilename"),bvt=mp((a,s)=>{if(!s)throw new Error("The current file path (__filename or import.meta.url) must be provided in the second argument of tsx.require()");return a.startsWith(".")?((typeof s=="string"&&s.startsWith(VK)||s instanceof URL)&&(s=Svt(s)),bS.resolve(bS.dirname(s),a)):a},"resolveContext"),WK=mp(a=>{let{sourceMapsEnabled:s}=process,c={enabled:!0};JSr(process.env.TSX_TSCONFIG_PATH),process.setSourceMapsEnabled(!0);let f=GA._resolveFilename,d=tTr(c,f,a?.namespace);GA._resolveFilename=d;let v=WSr(c,GA._extensions,a?.namespace),E=mp(()=>{s===!1&&process.setSourceMapsEnabled(!1),c.enabled=!1,GA._resolveFilename===d&&(GA._resolveFilename=f),v()},"unregister");if(a?.namespace){let A=mp((M,W)=>{let $=bvt(M,W),[Q,Pe]=$.split("?"),De=new URLSearchParams(Pe);return a.namespace&&!Q.startsWith("node:")&&De.set("namespace",a.namespace),t7(Q+q7e(De))},"scopedRequire");E.require=A;let O=mp((M,W,$)=>{let Q=bvt(M,W),[Pe,De]=Q.split("?"),Se=new URLSearchParams(De);return a.namespace&&!Pe.startsWith("node:")&&Se.set("namespace",a.namespace),d(Pe+q7e(Se),module,!1,$)},"scopedResolve");E.resolve=O,E.unregister=E}return E},"register");import{pathToFileURL as iTr}from"url";var rTr=Object.defineProperty,hpe=t((a,s)=>rTr(a,"name",{value:s,configurable:!0}),"o"),sTr=hpe(a=>(s,c)=>{if(!c)throw new Error("The current file path (import.meta.url) must be provided in the second argument of tsImport()");let f=c.startsWith(VK)?c:iTr(c).toString();return import(`tsx://${JSON.stringify({specifier:s,parentURL:f,namespace:a})}`)},"createScopedImport"),Nvt=!1,Ivt=hpe(a=>{if(!mpe.register)throw new Error(`This version of Node.js (${process.version}) does not support module.register(). Please upgrade to Node v18.19 or v20.6 and above.`);if(!Nvt){let{_resolveFilename:A}=mpe;mpe._resolveFilename=(O,...M)=>A(z7e(O),...M),Nvt=!0}let{sourceMapsEnabled:s}=process;process.setSourceMapsEnabled(!0);let{port1:c,port2:f}=new nTr;mpe.register(`./esm/index.mjs?${Date.now()}`,{parentURL:import.meta.url,data:{port:f,namespace:a?.namespace,tsconfig:a?.tsconfig},transferList:[f]});let d=a?.onImport,v=d&&(A=>{A.type==="load"&&d(A.url)});v&&(c.on("message",v),c.unref());let E=hpe(()=>(s===!1&&process.setSourceMapsEnabled(!1),v&&c.off("message",v),c.postMessage("deactivate"),new Promise(A=>{let O=hpe(M=>{M.type==="deactivated"&&(A(),c.off("message",O))},"onDeactivated");c.on("message",O)})),"unregister");return a?.namespace&&(E.import=sTr(a.namespace),E.unregister=E),E},"register");var aTr=Object.defineProperty,Fvt=t((a,s)=>aTr(a,"name",{value:s,configurable:!0}),"a"),FB,gpe=Fvt((a,s)=>(FB||(FB=WK({namespace:Date.now().toString()})),FB.require(a,s)),"tsxRequire"),Ovt=Fvt((a,s,c)=>(FB||(FB=WK({namespace:Date.now().toString()})),FB.resolve(a,s,c)),"resolve");Ovt.paths=t7.resolve.paths,gpe.resolve=Ovt,gpe.main=t7.main,gpe.extensions=t7.extensions,gpe.cache=t7.cache;var oTr=Object.defineProperty,Lvt=t((a,s)=>oTr(a,"name",{value:s,configurable:!0}),"o"),cTr=Lvt((a,s)=>{let c=a[0]-s[0];if(c===0){let f=a[1]-s[1];return f===0?a[2]>=s[2]:f>0}return c>0},"isVersionGreaterOrEqual"),lTr=process.versions.node.split(".").map(Number),Rvt=Lvt((a,s=lTr)=>{for(let c=0;c<a.length;c+=1){let f=a[c];if(c===a.length-1||s[0]===f[0])return cTr(s,f)}return!1},"isFeatureSupported");var Mvt=[[20,11,0],[21,3,0]];import"esbuild";var uTr=Object.defineProperty,fTr=t((a,s)=>uTr(a,"name",{value:s,configurable:!0}),"i"),jvt=fTr((a,s)=>{if(!s||typeof s=="object"&&!s.parentURL)throw new Error("The current file path (import.meta.url) must be provided in the second argument of tsImport()");let c=typeof s=="string",f=c?s:s.parentURL,d=Date.now().toString(),v=WK({namespace:d});return!Rvt(Mvt)&&!xvt.test(a)&&Cvt.test(a)?Promise.resolve(v.require(a,f)):Ivt({namespace:d,...c?{}:s}).import(a,f)},"tsImport");var sf;(function(a){a.assertEqual=d=>d;function s(d){}t(s,"assertIs"),a.assertIs=s;function c(d){throw new Error}t(c,"assertNever"),a.assertNever=c,a.arrayToEnum=d=>{let v={};for(let E of d)v[E]=E;return v},a.getValidEnumValues=d=>{let v=a.objectKeys(d).filter(A=>typeof d[d[A]]!="number"),E={};for(let A of v)E[A]=d[A];return a.objectValues(E)},a.objectValues=d=>a.objectKeys(d).map(function(v){return d[v]}),a.objectKeys=typeof Object.keys=="function"?d=>Object.keys(d):d=>{let v=[];for(let E in d)Object.prototype.hasOwnProperty.call(d,E)&&v.push(E);return v},a.find=(d,v)=>{for(let E of d)if(v(E))return E},a.isInteger=typeof Number.isInteger=="function"?d=>Number.isInteger(d):d=>typeof d=="number"&&isFinite(d)&&Math.floor(d)===d;function f(d,v=" | "){return d.map(E=>typeof E=="string"?`'${E}'`:E).join(v)}t(f,"joinValues"),a.joinValues=f,a.jsonStringifyReplacer=(d,v)=>typeof v=="bigint"?v.toString():v})(sf||(sf={}));var W7e;(function(a){a.mergeShapes=(s,c)=>({...s,...c})})(W7e||(W7e={}));var Ka=sf.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),AN=t(a=>{switch(typeof a){case"undefined":return Ka.undefined;case"string":return Ka.string;case"number":return isNaN(a)?Ka.nan:Ka.number;case"boolean":return Ka.boolean;case"function":return Ka.function;case"bigint":return Ka.bigint;case"symbol":return Ka.symbol;case"object":return Array.isArray(a)?Ka.array:a===null?Ka.null:a.then&&typeof a.then=="function"&&a.catch&&typeof a.catch=="function"?Ka.promise:typeof Map<"u"&&a instanceof Map?Ka.map:typeof Set<"u"&&a instanceof Set?Ka.set:typeof Date<"u"&&a instanceof Date?Ka.date:Ka.object;default:return Ka.unknown}},"getParsedType"),Ds=sf.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"]),_Tr=t(a=>JSON.stringify(a,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),SS=class a extends Error{static{t(this,"ZodError")}constructor(s){super(),this.issues=[],this.addIssue=f=>{this.issues=[...this.issues,f]},this.addIssues=(f=[])=>{this.issues=[...this.issues,...f]};let c=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,c):this.__proto__=c,this.name="ZodError",this.issues=s}get errors(){return this.issues}format(s){let c=s||function(v){return v.message},f={_errors:[]},d=t(v=>{for(let E of v.issues)if(E.code==="invalid_union")E.unionErrors.map(d);else if(E.code==="invalid_return_type")d(E.returnTypeError);else if(E.code==="invalid_arguments")d(E.argumentsError);else if(E.path.length===0)f._errors.push(c(E));else{let A=f,O=0;for(;O<E.path.length;){let M=E.path[O];O===E.path.length-1?(A[M]=A[M]||{_errors:[]},A[M]._errors.push(c(E))):A[M]=A[M]||{_errors:[]},A=A[M],O++}}},"processError");return d(this),f}static assert(s){if(!(s instanceof a))throw new Error(`Not a ZodError: ${s}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,sf.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(s=c=>c.message){let c={},f=[];for(let d of this.issues)d.path.length>0?(c[d.path[0]]=c[d.path[0]]||[],c[d.path[0]].push(s(d))):f.push(s(d));return{formErrors:f,fieldErrors:c}}get formErrors(){return this.flatten()}};SS.create=a=>new SS(a);var MB=t((a,s)=>{let c;switch(a.code){case Ds.invalid_type:a.received===Ka.undefined?c="Required":c=`Expected ${a.expected}, received ${a.received}`;break;case Ds.invalid_literal:c=`Invalid literal value, expected ${JSON.stringify(a.expected,sf.jsonStringifyReplacer)}`;break;case Ds.unrecognized_keys:c=`Unrecognized key(s) in object: ${sf.joinValues(a.keys,", ")}`;break;case Ds.invalid_union:c="Invalid input";break;case Ds.invalid_union_discriminator:c=`Invalid discriminator value. Expected ${sf.joinValues(a.options)}`;break;case Ds.invalid_enum_value:c=`Invalid enum value. Expected ${sf.joinValues(a.options)}, received '${a.received}'`;break;case Ds.invalid_arguments:c="Invalid function arguments";break;case Ds.invalid_return_type:c="Invalid function return type";break;case Ds.invalid_date:c="Invalid date";break;case Ds.invalid_string:typeof a.validation=="object"?"includes"in a.validation?(c=`Invalid input: must include "${a.validation.includes}"`,typeof a.validation.position=="number"&&(c=`${c} at one or more positions greater than or equal to ${a.validation.position}`)):"startsWith"in a.validation?c=`Invalid input: must start with "${a.validation.startsWith}"`:"endsWith"in a.validation?c=`Invalid input: must end with "${a.validation.endsWith}"`:sf.assertNever(a.validation):a.validation!=="regex"?c=`Invalid ${a.validation}`:c="Invalid";break;case Ds.too_small:a.type==="array"?c=`Array must contain ${a.exact?"exactly":a.inclusive?"at least":"more than"} ${a.minimum} element(s)`:a.type==="string"?c=`String must contain ${a.exact?"exactly":a.inclusive?"at least":"over"} ${a.minimum} character(s)`:a.type==="number"?c=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="date"?c=`Date must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(a.minimum))}`:c="Invalid input";break;case Ds.too_big:a.type==="array"?c=`Array must contain ${a.exact?"exactly":a.inclusive?"at most":"less than"} ${a.maximum} element(s)`:a.type==="string"?c=`String must contain ${a.exact?"exactly":a.inclusive?"at most":"under"} ${a.maximum} character(s)`:a.type==="number"?c=`Number must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="bigint"?c=`BigInt must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="date"?c=`Date must be ${a.exact?"exactly":a.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(a.maximum))}`:c="Invalid input";break;case Ds.custom:c="Invalid input";break;case Ds.invalid_intersection_types:c="Intersection results could not be merged";break;case Ds.not_multiple_of:c=`Number must be a multiple of ${a.multipleOf}`;break;case Ds.not_finite:c="Number must be finite";break;default:c=s.defaultError,sf.assertNever(a)}return{message:c}},"errorMap"),$vt=MB;function pTr(a){$vt=a}t(pTr,"setErrorMap");function ype(){return $vt}t(ype,"getErrorMap");var vpe=t(a=>{let{data:s,path:c,errorMaps:f,issueData:d}=a,v=[...c,...d.path||[]],E={...d,path:v};if(d.message!==void 0)return{...d,path:v,message:d.message};let A="",O=f.filter(M=>!!M).slice().reverse();for(let M of O)A=M(E,{data:s,defaultError:A}).message;return{...d,path:v,message:A}},"makeIssue"),dTr=[];function ja(a,s){let c=ype(),f=vpe({issueData:s,data:a.data,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,c,c===MB?void 0:MB].filter(d=>!!d)});a.common.issues.push(f)}t(ja,"addIssueToContext");var d1=class a{static{t(this,"ParseStatus")}constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(s,c){let f=[];for(let d of c){if(d.status==="aborted")return Bc;d.status==="dirty"&&s.dirty(),f.push(d.value)}return{status:s.value,value:f}}static async mergeObjectAsync(s,c){let f=[];for(let d of c){let v=await d.key,E=await d.value;f.push({key:v,value:E})}return a.mergeObjectSync(s,f)}static mergeObjectSync(s,c){let f={};for(let d of c){let{key:v,value:E}=d;if(v.status==="aborted"||E.status==="aborted")return Bc;v.status==="dirty"&&s.dirty(),E.status==="dirty"&&s.dirty(),v.value!=="__proto__"&&(typeof E.value<"u"||d.alwaysSet)&&(f[v.value]=E.value)}return{status:s.value,value:f}}},Bc=Object.freeze({status:"aborted"}),RB=t(a=>({status:"dirty",value:a}),"DIRTY"),Tv=t(a=>({status:"valid",value:a}),"OK"),H7e=t(a=>a.status==="aborted","isAborted"),G7e=t(a=>a.status==="dirty","isDirty"),QK=t(a=>a.status==="valid","isValid"),KK=t(a=>typeof Promise<"u"&&a instanceof Promise,"isAsync");function bpe(a,s,c,f){if(c==="a"&&!f)throw new TypeError("Private accessor was defined without a getter");if(typeof s=="function"?a!==s||!f:!s.has(a))throw new TypeError("Cannot read private member from an object whose class did not declare it");return c==="m"?f:c==="a"?f.call(a):f?f.value:s.get(a)}t(bpe,"__classPrivateFieldGet");function Jvt(a,s,c,f,d){if(f==="m")throw new TypeError("Private method is not writable");if(f==="a"&&!d)throw new TypeError("Private accessor was defined without a setter");if(typeof s=="function"?a!==s||!d:!s.has(a))throw new TypeError("Cannot write private member to an object whose class did not declare it");return f==="a"?d.call(a,c):d?d.value=c:s.set(a,c),c}t(Jvt,"__classPrivateFieldSet");var zo;(function(a){a.errToObj=s=>typeof s=="string"?{message:s}:s||{},a.toString=s=>typeof s=="string"?s:s?.message})(zo||(zo={}));var HK,GK,bC=class{static{t(this,"ParseInputLazyPath")}constructor(s,c,f,d){this._cachedPath=[],this.parent=s,this.data=c,this._path=f,this._key=d}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}},Bvt=t((a,s)=>{if(QK(s))return{success:!0,data:s.value};if(!a.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let c=new SS(a.common.issues);return this._error=c,this._error}}},"handleResult");function Dl(a){if(!a)return{};let{errorMap:s,invalid_type_error:c,required_error:f,description:d}=a;if(s&&(c||f))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return s?{errorMap:s,description:d}:{errorMap:t((E,A)=>{var O,M;let{message:W}=a;return E.code==="invalid_enum_value"?{message:W??A.defaultError}:typeof A.data>"u"?{message:(O=W??f)!==null&&O!==void 0?O:A.defaultError}:E.code!=="invalid_type"?{message:A.defaultError}:{message:(M=W??c)!==null&&M!==void 0?M:A.defaultError}},"customMap"),description:d}}t(Dl,"processCreateParams");var Al=class{static{t(this,"ZodType")}constructor(s){this.spa=this.safeParseAsync,this._def=s,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)}get description(){return this._def.description}_getType(s){return AN(s.data)}_getOrReturnCtx(s,c){return c||{common:s.parent.common,data:s.data,parsedType:AN(s.data),schemaErrorMap:this._def.errorMap,path:s.path,parent:s.parent}}_processInputParams(s){return{status:new d1,ctx:{common:s.parent.common,data:s.data,parsedType:AN(s.data),schemaErrorMap:this._def.errorMap,path:s.path,parent:s.parent}}}_parseSync(s){let c=this._parse(s);if(KK(c))throw new Error("Synchronous parse encountered promise.");return c}_parseAsync(s){let c=this._parse(s);return Promise.resolve(c)}parse(s,c){let f=this.safeParse(s,c);if(f.success)return f.data;throw f.error}safeParse(s,c){var f;let d={common:{issues:[],async:(f=c?.async)!==null&&f!==void 0?f:!1,contextualErrorMap:c?.errorMap},path:c?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:s,parsedType:AN(s)},v=this._parseSync({data:s,path:d.path,parent:d});return Bvt(d,v)}async parseAsync(s,c){let f=await this.safeParseAsync(s,c);if(f.success)return f.data;throw f.error}async safeParseAsync(s,c){let f={common:{issues:[],contextualErrorMap:c?.errorMap,async:!0},path:c?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:s,parsedType:AN(s)},d=this._parse({data:s,path:f.path,parent:f}),v=await(KK(d)?d:Promise.resolve(d));return Bvt(f,v)}refine(s,c){let f=t(d=>typeof c=="string"||typeof c>"u"?{message:c}:typeof c=="function"?c(d):c,"getIssueProperties");return this._refinement((d,v)=>{let E=s(d),A=t(()=>v.addIssue({code:Ds.custom,...f(d)}),"setError");return typeof Promise<"u"&&E instanceof Promise?E.then(O=>O?!0:(A(),!1)):E?!0:(A(),!1)})}refinement(s,c){return this._refinement((f,d)=>s(f)?!0:(d.addIssue(typeof c=="function"?c(f,d):c),!1))}_refinement(s){return new TS({schema:this,typeName:Oc.ZodEffects,effect:{type:"refinement",refinement:s}})}superRefine(s){return this._refinement(s)}optional(){return vC.create(this,this._def)}nullable(){return KA.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return l6.create(this,this._def)}promise(){return PN.create(this,this._def)}or(s){return u7.create([this,s],this._def)}and(s){return f7.create(this,s,this._def)}transform(s){return new TS({...Dl(this._def),schema:this,typeName:Oc.ZodEffects,effect:{type:"transform",transform:s}})}default(s){let c=typeof s=="function"?s:()=>s;return new h7({...Dl(this._def),innerType:this,defaultValue:c,typeName:Oc.ZodDefault})}brand(){return new YK({typeName:Oc.ZodBranded,type:this,...Dl(this._def)})}catch(s){let c=typeof s=="function"?s:()=>s;return new g7({...Dl(this._def),innerType:this,catchValue:c,typeName:Oc.ZodCatch})}describe(s){let c=this.constructor;return new c({...this._def,description:s})}pipe(s){return XK.create(this,s)}readonly(){return y7.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},mTr=/^c[^\s-]{8,}$/i,hTr=/^[0-9a-z]+$/,gTr=/^[0-9A-HJKMNP-TV-Z]{26}$/,yTr=/^[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,vTr=/^[a-z0-9_-]{21}$/i,bTr=/^[-+]?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)?)??$/,STr=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,TTr="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",V7e,CTr=/^(?:(?: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])$/,ETr=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,xTr=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,qvt="((\\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])))",DTr=new RegExp(`^${qvt}$`);function zvt(a){let s="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return a.precision?s=`${s}\\.\\d{${a.precision}}`:a.precision==null&&(s=`${s}(\\.\\d+)?`),s}t(zvt,"timeRegexSource");function ATr(a){return new RegExp(`^${zvt(a)}$`)}t(ATr,"timeRegex");function Vvt(a){let s=`${qvt}T${zvt(a)}`,c=[];return c.push(a.local?"Z?":"Z"),a.offset&&c.push("([+-]\\d{2}:?\\d{2})"),s=`${s}(${c.join("|")})`,new RegExp(`^${s}$`)}t(Vvt,"datetimeRegex");function kTr(a,s){return!!((s==="v4"||!s)&&CTr.test(a)||(s==="v6"||!s)&&ETr.test(a))}t(kTr,"isValidIP");var kN=class a extends Al{static{t(this,"ZodString")}_parse(s){if(this._def.coerce&&(s.data=String(s.data)),this._getType(s)!==Ka.string){let v=this._getOrReturnCtx(s);return ja(v,{code:Ds.invalid_type,expected:Ka.string,received:v.parsedType}),Bc}let f=new d1,d;for(let v of this._def.checks)if(v.kind==="min")s.data.length<v.value&&(d=this._getOrReturnCtx(s,d),ja(d,{code:Ds.too_small,minimum:v.value,type:"string",inclusive:!0,exact:!1,message:v.message}),f.dirty());else if(v.kind==="max")s.data.length>v.value&&(d=this._getOrReturnCtx(s,d),ja(d,{code:Ds.too_big,maximum:v.value,type:"string",inclusive:!0,exact:!1,message:v.message}),f.dirty());else if(v.kind==="length"){let E=s.data.length>v.value,A=s.data.length<v.value;(E||A)&&(d=this._getOrReturnCtx(s,d),E?ja(d,{code:Ds.too_big,maximum:v.value,type:"string",inclusive:!0,exact:!0,message:v.message}):A&&ja(d,{code:Ds.too_small,minimum:v.value,type:"string",inclusive:!0,exact:!0,message:v.message}),f.dirty())}else if(v.kind==="email")STr.test(s.data)||(d=this._getOrReturnCtx(s,d),ja(d,{validation:"email",code:Ds.invalid_string,message:v.message}),f.dirty());else if(v.kind==="emoji")V7e||(V7e=new RegExp(TTr,"u")),V7e.test(s.data)||(d=this._getOrReturnCtx(s,d),ja(d,{validation:"emoji",code:Ds.invalid_string,message:v.message}),f.dirty());else if(v.kind==="uuid")yTr.test(s.data)||(d=this._getOrReturnCtx(s,d),ja(d,{validation:"uuid",code:Ds.invalid_string,message:v.message}),f.dirty());else if(v.kind==="nanoid")vTr.test(s.data)||(d=this._getOrReturnCtx(s,d),ja(d,{validation:"nanoid",code:Ds.invalid_string,message:v.message}),f.dirty());else if(v.kind==="cuid")mTr.test(s.data)||(d=this._getOrReturnCtx(s,d),ja(d,{validation:"cuid",code:Ds.invalid_string,message:v.message}),f.dirty());else if(v.kind==="cuid2")hTr.test(s.data)||(d=this._getOrReturnCtx(s,d),ja(d,{validation:"cuid2",code:Ds.invalid_string,message:v.message}),f.dirty());else if(v.kind==="ulid")gTr.test(s.data)||(d=this._getOrReturnCtx(s,d),ja(d,{validation:"ulid",code:Ds.invalid_string,message:v.message}),f.dirty());else if(v.kind==="url")try{new URL(s.data)}catch{d=this._getOrReturnCtx(s,d),ja(d,{validation:"url",code:Ds.invalid_string,message:v.message}),f.dirty()}else v.kind==="regex"?(v.regex.lastIndex=0,v.regex.test(s.data)||(d=this._getOrReturnCtx(s,d),ja(d,{validation:"regex",code:Ds.invalid_string,message:v.message}),f.dirty())):v.kind==="trim"?s.data=s.data.trim():v.kind==="includes"?s.data.includes(v.value,v.position)||(d=this._getOrReturnCtx(s,d),ja(d,{code:Ds.invalid_string,validation:{includes:v.value,position:v.position},message:v.message}),f.dirty()):v.kind==="toLowerCase"?s.data=s.data.toLowerCase():v.kind==="toUpperCase"?s.data=s.data.toUpperCase():v.kind==="startsWith"?s.data.startsWith(v.value)||(d=this._getOrReturnCtx(s,d),ja(d,{code:Ds.invalid_string,validation:{startsWith:v.value},message:v.message}),f.dirty()):v.kind==="endsWith"?s.data.endsWith(v.value)||(d=this._getOrReturnCtx(s,d),ja(d,{code:Ds.invalid_string,validation:{endsWith:v.value},message:v.message}),f.dirty()):v.kind==="datetime"?Vvt(v).test(s.data)||(d=this._getOrReturnCtx(s,d),ja(d,{code:Ds.invalid_string,validation:"datetime",message:v.message}),f.dirty()):v.kind==="date"?DTr.test(s.data)||(d=this._getOrReturnCtx(s,d),ja(d,{code:Ds.invalid_string,validation:"date",message:v.message}),f.dirty()):v.kind==="time"?ATr(v).test(s.data)||(d=this._getOrReturnCtx(s,d),ja(d,{code:Ds.invalid_string,validation:"time",message:v.message}),f.dirty()):v.kind==="duration"?bTr.test(s.data)||(d=this._getOrReturnCtx(s,d),ja(d,{validation:"duration",code:Ds.invalid_string,message:v.message}),f.dirty()):v.kind==="ip"?kTr(s.data,v.version)||(d=this._getOrReturnCtx(s,d),ja(d,{validation:"ip",code:Ds.invalid_string,message:v.message}),f.dirty()):v.kind==="base64"?xTr.test(s.data)||(d=this._getOrReturnCtx(s,d),ja(d,{validation:"base64",code:Ds.invalid_string,message:v.message}),f.dirty()):sf.assertNever(v);return{status:f.value,value:s.data}}_regex(s,c,f){return this.refinement(d=>s.test(d),{validation:c,code:Ds.invalid_string,...zo.errToObj(f)})}_addCheck(s){return new a({...this._def,checks:[...this._def.checks,s]})}email(s){return this._addCheck({kind:"email",...zo.errToObj(s)})}url(s){return this._addCheck({kind:"url",...zo.errToObj(s)})}emoji(s){return this._addCheck({kind:"emoji",...zo.errToObj(s)})}uuid(s){return this._addCheck({kind:"uuid",...zo.errToObj(s)})}nanoid(s){return this._addCheck({kind:"nanoid",...zo.errToObj(s)})}cuid(s){return this._addCheck({kind:"cuid",...zo.errToObj(s)})}cuid2(s){return this._addCheck({kind:"cuid2",...zo.errToObj(s)})}ulid(s){return this._addCheck({kind:"ulid",...zo.errToObj(s)})}base64(s){return this._addCheck({kind:"base64",...zo.errToObj(s)})}ip(s){return this._addCheck({kind:"ip",...zo.errToObj(s)})}datetime(s){var c,f;return typeof s=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:s}):this._addCheck({kind:"datetime",precision:typeof s?.precision>"u"?null:s?.precision,offset:(c=s?.offset)!==null&&c!==void 0?c:!1,local:(f=s?.local)!==null&&f!==void 0?f:!1,...zo.errToObj(s?.message)})}date(s){return this._addCheck({kind:"date",message:s})}time(s){return typeof s=="string"?this._addCheck({kind:"time",precision:null,message:s}):this._addCheck({kind:"time",precision:typeof s?.precision>"u"?null:s?.precision,...zo.errToObj(s?.message)})}duration(s){return this._addCheck({kind:"duration",...zo.errToObj(s)})}regex(s,c){return this._addCheck({kind:"regex",regex:s,...zo.errToObj(c)})}includes(s,c){return this._addCheck({kind:"includes",value:s,position:c?.position,...zo.errToObj(c?.message)})}startsWith(s,c){return this._addCheck({kind:"startsWith",value:s,...zo.errToObj(c)})}endsWith(s,c){return this._addCheck({kind:"endsWith",value:s,...zo.errToObj(c)})}min(s,c){return this._addCheck({kind:"min",value:s,...zo.errToObj(c)})}max(s,c){return this._addCheck({kind:"max",value:s,...zo.errToObj(c)})}length(s,c){return this._addCheck({kind:"length",value:s,...zo.errToObj(c)})}nonempty(s){return this.min(1,zo.errToObj(s))}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(s=>s.kind==="datetime")}get isDate(){return!!this._def.checks.find(s=>s.kind==="date")}get isTime(){return!!this._def.checks.find(s=>s.kind==="time")}get isDuration(){return!!this._def.checks.find(s=>s.kind==="duration")}get isEmail(){return!!this._def.checks.find(s=>s.kind==="email")}get isURL(){return!!this._def.checks.find(s=>s.kind==="url")}get isEmoji(){return!!this._def.checks.find(s=>s.kind==="emoji")}get isUUID(){return!!this._def.checks.find(s=>s.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(s=>s.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(s=>s.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(s=>s.kind==="cuid2")}get isULID(){return!!this._def.checks.find(s=>s.kind==="ulid")}get isIP(){return!!this._def.checks.find(s=>s.kind==="ip")}get isBase64(){return!!this._def.checks.find(s=>s.kind==="base64")}get minLength(){let s=null;for(let c of this._def.checks)c.kind==="min"&&(s===null||c.value>s)&&(s=c.value);return s}get maxLength(){let s=null;for(let c of this._def.checks)c.kind==="max"&&(s===null||c.value<s)&&(s=c.value);return s}};kN.create=a=>{var s;return new kN({checks:[],typeName:Oc.ZodString,coerce:(s=a?.coerce)!==null&&s!==void 0?s:!1,...Dl(a)})};function wTr(a,s){let c=(a.toString().split(".")[1]||"").length,f=(s.toString().split(".")[1]||"").length,d=c>f?c:f,v=parseInt(a.toFixed(d).replace(".","")),E=parseInt(s.toFixed(d).replace(".",""));return v%E/Math.pow(10,d)}t(wTr,"floatSafeRemainder");var i7=class a extends Al{static{t(this,"ZodNumber")}constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(s){if(this._def.coerce&&(s.data=Number(s.data)),this._getType(s)!==Ka.number){let v=this._getOrReturnCtx(s);return ja(v,{code:Ds.invalid_type,expected:Ka.number,received:v.parsedType}),Bc}let f,d=new d1;for(let v of this._def.checks)v.kind==="int"?sf.isInteger(s.data)||(f=this._getOrReturnCtx(s,f),ja(f,{code:Ds.invalid_type,expected:"integer",received:"float",message:v.message}),d.dirty()):v.kind==="min"?(v.inclusive?s.data<v.value:s.data<=v.value)&&(f=this._getOrReturnCtx(s,f),ja(f,{code:Ds.too_small,minimum:v.value,type:"number",inclusive:v.inclusive,exact:!1,message:v.message}),d.dirty()):v.kind==="max"?(v.inclusive?s.data>v.value:s.data>=v.value)&&(f=this._getOrReturnCtx(s,f),ja(f,{code:Ds.too_big,maximum:v.value,type:"number",inclusive:v.inclusive,exact:!1,message:v.message}),d.dirty()):v.kind==="multipleOf"?wTr(s.data,v.value)!==0&&(f=this._getOrReturnCtx(s,f),ja(f,{code:Ds.not_multiple_of,multipleOf:v.value,message:v.message}),d.dirty()):v.kind==="finite"?Number.isFinite(s.data)||(f=this._getOrReturnCtx(s,f),ja(f,{code:Ds.not_finite,message:v.message}),d.dirty()):sf.assertNever(v);return{status:d.value,value:s.data}}gte(s,c){return this.setLimit("min",s,!0,zo.toString(c))}gt(s,c){return this.setLimit("min",s,!1,zo.toString(c))}lte(s,c){return this.setLimit("max",s,!0,zo.toString(c))}lt(s,c){return this.setLimit("max",s,!1,zo.toString(c))}setLimit(s,c,f,d){return new a({...this._def,checks:[...this._def.checks,{kind:s,value:c,inclusive:f,message:zo.toString(d)}]})}_addCheck(s){return new a({...this._def,checks:[...this._def.checks,s]})}int(s){return this._addCheck({kind:"int",message:zo.toString(s)})}positive(s){return this._addCheck({kind:"min",value:0,inclusive:!1,message:zo.toString(s)})}negative(s){return this._addCheck({kind:"max",value:0,inclusive:!1,message:zo.toString(s)})}nonpositive(s){return this._addCheck({kind:"max",value:0,inclusive:!0,message:zo.toString(s)})}nonnegative(s){return this._addCheck({kind:"min",value:0,inclusive:!0,message:zo.toString(s)})}multipleOf(s,c){return this._addCheck({kind:"multipleOf",value:s,message:zo.toString(c)})}finite(s){return this._addCheck({kind:"finite",message:zo.toString(s)})}safe(s){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:zo.toString(s)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:zo.toString(s)})}get minValue(){let s=null;for(let c of this._def.checks)c.kind==="min"&&(s===null||c.value>s)&&(s=c.value);return s}get maxValue(){let s=null;for(let c of this._def.checks)c.kind==="max"&&(s===null||c.value<s)&&(s=c.value);return s}get isInt(){return!!this._def.checks.find(s=>s.kind==="int"||s.kind==="multipleOf"&&sf.isInteger(s.value))}get isFinite(){let s=null,c=null;for(let f of this._def.checks){if(f.kind==="finite"||f.kind==="int"||f.kind==="multipleOf")return!0;f.kind==="min"?(c===null||f.value>c)&&(c=f.value):f.kind==="max"&&(s===null||f.value<s)&&(s=f.value)}return Number.isFinite(c)&&Number.isFinite(s)}};i7.create=a=>new i7({checks:[],typeName:Oc.ZodNumber,coerce:a?.coerce||!1,...Dl(a)});var s7=class a extends Al{static{t(this,"ZodBigInt")}constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(s){if(this._def.coerce&&(s.data=BigInt(s.data)),this._getType(s)!==Ka.bigint){let v=this._getOrReturnCtx(s);return ja(v,{code:Ds.invalid_type,expected:Ka.bigint,received:v.parsedType}),Bc}let f,d=new d1;for(let v of this._def.checks)v.kind==="min"?(v.inclusive?s.data<v.value:s.data<=v.value)&&(f=this._getOrReturnCtx(s,f),ja(f,{code:Ds.too_small,type:"bigint",minimum:v.value,inclusive:v.inclusive,message:v.message}),d.dirty()):v.kind==="max"?(v.inclusive?s.data>v.value:s.data>=v.value)&&(f=this._getOrReturnCtx(s,f),ja(f,{code:Ds.too_big,type:"bigint",maximum:v.value,inclusive:v.inclusive,message:v.message}),d.dirty()):v.kind==="multipleOf"?s.data%v.value!==BigInt(0)&&(f=this._getOrReturnCtx(s,f),ja(f,{code:Ds.not_multiple_of,multipleOf:v.value,message:v.message}),d.dirty()):sf.assertNever(v);return{status:d.value,value:s.data}}gte(s,c){return this.setLimit("min",s,!0,zo.toString(c))}gt(s,c){return this.setLimit("min",s,!1,zo.toString(c))}lte(s,c){return this.setLimit("max",s,!0,zo.toString(c))}lt(s,c){return this.setLimit("max",s,!1,zo.toString(c))}setLimit(s,c,f,d){return new a({...this._def,checks:[...this._def.checks,{kind:s,value:c,inclusive:f,message:zo.toString(d)}]})}_addCheck(s){return new a({...this._def,checks:[...this._def.checks,s]})}positive(s){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:zo.toString(s)})}negative(s){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:zo.toString(s)})}nonpositive(s){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:zo.toString(s)})}nonnegative(s){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:zo.toString(s)})}multipleOf(s,c){return this._addCheck({kind:"multipleOf",value:s,message:zo.toString(c)})}get minValue(){let s=null;for(let c of this._def.checks)c.kind==="min"&&(s===null||c.value>s)&&(s=c.value);return s}get maxValue(){let s=null;for(let c of this._def.checks)c.kind==="max"&&(s===null||c.value<s)&&(s=c.value);return s}};s7.create=a=>{var s;return new s7({checks:[],typeName:Oc.ZodBigInt,coerce:(s=a?.coerce)!==null&&s!==void 0?s:!1,...Dl(a)})};var a7=class extends Al{static{t(this,"ZodBoolean")}_parse(s){if(this._def.coerce&&(s.data=!!s.data),this._getType(s)!==Ka.boolean){let f=this._getOrReturnCtx(s);return ja(f,{code:Ds.invalid_type,expected:Ka.boolean,received:f.parsedType}),Bc}return Tv(s.data)}};a7.create=a=>new a7({typeName:Oc.ZodBoolean,coerce:a?.coerce||!1,...Dl(a)});var o7=class a extends Al{static{t(this,"ZodDate")}_parse(s){if(this._def.coerce&&(s.data=new Date(s.data)),this._getType(s)!==Ka.date){let v=this._getOrReturnCtx(s);return ja(v,{code:Ds.invalid_type,expected:Ka.date,received:v.parsedType}),Bc}if(isNaN(s.data.getTime())){let v=this._getOrReturnCtx(s);return ja(v,{code:Ds.invalid_date}),Bc}let f=new d1,d;for(let v of this._def.checks)v.kind==="min"?s.data.getTime()<v.value&&(d=this._getOrReturnCtx(s,d),ja(d,{code:Ds.too_small,message:v.message,inclusive:!0,exact:!1,minimum:v.value,type:"date"}),f.dirty()):v.kind==="max"?s.data.getTime()>v.value&&(d=this._getOrReturnCtx(s,d),ja(d,{code:Ds.too_big,message:v.message,inclusive:!0,exact:!1,maximum:v.value,type:"date"}),f.dirty()):sf.assertNever(v);return{status:f.value,value:new Date(s.data.getTime())}}_addCheck(s){return new a({...this._def,checks:[...this._def.checks,s]})}min(s,c){return this._addCheck({kind:"min",value:s.getTime(),message:zo.toString(c)})}max(s,c){return this._addCheck({kind:"max",value:s.getTime(),message:zo.toString(c)})}get minDate(){let s=null;for(let c of this._def.checks)c.kind==="min"&&(s===null||c.value>s)&&(s=c.value);return s!=null?new Date(s):null}get maxDate(){let s=null;for(let c of this._def.checks)c.kind==="max"&&(s===null||c.value<s)&&(s=c.value);return s!=null?new Date(s):null}};o7.create=a=>new o7({checks:[],coerce:a?.coerce||!1,typeName:Oc.ZodDate,...Dl(a)});var jB=class extends Al{static{t(this,"ZodSymbol")}_parse(s){if(this._getType(s)!==Ka.symbol){let f=this._getOrReturnCtx(s);return ja(f,{code:Ds.invalid_type,expected:Ka.symbol,received:f.parsedType}),Bc}return Tv(s.data)}};jB.create=a=>new jB({typeName:Oc.ZodSymbol,...Dl(a)});var c7=class extends Al{static{t(this,"ZodUndefined")}_parse(s){if(this._getType(s)!==Ka.undefined){let f=this._getOrReturnCtx(s);return ja(f,{code:Ds.invalid_type,expected:Ka.undefined,received:f.parsedType}),Bc}return Tv(s.data)}};c7.create=a=>new c7({typeName:Oc.ZodUndefined,...Dl(a)});var l7=class extends Al{static{t(this,"ZodNull")}_parse(s){if(this._getType(s)!==Ka.null){let f=this._getOrReturnCtx(s);return ja(f,{code:Ds.invalid_type,expected:Ka.null,received:f.parsedType}),Bc}return Tv(s.data)}};l7.create=a=>new l7({typeName:Oc.ZodNull,...Dl(a)});var wN=class extends Al{static{t(this,"ZodAny")}constructor(){super(...arguments),this._any=!0}_parse(s){return Tv(s.data)}};wN.create=a=>new wN({typeName:Oc.ZodAny,...Dl(a)});var c6=class extends Al{static{t(this,"ZodUnknown")}constructor(){super(...arguments),this._unknown=!0}_parse(s){return Tv(s.data)}};c6.create=a=>new c6({typeName:Oc.ZodUnknown,...Dl(a)});var Ox=class extends Al{static{t(this,"ZodNever")}_parse(s){let c=this._getOrReturnCtx(s);return ja(c,{code:Ds.invalid_type,expected:Ka.never,received:c.parsedType}),Bc}};Ox.create=a=>new Ox({typeName:Oc.ZodNever,...Dl(a)});var BB=class extends Al{static{t(this,"ZodVoid")}_parse(s){if(this._getType(s)!==Ka.undefined){let f=this._getOrReturnCtx(s);return ja(f,{code:Ds.invalid_type,expected:Ka.void,received:f.parsedType}),Bc}return Tv(s.data)}};BB.create=a=>new BB({typeName:Oc.ZodVoid,...Dl(a)});var l6=class a extends Al{static{t(this,"ZodArray")}_parse(s){let{ctx:c,status:f}=this._processInputParams(s),d=this._def;if(c.parsedType!==Ka.array)return ja(c,{code:Ds.invalid_type,expected:Ka.array,received:c.parsedType}),Bc;if(d.exactLength!==null){let E=c.data.length>d.exactLength.value,A=c.data.length<d.exactLength.value;(E||A)&&(ja(c,{code:E?Ds.too_big:Ds.too_small,minimum:A?d.exactLength.value:void 0,maximum:E?d.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:d.exactLength.message}),f.dirty())}if(d.minLength!==null&&c.data.length<d.minLength.value&&(ja(c,{code:Ds.too_small,minimum:d.minLength.value,type:"array",inclusive:!0,exact:!1,message:d.minLength.message}),f.dirty()),d.maxLength!==null&&c.data.length>d.maxLength.value&&(ja(c,{code:Ds.too_big,maximum:d.maxLength.value,type:"array",inclusive:!0,exact:!1,message:d.maxLength.message}),f.dirty()),c.common.async)return Promise.all([...c.data].map((E,A)=>d.type._parseAsync(new bC(c,E,c.path,A)))).then(E=>d1.mergeArray(f,E));let v=[...c.data].map((E,A)=>d.type._parseSync(new bC(c,E,c.path,A)));return d1.mergeArray(f,v)}get element(){return this._def.type}min(s,c){return new a({...this._def,minLength:{value:s,message:zo.toString(c)}})}max(s,c){return new a({...this._def,maxLength:{value:s,message:zo.toString(c)}})}length(s,c){return new a({...this._def,exactLength:{value:s,message:zo.toString(c)}})}nonempty(s){return this.min(1,s)}};l6.create=(a,s)=>new l6({type:a,minLength:null,maxLength:null,exactLength:null,typeName:Oc.ZodArray,...Dl(s)});function LB(a){if(a instanceof jb){let s={};for(let c in a.shape){let f=a.shape[c];s[c]=vC.create(LB(f))}return new jb({...a._def,shape:t(()=>s,"shape")})}else return a instanceof l6?new l6({...a._def,type:LB(a.element)}):a instanceof vC?vC.create(LB(a.unwrap())):a instanceof KA?KA.create(LB(a.unwrap())):a instanceof QA?QA.create(a.items.map(s=>LB(s))):a}t(LB,"deepPartialify");var jb=class a extends Al{static{t(this,"ZodObject")}constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let s=this._def.shape(),c=sf.objectKeys(s);return this._cached={shape:s,keys:c}}_parse(s){if(this._getType(s)!==Ka.object){let M=this._getOrReturnCtx(s);return ja(M,{code:Ds.invalid_type,expected:Ka.object,received:M.parsedType}),Bc}let{status:f,ctx:d}=this._processInputParams(s),{shape:v,keys:E}=this._getCached(),A=[];if(!(this._def.catchall instanceof Ox&&this._def.unknownKeys==="strip"))for(let M in d.data)E.includes(M)||A.push(M);let O=[];for(let M of E){let W=v[M],$=d.data[M];O.push({key:{status:"valid",value:M},value:W._parse(new bC(d,$,d.path,M)),alwaysSet:M in d.data})}if(this._def.catchall instanceof Ox){let M=this._def.unknownKeys;if(M==="passthrough")for(let W of A)O.push({key:{status:"valid",value:W},value:{status:"valid",value:d.data[W]}});else if(M==="strict")A.length>0&&(ja(d,{code:Ds.unrecognized_keys,keys:A}),f.dirty());else if(M!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let M=this._def.catchall;for(let W of A){let $=d.data[W];O.push({key:{status:"valid",value:W},value:M._parse(new bC(d,$,d.path,W)),alwaysSet:W in d.data})}}return d.common.async?Promise.resolve().then(async()=>{let M=[];for(let W of O){let $=await W.key,Q=await W.value;M.push({key:$,value:Q,alwaysSet:W.alwaysSet})}return M}).then(M=>d1.mergeObjectSync(f,M)):d1.mergeObjectSync(f,O)}get shape(){return this._def.shape()}strict(s){return zo.errToObj,new a({...this._def,unknownKeys:"strict",...s!==void 0?{errorMap:t((c,f)=>{var d,v,E,A;let O=(E=(v=(d=this._def).errorMap)===null||v===void 0?void 0:v.call(d,c,f).message)!==null&&E!==void 0?E:f.defaultError;return c.code==="unrecognized_keys"?{message:(A=zo.errToObj(s).message)!==null&&A!==void 0?A:O}:{message:O}},"errorMap")}:{}})}strip(){return new a({...this._def,unknownKeys:"strip"})}passthrough(){return new a({...this._def,unknownKeys:"passthrough"})}extend(s){return new a({...this._def,shape:t(()=>({...this._def.shape(),...s}),"shape")})}merge(s){return new a({unknownKeys:s._def.unknownKeys,catchall:s._def.catchall,shape:t(()=>({...this._def.shape(),...s._def.shape()}),"shape"),typeName:Oc.ZodObject})}setKey(s,c){return this.augment({[s]:c})}catchall(s){return new a({...this._def,catchall:s})}pick(s){let c={};return sf.objectKeys(s).forEach(f=>{s[f]&&this.shape[f]&&(c[f]=this.shape[f])}),new a({...this._def,shape:t(()=>c,"shape")})}omit(s){let c={};return sf.objectKeys(this.shape).forEach(f=>{s[f]||(c[f]=this.shape[f])}),new a({...this._def,shape:t(()=>c,"shape")})}deepPartial(){return LB(this)}partial(s){let c={};return sf.objectKeys(this.shape).forEach(f=>{let d=this.shape[f];s&&!s[f]?c[f]=d:c[f]=d.optional()}),new a({...this._def,shape:t(()=>c,"shape")})}required(s){let c={};return sf.objectKeys(this.shape).forEach(f=>{if(s&&!s[f])c[f]=this.shape[f];else{let v=this.shape[f];for(;v instanceof vC;)v=v._def.innerType;c[f]=v}}),new a({...this._def,shape:t(()=>c,"shape")})}keyof(){return Wvt(sf.objectKeys(this.shape))}};jb.create=(a,s)=>new jb({shape:t(()=>a,"shape"),unknownKeys:"strip",catchall:Ox.create(),typeName:Oc.ZodObject,...Dl(s)});jb.strictCreate=(a,s)=>new jb({shape:t(()=>a,"shape"),unknownKeys:"strict",catchall:Ox.create(),typeName:Oc.ZodObject,...Dl(s)});jb.lazycreate=(a,s)=>new jb({shape:a,unknownKeys:"strip",catchall:Ox.create(),typeName:Oc.ZodObject,...Dl(s)});var u7=class extends Al{static{t(this,"ZodUnion")}_parse(s){let{ctx:c}=this._processInputParams(s),f=this._def.options;function d(v){for(let A of v)if(A.result.status==="valid")return A.result;for(let A of v)if(A.result.status==="dirty")return c.common.issues.push(...A.ctx.common.issues),A.result;let E=v.map(A=>new SS(A.ctx.common.issues));return ja(c,{code:Ds.invalid_union,unionErrors:E}),Bc}if(t(d,"handleResults"),c.common.async)return Promise.all(f.map(async v=>{let E={...c,common:{...c.common,issues:[]},parent:null};return{result:await v._parseAsync({data:c.data,path:c.path,parent:E}),ctx:E}})).then(d);{let v,E=[];for(let O of f){let M={...c,common:{...c.common,issues:[]},parent:null},W=O._parseSync({data:c.data,path:c.path,parent:M});if(W.status==="valid")return W;W.status==="dirty"&&!v&&(v={result:W,ctx:M}),M.common.issues.length&&E.push(M.common.issues)}if(v)return c.common.issues.push(...v.ctx.common.issues),v.result;let A=E.map(O=>new SS(O));return ja(c,{code:Ds.invalid_union,unionErrors:A}),Bc}}get options(){return this._def.options}};u7.create=(a,s)=>new u7({options:a,typeName:Oc.ZodUnion,...Dl(s)});var o6=t(a=>a instanceof _7?o6(a.schema):a instanceof TS?o6(a.innerType()):a instanceof p7?[a.value]:a instanceof d7?a.options:a instanceof m7?sf.objectValues(a.enum):a instanceof h7?o6(a._def.innerType):a instanceof c7?[void 0]:a instanceof l7?[null]:a instanceof vC?[void 0,...o6(a.unwrap())]:a instanceof KA?[null,...o6(a.unwrap())]:a instanceof YK||a instanceof y7?o6(a.unwrap()):a instanceof g7?o6(a._def.innerType):[],"getDiscriminator"),Spe=class a extends Al{static{t(this,"ZodDiscriminatedUnion")}_parse(s){let{ctx:c}=this._processInputParams(s);if(c.parsedType!==Ka.object)return ja(c,{code:Ds.invalid_type,expected:Ka.object,received:c.parsedType}),Bc;let f=this.discriminator,d=c.data[f],v=this.optionsMap.get(d);return v?c.common.async?v._parseAsync({data:c.data,path:c.path,parent:c}):v._parseSync({data:c.data,path:c.path,parent:c}):(ja(c,{code:Ds.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[f]}),Bc)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(s,c,f){let d=new Map;for(let v of c){let E=o6(v.shape[s]);if(!E.length)throw new Error(`A discriminator value for key \`${s}\` could not be extracted from all schema options`);for(let A of E){if(d.has(A))throw new Error(`Discriminator property ${String(s)} has duplicate value ${String(A)}`);d.set(A,v)}}return new a({typeName:Oc.ZodDiscriminatedUnion,discriminator:s,options:c,optionsMap:d,...Dl(f)})}};function Q7e(a,s){let c=AN(a),f=AN(s);if(a===s)return{valid:!0,data:a};if(c===Ka.object&&f===Ka.object){let d=sf.objectKeys(s),v=sf.objectKeys(a).filter(A=>d.indexOf(A)!==-1),E={...a,...s};for(let A of v){let O=Q7e(a[A],s[A]);if(!O.valid)return{valid:!1};E[A]=O.data}return{valid:!0,data:E}}else if(c===Ka.array&&f===Ka.array){if(a.length!==s.length)return{valid:!1};let d=[];for(let v=0;v<a.length;v++){let E=a[v],A=s[v],O=Q7e(E,A);if(!O.valid)return{valid:!1};d.push(O.data)}return{valid:!0,data:d}}else return c===Ka.date&&f===Ka.date&&+a==+s?{valid:!0,data:a}:{valid:!1}}t(Q7e,"mergeValues");var f7=class extends Al{static{t(this,"ZodIntersection")}_parse(s){let{status:c,ctx:f}=this._processInputParams(s),d=t((v,E)=>{if(H7e(v)||H7e(E))return Bc;let A=Q7e(v.value,E.value);return A.valid?((G7e(v)||G7e(E))&&c.dirty(),{status:c.value,value:A.data}):(ja(f,{code:Ds.invalid_intersection_types}),Bc)},"handleParsed");return f.common.async?Promise.all([this._def.left._parseAsync({data:f.data,path:f.path,parent:f}),this._def.right._parseAsync({data:f.data,path:f.path,parent:f})]).then(([v,E])=>d(v,E)):d(this._def.left._parseSync({data:f.data,path:f.path,parent:f}),this._def.right._parseSync({data:f.data,path:f.path,parent:f}))}};f7.create=(a,s,c)=>new f7({left:a,right:s,typeName:Oc.ZodIntersection,...Dl(c)});var QA=class a extends Al{static{t(this,"ZodTuple")}_parse(s){let{status:c,ctx:f}=this._processInputParams(s);if(f.parsedType!==Ka.array)return ja(f,{code:Ds.invalid_type,expected:Ka.array,received:f.parsedType}),Bc;if(f.data.length<this._def.items.length)return ja(f,{code:Ds.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Bc;!this._def.rest&&f.data.length>this._def.items.length&&(ja(f,{code:Ds.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),c.dirty());let v=[...f.data].map((E,A)=>{let O=this._def.items[A]||this._def.rest;return O?O._parse(new bC(f,E,f.path,A)):null}).filter(E=>!!E);return f.common.async?Promise.all(v).then(E=>d1.mergeArray(c,E)):d1.mergeArray(c,v)}get items(){return this._def.items}rest(s){return new a({...this._def,rest:s})}};QA.create=(a,s)=>{if(!Array.isArray(a))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new QA({items:a,typeName:Oc.ZodTuple,rest:null,...Dl(s)})};var Tpe=class a extends Al{static{t(this,"ZodRecord")}get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(s){let{status:c,ctx:f}=this._processInputParams(s);if(f.parsedType!==Ka.object)return ja(f,{code:Ds.invalid_type,expected:Ka.object,received:f.parsedType}),Bc;let d=[],v=this._def.keyType,E=this._def.valueType;for(let A in f.data)d.push({key:v._parse(new bC(f,A,f.path,A)),value:E._parse(new bC(f,f.data[A],f.path,A)),alwaysSet:A in f.data});return f.common.async?d1.mergeObjectAsync(c,d):d1.mergeObjectSync(c,d)}get element(){return this._def.valueType}static create(s,c,f){return c instanceof Al?new a({keyType:s,valueType:c,typeName:Oc.ZodRecord,...Dl(f)}):new a({keyType:kN.create(),valueType:s,typeName:Oc.ZodRecord,...Dl(c)})}},UB=class extends Al{static{t(this,"ZodMap")}get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(s){let{status:c,ctx:f}=this._processInputParams(s);if(f.parsedType!==Ka.map)return ja(f,{code:Ds.invalid_type,expected:Ka.map,received:f.parsedType}),Bc;let d=this._def.keyType,v=this._def.valueType,E=[...f.data.entries()].map(([A,O],M)=>({key:d._parse(new bC(f,A,f.path,[M,"key"])),value:v._parse(new bC(f,O,f.path,[M,"value"]))}));if(f.common.async){let A=new Map;return Promise.resolve().then(async()=>{for(let O of E){let M=await O.key,W=await O.value;if(M.status==="aborted"||W.status==="aborted")return Bc;(M.status==="dirty"||W.status==="dirty")&&c.dirty(),A.set(M.value,W.value)}return{status:c.value,value:A}})}else{let A=new Map;for(let O of E){let M=O.key,W=O.value;if(M.status==="aborted"||W.status==="aborted")return Bc;(M.status==="dirty"||W.status==="dirty")&&c.dirty(),A.set(M.value,W.value)}return{status:c.value,value:A}}}};UB.create=(a,s,c)=>new UB({valueType:s,keyType:a,typeName:Oc.ZodMap,...Dl(c)});var $B=class a extends Al{static{t(this,"ZodSet")}_parse(s){let{status:c,ctx:f}=this._processInputParams(s);if(f.parsedType!==Ka.set)return ja(f,{code:Ds.invalid_type,expected:Ka.set,received:f.parsedType}),Bc;let d=this._def;d.minSize!==null&&f.data.size<d.minSize.value&&(ja(f,{code:Ds.too_small,minimum:d.minSize.value,type:"set",inclusive:!0,exact:!1,message:d.minSize.message}),c.dirty()),d.maxSize!==null&&f.data.size>d.maxSize.value&&(ja(f,{code:Ds.too_big,maximum:d.maxSize.value,type:"set",inclusive:!0,exact:!1,message:d.maxSize.message}),c.dirty());let v=this._def.valueType;function E(O){let M=new Set;for(let W of O){if(W.status==="aborted")return Bc;W.status==="dirty"&&c.dirty(),M.add(W.value)}return{status:c.value,value:M}}t(E,"finalizeSet");let A=[...f.data.values()].map((O,M)=>v._parse(new bC(f,O,f.path,M)));return f.common.async?Promise.all(A).then(O=>E(O)):E(A)}min(s,c){return new a({...this._def,minSize:{value:s,message:zo.toString(c)}})}max(s,c){return new a({...this._def,maxSize:{value:s,message:zo.toString(c)}})}size(s,c){return this.min(s,c).max(s,c)}nonempty(s){return this.min(1,s)}};$B.create=(a,s)=>new $B({valueType:a,minSize:null,maxSize:null,typeName:Oc.ZodSet,...Dl(s)});var Cpe=class a extends Al{static{t(this,"ZodFunction")}constructor(){super(...arguments),this.validate=this.implement}_parse(s){let{ctx:c}=this._processInputParams(s);if(c.parsedType!==Ka.function)return ja(c,{code:Ds.invalid_type,expected:Ka.function,received:c.parsedType}),Bc;function f(A,O){return vpe({data:A,path:c.path,errorMaps:[c.common.contextualErrorMap,c.schemaErrorMap,ype(),MB].filter(M=>!!M),issueData:{code:Ds.invalid_arguments,argumentsError:O}})}t(f,"makeArgsIssue");function d(A,O){return vpe({data:A,path:c.path,errorMaps:[c.common.contextualErrorMap,c.schemaErrorMap,ype(),MB].filter(M=>!!M),issueData:{code:Ds.invalid_return_type,returnTypeError:O}})}t(d,"makeReturnsIssue");let v={errorMap:c.common.contextualErrorMap},E=c.data;if(this._def.returns instanceof PN){let A=this;return Tv(async function(...O){let M=new SS([]),W=await A._def.args.parseAsync(O,v).catch(Pe=>{throw M.addIssue(f(O,Pe)),M}),$=await Reflect.apply(E,this,W);return await A._def.returns._def.type.parseAsync($,v).catch(Pe=>{throw M.addIssue(d($,Pe)),M})})}else{let A=this;return Tv(function(...O){let M=A._def.args.safeParse(O,v);if(!M.success)throw new SS([f(O,M.error)]);let W=Reflect.apply(E,this,M.data),$=A._def.returns.safeParse(W,v);if(!$.success)throw new SS([d(W,$.error)]);return $.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...s){return new a({...this._def,args:QA.create(s).rest(c6.create())})}returns(s){return new a({...this._def,returns:s})}implement(s){return this.parse(s)}strictImplement(s){return this.parse(s)}static create(s,c,f){return new a({args:s||QA.create([]).rest(c6.create()),returns:c||c6.create(),typeName:Oc.ZodFunction,...Dl(f)})}},_7=class extends Al{static{t(this,"ZodLazy")}get schema(){return this._def.getter()}_parse(s){let{ctx:c}=this._processInputParams(s);return this._def.getter()._parse({data:c.data,path:c.path,parent:c})}};_7.create=(a,s)=>new _7({getter:a,typeName:Oc.ZodLazy,...Dl(s)});var p7=class extends Al{static{t(this,"ZodLiteral")}_parse(s){if(s.data!==this._def.value){let c=this._getOrReturnCtx(s);return ja(c,{received:c.data,code:Ds.invalid_literal,expected:this._def.value}),Bc}return{status:"valid",value:s.data}}get value(){return this._def.value}};p7.create=(a,s)=>new p7({value:a,typeName:Oc.ZodLiteral,...Dl(s)});function Wvt(a,s){return new d7({values:a,typeName:Oc.ZodEnum,...Dl(s)})}t(Wvt,"createZodEnum");var d7=class a extends Al{static{t(this,"ZodEnum")}constructor(){super(...arguments),HK.set(this,void 0)}_parse(s){if(typeof s.data!="string"){let c=this._getOrReturnCtx(s),f=this._def.values;return ja(c,{expected:sf.joinValues(f),received:c.parsedType,code:Ds.invalid_type}),Bc}if(bpe(this,HK,"f")||Jvt(this,HK,new Set(this._def.values),"f"),!bpe(this,HK,"f").has(s.data)){let c=this._getOrReturnCtx(s),f=this._def.values;return ja(c,{received:c.data,code:Ds.invalid_enum_value,options:f}),Bc}return Tv(s.data)}get options(){return this._def.values}get enum(){let s={};for(let c of this._def.values)s[c]=c;return s}get Values(){let s={};for(let c of this._def.values)s[c]=c;return s}get Enum(){let s={};for(let c of this._def.values)s[c]=c;return s}extract(s,c=this._def){return a.create(s,{...this._def,...c})}exclude(s,c=this._def){return a.create(this.options.filter(f=>!s.includes(f)),{...this._def,...c})}};HK=new WeakMap;d7.create=Wvt;var m7=class extends Al{static{t(this,"ZodNativeEnum")}constructor(){super(...arguments),GK.set(this,void 0)}_parse(s){let c=sf.getValidEnumValues(this._def.values),f=this._getOrReturnCtx(s);if(f.parsedType!==Ka.string&&f.parsedType!==Ka.number){let d=sf.objectValues(c);return ja(f,{expected:sf.joinValues(d),received:f.parsedType,code:Ds.invalid_type}),Bc}if(bpe(this,GK,"f")||Jvt(this,GK,new Set(sf.getValidEnumValues(this._def.values)),"f"),!bpe(this,GK,"f").has(s.data)){let d=sf.objectValues(c);return ja(f,{received:f.data,code:Ds.invalid_enum_value,options:d}),Bc}return Tv(s.data)}get enum(){return this._def.values}};GK=new WeakMap;m7.create=(a,s)=>new m7({values:a,typeName:Oc.ZodNativeEnum,...Dl(s)});var PN=class extends Al{static{t(this,"ZodPromise")}unwrap(){return this._def.type}_parse(s){let{ctx:c}=this._processInputParams(s);if(c.parsedType!==Ka.promise&&c.common.async===!1)return ja(c,{code:Ds.invalid_type,expected:Ka.promise,received:c.parsedType}),Bc;let f=c.parsedType===Ka.promise?c.data:Promise.resolve(c.data);return Tv(f.then(d=>this._def.type.parseAsync(d,{path:c.path,errorMap:c.common.contextualErrorMap})))}};PN.create=(a,s)=>new PN({type:a,typeName:Oc.ZodPromise,...Dl(s)});var TS=class extends Al{static{t(this,"ZodEffects")}innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Oc.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(s){let{status:c,ctx:f}=this._processInputParams(s),d=this._def.effect||null,v={addIssue:t(E=>{ja(f,E),E.fatal?c.abort():c.dirty()},"addIssue"),get path(){return f.path}};if(v.addIssue=v.addIssue.bind(v),d.type==="preprocess"){let E=d.transform(f.data,v);if(f.common.async)return Promise.resolve(E).then(async A=>{if(c.value==="aborted")return Bc;let O=await this._def.schema._parseAsync({data:A,path:f.path,parent:f});return O.status==="aborted"?Bc:O.status==="dirty"||c.value==="dirty"?RB(O.value):O});{if(c.value==="aborted")return Bc;let A=this._def.schema._parseSync({data:E,path:f.path,parent:f});return A.status==="aborted"?Bc:A.status==="dirty"||c.value==="dirty"?RB(A.value):A}}if(d.type==="refinement"){let E=t(A=>{let O=d.refinement(A,v);if(f.common.async)return Promise.resolve(O);if(O instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return A},"executeRefinement");if(f.common.async===!1){let A=this._def.schema._parseSync({data:f.data,path:f.path,parent:f});return A.status==="aborted"?Bc:(A.status==="dirty"&&c.dirty(),E(A.value),{status:c.value,value:A.value})}else return this._def.schema._parseAsync({data:f.data,path:f.path,parent:f}).then(A=>A.status==="aborted"?Bc:(A.status==="dirty"&&c.dirty(),E(A.value).then(()=>({status:c.value,value:A.value}))))}if(d.type==="transform")if(f.common.async===!1){let E=this._def.schema._parseSync({data:f.data,path:f.path,parent:f});if(!QK(E))return E;let A=d.transform(E.value,v);if(A instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:c.value,value:A}}else return this._def.schema._parseAsync({data:f.data,path:f.path,parent:f}).then(E=>QK(E)?Promise.resolve(d.transform(E.value,v)).then(A=>({status:c.value,value:A})):E);sf.assertNever(d)}};TS.create=(a,s,c)=>new TS({schema:a,typeName:Oc.ZodEffects,effect:s,...Dl(c)});TS.createWithPreprocess=(a,s,c)=>new TS({schema:s,effect:{type:"preprocess",transform:a},typeName:Oc.ZodEffects,...Dl(c)});var vC=class extends Al{static{t(this,"ZodOptional")}_parse(s){return this._getType(s)===Ka.undefined?Tv(void 0):this._def.innerType._parse(s)}unwrap(){return this._def.innerType}};vC.create=(a,s)=>new vC({innerType:a,typeName:Oc.ZodOptional,...Dl(s)});var KA=class extends Al{static{t(this,"ZodNullable")}_parse(s){return this._getType(s)===Ka.null?Tv(null):this._def.innerType._parse(s)}unwrap(){return this._def.innerType}};KA.create=(a,s)=>new KA({innerType:a,typeName:Oc.ZodNullable,...Dl(s)});var h7=class extends Al{static{t(this,"ZodDefault")}_parse(s){let{ctx:c}=this._processInputParams(s),f=c.data;return c.parsedType===Ka.undefined&&(f=this._def.defaultValue()),this._def.innerType._parse({data:f,path:c.path,parent:c})}removeDefault(){return this._def.innerType}};h7.create=(a,s)=>new h7({innerType:a,typeName:Oc.ZodDefault,defaultValue:typeof s.default=="function"?s.default:()=>s.default,...Dl(s)});var g7=class extends Al{static{t(this,"ZodCatch")}_parse(s){let{ctx:c}=this._processInputParams(s),f={...c,common:{...c.common,issues:[]}},d=this._def.innerType._parse({data:f.data,path:f.path,parent:{...f}});return KK(d)?d.then(v=>({status:"valid",value:v.status==="valid"?v.value:this._def.catchValue({get error(){return new SS(f.common.issues)},input:f.data})})):{status:"valid",value:d.status==="valid"?d.value:this._def.catchValue({get error(){return new SS(f.common.issues)},input:f.data})}}removeCatch(){return this._def.innerType}};g7.create=(a,s)=>new g7({innerType:a,typeName:Oc.ZodCatch,catchValue:typeof s.catch=="function"?s.catch:()=>s.catch,...Dl(s)});var JB=class extends Al{static{t(this,"ZodNaN")}_parse(s){if(this._getType(s)!==Ka.nan){let f=this._getOrReturnCtx(s);return ja(f,{code:Ds.invalid_type,expected:Ka.nan,received:f.parsedType}),Bc}return{status:"valid",value:s.data}}};JB.create=a=>new JB({typeName:Oc.ZodNaN,...Dl(a)});var PTr=Symbol("zod_brand"),YK=class extends Al{static{t(this,"ZodBranded")}_parse(s){let{ctx:c}=this._processInputParams(s),f=c.data;return this._def.type._parse({data:f,path:c.path,parent:c})}unwrap(){return this._def.type}},XK=class a extends Al{static{t(this,"ZodPipeline")}_parse(s){let{status:c,ctx:f}=this._processInputParams(s);if(f.common.async)return t(async()=>{let v=await this._def.in._parseAsync({data:f.data,path:f.path,parent:f});return v.status==="aborted"?Bc:v.status==="dirty"?(c.dirty(),RB(v.value)):this._def.out._parseAsync({data:v.value,path:f.path,parent:f})},"handleAsync")();{let d=this._def.in._parseSync({data:f.data,path:f.path,parent:f});return d.status==="aborted"?Bc:d.status==="dirty"?(c.dirty(),{status:"dirty",value:d.value}):this._def.out._parseSync({data:d.value,path:f.path,parent:f})}}static create(s,c){return new a({in:s,out:c,typeName:Oc.ZodPipeline})}},y7=class extends Al{static{t(this,"ZodReadonly")}_parse(s){let c=this._def.innerType._parse(s),f=t(d=>(QK(d)&&(d.value=Object.freeze(d.value)),d),"freeze");return KK(c)?c.then(d=>f(d)):f(c)}unwrap(){return this._def.innerType}};y7.create=(a,s)=>new y7({innerType:a,typeName:Oc.ZodReadonly,...Dl(s)});function Hvt(a,s={},c){return a?wN.create().superRefine((f,d)=>{var v,E;if(!a(f)){let A=typeof s=="function"?s(f):typeof s=="string"?{message:s}:s,O=(E=(v=A.fatal)!==null&&v!==void 0?v:c)!==null&&E!==void 0?E:!0,M=typeof A=="string"?{message:A}:A;d.addIssue({code:"custom",...M,fatal:O})}}):wN.create()}t(Hvt,"custom");var NTr={object:jb.lazycreate},Oc;(function(a){a.ZodString="ZodString",a.ZodNumber="ZodNumber",a.ZodNaN="ZodNaN",a.ZodBigInt="ZodBigInt",a.ZodBoolean="ZodBoolean",a.ZodDate="ZodDate",a.ZodSymbol="ZodSymbol",a.ZodUndefined="ZodUndefined",a.ZodNull="ZodNull",a.ZodAny="ZodAny",a.ZodUnknown="ZodUnknown",a.ZodNever="ZodNever",a.ZodVoid="ZodVoid",a.ZodArray="ZodArray",a.ZodObject="ZodObject",a.ZodUnion="ZodUnion",a.ZodDiscriminatedUnion="ZodDiscriminatedUnion",a.ZodIntersection="ZodIntersection",a.ZodTuple="ZodTuple",a.ZodRecord="ZodRecord",a.ZodMap="ZodMap",a.ZodSet="ZodSet",a.ZodFunction="ZodFunction",a.ZodLazy="ZodLazy",a.ZodLiteral="ZodLiteral",a.ZodEnum="ZodEnum",a.ZodEffects="ZodEffects",a.ZodNativeEnum="ZodNativeEnum",a.ZodOptional="ZodOptional",a.ZodNullable="ZodNullable",a.ZodDefault="ZodDefault",a.ZodCatch="ZodCatch",a.ZodPromise="ZodPromise",a.ZodBranded="ZodBranded",a.ZodPipeline="ZodPipeline",a.ZodReadonly="ZodReadonly"})(Oc||(Oc={}));var ITr=t((a,s={message:`Input not instance of ${a.name}`})=>Hvt(c=>c instanceof a,s),"instanceOfType"),Gvt=kN.create,Qvt=i7.create,OTr=JB.create,FTr=s7.create,Kvt=a7.create,LTr=o7.create,RTr=jB.create,MTr=c7.create,jTr=l7.create,BTr=wN.create,UTr=c6.create,$Tr=Ox.create,JTr=BB.create,qTr=l6.create,zTr=jb.create,VTr=jb.strictCreate,WTr=u7.create,HTr=Spe.create,GTr=f7.create,QTr=QA.create,KTr=Tpe.create,YTr=UB.create,XTr=$B.create,ZTr=Cpe.create,eCr=_7.create,tCr=p7.create,rCr=d7.create,nCr=m7.create,iCr=PN.create,Uvt=TS.create,sCr=vC.create,aCr=KA.create,oCr=TS.createWithPreprocess,cCr=XK.create,lCr=t(()=>Gvt().optional(),"ostring"),uCr=t(()=>Qvt().optional(),"onumber"),fCr=t(()=>Kvt().optional(),"oboolean"),_Cr={string:t(a=>kN.create({...a,coerce:!0}),"string"),number:t(a=>i7.create({...a,coerce:!0}),"number"),boolean:t(a=>a7.create({...a,coerce:!0}),"boolean"),bigint:t(a=>s7.create({...a,coerce:!0}),"bigint"),date:t(a=>o7.create({...a,coerce:!0}),"date")},pCr=Bc,qr=Object.freeze({__proto__:null,defaultErrorMap:MB,setErrorMap:pTr,getErrorMap:ype,makeIssue:vpe,EMPTY_PATH:dTr,addIssueToContext:ja,ParseStatus:d1,INVALID:Bc,DIRTY:RB,OK:Tv,isAborted:H7e,isDirty:G7e,isValid:QK,isAsync:KK,get util(){return sf},get objectUtil(){return W7e},ZodParsedType:Ka,getParsedType:AN,ZodType:Al,datetimeRegex:Vvt,ZodString:kN,ZodNumber:i7,ZodBigInt:s7,ZodBoolean:a7,ZodDate:o7,ZodSymbol:jB,ZodUndefined:c7,ZodNull:l7,ZodAny:wN,ZodUnknown:c6,ZodNever:Ox,ZodVoid:BB,ZodArray:l6,ZodObject:jb,ZodUnion:u7,ZodDiscriminatedUnion:Spe,ZodIntersection:f7,ZodTuple:QA,ZodRecord:Tpe,ZodMap:UB,ZodSet:$B,ZodFunction:Cpe,ZodLazy:_7,ZodLiteral:p7,ZodEnum:d7,ZodNativeEnum:m7,ZodPromise:PN,ZodEffects:TS,ZodTransformer:TS,ZodOptional:vC,ZodNullable:KA,ZodDefault:h7,ZodCatch:g7,ZodNaN:JB,BRAND:PTr,ZodBranded:YK,ZodPipeline:XK,ZodReadonly:y7,custom:Hvt,Schema:Al,ZodSchema:Al,late:NTr,get ZodFirstPartyTypeKind(){return Oc},coerce:_Cr,any:BTr,array:qTr,bigint:FTr,boolean:Kvt,date:LTr,discriminatedUnion:HTr,effect:Uvt,enum:rCr,function:ZTr,instanceof:ITr,intersection:GTr,lazy:eCr,literal:tCr,map:YTr,nan:OTr,nativeEnum:nCr,never:$Tr,null:jTr,nullable:aCr,number:Qvt,object:zTr,oboolean:fCr,onumber:uCr,optional:sCr,ostring:lCr,pipeline:cCr,preprocess:oCr,promise:iCr,record:KTr,set:XTr,strictObject:VTr,string:Gvt,symbol:RTr,transformer:Uvt,tuple:QTr,undefined:MTr,union:WTr,unknown:UTr,void:JTr,NEVER:pCr,ZodIssueCode:Ds,quotelessJson:_Tr,ZodError:SS});function Yvt(a){return a instanceof Error&&a.name==="ZodError"&&"issues"in a&&Array.isArray(a.issues)}t(Yvt,"isZodErrorLike");var K7e=class extends Error{static{t(this,"ValidationError")}name;details;constructor(a,s){super(a,s),this.name="ZodValidationError",this.details=mCr(s)}toString(){return this.message}};function mCr(a){if(a){let s=a.cause;if(Yvt(s))return s.issues}return[]}t(mCr,"getIssuesFromErrorOptions");function Xvt(a){return a.length!==0}t(Xvt,"isNonEmptyArray");var hCr=/[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*/u;function gCr(a){return a.length===1?a[0].toString():a.reduce((s,c)=>{if(typeof c=="number")return s+"["+c.toString()+"]";if(c.includes('"'))return s+'["'+yCr(c)+'"]';if(!hCr.test(c))return s+'["'+c+'"]';let f=s.length===0?"":".";return s+f+c},"")}t(gCr,"joinPath");function yCr(a){return a.replace(/"/g,'\\"')}t(yCr,"escapeQuotes");var vCr="; ",bCr=99,Zvt="Validation error",SCr=": ",TCr=", or ";function CCr(a={}){let{issueSeparator:s=vCr,unionSeparator:c=TCr,prefixSeparator:f=SCr,prefix:d=Zvt,includePath:v=!0,maxIssuesInMessage:E=bCr}=a;return A=>{let O=A.slice(0,E).map(M=>Epe({issue:M,issueSeparator:s,unionSeparator:c,includePath:v})).join(s);return ECr(O,d,f)}}t(CCr,"createMessageBuilder");function Epe(a){let{issue:s,issueSeparator:c,unionSeparator:f,includePath:d}=a;if(s.code===Ds.invalid_union)return s.unionErrors.reduce((v,E)=>{let A=E.issues.map(O=>Epe({issue:O,issueSeparator:c,unionSeparator:f,includePath:d})).join(c);return v.includes(A)||v.push(A),v},[]).join(f);if(s.code===Ds.invalid_arguments)return[s.message,...s.argumentsError.issues.map(v=>Epe({issue:v,issueSeparator:c,unionSeparator:f,includePath:d}))].join(c);if(s.code===Ds.invalid_return_type)return[s.message,...s.returnTypeError.issues.map(v=>Epe({issue:v,issueSeparator:c,unionSeparator:f,includePath:d}))].join(c);if(d&&Xvt(s.path)){if(s.path.length===1){let v=s.path[0];if(typeof v=="number")return`${s.message} at index ${v}`}return`${s.message} at "${gCr(s.path)}"`}return s.message}t(Epe,"getMessageFromZodIssue");function ECr(a,s,c){return s!==null?a.length>0?[s,a].join(c):s:a.length>0?a:Zvt}t(ECr,"prefixMessage");function xCr(a,s={}){let c=a.errors,f;return Xvt(c)?f=DCr(s)(c):f=a.message,new K7e(f,{cause:a})}t(xCr,"fromZodErrorWithoutRuntimeCheck");function DCr(a){return"messageBuilder"in a?a.messageBuilder:CCr(a)}t(DCr,"createMessageBuilderFromOptions2");var ACr=t((a={})=>s=>Yvt(s)?xCr(s,a):s instanceof Error?new K7e(s.message,{cause:s}):new K7e("Unknown error"),"toValidationError");function xpe(a,s={}){return ACr(s)(a)}t(xpe,"fromError");var Dpe=t((a,s)=>{let c={};for(let[f,d]of Object.entries(a))Array.isArray(d)?c[f]=d.map(v=>typeof v=="object"&&v!==null?Dpe(v,s):v):typeof d=="object"&&d!==null?c[f]=Dpe(d,s):c[f]=d;return s(c)},"traverse"),NCr=t(({keys:a}={})=>s=>Dpe(s,c=>{let f={};for(let[d,v]of Object.entries(c))d.startsWith("x-")&&(a===void 0||a.includes(d))||(f[d]=v);return f}),"removeExtensions"),ICr=t(({paths:a={},shouldRemove:s})=>c=>Dpe(c,f=>{if(!f.paths)return f;let d={};for(let[v,E]of Object.entries(f.paths)){let A=f.paths[v];if(a[v]!==!0&&!s?.({path:v,method:!0,operation:A}))if(typeof E=="object"&&E!==null){let O=Object.fromEntries(Object.entries(E).filter(([M])=>{let W=f.paths[v][M],$=Array.isArray(a[v])&&a[v].includes(M),Q=s?.({path:v,method:M,operation:W});return!$&&!Q}));d[v]=O}else d[v]=E}return{...f,paths:d}}),"removePaths");function OCr(a){return a.apis&&(Array.isArray(a.apis)?a.apis=a.apis.map(rbt):a.apis=rbt(a.apis)),a}t(OCr,"withZuplo");function rbt(a){return a.type==="file"&&(a.postProcessors=[NCr({keys:["x-zuplo-route","x-zuplo-path"]}),ICr({shouldRemove:t(({operation:s})=>s["x-internal"],"shouldRemove")}),...a.postProcessors??[]]),a}t(rbt,"configureApis");var FCr=OCr,cbt=qr.object({label:qr.string(),color:qr.enum(["green","blue","yellow","red","purple","indigo","gray"]),placement:qr.enum(["start","end"]).optional()}),LCr=qr.object({type:qr.literal("doc"),id:qr.string(),label:qr.string().optional()}),RCr=qr.union([LCr,qr.string()]),MCr=qr.object({type:qr.literal("doc"),id:qr.string(),icon:qr.custom().optional(),label:qr.string().optional(),badge:cbt.optional()}),jCr=qr.union([MCr,qr.string()]),BCr=qr.object({type:qr.literal("link"),label:qr.string(),href:qr.string(),description:qr.string().optional(),badge:cbt.optional()}),UCr=qr.object({type:qr.literal("category"),icon:qr.custom().optional(),label:qr.string(),description:qr.string().optional(),collapsible:qr.boolean().optional(),collapsed:qr.boolean().optional(),link:RCr.optional()}),lbt=qr.lazy(()=>qr.union([jCr,BCr,$Cr])),$Cr=UCr.extend({items:lbt.array()}),JCr=lbt.array(),Y7e=qr.object({}).passthrough(),nbt=qr.object({background:qr.string(),foreground:qr.string(),card:qr.string(),cardForeground:qr.string(),popover:qr.string(),popoverForeground:qr.string(),primary:qr.string(),primaryForeground:qr.string(),secondary:qr.string(),secondaryForeground:qr.string(),muted:qr.string(),mutedForeground:qr.string(),accent:qr.string(),accentForeground:qr.string(),destructive:qr.string(),destructiveForeground:qr.string(),border:qr.string(),input:qr.string(),ring:qr.string(),radius:qr.string()}).partial(),qCr=qr.object({label:qr.string(),tags:qr.array(qr.string())}),X7e=qr.object({id:qr.string().optional(),server:qr.string().optional(),navigationId:qr.string().optional(),categories:qr.array(qCr).optional()}),zCr=qr.function().args(Y7e).returns(qr.union([Y7e,qr.promise(Y7e)])),ibt=qr.union([qr.object({type:qr.literal("url"),input:qr.string()}).merge(X7e),qr.object({type:qr.literal("file"),input:qr.string()}).merge(X7e).merge(qr.object({postProcessors:zCr.array().optional()})),qr.object({type:qr.literal("raw"),input:qr.string()}).merge(X7e)]),VCr=qr.union([qr.object({enabled:qr.boolean(),endpoint:qr.string()}),qr.object({enabled:qr.boolean(),getKeys:qr.custom(a=>typeof a=="function"),rollKey:qr.custom(a=>typeof a=="function").optional(),deleteKey:qr.custom(a=>typeof a=="function").optional(),updateKeyDescription:qr.custom(a=>typeof a=="function").optional(),createKey:qr.custom(a=>typeof a=="function").optional()})]),WCr=qr.object({src:qr.object({light:qr.string(),dark:qr.string()}),alt:qr.string().optional(),width:qr.string().optional()}),HCr=qr.object({siteUrl:qr.string(),changefreq:qr.optional(qr.enum(["always","hourly","daily","weekly","monthly","yearly","never"])),priority:qr.optional(qr.number()),outDir:qr.string().optional(),autoLastmod:qr.boolean().optional(),exclude:qr.union([qr.function().returns(qr.promise(qr.array(qr.string()))),qr.array(qr.string())]).optional()}).optional(),sbt=qr.object({files:qr.string(),defaultOptions:qr.object({toc:qr.boolean(),disablePager:qr.boolean()}).partial().optional()}),GCr=qr.object({label:qr.string(),id:qr.string(),default:qr.string().optional(),display:qr.enum(["auth","anon","always"]).default("always").optional()}),QCr=qr.object({from:qr.string(),to:qr.string()}),KCr=qr.object({type:qr.literal("inkeep"),apiKey:qr.string(),integrationId:qr.string(),organizationId:qr.string(),primaryBrandColor:qr.string(),organizationDisplayName:qr.string()}).optional(),YCr=qr.union([qr.object({type:qr.literal("clerk"),clerkPubKey:qr.custom(a=>typeof a=="string"?/^pk_(test|live)_\w+$/.test(a):!1),redirectToAfterSignUp:qr.string().optional(),redirectToAfterSignIn:qr.string().optional(),redirectToAfterSignOut:qr.string().optional()}),qr.object({type:qr.literal("openid"),clientId:qr.string(),issuer:qr.string(),audience:qr.string().optional(),scopes:qr.array(qr.string()).optional(),redirectToAfterSignUp:qr.string().optional(),redirectToAfterSignIn:qr.string().optional(),redirectToAfterSignOut:qr.string().optional()}),qr.object({type:qr.literal("auth0"),clientId:qr.string(),domain:qr.string(),audience:qr.string().optional(),redirectToAfterSignUp:qr.string().optional(),redirectToAfterSignIn:qr.string().optional(),redirectToAfterSignOut:qr.string().optional()})]),XCr=qr.object({title:qr.string(),description:qr.string(),logo:qr.string(),favicon:qr.string(),generator:qr.string(),applicationName:qr.string(),referrer:qr.string(),keywords:qr.array(qr.string()),authors:qr.array(qr.string()),creator:qr.string(),publisher:qr.string()}).partial(),abt=qr.object({url:qr.string(),fontFamily:qr.string()}),ZCr=qr.object({sans:abt.optional(),mono:abt.optional()}),eEr=qr.object({pageTitle:qr.string(),logoUrl:qr.string(),logo:WCr,banner:qr.object({message:qr.custom(),color:qr.enum(["note","tip","info","caution","danger"]).or(qr.string()).optional(),dismissible:qr.boolean().optional()})}).partial(),obt=qr.object({navigationId:qr.string(),label:qr.string(),items:qr.array(qr.string()).optional()}),ubt=qr.object({basePath:qr.string().optional(),page:eEr,topNavigation:qr.array(GCr),sidebar:qr.record(JCr),theme:qr.object({light:nbt,dark:nbt,fonts:ZCr}).partial(),metadata:XCr,authentication:YCr,search:KCr,docs:qr.union([sbt,qr.array(sbt)]),apis:qr.union([ibt,qr.array(ibt)]),catalog:qr.union([obt,qr.array(obt)]),apiKeys:VCr,redirects:qr.array(QCr),sitemap:HCr}),fbt=t((a,s)=>{if(!a.sidebar||!a.topNavigation)return;let c=a.topNavigation.map(d=>d.id),f=Object.keys(a.sidebar).filter(d=>!c.includes(d));f.length>0&&s.addIssue({code:qr.ZodIssueCode.custom,message:`Sidebar ID [${f.map(d=>`"${d}"`).join(", ")}] not found in top navigation.
614
614
  Following IDs are available: ${c.join(", ")}`})},"refine"),tEr=ubt.partial(),rEr=tEr.superRefine(fbt);function nEr(a){let s=rEr.safeParse(a);s.success||(console.log("Validation errors:"),console.log(xpe(s.error).toString()))}t(nEr,"validateCommonConfig");var iEr=qr.object({UNSAFE_slotlets:qr.record(qr.string(),qr.custom()),mdx:qr.object({components:qr.custom()}).partial(),customPages:qr.array(qr.object({path:qr.string(),element:qr.custom().optional(),render:qr.custom().optional(),prose:qr.boolean().optional()})),plugins:qr.array(qr.custom()),build:qr.custom()}),sEr=ubt.merge(iEr).partial().superRefine(fbt);function aEr(a){let s=sEr.safeParse(a);s.success||(console.log("Validation errors:"),console.log(xpe(s.error).toString()))}t(aEr,"validateConfig");var oEr=["zudoku.config.js","zudoku.config.jsx","zudoku.config.ts","zudoku.config.tsx","zudoku.config.mjs"],cEr="dev-portal.json",Z7e=t(a=>wCr(a).then(()=>!0).catch(()=>!1),"fileExists"),u6,NN;async function t5e(a){if(u6&&NN&&await Z7e(u6))return{configPath:u6,configType:NN};let s=ebt.join(a,cEr);if(await Z7e(s))return u6=s,NN="dev-portal",{configPath:u6,configType:NN};for(let c of oEr){let f=ebt.join(a,c);if(await Z7e(f))return u6=f,NN="zudoku",{configPath:u6,configType:NN}}return u6=void 0,NN=void 0,{configPath:u6,configType:NN}}t(t5e,"findConfigFilePath");async function lEr(a){let s=await t5e(a);if(s.configType)return s;throw new Error("No zudoku config file found in project root.")}t(lEr,"getConfigFilePath");async function uEr(a,s,c){let f=tbt(s).href,d=[],v=await jvt(f,{parentURL:import.meta.url,onImport:t(E=>{let A=PCr(E.startsWith("file://")?E:tbt(E).href);A.startsWith(a)&&d.push(A)},"onImport")}).then(E=>E.default);if(!v)throw new Error(`Failed to load config file: ${s}`);return{dependencies:d,config:v}}t(uEr,"loadZudokuCodeConfig");async function fEr(a,s){let c=await kCr(a,"utf-8"),f;try{f=JSON.parse(c)}catch{throw new Error("Failed to parse dev-portal.json. Check that the file is valid JSON.")}return nEr(f),f=e5e(f,s),f=FCr(f),f}t(fEr,"loadDevPortalConfig");function e5e(a,s){if(typeof a=="string"){let c=a.match(/^\$env\(([^)]+)\)$/);if(c){let f=c[1];return s[f]}return a}else{if(Array.isArray(a))return a.map(c=>e5e(c,s));if(typeof a=="object"&&a!==null){let c={};for(let f in a)Object.hasOwn(a,f)&&(c[f]=e5e(a[f],s));return c}}return a}t(e5e,"replaceEnvVariables");async function _bt(a,s,c){let{configPath:f,configType:d}=await lEr(a),v,E;return d==="dev-portal"?(v=await fEr(f,s),E=[]):({config:v,dependencies:E}=await(c?.loadZudokuCodeConfig??uEr)(a,f,s),aEr(v)),{...v,__meta:{dependencies:E,path:f,registerDependency:t((...O)=>E.push(...O),"registerDependency")}}}t(_bt,"tryLoadZudokuConfig");import dbt from"fs/promises";import v7 from"path";import{writeFile as _Er}from"fs/promises";async function YA(a,s){await Ul.mkdirForFilePathIfNotExits(a);let c=await import("prettier"),f=s;try{f=await c.format(s,{parser:"babel"})}catch{}await _Er(a,f,"utf-8")}t(YA,"writeDebugSourceFile");import r5e from"path";async function n5e(a){if(await Ul.fileExists(`${a}/config/dev-portal.json`))return"dev-portal";if((await t5e(r5e.join(a,"docs")))?.configType)return"zudoku"}t(n5e,"getDevPortalType");function qB(a,s){let c=r5e.relative(process.cwd(),r5e.join(a,TF));return Object.keys(s?.outputs??{}).map(d=>`.${d.replace(c,"")}`)}t(qB,"getBuildModules");var pbt="/docs",dEr="/__zuplo/dev-portal";function mEr(a){let s=a.trim().toLowerCase();return s.endsWith("/")&&(s=s.slice(0,-1)),s}t(mEr,"normalizePathname");function hEr(a){let s={sitePathname:a?.sitePathname===dEr?pbt:a?.sitePathname?mEr(a.sitePathname):pbt,enabled:a?a.enabled??!0:!1,version:a?.version??"legacy"};return`const devPortal = ${JSON.stringify(s)};
615
- export default devPortal;`}t(hEr,"generateSource");function mbt(a){return{name:"dev-portal-config",setup(s){s.onResolve({filter:/dev-portal.json$/},c=>({namespace:"dev-portal-json",path:v7.isAbsolute(c.path)?c.path:v7.join(c.resolveDir,c.path),pluginName:"dev-portal"})),s.onLoad({filter:/.*/,namespace:"dev-portal-json"},async c=>__.timeFn("Generating dev-portal.json data",async()=>{let f,d,v=[],E=await n5e(a.sourceDirectory);if(E==="zudoku")try{let O=v7.join(v7.resolve(v7.dirname(c.path),".."),rlt);f={version:"zudoku",enabled:!0,sitePathname:(await _bt(O,{},{loadZudokuCodeConfig:gEr(a.sourceDirectory)})).basePath}}catch(O){v.push({id:"dev-portal-build-error",text:"Could not load developer portal configuration.",location:{file:"docs/dev-portal.json",namespace:"",line:1,column:0,length:0,lineText:"",suggestion:""},detail:O.message,pluginName:"dev-portal",notes:[]})}else if(E==="dev-portal"){d=await dbt.readFile(c.path,"utf-8");try{f=JSON.parse(d)}catch(O){v.push({id:"dev-portal-build-error",text:"Could not parse dev-portal.json. Ensure that the file is valid JSON.",location:{file:"config/dev-portal.json",namespace:"",line:1,column:0,length:0,lineText:"",suggestion:""},detail:"DevPortalValidationError",pluginName:"dev-portal",notes:[{text:O.message,location:null}]})}}let A;try{if(A=hEr(f),Sh.DEBUG_BUILD_MODE&&A){let O=v7.join(a.sourceDirectory,".zuplo","dev-portal.js");await YA(O,A)}}catch(O){v.push({id:"dev-portal-build-error",text:O.message,location:{file:"dev-portal.json",namespace:"dev-portal-json",line:1,column:0,length:0,lineText:"issue",suggestion:""},detail:"DevPortalValidationError",pluginName:"dev-portal",notes:[{text:O.message,location:null}]})}return{contents:A,errors:v,pluginName:"dev-portal",loader:"js",resolveDir:v7.dirname(c.path),watchFiles:[c.path]}}))}}}t(mbt,"devPortalConfigPlugin");function gEr(a){return t(async function(c,f,d){let v=Ul.safePath(a).resolve(f),E=await dbt.readFile(v,"utf-8"),A=await pEr(E,{target:"esnext",syntax:"typescript",tsx:!0}),O=yEr(A);return{dependencies:[],config:{basePath:O??"/docs"}}},"loadZudokuCodeConfig")}t(gEr,"createLoadDevPortalConfigFunction");function yEr(a){let s;return a.body.forEach(c=>{if(c.type==="VariableDeclaration"){let f=c.declarations[0];f.id.type==="Identifier"&&f.id.value==="config"&&f.init&&f.init.type==="ObjectExpression"&&f.init.properties.forEach(v=>{v.type==="KeyValueProperty"&&(v.key.type==="Identifier"&&v.key.value==="basePath"||v.key.type==="StringLiteral"&&v.key.value==="basePath")&&v.value.type==="StringLiteral"&&(s=v.value.value)})}}),s}t(yEr,"getBasePathFromConfig");import hbt from"path";var gbt="legacy-environment",ybt="legacy-environment",vEr=`import { environment } from "@zuplo/runtime";
615
+ export default devPortal;`}t(hEr,"generateSource");function mbt(a){return{name:"dev-portal-config",setup(s){s.onResolve({filter:/dev-portal.json$/},c=>({namespace:"dev-portal-json",path:v7.isAbsolute(c.path)?c.path:v7.join(c.resolveDir,c.path),pluginName:"dev-portal"})),s.onLoad({filter:/.*/,namespace:"dev-portal-json"},async c=>__.timeFn("Generating dev-portal.json data",async()=>{let f,d,v=[],E=await n5e(a.sourceDirectory);if(E==="zudoku")try{let O=v7.join(v7.resolve(v7.dirname(c.path),".."),rlt);f={version:"zudoku",enabled:!0,sitePathname:(await _bt(O,{},{loadZudokuCodeConfig:gEr(a.sourceDirectory)})).basePath}}catch(O){a.logger.error(O,"Failed to load developer portal configuration"),v.push({id:"dev-portal-build-error",text:"Could not load developer portal configuration.",location:{file:"docs/dev-portal.json",namespace:"",line:1,column:0,length:0,lineText:"",suggestion:""},detail:O.message,pluginName:"dev-portal",notes:[]})}else if(E==="dev-portal"){d=await dbt.readFile(c.path,"utf-8");try{f=JSON.parse(d)}catch(O){v.push({id:"dev-portal-build-error",text:"Could not parse dev-portal.json. Ensure that the file is valid JSON.",location:{file:"config/dev-portal.json",namespace:"",line:1,column:0,length:0,lineText:"",suggestion:""},detail:"DevPortalValidationError",pluginName:"dev-portal",notes:[{text:O.message,location:null}]})}}let A;try{if(A=hEr(f),Sh.DEBUG_BUILD_MODE&&A){let O=v7.join(a.sourceDirectory,".zuplo","dev-portal.js");await YA(O,A)}}catch(O){v.push({id:"dev-portal-build-error",text:O.message,location:{file:"dev-portal.json",namespace:"dev-portal-json",line:1,column:0,length:0,lineText:"issue",suggestion:""},detail:"DevPortalValidationError",pluginName:"dev-portal",notes:[{text:O.message,location:null}]})}return{contents:A,errors:v,pluginName:"dev-portal",loader:"js",resolveDir:v7.dirname(c.path),watchFiles:[c.path]}}))}}}t(mbt,"devPortalConfigPlugin");function gEr(a){return t(async function(c,f,d){let v=Ul.safePath(a).resolve(f),E=await dbt.readFile(v,"utf-8"),A=await pEr(E,{target:"esnext",syntax:"typescript",tsx:!0}),O=yEr(A);return{dependencies:[],config:{basePath:O??"/docs"}}},"loadZudokuCodeConfig")}t(gEr,"createLoadDevPortalConfigFunction");function yEr(a){let s;return a.body.forEach(c=>{if(c.type==="VariableDeclaration"){let f=c.declarations[0];f.id.type==="Identifier"&&f.id.value==="config"&&f.init&&f.init.type==="ObjectExpression"&&f.init.properties.forEach(v=>{v.type==="KeyValueProperty"&&(v.key.type==="Identifier"&&v.key.value==="basePath"||v.key.type==="StringLiteral"&&v.key.value==="basePath")&&v.value.type==="StringLiteral"&&(s=v.value.value)})}}),s}t(yEr,"getBasePathFromConfig");import hbt from"path";var gbt="legacy-environment",ybt="legacy-environment",vEr=`import { environment } from "@zuplo/runtime";
616
616
  export default environment;`;function vbt(a){return{name:"environment",setup(s){s.onResolve({filter:/@app\/environment$/},()=>({namespace:ybt,pluginName:gbt,path:hbt.join(a.sourceDirectory,Y3,"environment.js")})),s.onLoad({filter:/.*/,namespace:ybt},async c=>({contents:vEr,loader:"ts",resolveDir:hbt.dirname(c.path),pluginName:gbt}))}}}t(vbt,"environmentPlugin");var PTt=W_(W9e(),1),NTt=W_(XSt(),1),ITt=W_(gLe(),1),OTt=W_(yLe(),1);import y6r from"fs/promises";import CS from"path";var ik="schemas",cde="json-schema";function FTt(a){return{name:ik,async setup(s){let c=new ITt.Ajv2020({code:{source:!0},allErrors:!0,strict:!1,verbose:!0,meta:!0});(0,NTt.default)(c,{mode:"fast"}),c.opts.code.formats=PTt._`require("ajv-formats/dist/formats").fastFormats`;let f=CS.join(a.sourceDirectory,HG),d,v=[],E=[];if(await Ul.dirExists(f)&&(c.addKeyword("faker"),d=await Ul.listFolderContents(f,HG),await Promise.all(d.map(async A=>{try{let O=Ul.safePath(a.sourceDirectory).resolve(f,A);if(!O.startsWith(f))throw new Error("All schemas must be in the schemas directory");let M=await y6r.readFile(O,"utf-8");if(M===""||M===void 0)throw new Error(`Schema 'schemas/${A}' is empty and will be ignored.`);let W=JSON.parse(M);if(W.$schema&&W.$schema!=="https://json-schema.org/draft/2020-12/schema")throw new Error(`Error in ${A}: All JSON schemas must use version 2020-12. See release notes for changes: https://json-schema.org/draft/2020-12/release-notes.html`);if(c.$dataMetaSchema,c.addSchema(W,A),c.errors?.length){let $=c.errors[0];v.push({id:"json-schema-validation-error",pluginName:ik,text:`Error: ${$.message}`,location:{file:CS.join(HG,A)},detail:{params:$.params,propertyName:$.propertyName,schemaPath:$.schemaPath,data:$.data}})}}catch(O){if(O.message.endsWith("is empty and will be ignored.")){E.push({id:"empty-json-schema-file",pluginName:ik,text:`Schema 'schemas/${A}' is empty and will be ignored.`,location:{file:`schemas/${A}`,suggestion:"Add schema details or remove the file from the project."},detail:"EmptyJSONSchemaFile",notes:[{text:`Schema 'schemas/${A}' is empty and will be ignored.`,location:{file:`schemas/${A}`,suggestion:"Add schema details or remove the file from the project."}}]});return}let M=await VFe(A,a.sourceDirectory,O.message);v.push({id:"json-schema-add-error",pluginName:ik,text:`Error: ${O.message}`,location:M,detail:"InvalidAddSchemaError",notes:[{text:O.message}]})}})),await Promise.all(d.map(async A=>{try{let O=c.getSchema(A);O&&c.compile(O.schema).errors?.forEach(W=>{v.push({text:`Failed to compile ${A}: ${W.message}`})})}catch(O){let M=await VFe(A,a.sourceDirectory,O.message);v.push({id:"json-schema-compile-error",pluginName:ik,text:`The schema file '${A}' is not valid. Error: ${O.message}`,location:M,detail:"InvalidSchemaError",notes:[{text:O.message}]})}})),Sh.DEBUG_BUILD_MODE)){let A=CS.resolve(a.outputDirectory,HG);await Ul.mkdirIfNotExists(A)}s.onStart(async()=>{if(d)return{errors:v,warnings:E}}),s.onResolve({filter:/schemas\/.*\.json$/},async A=>{let O=CS.isAbsolute(A.path)?A.path:CS.join(A.resolveDir,A.path);if(A.importer&&A.importer!==CS.join(a.sourceDirectory,"config/routes.json"))return{path:O};if(!await Ul.fileExists(O)){let M="policies.json";return{errors:[{id:"json-schema-build-error",text:`Unable to resolve reference to '${A.path}' from ${M}`,location:{file:CS.join(A.resolveDir,M),namespace:cde,line:1,column:0,length:0,lineText:`Invalid JSON schema reference in ${M}`,suggestion:""},detail:"RouteReferenceError",pluginName:ik,notes:[{text:`Unable to resolve reference to '${A.path}' from ${M}`,location:null}]}],namespace:cde,path:O,pluginName:ik}}return{path:O,namespace:cde,pluginName:ik}}),s.onLoad({filter:/.*/,namespace:cde},async A=>__.timeFn(`Generating json schema data: ${CS.basename(A.path)}`,async()=>{let O=[],M;try{let W=CS.relative(f,A.path),$=c.getSchema(W);if(!$)throw new Error(`Could not load schema at ${A.path}`);M=$.source?.validateCode;let Q=c.compile($.schema);M=(0,OTt.default)(c,Q)}catch(W){O.push({pluginName:ik,text:`Cannot parse project's schemas/${CS.basename(A.path)} file. Error: ${W.message}`,location:null,notes:[{text:W.message,location:null}],detail:W})}if(Sh.DEBUG_BUILD_MODE&&M){let W=CS.relative(f,A.path),$=CS.join(a.sourceDirectory,".zuplo",`${W}.js`);await YA($,M)}return{contents:M,errors:O,pluginName:ik,resolveDir:CS.dirname(A.path),watchFiles:[A.path]}}))}}}t(FTt,"jsonSchemaPlugin");import{relative as v6r}from"path";var LTt=["node:assert","node:async_hooks","node:buffer","node:crypto","node:diagnostics_channel","node:events","node:path","node:process","node:stream","node:string_decoder","node:util"],b6r="nodejs-compat-plugin";function RTt({sourceDirectory:a}){return{name:b6r,setup(s){let c=new Set;s.onStart(()=>{c.clear()}),s.onResolve({filter:/node:.*/},async({path:f,kind:d,resolveDir:v,...E})=>{let A=`${f}:${d}:${v}:${E.importer}`;if(c.has(A))return;c.add(A);let O=await s.resolve(f,{kind:d,resolveDir:v,importer:E.importer});return O.errors.length>0?LTt.includes(f)||f.includes("/")&&LTt.includes(f.split("/")[0])?{external:!0}:{external:!0,warnings:O.errors.map(W=>({...W,location:{file:v6r(a,E.importer),line:0,column:0,namespace:"",length:0,lineText:"",suggestion:"Remove the imported node module"},detail:`The package "${f}" wasn't found on the file system but is built into node. If this code is executed it will fail.`}))}:O})}}}t(RTt,"nodejsCompatPlugin");import MTt from"fs/promises";import Ux from"path";var fU="open-api-routes-plugin",lde="open-api-routes-json";function jTt(a){return{name:"open-api-routes-plugin",setup(s){s.onResolve({filter:/routes.json$/},c=>({watchFiles:[...vLe(Ux.join(a.sourceDirectory,Nb),[".oas.json"],!0),Ux.join(a.sourceDirectory,Nb,uue)],namespace:lde,path:Ux.isAbsolute(c.path)?c.path:Ux.join(c.resolveDir,c.path),pluginName:fU})),s.onResolve({filter:/^\.\.\/modules\/.*/,namespace:lde},async c=>{let f=Ux.join(c.resolveDir,`${c.path}.ts`);if(!await Ul.fileExists(f)){let d=`$import(.${c.path.replace(/^../,"")})`,v=Ux.resolve(a.sourceDirectory,"config"),E=await AF(v),A=await Vut(E,d,"Update your route configuration to use code from the 'modules' folder");return{errors:[{id:"route-build-error",text:`Invalid handler reference in routes.json. Unable to resolve reference to '${d}' from routes.json`,location:A,detail:"RouteReferenceError",pluginName:fU}],namespace:lde,path:c.path,pluginName:fU}}}),s.onLoad({filter:/.*/,namespace:lde},async c=>__.timeFn("Generating route.json data",async()=>{let f=Ux.resolve(a.sourceDirectory,"config"),d=await AF(f),v=await Promise.all(d.map(async M=>({content:await MTt.readFile(M,"utf-8"),fileName:M}))),E=Ux.resolve(f,"policies.json");if(!await Ul.fileExists(E))return{errors:[{text:"The project must include a policies file ('/config/policies.json')",detail:"OASPoliciesFileMissing",pluginName:fU,location:{line:0,column:0,file:"/config/policies.json"}}],pluginName:fU};let A={content:await MTt.readFile(E,"utf-8"),fileName:E},O;try{O=await $Fe({sourceDirectory:a.sourceDirectory,oasContent:v,policiesContent:A})}catch(M){throw new Error("Error compiling routes: "+M.message)}if(Sh.DEBUG_BUILD_MODE&&O.content){let M=Ux.join(a.sourceDirectory,".zuplo"),W=Ux.resolve(M,"routes.js");await YA(W,O.content)}return{contents:O.content,errors:O.errors,pluginName:fU,resolveDir:Ux.dirname(c.path),watchFiles:[c.path]}}))}}}t(jTt,"openApiRoutesPlugin");import ude from"path";var NY="raw-route-plugin",BTt="raw-route";function UTt(a){return{name:"raw-route-plugin",setup(s){s.onResolve({filter:/raw.json$/},c=>({namespace:BTt,path:c.path,pluginName:NY})),s.onLoad({filter:/.*/,namespace:BTt},async c=>{let f=ude.resolve(a.sourceDirectory,Nb);if(!await Ul.dirExists(f))return{loader:"js",resolveDir:ude.dirname(c.path),pluginName:NY};let d=await AF(f);try{let v=await zFe({oasFiles:d,sourceDirectory:a.sourceDirectory,logger:a.logger});if(Sh.DEBUG_BUILD_MODE&&v){let E=ude.join(a.sourceDirectory,".zuplo","raw-routes.js");await YA(E,v)}return{contents:v,loader:"js",resolveDir:ude.dirname(c.path),pluginName:NY}}catch(v){if(v instanceof pv)return{contents:"",loader:"ts",errors:[{id:"route-build-error",text:v.issue.text,location:v.issue.location,detail:v.issue.detail,pluginName:NY}],pluginName:NY};throw v}})}}}t(UTt,"rawRoutePlugin");import S6r from"fs/promises";import bLe from"path";var fde="runtime-config",$Tt="runtime-config-plugin";function JTt(){return{name:fde,setup(a){a.onResolve({filter:/^\.\.\/modules\/zuplo.runtime.ts$/},s=>({namespace:$Tt,path:bLe.isAbsolute(s.path)?s.path:bLe.join(s.resolveDir,s.path),pluginName:fde})),a.onLoad({filter:/.*/,namespace:$Tt},async s=>__.timeFn("Generating zuplo.runtime.ts data",async()=>{let c="export const runtimeInit = undefined;",f=[];return await Ul.fileExists(s.path)?(c=await S6r.readFile(s.path,"utf-8"),{contents:c,loader:"ts",resolveDir:bLe.dirname(s.path),errors:f,pluginName:fde,watchFiles:[s.path]}):{contents:c,loader:"ts",errors:f,pluginName:fde}}))}}}t(JTt,"runtimeConfigPlugin");var zTt=W_(gLe(),1),VTt=W_(yLe(),1);import CLe from"fs/promises";import N7 from"path";var SLe="schema-validation-plugin",qTt="schema-validation",T6r="module.exports = {}";function WTt(a){return{name:"schema-validation-plugin",setup(s){s.onResolve({filter:/ajv-schema.json$/},c=>({namespace:qTt,path:c.path,pluginName:SLe})),s.onLoad({filter:/.*/,namespace:qTt},async c=>{let f=N7.resolve(a.sourceDirectory,Nb,"policies.json");if(!await Ul.fileExists(f))return{contents:T6r,loader:"js",resolveDir:N7.dirname(c.path),pluginName:SLe};let d=await E6r(a.sourceDirectory),v=N7.resolve(a.sourceDirectory,Nb),E=await AF(v),A=await k6r(E,d),O=await C6r({oasFiles:E,routesWithSchemaValidation:A,sourceDirectory:a.sourceDirectory,logger:a.logger});if(Sh.DEBUG_BUILD_MODE&&O){let M=N7.join(a.sourceDirectory,".zuplo","schema-validation.js");await YA(M,O)}return{contents:O,loader:"js",resolveDir:N7.dirname(c.path),pluginName:SLe}})}}}t(WTt,"schemaValidationPlugin");async function C6r({oasFiles:a,routesWithSchemaValidation:s,sourceDirectory:c,logger:f}){let d="",v=new uN(c,f);if(s.length===0)return d;let E=new zTt.Ajv2020({code:{source:!0},allErrors:!0,strict:!1,verbose:!0,meta:!0});for(let A of a){let O=await CLe.readFile(A,"utf-8"),M=N7.basename(A,".oas.json"),W=s.filter(Se=>Se.fileName===M),$=await v.resolve(A),Q=JSON.parse(O),Pe=[],De=new Map;W.forEach(Se=>{let Tt=Q.paths[Se.path][Se.method];if(Tt.requestBody){let wt;if(Tt.requestBody.$ref){let _r=Tt.requestBody.$ref;wt=$.get(_r)?.content}else Tt.requestBody.content&&(wt=Tt.requestBody.content);if(wt)for(let _r in wt){let lr=wt[_r].schema,Or=EIe(Se.path,Se.method,_r);lr.$id=Or,E.addSchema(lr),TLe(lr,A,M,E,$,Pe,De)}}if(Tt.parameters)for(let wt of Tt.parameters){let _r=wt.$ref?$.get(wt.$ref):wt,lr=_r.schema.$ref?$.get(_r.schema.$ref):_r.schema,Or=CIe(Se.path,Se.method,_r.in,_r.name);lr.$id=Or,E.addSchema(lr),TLe(_r,A,M,E,$,Pe,De)}});for(let Se of Pe){let Tt=$.get(Se),wt=jQ(M,Se);E.addSchema(Tt,wt)}}return d=(0,VTt.default)(E),d}t(C6r,"schemaValidationSource");function TLe(a,s,c,f,d,v,E){for(let A in a){let O=a[A];if(A==="$ref"){let M=jQ(c,tN(s,O));a[A]=M,vQ(s,c,tN(s,O),d,v,E,(W,$)=>jQ(W,tN(s,$)))}else typeof O=="object"&&TLe(O,s,c,f,d,v,E)}}t(TLe,"addRefsToSchema");async function E6r(a){let s=new Set(["RequestValidationInboundPolicy"]),c=await CLe.readFile(`${a}/config/policies.json`,"utf-8"),f=JSON.parse(c);return x6r(f,s)}t(E6r,"getPolicyNamesUsingSchemaValidationPolicies");function x6r(a,s){let c=new Set;a.policies?.forEach(d=>{d.handler?.export&&s.has(d.handler.export)&&d.handler.module==="$import(@zuplo/runtime)"&&c.add(d.name)});let f=D6r(a,c);return new Set([...c,...f])}t(x6r,"getPolicyNamesReferencingPolicyHandlers");function D6r(a,s){let c=new Set;return a.policies?.forEach(f=>{f.handler?.export==="CompositeInboundPolicy"&&f.handler?.options?.policies?.forEach(d=>{s.has(d)&&c.add(f.name)})}),c}t(D6r,"getCompositePoliciesContainingPolicy");function A6r(a,s){if(!a["x-zuplo-route"]||!a["x-zuplo-route"].policies)return!1;let c=a["x-zuplo-route"].policies.inbound;if(c){for(let d of c)if(s.has(d))return!0}let f=a["x-zuplo-route"].policies.outbound;if(f){for(let d of f)if(s.has(d))return!0}return!1}t(A6r,"isPolicyPresentInOperation");async function k6r(a,s){let c=[];for(let f of a){let d=await CLe.readFile(f,"utf-8"),E=JSON.parse(d).paths;for(let A in E){let O=E[A];for(let M in O){let W=O[M];A6r(W,s)&&c.push({fileName:N7.basename(f,".oas.json"),path:A,method:M})}}}return c}t(k6r,"getRoutesContainingPolicies");import{mkdirSync as w6r,writeFileSync as P6r}from"fs";import N6r from"path";function HTt(a){return{name:"write-modules-plugin",setup(s){s.onEnd(async c=>{if(c){let f=qB(a.sourceDirectory,c.metafile);w6r(a.outputDirectory,{recursive:!0}),P6r(N6r.join(a.outputDirectory,"modules.json"),JSON.stringify(f,null,2))}})}}}t(HTt,"writeModulesPlugin");var I6r=kyt("zuplo:core:build"),O6r=["workerd","worker","browser"],KTt=[...process.env.GLOBAL_MODULE_LOCATION?[process.env.GLOBAL_MODULE_LOCATION]:[],ELe.resolve(GTt(QTt(import.meta.url)),"..","..","..","node_modules"),ELe.resolve(GTt(QTt(import.meta.url)),"..","..","..","..","..","node_modules")];async function IY({systemDirectory:a,outputDirectory:s,sourceDirectory:c,cacheDirectory:f,logger:d,minify:v=!0,command:E,flags:A}){let O=ELe.join(a,_ue);I6r(`Building with node paths: ${KTt.join(", ")}`);let M=v&&E!=="dev"&&!process.env.DEBUG_BUILD_DISABLE_MINIFY?{minify:!0,chunkNames:"[hash]"}:{minify:!1,keepNames:!0,chunkNames:"[name]-[hash]"},W={sourceDirectory:c,outputDirectory:s,cacheDirectory:f,logger:d,debugMode:Sh.DEBUG_BUILD_MODE,flags:A};return{platform:"browser",target:"es2022",outdir:s,splitting:!0,metafile:!0,format:"esm",nodePaths:KTt,entryPoints:[O],sourcemap:"linked",legalComments:"none",treeShaking:!0,bundle:!0,...M,external:[],logLevel:"silent",conditions:O6r,plugins:[vbt(W),wyt(W),jTt(W),UTt(W),WTt(W),JTt(),mbt(W),FTt(W),RTt(W),HTt(W)]}}t(IY,"getBaseESBuildConfig");var I7="run-esbuild",XTt=t(async function({systemDirectory:a,outputDirectory:s,sourceDirectory:c,cacheDirectory:f,buildId:d,logger:v,config:E,command:A,minify:O},{data:M}){return __.timeFn("Running esbuild",async()=>{v.debug("Running esbuild");let W=await IY({command:A,minify:O,systemDirectory:a,outputDirectory:s,cacheDirectory:f,sourceDirectory:c,logger:v,flags:E.flags}),$;try{if(!await Nj(c))throw new Error("Failed to build project because no open-api file was found on the 'config' folder");$=await YTt.build(W),M.set("metafile",$.metafile)}catch(De){if(v.error(De),De.errors||De.warnings)$=De;else if(De.message.includes("Failed to build project because no open-api file was found on the 'config' folder"))$={warnings:[],errors:[{id:"missing-open-api-file",text:"Failed to build project because no open-api file was found on the 'config' folder",pluginName:I7,location:null,notes:[],detail:"Failed to build project because no open-api file was found on the 'config' folder"}],outputFiles:void 0,metafile:void 0,mangleCache:void 0};else throw De}$.errors.length>0&&$.errors.length>1&&($.errors.length=1);let{errors:Q,warnings:Pe}=xLe({buildId:d,result:$});return{errors:Q,warnings:Pe}})},"runEsbuild");function xLe({buildId:a,result:s}){return{status:s.errors.length>0?"Failed":s.warnings.length>0?"Warnings":"Good",runtimeVersion:"0.0.0",buildTime:"",buildTimeMs:0,buildId:a,warnings:s.warnings.map(f=>f.text==="Using direct eval with a bundler is not recommended and may cause problems"?{location:f.location,detail:f.detail,id:f.id,notes:f.notes,message:"We do not support the use of 'eval' or 'new Function(...)'",severity:oue,pluginName:f.pluginName||I7}:{location:f.location,detail:f.detail,id:f.id,notes:f.notes,message:f.text,severity:oue,pluginName:f.pluginName||I7}),errors:s.errors.map(f=>({location:f.location,detail:f.detail,id:f.id,notes:f.notes,message:f.text,severity:f3e,pluginName:f.pluginName||I7})),metafile:s.metafile}}t(xLe,"esbuildResultToBuildResult");var F6r=t((a,s)=>{let c=s;if(s.includes(a)){let f=new RegExp(`.*(${a})`,"g");c=s.replace(f,"")}return c.match(/^(\/)?(\.\.(\/)?)+/)&&(c=c.replace(/^(\/)?(\.\.(\/)?)+/,"/")),c},"removePrefixFromString"),L6r=t((a,s)=>{let c=s;if(c.includes(a)){let f=new RegExp(`[a-zA-Z0-9-_.\\/]+(${a})`,"g");c=c.replace(f,"")}return c},"cleanFilePathsInMessage"),ZTt=t((a,s,c)=>{if(!a||a.length<=0)return a;let f=a.filter(d=>d.message!=='Could not resolve "@zuplo/runtime"');return f&&f.length>0&&f.forEach(d=>{try{d.location&&d.location.file&&(d.location.file=F6r(s,d.location.file)),d.location&&d.location.lineText&&d.location.lineText.includes("@zuplo/core/index.minified.js")&&(d.location.lineText=d.location.lineText.substring(0,200)+"...<Truncated>"),d.message=L6r(s,d.message),d.notes&&d.notes.length>0&&delete d.notes,d.text&&delete d.text,d.pluginName===""&&(d.pluginName=c)}catch{}}),f},"cleanDataOnBuildIssue");function eCt(a,s){let c=DLe.basename(s);a.errors&&(a.errors=ZTt(a.errors,c,I7)),a.warnings&&(a.warnings=ZTt(a.warnings,c,I7))}t(eCt,"formatBuildResult");var R6r=t(a=>DLe.basename(a).startsWith("."),"isHiddenOnUnix"),M6r=t((a,s=[])=>s.map(c=>c.startsWith(".")?c:`.${c}`).some(c=>a.endsWith(c)),"hasMatchingExtname");function vLe(a,s=[],c=!1){let f=[],d;if(!_de.existsSync(a)){let v;if(mQ.hasMagic(a))v=a;else{let E=s.map(A=>A.startsWith(".")?A:`.${A}`).join("|");v=`${a}+(${E})`}if(f.push(...mQ.sync(v,{nodir:!0})),!f.length)throw Error(`Cannot find any files matching pattern "${a}"`);return f}try{if(d=_de.statSync(a),d.isFile())return[a]}catch{return[]}return _de.readdirSync(a).forEach(v=>{let E=DLe.join(a,v),A;try{if(A=_de.statSync(E),A.isDirectory()){c&&f.push(...vLe(E,s,c));return}}catch{return}if(!s.length)throw Error(`Argument '${s}' required when argument '${a}' is a directory`);!A.isFile()||!M6r(E,s)||R6r(E)||f.push(E)}),f}t(vLe,"lookupFiles");var DC=new gue({level:process.env.FORCE_BUILD_COLORS?2:void 0}),sk=` ${DC.gray("|")} `;function rXr(a,s,c){a.info(DC.green(s),c)}t(rXr,"outputSuccess");function nXr(a,s,c){a.warn(DC.yellow(s),c)}t(nXr,"outputWarning");function iXr(a,s,c){a.error(`
617
617
  ${DC.red(s)}`,c)}t(iXr,"outputCritical");function sXr(a,s,c){let f=c.sort((E,A)=>{let O=E.path.split("/").length,M=A.path.split("/").length;return O!==M?O-M:E.path.localeCompare(A.path)}),d=Math.max(...f.map(E=>E.path.length)),v=`${s}
618
618
  `;f.forEach(E=>{let A=" ".repeat(d-E.path.length),O=E.bytes/1024,M=` ${E.path}${A} ${O.toFixed(2)} KB
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zuplo/core",
3
- "version": "6.30.2",
3
+ "version": "6.30.6",
4
4
  "repository": "https://github.com/zuplo/zuplo",
5
5
  "author": "Zuplo, Inc.",
6
6
  "type": "module",
@@ -40,8 +40,8 @@
40
40
  "prettier": "^3.3.3"
41
41
  },
42
42
  "peerDependencies": {
43
- "@zuplo/graphql": "^6.30.2",
44
- "@zuplo/otel": "^6.30.2",
45
- "@zuplo/runtime": "^6.30.2"
43
+ "@zuplo/graphql": "^6.30.6",
44
+ "@zuplo/otel": "^6.30.6",
45
+ "@zuplo/runtime": "^6.30.6"
46
46
  }
47
47
  }