@resconet/qp-bridge 1.1.1-alpha.30 → 1.1.1-alpha.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});let X;const St=new Uint8Array(16);function Rt(){if(!X&&(X=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!X))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return X(St)}const S=[];for(let t=0;t<256;++t)S.push((t+256).toString(16).slice(1));function Ct(t,e=0){return S[t[e+0]]+S[t[e+1]]+S[t[e+2]]+S[t[e+3]]+"-"+S[t[e+4]]+S[t[e+5]]+"-"+S[t[e+6]]+S[t[e+7]]+"-"+S[t[e+8]]+S[t[e+9]]+"-"+S[t[e+10]]+S[t[e+11]]+S[t[e+12]]+S[t[e+13]]+S[t[e+14]]+S[t[e+15]]}const Mt=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Ae={randomUUID:Mt};function qe(t,e,s){if(Ae.randomUUID&&!e&&!t)return Ae.randomUUID();t=t||{};const n=t.random||(t.rng||Rt)();return n[6]=n[6]&15|64,n[8]=n[8]&63|128,Ct(n)}var v;(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})(v||(v={}));var Ee;(function(t){t.mergeShapes=(e,s)=>({...e,...s})})(Ee||(Ee={}));const d=v.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),I=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=v.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 N 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 N))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,v.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()}}N.create=t=>new N(t);const oe=(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,v.jsonStringifyReplacer)}`;break;case o.unrecognized_keys:s=`Unrecognized key(s) in object: ${v.joinValues(t.keys,", ")}`;break;case o.invalid_union:s="Invalid input";break;case o.invalid_union_discriminator:s=`Invalid discriminator value. Expected ${v.joinValues(t.options)}`;break;case o.invalid_enum_value:s=`Invalid enum value. Expected ${v.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}"`:v.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,v.assertNever(t)}return{message:s}};let Tt=oe;function At(){return Tt}const Et=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=At(),n=Et({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,s,s===oe?void 0:oe].filter(a=>!!a)});t.common.issues.push(n)}class R{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 R.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"}),W=t=>({status:"dirty",value:t}),M=t=>({status:"valid",value:t}),Ne=t=>t.status==="aborted",Ie=t=>t.status==="dirty",B=t=>t.status==="valid",K=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 A{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 Oe=(t,e)=>{if(B(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 N(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 I(e.data)}_getOrReturnCtx(e,s){return s||{common:e.parent.common,data:e.data,parsedType:I(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new R,ctx:{common:e.parent.common,data:e.data,parsedType:I(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const s=this._parse(e);if(K(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:I(e)},a=this._parseSync({data:e,path:n.path,parent:n});return Oe(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:I(e)};if(!this["~standard"].async)try{const r=this._parseSync({data:e,path:[],parent:s});return B(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=>B(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:I(e)},a=this._parse({data:e,path:n.path,parent:n}),r=await(K(a)?a:Promise.resolve(a));return Oe(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 Z({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 O.create(this,this._def)}nullable(){return F.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return T.create(this)}promise(){return ne.create(this,this._def)}or(e){return ee.create([this,e],this._def)}and(e){return te.create(this,e,this._def)}transform(e){return new Z({...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 Kt({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 Re.create(this,e)}readonly(){return Se.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Nt=/^c[^\s-]{8,}$/i,It=/^[0-9a-z]+$/,Ot=/^[0-9A-HJKMNP-TV-Z]{26}$/i,qt=/^[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,Zt=/^[a-z0-9_-]{21}$/i,jt=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Pt=/^[-+]?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)?)??$/,$t=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Gt="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let ce;const Lt=/^(?:(?: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])$/,Ut=/^(?:(?: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])$/,Bt=/^(([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]))$/,Vt=/^(([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])$/,zt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Dt=/^([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])))",Qt=new RegExp(`^${Ze}$`);function je(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 Ft(t){return new RegExp(`^${je(t)}$`)}function Wt(t){let e=`${Ze}T${je(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 Jt(t,e){return!!((e==="v4"||!e)&&Lt.test(t)||(e==="v6"||!e)&&Bt.test(t))}function Ht(t,e){if(!jt.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 Yt(t,e){return!!((e==="v4"||!e)&&Ut.test(t)||(e==="v6"||!e)&&Vt.test(t))}class E 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 R;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")$t.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")ce||(ce=new RegExp(Gt,"u")),ce.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")qt.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")Zt.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")Nt.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")It.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")Ot.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"?Wt(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"?Qt.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{code:o.invalid_string,validation:"date",message:r.message}),n.dirty()):r.kind==="time"?Ft(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"?Pt.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"duration",code:o.invalid_string,message:r.message}),n.dirty()):r.kind==="ip"?Jt(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"?Ht(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"?Yt(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"?zt.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"base64",code:o.invalid_string,message:r.message}),n.dirty()):r.kind==="base64url"?Dt.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"base64url",code:o.invalid_string,message:r.message}),n.dirty()):v.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 E({...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 E({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new E({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new E({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const 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}}E.create=t=>new E({checks:[],typeName:m.ZodString,coerce:(t==null?void 0:t.coerce)??!1,...g(t)});function Xt(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 V 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 R;for(const r of this._def.checks)r.kind==="int"?v.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"?Xt(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()):v.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 V({...this._def,checks:[...this._def.checks,{kind:e,value:s,inclusive:n,message:l.toString(a)}]})}_addCheck(e){return new V({...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"&&v.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)}}V.create=t=>new V({checks:[],typeName:m.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...g(t)});class z 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 R;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()):v.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 z({...this._def,checks:[...this._def.checks,{kind:e,value:s,inclusive:n,message:l.toString(a)}]})}_addCheck(e){return new z({...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}}z.create=t=>new z({checks:[],typeName:m.ZodBigInt,coerce:(t==null?void 0:t.coerce)??!1,...g(t)});class ue 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 M(e.data)}}ue.create=t=>new ue({typeName:m.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...g(t)});class H 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 R;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()):v.assertNever(r);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new H({...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}}H.create=t=>new H({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:m.ZodDate,...g(t)});class de 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 M(e.data)}}de.create=t=>new de({typeName:m.ZodSymbol,...g(t)});class le 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 M(e.data)}}le.create=t=>new le({typeName:m.ZodUndefined,...g(t)});class fe 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 M(e.data)}}fe.create=t=>new fe({typeName:m.ZodNull,...g(t)});class he extends y{constructor(){super(...arguments),this._any=!0}_parse(e){return M(e.data)}}he.create=t=>new he({typeName:m.ZodAny,...g(t)});class me extends y{constructor(){super(...arguments),this._unknown=!0}_parse(e){return M(e.data)}}me.create=t=>new me({typeName:m.ZodUnknown,...g(t)});class q extends y{_parse(e){const s=this._getOrReturnCtx(e);return u(s,{code:o.invalid_type,expected:d.never,received:s.parsedType}),p}}q.create=t=>new q({typeName:m.ZodNever,...g(t)});class pe 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 M(e.data)}}pe.create=t=>new pe({typeName:m.ZodVoid,...g(t)});class T 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 A(s,i,s.path,c)))).then(i=>R.mergeArray(n,i));const r=[...s.data].map((i,c)=>a.type._parseSync(new A(s,i,s.path,c)));return R.mergeArray(n,r)}get element(){return this._def.type}min(e,s){return new T({...this._def,minLength:{value:e,message:l.toString(s)}})}max(e,s){return new T({...this._def,maxLength:{value:e,message:l.toString(s)}})}length(e,s){return new T({...this._def,exactLength:{value:e,message:l.toString(s)}})}nonempty(e){return this.min(1,e)}}T.create=(t,e)=>new T({type:t,minLength:null,maxLength:null,exactLength:null,typeName:m.ZodArray,...g(e)});function L(t){if(t instanceof b){const e={};for(const s in t.shape){const n=t.shape[s];e[s]=O.create(L(n))}return new b({...t._def,shape:()=>e})}else return t instanceof T?new T({...t._def,type:L(t.element)}):t instanceof O?O.create(L(t.unwrap())):t instanceof F?F.create(L(t.unwrap())):t instanceof P?P.create(t.items.map(e=>L(e))):t}class b 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=v.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 q&&this._def.unknownKeys==="strip"))for(const h in a.data)i.includes(h)||c.push(h);const f=[];for(const h of i){const _=r[h],j=a.data[h];f.push({key:{status:"valid",value:h},value:_._parse(new A(a,j,a.path,h)),alwaysSet:h in a.data})}if(this._def.catchall instanceof q){const h=this._def.unknownKeys;if(h==="passthrough")for(const _ of c)f.push({key:{status:"valid",value:_},value:{status:"valid",value:a.data[_]}});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 _ of c){const j=a.data[_];f.push({key:{status:"valid",value:_},value:h._parse(new A(a,j,a.path,_)),alwaysSet:_ in a.data})}}return a.common.async?Promise.resolve().then(async()=>{const h=[];for(const _ of f){const j=await _.key,G=await _.value;h.push({key:j,value:G,alwaysSet:_.alwaysSet})}return h}).then(h=>R.mergeObjectSync(n,h)):R.mergeObjectSync(n,f)}get shape(){return this._def.shape()}strict(e){return l.errToObj,new b({...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 b({...this._def,unknownKeys:"strip"})}passthrough(){return new b({...this._def,unknownKeys:"passthrough"})}extend(e){return new b({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new b({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:m.ZodObject})}setKey(e,s){return this.augment({[e]:s})}catchall(e){return new b({...this._def,catchall:e})}pick(e){const s={};for(const n of v.objectKeys(e))e[n]&&this.shape[n]&&(s[n]=this.shape[n]);return new b({...this._def,shape:()=>s})}omit(e){const s={};for(const n of v.objectKeys(this.shape))e[n]||(s[n]=this.shape[n]);return new b({...this._def,shape:()=>s})}deepPartial(){return L(this)}partial(e){const s={};for(const n of v.objectKeys(this.shape)){const a=this.shape[n];e&&!e[n]?s[n]=a:s[n]=a.optional()}return new b({...this._def,shape:()=>s})}required(e){const s={};for(const n of v.objectKeys(this.shape))if(e&&!e[n])s[n]=this.shape[n];else{let r=this.shape[n];for(;r instanceof O;)r=r._def.innerType;s[n]=r}return new b({...this._def,shape:()=>s})}keyof(){return Pe(v.objectKeys(this.shape))}}b.create=(t,e)=>new b({shape:()=>t,unknownKeys:"strip",catchall:q.create(),typeName:m.ZodObject,...g(e)});b.strictCreate=(t,e)=>new b({shape:()=>t,unknownKeys:"strict",catchall:q.create(),typeName:m.ZodObject,...g(e)});b.lazycreate=(t,e)=>new b({shape:t,unknownKeys:"strip",catchall:q.create(),typeName:m.ZodObject,...g(e)});class ee 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 N(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},_=f._parseSync({data:s.data,path:s.path,parent:h});if(_.status==="valid")return _;_.status==="dirty"&&!r&&(r={result:_,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 N(f));return u(s,{code:o.invalid_union,unionErrors:c}),p}}get options(){return this._def.options}}ee.create=(t,e)=>new ee({options:t,typeName:m.ZodUnion,...g(e)});function ge(t,e){const s=I(t),n=I(e);if(t===e)return{valid:!0,data:t};if(s===d.object&&n===d.object){const a=v.objectKeys(e),r=v.objectKeys(t).filter(c=>a.indexOf(c)!==-1),i={...t,...e};for(const c of r){const f=ge(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=ge(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 te extends y{_parse(e){const{status:s,ctx:n}=this._processInputParams(e),a=(r,i)=>{if(Ne(r)||Ne(i))return p;const c=ge(r.value,i.value);return c.valid?((Ie(r)||Ie(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}))}}te.create=(t,e,s)=>new te({left:t,right:e,typeName:m.ZodIntersection,...g(s)});class P 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 A(n,i,n.path,c)):null}).filter(i=>!!i);return n.common.async?Promise.all(r).then(i=>R.mergeArray(s,i)):R.mergeArray(s,r)}get items(){return this._def.items}rest(e){return new P({...this._def,rest:e})}}P.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new P({items:t,typeName:m.ZodTuple,rest:null,...g(e)})};class se 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 A(n,c,n.path,c)),value:i._parse(new A(n,n.data[c],n.path,c)),alwaysSet:c in n.data});return n.common.async?R.mergeObjectAsync(s,a):R.mergeObjectSync(s,a)}get element(){return this._def.valueType}static create(e,s,n){return s instanceof y?new se({keyType:e,valueType:s,typeName:m.ZodRecord,...g(n)}):new se({keyType:E.create(),valueType:e,typeName:m.ZodRecord,...g(s)})}}class ye 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 A(n,c,n.path,[h,"key"])),value:r._parse(new A(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,_=await f.value;if(h.status==="aborted"||_.status==="aborted")return p;(h.status==="dirty"||_.status==="dirty")&&s.dirty(),c.set(h.value,_.value)}return{status:s.value,value:c}})}else{const c=new Map;for(const f of i){const h=f.key,_=f.value;if(h.status==="aborted"||_.status==="aborted")return p;(h.status==="dirty"||_.status==="dirty")&&s.dirty(),c.set(h.value,_.value)}return{status:s.value,value:c}}}}ye.create=(t,e,s)=>new ye({valueType:e,keyType:t,typeName:m.ZodMap,...g(s)});class D 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 _ of f){if(_.status==="aborted")return p;_.status==="dirty"&&s.dirty(),h.add(_.value)}return{status:s.value,value:h}}const c=[...n.data.values()].map((f,h)=>r._parse(new A(n,f,n.path,h)));return n.common.async?Promise.all(c).then(f=>i(f)):i(c)}min(e,s){return new D({...this._def,minSize:{value:e,message:l.toString(s)}})}max(e,s){return new D({...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)}}D.create=(t,e)=>new D({valueType:t,minSize:null,maxSize:null,typeName:m.ZodSet,...g(e)});class _e 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})}}_e.create=(t,e)=>new _e({getter:t,typeName:m.ZodLazy,...g(e)});class ve 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}}ve.create=(t,e)=>new ve({value:t,typeName:m.ZodLiteral,...g(e)});function Pe(t,e){return new Q({values:t,typeName:m.ZodEnum,...g(e)})}class Q extends y{_parse(e){if(typeof e.data!="string"){const s=this._getOrReturnCtx(e),n=this._def.values;return u(s,{expected:v.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 M(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 Q.create(e,{...this._def,...s})}exclude(e,s=this._def){return Q.create(this.options.filter(n=>!e.includes(n)),{...this._def,...s})}}Q.create=Pe;class xe extends y{_parse(e){const s=v.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==d.string&&n.parsedType!==d.number){const a=v.objectValues(s);return u(n,{expected:v.joinValues(a),received:n.parsedType,code:o.invalid_type}),p}if(this._cache||(this._cache=new Set(v.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const a=v.objectValues(s);return u(n,{received:n.data,code:o.invalid_enum_value,options:a}),p}return M(e.data)}get enum(){return this._def.values}}xe.create=(t,e)=>new xe({values:t,typeName:m.ZodNativeEnum,...g(e)});class ne 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 M(n.then(a=>this._def.type.parseAsync(a,{path:s.path,errorMap:s.common.contextualErrorMap})))}}ne.create=(t,e)=>new ne({type:t,typeName:m.ZodPromise,...g(e)});class Z 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"?W(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"?W(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(!B(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=>B(i)?Promise.resolve(a.transform(i.value,r)).then(c=>({status:s.value,value:c})):p);v.assertNever(a)}}Z.create=(t,e,s)=>new Z({schema:t,typeName:m.ZodEffects,effect:e,...g(s)});Z.createWithPreprocess=(t,e,s)=>new Z({schema:e,effect:{type:"preprocess",transform:t},typeName:m.ZodEffects,...g(s)});class O extends y{_parse(e){return this._getType(e)===d.undefined?M(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}O.create=(t,e)=>new O({innerType:t,typeName:m.ZodOptional,...g(e)});class F extends y{_parse(e){return this._getType(e)===d.null?M(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}F.create=(t,e)=>new F({innerType:t,typeName:m.ZodNullable,...g(e)});class be 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}}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 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 K(a)?a.then(r=>({status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new N(n.common.issues)},input:n.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new N(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 we 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}}}we.create=t=>new we({typeName:m.ZodNaN,...g(t)});class Kt 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 Re 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(),W(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 Re({in:e,out:s,typeName:m.ZodPipeline})}}class Se extends y{_parse(e){const s=this._def.innerType._parse(e),n=a=>(B(a)&&(a.value=Object.freeze(a.value)),a);return K(s)?s.then(a=>n(a)):n(s)}unwrap(){return this._def.innerType}}Se.create=(t,e)=>new Se({innerType:t,typeName:m.ZodReadonly,...g(e)});b.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=E.create,$e=V.create;we.create;z.create;const U=ue.create;H.create;de.create;le.create;fe.create;he.create;const ae=me.create;q.create;pe.create;const es=T.create,re=b.create;b.strictCreate;ee.create;te.create;P.create;const ts=se.create;ye.create;D.create;_e.create;const w=ve.create;Q.create;xe.create;ne.create;Z.create;O.create;F.create;Z.createWithPreprocess;const k=re({type:w("qp-bridge"),id:x().optional()}),Ge=k.extend({status:w("answerChanged"),question:x(),answer:ae()}),$=k.extend({status:w("success")}),Le=k.extend({status:w("error"),message:x()}),Ce=re({semanticColor:x().optional(),label:x(),description:x(),disabled:U(),required:U(),hidden:U(),errorMessage:x().optional(),answer:ae().optional()}),Ue=Ce.partial(),Be=re({id:x().uuid(),name:x(),mimeType:x(),blobUrl:x()}),ie=ts(ae()),Me=re({label:x(),hidden:U(),collapsed:U()}),Ve=Me.partial(),ze=k.extend({action:w("getQuestion"),question:x()}),De=$.extend({question:Ce}),Qe=k.extend({action:w("setQuestion"),question:x(),questionData:Ue}),Fe=k.extend({action:w("getGroup"),group:x()}),We=$.extend({group:Me}),Je=$.extend({canSave:U()}),He=k.extend({action:w("canSave")}),Ye=k.extend({action:w("setGroup"),group:x(),groupData:Ve}),Xe=k.extend({action:w("setAnswer"),question:x(),answer:ae()}),Ke=k.extend({action:w("busyIndicatorStart")}),et=k.extend({action:w("busyIndicatorEnd")}),tt=k.extend({action:w("saveQuestionnaire")}),st=k.extend({action:w("completeAndCloseQuestionnaire")}),nt=k.extend({action:w("executeCustomCommand"),commandName:x()}),at=k.extend({action:w("fetchEntities"),fetchXml:x()}),rt=$.extend({entities:es(ie)}),it=k.extend({action:w("getEntityById"),entityName:x(),entityId:x()}),ct=$.extend({entity:ie}),ot=k.extend({action:w("saveEntity"),entity:ie}),ut=k.extend({action:w("repeatGroup"),parentGroupName:x(),groupIndex:$e()}),dt=k.extend({action:w("addNewGroup"),groupName:x()}),lt=k.extend({action:w("deleteGroup"),parentGroupName:x(),groupIndex:$e()});function ss(t){return Be.safeParse(t).success}function ft(t){return Ge.safeParse(t).success}function Te(t){return k.safeParse(t).success}function ht(t){return $.safeParse(t).success}function mt(t){return Le.safeParse(t).success}function ns(t){return ze.safeParse(t).success}function pt(t){return De.safeParse(t).success}function as(t){return Xe.safeParse(t).success}function rs(t){return Qe.safeParse(t).success}function is(t){return Ye.safeParse(t).success}function cs(t){return Fe.safeParse(t).success}function gt(t){return We.safeParse(t).success}function os(t){return Je.safeParse(t).success}function yt(t){return He.safeParse(t).success}function _t(t){return Ke.safeParse(t).success}function vt(t){return et.safeParse(t).success}function us(t){return tt.safeParse(t).success}function ds(t){return st.safeParse(t).success}function ls(t){return nt.safeParse(t).success}function fs(t){return _t(t)||vt(t)}function xt(t,e){return!Te(t)||t.id!==e||!("status"in t)}function hs(t){return at.safeParse(t).success}function bt(t){return rt.safeParse(t).success}function ms(t){return it.safeParse(t).success}function kt(t){return ct.safeParse(t).success}function ps(t){return ot.safeParse(t).success}function gs(t){return ut.safeParse(t).success}function ys(t){return dt.safeParse(t).success}function _s(t){return lt.safeParse(t).success}function wt(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),_=new Uint8Array(h);for(let G=0;G<f.length;G++)_[G]=f.charCodeAt(G);const j=new Blob([h],{type:i});return URL.createObjectURL(j)}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 vs(t,e,s,n){return{id:n??qe(),name:t,mimeType:e,blobUrl:wt(s)}}function xs(t,e){let s=t.blobUrl;return e.content!==void 0&&(s=wt(e.content)),{...t,...e,blobUrl:s}}window.addEventListener("message",Is);async function bs(t,e){await C({type:"qp-bridge",action:"setAnswer",question:t,answer:e})}async function ks(t){return await Ls({type:"qp-bridge",action:"getQuestion",question:t})}async function ws(t,e){await C({type:"qp-bridge",action:"setQuestion",question:t,questionData:e})}async function Ss(t){return await Us({type:"qp-bridge",action:"getGroup",group:t})}async function Rs(t,e){await C({type:"qp-bridge",action:"setGroup",group:t,groupData:e})}function Cs(t){const e=s=>{ft(s.data)&&t(s.data.question,s.data.answer)};return window.addEventListener("message",e),{cancelSubscription:()=>{window.removeEventListener("message",e)}}}async function Ms(t){await C({type:"qp-bridge",action:"busyIndicatorStart"});try{return await t()}finally{await C({type:"qp-bridge",action:"busyIndicatorEnd"})}}async function Ts(){await C({type:"qp-bridge",action:"saveQuestionnaire"})}async function As(){await C({type:"qp-bridge",action:"completeAndCloseQuestionnaire"})}async function Es(t){await C({type:"qp-bridge",action:"executeCustomCommand",commandName:t})}const J=[];function Ns(t){return J.includes(t)||J.push(t),{cancelSubscription:()=>{const e=J.indexOf(t);e!==-1&&J.splice(e,1)}}}async function Is(t){try{if(yt(t.data)){const e=await Promise.all(J.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 Os(t){return await Bs({type:"qp-bridge",action:"fetchEntities",fetchXml:t})}async function qs(t,e){return await Vs({type:"qp-bridge",action:"getEntityById",entityName:t,entityId:e})}function Zs(){return{isNew:!0}}async function js(t){await C({type:"qp-bridge",action:"saveEntity",entity:t})}async function Ps(t,e){await C({type:"qp-bridge",action:"repeatGroup",parentGroupName:t,groupIndex:e})}async function $s(t){await C({type:"qp-bridge",action:"addNewGroup",groupName:t})}async function Gs(t,e){await C({type:"qp-bridge",action:"deleteGroup",parentGroupName:t,groupIndex:e})}async function Y(t,e){return new Promise((s,n)=>{const a=qe(),r=i=>{if(xt(i.data,a))return;const c=e(i.data);c.success?s(c.data):mt(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},"*")})}async function Ls(t){return Y(t,e=>pt(e)?{success:!0,data:e.question}:{success:!1})}async function Us(t){return Y(t,e=>gt(e)?{success:!0,data:e.group}:{success:!1})}function C(t){return Y(t,e=>ht(e)?{success:!0,data:void 0}:{success:!1})}async function Bs(t){return Y(t,e=>bt(e)?{success:!0,data:e.entities}:{success:!1})}async function Vs(t){return Y(t,e=>kt(e)?{success:!0,data:e.entity}:{success:!1})}exports.addNewGroup=$s;exports.addNewGroupRequestMessageSchema=dt;exports.busyIndicatorEndRequestMessageSchema=et;exports.busyIndicatorStartRequestMessageSchema=Ke;exports.canSaveRequestMessageSchema=He;exports.canSaveSuccessResponseMessageSchema=Je;exports.completeAndCloseQuestionnaire=As;exports.completeAndCloseQuestionnaireRequestMessageSchema=st;exports.createMediaItem=vs;exports.createNewEntity=Zs;exports.deleteGroup=Gs;exports.deleteGroupRequestMessageSchema=lt;exports.entitySchema=ie;exports.executeCustomCommand=Es;exports.executeCustomCommandRequestMessageSchema=nt;exports.fetchEntities=Os;exports.fetchEntitiesRequestMessageSchema=at;exports.fetchEntitiesSuccessResponseMessageSchema=rt;exports.getEntityById=qs;exports.getEntityByIdRequestMessageSchema=it;exports.getEntityByIdSuccessResponseMessageSchema=ct;exports.getGroup=Ss;exports.getGroupRequestMessageSchema=Fe;exports.getGroupSuccessResponseMessageSchema=We;exports.getQuestion=ks;exports.getQuestionRequestMessageSchema=ze;exports.getQuestionSuccessResponseMessageSchema=De;exports.groupOptionalScheme=Ve;exports.groupSchema=Me;exports.isAddNewGroupRequestMessage=ys;exports.isBusyIndicatorEndRequestMessage=vt;exports.isBusyIndicatorStartRequestMessage=_t;exports.isCanSaveRequestMessage=yt;exports.isCanSaveSuccessResponseMessage=os;exports.isCompleteAndCloseQuestionnaireRequestMessage=ds;exports.isDeleteGroupRequestMessage=_s;exports.isErrorMessage=mt;exports.isExecuteCustomCommandRequestMessage=ls;exports.isFetchEntitiesRequestMessage=hs;exports.isFetchEntitiesSuccessResponseMessage=bt;exports.isGetEntityByIdRequestMessage=ms;exports.isGetEntityByIdSuccessResponseMessage=kt;exports.isGetGroupRequestMessage=cs;exports.isGetGroupSuccessResponseMessage=gt;exports.isGetQuestionRequestMessage=ns;exports.isGetQuestionSuccessResponseMessage=pt;exports.isMediaItem=ss;exports.isNotRelevantMessage=xt;exports.isOnAnswerChangeMessage=ft;exports.isQpBridgeMessage=Te;exports.isRepeatGroupRequestMessage=gs;exports.isSaveEntityRequestMessage=ps;exports.isSaveQuestionnaireRequestMessage=us;exports.isSetAnswerRequestMessage=as;exports.isSetGroupRequestMessage=is;exports.isSetQuestionRequestMessage=rs;exports.isSuccessMessage=ht;exports.isWithBusyIndicatorRequestMessage=fs;exports.mediaItemSchema=Be;exports.onAnswerChange=Cs;exports.onAnswerChangeMessageSchema=Ge;exports.onSave=Ns;exports.qpBridgeMessageSchema=k;exports.questionOptionalScheme=Ue;exports.questionSchema=Ce;exports.repeatGroup=Ps;exports.repeatGroupRequestMessageSchema=ut;exports.responseErrorMessageSchema=Le;exports.responseSuccessMessageSchema=$;exports.saveEntity=js;exports.saveEntityRequestMessageSchema=ot;exports.saveQuestionnaire=Ts;exports.saveQuestionnaireRequestMessageSchema=tt;exports.setAnswer=bs;exports.setAnswerRequestMessageSchema=Xe;exports.setGroup=Rs;exports.setGroupRequestMessageSchema=Ye;exports.setQuestion=ws;exports.setQuestionRequestMessageSchema=Qe;exports.updateMediaItem=xs;exports.withBusyIndicator=Ms;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});let ee;const At=new Uint8Array(16);function Nt(){if(!ee&&(ee=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!ee))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ee(At)}const S=[];for(let t=0;t<256;++t)S.push((t+256).toString(16).slice(1));function It(t,e=0){return S[t[e+0]]+S[t[e+1]]+S[t[e+2]]+S[t[e+3]]+"-"+S[t[e+4]]+S[t[e+5]]+"-"+S[t[e+6]]+S[t[e+7]]+"-"+S[t[e+8]]+S[t[e+9]]+"-"+S[t[e+10]]+S[t[e+11]]+S[t[e+12]]+S[t[e+13]]+S[t[e+14]]+S[t[e+15]]}const Ot=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Ne={randomUUID:Ot};function je(t,e,s){if(Ne.randomUUID&&!e&&!t)return Ne.randomUUID();t=t||{};const n=t.random||(t.rng||Nt)();return n[6]=n[6]&15|64,n[8]=n[8]&63|128,It(n)}var v;(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})(v||(v={}));var Ie;(function(t){t.mergeShapes=(e,s)=>({...e,...s})})(Ie||(Ie={}));const d=v.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),I=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=v.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 N 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 N))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,v.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()}}N.create=t=>new N(t);const de=(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,v.jsonStringifyReplacer)}`;break;case o.unrecognized_keys:s=`Unrecognized key(s) in object: ${v.joinValues(t.keys,", ")}`;break;case o.invalid_union:s="Invalid input";break;case o.invalid_union_discriminator:s=`Invalid discriminator value. Expected ${v.joinValues(t.options)}`;break;case o.invalid_enum_value:s=`Invalid enum value. Expected ${v.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}"`:v.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,v.assertNever(t)}return{message:s}};let qt=de;function Zt(){return qt}const jt=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=Zt(),n=jt({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,s,s===de?void 0:de].filter(a=>!!a)});t.common.issues.push(n)}class R{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 R.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"}),W=t=>({status:"dirty",value:t}),C=t=>({status:"valid",value:t}),Oe=t=>t.status==="aborted",qe=t=>t.status==="dirty",B=t=>t.status==="valid",te=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 T{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(B(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 N(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 I(e.data)}_getOrReturnCtx(e,s){return s||{common:e.parent.common,data:e.data,parsedType:I(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new R,ctx:{common:e.parent.common,data:e.data,parsedType:I(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const s=this._parse(e);if(te(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:I(e)},a=this._parseSync({data:e,path:n.path,parent:n});return Ze(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:I(e)};if(!this["~standard"].async)try{const r=this._parseSync({data:e,path:[],parent:s});return B(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=>B(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:I(e)},a=this._parse({data:e,path:n.path,parent:n}),r=await(te(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),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 Z({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 O.create(this,this._def)}nullable(){return F.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return E.create(this)}promise(){return re.create(this,this._def)}or(e){return se.create([this,e],this._def)}and(e){return ne.create(this,e,this._def)}transform(e){return new Z({...g(this._def),schema:this,typeName:m.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const s=typeof e=="function"?e:()=>e;return new we({...g(this._def),innerType:this,defaultValue:s,typeName:m.ZodDefault})}brand(){return new rs({typeName:m.ZodBranded,type:this,...g(this._def)})}catch(e){const s=typeof e=="function"?e:()=>e;return new Se({...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 Ce.create(this,e)}readonly(){return Me.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Pt=/^c[^\s-]{8,}$/i,$t=/^[0-9a-z]+$/,Lt=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Gt=/^[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,Ut=/^[a-z0-9_-]{21}$/i,Bt=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Vt=/^[-+]?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)?)??$/,zt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Qt="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let ue;const Dt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Ft=/^(?:(?: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])$/,Wt=/^(([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]))$/,Ht=/^(([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])$/,Jt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Yt=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Pe="((\\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])))",Xt=new RegExp(`^${Pe}$`);function $e(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 Kt(t){return new RegExp(`^${$e(t)}$`)}function es(t){let e=`${Pe}T${$e(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 ts(t,e){return!!((e==="v4"||!e)&&Dt.test(t)||(e==="v6"||!e)&&Wt.test(t))}function ss(t,e){if(!Bt.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 ns(t,e){return!!((e==="v4"||!e)&&Ft.test(t)||(e==="v6"||!e)&&Ht.test(t))}class A 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 R;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")zt.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")ue||(ue=new RegExp(Qt,"u")),ue.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")Gt.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")Ut.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")Pt.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")$t.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")Lt.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"?es(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"?Xt.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{code:o.invalid_string,validation:"date",message:r.message}),n.dirty()):r.kind==="time"?Kt(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"?Vt.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"duration",code:o.invalid_string,message:r.message}),n.dirty()):r.kind==="ip"?ts(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"?ns(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"?Jt.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"base64",code:o.invalid_string,message:r.message}),n.dirty()):r.kind==="base64url"?Yt.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"base64url",code:o.invalid_string,message:r.message}),n.dirty()):v.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 A({...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 A({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new A({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new A({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const 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}}A.create=t=>new A({checks:[],typeName:m.ZodString,coerce:(t==null?void 0:t.coerce)??!1,...g(t)});function as(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 V 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 R;for(const r of this._def.checks)r.kind==="int"?v.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"?as(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()):v.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 V({...this._def,checks:[...this._def.checks,{kind:e,value:s,inclusive:n,message:l.toString(a)}]})}_addCheck(e){return new V({...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"&&v.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)}}V.create=t=>new V({checks:[],typeName:m.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...g(t)});class z 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 R;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()):v.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 z({...this._def,checks:[...this._def.checks,{kind:e,value:s,inclusive:n,message:l.toString(a)}]})}_addCheck(e){return new z({...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}}z.create=t=>new z({checks:[],typeName:m.ZodBigInt,coerce:(t==null?void 0:t.coerce)??!1,...g(t)});class le 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 C(e.data)}}le.create=t=>new le({typeName:m.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...g(t)});class X 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 R;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()):v.assertNever(r);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new X({...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}}X.create=t=>new X({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:m.ZodDate,...g(t)});class fe 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 C(e.data)}}fe.create=t=>new fe({typeName:m.ZodSymbol,...g(t)});class he 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 C(e.data)}}he.create=t=>new he({typeName:m.ZodUndefined,...g(t)});class me 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 C(e.data)}}me.create=t=>new me({typeName:m.ZodNull,...g(t)});class pe extends y{constructor(){super(...arguments),this._any=!0}_parse(e){return C(e.data)}}pe.create=t=>new pe({typeName:m.ZodAny,...g(t)});class ge extends y{constructor(){super(...arguments),this._unknown=!0}_parse(e){return C(e.data)}}ge.create=t=>new ge({typeName:m.ZodUnknown,...g(t)});class q extends y{_parse(e){const s=this._getOrReturnCtx(e);return u(s,{code:o.invalid_type,expected:d.never,received:s.parsedType}),p}}q.create=t=>new q({typeName:m.ZodNever,...g(t)});class ye 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 C(e.data)}}ye.create=t=>new ye({typeName:m.ZodVoid,...g(t)});class E 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 T(s,i,s.path,c)))).then(i=>R.mergeArray(n,i));const r=[...s.data].map((i,c)=>a.type._parseSync(new T(s,i,s.path,c)));return R.mergeArray(n,r)}get element(){return this._def.type}min(e,s){return new E({...this._def,minLength:{value:e,message:l.toString(s)}})}max(e,s){return new E({...this._def,maxLength:{value:e,message:l.toString(s)}})}length(e,s){return new E({...this._def,exactLength:{value:e,message:l.toString(s)}})}nonempty(e){return this.min(1,e)}}E.create=(t,e)=>new E({type:t,minLength:null,maxLength:null,exactLength:null,typeName:m.ZodArray,...g(e)});function G(t){if(t instanceof w){const e={};for(const s in t.shape){const n=t.shape[s];e[s]=O.create(G(n))}return new w({...t._def,shape:()=>e})}else return t instanceof E?new E({...t._def,type:G(t.element)}):t instanceof O?O.create(G(t.unwrap())):t instanceof F?F.create(G(t.unwrap())):t instanceof P?P.create(t.items.map(e=>G(e))):t}class w 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=v.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 q&&this._def.unknownKeys==="strip"))for(const h in a.data)i.includes(h)||c.push(h);const f=[];for(const h of i){const _=r[h],j=a.data[h];f.push({key:{status:"valid",value:h},value:_._parse(new T(a,j,a.path,h)),alwaysSet:h in a.data})}if(this._def.catchall instanceof q){const h=this._def.unknownKeys;if(h==="passthrough")for(const _ of c)f.push({key:{status:"valid",value:_},value:{status:"valid",value:a.data[_]}});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 _ of c){const j=a.data[_];f.push({key:{status:"valid",value:_},value:h._parse(new T(a,j,a.path,_)),alwaysSet:_ in a.data})}}return a.common.async?Promise.resolve().then(async()=>{const h=[];for(const _ of f){const j=await _.key,L=await _.value;h.push({key:j,value:L,alwaysSet:_.alwaysSet})}return h}).then(h=>R.mergeObjectSync(n,h)):R.mergeObjectSync(n,f)}get shape(){return this._def.shape()}strict(e){return l.errToObj,new w({...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 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 v.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 v.objectKeys(this.shape))e[n]||(s[n]=this.shape[n]);return new w({...this._def,shape:()=>s})}deepPartial(){return G(this)}partial(e){const s={};for(const n of v.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 v.objectKeys(this.shape))if(e&&!e[n])s[n]=this.shape[n];else{let r=this.shape[n];for(;r instanceof O;)r=r._def.innerType;s[n]=r}return new w({...this._def,shape:()=>s})}keyof(){return Le(v.objectKeys(this.shape))}}w.create=(t,e)=>new w({shape:()=>t,unknownKeys:"strip",catchall:q.create(),typeName:m.ZodObject,...g(e)});w.strictCreate=(t,e)=>new w({shape:()=>t,unknownKeys:"strict",catchall:q.create(),typeName:m.ZodObject,...g(e)});w.lazycreate=(t,e)=>new w({shape:t,unknownKeys:"strip",catchall:q.create(),typeName:m.ZodObject,...g(e)});class se 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 N(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},_=f._parseSync({data:s.data,path:s.path,parent:h});if(_.status==="valid")return _;_.status==="dirty"&&!r&&(r={result:_,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 N(f));return u(s,{code:o.invalid_union,unionErrors:c}),p}}get options(){return this._def.options}}se.create=(t,e)=>new se({options:t,typeName:m.ZodUnion,...g(e)});function _e(t,e){const s=I(t),n=I(e);if(t===e)return{valid:!0,data:t};if(s===d.object&&n===d.object){const a=v.objectKeys(e),r=v.objectKeys(t).filter(c=>a.indexOf(c)!==-1),i={...t,...e};for(const c of r){const f=_e(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=_e(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 ne extends y{_parse(e){const{status:s,ctx:n}=this._processInputParams(e),a=(r,i)=>{if(Oe(r)||Oe(i))return p;const c=_e(r.value,i.value);return c.valid?((qe(r)||qe(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}))}}ne.create=(t,e,s)=>new ne({left:t,right:e,typeName:m.ZodIntersection,...g(s)});class P 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 T(n,i,n.path,c)):null}).filter(i=>!!i);return n.common.async?Promise.all(r).then(i=>R.mergeArray(s,i)):R.mergeArray(s,r)}get items(){return this._def.items}rest(e){return new P({...this._def,rest:e})}}P.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new P({items:t,typeName:m.ZodTuple,rest:null,...g(e)})};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.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 T(n,c,n.path,c)),value:i._parse(new T(n,n.data[c],n.path,c)),alwaysSet:c in n.data});return n.common.async?R.mergeObjectAsync(s,a):R.mergeObjectSync(s,a)}get element(){return this._def.valueType}static create(e,s,n){return s instanceof y?new ae({keyType:e,valueType:s,typeName:m.ZodRecord,...g(n)}):new ae({keyType:A.create(),valueType:e,typeName:m.ZodRecord,...g(s)})}}class ve 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 T(n,c,n.path,[h,"key"])),value:r._parse(new T(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,_=await f.value;if(h.status==="aborted"||_.status==="aborted")return p;(h.status==="dirty"||_.status==="dirty")&&s.dirty(),c.set(h.value,_.value)}return{status:s.value,value:c}})}else{const c=new Map;for(const f of i){const h=f.key,_=f.value;if(h.status==="aborted"||_.status==="aborted")return p;(h.status==="dirty"||_.status==="dirty")&&s.dirty(),c.set(h.value,_.value)}return{status:s.value,value:c}}}}ve.create=(t,e,s)=>new ve({valueType:e,keyType:t,typeName:m.ZodMap,...g(s)});class Q 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 _ of f){if(_.status==="aborted")return p;_.status==="dirty"&&s.dirty(),h.add(_.value)}return{status:s.value,value:h}}const c=[...n.data.values()].map((f,h)=>r._parse(new T(n,f,n.path,h)));return n.common.async?Promise.all(c).then(f=>i(f)):i(c)}min(e,s){return new Q({...this._def,minSize:{value:e,message:l.toString(s)}})}max(e,s){return new Q({...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)}}Q.create=(t,e)=>new Q({valueType:t,minSize:null,maxSize:null,typeName:m.ZodSet,...g(e)});class xe 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})}}xe.create=(t,e)=>new xe({getter:t,typeName:m.ZodLazy,...g(e)});class be 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}}be.create=(t,e)=>new be({value:t,typeName:m.ZodLiteral,...g(e)});function Le(t,e){return new D({values:t,typeName:m.ZodEnum,...g(e)})}class D extends y{_parse(e){if(typeof e.data!="string"){const s=this._getOrReturnCtx(e),n=this._def.values;return u(s,{expected:v.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 C(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 D.create(e,{...this._def,...s})}exclude(e,s=this._def){return D.create(this.options.filter(n=>!e.includes(n)),{...this._def,...s})}}D.create=Le;class ke extends y{_parse(e){const s=v.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==d.string&&n.parsedType!==d.number){const a=v.objectValues(s);return u(n,{expected:v.joinValues(a),received:n.parsedType,code:o.invalid_type}),p}if(this._cache||(this._cache=new Set(v.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const a=v.objectValues(s);return u(n,{received:n.data,code:o.invalid_enum_value,options:a}),p}return C(e.data)}get enum(){return this._def.values}}ke.create=(t,e)=>new ke({values:t,typeName:m.ZodNativeEnum,...g(e)});class re 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 C(n.then(a=>this._def.type.parseAsync(a,{path:s.path,errorMap:s.common.contextualErrorMap})))}}re.create=(t,e)=>new re({type:t,typeName:m.ZodPromise,...g(e)});class Z 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"?W(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"?W(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(!B(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=>B(i)?Promise.resolve(a.transform(i.value,r)).then(c=>({status:s.value,value:c})):p);v.assertNever(a)}}Z.create=(t,e,s)=>new Z({schema:t,typeName:m.ZodEffects,effect:e,...g(s)});Z.createWithPreprocess=(t,e,s)=>new Z({schema:e,effect:{type:"preprocess",transform:t},typeName:m.ZodEffects,...g(s)});class O extends y{_parse(e){return this._getType(e)===d.undefined?C(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}O.create=(t,e)=>new O({innerType:t,typeName:m.ZodOptional,...g(e)});class F extends y{_parse(e){return this._getType(e)===d.null?C(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}F.create=(t,e)=>new F({innerType:t,typeName:m.ZodNullable,...g(e)});class we 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}}we.create=(t,e)=>new we({innerType:t,typeName:m.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...g(e)});class Se 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 te(a)?a.then(r=>({status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new N(n.common.issues)},input:n.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new N(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}Se.create=(t,e)=>new Se({innerType:t,typeName:m.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...g(e)});class Re 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}}}Re.create=t=>new Re({typeName:m.ZodNaN,...g(t)});class rs 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 Ce 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(),W(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 Ce({in:e,out:s,typeName:m.ZodPipeline})}}class Me extends y{_parse(e){const s=this._def.innerType._parse(e),n=a=>(B(a)&&(a.value=Object.freeze(a.value)),a);return te(s)?s.then(a=>n(a)):n(s)}unwrap(){return this._def.innerType}}Me.create=(t,e)=>new Me({innerType:t,typeName:m.ZodReadonly,...g(e)});w.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=A.create,Ge=V.create;Re.create;z.create;const U=le.create;X.create;fe.create;he.create;me.create;pe.create;const ie=ge.create;q.create;ye.create;const is=E.create,ce=w.create;w.strictCreate;se.create;ne.create;P.create;const cs=ae.create;ve.create;Q.create;xe.create;const k=be.create;D.create;ke.create;re.create;Z.create;O.create;F.create;Z.createWithPreprocess;const b=ce({type:k("qp-bridge"),id:x().optional()}),Ue=b.extend({status:k("answerChanged"),question:x(),answer:ie()}),Be=b.extend({action:k("commandExecuted"),commandName:x()}),Ve=b.extend({action:k("questionnaireLoaded")}),$=b.extend({status:k("success")}),ze=b.extend({status:k("error"),message:x()}),Ee=ce({semanticColor:x().optional(),label:x(),description:x(),disabled:U(),required:U(),hidden:U(),errorMessage:x().optional(),answer:ie().optional()}),Qe=Ee.partial(),De=ce({id:x().uuid(),name:x(),mimeType:x(),blobUrl:x()}),oe=cs(ie()),Te=ce({label:x(),hidden:U(),collapsed:U()}),Fe=Te.partial(),We=b.extend({action:k("getQuestion"),question:x()}),He=$.extend({question:Ee}),Je=b.extend({action:k("setQuestion"),question:x(),questionData:Qe}),Ye=b.extend({action:k("getGroup"),group:x()}),Xe=$.extend({group:Te}),Ke=$.extend({canSave:U()}),et=b.extend({action:k("canSave")}),tt=b.extend({action:k("setGroup"),group:x(),groupData:Fe}),st=b.extend({action:k("setAnswer"),question:x(),answer:ie()}),nt=b.extend({action:k("busyIndicatorStart")}),at=b.extend({action:k("busyIndicatorEnd")}),rt=b.extend({action:k("saveQuestionnaire")}),it=b.extend({action:k("completeAndCloseQuestionnaire")}),ct=b.extend({action:k("executeCustomCommand"),commandName:x()}),ot=b.extend({action:k("fetchEntities"),fetchXml:x()}),ut=$.extend({entities:is(oe)}),dt=b.extend({action:k("getEntityById"),entityName:x(),entityId:x()}),lt=$.extend({entity:oe}),ft=b.extend({action:k("saveEntity"),entity:oe}),ht=b.extend({action:k("repeatGroup"),parentGroupName:x(),groupIndex:Ge()}),mt=b.extend({action:k("addNewGroup"),groupName:x()}),pt=b.extend({action:k("deleteGroup"),parentGroupName:x(),groupIndex:Ge()});function os(t){return De.safeParse(t).success}function gt(t){return Ue.safeParse(t).success}function yt(t){return Be.safeParse(t).success}function _t(t){return Ve.safeParse(t).success}function Ae(t){return b.safeParse(t).success}function vt(t){return $.safeParse(t).success}function xt(t){return ze.safeParse(t).success}function us(t){return We.safeParse(t).success}function bt(t){return He.safeParse(t).success}function ds(t){return st.safeParse(t).success}function ls(t){return Je.safeParse(t).success}function fs(t){return tt.safeParse(t).success}function hs(t){return Ye.safeParse(t).success}function kt(t){return Xe.safeParse(t).success}function ms(t){return Ke.safeParse(t).success}function wt(t){return et.safeParse(t).success}function St(t){return nt.safeParse(t).success}function Rt(t){return at.safeParse(t).success}function ps(t){return rt.safeParse(t).success}function gs(t){return it.safeParse(t).success}function ys(t){return ct.safeParse(t).success}function _s(t){return St(t)||Rt(t)}function Mt(t,e){return!Ae(t)||t.id!==e||!("status"in t)}function vs(t){return ot.safeParse(t).success}function Ct(t){return ut.safeParse(t).success}function xs(t){return dt.safeParse(t).success}function Et(t){return lt.safeParse(t).success}function bs(t){return ft.safeParse(t).success}function ks(t){return ht.safeParse(t).success}function ws(t){return mt.safeParse(t).success}function Ss(t){return pt.safeParse(t).success}function Tt(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),_=new Uint8Array(h);for(let L=0;L<f.length;L++)_[L]=f.charCodeAt(L);const j=new Blob([h],{type:i});return URL.createObjectURL(j)}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 Rs(t,e,s,n){return{id:n??je(),name:t,mimeType:e,blobUrl:Tt(s)}}function Ms(t,e){let s=t.blobUrl;return e.content!==void 0&&(s=Tt(e.content)),{...t,...e,blobUrl:s}}window.addEventListener("message",Gs);async function Cs(t,e){await M({type:"qp-bridge",action:"setAnswer",question:t,answer:e})}async function Es(t){return await Ws({type:"qp-bridge",action:"getQuestion",question:t})}async function Ts(t,e){await M({type:"qp-bridge",action:"setQuestion",question:t,questionData:e})}async function As(t){return await Hs({type:"qp-bridge",action:"getGroup",group:t})}async function Ns(t,e){await M({type:"qp-bridge",action:"setGroup",group:t,groupData:e})}function Is(t){const e=s=>{gt(s.data)&&t(s.data.question,s.data.answer)};return window.addEventListener("message",e),{cancelSubscription:()=>{window.removeEventListener("message",e)}}}async function Os(t){await M({type:"qp-bridge",action:"busyIndicatorStart"});try{return await t()}finally{await M({type:"qp-bridge",action:"busyIndicatorEnd"})}}async function qs(){await M({type:"qp-bridge",action:"saveQuestionnaire"})}async function Zs(){await M({type:"qp-bridge",action:"completeAndCloseQuestionnaire"})}async function js(t){await M({type:"qp-bridge",action:"executeCustomCommand",commandName:t})}const H=[],J=[],Y=[];function Ps(t){return Y.includes(t)||Y.push(t),{cancelSubscription:()=>{const e=Y.indexOf(t);e!==-1&&Y.splice(e,1)}}}function $s(t){return J.includes(t)||J.push(t),{cancelSubscription:()=>{const e=J.indexOf(t);e!==-1&&J.splice(e,1)}}}function Ls(t){return H.includes(t)||H.push(t),{cancelSubscription:()=>{const e=H.indexOf(t);e!==-1&&H.splice(e,1)}}}async function Gs(t){try{if(yt(t.data)&&J.forEach(e=>e(t.data.commandName)),_t(t.data)&&Y.forEach(e=>e()),wt(t.data)){const e=await Promise.all(H.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:Ae(t.data)?t.data.id:void 0,message:e instanceof Error?e.message:"Unknown error"};window.parent.postMessage(s,"*")}}async function Us(t){return await Js({type:"qp-bridge",action:"fetchEntities",fetchXml:t})}async function Bs(t,e){return await Ys({type:"qp-bridge",action:"getEntityById",entityName:t,entityId:e})}function Vs(){return{isNew:!0}}async function zs(t){await M({type:"qp-bridge",action:"saveEntity",entity:t})}async function Qs(t,e){await M({type:"qp-bridge",action:"repeatGroup",parentGroupName:t,groupIndex:e})}async function Ds(t){await M({type:"qp-bridge",action:"addNewGroup",groupName:t})}async function Fs(t,e){await M({type:"qp-bridge",action:"deleteGroup",parentGroupName:t,groupIndex:e})}async function K(t,e){return new Promise((s,n)=>{const a=je(),r=i=>{if(Mt(i.data,a))return;const c=e(i.data);c.success?s(c.data):xt(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},"*")})}async function Ws(t){return K(t,e=>bt(e)?{success:!0,data:e.question}:{success:!1})}async function Hs(t){return K(t,e=>kt(e)?{success:!0,data:e.group}:{success:!1})}function M(t){return K(t,e=>vt(e)?{success:!0,data:void 0}:{success:!1})}async function Js(t){return K(t,e=>Ct(e)?{success:!0,data:e.entities}:{success:!1})}async function Ys(t){return K(t,e=>Et(e)?{success:!0,data:e.entity}:{success:!1})}exports.addNewGroup=Ds;exports.addNewGroupRequestMessageSchema=mt;exports.busyIndicatorEndRequestMessageSchema=at;exports.busyIndicatorStartRequestMessageSchema=nt;exports.canSaveRequestMessageSchema=et;exports.canSaveSuccessResponseMessageSchema=Ke;exports.commandExecutedMessageSchema=Be;exports.completeAndCloseQuestionnaire=Zs;exports.completeAndCloseQuestionnaireRequestMessageSchema=it;exports.createMediaItem=Rs;exports.createNewEntity=Vs;exports.deleteGroup=Fs;exports.deleteGroupRequestMessageSchema=pt;exports.entitySchema=oe;exports.executeCustomCommand=js;exports.executeCustomCommandRequestMessageSchema=ct;exports.fetchEntities=Us;exports.fetchEntitiesRequestMessageSchema=ot;exports.fetchEntitiesSuccessResponseMessageSchema=ut;exports.getEntityById=Bs;exports.getEntityByIdRequestMessageSchema=dt;exports.getEntityByIdSuccessResponseMessageSchema=lt;exports.getGroup=As;exports.getGroupRequestMessageSchema=Ye;exports.getGroupSuccessResponseMessageSchema=Xe;exports.getQuestion=Es;exports.getQuestionRequestMessageSchema=We;exports.getQuestionSuccessResponseMessageSchema=He;exports.groupOptionalScheme=Fe;exports.groupSchema=Te;exports.isAddNewGroupRequestMessage=ws;exports.isBusyIndicatorEndRequestMessage=Rt;exports.isBusyIndicatorStartRequestMessage=St;exports.isCanSaveRequestMessage=wt;exports.isCanSaveSuccessResponseMessage=ms;exports.isCommandExecutedMessage=yt;exports.isCompleteAndCloseQuestionnaireRequestMessage=gs;exports.isDeleteGroupRequestMessage=Ss;exports.isErrorMessage=xt;exports.isExecuteCustomCommandRequestMessage=ys;exports.isFetchEntitiesRequestMessage=vs;exports.isFetchEntitiesSuccessResponseMessage=Ct;exports.isGetEntityByIdRequestMessage=xs;exports.isGetEntityByIdSuccessResponseMessage=Et;exports.isGetGroupRequestMessage=hs;exports.isGetGroupSuccessResponseMessage=kt;exports.isGetQuestionRequestMessage=us;exports.isGetQuestionSuccessResponseMessage=bt;exports.isMediaItem=os;exports.isNotRelevantMessage=Mt;exports.isOnAnswerChangeMessage=gt;exports.isQpBridgeMessage=Ae;exports.isQuestionnaireLoadedMessage=_t;exports.isRepeatGroupRequestMessage=ks;exports.isSaveEntityRequestMessage=bs;exports.isSaveQuestionnaireRequestMessage=ps;exports.isSetAnswerRequestMessage=ds;exports.isSetGroupRequestMessage=fs;exports.isSetQuestionRequestMessage=ls;exports.isSuccessMessage=vt;exports.isWithBusyIndicatorRequestMessage=_s;exports.mediaItemSchema=De;exports.onAnswerChange=Is;exports.onAnswerChangeMessageSchema=Ue;exports.onCommandExecuted=$s;exports.onQuestionnaireLoaded=Ps;exports.onSave=Ls;exports.qpBridgeMessageSchema=b;exports.questionOptionalScheme=Qe;exports.questionSchema=Ee;exports.questionnaireLoadedMessageSchema=Ve;exports.repeatGroup=Qs;exports.repeatGroupRequestMessageSchema=ht;exports.responseErrorMessageSchema=ze;exports.responseSuccessMessageSchema=$;exports.saveEntity=zs;exports.saveEntityRequestMessageSchema=ft;exports.saveQuestionnaire=qs;exports.saveQuestionnaireRequestMessageSchema=rt;exports.setAnswer=Cs;exports.setAnswerRequestMessageSchema=st;exports.setGroup=Ns;exports.setGroupRequestMessageSchema=tt;exports.setQuestion=Ts;exports.setQuestionRequestMessageSchema=Je;exports.updateMediaItem=Ms;exports.withBusyIndicator=Os;