@resconet/qp-bridge 1.2.1-alpha.42 → 1.2.1-alpha.44

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.
Files changed (4) hide show
  1. package/README.md +243 -292
  2. package/index.js +1 -1
  3. package/index.mjs +1063 -1103
  4. package/package.json +1 -1
package/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var He={exports:{}},w=He.exports={},E,A;function _e(){throw new Error("setTimeout has not been defined")}function xe(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?E=setTimeout:E=_e}catch{E=_e}try{typeof clearTimeout=="function"?A=clearTimeout:A=xe}catch{A=xe}})();function Je(t){if(E===setTimeout)return setTimeout(t,0);if((E===_e||!E)&&setTimeout)return E=setTimeout,setTimeout(t,0);try{return E(t,0)}catch{try{return E.call(null,t,0)}catch{return E.call(this,t,0)}}}function Ht(t){if(A===clearTimeout)return clearTimeout(t);if((A===xe||!A)&&clearTimeout)return A=clearTimeout,clearTimeout(t);try{return A(t)}catch{try{return A.call(null,t)}catch{return A.call(this,t)}}}var I=[],W=!1,V,ue=-1;function Jt(){!W||!V||(W=!1,V.length?I=V.concat(I):ue=-1,I.length&&Ye())}function Ye(){if(!W){var t=Je(Jt);W=!0;for(var e=I.length;e;){for(V=I,I=[];++ue<e;)V&&V[ue].run();ue=-1,e=I.length}V=null,W=!1,Ht(t)}}w.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var s=1;s<arguments.length;s++)e[s-1]=arguments[s];I.push(new Xe(t,e)),I.length===1&&!W&&Je(Ye)};function Xe(t,e){this.fun=t,this.array=e}Xe.prototype.run=function(){this.fun.apply(null,this.array)};w.title="browser";w.browser=!0;w.env={};w.argv=[];w.version="";w.versions={};function j(){}w.on=j;w.addListener=j;w.once=j;w.off=j;w.removeListener=j;w.removeAllListeners=j;w.emit=j;w.prependListener=j;w.prependOnceListener=j;w.listeners=function(t){return[]};w.binding=function(t){throw new Error("process.binding is not supported")};w.cwd=function(){return"/"};w.chdir=function(t){throw new Error("process.chdir is not supported")};w.umask=function(){return 0};var Yt=He.exports;let oe;const Xt=new Uint8Array(16);function Kt(){if(!oe&&(oe=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!oe))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return oe(Xt)}const R=[];for(let t=0;t<256;++t)R.push((t+256).toString(16).slice(1));function es(t,e=0){return R[t[e+0]]+R[t[e+1]]+R[t[e+2]]+R[t[e+3]]+"-"+R[t[e+4]]+R[t[e+5]]+"-"+R[t[e+6]]+R[t[e+7]]+"-"+R[t[e+8]]+R[t[e+9]]+"-"+R[t[e+10]]+R[t[e+11]]+R[t[e+12]]+R[t[e+13]]+R[t[e+14]]+R[t[e+15]]}const ts=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Ve={randomUUID:ts};function Ke(t,e,s){if(Ve.randomUUID&&!e&&!t)return Ve.randomUUID();t=t||{};const n=t.random||(t.rng||Kt)();return n[6]=n[6]&15|64,n[8]=n[8]&63|128,es(n)}var _;(function(t){t.assertEqual=a=>{};function e(a){}t.assertIs=e;function s(a){throw new Error}t.assertNever=s,t.arrayToEnum=a=>{const r={};for(const i of a)r[i]=i;return r},t.getValidEnumValues=a=>{const r=t.objectKeys(a).filter(c=>typeof a[a[c]]!="number"),i={};for(const c of r)i[c]=a[c];return t.objectValues(i)},t.objectValues=a=>t.objectKeys(a).map(function(r){return a[r]}),t.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{const r=[];for(const i in a)Object.prototype.hasOwnProperty.call(a,i)&&r.push(i);return r},t.find=(a,r)=>{for(const i of a)if(r(i))return i},t.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function n(a,r=" | "){return a.map(i=>typeof i=="string"?`'${i}'`:i).join(r)}t.joinValues=n,t.jsonStringifyReplacer=(a,r)=>typeof r=="bigint"?r.toString():r})(_||(_={}));var Qe;(function(t){t.mergeShapes=(e,s)=>({...e,...s})})(Qe||(Qe={}));const d=_.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),P=t=>{switch(typeof t){case"undefined":return d.undefined;case"string":return d.string;case"number":return Number.isNaN(t)?d.nan:d.number;case"boolean":return d.boolean;case"function":return d.function;case"bigint":return d.bigint;case"symbol":return d.symbol;case"object":return Array.isArray(t)?d.array:t===null?d.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?d.promise:typeof Map<"u"&&t instanceof Map?d.map:typeof Set<"u"&&t instanceof Set?d.set:typeof Date<"u"&&t instanceof Date?d.date:d.object;default:return d.unknown}},o=_.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Z extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const s=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,s):this.__proto__=s,this.name="ZodError",this.issues=e}format(e){const s=e||function(r){return r.message},n={_errors:[]},a=r=>{for(const i of r.issues)if(i.code==="invalid_union")i.unionErrors.map(a);else if(i.code==="invalid_return_type")a(i.returnTypeError);else if(i.code==="invalid_arguments")a(i.argumentsError);else if(i.path.length===0)n._errors.push(s(i));else{let c=n,f=0;for(;f<i.path.length;){const h=i.path[f];f===i.path.length-1?(c[h]=c[h]||{_errors:[]},c[h]._errors.push(s(i))):c[h]=c[h]||{_errors:[]},c=c[h],f++}}};return a(this),n}static assert(e){if(!(e instanceof Z))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,_.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=s=>s.message){const s={},n=[];for(const a of this.issues)if(a.path.length>0){const r=a.path[0];s[r]=s[r]||[],s[r].push(e(a))}else n.push(e(a));return{formErrors:n,fieldErrors:s}}get formErrors(){return this.flatten()}}Z.create=t=>new Z(t);const be=(t,e)=>{let s;switch(t.code){case o.invalid_type:t.received===d.undefined?s="Required":s=`Expected ${t.expected}, received ${t.received}`;break;case o.invalid_literal:s=`Invalid literal value, expected ${JSON.stringify(t.expected,_.jsonStringifyReplacer)}`;break;case o.unrecognized_keys:s=`Unrecognized key(s) in object: ${_.joinValues(t.keys,", ")}`;break;case o.invalid_union:s="Invalid input";break;case o.invalid_union_discriminator:s=`Invalid discriminator value. Expected ${_.joinValues(t.options)}`;break;case o.invalid_enum_value:s=`Invalid enum value. Expected ${_.joinValues(t.options)}, received '${t.received}'`;break;case o.invalid_arguments:s="Invalid function arguments";break;case o.invalid_return_type:s="Invalid function return type";break;case o.invalid_date:s="Invalid date";break;case o.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(s=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(s=`${s} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?s=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?s=`Invalid input: must end with "${t.validation.endsWith}"`:_.assertNever(t.validation):t.validation!=="regex"?s=`Invalid ${t.validation}`:s="Invalid";break;case o.too_small:t.type==="array"?s=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?s=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?s=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?s=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?s=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:s="Invalid input";break;case o.too_big:t.type==="array"?s=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?s=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?s=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?s=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?s=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:s="Invalid input";break;case o.custom:s="Invalid input";break;case o.invalid_intersection_types:s="Intersection results could not be merged";break;case o.not_multiple_of:s=`Number must be a multiple of ${t.multipleOf}`;break;case o.not_finite:s="Number must be finite";break;default:s=e.defaultError,_.assertNever(t)}return{message:s}};let ss=be;function ns(){return ss}const as=t=>{const{data:e,path:s,errorMaps:n,issueData:a}=t,r=[...s,...a.path||[]],i={...a,path:r};if(a.message!==void 0)return{...a,path:r,message:a.message};let c="";const f=n.filter(h=>!!h).slice().reverse();for(const h of f)c=h(i,{data:e,defaultError:c}).message;return{...a,path:r,message:c}};function u(t,e){const s=ns(),n=as({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,s,s===be?void 0:be].filter(a=>!!a)});t.common.issues.push(n)}class M{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,s){const n=[];for(const a of s){if(a.status==="aborted")return p;a.status==="dirty"&&e.dirty(),n.push(a.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,s){const n=[];for(const a of s){const r=await a.key,i=await a.value;n.push({key:r,value:i})}return M.mergeObjectSync(e,n)}static mergeObjectSync(e,s){const n={};for(const a of s){const{key:r,value:i}=a;if(r.status==="aborted"||i.status==="aborted")return p;r.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),r.value!=="__proto__"&&(typeof i.value<"u"||a.alwaysSet)&&(n[r.value]=i.value)}return{status:e.value,value:n}}}const p=Object.freeze({status:"aborted"}),se=t=>({status:"dirty",value:t}),T=t=>({status:"valid",value:t}),ze=t=>t.status==="aborted",De=t=>t.status==="dirty",J=t=>t.status==="valid",de=t=>typeof Promise<"u"&&t instanceof Promise;var l;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(l||(l={}));class O{constructor(e,s,n,a){this._cachedPath=[],this.parent=e,this.data=s,this._path=n,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Fe=(t,e)=>{if(J(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const s=new Z(t.common.issues);return this._error=s,this._error}}};function g(t){if(!t)return{};const{errorMap:e,invalid_type_error:s,required_error:n,description:a}=t;if(e&&(s||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:(i,c)=>{const{message:f}=t;return i.code==="invalid_enum_value"?{message:f??c.defaultError}:typeof c.data>"u"?{message:f??n??c.defaultError}:i.code!=="invalid_type"?{message:c.defaultError}:{message:f??s??c.defaultError}},description:a}}class y{get description(){return this._def.description}_getType(e){return P(e.data)}_getOrReturnCtx(e,s){return s||{common:e.parent.common,data:e.data,parsedType:P(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new M,ctx:{common:e.parent.common,data:e.data,parsedType:P(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const s=this._parse(e);if(de(s))throw new Error("Synchronous parse encountered promise.");return s}_parseAsync(e){const s=this._parse(e);return Promise.resolve(s)}parse(e,s){const n=this.safeParse(e,s);if(n.success)return n.data;throw n.error}safeParse(e,s){const n={common:{issues:[],async:(s==null?void 0:s.async)??!1,contextualErrorMap:s==null?void 0:s.errorMap},path:(s==null?void 0:s.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:P(e)},a=this._parseSync({data:e,path:n.path,parent:n});return Fe(n,a)}"~validate"(e){var n,a;const s={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:P(e)};if(!this["~standard"].async)try{const r=this._parseSync({data:e,path:[],parent:s});return J(r)?{value:r.value}:{issues:s.common.issues}}catch(r){(a=(n=r==null?void 0:r.message)==null?void 0:n.toLowerCase())!=null&&a.includes("encountered")&&(this["~standard"].async=!0),s.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:s}).then(r=>J(r)?{value:r.value}:{issues:s.common.issues})}async parseAsync(e,s){const n=await this.safeParseAsync(e,s);if(n.success)return n.data;throw n.error}async safeParseAsync(e,s){const n={common:{issues:[],contextualErrorMap:s==null?void 0:s.errorMap,async:!0},path:(s==null?void 0:s.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:P(e)},a=this._parse({data:e,path:n.path,parent:n}),r=await(de(a)?a:Promise.resolve(a));return Fe(n,r)}refine(e,s){const n=a=>typeof s=="string"||typeof s>"u"?{message:s}:typeof s=="function"?s(a):s;return this._refinement((a,r)=>{const i=e(a),c=()=>r.addIssue({code:o.custom,...n(a)});return typeof Promise<"u"&&i instanceof Promise?i.then(f=>f?!0:(c(),!1)):i?!0:(c(),!1)})}refinement(e,s){return this._refinement((n,a)=>e(n)?!0:(a.addIssue(typeof s=="function"?s(n,a):s),!1))}_refinement(e){return new B({schema:this,typeName:m.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:s=>this["~validate"](s)}}optional(){return L.create(this,this._def)}nullable(){return te.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return N.create(this)}promise(){return me.create(this,this._def)}or(e){return le.create([this,e],this._def)}and(e){return fe.create(this,e,this._def)}transform(e){return new B({...g(this._def),schema:this,typeName:m.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const s=typeof e=="function"?e:()=>e;return new qe({...g(this._def),innerType:this,defaultValue:s,typeName:m.ZodDefault})}brand(){return new Cs({typeName:m.ZodBranded,type:this,...g(this._def)})}catch(e){const s=typeof e=="function"?e:()=>e;return new Ze({...g(this._def),innerType:this,catchValue:s,typeName:m.ZodCatch})}describe(e){const s=this.constructor;return new s({...this._def,description:e})}pipe(e){return Le.create(this,e)}readonly(){return Pe.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const rs=/^c[^\s-]{8,}$/i,is=/^[0-9a-z]+$/,cs=/^[0-9A-HJKMNP-TV-Z]{26}$/i,os=/^[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,us=/^[a-z0-9_-]{21}$/i,ds=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,ls=/^[-+]?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)?)??$/,fs=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,hs="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let ve;const ms=/^(?:(?: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])$/,ps=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,gs=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,ys=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,vs=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,_s=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,et="((\\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])))",xs=new RegExp(`^${et}$`);function tt(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);const s=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${s}`}function bs(t){return new RegExp(`^${tt(t)}$`)}function ks(t){let e=`${et}T${tt(t)}`;const s=[];return s.push(t.local?"Z?":"Z"),t.offset&&s.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${s.join("|")})`,new RegExp(`^${e}$`)}function ws(t,e){return!!((e==="v4"||!e)&&ms.test(t)||(e==="v6"||!e)&&gs.test(t))}function Ss(t,e){if(!ds.test(t))return!1;try{const[s]=t.split(".");if(!s)return!1;const n=s.replace(/-/g,"+").replace(/_/g,"/").padEnd(s.length+(4-s.length%4)%4,"="),a=JSON.parse(atob(n));return!(typeof a!="object"||a===null||"typ"in a&&(a==null?void 0:a.typ)!=="JWT"||!a.alg||e&&a.alg!==e)}catch{return!1}}function Rs(t,e){return!!((e==="v4"||!e)&&ps.test(t)||(e==="v6"||!e)&&ys.test(t))}class q extends y{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==d.string){const r=this._getOrReturnCtx(e);return u(r,{code:o.invalid_type,expected:d.string,received:r.parsedType}),p}const n=new M;let a;for(const r of this._def.checks)if(r.kind==="min")e.data.length<r.value&&(a=this._getOrReturnCtx(e,a),u(a,{code:o.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),n.dirty());else if(r.kind==="max")e.data.length>r.value&&(a=this._getOrReturnCtx(e,a),u(a,{code:o.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),n.dirty());else if(r.kind==="length"){const i=e.data.length>r.value,c=e.data.length<r.value;(i||c)&&(a=this._getOrReturnCtx(e,a),i?u(a,{code:o.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}):c&&u(a,{code:o.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}),n.dirty())}else if(r.kind==="email")fs.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"email",code:o.invalid_string,message:r.message}),n.dirty());else if(r.kind==="emoji")ve||(ve=new RegExp(hs,"u")),ve.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"emoji",code:o.invalid_string,message:r.message}),n.dirty());else if(r.kind==="uuid")os.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"uuid",code:o.invalid_string,message:r.message}),n.dirty());else if(r.kind==="nanoid")us.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"nanoid",code:o.invalid_string,message:r.message}),n.dirty());else if(r.kind==="cuid")rs.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"cuid",code:o.invalid_string,message:r.message}),n.dirty());else if(r.kind==="cuid2")is.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"cuid2",code:o.invalid_string,message:r.message}),n.dirty());else if(r.kind==="ulid")cs.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"ulid",code:o.invalid_string,message:r.message}),n.dirty());else if(r.kind==="url")try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),u(a,{validation:"url",code:o.invalid_string,message:r.message}),n.dirty()}else r.kind==="regex"?(r.regex.lastIndex=0,r.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"regex",code:o.invalid_string,message:r.message}),n.dirty())):r.kind==="trim"?e.data=e.data.trim():r.kind==="includes"?e.data.includes(r.value,r.position)||(a=this._getOrReturnCtx(e,a),u(a,{code:o.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),n.dirty()):r.kind==="toLowerCase"?e.data=e.data.toLowerCase():r.kind==="toUpperCase"?e.data=e.data.toUpperCase():r.kind==="startsWith"?e.data.startsWith(r.value)||(a=this._getOrReturnCtx(e,a),u(a,{code:o.invalid_string,validation:{startsWith:r.value},message:r.message}),n.dirty()):r.kind==="endsWith"?e.data.endsWith(r.value)||(a=this._getOrReturnCtx(e,a),u(a,{code:o.invalid_string,validation:{endsWith:r.value},message:r.message}),n.dirty()):r.kind==="datetime"?ks(r).test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{code:o.invalid_string,validation:"datetime",message:r.message}),n.dirty()):r.kind==="date"?xs.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{code:o.invalid_string,validation:"date",message:r.message}),n.dirty()):r.kind==="time"?bs(r).test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{code:o.invalid_string,validation:"time",message:r.message}),n.dirty()):r.kind==="duration"?ls.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"duration",code:o.invalid_string,message:r.message}),n.dirty()):r.kind==="ip"?ws(e.data,r.version)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"ip",code:o.invalid_string,message:r.message}),n.dirty()):r.kind==="jwt"?Ss(e.data,r.alg)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"jwt",code:o.invalid_string,message:r.message}),n.dirty()):r.kind==="cidr"?Rs(e.data,r.version)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"cidr",code:o.invalid_string,message:r.message}),n.dirty()):r.kind==="base64"?vs.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"base64",code:o.invalid_string,message:r.message}),n.dirty()):r.kind==="base64url"?_s.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"base64url",code:o.invalid_string,message:r.message}),n.dirty()):_.assertNever(r);return{status:n.value,value:e.data}}_regex(e,s,n){return this.refinement(a=>e.test(a),{validation:s,code:o.invalid_string,...l.errToObj(n)})}_addCheck(e){return new q({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...l.errToObj(e)})}url(e){return this._addCheck({kind:"url",...l.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...l.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...l.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...l.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...l.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...l.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...l.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...l.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...l.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...l.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...l.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...l.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...l.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...l.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...l.errToObj(e)})}regex(e,s){return this._addCheck({kind:"regex",regex:e,...l.errToObj(s)})}includes(e,s){return this._addCheck({kind:"includes",value:e,position:s==null?void 0:s.position,...l.errToObj(s==null?void 0:s.message)})}startsWith(e,s){return this._addCheck({kind:"startsWith",value:e,...l.errToObj(s)})}endsWith(e,s){return this._addCheck({kind:"endsWith",value:e,...l.errToObj(s)})}min(e,s){return this._addCheck({kind:"min",value:e,...l.errToObj(s)})}max(e,s){return this._addCheck({kind:"max",value:e,...l.errToObj(s)})}length(e,s){return this._addCheck({kind:"length",value:e,...l.errToObj(s)})}nonempty(e){return this.min(1,l.errToObj(e))}trim(){return new q({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new q({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new q({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const s of this._def.checks)s.kind==="min"&&(e===null||s.value>e)&&(e=s.value);return e}get maxLength(){let e=null;for(const s of this._def.checks)s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);return e}}q.create=t=>new q({checks:[],typeName:m.ZodString,coerce:(t==null?void 0:t.coerce)??!1,...g(t)});function Ms(t,e){const s=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,a=s>n?s:n,r=Number.parseInt(t.toFixed(a).replace(".","")),i=Number.parseInt(e.toFixed(a).replace(".",""));return r%i/10**a}class Y extends y{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==d.number){const r=this._getOrReturnCtx(e);return u(r,{code:o.invalid_type,expected:d.number,received:r.parsedType}),p}let n;const a=new M;for(const r of this._def.checks)r.kind==="int"?_.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{code:o.invalid_type,expected:"integer",received:"float",message:r.message}),a.dirty()):r.kind==="min"?(r.inclusive?e.data<r.value:e.data<=r.value)&&(n=this._getOrReturnCtx(e,n),u(n,{code:o.too_small,minimum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),a.dirty()):r.kind==="max"?(r.inclusive?e.data>r.value:e.data>=r.value)&&(n=this._getOrReturnCtx(e,n),u(n,{code:o.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),a.dirty()):r.kind==="multipleOf"?Ms(e.data,r.value)!==0&&(n=this._getOrReturnCtx(e,n),u(n,{code:o.not_multiple_of,multipleOf:r.value,message:r.message}),a.dirty()):r.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{code:o.not_finite,message:r.message}),a.dirty()):_.assertNever(r);return{status:a.value,value:e.data}}gte(e,s){return this.setLimit("min",e,!0,l.toString(s))}gt(e,s){return this.setLimit("min",e,!1,l.toString(s))}lte(e,s){return this.setLimit("max",e,!0,l.toString(s))}lt(e,s){return this.setLimit("max",e,!1,l.toString(s))}setLimit(e,s,n,a){return new Y({...this._def,checks:[...this._def.checks,{kind:e,value:s,inclusive:n,message:l.toString(a)}]})}_addCheck(e){return new Y({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:l.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:l.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:l.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:l.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:l.toString(e)})}multipleOf(e,s){return this._addCheck({kind:"multipleOf",value:e,message:l.toString(s)})}finite(e){return this._addCheck({kind:"finite",message:l.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:l.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:l.toString(e)})}get minValue(){let e=null;for(const s of this._def.checks)s.kind==="min"&&(e===null||s.value>e)&&(e=s.value);return e}get maxValue(){let e=null;for(const s of this._def.checks)s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&_.isInteger(e.value))}get isFinite(){let e=null,s=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(s===null||n.value>s)&&(s=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(s)&&Number.isFinite(e)}}Y.create=t=>new Y({checks:[],typeName:m.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...g(t)});class X extends y{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==d.bigint)return this._getInvalidInput(e);let n;const a=new M;for(const r of this._def.checks)r.kind==="min"?(r.inclusive?e.data<r.value:e.data<=r.value)&&(n=this._getOrReturnCtx(e,n),u(n,{code:o.too_small,type:"bigint",minimum:r.value,inclusive:r.inclusive,message:r.message}),a.dirty()):r.kind==="max"?(r.inclusive?e.data>r.value:e.data>=r.value)&&(n=this._getOrReturnCtx(e,n),u(n,{code:o.too_big,type:"bigint",maximum:r.value,inclusive:r.inclusive,message:r.message}),a.dirty()):r.kind==="multipleOf"?e.data%r.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),u(n,{code:o.not_multiple_of,multipleOf:r.value,message:r.message}),a.dirty()):_.assertNever(r);return{status:a.value,value:e.data}}_getInvalidInput(e){const s=this._getOrReturnCtx(e);return u(s,{code:o.invalid_type,expected:d.bigint,received:s.parsedType}),p}gte(e,s){return this.setLimit("min",e,!0,l.toString(s))}gt(e,s){return this.setLimit("min",e,!1,l.toString(s))}lte(e,s){return this.setLimit("max",e,!0,l.toString(s))}lt(e,s){return this.setLimit("max",e,!1,l.toString(s))}setLimit(e,s,n,a){return new X({...this._def,checks:[...this._def.checks,{kind:e,value:s,inclusive:n,message:l.toString(a)}]})}_addCheck(e){return new X({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:l.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:l.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:l.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:l.toString(e)})}multipleOf(e,s){return this._addCheck({kind:"multipleOf",value:e,message:l.toString(s)})}get minValue(){let e=null;for(const s of this._def.checks)s.kind==="min"&&(e===null||s.value>e)&&(e=s.value);return e}get maxValue(){let e=null;for(const s of this._def.checks)s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);return e}}X.create=t=>new X({checks:[],typeName:m.ZodBigInt,coerce:(t==null?void 0:t.coerce)??!1,...g(t)});class ke extends y{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==d.boolean){const n=this._getOrReturnCtx(e);return u(n,{code:o.invalid_type,expected:d.boolean,received:n.parsedType}),p}return T(e.data)}}ke.create=t=>new ke({typeName:m.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...g(t)});class ie extends y{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==d.date){const r=this._getOrReturnCtx(e);return u(r,{code:o.invalid_type,expected:d.date,received:r.parsedType}),p}if(Number.isNaN(e.data.getTime())){const r=this._getOrReturnCtx(e);return u(r,{code:o.invalid_date}),p}const n=new M;let a;for(const r of this._def.checks)r.kind==="min"?e.data.getTime()<r.value&&(a=this._getOrReturnCtx(e,a),u(a,{code:o.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:"date"}),n.dirty()):r.kind==="max"?e.data.getTime()>r.value&&(a=this._getOrReturnCtx(e,a),u(a,{code:o.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),n.dirty()):_.assertNever(r);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new ie({...this._def,checks:[...this._def.checks,e]})}min(e,s){return this._addCheck({kind:"min",value:e.getTime(),message:l.toString(s)})}max(e,s){return this._addCheck({kind:"max",value:e.getTime(),message:l.toString(s)})}get minDate(){let e=null;for(const s of this._def.checks)s.kind==="min"&&(e===null||s.value>e)&&(e=s.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const s of this._def.checks)s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);return e!=null?new Date(e):null}}ie.create=t=>new ie({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:m.ZodDate,...g(t)});class we extends y{_parse(e){if(this._getType(e)!==d.symbol){const n=this._getOrReturnCtx(e);return u(n,{code:o.invalid_type,expected:d.symbol,received:n.parsedType}),p}return T(e.data)}}we.create=t=>new we({typeName:m.ZodSymbol,...g(t)});class Se extends y{_parse(e){if(this._getType(e)!==d.undefined){const n=this._getOrReturnCtx(e);return u(n,{code:o.invalid_type,expected:d.undefined,received:n.parsedType}),p}return T(e.data)}}Se.create=t=>new Se({typeName:m.ZodUndefined,...g(t)});class Re extends y{_parse(e){if(this._getType(e)!==d.null){const n=this._getOrReturnCtx(e);return u(n,{code:o.invalid_type,expected:d.null,received:n.parsedType}),p}return T(e.data)}}Re.create=t=>new Re({typeName:m.ZodNull,...g(t)});class Me extends y{constructor(){super(...arguments),this._any=!0}_parse(e){return T(e.data)}}Me.create=t=>new Me({typeName:m.ZodAny,...g(t)});class Ce extends y{constructor(){super(...arguments),this._unknown=!0}_parse(e){return T(e.data)}}Ce.create=t=>new Ce({typeName:m.ZodUnknown,...g(t)});class $ extends y{_parse(e){const s=this._getOrReturnCtx(e);return u(s,{code:o.invalid_type,expected:d.never,received:s.parsedType}),p}}$.create=t=>new $({typeName:m.ZodNever,...g(t)});class Te extends y{_parse(e){if(this._getType(e)!==d.undefined){const n=this._getOrReturnCtx(e);return u(n,{code:o.invalid_type,expected:d.void,received:n.parsedType}),p}return T(e.data)}}Te.create=t=>new Te({typeName:m.ZodVoid,...g(t)});class N extends y{_parse(e){const{ctx:s,status:n}=this._processInputParams(e),a=this._def;if(s.parsedType!==d.array)return u(s,{code:o.invalid_type,expected:d.array,received:s.parsedType}),p;if(a.exactLength!==null){const i=s.data.length>a.exactLength.value,c=s.data.length<a.exactLength.value;(i||c)&&(u(s,{code:i?o.too_big:o.too_small,minimum:c?a.exactLength.value:void 0,maximum:i?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),n.dirty())}if(a.minLength!==null&&s.data.length<a.minLength.value&&(u(s,{code:o.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),n.dirty()),a.maxLength!==null&&s.data.length>a.maxLength.value&&(u(s,{code:o.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),n.dirty()),s.common.async)return Promise.all([...s.data].map((i,c)=>a.type._parseAsync(new O(s,i,s.path,c)))).then(i=>M.mergeArray(n,i));const r=[...s.data].map((i,c)=>a.type._parseSync(new O(s,i,s.path,c)));return M.mergeArray(n,r)}get element(){return this._def.type}min(e,s){return new N({...this._def,minLength:{value:e,message:l.toString(s)}})}max(e,s){return new N({...this._def,maxLength:{value:e,message:l.toString(s)}})}length(e,s){return new N({...this._def,exactLength:{value:e,message:l.toString(s)}})}nonempty(e){return this.min(1,e)}}N.create=(t,e)=>new N({type:t,minLength:null,maxLength:null,exactLength:null,typeName:m.ZodArray,...g(e)});function F(t){if(t instanceof k){const e={};for(const s in t.shape){const n=t.shape[s];e[s]=L.create(F(n))}return new k({...t._def,shape:()=>e})}else return t instanceof N?new N({...t._def,type:F(t.element)}):t instanceof L?L.create(F(t.unwrap())):t instanceof te?te.create(F(t.unwrap())):t instanceof Q?Q.create(t.items.map(e=>F(e))):t}class k extends y{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),s=_.objectKeys(e);return this._cached={shape:e,keys:s},this._cached}_parse(e){if(this._getType(e)!==d.object){const h=this._getOrReturnCtx(e);return u(h,{code:o.invalid_type,expected:d.object,received:h.parsedType}),p}const{status:n,ctx:a}=this._processInputParams(e),{shape:r,keys:i}=this._getCached(),c=[];if(!(this._def.catchall instanceof $&&this._def.unknownKeys==="strip"))for(const h in a.data)i.includes(h)||c.push(h);const f=[];for(const h of i){const v=r[h],U=a.data[h];f.push({key:{status:"valid",value:h},value:v._parse(new O(a,U,a.path,h)),alwaysSet:h in a.data})}if(this._def.catchall instanceof $){const h=this._def.unknownKeys;if(h==="passthrough")for(const v of c)f.push({key:{status:"valid",value:v},value:{status:"valid",value:a.data[v]}});else if(h==="strict")c.length>0&&(u(a,{code:o.unrecognized_keys,keys:c}),n.dirty());else if(h!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const h=this._def.catchall;for(const v of c){const U=a.data[v];f.push({key:{status:"valid",value:v},value:h._parse(new O(a,U,a.path,v)),alwaysSet:v in a.data})}}return a.common.async?Promise.resolve().then(async()=>{const h=[];for(const v of f){const U=await v.key,D=await v.value;h.push({key:U,value:D,alwaysSet:v.alwaysSet})}return h}).then(h=>M.mergeObjectSync(n,h)):M.mergeObjectSync(n,f)}get shape(){return this._def.shape()}strict(e){return l.errToObj,new k({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(s,n)=>{var r,i;const a=((i=(r=this._def).errorMap)==null?void 0:i.call(r,s,n).message)??n.defaultError;return s.code==="unrecognized_keys"?{message:l.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new k({...this._def,unknownKeys:"strip"})}passthrough(){return new k({...this._def,unknownKeys:"passthrough"})}extend(e){return new k({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new k({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:m.ZodObject})}setKey(e,s){return this.augment({[e]:s})}catchall(e){return new k({...this._def,catchall:e})}pick(e){const s={};for(const n of _.objectKeys(e))e[n]&&this.shape[n]&&(s[n]=this.shape[n]);return new k({...this._def,shape:()=>s})}omit(e){const s={};for(const n of _.objectKeys(this.shape))e[n]||(s[n]=this.shape[n]);return new k({...this._def,shape:()=>s})}deepPartial(){return F(this)}partial(e){const s={};for(const n of _.objectKeys(this.shape)){const a=this.shape[n];e&&!e[n]?s[n]=a:s[n]=a.optional()}return new k({...this._def,shape:()=>s})}required(e){const s={};for(const n of _.objectKeys(this.shape))if(e&&!e[n])s[n]=this.shape[n];else{let r=this.shape[n];for(;r instanceof L;)r=r._def.innerType;s[n]=r}return new k({...this._def,shape:()=>s})}keyof(){return st(_.objectKeys(this.shape))}}k.create=(t,e)=>new k({shape:()=>t,unknownKeys:"strip",catchall:$.create(),typeName:m.ZodObject,...g(e)});k.strictCreate=(t,e)=>new k({shape:()=>t,unknownKeys:"strict",catchall:$.create(),typeName:m.ZodObject,...g(e)});k.lazycreate=(t,e)=>new k({shape:t,unknownKeys:"strip",catchall:$.create(),typeName:m.ZodObject,...g(e)});class le extends y{_parse(e){const{ctx:s}=this._processInputParams(e),n=this._def.options;function a(r){for(const c of r)if(c.result.status==="valid")return c.result;for(const c of r)if(c.result.status==="dirty")return s.common.issues.push(...c.ctx.common.issues),c.result;const i=r.map(c=>new Z(c.ctx.common.issues));return u(s,{code:o.invalid_union,unionErrors:i}),p}if(s.common.async)return Promise.all(n.map(async r=>{const i={...s,common:{...s.common,issues:[]},parent:null};return{result:await r._parseAsync({data:s.data,path:s.path,parent:i}),ctx:i}})).then(a);{let r;const i=[];for(const f of n){const h={...s,common:{...s.common,issues:[]},parent:null},v=f._parseSync({data:s.data,path:s.path,parent:h});if(v.status==="valid")return v;v.status==="dirty"&&!r&&(r={result:v,ctx:h}),h.common.issues.length&&i.push(h.common.issues)}if(r)return s.common.issues.push(...r.ctx.common.issues),r.result;const c=i.map(f=>new Z(f));return u(s,{code:o.invalid_union,unionErrors:c}),p}}get options(){return this._def.options}}le.create=(t,e)=>new le({options:t,typeName:m.ZodUnion,...g(e)});function Ee(t,e){const s=P(t),n=P(e);if(t===e)return{valid:!0,data:t};if(s===d.object&&n===d.object){const a=_.objectKeys(e),r=_.objectKeys(t).filter(c=>a.indexOf(c)!==-1),i={...t,...e};for(const c of r){const f=Ee(t[c],e[c]);if(!f.valid)return{valid:!1};i[c]=f.data}return{valid:!0,data:i}}else if(s===d.array&&n===d.array){if(t.length!==e.length)return{valid:!1};const a=[];for(let r=0;r<t.length;r++){const i=t[r],c=e[r],f=Ee(i,c);if(!f.valid)return{valid:!1};a.push(f.data)}return{valid:!0,data:a}}else return s===d.date&&n===d.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class fe extends y{_parse(e){const{status:s,ctx:n}=this._processInputParams(e),a=(r,i)=>{if(ze(r)||ze(i))return p;const c=Ee(r.value,i.value);return c.valid?((De(r)||De(i))&&s.dirty(),{status:s.value,value:c.data}):(u(n,{code:o.invalid_intersection_types}),p)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([r,i])=>a(r,i)):a(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}fe.create=(t,e,s)=>new fe({left:t,right:e,typeName:m.ZodIntersection,...g(s)});class Q extends y{_parse(e){const{status:s,ctx:n}=this._processInputParams(e);if(n.parsedType!==d.array)return u(n,{code:o.invalid_type,expected:d.array,received:n.parsedType}),p;if(n.data.length<this._def.items.length)return u(n,{code:o.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),p;!this._def.rest&&n.data.length>this._def.items.length&&(u(n,{code:o.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),s.dirty());const r=[...n.data].map((i,c)=>{const f=this._def.items[c]||this._def.rest;return f?f._parse(new O(n,i,n.path,c)):null}).filter(i=>!!i);return n.common.async?Promise.all(r).then(i=>M.mergeArray(s,i)):M.mergeArray(s,r)}get items(){return this._def.items}rest(e){return new Q({...this._def,rest:e})}}Q.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Q({items:t,typeName:m.ZodTuple,rest:null,...g(e)})};class he extends y{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:s,ctx:n}=this._processInputParams(e);if(n.parsedType!==d.object)return u(n,{code:o.invalid_type,expected:d.object,received:n.parsedType}),p;const a=[],r=this._def.keyType,i=this._def.valueType;for(const c in n.data)a.push({key:r._parse(new O(n,c,n.path,c)),value:i._parse(new O(n,n.data[c],n.path,c)),alwaysSet:c in n.data});return n.common.async?M.mergeObjectAsync(s,a):M.mergeObjectSync(s,a)}get element(){return this._def.valueType}static create(e,s,n){return s instanceof y?new he({keyType:e,valueType:s,typeName:m.ZodRecord,...g(n)}):new he({keyType:q.create(),valueType:e,typeName:m.ZodRecord,...g(s)})}}class Ae extends y{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:s,ctx:n}=this._processInputParams(e);if(n.parsedType!==d.map)return u(n,{code:o.invalid_type,expected:d.map,received:n.parsedType}),p;const a=this._def.keyType,r=this._def.valueType,i=[...n.data.entries()].map(([c,f],h)=>({key:a._parse(new O(n,c,n.path,[h,"key"])),value:r._parse(new O(n,f,n.path,[h,"value"]))}));if(n.common.async){const c=new Map;return Promise.resolve().then(async()=>{for(const f of i){const h=await f.key,v=await f.value;if(h.status==="aborted"||v.status==="aborted")return p;(h.status==="dirty"||v.status==="dirty")&&s.dirty(),c.set(h.value,v.value)}return{status:s.value,value:c}})}else{const c=new Map;for(const f of i){const h=f.key,v=f.value;if(h.status==="aborted"||v.status==="aborted")return p;(h.status==="dirty"||v.status==="dirty")&&s.dirty(),c.set(h.value,v.value)}return{status:s.value,value:c}}}}Ae.create=(t,e,s)=>new Ae({valueType:e,keyType:t,typeName:m.ZodMap,...g(s)});class K extends y{_parse(e){const{status:s,ctx:n}=this._processInputParams(e);if(n.parsedType!==d.set)return u(n,{code:o.invalid_type,expected:d.set,received:n.parsedType}),p;const a=this._def;a.minSize!==null&&n.data.size<a.minSize.value&&(u(n,{code:o.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),s.dirty()),a.maxSize!==null&&n.data.size>a.maxSize.value&&(u(n,{code:o.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),s.dirty());const r=this._def.valueType;function i(f){const h=new Set;for(const v of f){if(v.status==="aborted")return p;v.status==="dirty"&&s.dirty(),h.add(v.value)}return{status:s.value,value:h}}const c=[...n.data.values()].map((f,h)=>r._parse(new O(n,f,n.path,h)));return n.common.async?Promise.all(c).then(f=>i(f)):i(c)}min(e,s){return new K({...this._def,minSize:{value:e,message:l.toString(s)}})}max(e,s){return new K({...this._def,maxSize:{value:e,message:l.toString(s)}})}size(e,s){return this.min(e,s).max(e,s)}nonempty(e){return this.min(1,e)}}K.create=(t,e)=>new K({valueType:t,minSize:null,maxSize:null,typeName:m.ZodSet,...g(e)});class Ne extends y{get schema(){return this._def.getter()}_parse(e){const{ctx:s}=this._processInputParams(e);return this._def.getter()._parse({data:s.data,path:s.path,parent:s})}}Ne.create=(t,e)=>new Ne({getter:t,typeName:m.ZodLazy,...g(e)});class Oe extends y{_parse(e){if(e.data!==this._def.value){const s=this._getOrReturnCtx(e);return u(s,{received:s.data,code:o.invalid_literal,expected:this._def.value}),p}return{status:"valid",value:e.data}}get value(){return this._def.value}}Oe.create=(t,e)=>new Oe({value:t,typeName:m.ZodLiteral,...g(e)});function st(t,e){return new ee({values:t,typeName:m.ZodEnum,...g(e)})}class ee extends y{_parse(e){if(typeof e.data!="string"){const s=this._getOrReturnCtx(e),n=this._def.values;return u(s,{expected:_.joinValues(n),received:s.parsedType,code:o.invalid_type}),p}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const s=this._getOrReturnCtx(e),n=this._def.values;return u(s,{received:s.data,code:o.invalid_enum_value,options:n}),p}return T(e.data)}get options(){return this._def.values}get enum(){const e={};for(const s of this._def.values)e[s]=s;return e}get Values(){const e={};for(const s of this._def.values)e[s]=s;return e}get Enum(){const e={};for(const s of this._def.values)e[s]=s;return e}extract(e,s=this._def){return ee.create(e,{...this._def,...s})}exclude(e,s=this._def){return ee.create(this.options.filter(n=>!e.includes(n)),{...this._def,...s})}}ee.create=st;class Ie extends y{_parse(e){const s=_.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==d.string&&n.parsedType!==d.number){const a=_.objectValues(s);return u(n,{expected:_.joinValues(a),received:n.parsedType,code:o.invalid_type}),p}if(this._cache||(this._cache=new Set(_.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const a=_.objectValues(s);return u(n,{received:n.data,code:o.invalid_enum_value,options:a}),p}return T(e.data)}get enum(){return this._def.values}}Ie.create=(t,e)=>new Ie({values:t,typeName:m.ZodNativeEnum,...g(e)});class me extends y{unwrap(){return this._def.type}_parse(e){const{ctx:s}=this._processInputParams(e);if(s.parsedType!==d.promise&&s.common.async===!1)return u(s,{code:o.invalid_type,expected:d.promise,received:s.parsedType}),p;const n=s.parsedType===d.promise?s.data:Promise.resolve(s.data);return T(n.then(a=>this._def.type.parseAsync(a,{path:s.path,errorMap:s.common.contextualErrorMap})))}}me.create=(t,e)=>new me({type:t,typeName:m.ZodPromise,...g(e)});class B extends y{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===m.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:s,ctx:n}=this._processInputParams(e),a=this._def.effect||null,r={addIssue:i=>{u(n,i),i.fatal?s.abort():s.dirty()},get path(){return n.path}};if(r.addIssue=r.addIssue.bind(r),a.type==="preprocess"){const i=a.transform(n.data,r);if(n.common.async)return Promise.resolve(i).then(async c=>{if(s.value==="aborted")return p;const f=await this._def.schema._parseAsync({data:c,path:n.path,parent:n});return f.status==="aborted"?p:f.status==="dirty"||s.value==="dirty"?se(f.value):f});{if(s.value==="aborted")return p;const c=this._def.schema._parseSync({data:i,path:n.path,parent:n});return c.status==="aborted"?p:c.status==="dirty"||s.value==="dirty"?se(c.value):c}}if(a.type==="refinement"){const i=c=>{const f=a.refinement(c,r);if(n.common.async)return Promise.resolve(f);if(f instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return c};if(n.common.async===!1){const c=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return c.status==="aborted"?p:(c.status==="dirty"&&s.dirty(),i(c.value),{status:s.value,value:c.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(c=>c.status==="aborted"?p:(c.status==="dirty"&&s.dirty(),i(c.value).then(()=>({status:s.value,value:c.value}))))}if(a.type==="transform")if(n.common.async===!1){const i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!J(i))return p;const c=a.transform(i.value,r);if(c instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:s.value,value:c}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>J(i)?Promise.resolve(a.transform(i.value,r)).then(c=>({status:s.value,value:c})):p);_.assertNever(a)}}B.create=(t,e,s)=>new B({schema:t,typeName:m.ZodEffects,effect:e,...g(s)});B.createWithPreprocess=(t,e,s)=>new B({schema:e,effect:{type:"preprocess",transform:t},typeName:m.ZodEffects,...g(s)});class L extends y{_parse(e){return this._getType(e)===d.undefined?T(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}L.create=(t,e)=>new L({innerType:t,typeName:m.ZodOptional,...g(e)});class te extends y{_parse(e){return this._getType(e)===d.null?T(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}te.create=(t,e)=>new te({innerType:t,typeName:m.ZodNullable,...g(e)});class qe extends y{_parse(e){const{ctx:s}=this._processInputParams(e);let n=s.data;return s.parsedType===d.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:s.path,parent:s})}removeDefault(){return this._def.innerType}}qe.create=(t,e)=>new qe({innerType:t,typeName:m.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...g(e)});class Ze extends y{_parse(e){const{ctx:s}=this._processInputParams(e),n={...s,common:{...s.common,issues:[]}},a=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return de(a)?a.then(r=>({status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new Z(n.common.issues)},input:n.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Z(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}Ze.create=(t,e)=>new Ze({innerType:t,typeName:m.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...g(e)});class je extends y{_parse(e){if(this._getType(e)!==d.nan){const n=this._getOrReturnCtx(e);return u(n,{code:o.invalid_type,expected:d.nan,received:n.parsedType}),p}return{status:"valid",value:e.data}}}je.create=t=>new je({typeName:m.ZodNaN,...g(t)});class Cs extends y{_parse(e){const{ctx:s}=this._processInputParams(e),n=s.data;return this._def.type._parse({data:n,path:s.path,parent:s})}unwrap(){return this._def.type}}class Le extends y{_parse(e){const{status:s,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const r=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return r.status==="aborted"?p:r.status==="dirty"?(s.dirty(),se(r.value)):this._def.out._parseAsync({data:r.value,path:n.path,parent:n})})();{const a=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?p:a.status==="dirty"?(s.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:n.path,parent:n})}}static create(e,s){return new Le({in:e,out:s,typeName:m.ZodPipeline})}}class Pe extends y{_parse(e){const s=this._def.innerType._parse(e),n=a=>(J(a)&&(a.value=Object.freeze(a.value)),a);return de(s)?s.then(a=>n(a)):n(s)}unwrap(){return this._def.innerType}}Pe.create=(t,e)=>new Pe({innerType:t,typeName:m.ZodReadonly,...g(e)});k.lazycreate;var m;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(m||(m={}));const x=q.create,$e=Y.create;je.create;X.create;const H=ke.create;ie.create;we.create;Se.create;Re.create;Me.create;const pe=Ce.create;$.create;Te.create;const Ts=N.create,ge=k.create;k.strictCreate;le.create;fe.create;Q.create;const Es=he.create;Ae.create;K.create;Ne.create;const b=Oe.create;ee.create;Ie.create;me.create;B.create;L.create;te.create;B.createWithPreprocess;const nt=1,G=ge({type:b("qp-bridge"),id:x().optional()}),S=G.extend({featureVersion:$e().optional()}),at=G.extend({status:b("answerChanged"),question:x(),answer:pe()}),rt=G.extend({action:b("commandExecuted"),commandName:x()}),it=G.extend({action:b("questionnaireLoaded")}),z=G.extend({status:b("success")}),ct=G.extend({status:b("error"),message:x()}),Be=ge({semanticColor:x().optional(),label:x(),description:x(),disabled:H(),required:H(),hidden:H(),errorMessage:x().optional(),answer:pe().optional()}),ot=Be.partial(),ut=ge({id:x().uuid(),name:x(),mimeType:x(),blobUrl:x()}),ye=Es(pe()),Ge=ge({label:x(),hidden:H(),collapsed:H()}),dt=Ge.partial(),lt=S.extend({action:b("getQuestion"),question:x()}),ft=z.extend({question:Be}),ht=S.extend({action:b("setQuestion"),question:x(),questionData:ot}),mt=S.extend({action:b("getGroup"),group:x()}),pt=z.extend({group:Ge}),gt=z.extend({canSave:H()}),yt=S.extend({action:b("canSave")}),vt=S.extend({action:b("setGroup"),group:x(),groupData:dt}),_t=S.extend({action:b("setAnswer"),question:x(),answer:pe()}),xt=S.extend({action:b("busyIndicatorStart")}),bt=S.extend({action:b("busyIndicatorEnd")}),kt=S.extend({action:b("saveQuestionnaire")}),wt=S.extend({action:b("completeAndCloseQuestionnaire")}),St=S.extend({action:b("executeCustomCommand"),commandName:x()}),Rt=S.extend({action:b("fetchEntities"),fetchXml:x()}),Mt=z.extend({entities:Ts(ye)}),Ct=S.extend({action:b("getEntityById"),entityName:x(),entityId:x()}),Tt=z.extend({entity:ye}),Et=S.extend({action:b("saveEntity"),entity:ye}),At=S.extend({action:b("repeatGroup"),parentGroupName:x(),groupIndex:$e()}),Nt=S.extend({action:b("addNewGroup"),groupName:x()}),Ot=S.extend({action:b("deleteGroup"),parentGroupName:x(),groupIndex:$e()});function As(t){return ut.safeParse(t).success}function It(t){return at.safeParse(t).success}function qt(t){return rt.safeParse(t).success}function Zt(t){return it.safeParse(t).success}function Ue(t){return G.safeParse(t).success}function Ns(t){return S.safeParse(t).success}function jt(t){return z.safeParse(t).success}function Pt(t){return ct.safeParse(t).success}function Os(t){return lt.safeParse(t).success}function Lt(t){return ft.safeParse(t).success}function Is(t){return _t.safeParse(t).success}function qs(t){return ht.safeParse(t).success}function Zs(t){return vt.safeParse(t).success}function js(t){return mt.safeParse(t).success}function $t(t){return pt.safeParse(t).success}function Ps(t){return gt.safeParse(t).success}function Bt(t){return yt.safeParse(t).success}function Gt(t){return xt.safeParse(t).success}function Ut(t){return bt.safeParse(t).success}function Ls(t){return kt.safeParse(t).success}function $s(t){return wt.safeParse(t).success}function Bs(t){return St.safeParse(t).success}function Gs(t){return Gt(t)||Ut(t)}function Vt(t,e){return!Ue(t)||t.id!==e||!("status"in t)}function Us(t){return Rt.safeParse(t).success}function Qt(t){return Mt.safeParse(t).success}function Vs(t){return Ct.safeParse(t).success}function zt(t){return Tt.safeParse(t).success}function Qs(t){return Et.safeParse(t).success}function zs(t){return At.safeParse(t).success}function Ds(t){return Nt.safeParse(t).success}function Fs(t){return Ot.safeParse(t).success}function Dt(t){if(t instanceof File||t instanceof Blob)return URL.createObjectURL(t);if(typeof t=="string"){if(/^data:/.test(t)){const r=t.match(/^data:([^;]+);base64,(.*)$/);if(r){const i=r[1],c=r[2],f=atob(c),h=new ArrayBuffer(f.length),v=new Uint8Array(h);for(let D=0;D<f.length;D++)v[D]=f.charCodeAt(D);const U=new Blob([h],{type:i});return URL.createObjectURL(U)}throw new Error("Invalid data URL format. Only base64 data URLs are supported.")}const e=atob(t),s=new ArrayBuffer(e.length),n=new Uint8Array(s);for(let r=0;r<e.length;r++)n[r]=e.charCodeAt(r);const a=new Blob([s]);return URL.createObjectURL(a)}if(t instanceof ArrayBuffer){const e=new Blob([t]);return URL.createObjectURL(e)}throw new Error("Unsupported content type for blobUrl")}function Ws(t,e,s,n){return{id:n??Ke(),name:t,mimeType:e,blobUrl:Dt(s)}}function Hs(t,e){let s=t.blobUrl;return e.content!==void 0&&(s=Dt(e.content)),{...t,...e,blobUrl:s}}var We;((We=Yt.env)==null?void 0:We.NODE_ENV)!=="test"&&Ft();function Ft(){window.addEventListener("message",Wt)}function Js(){window.removeEventListener("message",Wt)}async function Ys(t,e){await C({type:"qp-bridge",action:"setAnswer",question:t,answer:e})}async function Xs(t){return await vn({type:"qp-bridge",action:"getQuestion",question:t})}async function Ks(t,e){await C({type:"qp-bridge",action:"setQuestion",question:t,questionData:e})}async function en(t){return await _n({type:"qp-bridge",action:"getGroup",group:t})}async function tn(t,e){await C({type:"qp-bridge",action:"setGroup",group:t,groupData:e})}function sn(t){const e=s=>{It(s.data)&&t(s.data.question,s.data.answer)};return window.addEventListener("message",e),{cancelSubscription:()=>{window.removeEventListener("message",e)}}}async function nn(t){await C({type:"qp-bridge",action:"busyIndicatorStart"});try{return await t()}finally{await C({type:"qp-bridge",action:"busyIndicatorEnd"})}}async function an(){await C({type:"qp-bridge",action:"saveQuestionnaire"})}async function rn(){await C({type:"qp-bridge",action:"completeAndCloseQuestionnaire"})}async function cn(t){await C({type:"qp-bridge",action:"executeCustomCommand",commandName:t})}const ne=[],ae=[],re=[];function on(t){return re.includes(t)||re.push(t),{cancelSubscription:()=>{const e=re.indexOf(t);e!==-1&&re.splice(e,1)}}}function un(t){return ae.includes(t)||ae.push(t),{cancelSubscription:()=>{const e=ae.indexOf(t);e!==-1&&ae.splice(e,1)}}}function dn(t){return ne.includes(t)||ne.push(t),{cancelSubscription:()=>{const e=ne.indexOf(t);e!==-1&&ne.splice(e,1)}}}async function Wt(t){try{if(qt(t.data)&&ae.forEach(e=>e(t.data.commandName)),Zt(t.data)&&re.forEach(e=>e()),Bt(t.data)){const e=await Promise.all(ne.map(n=>n())),s={type:"qp-bridge",status:"success",id:t.data.id,canSave:e.every(n=>n)};window.parent.postMessage(s,"*")}}catch(e){const s={type:"qp-bridge",status:"error",id:Ue(t.data)?t.data.id:void 0,message:e instanceof Error?e.message:"Unknown error"};window.parent.postMessage(s,"*")}}async function ln(t){return await xn({type:"qp-bridge",action:"fetchEntities",fetchXml:t})}async function fn(t,e){return await bn({type:"qp-bridge",action:"getEntityById",entityName:t,entityId:e})}function hn(){return{isNew:!0}}async function mn(t){await C({type:"qp-bridge",action:"saveEntity",entity:t})}async function pn(t,e){await C({type:"qp-bridge",action:"repeatGroup",parentGroupName:t,groupIndex:e})}async function gn(t){await C({type:"qp-bridge",action:"addNewGroup",groupName:t})}async function yn(t,e){await C({type:"qp-bridge",action:"deleteGroup",parentGroupName:t,groupIndex:e})}async function ce(t,e){return new Promise((s,n)=>{const a=Ke(),r=i=>{if(Vt(i.data,a))return;const c=e(i.data);c.success?s(c.data):Pt(i.data)?n(new Error(i.data.message)):n(new Error("Unknown message received")),window.removeEventListener("message",r)};window.addEventListener("message",r),window.parent.postMessage({...t,id:a,featureVersion:nt},"*")})}async function vn(t){return ce(t,e=>Lt(e)?{success:!0,data:e.question}:{success:!1})}async function _n(t){return ce(t,e=>$t(e)?{success:!0,data:e.group}:{success:!1})}function C(t){return ce(t,e=>jt(e)?{success:!0,data:void 0}:{success:!1})}async function xn(t){return ce(t,e=>Qt(e)?{success:!0,data:e.entities}:{success:!1})}async function bn(t){return ce(t,e=>zt(e)?{success:!0,data:e.entity}:{success:!1})}exports.QP_BRIDGE_FEATURE_VERSION=nt;exports.addNewGroup=gn;exports.addNewGroupRequestMessageSchema=Nt;exports.busyIndicatorEndRequestMessageSchema=bt;exports.busyIndicatorStartRequestMessageSchema=xt;exports.canSaveRequestMessageSchema=yt;exports.canSaveSuccessResponseMessageSchema=gt;exports.commandExecutedMessageSchema=rt;exports.completeAndCloseQuestionnaire=rn;exports.completeAndCloseQuestionnaireRequestMessageSchema=wt;exports.createMediaItem=Ws;exports.createNewEntity=hn;exports.deleteGroup=yn;exports.deleteGroupRequestMessageSchema=Ot;exports.entitySchema=ye;exports.executeCustomCommand=cn;exports.executeCustomCommandRequestMessageSchema=St;exports.fetchEntities=ln;exports.fetchEntitiesRequestMessageSchema=Rt;exports.fetchEntitiesSuccessResponseMessageSchema=Mt;exports.getEntityById=fn;exports.getEntityByIdRequestMessageSchema=Ct;exports.getEntityByIdSuccessResponseMessageSchema=Tt;exports.getGroup=en;exports.getGroupRequestMessageSchema=mt;exports.getGroupSuccessResponseMessageSchema=pt;exports.getQuestion=Xs;exports.getQuestionRequestMessageSchema=lt;exports.getQuestionSuccessResponseMessageSchema=ft;exports.groupOptionalScheme=dt;exports.groupSchema=Ge;exports.initOnSaveMessageHandler=Ft;exports.isAddNewGroupRequestMessage=Ds;exports.isBusyIndicatorEndRequestMessage=Ut;exports.isBusyIndicatorStartRequestMessage=Gt;exports.isCanSaveRequestMessage=Bt;exports.isCanSaveSuccessResponseMessage=Ps;exports.isCommandExecutedMessage=qt;exports.isCompleteAndCloseQuestionnaireRequestMessage=$s;exports.isDeleteGroupRequestMessage=Fs;exports.isErrorMessage=Pt;exports.isExecuteCustomCommandRequestMessage=Bs;exports.isFetchEntitiesRequestMessage=Us;exports.isFetchEntitiesSuccessResponseMessage=Qt;exports.isGetEntityByIdRequestMessage=Vs;exports.isGetEntityByIdSuccessResponseMessage=zt;exports.isGetGroupRequestMessage=js;exports.isGetGroupSuccessResponseMessage=$t;exports.isGetQuestionRequestMessage=Os;exports.isGetQuestionSuccessResponseMessage=Lt;exports.isMediaItem=As;exports.isNotRelevantMessage=Vt;exports.isOnAnswerChangeMessage=It;exports.isQpBridgeMessage=Ue;exports.isQpBridgeRequestMessage=Ns;exports.isQuestionnaireLoadedMessage=Zt;exports.isRepeatGroupRequestMessage=zs;exports.isSaveEntityRequestMessage=Qs;exports.isSaveQuestionnaireRequestMessage=Ls;exports.isSetAnswerRequestMessage=Is;exports.isSetGroupRequestMessage=Zs;exports.isSetQuestionRequestMessage=qs;exports.isSuccessMessage=jt;exports.isWithBusyIndicatorRequestMessage=Gs;exports.mediaItemSchema=ut;exports.onAnswerChange=sn;exports.onAnswerChangeMessageSchema=at;exports.onCommandExecuted=un;exports.onQuestionnaireLoaded=on;exports.onSave=dn;exports.qpBridgeBaseMessageSchema=G;exports.qpBridgeRequestMessageSchema=S;exports.questionOptionalScheme=ot;exports.questionSchema=Be;exports.questionnaireLoadedMessageSchema=it;exports.removeOnSaveMessageHandler=Js;exports.repeatGroup=pn;exports.repeatGroupRequestMessageSchema=At;exports.responseErrorMessageSchema=ct;exports.responseSuccessMessageSchema=z;exports.saveEntity=mn;exports.saveEntityRequestMessageSchema=Et;exports.saveQuestionnaire=an;exports.saveQuestionnaireRequestMessageSchema=kt;exports.setAnswer=Ys;exports.setAnswerRequestMessageSchema=_t;exports.setGroup=tn;exports.setGroupRequestMessageSchema=vt;exports.setQuestion=Ks;exports.setQuestionRequestMessageSchema=ht;exports.updateMediaItem=Hs;exports.withBusyIndicator=nn;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var me={exports:{}},Ae;function Gt(){if(Ae)return me.exports;Ae=1;var t=me.exports={},e,s;function n(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?e=setTimeout:e=n}catch{e=n}try{typeof clearTimeout=="function"?s=clearTimeout:s=a}catch{s=a}})();function r(k){if(e===setTimeout)return setTimeout(k,0);if((e===n||!e)&&setTimeout)return e=setTimeout,setTimeout(k,0);try{return e(k,0)}catch{try{return e.call(null,k,0)}catch{return e.call(this,k,0)}}}function i(k){if(s===clearTimeout)return clearTimeout(k);if((s===a||!s)&&clearTimeout)return s=clearTimeout,clearTimeout(k);try{return s(k)}catch{try{return s.call(null,k)}catch{return s.call(this,k)}}}var o=[],d=!1,l,y=-1;function O(){!d||!l||(d=!1,l.length?o=l.concat(o):y=-1,o.length&&I())}function I(){if(!d){var k=r(O);d=!0;for(var E=o.length;E;){for(l=o,o=[];++y<E;)l&&l[y].run();y=-1,E=o.length}l=null,d=!1,i(k)}}t.nextTick=function(k){var E=new Array(arguments.length-1);if(arguments.length>1)for(var V=1;V<arguments.length;V++)E[V-1]=arguments[V];o.push(new Ee(k,E)),o.length===1&&!d&&r(I)};function Ee(k,E){this.fun=k,this.array=E}Ee.prototype.run=function(){this.fun.apply(null,this.array)},t.title="browser",t.browser=!0,t.env={},t.argv=[],t.version="",t.versions={};function q(){}return t.on=q,t.addListener=q,t.once=q,t.off=q,t.removeListener=q,t.removeAllListeners=q,t.emit=q,t.prependListener=q,t.prependOnceListener=q,t.listeners=function(k){return[]},t.binding=function(k){throw new Error("process.binding is not supported")},t.cwd=function(){return"/"},t.chdir=function(k){throw new Error("process.chdir is not supported")},t.umask=function(){return 0},me.exports}var Ut=Gt();let ae;const Vt=new Uint8Array(16);function Qt(){if(!ae&&(ae=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!ae))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ae(Vt)}const R=[];for(let t=0;t<256;++t)R.push((t+256).toString(16).slice(1));function Dt(t,e=0){return R[t[e+0]]+R[t[e+1]]+R[t[e+2]]+R[t[e+3]]+"-"+R[t[e+4]]+R[t[e+5]]+"-"+R[t[e+6]]+R[t[e+7]]+"-"+R[t[e+8]]+R[t[e+9]]+"-"+R[t[e+10]]+R[t[e+11]]+R[t[e+12]]+R[t[e+13]]+R[t[e+14]]+R[t[e+15]]}const zt=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Ne={randomUUID:zt};function De(t,e,s){if(Ne.randomUUID&&!t)return Ne.randomUUID();t=t||{};const n=t.random||(t.rng||Qt)();return n[6]=n[6]&15|64,n[8]=n[8]&63|128,Dt(n)}var _;(function(t){t.assertEqual=a=>{};function e(a){}t.assertIs=e;function s(a){throw new Error}t.assertNever=s,t.arrayToEnum=a=>{const r={};for(const i of a)r[i]=i;return r},t.getValidEnumValues=a=>{const r=t.objectKeys(a).filter(o=>typeof a[a[o]]!="number"),i={};for(const o of r)i[o]=a[o];return t.objectValues(i)},t.objectValues=a=>t.objectKeys(a).map(function(r){return a[r]}),t.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{const r=[];for(const i in a)Object.prototype.hasOwnProperty.call(a,i)&&r.push(i);return r},t.find=(a,r)=>{for(const i of a)if(r(i))return i},t.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function n(a,r=" | "){return a.map(i=>typeof i=="string"?`'${i}'`:i).join(r)}t.joinValues=n,t.jsonStringifyReplacer=(a,r)=>typeof r=="bigint"?r.toString():r})(_||(_={}));var Oe;(function(t){t.mergeShapes=(e,s)=>({...e,...s})})(Oe||(Oe={}));const f=_.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),P=t=>{switch(typeof t){case"undefined":return f.undefined;case"string":return f.string;case"number":return Number.isNaN(t)?f.nan:f.number;case"boolean":return f.boolean;case"function":return f.function;case"bigint":return f.bigint;case"symbol":return f.symbol;case"object":return Array.isArray(t)?f.array:t===null?f.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?f.promise:typeof Map<"u"&&t instanceof Map?f.map:typeof Set<"u"&&t instanceof Set?f.set:typeof Date<"u"&&t instanceof Date?f.date:f.object;default:return f.unknown}},c=_.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class j extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const s=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,s):this.__proto__=s,this.name="ZodError",this.issues=e}format(e){const s=e||function(r){return r.message},n={_errors:[]},a=r=>{for(const i of r.issues)if(i.code==="invalid_union")i.unionErrors.map(a);else if(i.code==="invalid_return_type")a(i.returnTypeError);else if(i.code==="invalid_arguments")a(i.argumentsError);else if(i.path.length===0)n._errors.push(s(i));else{let o=n,d=0;for(;d<i.path.length;){const l=i.path[d];d===i.path.length-1?(o[l]=o[l]||{_errors:[]},o[l]._errors.push(s(i))):o[l]=o[l]||{_errors:[]},o=o[l],d++}}};return a(this),n}static assert(e){if(!(e instanceof j))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,_.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=s=>s.message){const s={},n=[];for(const a of this.issues)if(a.path.length>0){const r=a.path[0];s[r]=s[r]||[],s[r].push(e(a))}else n.push(e(a));return{formErrors:n,fieldErrors:s}}get formErrors(){return this.flatten()}}j.create=t=>new j(t);const ge=(t,e)=>{let s;switch(t.code){case c.invalid_type:t.received===f.undefined?s="Required":s=`Expected ${t.expected}, received ${t.received}`;break;case c.invalid_literal:s=`Invalid literal value, expected ${JSON.stringify(t.expected,_.jsonStringifyReplacer)}`;break;case c.unrecognized_keys:s=`Unrecognized key(s) in object: ${_.joinValues(t.keys,", ")}`;break;case c.invalid_union:s="Invalid input";break;case c.invalid_union_discriminator:s=`Invalid discriminator value. Expected ${_.joinValues(t.options)}`;break;case c.invalid_enum_value:s=`Invalid enum value. Expected ${_.joinValues(t.options)}, received '${t.received}'`;break;case c.invalid_arguments:s="Invalid function arguments";break;case c.invalid_return_type:s="Invalid function return type";break;case c.invalid_date:s="Invalid date";break;case c.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(s=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(s=`${s} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?s=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?s=`Invalid input: must end with "${t.validation.endsWith}"`:_.assertNever(t.validation):t.validation!=="regex"?s=`Invalid ${t.validation}`:s="Invalid";break;case c.too_small:t.type==="array"?s=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?s=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?s=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?s=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?s=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:s="Invalid input";break;case c.too_big:t.type==="array"?s=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?s=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?s=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?s=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?s=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:s="Invalid input";break;case c.custom:s="Invalid input";break;case c.invalid_intersection_types:s="Intersection results could not be merged";break;case c.not_multiple_of:s=`Number must be a multiple of ${t.multipleOf}`;break;case c.not_finite:s="Number must be finite";break;default:s=e.defaultError,_.assertNever(t)}return{message:s}};let Ft=ge;function Wt(){return Ft}const Ht=t=>{const{data:e,path:s,errorMaps:n,issueData:a}=t,r=[...s,...a.path||[]],i={...a,path:r};if(a.message!==void 0)return{...a,path:r,message:a.message};let o="";const d=n.filter(l=>!!l).slice().reverse();for(const l of d)o=l(i,{data:e,defaultError:o}).message;return{...a,path:r,message:o}};function u(t,e){const s=Wt(),n=Ht({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,s,s===ge?void 0:ge].filter(a=>!!a)});t.common.issues.push(n)}class M{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,s){const n=[];for(const a of s){if(a.status==="aborted")return p;a.status==="dirty"&&e.dirty(),n.push(a.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,s){const n=[];for(const a of s){const r=await a.key,i=await a.value;n.push({key:r,value:i})}return M.mergeObjectSync(e,n)}static mergeObjectSync(e,s){const n={};for(const a of s){const{key:r,value:i}=a;if(r.status==="aborted"||i.status==="aborted")return p;r.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),r.value!=="__proto__"&&(typeof i.value<"u"||a.alwaysSet)&&(n[r.value]=i.value)}return{status:e.value,value:n}}}const p=Object.freeze({status:"aborted"}),Y=t=>({status:"dirty",value:t}),T=t=>({status:"valid",value:t}),Ie=t=>t.status==="aborted",qe=t=>t.status==="dirty",z=t=>t.status==="valid",re=t=>typeof Promise<"u"&&t instanceof Promise;var h;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(h||(h={}));class N{constructor(e,s,n,a){this._cachedPath=[],this.parent=e,this.data=s,this._path=n,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Ze=(t,e)=>{if(z(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const s=new j(t.common.issues);return this._error=s,this._error}}};function g(t){if(!t)return{};const{errorMap:e,invalid_type_error:s,required_error:n,description:a}=t;if(e&&(s||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:(i,o)=>{const{message:d}=t;return i.code==="invalid_enum_value"?{message:d??o.defaultError}:typeof o.data>"u"?{message:d??n??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:d??s??o.defaultError}},description:a}}class v{get description(){return this._def.description}_getType(e){return P(e.data)}_getOrReturnCtx(e,s){return s||{common:e.parent.common,data:e.data,parsedType:P(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new M,ctx:{common:e.parent.common,data:e.data,parsedType:P(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const s=this._parse(e);if(re(s))throw new Error("Synchronous parse encountered promise.");return s}_parseAsync(e){const s=this._parse(e);return Promise.resolve(s)}parse(e,s){const n=this.safeParse(e,s);if(n.success)return n.data;throw n.error}safeParse(e,s){const n={common:{issues:[],async:s?.async??!1,contextualErrorMap:s?.errorMap},path:s?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:P(e)},a=this._parseSync({data:e,path:n.path,parent:n});return Ze(n,a)}"~validate"(e){const s={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:P(e)};if(!this["~standard"].async)try{const n=this._parseSync({data:e,path:[],parent:s});return z(n)?{value:n.value}:{issues:s.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),s.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:s}).then(n=>z(n)?{value:n.value}:{issues:s.common.issues})}async parseAsync(e,s){const n=await this.safeParseAsync(e,s);if(n.success)return n.data;throw n.error}async safeParseAsync(e,s){const n={common:{issues:[],contextualErrorMap:s?.errorMap,async:!0},path:s?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:P(e)},a=this._parse({data:e,path:n.path,parent:n}),r=await(re(a)?a:Promise.resolve(a));return Ze(n,r)}refine(e,s){const n=a=>typeof s=="string"||typeof s>"u"?{message:s}:typeof s=="function"?s(a):s;return this._refinement((a,r)=>{const i=e(a),o=()=>r.addIssue({code:c.custom,...n(a)});return typeof Promise<"u"&&i instanceof Promise?i.then(d=>d?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,s){return this._refinement((n,a)=>e(n)?!0:(a.addIssue(typeof s=="function"?s(n,a):s),!1))}_refinement(e){return new H({schema:this,typeName:m.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:s=>this["~validate"](s)}}optional(){return L.create(this,this._def)}nullable(){return J.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return A.create(this)}promise(){return de.create(this,this._def)}or(e){return oe.create([this,e],this._def)}and(e){return ce.create(this,e,this._def)}transform(e){return new H({...g(this._def),schema:this,typeName:m.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const s=typeof e=="function"?e:()=>e;return new be({...g(this._def),innerType:this,defaultValue:s,typeName:m.ZodDefault})}brand(){return new vs({typeName:m.ZodBranded,type:this,...g(this._def)})}catch(e){const s=typeof e=="function"?e:()=>e;return new ke({...g(this._def),innerType:this,catchValue:s,typeName:m.ZodCatch})}describe(e){const s=this.constructor;return new s({...this._def,description:e})}pipe(e){return Se.create(this,e)}readonly(){return we.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Jt=/^c[^\s-]{8,}$/i,Yt=/^[0-9a-z]+$/,Xt=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Kt=/^[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,es=/^[a-z0-9_-]{21}$/i,ts=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,ss=/^[-+]?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)?)??$/,ns=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,as="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let pe;const rs=/^(?:(?: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])$/,is=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,os=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,cs=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,us=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ds=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ze="((\\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])))",ls=new RegExp(`^${ze}$`);function Fe(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);const s=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${s}`}function fs(t){return new RegExp(`^${Fe(t)}$`)}function hs(t){let e=`${ze}T${Fe(t)}`;const s=[];return s.push(t.local?"Z?":"Z"),t.offset&&s.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${s.join("|")})`,new RegExp(`^${e}$`)}function ms(t,e){return!!((e==="v4"||!e)&&rs.test(t)||(e==="v6"||!e)&&os.test(t))}function ps(t,e){if(!ts.test(t))return!1;try{const[s]=t.split(".");if(!s)return!1;const n=s.replace(/-/g,"+").replace(/_/g,"/").padEnd(s.length+(4-s.length%4)%4,"="),a=JSON.parse(atob(n));return!(typeof a!="object"||a===null||"typ"in a&&a?.typ!=="JWT"||!a.alg||e&&a.alg!==e)}catch{return!1}}function gs(t,e){return!!((e==="v4"||!e)&&is.test(t)||(e==="v6"||!e)&&cs.test(t))}class Z extends v{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==f.string){const r=this._getOrReturnCtx(e);return u(r,{code:c.invalid_type,expected:f.string,received:r.parsedType}),p}const n=new M;let a;for(const r of this._def.checks)if(r.kind==="min")e.data.length<r.value&&(a=this._getOrReturnCtx(e,a),u(a,{code:c.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),n.dirty());else if(r.kind==="max")e.data.length>r.value&&(a=this._getOrReturnCtx(e,a),u(a,{code:c.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),n.dirty());else if(r.kind==="length"){const i=e.data.length>r.value,o=e.data.length<r.value;(i||o)&&(a=this._getOrReturnCtx(e,a),i?u(a,{code:c.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}):o&&u(a,{code:c.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}),n.dirty())}else if(r.kind==="email")ns.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"email",code:c.invalid_string,message:r.message}),n.dirty());else if(r.kind==="emoji")pe||(pe=new RegExp(as,"u")),pe.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"emoji",code:c.invalid_string,message:r.message}),n.dirty());else if(r.kind==="uuid")Kt.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"uuid",code:c.invalid_string,message:r.message}),n.dirty());else if(r.kind==="nanoid")es.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"nanoid",code:c.invalid_string,message:r.message}),n.dirty());else if(r.kind==="cuid")Jt.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"cuid",code:c.invalid_string,message:r.message}),n.dirty());else if(r.kind==="cuid2")Yt.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"cuid2",code:c.invalid_string,message:r.message}),n.dirty());else if(r.kind==="ulid")Xt.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"ulid",code:c.invalid_string,message:r.message}),n.dirty());else if(r.kind==="url")try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),u(a,{validation:"url",code:c.invalid_string,message:r.message}),n.dirty()}else r.kind==="regex"?(r.regex.lastIndex=0,r.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"regex",code:c.invalid_string,message:r.message}),n.dirty())):r.kind==="trim"?e.data=e.data.trim():r.kind==="includes"?e.data.includes(r.value,r.position)||(a=this._getOrReturnCtx(e,a),u(a,{code:c.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),n.dirty()):r.kind==="toLowerCase"?e.data=e.data.toLowerCase():r.kind==="toUpperCase"?e.data=e.data.toUpperCase():r.kind==="startsWith"?e.data.startsWith(r.value)||(a=this._getOrReturnCtx(e,a),u(a,{code:c.invalid_string,validation:{startsWith:r.value},message:r.message}),n.dirty()):r.kind==="endsWith"?e.data.endsWith(r.value)||(a=this._getOrReturnCtx(e,a),u(a,{code:c.invalid_string,validation:{endsWith:r.value},message:r.message}),n.dirty()):r.kind==="datetime"?hs(r).test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{code:c.invalid_string,validation:"datetime",message:r.message}),n.dirty()):r.kind==="date"?ls.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{code:c.invalid_string,validation:"date",message:r.message}),n.dirty()):r.kind==="time"?fs(r).test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{code:c.invalid_string,validation:"time",message:r.message}),n.dirty()):r.kind==="duration"?ss.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"duration",code:c.invalid_string,message:r.message}),n.dirty()):r.kind==="ip"?ms(e.data,r.version)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"ip",code:c.invalid_string,message:r.message}),n.dirty()):r.kind==="jwt"?ps(e.data,r.alg)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"jwt",code:c.invalid_string,message:r.message}),n.dirty()):r.kind==="cidr"?gs(e.data,r.version)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"cidr",code:c.invalid_string,message:r.message}),n.dirty()):r.kind==="base64"?us.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"base64",code:c.invalid_string,message:r.message}),n.dirty()):r.kind==="base64url"?ds.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"base64url",code:c.invalid_string,message:r.message}),n.dirty()):_.assertNever(r);return{status:n.value,value:e.data}}_regex(e,s,n){return this.refinement(a=>e.test(a),{validation:s,code:c.invalid_string,...h.errToObj(n)})}_addCheck(e){return new Z({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...h.errToObj(e)})}url(e){return this._addCheck({kind:"url",...h.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...h.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...h.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...h.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...h.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...h.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...h.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...h.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...h.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...h.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...h.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...h.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...h.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...h.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...h.errToObj(e)})}regex(e,s){return this._addCheck({kind:"regex",regex:e,...h.errToObj(s)})}includes(e,s){return this._addCheck({kind:"includes",value:e,position:s?.position,...h.errToObj(s?.message)})}startsWith(e,s){return this._addCheck({kind:"startsWith",value:e,...h.errToObj(s)})}endsWith(e,s){return this._addCheck({kind:"endsWith",value:e,...h.errToObj(s)})}min(e,s){return this._addCheck({kind:"min",value:e,...h.errToObj(s)})}max(e,s){return this._addCheck({kind:"max",value:e,...h.errToObj(s)})}length(e,s){return this._addCheck({kind:"length",value:e,...h.errToObj(s)})}nonempty(e){return this.min(1,h.errToObj(e))}trim(){return new Z({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Z({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Z({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const s of this._def.checks)s.kind==="min"&&(e===null||s.value>e)&&(e=s.value);return e}get maxLength(){let e=null;for(const s of this._def.checks)s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);return e}}Z.create=t=>new Z({checks:[],typeName:m.ZodString,coerce:t?.coerce??!1,...g(t)});function ys(t,e){const s=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,a=s>n?s:n,r=Number.parseInt(t.toFixed(a).replace(".","")),i=Number.parseInt(e.toFixed(a).replace(".",""));return r%i/10**a}class F extends v{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==f.number){const r=this._getOrReturnCtx(e);return u(r,{code:c.invalid_type,expected:f.number,received:r.parsedType}),p}let n;const a=new M;for(const r of this._def.checks)r.kind==="int"?_.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{code:c.invalid_type,expected:"integer",received:"float",message:r.message}),a.dirty()):r.kind==="min"?(r.inclusive?e.data<r.value:e.data<=r.value)&&(n=this._getOrReturnCtx(e,n),u(n,{code:c.too_small,minimum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),a.dirty()):r.kind==="max"?(r.inclusive?e.data>r.value:e.data>=r.value)&&(n=this._getOrReturnCtx(e,n),u(n,{code:c.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),a.dirty()):r.kind==="multipleOf"?ys(e.data,r.value)!==0&&(n=this._getOrReturnCtx(e,n),u(n,{code:c.not_multiple_of,multipleOf:r.value,message:r.message}),a.dirty()):r.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{code:c.not_finite,message:r.message}),a.dirty()):_.assertNever(r);return{status:a.value,value:e.data}}gte(e,s){return this.setLimit("min",e,!0,h.toString(s))}gt(e,s){return this.setLimit("min",e,!1,h.toString(s))}lte(e,s){return this.setLimit("max",e,!0,h.toString(s))}lt(e,s){return this.setLimit("max",e,!1,h.toString(s))}setLimit(e,s,n,a){return new F({...this._def,checks:[...this._def.checks,{kind:e,value:s,inclusive:n,message:h.toString(a)}]})}_addCheck(e){return new F({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:h.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:h.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:h.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:h.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:h.toString(e)})}multipleOf(e,s){return this._addCheck({kind:"multipleOf",value:e,message:h.toString(s)})}finite(e){return this._addCheck({kind:"finite",message:h.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:h.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:h.toString(e)})}get minValue(){let e=null;for(const s of this._def.checks)s.kind==="min"&&(e===null||s.value>e)&&(e=s.value);return e}get maxValue(){let e=null;for(const s of this._def.checks)s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&_.isInteger(e.value))}get isFinite(){let e=null,s=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(s===null||n.value>s)&&(s=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(s)&&Number.isFinite(e)}}F.create=t=>new F({checks:[],typeName:m.ZodNumber,coerce:t?.coerce||!1,...g(t)});class te extends v{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==f.bigint)return this._getInvalidInput(e);let n;const a=new M;for(const r of this._def.checks)r.kind==="min"?(r.inclusive?e.data<r.value:e.data<=r.value)&&(n=this._getOrReturnCtx(e,n),u(n,{code:c.too_small,type:"bigint",minimum:r.value,inclusive:r.inclusive,message:r.message}),a.dirty()):r.kind==="max"?(r.inclusive?e.data>r.value:e.data>=r.value)&&(n=this._getOrReturnCtx(e,n),u(n,{code:c.too_big,type:"bigint",maximum:r.value,inclusive:r.inclusive,message:r.message}),a.dirty()):r.kind==="multipleOf"?e.data%r.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),u(n,{code:c.not_multiple_of,multipleOf:r.value,message:r.message}),a.dirty()):_.assertNever(r);return{status:a.value,value:e.data}}_getInvalidInput(e){const s=this._getOrReturnCtx(e);return u(s,{code:c.invalid_type,expected:f.bigint,received:s.parsedType}),p}gte(e,s){return this.setLimit("min",e,!0,h.toString(s))}gt(e,s){return this.setLimit("min",e,!1,h.toString(s))}lte(e,s){return this.setLimit("max",e,!0,h.toString(s))}lt(e,s){return this.setLimit("max",e,!1,h.toString(s))}setLimit(e,s,n,a){return new te({...this._def,checks:[...this._def.checks,{kind:e,value:s,inclusive:n,message:h.toString(a)}]})}_addCheck(e){return new te({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:h.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:h.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:h.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:h.toString(e)})}multipleOf(e,s){return this._addCheck({kind:"multipleOf",value:e,message:h.toString(s)})}get minValue(){let e=null;for(const s of this._def.checks)s.kind==="min"&&(e===null||s.value>e)&&(e=s.value);return e}get maxValue(){let e=null;for(const s of this._def.checks)s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);return e}}te.create=t=>new te({checks:[],typeName:m.ZodBigInt,coerce:t?.coerce??!1,...g(t)});class ye extends v{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==f.boolean){const n=this._getOrReturnCtx(e);return u(n,{code:c.invalid_type,expected:f.boolean,received:n.parsedType}),p}return T(e.data)}}ye.create=t=>new ye({typeName:m.ZodBoolean,coerce:t?.coerce||!1,...g(t)});class ie extends v{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==f.date){const r=this._getOrReturnCtx(e);return u(r,{code:c.invalid_type,expected:f.date,received:r.parsedType}),p}if(Number.isNaN(e.data.getTime())){const r=this._getOrReturnCtx(e);return u(r,{code:c.invalid_date}),p}const n=new M;let a;for(const r of this._def.checks)r.kind==="min"?e.data.getTime()<r.value&&(a=this._getOrReturnCtx(e,a),u(a,{code:c.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:"date"}),n.dirty()):r.kind==="max"?e.data.getTime()>r.value&&(a=this._getOrReturnCtx(e,a),u(a,{code:c.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),n.dirty()):_.assertNever(r);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new ie({...this._def,checks:[...this._def.checks,e]})}min(e,s){return this._addCheck({kind:"min",value:e.getTime(),message:h.toString(s)})}max(e,s){return this._addCheck({kind:"max",value:e.getTime(),message:h.toString(s)})}get minDate(){let e=null;for(const s of this._def.checks)s.kind==="min"&&(e===null||s.value>e)&&(e=s.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const s of this._def.checks)s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);return e!=null?new Date(e):null}}ie.create=t=>new ie({checks:[],coerce:t?.coerce||!1,typeName:m.ZodDate,...g(t)});class je extends v{_parse(e){if(this._getType(e)!==f.symbol){const n=this._getOrReturnCtx(e);return u(n,{code:c.invalid_type,expected:f.symbol,received:n.parsedType}),p}return T(e.data)}}je.create=t=>new je({typeName:m.ZodSymbol,...g(t)});class Pe extends v{_parse(e){if(this._getType(e)!==f.undefined){const n=this._getOrReturnCtx(e);return u(n,{code:c.invalid_type,expected:f.undefined,received:n.parsedType}),p}return T(e.data)}}Pe.create=t=>new Pe({typeName:m.ZodUndefined,...g(t)});class Le extends v{_parse(e){if(this._getType(e)!==f.null){const n=this._getOrReturnCtx(e);return u(n,{code:c.invalid_type,expected:f.null,received:n.parsedType}),p}return T(e.data)}}Le.create=t=>new Le({typeName:m.ZodNull,...g(t)});class $e extends v{constructor(){super(...arguments),this._any=!0}_parse(e){return T(e.data)}}$e.create=t=>new $e({typeName:m.ZodAny,...g(t)});class ve extends v{constructor(){super(...arguments),this._unknown=!0}_parse(e){return T(e.data)}}ve.create=t=>new ve({typeName:m.ZodUnknown,...g(t)});class $ extends v{_parse(e){const s=this._getOrReturnCtx(e);return u(s,{code:c.invalid_type,expected:f.never,received:s.parsedType}),p}}$.create=t=>new $({typeName:m.ZodNever,...g(t)});class Be extends v{_parse(e){if(this._getType(e)!==f.undefined){const n=this._getOrReturnCtx(e);return u(n,{code:c.invalid_type,expected:f.void,received:n.parsedType}),p}return T(e.data)}}Be.create=t=>new Be({typeName:m.ZodVoid,...g(t)});class A extends v{_parse(e){const{ctx:s,status:n}=this._processInputParams(e),a=this._def;if(s.parsedType!==f.array)return u(s,{code:c.invalid_type,expected:f.array,received:s.parsedType}),p;if(a.exactLength!==null){const i=s.data.length>a.exactLength.value,o=s.data.length<a.exactLength.value;(i||o)&&(u(s,{code:i?c.too_big:c.too_small,minimum:o?a.exactLength.value:void 0,maximum:i?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),n.dirty())}if(a.minLength!==null&&s.data.length<a.minLength.value&&(u(s,{code:c.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),n.dirty()),a.maxLength!==null&&s.data.length>a.maxLength.value&&(u(s,{code:c.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),n.dirty()),s.common.async)return Promise.all([...s.data].map((i,o)=>a.type._parseAsync(new N(s,i,s.path,o)))).then(i=>M.mergeArray(n,i));const r=[...s.data].map((i,o)=>a.type._parseSync(new N(s,i,s.path,o)));return M.mergeArray(n,r)}get element(){return this._def.type}min(e,s){return new A({...this._def,minLength:{value:e,message:h.toString(s)}})}max(e,s){return new A({...this._def,maxLength:{value:e,message:h.toString(s)}})}length(e,s){return new A({...this._def,exactLength:{value:e,message:h.toString(s)}})}nonempty(e){return this.min(1,e)}}A.create=(t,e)=>new A({type:t,minLength:null,maxLength:null,exactLength:null,typeName:m.ZodArray,...g(e)});function Q(t){if(t instanceof w){const e={};for(const s in t.shape){const n=t.shape[s];e[s]=L.create(Q(n))}return new w({...t._def,shape:()=>e})}else return t instanceof A?new A({...t._def,type:Q(t.element)}):t instanceof L?L.create(Q(t.unwrap())):t instanceof J?J.create(Q(t.unwrap())):t instanceof G?G.create(t.items.map(e=>Q(e))):t}class w extends v{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),s=_.objectKeys(e);return this._cached={shape:e,keys:s},this._cached}_parse(e){if(this._getType(e)!==f.object){const l=this._getOrReturnCtx(e);return u(l,{code:c.invalid_type,expected:f.object,received:l.parsedType}),p}const{status:n,ctx:a}=this._processInputParams(e),{shape:r,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof $&&this._def.unknownKeys==="strip"))for(const l in a.data)i.includes(l)||o.push(l);const d=[];for(const l of i){const y=r[l],O=a.data[l];d.push({key:{status:"valid",value:l},value:y._parse(new N(a,O,a.path,l)),alwaysSet:l in a.data})}if(this._def.catchall instanceof $){const l=this._def.unknownKeys;if(l==="passthrough")for(const y of o)d.push({key:{status:"valid",value:y},value:{status:"valid",value:a.data[y]}});else if(l==="strict")o.length>0&&(u(a,{code:c.unrecognized_keys,keys:o}),n.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const l=this._def.catchall;for(const y of o){const O=a.data[y];d.push({key:{status:"valid",value:y},value:l._parse(new N(a,O,a.path,y)),alwaysSet:y in a.data})}}return a.common.async?Promise.resolve().then(async()=>{const l=[];for(const y of d){const O=await y.key,I=await y.value;l.push({key:O,value:I,alwaysSet:y.alwaysSet})}return l}).then(l=>M.mergeObjectSync(n,l)):M.mergeObjectSync(n,d)}get shape(){return this._def.shape()}strict(e){return h.errToObj,new w({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(s,n)=>{const a=this._def.errorMap?.(s,n).message??n.defaultError;return s.code==="unrecognized_keys"?{message:h.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new w({...this._def,unknownKeys:"strip"})}passthrough(){return new w({...this._def,unknownKeys:"passthrough"})}extend(e){return new w({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new w({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:m.ZodObject})}setKey(e,s){return this.augment({[e]:s})}catchall(e){return new w({...this._def,catchall:e})}pick(e){const s={};for(const n of _.objectKeys(e))e[n]&&this.shape[n]&&(s[n]=this.shape[n]);return new w({...this._def,shape:()=>s})}omit(e){const s={};for(const n of _.objectKeys(this.shape))e[n]||(s[n]=this.shape[n]);return new w({...this._def,shape:()=>s})}deepPartial(){return Q(this)}partial(e){const s={};for(const n of _.objectKeys(this.shape)){const a=this.shape[n];e&&!e[n]?s[n]=a:s[n]=a.optional()}return new w({...this._def,shape:()=>s})}required(e){const s={};for(const n of _.objectKeys(this.shape))if(e&&!e[n])s[n]=this.shape[n];else{let r=this.shape[n];for(;r instanceof L;)r=r._def.innerType;s[n]=r}return new w({...this._def,shape:()=>s})}keyof(){return We(_.objectKeys(this.shape))}}w.create=(t,e)=>new w({shape:()=>t,unknownKeys:"strip",catchall:$.create(),typeName:m.ZodObject,...g(e)});w.strictCreate=(t,e)=>new w({shape:()=>t,unknownKeys:"strict",catchall:$.create(),typeName:m.ZodObject,...g(e)});w.lazycreate=(t,e)=>new w({shape:t,unknownKeys:"strip",catchall:$.create(),typeName:m.ZodObject,...g(e)});class oe extends v{_parse(e){const{ctx:s}=this._processInputParams(e),n=this._def.options;function a(r){for(const o of r)if(o.result.status==="valid")return o.result;for(const o of r)if(o.result.status==="dirty")return s.common.issues.push(...o.ctx.common.issues),o.result;const i=r.map(o=>new j(o.ctx.common.issues));return u(s,{code:c.invalid_union,unionErrors:i}),p}if(s.common.async)return Promise.all(n.map(async r=>{const i={...s,common:{...s.common,issues:[]},parent:null};return{result:await r._parseAsync({data:s.data,path:s.path,parent:i}),ctx:i}})).then(a);{let r;const i=[];for(const d of n){const l={...s,common:{...s.common,issues:[]},parent:null},y=d._parseSync({data:s.data,path:s.path,parent:l});if(y.status==="valid")return y;y.status==="dirty"&&!r&&(r={result:y,ctx:l}),l.common.issues.length&&i.push(l.common.issues)}if(r)return s.common.issues.push(...r.ctx.common.issues),r.result;const o=i.map(d=>new j(d));return u(s,{code:c.invalid_union,unionErrors:o}),p}}get options(){return this._def.options}}oe.create=(t,e)=>new oe({options:t,typeName:m.ZodUnion,...g(e)});function _e(t,e){const s=P(t),n=P(e);if(t===e)return{valid:!0,data:t};if(s===f.object&&n===f.object){const a=_.objectKeys(e),r=_.objectKeys(t).filter(o=>a.indexOf(o)!==-1),i={...t,...e};for(const o of r){const d=_e(t[o],e[o]);if(!d.valid)return{valid:!1};i[o]=d.data}return{valid:!0,data:i}}else if(s===f.array&&n===f.array){if(t.length!==e.length)return{valid:!1};const a=[];for(let r=0;r<t.length;r++){const i=t[r],o=e[r],d=_e(i,o);if(!d.valid)return{valid:!1};a.push(d.data)}return{valid:!0,data:a}}else return s===f.date&&n===f.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class ce extends v{_parse(e){const{status:s,ctx:n}=this._processInputParams(e),a=(r,i)=>{if(Ie(r)||Ie(i))return p;const o=_e(r.value,i.value);return o.valid?((qe(r)||qe(i))&&s.dirty(),{status:s.value,value:o.data}):(u(n,{code:c.invalid_intersection_types}),p)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([r,i])=>a(r,i)):a(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}ce.create=(t,e,s)=>new ce({left:t,right:e,typeName:m.ZodIntersection,...g(s)});class G extends v{_parse(e){const{status:s,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.array)return u(n,{code:c.invalid_type,expected:f.array,received:n.parsedType}),p;if(n.data.length<this._def.items.length)return u(n,{code:c.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),p;!this._def.rest&&n.data.length>this._def.items.length&&(u(n,{code:c.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),s.dirty());const r=[...n.data].map((i,o)=>{const d=this._def.items[o]||this._def.rest;return d?d._parse(new N(n,i,n.path,o)):null}).filter(i=>!!i);return n.common.async?Promise.all(r).then(i=>M.mergeArray(s,i)):M.mergeArray(s,r)}get items(){return this._def.items}rest(e){return new G({...this._def,rest:e})}}G.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new G({items:t,typeName:m.ZodTuple,rest:null,...g(e)})};class ue extends v{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:s,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.object)return u(n,{code:c.invalid_type,expected:f.object,received:n.parsedType}),p;const a=[],r=this._def.keyType,i=this._def.valueType;for(const o in n.data)a.push({key:r._parse(new N(n,o,n.path,o)),value:i._parse(new N(n,n.data[o],n.path,o)),alwaysSet:o in n.data});return n.common.async?M.mergeObjectAsync(s,a):M.mergeObjectSync(s,a)}get element(){return this._def.valueType}static create(e,s,n){return s instanceof v?new ue({keyType:e,valueType:s,typeName:m.ZodRecord,...g(n)}):new ue({keyType:Z.create(),valueType:e,typeName:m.ZodRecord,...g(s)})}}class Ge extends v{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:s,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.map)return u(n,{code:c.invalid_type,expected:f.map,received:n.parsedType}),p;const a=this._def.keyType,r=this._def.valueType,i=[...n.data.entries()].map(([o,d],l)=>({key:a._parse(new N(n,o,n.path,[l,"key"])),value:r._parse(new N(n,d,n.path,[l,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const d of i){const l=await d.key,y=await d.value;if(l.status==="aborted"||y.status==="aborted")return p;(l.status==="dirty"||y.status==="dirty")&&s.dirty(),o.set(l.value,y.value)}return{status:s.value,value:o}})}else{const o=new Map;for(const d of i){const l=d.key,y=d.value;if(l.status==="aborted"||y.status==="aborted")return p;(l.status==="dirty"||y.status==="dirty")&&s.dirty(),o.set(l.value,y.value)}return{status:s.value,value:o}}}}Ge.create=(t,e,s)=>new Ge({valueType:e,keyType:t,typeName:m.ZodMap,...g(s)});class se extends v{_parse(e){const{status:s,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.set)return u(n,{code:c.invalid_type,expected:f.set,received:n.parsedType}),p;const a=this._def;a.minSize!==null&&n.data.size<a.minSize.value&&(u(n,{code:c.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),s.dirty()),a.maxSize!==null&&n.data.size>a.maxSize.value&&(u(n,{code:c.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),s.dirty());const r=this._def.valueType;function i(d){const l=new Set;for(const y of d){if(y.status==="aborted")return p;y.status==="dirty"&&s.dirty(),l.add(y.value)}return{status:s.value,value:l}}const o=[...n.data.values()].map((d,l)=>r._parse(new N(n,d,n.path,l)));return n.common.async?Promise.all(o).then(d=>i(d)):i(o)}min(e,s){return new se({...this._def,minSize:{value:e,message:h.toString(s)}})}max(e,s){return new se({...this._def,maxSize:{value:e,message:h.toString(s)}})}size(e,s){return this.min(e,s).max(e,s)}nonempty(e){return this.min(1,e)}}se.create=(t,e)=>new se({valueType:t,minSize:null,maxSize:null,typeName:m.ZodSet,...g(e)});class Ue extends v{get schema(){return this._def.getter()}_parse(e){const{ctx:s}=this._processInputParams(e);return this._def.getter()._parse({data:s.data,path:s.path,parent:s})}}Ue.create=(t,e)=>new Ue({getter:t,typeName:m.ZodLazy,...g(e)});class xe extends v{_parse(e){if(e.data!==this._def.value){const s=this._getOrReturnCtx(e);return u(s,{received:s.data,code:c.invalid_literal,expected:this._def.value}),p}return{status:"valid",value:e.data}}get value(){return this._def.value}}xe.create=(t,e)=>new xe({value:t,typeName:m.ZodLiteral,...g(e)});function We(t,e){return new W({values:t,typeName:m.ZodEnum,...g(e)})}class W extends v{_parse(e){if(typeof e.data!="string"){const s=this._getOrReturnCtx(e),n=this._def.values;return u(s,{expected:_.joinValues(n),received:s.parsedType,code:c.invalid_type}),p}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const s=this._getOrReturnCtx(e),n=this._def.values;return u(s,{received:s.data,code:c.invalid_enum_value,options:n}),p}return T(e.data)}get options(){return this._def.values}get enum(){const e={};for(const s of this._def.values)e[s]=s;return e}get Values(){const e={};for(const s of this._def.values)e[s]=s;return e}get Enum(){const e={};for(const s of this._def.values)e[s]=s;return e}extract(e,s=this._def){return W.create(e,{...this._def,...s})}exclude(e,s=this._def){return W.create(this.options.filter(n=>!e.includes(n)),{...this._def,...s})}}W.create=We;class Ve extends v{_parse(e){const s=_.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==f.string&&n.parsedType!==f.number){const a=_.objectValues(s);return u(n,{expected:_.joinValues(a),received:n.parsedType,code:c.invalid_type}),p}if(this._cache||(this._cache=new Set(_.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const a=_.objectValues(s);return u(n,{received:n.data,code:c.invalid_enum_value,options:a}),p}return T(e.data)}get enum(){return this._def.values}}Ve.create=(t,e)=>new Ve({values:t,typeName:m.ZodNativeEnum,...g(e)});class de extends v{unwrap(){return this._def.type}_parse(e){const{ctx:s}=this._processInputParams(e);if(s.parsedType!==f.promise&&s.common.async===!1)return u(s,{code:c.invalid_type,expected:f.promise,received:s.parsedType}),p;const n=s.parsedType===f.promise?s.data:Promise.resolve(s.data);return T(n.then(a=>this._def.type.parseAsync(a,{path:s.path,errorMap:s.common.contextualErrorMap})))}}de.create=(t,e)=>new de({type:t,typeName:m.ZodPromise,...g(e)});class H extends v{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===m.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:s,ctx:n}=this._processInputParams(e),a=this._def.effect||null,r={addIssue:i=>{u(n,i),i.fatal?s.abort():s.dirty()},get path(){return n.path}};if(r.addIssue=r.addIssue.bind(r),a.type==="preprocess"){const i=a.transform(n.data,r);if(n.common.async)return Promise.resolve(i).then(async o=>{if(s.value==="aborted")return p;const d=await this._def.schema._parseAsync({data:o,path:n.path,parent:n});return d.status==="aborted"?p:d.status==="dirty"||s.value==="dirty"?Y(d.value):d});{if(s.value==="aborted")return p;const o=this._def.schema._parseSync({data:i,path:n.path,parent:n});return o.status==="aborted"?p:o.status==="dirty"||s.value==="dirty"?Y(o.value):o}}if(a.type==="refinement"){const i=o=>{const d=a.refinement(o,r);if(n.common.async)return Promise.resolve(d);if(d instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?p:(o.status==="dirty"&&s.dirty(),i(o.value),{status:s.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?p:(o.status==="dirty"&&s.dirty(),i(o.value).then(()=>({status:s.value,value:o.value}))))}if(a.type==="transform")if(n.common.async===!1){const i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!z(i))return p;const o=a.transform(i.value,r);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:s.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>z(i)?Promise.resolve(a.transform(i.value,r)).then(o=>({status:s.value,value:o})):p);_.assertNever(a)}}H.create=(t,e,s)=>new H({schema:t,typeName:m.ZodEffects,effect:e,...g(s)});H.createWithPreprocess=(t,e,s)=>new H({schema:e,effect:{type:"preprocess",transform:t},typeName:m.ZodEffects,...g(s)});class L extends v{_parse(e){return this._getType(e)===f.undefined?T(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}L.create=(t,e)=>new L({innerType:t,typeName:m.ZodOptional,...g(e)});class J extends v{_parse(e){return this._getType(e)===f.null?T(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}J.create=(t,e)=>new J({innerType:t,typeName:m.ZodNullable,...g(e)});class be extends v{_parse(e){const{ctx:s}=this._processInputParams(e);let n=s.data;return s.parsedType===f.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:s.path,parent:s})}removeDefault(){return this._def.innerType}}be.create=(t,e)=>new be({innerType:t,typeName:m.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...g(e)});class ke extends v{_parse(e){const{ctx:s}=this._processInputParams(e),n={...s,common:{...s.common,issues:[]}},a=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return re(a)?a.then(r=>({status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new j(n.common.issues)},input:n.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new j(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}ke.create=(t,e)=>new ke({innerType:t,typeName:m.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...g(e)});class Qe extends v{_parse(e){if(this._getType(e)!==f.nan){const n=this._getOrReturnCtx(e);return u(n,{code:c.invalid_type,expected:f.nan,received:n.parsedType}),p}return{status:"valid",value:e.data}}}Qe.create=t=>new Qe({typeName:m.ZodNaN,...g(t)});class vs extends v{_parse(e){const{ctx:s}=this._processInputParams(e),n=s.data;return this._def.type._parse({data:n,path:s.path,parent:s})}unwrap(){return this._def.type}}class Se extends v{_parse(e){const{status:s,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const r=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return r.status==="aborted"?p:r.status==="dirty"?(s.dirty(),Y(r.value)):this._def.out._parseAsync({data:r.value,path:n.path,parent:n})})();{const a=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?p:a.status==="dirty"?(s.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:n.path,parent:n})}}static create(e,s){return new Se({in:e,out:s,typeName:m.ZodPipeline})}}class we extends v{_parse(e){const s=this._def.innerType._parse(e),n=a=>(z(a)&&(a.value=Object.freeze(a.value)),a);return re(s)?s.then(a=>n(a)):n(s)}unwrap(){return this._def.innerType}}we.create=(t,e)=>new we({innerType:t,typeName:m.ZodReadonly,...g(e)});var m;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(m||(m={}));const x=Z.create,Re=F.create,D=ye.create,le=ve.create;$.create;const _s=A.create,fe=w.create;oe.create;ce.create;G.create;const xs=ue.create,b=xe.create;W.create;de.create;L.create;J.create;const He=1,B=fe({type:b("qp-bridge"),id:x().optional()}),S=B.extend({featureVersion:Re().optional()}),Je=B.extend({status:b("answerChanged"),question:x(),answer:le()}),Ye=B.extend({action:b("commandExecuted"),commandName:x()}),Xe=B.extend({action:b("questionnaireLoaded")}),U=B.extend({status:b("success")}),Ke=B.extend({status:b("error"),message:x()}),Me=fe({semanticColor:x().optional(),label:x(),description:x(),disabled:D(),required:D(),hidden:D(),errorMessage:x().optional(),answer:le().optional()}),et=Me.partial(),tt=fe({id:x().uuid(),name:x(),mimeType:x(),blobUrl:x()}),he=xs(le()),Ce=fe({label:x(),hidden:D(),collapsed:D()}),st=Ce.partial(),nt=S.extend({action:b("getQuestion"),question:x()}),at=U.extend({question:Me}),rt=S.extend({action:b("setQuestion"),question:x(),questionData:et}),it=S.extend({action:b("getGroup"),group:x()}),ot=U.extend({group:Ce}),ct=U.extend({canSave:D()}),ut=S.extend({action:b("canSave")}),dt=S.extend({action:b("setGroup"),group:x(),groupData:st}),lt=S.extend({action:b("setAnswer"),question:x(),answer:le()}),ft=S.extend({action:b("busyIndicatorStart")}),ht=S.extend({action:b("busyIndicatorEnd")}),mt=S.extend({action:b("saveQuestionnaire")}),pt=S.extend({action:b("completeAndCloseQuestionnaire")}),gt=S.extend({action:b("executeCustomCommand"),commandName:x()}),yt=S.extend({action:b("fetchEntities"),fetchXml:x()}),vt=U.extend({entities:_s(he)}),_t=S.extend({action:b("getEntityById"),entityName:x(),entityId:x()}),xt=U.extend({entity:he}),bt=S.extend({action:b("saveEntity"),entity:he}),kt=S.extend({action:b("repeatGroup"),parentGroupName:x(),groupIndex:Re()}),wt=S.extend({action:b("addNewGroup"),groupName:x()}),St=S.extend({action:b("deleteGroup"),parentGroupName:x(),groupIndex:Re()});function bs(t){return tt.safeParse(t).success}function Rt(t){return Je.safeParse(t).success}function Mt(t){return Ye.safeParse(t).success}function Ct(t){return Xe.safeParse(t).success}function Te(t){return B.safeParse(t).success}function ks(t){return S.safeParse(t).success}function Tt(t){return U.safeParse(t).success}function Et(t){return Ke.safeParse(t).success}function ws(t){return nt.safeParse(t).success}function At(t){return at.safeParse(t).success}function Ss(t){return lt.safeParse(t).success}function Rs(t){return rt.safeParse(t).success}function Ms(t){return dt.safeParse(t).success}function Cs(t){return it.safeParse(t).success}function Nt(t){return ot.safeParse(t).success}function Ts(t){return ct.safeParse(t).success}function Ot(t){return ut.safeParse(t).success}function It(t){return ft.safeParse(t).success}function qt(t){return ht.safeParse(t).success}function Es(t){return mt.safeParse(t).success}function As(t){return pt.safeParse(t).success}function Ns(t){return gt.safeParse(t).success}function Os(t){return It(t)||qt(t)}function Zt(t,e){return!Te(t)||t.id!==e||!("status"in t)}function Is(t){return yt.safeParse(t).success}function jt(t){return vt.safeParse(t).success}function qs(t){return _t.safeParse(t).success}function Pt(t){return xt.safeParse(t).success}function Zs(t){return bt.safeParse(t).success}function js(t){return kt.safeParse(t).success}function Ps(t){return wt.safeParse(t).success}function Ls(t){return St.safeParse(t).success}function Lt(t){if(t instanceof File||t instanceof Blob)return URL.createObjectURL(t);if(typeof t=="string"){if(/^data:/.test(t)){const r=t.match(/^data:([^;]+);base64,(.*)$/);if(r){const i=r[1],o=r[2],d=atob(o),l=new ArrayBuffer(d.length),y=new Uint8Array(l);for(let I=0;I<d.length;I++)y[I]=d.charCodeAt(I);const O=new Blob([l],{type:i});return URL.createObjectURL(O)}throw new Error("Invalid data URL format. Only base64 data URLs are supported.")}const e=atob(t),s=new ArrayBuffer(e.length),n=new Uint8Array(s);for(let r=0;r<e.length;r++)n[r]=e.charCodeAt(r);const a=new Blob([s]);return URL.createObjectURL(a)}if(t instanceof ArrayBuffer){const e=new Blob([t]);return URL.createObjectURL(e)}throw new Error("Unsupported content type for blobUrl")}function $s(t,e,s,n){return{id:n??De(),name:t,mimeType:e,blobUrl:Lt(s)}}function Bs(t,e){let s=t.blobUrl;return e.content!==void 0&&(s=Lt(e.content)),{...t,...e,blobUrl:s}}Ut.env?.NODE_ENV!=="test"&&$t();function $t(){window.addEventListener("message",Bt)}function Gs(){window.removeEventListener("message",Bt)}async function Us(t,e){await C({type:"qp-bridge",action:"setAnswer",question:t,answer:e})}async function Vs(t){return await un({type:"qp-bridge",action:"getQuestion",question:t})}async function Qs(t,e){await C({type:"qp-bridge",action:"setQuestion",question:t,questionData:e})}async function Ds(t){return await dn({type:"qp-bridge",action:"getGroup",group:t})}async function zs(t,e){await C({type:"qp-bridge",action:"setGroup",group:t,groupData:e})}function Fs(t){const e=s=>{Rt(s.data)&&t(s.data.question,s.data.answer)};return window.addEventListener("message",e),{cancelSubscription:()=>{window.removeEventListener("message",e)}}}async function Ws(t){await C({type:"qp-bridge",action:"busyIndicatorStart"});try{return await t()}finally{await C({type:"qp-bridge",action:"busyIndicatorEnd"})}}async function Hs(){await C({type:"qp-bridge",action:"saveQuestionnaire"})}async function Js(){await C({type:"qp-bridge",action:"completeAndCloseQuestionnaire"})}async function Ys(t){await C({type:"qp-bridge",action:"executeCustomCommand",commandName:t})}const X=[],K=[],ee=[];function Xs(t){return ee.includes(t)||ee.push(t),{cancelSubscription:()=>{const e=ee.indexOf(t);e!==-1&&ee.splice(e,1)}}}function Ks(t){return K.includes(t)||K.push(t),{cancelSubscription:()=>{const e=K.indexOf(t);e!==-1&&K.splice(e,1)}}}function en(t){return X.includes(t)||X.push(t),{cancelSubscription:()=>{const e=X.indexOf(t);e!==-1&&X.splice(e,1)}}}async function Bt(t){try{if(Mt(t.data)&&K.forEach(e=>e(t.data.commandName)),Ct(t.data)&&ee.forEach(e=>e()),Ot(t.data)){const e=await Promise.all(X.map(n=>n())),s={type:"qp-bridge",status:"success",id:t.data.id,canSave:e.every(n=>n)};window.parent.postMessage(s,"*")}}catch(e){const s={type:"qp-bridge",status:"error",id:Te(t.data)?t.data.id:void 0,message:e instanceof Error?e.message:"Unknown error"};window.parent.postMessage(s,"*")}}async function tn(t){return await ln({type:"qp-bridge",action:"fetchEntities",fetchXml:t})}async function sn(t,e){return await fn({type:"qp-bridge",action:"getEntityById",entityName:t,entityId:e})}function nn(){return{isNew:!0}}async function an(t){await C({type:"qp-bridge",action:"saveEntity",entity:t})}async function rn(t,e){await C({type:"qp-bridge",action:"repeatGroup",parentGroupName:t,groupIndex:e})}async function on(t){await C({type:"qp-bridge",action:"addNewGroup",groupName:t})}async function cn(t,e){await C({type:"qp-bridge",action:"deleteGroup",parentGroupName:t,groupIndex:e})}async function ne(t,e){return new Promise((s,n)=>{const a=De(),r=i=>{if(Zt(i.data,a))return;const o=e(i.data);o.success?s(o.data):Et(i.data)?n(new Error(i.data.message)):n(new Error("Unknown message received")),window.removeEventListener("message",r)};window.addEventListener("message",r),window.parent.postMessage({...t,id:a,featureVersion:He},"*")})}async function un(t){return ne(t,e=>At(e)?{success:!0,data:e.question}:{success:!1})}async function dn(t){return ne(t,e=>Nt(e)?{success:!0,data:e.group}:{success:!1})}function C(t){return ne(t,e=>Tt(e)?{success:!0,data:void 0}:{success:!1})}async function ln(t){return ne(t,e=>jt(e)?{success:!0,data:e.entities}:{success:!1})}async function fn(t){return ne(t,e=>Pt(e)?{success:!0,data:e.entity}:{success:!1})}exports.QP_BRIDGE_FEATURE_VERSION=He;exports.addNewGroup=on;exports.addNewGroupRequestMessageSchema=wt;exports.busyIndicatorEndRequestMessageSchema=ht;exports.busyIndicatorStartRequestMessageSchema=ft;exports.canSaveRequestMessageSchema=ut;exports.canSaveSuccessResponseMessageSchema=ct;exports.commandExecutedMessageSchema=Ye;exports.completeAndCloseQuestionnaire=Js;exports.completeAndCloseQuestionnaireRequestMessageSchema=pt;exports.createMediaItem=$s;exports.createNewEntity=nn;exports.deleteGroup=cn;exports.deleteGroupRequestMessageSchema=St;exports.entitySchema=he;exports.executeCustomCommand=Ys;exports.executeCustomCommandRequestMessageSchema=gt;exports.fetchEntities=tn;exports.fetchEntitiesRequestMessageSchema=yt;exports.fetchEntitiesSuccessResponseMessageSchema=vt;exports.getEntityById=sn;exports.getEntityByIdRequestMessageSchema=_t;exports.getEntityByIdSuccessResponseMessageSchema=xt;exports.getGroup=Ds;exports.getGroupRequestMessageSchema=it;exports.getGroupSuccessResponseMessageSchema=ot;exports.getQuestion=Vs;exports.getQuestionRequestMessageSchema=nt;exports.getQuestionSuccessResponseMessageSchema=at;exports.groupOptionalScheme=st;exports.groupSchema=Ce;exports.initOnSaveMessageHandler=$t;exports.isAddNewGroupRequestMessage=Ps;exports.isBusyIndicatorEndRequestMessage=qt;exports.isBusyIndicatorStartRequestMessage=It;exports.isCanSaveRequestMessage=Ot;exports.isCanSaveSuccessResponseMessage=Ts;exports.isCommandExecutedMessage=Mt;exports.isCompleteAndCloseQuestionnaireRequestMessage=As;exports.isDeleteGroupRequestMessage=Ls;exports.isErrorMessage=Et;exports.isExecuteCustomCommandRequestMessage=Ns;exports.isFetchEntitiesRequestMessage=Is;exports.isFetchEntitiesSuccessResponseMessage=jt;exports.isGetEntityByIdRequestMessage=qs;exports.isGetEntityByIdSuccessResponseMessage=Pt;exports.isGetGroupRequestMessage=Cs;exports.isGetGroupSuccessResponseMessage=Nt;exports.isGetQuestionRequestMessage=ws;exports.isGetQuestionSuccessResponseMessage=At;exports.isMediaItem=bs;exports.isNotRelevantMessage=Zt;exports.isOnAnswerChangeMessage=Rt;exports.isQpBridgeMessage=Te;exports.isQpBridgeRequestMessage=ks;exports.isQuestionnaireLoadedMessage=Ct;exports.isRepeatGroupRequestMessage=js;exports.isSaveEntityRequestMessage=Zs;exports.isSaveQuestionnaireRequestMessage=Es;exports.isSetAnswerRequestMessage=Ss;exports.isSetGroupRequestMessage=Ms;exports.isSetQuestionRequestMessage=Rs;exports.isSuccessMessage=Tt;exports.isWithBusyIndicatorRequestMessage=Os;exports.mediaItemSchema=tt;exports.onAnswerChange=Fs;exports.onAnswerChangeMessageSchema=Je;exports.onCommandExecuted=Ks;exports.onQuestionnaireLoaded=Xs;exports.onSave=en;exports.qpBridgeBaseMessageSchema=B;exports.qpBridgeRequestMessageSchema=S;exports.questionOptionalScheme=et;exports.questionSchema=Me;exports.questionnaireLoadedMessageSchema=Xe;exports.removeOnSaveMessageHandler=Gs;exports.repeatGroup=rn;exports.repeatGroupRequestMessageSchema=kt;exports.responseErrorMessageSchema=Ke;exports.responseSuccessMessageSchema=U;exports.saveEntity=an;exports.saveEntityRequestMessageSchema=bt;exports.saveQuestionnaire=Hs;exports.saveQuestionnaireRequestMessageSchema=mt;exports.setAnswer=Us;exports.setAnswerRequestMessageSchema=lt;exports.setGroup=zs;exports.setGroupRequestMessageSchema=dt;exports.setQuestion=Qs;exports.setQuestionRequestMessageSchema=rt;exports.updateMediaItem=Bs;exports.withBusyIndicator=Ws;