@resconet/qp-bridge 0.0.1-alpha.21 → 0.0.1-alpha.24
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 +1 -1
- package/index.mjs +189 -184
- package/lib/qp-bridge-types.d.ts +17 -0
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});let ve;const qt=new Uint8Array(16);function jt(){if(!ve&&(ve=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!ve))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ve(qt)}const k=[];for(let t=0;t<256;++t)k.push((t+256).toString(16).slice(1));function Pt(t,e=0){return k[t[e+0]]+k[t[e+1]]+k[t[e+2]]+k[t[e+3]]+"-"+k[t[e+4]]+k[t[e+5]]+"-"+k[t[e+6]]+k[t[e+7]]+"-"+k[t[e+8]]+k[t[e+9]]+"-"+k[t[e+10]]+k[t[e+11]]+k[t[e+12]]+k[t[e+13]]+k[t[e+14]]+k[t[e+15]]}const $t=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),$e={randomUUID:$t};function Le(t,e,s){if($e.randomUUID&&!e&&!t)return $e.randomUUID();t=t||{};const n=t.random||(t.rng||jt)();return n[6]=n[6]&15|64,n[8]=n[8]&63|128,Pt(n)}var x;(function(t){t.assertEqual=r=>r;function e(r){}t.assertIs=e;function s(r){throw new Error}t.assertNever=s,t.arrayToEnum=r=>{const a={};for(const i of r)a[i]=i;return a},t.getValidEnumValues=r=>{const a=t.objectKeys(r).filter(o=>typeof r[r[o]]!="number"),i={};for(const o of a)i[o]=r[o];return t.objectValues(i)},t.objectValues=r=>t.objectKeys(r).map(function(a){return r[a]}),t.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{const a=[];for(const i in r)Object.prototype.hasOwnProperty.call(r,i)&&a.push(i);return a},t.find=(r,a)=>{for(const i of r)if(a(i))return i},t.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&isFinite(r)&&Math.floor(r)===r;function n(r,a=" | "){return r.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}t.joinValues=n,t.jsonStringifyReplacer=(r,a)=>typeof a=="bigint"?a.toString():a})(x||(x={}));var Ce;(function(t){t.mergeShapes=(e,s)=>({...e,...s})})(Ce||(Ce={}));const f=x.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),P=t=>{switch(typeof t){case"undefined":return f.undefined;case"string":return f.string;case"number":return isNaN(t)?f.nan:f.number;case"boolean":return f.boolean;case"function":return f.function;case"bigint":return f.bigint;case"symbol":return f.symbol;case"object":return Array.isArray(t)?f.array:t===null?f.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?f.promise:typeof Map<"u"&&t instanceof Map?f.map:typeof Set<"u"&&t instanceof Set?f.set:typeof Date<"u"&&t instanceof Date?f.date:f.object;default:return f.unknown}},c=x.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"]),Ut=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");class M extends Error{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}get errors(){return this.issues}format(e){const s=e||function(a){return a.message},n={_errors:[]},r=a=>{for(const i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(r);else if(i.code==="invalid_return_type")r(i.returnTypeError);else if(i.code==="invalid_arguments")r(i.argumentsError);else if(i.path.length===0)n._errors.push(s(i));else{let o=n,u=0;for(;u<i.path.length;){const d=i.path[u];u===i.path.length-1?(o[d]=o[d]||{_errors:[]},o[d]._errors.push(s(i))):o[d]=o[d]||{_errors:[]},o=o[d],u++}}};return r(this),n}static assert(e){if(!(e instanceof M))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,x.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=s=>s.message){const s={},n=[];for(const r of this.issues)r.path.length>0?(s[r.path[0]]=s[r.path[0]]||[],s[r.path[0]].push(e(r))):n.push(e(r));return{formErrors:n,fieldErrors:s}}get formErrors(){return this.flatten()}}M.create=t=>new M(t);const J=(t,e)=>{let s;switch(t.code){case c.invalid_type:t.received===f.undefined?s="Required":s=`Expected ${t.expected}, received ${t.received}`;break;case c.invalid_literal:s=`Invalid literal value, expected ${JSON.stringify(t.expected,x.jsonStringifyReplacer)}`;break;case c.unrecognized_keys:s=`Unrecognized key(s) in object: ${x.joinValues(t.keys,", ")}`;break;case c.invalid_union:s="Invalid input";break;case c.invalid_union_discriminator:s=`Invalid discriminator value. Expected ${x.joinValues(t.options)}`;break;case c.invalid_enum_value:s=`Invalid enum value. Expected ${x.joinValues(t.options)}, received '${t.received}'`;break;case c.invalid_arguments:s="Invalid function arguments";break;case c.invalid_return_type:s="Invalid function return type";break;case c.invalid_date:s="Invalid date";break;case c.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(s=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(s=`${s} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?s=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?s=`Invalid input: must end with "${t.validation.endsWith}"`:x.assertNever(t.validation):t.validation!=="regex"?s=`Invalid ${t.validation}`:s="Invalid";break;case c.too_small:t.type==="array"?s=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?s=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?s=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?s=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:s="Invalid input";break;case c.too_big:t.type==="array"?s=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?s=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?s=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?s=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?s=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:s="Invalid input";break;case c.custom:s="Invalid input";break;case c.invalid_intersection_types:s="Intersection results could not be merged";break;case c.not_multiple_of:s=`Number must be a multiple of ${t.multipleOf}`;break;case c.not_finite:s="Number must be finite";break;default:s=e.defaultError,x.assertNever(t)}return{message:s}};let Ve=J;function Gt(t){Ve=t}function _e(){return Ve}const xe=t=>{const{data:e,path:s,errorMaps:n,issueData:r}=t,a=[...s,...r.path||[]],i={...r,path:a};if(r.message!==void 0)return{...r,path:a,message:r.message};let o="";const u=n.filter(d=>!!d).slice().reverse();for(const d of u)o=d(i,{data:e,defaultError:o}).message;return{...r,path:a,message:o}},Lt=[];function l(t,e){const s=_e(),n=xe({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,s,s===J?void 0:J].filter(r=>!!r)});t.common.issues.push(n)}class S{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 r of s){if(r.status==="aborted")return y;r.status==="dirty"&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,s){const n=[];for(const r of s){const a=await r.key,i=await r.value;n.push({key:a,value:i})}return S.mergeObjectSync(e,n)}static mergeObjectSync(e,s){const n={};for(const r of s){const{key:a,value:i}=r;if(a.status==="aborted"||i.status==="aborted")return y;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||r.alwaysSet)&&(n[a.value]=i.value)}return{status:e.value,value:n}}}const y=Object.freeze({status:"aborted"}),H=t=>({status:"dirty",value:t}),R=t=>({status:"valid",value:t}),Ze=t=>t.status==="aborted",Ie=t=>t.status==="dirty",se=t=>t.status==="valid",ne=t=>typeof Promise<"u"&&t instanceof Promise;function be(t,e,s,n){if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(t)}function Be(t,e,s,n,r){if(typeof e=="function"?t!==e||!r:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,s),s}var p;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(p||(p={}));var F,ee;class O{constructor(e,s,n,r){this._cachedPath=[],this.parent=e,this.data=s,this._path=n,this._key=r}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Ue=(t,e)=>{if(se(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 M(t.common.issues);return this._error=s,this._error}}};function v(t){if(!t)return{};const{errorMap:e,invalid_type_error:s,required_error:n,description:r}=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:r}:{errorMap:(i,o)=>{var u,d;const{message:g}=t;return i.code==="invalid_enum_value"?{message:g??o.defaultError}:typeof o.data>"u"?{message:(u=g??n)!==null&&u!==void 0?u:o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:(d=g??s)!==null&&d!==void 0?d:o.defaultError}},description:r}}class _{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)}get description(){return this._def.description}_getType(e){return P(e.data)}_getOrReturnCtx(e,s){return s||{common:e.parent.common,data:e.data,parsedType:P(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new S,ctx:{common:e.parent.common,data:e.data,parsedType:P(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const s=this._parse(e);if(ne(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){var n;const r={common:{issues:[],async:(n=s==null?void 0:s.async)!==null&&n!==void 0?n:!1,contextualErrorMap:s==null?void 0:s.errorMap},path:(s==null?void 0:s.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:P(e)},a=this._parseSync({data:e,path:r.path,parent:r});return Ue(r,a)}async parseAsync(e,s){const n=await this.safeParseAsync(e,s);if(n.success)return n.data;throw n.error}async safeParseAsync(e,s){const n={common:{issues:[],contextualErrorMap:s==null?void 0:s.errorMap,async:!0},path:(s==null?void 0:s.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:P(e)},r=this._parse({data:e,path:n.path,parent:n}),a=await(ne(r)?r:Promise.resolve(r));return Ue(n,a)}refine(e,s){const n=r=>typeof s=="string"||typeof s>"u"?{message:s}:typeof s=="function"?s(r):s;return this._refinement((r,a)=>{const i=e(r),o=()=>a.addIssue({code:c.custom,...n(r)});return typeof Promise<"u"&&i instanceof Promise?i.then(u=>u?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,s){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof s=="function"?s(n,r):s),!1))}_refinement(e){return new Z({schema:this,typeName:m.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return N.create(this,this._def)}nullable(){return L.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return C.create(this,this._def)}promise(){return K.create(this,this._def)}or(e){return oe.create([this,e],this._def)}and(e){return ce.create(this,e,this._def)}transform(e){return new Z({...v(this._def),schema:this,typeName:m.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const s=typeof e=="function"?e:()=>e;return new he({...v(this._def),innerType:this,defaultValue:s,typeName:m.ZodDefault})}brand(){return new Oe({typeName:m.ZodBranded,type:this,...v(this._def)})}catch(e){const s=typeof e=="function"?e:()=>e;return new pe({...v(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 ge.create(this,e)}readonly(){return me.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Vt=/^c[^\s-]{8,}$/i,Bt=/^[0-9a-z]+$/,Dt=/^[0-9A-HJKMNP-TV-Z]{26}$/,zt=/^[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,Qt=/^[a-z0-9_-]{21}$/i,Wt=/^[-+]?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)?)??$/,Ht=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Yt="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Ee;const Jt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Xt=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Kt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,De="((\\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])))",Ft=new RegExp(`^${De}$`);function ze(t){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`),e}function es(t){return new RegExp(`^${ze(t)}$`)}function Qe(t){let e=`${De}T${ze(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)&&Jt.test(t)||(e==="v6"||!e)&&Xt.test(t))}class E extends _{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==f.string){const a=this._getOrReturnCtx(e);return l(a,{code:c.invalid_type,expected:f.string,received:a.parsedType}),y}const n=new S;let r;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(r=this._getOrReturnCtx(e,r),l(r,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")e.data.length>a.value&&(r=this._getOrReturnCtx(e,r),l(r,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){const i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(r=this._getOrReturnCtx(e,r),i?l(r,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&l(r,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")Ht.test(e.data)||(r=this._getOrReturnCtx(e,r),l(r,{validation:"email",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")Ee||(Ee=new RegExp(Yt,"u")),Ee.test(e.data)||(r=this._getOrReturnCtx(e,r),l(r,{validation:"emoji",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")zt.test(e.data)||(r=this._getOrReturnCtx(e,r),l(r,{validation:"uuid",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")Qt.test(e.data)||(r=this._getOrReturnCtx(e,r),l(r,{validation:"nanoid",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")Vt.test(e.data)||(r=this._getOrReturnCtx(e,r),l(r,{validation:"cuid",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")Bt.test(e.data)||(r=this._getOrReturnCtx(e,r),l(r,{validation:"cuid2",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")Dt.test(e.data)||(r=this._getOrReturnCtx(e,r),l(r,{validation:"ulid",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),l(r,{validation:"url",code:c.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),l(r,{validation:"regex",code:c.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(r=this._getOrReturnCtx(e,r),l(r,{code:c.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(r=this._getOrReturnCtx(e,r),l(r,{code:c.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(r=this._getOrReturnCtx(e,r),l(r,{code:c.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?Qe(a).test(e.data)||(r=this._getOrReturnCtx(e,r),l(r,{code:c.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?Ft.test(e.data)||(r=this._getOrReturnCtx(e,r),l(r,{code:c.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?es(a).test(e.data)||(r=this._getOrReturnCtx(e,r),l(r,{code:c.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?Wt.test(e.data)||(r=this._getOrReturnCtx(e,r),l(r,{validation:"duration",code:c.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?ts(e.data,a.version)||(r=this._getOrReturnCtx(e,r),l(r,{validation:"ip",code:c.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?Kt.test(e.data)||(r=this._getOrReturnCtx(e,r),l(r,{validation:"base64",code:c.invalid_string,message:a.message}),n.dirty()):x.assertNever(a);return{status:n.value,value:e.data}}_regex(e,s,n){return this.refinement(r=>e.test(r),{validation:s,code:c.invalid_string,...p.errToObj(n)})}_addCheck(e){return new E({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...p.errToObj(e)})}url(e){return this._addCheck({kind:"url",...p.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...p.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...p.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...p.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...p.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...p.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...p.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...p.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...p.errToObj(e)})}datetime(e){var s,n;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:(s=e==null?void 0:e.offset)!==null&&s!==void 0?s:!1,local:(n=e==null?void 0:e.local)!==null&&n!==void 0?n:!1,...p.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...p.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...p.errToObj(e)})}regex(e,s){return this._addCheck({kind:"regex",regex:e,...p.errToObj(s)})}includes(e,s){return this._addCheck({kind:"includes",value:e,position:s==null?void 0:s.position,...p.errToObj(s==null?void 0:s.message)})}startsWith(e,s){return this._addCheck({kind:"startsWith",value:e,...p.errToObj(s)})}endsWith(e,s){return this._addCheck({kind:"endsWith",value:e,...p.errToObj(s)})}min(e,s){return this._addCheck({kind:"min",value:e,...p.errToObj(s)})}max(e,s){return this._addCheck({kind:"max",value:e,...p.errToObj(s)})}length(e,s){return this._addCheck({kind:"length",value:e,...p.errToObj(s)})}nonempty(e){return this.min(1,p.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 isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}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=>{var e;return new E({checks:[],typeName:m.ZodString,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...v(t)})};function ss(t,e){const s=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,r=s>n?s:n,a=parseInt(t.toFixed(r).replace(".","")),i=parseInt(e.toFixed(r).replace(".",""));return a%i/Math.pow(10,r)}class $ extends _{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==f.number){const a=this._getOrReturnCtx(e);return l(a,{code:c.invalid_type,expected:f.number,received:a.parsedType}),y}let n;const r=new S;for(const a of this._def.checks)a.kind==="int"?x.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{code:c.invalid_type,expected:"integer",received:"float",message:a.message}),r.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty()):a.kind==="multipleOf"?ss(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{code:c.not_finite,message:a.message}),r.dirty()):x.assertNever(a);return{status:r.value,value:e.data}}gte(e,s){return this.setLimit("min",e,!0,p.toString(s))}gt(e,s){return this.setLimit("min",e,!1,p.toString(s))}lte(e,s){return this.setLimit("max",e,!0,p.toString(s))}lt(e,s){return this.setLimit("max",e,!1,p.toString(s))}setLimit(e,s,n,r){return new $({...this._def,checks:[...this._def.checks,{kind:e,value:s,inclusive:n,message:p.toString(r)}]})}_addCheck(e){return new $({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:p.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:p.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:p.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:p.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:p.toString(e)})}multipleOf(e,s){return this._addCheck({kind:"multipleOf",value:e,message:p.toString(s)})}finite(e){return this._addCheck({kind:"finite",message:p.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:p.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:p.toString(e)})}get minValue(){let e=null;for(const 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"&&x.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)}}$.create=t=>new $({checks:[],typeName:m.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...v(t)});class U extends _{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==f.bigint){const a=this._getOrReturnCtx(e);return l(a,{code:c.invalid_type,expected:f.bigint,received:a.parsedType}),y}let n;const r=new S;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),r.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),r.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):x.assertNever(a);return{status:r.value,value:e.data}}gte(e,s){return this.setLimit("min",e,!0,p.toString(s))}gt(e,s){return this.setLimit("min",e,!1,p.toString(s))}lte(e,s){return this.setLimit("max",e,!0,p.toString(s))}lt(e,s){return this.setLimit("max",e,!1,p.toString(s))}setLimit(e,s,n,r){return new U({...this._def,checks:[...this._def.checks,{kind:e,value:s,inclusive:n,message:p.toString(r)}]})}_addCheck(e){return new U({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:p.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:p.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:p.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:p.toString(e)})}multipleOf(e,s){return this._addCheck({kind:"multipleOf",value:e,message:p.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}}U.create=t=>{var e;return new U({checks:[],typeName:m.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...v(t)})};class re extends _{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==f.boolean){const n=this._getOrReturnCtx(e);return l(n,{code:c.invalid_type,expected:f.boolean,received:n.parsedType}),y}return R(e.data)}}re.create=t=>new re({typeName:m.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...v(t)});class D extends _{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==f.date){const a=this._getOrReturnCtx(e);return l(a,{code:c.invalid_type,expected:f.date,received:a.parsedType}),y}if(isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return l(a,{code:c.invalid_date}),y}const n=new S;let r;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(r=this._getOrReturnCtx(e,r),l(r,{code:c.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(r=this._getOrReturnCtx(e,r),l(r,{code:c.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):x.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new D({...this._def,checks:[...this._def.checks,e]})}min(e,s){return this._addCheck({kind:"min",value:e.getTime(),message:p.toString(s)})}max(e,s){return this._addCheck({kind:"max",value:e.getTime(),message:p.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}}D.create=t=>new D({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:m.ZodDate,...v(t)});class we extends _{_parse(e){if(this._getType(e)!==f.symbol){const n=this._getOrReturnCtx(e);return l(n,{code:c.invalid_type,expected:f.symbol,received:n.parsedType}),y}return R(e.data)}}we.create=t=>new we({typeName:m.ZodSymbol,...v(t)});class ae extends _{_parse(e){if(this._getType(e)!==f.undefined){const n=this._getOrReturnCtx(e);return l(n,{code:c.invalid_type,expected:f.undefined,received:n.parsedType}),y}return R(e.data)}}ae.create=t=>new ae({typeName:m.ZodUndefined,...v(t)});class ie extends _{_parse(e){if(this._getType(e)!==f.null){const n=this._getOrReturnCtx(e);return l(n,{code:c.invalid_type,expected:f.null,received:n.parsedType}),y}return R(e.data)}}ie.create=t=>new ie({typeName:m.ZodNull,...v(t)});class X extends _{constructor(){super(...arguments),this._any=!0}_parse(e){return R(e.data)}}X.create=t=>new X({typeName:m.ZodAny,...v(t)});class B extends _{constructor(){super(...arguments),this._unknown=!0}_parse(e){return R(e.data)}}B.create=t=>new B({typeName:m.ZodUnknown,...v(t)});class j extends _{_parse(e){const s=this._getOrReturnCtx(e);return l(s,{code:c.invalid_type,expected:f.never,received:s.parsedType}),y}}j.create=t=>new j({typeName:m.ZodNever,...v(t)});class ke extends _{_parse(e){if(this._getType(e)!==f.undefined){const n=this._getOrReturnCtx(e);return l(n,{code:c.invalid_type,expected:f.void,received:n.parsedType}),y}return R(e.data)}}ke.create=t=>new ke({typeName:m.ZodVoid,...v(t)});class C extends _{_parse(e){const{ctx:s,status:n}=this._processInputParams(e),r=this._def;if(s.parsedType!==f.array)return l(s,{code:c.invalid_type,expected:f.array,received:s.parsedType}),y;if(r.exactLength!==null){const i=s.data.length>r.exactLength.value,o=s.data.length<r.exactLength.value;(i||o)&&(l(s,{code:i?c.too_big:c.too_small,minimum:o?r.exactLength.value:void 0,maximum:i?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(r.minLength!==null&&s.data.length<r.minLength.value&&(l(s,{code:c.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),r.maxLength!==null&&s.data.length>r.maxLength.value&&(l(s,{code:c.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),s.common.async)return Promise.all([...s.data].map((i,o)=>r.type._parseAsync(new O(s,i,s.path,o)))).then(i=>S.mergeArray(n,i));const a=[...s.data].map((i,o)=>r.type._parseSync(new O(s,i,s.path,o)));return S.mergeArray(n,a)}get element(){return this._def.type}min(e,s){return new C({...this._def,minLength:{value:e,message:p.toString(s)}})}max(e,s){return new C({...this._def,maxLength:{value:e,message:p.toString(s)}})}length(e,s){return new C({...this._def,exactLength:{value:e,message:p.toString(s)}})}nonempty(e){return this.min(1,e)}}C.create=(t,e)=>new C({type:t,minLength:null,maxLength:null,exactLength:null,typeName:m.ZodArray,...v(e)});function W(t){if(t instanceof b){const e={};for(const s in t.shape){const n=t.shape[s];e[s]=N.create(W(n))}return new b({...t._def,shape:()=>e})}else return t instanceof C?new C({...t._def,type:W(t.element)}):t instanceof N?N.create(W(t.unwrap())):t instanceof L?L.create(W(t.unwrap())):t instanceof A?A.create(t.items.map(e=>W(e))):t}class b extends _{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=x.objectKeys(e);return this._cached={shape:e,keys:s}}_parse(e){if(this._getType(e)!==f.object){const d=this._getOrReturnCtx(e);return l(d,{code:c.invalid_type,expected:f.object,received:d.parsedType}),y}const{status:n,ctx:r}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof j&&this._def.unknownKeys==="strip"))for(const d in r.data)i.includes(d)||o.push(d);const u=[];for(const d of i){const g=a[d],T=r.data[d];u.push({key:{status:"valid",value:d},value:g._parse(new O(r,T,r.path,d)),alwaysSet:d in r.data})}if(this._def.catchall instanceof j){const d=this._def.unknownKeys;if(d==="passthrough")for(const g of o)u.push({key:{status:"valid",value:g},value:{status:"valid",value:r.data[g]}});else if(d==="strict")o.length>0&&(l(r,{code:c.unrecognized_keys,keys:o}),n.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const d=this._def.catchall;for(const g of o){const T=r.data[g];u.push({key:{status:"valid",value:g},value:d._parse(new O(r,T,r.path,g)),alwaysSet:g in r.data})}}return r.common.async?Promise.resolve().then(async()=>{const d=[];for(const g of u){const T=await g.key,V=await g.value;d.push({key:T,value:V,alwaysSet:g.alwaysSet})}return d}).then(d=>S.mergeObjectSync(n,d)):S.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(e){return p.errToObj,new b({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(s,n)=>{var r,a,i,o;const u=(i=(a=(r=this._def).errorMap)===null||a===void 0?void 0:a.call(r,s,n).message)!==null&&i!==void 0?i:n.defaultError;return s.code==="unrecognized_keys"?{message:(o=p.errToObj(e).message)!==null&&o!==void 0?o:u}:{message:u}}}:{}})}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={};return x.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(s[n]=this.shape[n])}),new b({...this._def,shape:()=>s})}omit(e){const s={};return x.objectKeys(this.shape).forEach(n=>{e[n]||(s[n]=this.shape[n])}),new b({...this._def,shape:()=>s})}deepPartial(){return W(this)}partial(e){const s={};return x.objectKeys(this.shape).forEach(n=>{const r=this.shape[n];e&&!e[n]?s[n]=r:s[n]=r.optional()}),new b({...this._def,shape:()=>s})}required(e){const s={};return x.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])s[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof N;)a=a._def.innerType;s[n]=a}}),new b({...this._def,shape:()=>s})}keyof(){return We(x.objectKeys(this.shape))}}b.create=(t,e)=>new b({shape:()=>t,unknownKeys:"strip",catchall:j.create(),typeName:m.ZodObject,...v(e)});b.strictCreate=(t,e)=>new b({shape:()=>t,unknownKeys:"strict",catchall:j.create(),typeName:m.ZodObject,...v(e)});b.lazycreate=(t,e)=>new b({shape:t,unknownKeys:"strip",catchall:j.create(),typeName:m.ZodObject,...v(e)});class oe extends _{_parse(e){const{ctx:s}=this._processInputParams(e),n=this._def.options;function r(a){for(const o of a)if(o.result.status==="valid")return o.result;for(const o of a)if(o.result.status==="dirty")return s.common.issues.push(...o.ctx.common.issues),o.result;const i=a.map(o=>new M(o.ctx.common.issues));return l(s,{code:c.invalid_union,unionErrors:i}),y}if(s.common.async)return Promise.all(n.map(async a=>{const i={...s,common:{...s.common,issues:[]},parent:null};return{result:await a._parseAsync({data:s.data,path:s.path,parent:i}),ctx:i}})).then(r);{let a;const i=[];for(const u of n){const d={...s,common:{...s.common,issues:[]},parent:null},g=u._parseSync({data:s.data,path:s.path,parent:d});if(g.status==="valid")return g;g.status==="dirty"&&!a&&(a={result:g,ctx:d}),d.common.issues.length&&i.push(d.common.issues)}if(a)return s.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(u=>new M(u));return l(s,{code:c.invalid_union,unionErrors:o}),y}}get options(){return this._def.options}}oe.create=(t,e)=>new oe({options:t,typeName:m.ZodUnion,...v(e)});const q=t=>t instanceof de?q(t.schema):t instanceof Z?q(t.innerType()):t instanceof le?[t.value]:t instanceof G?t.options:t instanceof fe?x.objectValues(t.enum):t instanceof he?q(t._def.innerType):t instanceof ae?[void 0]:t instanceof ie?[null]:t instanceof N?[void 0,...q(t.unwrap())]:t instanceof L?[null,...q(t.unwrap())]:t instanceof Oe||t instanceof me?q(t.unwrap()):t instanceof pe?q(t._def.innerType):[];class Te extends _{_parse(e){const{ctx:s}=this._processInputParams(e);if(s.parsedType!==f.object)return l(s,{code:c.invalid_type,expected:f.object,received:s.parsedType}),y;const n=this.discriminator,r=s.data[n],a=this.optionsMap.get(r);return a?s.common.async?a._parseAsync({data:s.data,path:s.path,parent:s}):a._parseSync({data:s.data,path:s.path,parent:s}):(l(s,{code:c.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),y)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,s,n){const r=new Map;for(const a of s){const i=q(a.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of i){if(r.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);r.set(o,a)}}return new Te({typeName:m.ZodDiscriminatedUnion,discriminator:e,options:s,optionsMap:r,...v(n)})}}function Ne(t,e){const s=P(t),n=P(e);if(t===e)return{valid:!0,data:t};if(s===f.object&&n===f.object){const r=x.objectKeys(e),a=x.objectKeys(t).filter(o=>r.indexOf(o)!==-1),i={...t,...e};for(const o of a){const u=Ne(t[o],e[o]);if(!u.valid)return{valid:!1};i[o]=u.data}return{valid:!0,data:i}}else if(s===f.array&&n===f.array){if(t.length!==e.length)return{valid:!1};const r=[];for(let a=0;a<t.length;a++){const i=t[a],o=e[a],u=Ne(i,o);if(!u.valid)return{valid:!1};r.push(u.data)}return{valid:!0,data:r}}else return s===f.date&&n===f.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class ce extends _{_parse(e){const{status:s,ctx:n}=this._processInputParams(e),r=(a,i)=>{if(Ze(a)||Ze(i))return y;const o=Ne(a.value,i.value);return o.valid?((Ie(a)||Ie(i))&&s.dirty(),{status:s.value,value:o.data}):(l(n,{code:c.invalid_intersection_types}),y)};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(([a,i])=>r(a,i)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}ce.create=(t,e,s)=>new ce({left:t,right:e,typeName:m.ZodIntersection,...v(s)});class A extends _{_parse(e){const{status:s,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.array)return l(n,{code:c.invalid_type,expected:f.array,received:n.parsedType}),y;if(n.data.length<this._def.items.length)return l(n,{code:c.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),y;!this._def.rest&&n.data.length>this._def.items.length&&(l(n,{code:c.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),s.dirty());const a=[...n.data].map((i,o)=>{const u=this._def.items[o]||this._def.rest;return u?u._parse(new O(n,i,n.path,o)):null}).filter(i=>!!i);return n.common.async?Promise.all(a).then(i=>S.mergeArray(s,i)):S.mergeArray(s,a)}get items(){return this._def.items}rest(e){return new A({...this._def,rest:e})}}A.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new A({items:t,typeName:m.ZodTuple,rest:null,...v(e)})};class ue extends _{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:s,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.object)return l(n,{code:c.invalid_type,expected:f.object,received:n.parsedType}),y;const r=[],a=this._def.keyType,i=this._def.valueType;for(const o in n.data)r.push({key:a._parse(new O(n,o,n.path,o)),value:i._parse(new O(n,n.data[o],n.path,o)),alwaysSet:o in n.data});return n.common.async?S.mergeObjectAsync(s,r):S.mergeObjectSync(s,r)}get element(){return this._def.valueType}static create(e,s,n){return s instanceof _?new ue({keyType:e,valueType:s,typeName:m.ZodRecord,...v(n)}):new ue({keyType:E.create(),valueType:e,typeName:m.ZodRecord,...v(s)})}}class Se extends _{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:s,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.map)return l(n,{code:c.invalid_type,expected:f.map,received:n.parsedType}),y;const r=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([o,u],d)=>({key:r._parse(new O(n,o,n.path,[d,"key"])),value:a._parse(new O(n,u,n.path,[d,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const u of i){const d=await u.key,g=await u.value;if(d.status==="aborted"||g.status==="aborted")return y;(d.status==="dirty"||g.status==="dirty")&&s.dirty(),o.set(d.value,g.value)}return{status:s.value,value:o}})}else{const o=new Map;for(const u of i){const d=u.key,g=u.value;if(d.status==="aborted"||g.status==="aborted")return y;(d.status==="dirty"||g.status==="dirty")&&s.dirty(),o.set(d.value,g.value)}return{status:s.value,value:o}}}}Se.create=(t,e,s)=>new Se({valueType:e,keyType:t,typeName:m.ZodMap,...v(s)});class z extends _{_parse(e){const{status:s,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.set)return l(n,{code:c.invalid_type,expected:f.set,received:n.parsedType}),y;const r=this._def;r.minSize!==null&&n.data.size<r.minSize.value&&(l(n,{code:c.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),s.dirty()),r.maxSize!==null&&n.data.size>r.maxSize.value&&(l(n,{code:c.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),s.dirty());const a=this._def.valueType;function i(u){const d=new Set;for(const g of u){if(g.status==="aborted")return y;g.status==="dirty"&&s.dirty(),d.add(g.value)}return{status:s.value,value:d}}const o=[...n.data.values()].map((u,d)=>a._parse(new O(n,u,n.path,d)));return n.common.async?Promise.all(o).then(u=>i(u)):i(o)}min(e,s){return new z({...this._def,minSize:{value:e,message:p.toString(s)}})}max(e,s){return new z({...this._def,maxSize:{value:e,message:p.toString(s)}})}size(e,s){return this.min(e,s).max(e,s)}nonempty(e){return this.min(1,e)}}z.create=(t,e)=>new z({valueType:t,minSize:null,maxSize:null,typeName:m.ZodSet,...v(e)});class Y extends _{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:s}=this._processInputParams(e);if(s.parsedType!==f.function)return l(s,{code:c.invalid_type,expected:f.function,received:s.parsedType}),y;function n(o,u){return xe({data:o,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,_e(),J].filter(d=>!!d),issueData:{code:c.invalid_arguments,argumentsError:u}})}function r(o,u){return xe({data:o,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,_e(),J].filter(d=>!!d),issueData:{code:c.invalid_return_type,returnTypeError:u}})}const a={errorMap:s.common.contextualErrorMap},i=s.data;if(this._def.returns instanceof K){const o=this;return R(async function(...u){const d=new M([]),g=await o._def.args.parseAsync(u,a).catch(Me=>{throw d.addIssue(n(u,Me)),d}),T=await Reflect.apply(i,this,g);return await o._def.returns._def.type.parseAsync(T,a).catch(Me=>{throw d.addIssue(r(T,Me)),d})})}else{const o=this;return R(function(...u){const d=o._def.args.safeParse(u,a);if(!d.success)throw new M([n(u,d.error)]);const g=Reflect.apply(i,this,d.data),T=o._def.returns.safeParse(g,a);if(!T.success)throw new M([r(g,T.error)]);return T.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Y({...this._def,args:A.create(e).rest(B.create())})}returns(e){return new Y({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,s,n){return new Y({args:e||A.create([]).rest(B.create()),returns:s||B.create(),typeName:m.ZodFunction,...v(n)})}}class de extends _{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})}}de.create=(t,e)=>new de({getter:t,typeName:m.ZodLazy,...v(e)});class le extends _{_parse(e){if(e.data!==this._def.value){const s=this._getOrReturnCtx(e);return l(s,{received:s.data,code:c.invalid_literal,expected:this._def.value}),y}return{status:"valid",value:e.data}}get value(){return this._def.value}}le.create=(t,e)=>new le({value:t,typeName:m.ZodLiteral,...v(e)});function We(t,e){return new G({values:t,typeName:m.ZodEnum,...v(e)})}class G extends _{constructor(){super(...arguments),F.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const s=this._getOrReturnCtx(e),n=this._def.values;return l(s,{expected:x.joinValues(n),received:s.parsedType,code:c.invalid_type}),y}if(be(this,F)||Be(this,F,new Set(this._def.values)),!be(this,F).has(e.data)){const s=this._getOrReturnCtx(e),n=this._def.values;return l(s,{received:s.data,code:c.invalid_enum_value,options:n}),y}return R(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 G.create(e,{...this._def,...s})}exclude(e,s=this._def){return G.create(this.options.filter(n=>!e.includes(n)),{...this._def,...s})}}F=new WeakMap;G.create=We;class fe extends _{constructor(){super(...arguments),ee.set(this,void 0)}_parse(e){const s=x.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==f.string&&n.parsedType!==f.number){const r=x.objectValues(s);return l(n,{expected:x.joinValues(r),received:n.parsedType,code:c.invalid_type}),y}if(be(this,ee)||Be(this,ee,new Set(x.getValidEnumValues(this._def.values))),!be(this,ee).has(e.data)){const r=x.objectValues(s);return l(n,{received:n.data,code:c.invalid_enum_value,options:r}),y}return R(e.data)}get enum(){return this._def.values}}ee=new WeakMap;fe.create=(t,e)=>new fe({values:t,typeName:m.ZodNativeEnum,...v(e)});class K extends _{unwrap(){return this._def.type}_parse(e){const{ctx:s}=this._processInputParams(e);if(s.parsedType!==f.promise&&s.common.async===!1)return l(s,{code:c.invalid_type,expected:f.promise,received:s.parsedType}),y;const n=s.parsedType===f.promise?s.data:Promise.resolve(s.data);return R(n.then(r=>this._def.type.parseAsync(r,{path:s.path,errorMap:s.common.contextualErrorMap})))}}K.create=(t,e)=>new K({type:t,typeName:m.ZodPromise,...v(e)});class Z extends _{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),r=this._def.effect||null,a={addIssue:i=>{l(n,i),i.fatal?s.abort():s.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),r.type==="preprocess"){const i=r.transform(n.data,a);if(n.common.async)return Promise.resolve(i).then(async o=>{if(s.value==="aborted")return y;const u=await this._def.schema._parseAsync({data:o,path:n.path,parent:n});return u.status==="aborted"?y:u.status==="dirty"||s.value==="dirty"?H(u.value):u});{if(s.value==="aborted")return y;const o=this._def.schema._parseSync({data:i,path:n.path,parent:n});return o.status==="aborted"?y:o.status==="dirty"||s.value==="dirty"?H(o.value):o}}if(r.type==="refinement"){const i=o=>{const u=r.refinement(o,a);if(n.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?y:(o.status==="dirty"&&s.dirty(),i(o.value),{status:s.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?y:(o.status==="dirty"&&s.dirty(),i(o.value).then(()=>({status:s.value,value:o.value}))))}if(r.type==="transform")if(n.common.async===!1){const i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!se(i))return i;const o=r.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:s.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>se(i)?Promise.resolve(r.transform(i.value,a)).then(o=>({status:s.value,value:o})):i);x.assertNever(r)}}Z.create=(t,e,s)=>new Z({schema:t,typeName:m.ZodEffects,effect:e,...v(s)});Z.createWithPreprocess=(t,e,s)=>new Z({schema:e,effect:{type:"preprocess",transform:t},typeName:m.ZodEffects,...v(s)});class N extends _{_parse(e){return this._getType(e)===f.undefined?R(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}N.create=(t,e)=>new N({innerType:t,typeName:m.ZodOptional,...v(e)});class L extends _{_parse(e){return this._getType(e)===f.null?R(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}L.create=(t,e)=>new L({innerType:t,typeName:m.ZodNullable,...v(e)});class he extends _{_parse(e){const{ctx:s}=this._processInputParams(e);let n=s.data;return s.parsedType===f.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:s.path,parent:s})}removeDefault(){return this._def.innerType}}he.create=(t,e)=>new he({innerType:t,typeName:m.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...v(e)});class pe extends _{_parse(e){const{ctx:s}=this._processInputParams(e),n={...s,common:{...s.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return ne(r)?r.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new M(n.common.issues)},input:n.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new M(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}pe.create=(t,e)=>new pe({innerType:t,typeName:m.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...v(e)});class Re extends _{_parse(e){if(this._getType(e)!==f.nan){const n=this._getOrReturnCtx(e);return l(n,{code:c.invalid_type,expected:f.nan,received:n.parsedType}),y}return{status:"valid",value:e.data}}}Re.create=t=>new Re({typeName:m.ZodNaN,...v(t)});const ns=Symbol("zod_brand");class Oe extends _{_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 ge extends _{_parse(e){const{status:s,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?y:a.status==="dirty"?(s.dirty(),H(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{const r=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return r.status==="aborted"?y:r.status==="dirty"?(s.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:n.path,parent:n})}}static create(e,s){return new ge({in:e,out:s,typeName:m.ZodPipeline})}}class me extends _{_parse(e){const s=this._def.innerType._parse(e),n=r=>(se(r)&&(r.value=Object.freeze(r.value)),r);return ne(s)?s.then(r=>n(r)):n(s)}unwrap(){return this._def.innerType}}me.create=(t,e)=>new me({innerType:t,typeName:m.ZodReadonly,...v(e)});function He(t,e={},s){return t?X.create().superRefine((n,r)=>{var a,i;if(!t(n)){const o=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,u=(i=(a=o.fatal)!==null&&a!==void 0?a:s)!==null&&i!==void 0?i:!0,d=typeof o=="string"?{message:o}:o;r.addIssue({code:"custom",...d,fatal:u})}}):X.create()}const rs={object: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 as=(t,e={message:`Input not instance of ${t.name}`})=>He(s=>s instanceof t,e),Ye=E.create,Je=$.create,is=Re.create,os=U.create,Xe=re.create,cs=D.create,us=we.create,ds=ae.create,ls=ie.create,fs=X.create,hs=B.create,ps=j.create,ms=ke.create,gs=C.create,ys=b.create,vs=b.strictCreate,_s=oe.create,xs=Te.create,bs=ce.create,ws=A.create,ks=ue.create,Ss=Se.create,Rs=z.create,Ts=Y.create,Ms=de.create,Es=le.create,Cs=G.create,Zs=fe.create,Is=K.create,Ge=Z.create,Ns=N.create,Os=L.create,As=Z.createWithPreprocess,qs=ge.create,js=()=>Ye().optional(),Ps=()=>Je().optional(),$s=()=>Xe().optional(),Us={string:t=>E.create({...t,coerce:!0}),number:t=>$.create({...t,coerce:!0}),boolean:t=>re.create({...t,coerce:!0}),bigint:t=>U.create({...t,coerce:!0}),date:t=>D.create({...t,coerce:!0})},Gs=y;var h=Object.freeze({__proto__:null,defaultErrorMap:J,setErrorMap:Gt,getErrorMap:_e,makeIssue:xe,EMPTY_PATH:Lt,addIssueToContext:l,ParseStatus:S,INVALID:y,DIRTY:H,OK:R,isAborted:Ze,isDirty:Ie,isValid:se,isAsync:ne,get util(){return x},get objectUtil(){return Ce},ZodParsedType:f,getParsedType:P,ZodType:_,datetimeRegex:Qe,ZodString:E,ZodNumber:$,ZodBigInt:U,ZodBoolean:re,ZodDate:D,ZodSymbol:we,ZodUndefined:ae,ZodNull:ie,ZodAny:X,ZodUnknown:B,ZodNever:j,ZodVoid:ke,ZodArray:C,ZodObject:b,ZodUnion:oe,ZodDiscriminatedUnion:Te,ZodIntersection:ce,ZodTuple:A,ZodRecord:ue,ZodMap:Se,ZodSet:z,ZodFunction:Y,ZodLazy:de,ZodLiteral:le,ZodEnum:G,ZodNativeEnum:fe,ZodPromise:K,ZodEffects:Z,ZodTransformer:Z,ZodOptional:N,ZodNullable:L,ZodDefault:he,ZodCatch:pe,ZodNaN:Re,BRAND:ns,ZodBranded:Oe,ZodPipeline:ge,ZodReadonly:me,custom:He,Schema:_,ZodSchema:_,late:rs,get ZodFirstPartyTypeKind(){return m},coerce:Us,any:fs,array:gs,bigint:os,boolean:Xe,date:cs,discriminatedUnion:xs,effect:Ge,enum:Cs,function:Ts,instanceof:as,intersection:bs,lazy:Ms,literal:Es,map:Ss,nan:is,nativeEnum:Zs,never:ps,null:ls,nullable:Os,number:Je,object:ys,oboolean:$s,onumber:Ps,optional:Ns,ostring:js,pipeline:qs,preprocess:As,promise:Is,record:ks,set:Rs,strictObject:vs,string:Ye,symbol:us,transformer:Ge,tuple:ws,undefined:ds,union:_s,unknown:hs,void:ms,NEVER:Gs,ZodIssueCode:c,quotelessJson:Ut,ZodError:M});const w=h.object({type:h.literal("qp-bridge"),id:h.string().optional()}),Ke=w.extend({status:h.literal("answerChanged"),question:h.string(),answer:h.unknown()}),Q=w.extend({status:h.literal("success")}),Fe=w.extend({status:h.literal("error"),message:h.string()}),Ae=h.object({semanticColor:h.string().optional(),label:h.string(),description:h.string(),disabled:h.boolean(),required:h.boolean(),hidden:h.boolean(),errorMessage:h.string().optional()}),et=Ae.partial(),tt=h.object({id:h.string().uuid(),name:h.string(),mimeType:h.string(),blobUrl:h.string()}),qe=h.record(h.unknown()),je=h.object({label:h.string(),hidden:h.boolean(),collapsed:h.boolean()}),st=je.partial(),nt=w.extend({action:h.literal("getQuestion"),question:h.string()}),rt=Q.extend({question:Ae}),at=w.extend({action:h.literal("setQuestion"),question:h.string(),questionData:et}),it=w.extend({action:h.literal("getGroup"),group:h.string()}),ot=Q.extend({group:je}),ct=Q.extend({canSave:h.boolean()}),ut=w.extend({action:h.literal("canSave")}),dt=w.extend({action:h.literal("setGroup"),group:h.string(),groupData:st}),lt=w.extend({action:h.literal("setAnswer"),question:h.string(),answer:h.unknown()}),ft=w.extend({action:h.literal("busyIndicatorStart")}),ht=w.extend({action:h.literal("busyIndicatorEnd")}),pt=w.extend({action:h.literal("saveQuestionnaire")}),mt=w.extend({action:h.literal("completeAndCloseQuestionnaire")}),gt=w.extend({action:h.literal("executeCustomCommand"),commandName:h.string()}),yt=w.extend({action:h.literal("fetchEntities"),fetchXml:h.string()}),vt=Q.extend({entities:h.array(qe)}),_t=w.extend({action:h.literal("getEntityById"),entityName:h.string(),entityId:h.string()}),xt=Q.extend({entity:qe}),bt=w.extend({action:h.literal("repeatGroup"),parentGroupName:h.string(),groupIndex:h.number()}),wt=w.extend({action:h.literal("addNewGroup"),groupName:h.string()}),kt=w.extend({action:h.literal("deleteGroup"),parentGroupName:h.string(),groupIndex:h.number()});function Ls(t){return tt.safeParse(t).success}function St(t){return Ke.safeParse(t).success}function Pe(t){return w.safeParse(t).success}function Rt(t){return Q.safeParse(t).success}function Tt(t){return Fe.safeParse(t).success}function Vs(t){return nt.safeParse(t).success}function Mt(t){return rt.safeParse(t).success}function Bs(t){return lt.safeParse(t).success}function Ds(t){return at.safeParse(t).success}function zs(t){return dt.safeParse(t).success}function Qs(t){return it.safeParse(t).success}function Et(t){return ot.safeParse(t).success}function Ws(t){return ct.safeParse(t).success}function Ct(t){return ut.safeParse(t).success}function Zt(t){return ft.safeParse(t).success}function It(t){return ht.safeParse(t).success}function Hs(t){return pt.safeParse(t).success}function Ys(t){return mt.safeParse(t).success}function Js(t){return gt.safeParse(t).success}function Xs(t){return Zt(t)||It(t)}function Ks(t){return yt.safeParse(t).success}function Nt(t){return vt.safeParse(t).success}function Fs(t){return _t.safeParse(t).success}function Ot(t){return xt.safeParse(t).success}function en(t){return bt.safeParse(t).success}function tn(t){return wt.safeParse(t).success}function sn(t){return kt.safeParse(t).success}function At(t){if(t instanceof File||t instanceof Blob)return URL.createObjectURL(t);if(typeof t=="string"){if(/^data:/.test(t)){const a=t.match(/^data:([^;]+);base64,(.*)$/);if(a){const i=a[1],o=a[2],u=atob(o),d=new ArrayBuffer(u.length),g=new Uint8Array(d);for(let V=0;V<u.length;V++)g[V]=u.charCodeAt(V);const T=new Blob([d],{type:i});return URL.createObjectURL(T)}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 a=0;a<e.length;a++)n[a]=e.charCodeAt(a);const r=new Blob([s]);return URL.createObjectURL(r)}if(t instanceof ArrayBuffer){const e=new Blob([t]);return URL.createObjectURL(e)}throw new Error("Unsupported content type for blobUrl")}function nn(t,e,s,n){return{id:n??Le(),name:t,mimeType:e,blobUrl:At(s)}}function rn(t,e){let s=t.blobUrl;return e.content!==void 0&&(s=At(e.content)),{...t,...e,blobUrl:s}}window.addEventListener("message",yn);async function an(t,e){await I({type:"qp-bridge",action:"setAnswer",question:t,answer:e})}async function on(t){return await kn({type:"qp-bridge",action:"getQuestion",question:t})}async function cn(t,e){await I({type:"qp-bridge",action:"setQuestion",question:t,questionData:e})}async function un(t){return await Sn({type:"qp-bridge",action:"getGroup",group:t})}async function dn(t,e){await I({type:"qp-bridge",action:"setGroup",group:t,groupData:e})}function ln(t){const e=s=>{St(s.data)&&t(s.data.question,s.data.answer)};return window.addEventListener("message",e),{cancelSubscription:()=>{window.removeEventListener("message",e)}}}async function fn(t){await I({type:"qp-bridge",action:"busyIndicatorStart"});try{return await t()}finally{await I({type:"qp-bridge",action:"busyIndicatorEnd"})}}async function hn(){await I({type:"qp-bridge",action:"saveQuestionnaire"})}async function pn(){await I({type:"qp-bridge",action:"completeAndCloseQuestionnaire"})}async function mn(t){await I({type:"qp-bridge",action:"executeCustomCommand",commandName:t})}const te=[];function gn(t){return te.includes(t)||te.push(t),{cancelSubscription:()=>{const e=te.indexOf(t);e!==-1&&te.splice(e,1)}}}async function yn(t){try{if(Ct(t.data)){const e=await Promise.all(te.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:Pe(t.data)?t.data.id:void 0,message:e instanceof Error?e.message:"Unknown error"};window.parent.postMessage(s,"*")}}async function vn(t){return await Rn({type:"qp-bridge",action:"fetchEntities",fetchXml:t})}async function _n(t,e){return await Tn({type:"qp-bridge",action:"getEntityById",entityName:t,entityId:e})}async function xn(t,e){await I({type:"qp-bridge",action:"repeatGroup",parentGroupName:t,groupIndex:e})}async function bn(t){await I({type:"qp-bridge",action:"addNewGroup",groupName:t})}async function wn(t,e){await I({type:"qp-bridge",action:"deleteGroup",parentGroupName:t,groupIndex:e})}async function ye(t,e){return new Promise((s,n)=>{const r=Le(),a=i=>{if(!Pe(i.data)||i.data.id!==r)return;const u=e(i.data);u.success?s(u.data):Tt(i.data)?n(new Error(i.data.message)):n(new Error("Unknown message received")),window.removeEventListener("message",a)};window.addEventListener("message",a),window.parent.postMessage({...t,id:r},"*")})}async function kn(t){return ye(t,e=>Mt(e)?{success:!0,data:e.question}:{success:!1})}async function Sn(t){return ye(t,e=>Et(e)?{success:!0,data:e.group}:{success:!1})}function I(t){return ye(t,e=>Rt(e)?{success:!0,data:void 0}:{success:!1})}async function Rn(t){return ye(t,e=>Nt(e)?{success:!0,data:e.entities}:{success:!1})}async function Tn(t){return ye(t,e=>Ot(e)?{success:!0,data:e.entity}:{success:!1})}exports.addNewGroup=bn;exports.addNewGroupRequestMessageSchema=wt;exports.busyIndicatorEndRequestMessageSchema=ht;exports.busyIndicatorStartRequestMessageSchema=ft;exports.canSaveRequestMessageSchema=ut;exports.canSaveSuccessResponseMessageSchema=ct;exports.completeAndCloseQuestionnaire=pn;exports.completeAndCloseQuestionnaireRequestMessageSchema=mt;exports.createMediaItem=nn;exports.deleteGroup=wn;exports.deleteGroupRequestMessageSchema=kt;exports.entitySchema=qe;exports.executeCustomCommand=mn;exports.executeCustomCommandRequestMessageSchema=gt;exports.fetchEntities=vn;exports.fetchEntitiesRequestMessageSchema=yt;exports.fetchEntitiesSuccessResponseMessageSchema=vt;exports.getEntityById=_n;exports.getEntityByIdRequestMessageSchema=_t;exports.getEntityByIdSuccessResponseMessageSchema=xt;exports.getGroup=un;exports.getGroupRequestMessageSchema=it;exports.getGroupSuccessResponseMessageSchema=ot;exports.getQuestion=on;exports.getQuestionRequestMessageSchema=nt;exports.getQuestionSuccessResponseMessageSchema=rt;exports.groupOptionalScheme=st;exports.groupSchema=je;exports.isAddNewGroupRequestMessage=tn;exports.isBusyIndicatorEndRequestMessage=It;exports.isBusyIndicatorStartRequestMessage=Zt;exports.isCanSaveRequestMessage=Ct;exports.isCanSaveSuccessResponseMessage=Ws;exports.isCompleteAndCloseQuestionnaireRequestMessage=Ys;exports.isDeleteGroupRequestMessage=sn;exports.isErrorMessage=Tt;exports.isExecuteCustomCommandRequestMessage=Js;exports.isFetchEntitiesRequestMessage=Ks;exports.isFetchEntitiesSuccessResponseMessage=Nt;exports.isGetEntityByIdRequestMessage=Fs;exports.isGetEntityByIdSuccessResponseMessage=Ot;exports.isGetGroupRequestMessage=Qs;exports.isGetGroupSuccessResponseMessage=Et;exports.isGetQuestionRequestMessage=Vs;exports.isGetQuestionSuccessResponseMessage=Mt;exports.isMediaItem=Ls;exports.isOnAnswerChangeMessage=St;exports.isQpBridgeMessage=Pe;exports.isRepeatGroupRequestMessage=en;exports.isSaveQuestionnaireRequestMessage=Hs;exports.isSetAnswerRequestMessage=Bs;exports.isSetGroupRequestMessage=zs;exports.isSetQuestionRequestMessage=Ds;exports.isSuccessMessage=Rt;exports.isWithBusyIndicatorRequestMessage=Xs;exports.mediaItemSchema=tt;exports.onAnswerChange=ln;exports.onAnswerChangeMessageSchema=Ke;exports.onSave=gn;exports.qpBridgeMessageSchema=w;exports.questionOptionalScheme=et;exports.questionSchema=Ae;exports.repeatGroup=xn;exports.repeatGroupRequestMessageSchema=bt;exports.responseErrorMessageSchema=Fe;exports.responseSuccessMessageSchema=Q;exports.saveQuestionnaire=hn;exports.saveQuestionnaireRequestMessageSchema=pt;exports.setAnswer=an;exports.setAnswerRequestMessageSchema=lt;exports.setGroup=dn;exports.setGroupRequestMessageSchema=dt;exports.setQuestion=cn;exports.setQuestionRequestMessageSchema=at;exports.updateMediaItem=rn;exports.withBusyIndicator=fn;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});let ve;const jt=new Uint8Array(16);function Pt(){if(!ve&&(ve=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!ve))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ve(jt)}const k=[];for(let t=0;t<256;++t)k.push((t+256).toString(16).slice(1));function $t(t,e=0){return k[t[e+0]]+k[t[e+1]]+k[t[e+2]]+k[t[e+3]]+"-"+k[t[e+4]]+k[t[e+5]]+"-"+k[t[e+6]]+k[t[e+7]]+"-"+k[t[e+8]]+k[t[e+9]]+"-"+k[t[e+10]]+k[t[e+11]]+k[t[e+12]]+k[t[e+13]]+k[t[e+14]]+k[t[e+15]]}const Ut=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),$e={randomUUID:Ut};function Le(t,e,s){if($e.randomUUID&&!e&&!t)return $e.randomUUID();t=t||{};const n=t.random||(t.rng||Pt)();return n[6]=n[6]&15|64,n[8]=n[8]&63|128,$t(n)}var x;(function(t){t.assertEqual=r=>r;function e(r){}t.assertIs=e;function s(r){throw new Error}t.assertNever=s,t.arrayToEnum=r=>{const a={};for(const i of r)a[i]=i;return a},t.getValidEnumValues=r=>{const a=t.objectKeys(r).filter(o=>typeof r[r[o]]!="number"),i={};for(const o of a)i[o]=r[o];return t.objectValues(i)},t.objectValues=r=>t.objectKeys(r).map(function(a){return r[a]}),t.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{const a=[];for(const i in r)Object.prototype.hasOwnProperty.call(r,i)&&a.push(i);return a},t.find=(r,a)=>{for(const i of r)if(a(i))return i},t.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&isFinite(r)&&Math.floor(r)===r;function n(r,a=" | "){return r.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}t.joinValues=n,t.jsonStringifyReplacer=(r,a)=>typeof a=="bigint"?a.toString():a})(x||(x={}));var Ce;(function(t){t.mergeShapes=(e,s)=>({...e,...s})})(Ce||(Ce={}));const f=x.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),P=t=>{switch(typeof t){case"undefined":return f.undefined;case"string":return f.string;case"number":return isNaN(t)?f.nan:f.number;case"boolean":return f.boolean;case"function":return f.function;case"bigint":return f.bigint;case"symbol":return f.symbol;case"object":return Array.isArray(t)?f.array:t===null?f.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?f.promise:typeof Map<"u"&&t instanceof Map?f.map:typeof Set<"u"&&t instanceof Set?f.set:typeof Date<"u"&&t instanceof Date?f.date:f.object;default:return f.unknown}},c=x.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"]),Gt=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");class M extends Error{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}get errors(){return this.issues}format(e){const s=e||function(a){return a.message},n={_errors:[]},r=a=>{for(const i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(r);else if(i.code==="invalid_return_type")r(i.returnTypeError);else if(i.code==="invalid_arguments")r(i.argumentsError);else if(i.path.length===0)n._errors.push(s(i));else{let o=n,d=0;for(;d<i.path.length;){const u=i.path[d];d===i.path.length-1?(o[u]=o[u]||{_errors:[]},o[u]._errors.push(s(i))):o[u]=o[u]||{_errors:[]},o=o[u],d++}}};return r(this),n}static assert(e){if(!(e instanceof M))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,x.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=s=>s.message){const s={},n=[];for(const r of this.issues)r.path.length>0?(s[r.path[0]]=s[r.path[0]]||[],s[r.path[0]].push(e(r))):n.push(e(r));return{formErrors:n,fieldErrors:s}}get formErrors(){return this.flatten()}}M.create=t=>new M(t);const J=(t,e)=>{let s;switch(t.code){case c.invalid_type:t.received===f.undefined?s="Required":s=`Expected ${t.expected}, received ${t.received}`;break;case c.invalid_literal:s=`Invalid literal value, expected ${JSON.stringify(t.expected,x.jsonStringifyReplacer)}`;break;case c.unrecognized_keys:s=`Unrecognized key(s) in object: ${x.joinValues(t.keys,", ")}`;break;case c.invalid_union:s="Invalid input";break;case c.invalid_union_discriminator:s=`Invalid discriminator value. Expected ${x.joinValues(t.options)}`;break;case c.invalid_enum_value:s=`Invalid enum value. Expected ${x.joinValues(t.options)}, received '${t.received}'`;break;case c.invalid_arguments:s="Invalid function arguments";break;case c.invalid_return_type:s="Invalid function return type";break;case c.invalid_date:s="Invalid date";break;case c.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(s=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(s=`${s} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?s=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?s=`Invalid input: must end with "${t.validation.endsWith}"`:x.assertNever(t.validation):t.validation!=="regex"?s=`Invalid ${t.validation}`:s="Invalid";break;case c.too_small:t.type==="array"?s=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?s=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?s=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?s=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:s="Invalid input";break;case c.too_big:t.type==="array"?s=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?s=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?s=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?s=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?s=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:s="Invalid input";break;case c.custom:s="Invalid input";break;case c.invalid_intersection_types:s="Intersection results could not be merged";break;case c.not_multiple_of:s=`Number must be a multiple of ${t.multipleOf}`;break;case c.not_finite:s="Number must be finite";break;default:s=e.defaultError,x.assertNever(t)}return{message:s}};let Ve=J;function Lt(t){Ve=t}function _e(){return Ve}const xe=t=>{const{data:e,path:s,errorMaps:n,issueData:r}=t,a=[...s,...r.path||[]],i={...r,path:a};if(r.message!==void 0)return{...r,path:a,message:r.message};let o="";const d=n.filter(u=>!!u).slice().reverse();for(const u of d)o=u(i,{data:e,defaultError:o}).message;return{...r,path:a,message:o}},Vt=[];function l(t,e){const s=_e(),n=xe({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,s,s===J?void 0:J].filter(r=>!!r)});t.common.issues.push(n)}class S{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 r of s){if(r.status==="aborted")return y;r.status==="dirty"&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,s){const n=[];for(const r of s){const a=await r.key,i=await r.value;n.push({key:a,value:i})}return S.mergeObjectSync(e,n)}static mergeObjectSync(e,s){const n={};for(const r of s){const{key:a,value:i}=r;if(a.status==="aborted"||i.status==="aborted")return y;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||r.alwaysSet)&&(n[a.value]=i.value)}return{status:e.value,value:n}}}const y=Object.freeze({status:"aborted"}),H=t=>({status:"dirty",value:t}),R=t=>({status:"valid",value:t}),Ze=t=>t.status==="aborted",Ie=t=>t.status==="dirty",se=t=>t.status==="valid",ne=t=>typeof Promise<"u"&&t instanceof Promise;function be(t,e,s,n){if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(t)}function Be(t,e,s,n,r){if(typeof e=="function"?t!==e||!r:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,s),s}var p;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(p||(p={}));var F,ee;class O{constructor(e,s,n,r){this._cachedPath=[],this.parent=e,this.data=s,this._path=n,this._key=r}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Ue=(t,e)=>{if(se(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 M(t.common.issues);return this._error=s,this._error}}};function v(t){if(!t)return{};const{errorMap:e,invalid_type_error:s,required_error:n,description:r}=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:r}:{errorMap:(i,o)=>{var d,u;const{message:g}=t;return i.code==="invalid_enum_value"?{message:g??o.defaultError}:typeof o.data>"u"?{message:(d=g??n)!==null&&d!==void 0?d:o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:(u=g??s)!==null&&u!==void 0?u:o.defaultError}},description:r}}class _{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)}get description(){return this._def.description}_getType(e){return P(e.data)}_getOrReturnCtx(e,s){return s||{common:e.parent.common,data:e.data,parsedType:P(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new S,ctx:{common:e.parent.common,data:e.data,parsedType:P(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const s=this._parse(e);if(ne(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){var n;const r={common:{issues:[],async:(n=s==null?void 0:s.async)!==null&&n!==void 0?n:!1,contextualErrorMap:s==null?void 0:s.errorMap},path:(s==null?void 0:s.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:P(e)},a=this._parseSync({data:e,path:r.path,parent:r});return Ue(r,a)}async parseAsync(e,s){const n=await this.safeParseAsync(e,s);if(n.success)return n.data;throw n.error}async safeParseAsync(e,s){const n={common:{issues:[],contextualErrorMap:s==null?void 0:s.errorMap,async:!0},path:(s==null?void 0:s.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:P(e)},r=this._parse({data:e,path:n.path,parent:n}),a=await(ne(r)?r:Promise.resolve(r));return Ue(n,a)}refine(e,s){const n=r=>typeof s=="string"||typeof s>"u"?{message:s}:typeof s=="function"?s(r):s;return this._refinement((r,a)=>{const i=e(r),o=()=>a.addIssue({code:c.custom,...n(r)});return typeof Promise<"u"&&i instanceof Promise?i.then(d=>d?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,s){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof s=="function"?s(n,r):s),!1))}_refinement(e){return new Z({schema:this,typeName:m.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return N.create(this,this._def)}nullable(){return L.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return C.create(this,this._def)}promise(){return K.create(this,this._def)}or(e){return oe.create([this,e],this._def)}and(e){return ce.create(this,e,this._def)}transform(e){return new Z({...v(this._def),schema:this,typeName:m.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const s=typeof e=="function"?e:()=>e;return new he({...v(this._def),innerType:this,defaultValue:s,typeName:m.ZodDefault})}brand(){return new Oe({typeName:m.ZodBranded,type:this,...v(this._def)})}catch(e){const s=typeof e=="function"?e:()=>e;return new pe({...v(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 ge.create(this,e)}readonly(){return me.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Bt=/^c[^\s-]{8,}$/i,Dt=/^[0-9a-z]+$/,zt=/^[0-9A-HJKMNP-TV-Z]{26}$/,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,Wt=/^[a-z0-9_-]{21}$/i,Ht=/^[-+]?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)?)??$/,Yt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Jt="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Ee;const Xt=/^(?:(?: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])$/,Kt=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Ft=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,De="((\\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])))",es=new RegExp(`^${De}$`);function ze(t){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`),e}function ts(t){return new RegExp(`^${ze(t)}$`)}function Qe(t){let e=`${De}T${ze(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 ss(t,e){return!!((e==="v4"||!e)&&Xt.test(t)||(e==="v6"||!e)&&Kt.test(t))}class E extends _{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==f.string){const a=this._getOrReturnCtx(e);return l(a,{code:c.invalid_type,expected:f.string,received:a.parsedType}),y}const n=new S;let r;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(r=this._getOrReturnCtx(e,r),l(r,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")e.data.length>a.value&&(r=this._getOrReturnCtx(e,r),l(r,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){const i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(r=this._getOrReturnCtx(e,r),i?l(r,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&l(r,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")Yt.test(e.data)||(r=this._getOrReturnCtx(e,r),l(r,{validation:"email",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")Ee||(Ee=new RegExp(Jt,"u")),Ee.test(e.data)||(r=this._getOrReturnCtx(e,r),l(r,{validation:"emoji",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")Qt.test(e.data)||(r=this._getOrReturnCtx(e,r),l(r,{validation:"uuid",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")Wt.test(e.data)||(r=this._getOrReturnCtx(e,r),l(r,{validation:"nanoid",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")Bt.test(e.data)||(r=this._getOrReturnCtx(e,r),l(r,{validation:"cuid",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")Dt.test(e.data)||(r=this._getOrReturnCtx(e,r),l(r,{validation:"cuid2",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")zt.test(e.data)||(r=this._getOrReturnCtx(e,r),l(r,{validation:"ulid",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),l(r,{validation:"url",code:c.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),l(r,{validation:"regex",code:c.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(r=this._getOrReturnCtx(e,r),l(r,{code:c.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(r=this._getOrReturnCtx(e,r),l(r,{code:c.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(r=this._getOrReturnCtx(e,r),l(r,{code:c.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?Qe(a).test(e.data)||(r=this._getOrReturnCtx(e,r),l(r,{code:c.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?es.test(e.data)||(r=this._getOrReturnCtx(e,r),l(r,{code:c.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?ts(a).test(e.data)||(r=this._getOrReturnCtx(e,r),l(r,{code:c.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?Ht.test(e.data)||(r=this._getOrReturnCtx(e,r),l(r,{validation:"duration",code:c.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?ss(e.data,a.version)||(r=this._getOrReturnCtx(e,r),l(r,{validation:"ip",code:c.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?Ft.test(e.data)||(r=this._getOrReturnCtx(e,r),l(r,{validation:"base64",code:c.invalid_string,message:a.message}),n.dirty()):x.assertNever(a);return{status:n.value,value:e.data}}_regex(e,s,n){return this.refinement(r=>e.test(r),{validation:s,code:c.invalid_string,...p.errToObj(n)})}_addCheck(e){return new E({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...p.errToObj(e)})}url(e){return this._addCheck({kind:"url",...p.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...p.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...p.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...p.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...p.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...p.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...p.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...p.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...p.errToObj(e)})}datetime(e){var s,n;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:(s=e==null?void 0:e.offset)!==null&&s!==void 0?s:!1,local:(n=e==null?void 0:e.local)!==null&&n!==void 0?n:!1,...p.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...p.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...p.errToObj(e)})}regex(e,s){return this._addCheck({kind:"regex",regex:e,...p.errToObj(s)})}includes(e,s){return this._addCheck({kind:"includes",value:e,position:s==null?void 0:s.position,...p.errToObj(s==null?void 0:s.message)})}startsWith(e,s){return this._addCheck({kind:"startsWith",value:e,...p.errToObj(s)})}endsWith(e,s){return this._addCheck({kind:"endsWith",value:e,...p.errToObj(s)})}min(e,s){return this._addCheck({kind:"min",value:e,...p.errToObj(s)})}max(e,s){return this._addCheck({kind:"max",value:e,...p.errToObj(s)})}length(e,s){return this._addCheck({kind:"length",value:e,...p.errToObj(s)})}nonempty(e){return this.min(1,p.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 isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}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=>{var e;return new E({checks:[],typeName:m.ZodString,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...v(t)})};function ns(t,e){const s=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,r=s>n?s:n,a=parseInt(t.toFixed(r).replace(".","")),i=parseInt(e.toFixed(r).replace(".",""));return a%i/Math.pow(10,r)}class $ extends _{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==f.number){const a=this._getOrReturnCtx(e);return l(a,{code:c.invalid_type,expected:f.number,received:a.parsedType}),y}let n;const r=new S;for(const a of this._def.checks)a.kind==="int"?x.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{code:c.invalid_type,expected:"integer",received:"float",message:a.message}),r.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty()):a.kind==="multipleOf"?ns(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{code:c.not_finite,message:a.message}),r.dirty()):x.assertNever(a);return{status:r.value,value:e.data}}gte(e,s){return this.setLimit("min",e,!0,p.toString(s))}gt(e,s){return this.setLimit("min",e,!1,p.toString(s))}lte(e,s){return this.setLimit("max",e,!0,p.toString(s))}lt(e,s){return this.setLimit("max",e,!1,p.toString(s))}setLimit(e,s,n,r){return new $({...this._def,checks:[...this._def.checks,{kind:e,value:s,inclusive:n,message:p.toString(r)}]})}_addCheck(e){return new $({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:p.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:p.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:p.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:p.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:p.toString(e)})}multipleOf(e,s){return this._addCheck({kind:"multipleOf",value:e,message:p.toString(s)})}finite(e){return this._addCheck({kind:"finite",message:p.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:p.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:p.toString(e)})}get minValue(){let e=null;for(const 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"&&x.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)}}$.create=t=>new $({checks:[],typeName:m.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...v(t)});class U extends _{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==f.bigint){const a=this._getOrReturnCtx(e);return l(a,{code:c.invalid_type,expected:f.bigint,received:a.parsedType}),y}let n;const r=new S;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),r.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),r.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):x.assertNever(a);return{status:r.value,value:e.data}}gte(e,s){return this.setLimit("min",e,!0,p.toString(s))}gt(e,s){return this.setLimit("min",e,!1,p.toString(s))}lte(e,s){return this.setLimit("max",e,!0,p.toString(s))}lt(e,s){return this.setLimit("max",e,!1,p.toString(s))}setLimit(e,s,n,r){return new U({...this._def,checks:[...this._def.checks,{kind:e,value:s,inclusive:n,message:p.toString(r)}]})}_addCheck(e){return new U({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:p.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:p.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:p.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:p.toString(e)})}multipleOf(e,s){return this._addCheck({kind:"multipleOf",value:e,message:p.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}}U.create=t=>{var e;return new U({checks:[],typeName:m.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...v(t)})};class re extends _{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==f.boolean){const n=this._getOrReturnCtx(e);return l(n,{code:c.invalid_type,expected:f.boolean,received:n.parsedType}),y}return R(e.data)}}re.create=t=>new re({typeName:m.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...v(t)});class D extends _{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==f.date){const a=this._getOrReturnCtx(e);return l(a,{code:c.invalid_type,expected:f.date,received:a.parsedType}),y}if(isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return l(a,{code:c.invalid_date}),y}const n=new S;let r;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(r=this._getOrReturnCtx(e,r),l(r,{code:c.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(r=this._getOrReturnCtx(e,r),l(r,{code:c.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):x.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new D({...this._def,checks:[...this._def.checks,e]})}min(e,s){return this._addCheck({kind:"min",value:e.getTime(),message:p.toString(s)})}max(e,s){return this._addCheck({kind:"max",value:e.getTime(),message:p.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}}D.create=t=>new D({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:m.ZodDate,...v(t)});class we extends _{_parse(e){if(this._getType(e)!==f.symbol){const n=this._getOrReturnCtx(e);return l(n,{code:c.invalid_type,expected:f.symbol,received:n.parsedType}),y}return R(e.data)}}we.create=t=>new we({typeName:m.ZodSymbol,...v(t)});class ae extends _{_parse(e){if(this._getType(e)!==f.undefined){const n=this._getOrReturnCtx(e);return l(n,{code:c.invalid_type,expected:f.undefined,received:n.parsedType}),y}return R(e.data)}}ae.create=t=>new ae({typeName:m.ZodUndefined,...v(t)});class ie extends _{_parse(e){if(this._getType(e)!==f.null){const n=this._getOrReturnCtx(e);return l(n,{code:c.invalid_type,expected:f.null,received:n.parsedType}),y}return R(e.data)}}ie.create=t=>new ie({typeName:m.ZodNull,...v(t)});class X extends _{constructor(){super(...arguments),this._any=!0}_parse(e){return R(e.data)}}X.create=t=>new X({typeName:m.ZodAny,...v(t)});class B extends _{constructor(){super(...arguments),this._unknown=!0}_parse(e){return R(e.data)}}B.create=t=>new B({typeName:m.ZodUnknown,...v(t)});class j extends _{_parse(e){const s=this._getOrReturnCtx(e);return l(s,{code:c.invalid_type,expected:f.never,received:s.parsedType}),y}}j.create=t=>new j({typeName:m.ZodNever,...v(t)});class ke extends _{_parse(e){if(this._getType(e)!==f.undefined){const n=this._getOrReturnCtx(e);return l(n,{code:c.invalid_type,expected:f.void,received:n.parsedType}),y}return R(e.data)}}ke.create=t=>new ke({typeName:m.ZodVoid,...v(t)});class C extends _{_parse(e){const{ctx:s,status:n}=this._processInputParams(e),r=this._def;if(s.parsedType!==f.array)return l(s,{code:c.invalid_type,expected:f.array,received:s.parsedType}),y;if(r.exactLength!==null){const i=s.data.length>r.exactLength.value,o=s.data.length<r.exactLength.value;(i||o)&&(l(s,{code:i?c.too_big:c.too_small,minimum:o?r.exactLength.value:void 0,maximum:i?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(r.minLength!==null&&s.data.length<r.minLength.value&&(l(s,{code:c.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),r.maxLength!==null&&s.data.length>r.maxLength.value&&(l(s,{code:c.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),s.common.async)return Promise.all([...s.data].map((i,o)=>r.type._parseAsync(new O(s,i,s.path,o)))).then(i=>S.mergeArray(n,i));const a=[...s.data].map((i,o)=>r.type._parseSync(new O(s,i,s.path,o)));return S.mergeArray(n,a)}get element(){return this._def.type}min(e,s){return new C({...this._def,minLength:{value:e,message:p.toString(s)}})}max(e,s){return new C({...this._def,maxLength:{value:e,message:p.toString(s)}})}length(e,s){return new C({...this._def,exactLength:{value:e,message:p.toString(s)}})}nonempty(e){return this.min(1,e)}}C.create=(t,e)=>new C({type:t,minLength:null,maxLength:null,exactLength:null,typeName:m.ZodArray,...v(e)});function W(t){if(t instanceof b){const e={};for(const s in t.shape){const n=t.shape[s];e[s]=N.create(W(n))}return new b({...t._def,shape:()=>e})}else return t instanceof C?new C({...t._def,type:W(t.element)}):t instanceof N?N.create(W(t.unwrap())):t instanceof L?L.create(W(t.unwrap())):t instanceof A?A.create(t.items.map(e=>W(e))):t}class b extends _{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=x.objectKeys(e);return this._cached={shape:e,keys:s}}_parse(e){if(this._getType(e)!==f.object){const u=this._getOrReturnCtx(e);return l(u,{code:c.invalid_type,expected:f.object,received:u.parsedType}),y}const{status:n,ctx:r}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof j&&this._def.unknownKeys==="strip"))for(const u in r.data)i.includes(u)||o.push(u);const d=[];for(const u of i){const g=a[u],T=r.data[u];d.push({key:{status:"valid",value:u},value:g._parse(new O(r,T,r.path,u)),alwaysSet:u in r.data})}if(this._def.catchall instanceof j){const u=this._def.unknownKeys;if(u==="passthrough")for(const g of o)d.push({key:{status:"valid",value:g},value:{status:"valid",value:r.data[g]}});else if(u==="strict")o.length>0&&(l(r,{code:c.unrecognized_keys,keys:o}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const g of o){const T=r.data[g];d.push({key:{status:"valid",value:g},value:u._parse(new O(r,T,r.path,g)),alwaysSet:g in r.data})}}return r.common.async?Promise.resolve().then(async()=>{const u=[];for(const g of d){const T=await g.key,V=await g.value;u.push({key:T,value:V,alwaysSet:g.alwaysSet})}return u}).then(u=>S.mergeObjectSync(n,u)):S.mergeObjectSync(n,d)}get shape(){return this._def.shape()}strict(e){return p.errToObj,new b({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(s,n)=>{var r,a,i,o;const d=(i=(a=(r=this._def).errorMap)===null||a===void 0?void 0:a.call(r,s,n).message)!==null&&i!==void 0?i:n.defaultError;return s.code==="unrecognized_keys"?{message:(o=p.errToObj(e).message)!==null&&o!==void 0?o:d}:{message:d}}}:{}})}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={};return x.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(s[n]=this.shape[n])}),new b({...this._def,shape:()=>s})}omit(e){const s={};return x.objectKeys(this.shape).forEach(n=>{e[n]||(s[n]=this.shape[n])}),new b({...this._def,shape:()=>s})}deepPartial(){return W(this)}partial(e){const s={};return x.objectKeys(this.shape).forEach(n=>{const r=this.shape[n];e&&!e[n]?s[n]=r:s[n]=r.optional()}),new b({...this._def,shape:()=>s})}required(e){const s={};return x.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])s[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof N;)a=a._def.innerType;s[n]=a}}),new b({...this._def,shape:()=>s})}keyof(){return We(x.objectKeys(this.shape))}}b.create=(t,e)=>new b({shape:()=>t,unknownKeys:"strip",catchall:j.create(),typeName:m.ZodObject,...v(e)});b.strictCreate=(t,e)=>new b({shape:()=>t,unknownKeys:"strict",catchall:j.create(),typeName:m.ZodObject,...v(e)});b.lazycreate=(t,e)=>new b({shape:t,unknownKeys:"strip",catchall:j.create(),typeName:m.ZodObject,...v(e)});class oe extends _{_parse(e){const{ctx:s}=this._processInputParams(e),n=this._def.options;function r(a){for(const o of a)if(o.result.status==="valid")return o.result;for(const o of a)if(o.result.status==="dirty")return s.common.issues.push(...o.ctx.common.issues),o.result;const i=a.map(o=>new M(o.ctx.common.issues));return l(s,{code:c.invalid_union,unionErrors:i}),y}if(s.common.async)return Promise.all(n.map(async a=>{const i={...s,common:{...s.common,issues:[]},parent:null};return{result:await a._parseAsync({data:s.data,path:s.path,parent:i}),ctx:i}})).then(r);{let a;const i=[];for(const d of n){const u={...s,common:{...s.common,issues:[]},parent:null},g=d._parseSync({data:s.data,path:s.path,parent:u});if(g.status==="valid")return g;g.status==="dirty"&&!a&&(a={result:g,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(a)return s.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(d=>new M(d));return l(s,{code:c.invalid_union,unionErrors:o}),y}}get options(){return this._def.options}}oe.create=(t,e)=>new oe({options:t,typeName:m.ZodUnion,...v(e)});const q=t=>t instanceof de?q(t.schema):t instanceof Z?q(t.innerType()):t instanceof le?[t.value]:t instanceof G?t.options:t instanceof fe?x.objectValues(t.enum):t instanceof he?q(t._def.innerType):t instanceof ae?[void 0]:t instanceof ie?[null]:t instanceof N?[void 0,...q(t.unwrap())]:t instanceof L?[null,...q(t.unwrap())]:t instanceof Oe||t instanceof me?q(t.unwrap()):t instanceof pe?q(t._def.innerType):[];class Te extends _{_parse(e){const{ctx:s}=this._processInputParams(e);if(s.parsedType!==f.object)return l(s,{code:c.invalid_type,expected:f.object,received:s.parsedType}),y;const n=this.discriminator,r=s.data[n],a=this.optionsMap.get(r);return a?s.common.async?a._parseAsync({data:s.data,path:s.path,parent:s}):a._parseSync({data:s.data,path:s.path,parent:s}):(l(s,{code:c.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),y)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,s,n){const r=new Map;for(const a of s){const i=q(a.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of i){if(r.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);r.set(o,a)}}return new Te({typeName:m.ZodDiscriminatedUnion,discriminator:e,options:s,optionsMap:r,...v(n)})}}function Ne(t,e){const s=P(t),n=P(e);if(t===e)return{valid:!0,data:t};if(s===f.object&&n===f.object){const r=x.objectKeys(e),a=x.objectKeys(t).filter(o=>r.indexOf(o)!==-1),i={...t,...e};for(const o of a){const d=Ne(t[o],e[o]);if(!d.valid)return{valid:!1};i[o]=d.data}return{valid:!0,data:i}}else if(s===f.array&&n===f.array){if(t.length!==e.length)return{valid:!1};const r=[];for(let a=0;a<t.length;a++){const i=t[a],o=e[a],d=Ne(i,o);if(!d.valid)return{valid:!1};r.push(d.data)}return{valid:!0,data:r}}else return s===f.date&&n===f.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class ce extends _{_parse(e){const{status:s,ctx:n}=this._processInputParams(e),r=(a,i)=>{if(Ze(a)||Ze(i))return y;const o=Ne(a.value,i.value);return o.valid?((Ie(a)||Ie(i))&&s.dirty(),{status:s.value,value:o.data}):(l(n,{code:c.invalid_intersection_types}),y)};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(([a,i])=>r(a,i)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}ce.create=(t,e,s)=>new ce({left:t,right:e,typeName:m.ZodIntersection,...v(s)});class A extends _{_parse(e){const{status:s,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.array)return l(n,{code:c.invalid_type,expected:f.array,received:n.parsedType}),y;if(n.data.length<this._def.items.length)return l(n,{code:c.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),y;!this._def.rest&&n.data.length>this._def.items.length&&(l(n,{code:c.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),s.dirty());const a=[...n.data].map((i,o)=>{const d=this._def.items[o]||this._def.rest;return d?d._parse(new O(n,i,n.path,o)):null}).filter(i=>!!i);return n.common.async?Promise.all(a).then(i=>S.mergeArray(s,i)):S.mergeArray(s,a)}get items(){return this._def.items}rest(e){return new A({...this._def,rest:e})}}A.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new A({items:t,typeName:m.ZodTuple,rest:null,...v(e)})};class ue extends _{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:s,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.object)return l(n,{code:c.invalid_type,expected:f.object,received:n.parsedType}),y;const r=[],a=this._def.keyType,i=this._def.valueType;for(const o in n.data)r.push({key:a._parse(new O(n,o,n.path,o)),value:i._parse(new O(n,n.data[o],n.path,o)),alwaysSet:o in n.data});return n.common.async?S.mergeObjectAsync(s,r):S.mergeObjectSync(s,r)}get element(){return this._def.valueType}static create(e,s,n){return s instanceof _?new ue({keyType:e,valueType:s,typeName:m.ZodRecord,...v(n)}):new ue({keyType:E.create(),valueType:e,typeName:m.ZodRecord,...v(s)})}}class Se extends _{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:s,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.map)return l(n,{code:c.invalid_type,expected:f.map,received:n.parsedType}),y;const r=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([o,d],u)=>({key:r._parse(new O(n,o,n.path,[u,"key"])),value:a._parse(new O(n,d,n.path,[u,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const d of i){const u=await d.key,g=await d.value;if(u.status==="aborted"||g.status==="aborted")return y;(u.status==="dirty"||g.status==="dirty")&&s.dirty(),o.set(u.value,g.value)}return{status:s.value,value:o}})}else{const o=new Map;for(const d of i){const u=d.key,g=d.value;if(u.status==="aborted"||g.status==="aborted")return y;(u.status==="dirty"||g.status==="dirty")&&s.dirty(),o.set(u.value,g.value)}return{status:s.value,value:o}}}}Se.create=(t,e,s)=>new Se({valueType:e,keyType:t,typeName:m.ZodMap,...v(s)});class z extends _{_parse(e){const{status:s,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.set)return l(n,{code:c.invalid_type,expected:f.set,received:n.parsedType}),y;const r=this._def;r.minSize!==null&&n.data.size<r.minSize.value&&(l(n,{code:c.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),s.dirty()),r.maxSize!==null&&n.data.size>r.maxSize.value&&(l(n,{code:c.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),s.dirty());const a=this._def.valueType;function i(d){const u=new Set;for(const g of d){if(g.status==="aborted")return y;g.status==="dirty"&&s.dirty(),u.add(g.value)}return{status:s.value,value:u}}const o=[...n.data.values()].map((d,u)=>a._parse(new O(n,d,n.path,u)));return n.common.async?Promise.all(o).then(d=>i(d)):i(o)}min(e,s){return new z({...this._def,minSize:{value:e,message:p.toString(s)}})}max(e,s){return new z({...this._def,maxSize:{value:e,message:p.toString(s)}})}size(e,s){return this.min(e,s).max(e,s)}nonempty(e){return this.min(1,e)}}z.create=(t,e)=>new z({valueType:t,minSize:null,maxSize:null,typeName:m.ZodSet,...v(e)});class Y extends _{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:s}=this._processInputParams(e);if(s.parsedType!==f.function)return l(s,{code:c.invalid_type,expected:f.function,received:s.parsedType}),y;function n(o,d){return xe({data:o,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,_e(),J].filter(u=>!!u),issueData:{code:c.invalid_arguments,argumentsError:d}})}function r(o,d){return xe({data:o,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,_e(),J].filter(u=>!!u),issueData:{code:c.invalid_return_type,returnTypeError:d}})}const a={errorMap:s.common.contextualErrorMap},i=s.data;if(this._def.returns instanceof K){const o=this;return R(async function(...d){const u=new M([]),g=await o._def.args.parseAsync(d,a).catch(Me=>{throw u.addIssue(n(d,Me)),u}),T=await Reflect.apply(i,this,g);return await o._def.returns._def.type.parseAsync(T,a).catch(Me=>{throw u.addIssue(r(T,Me)),u})})}else{const o=this;return R(function(...d){const u=o._def.args.safeParse(d,a);if(!u.success)throw new M([n(d,u.error)]);const g=Reflect.apply(i,this,u.data),T=o._def.returns.safeParse(g,a);if(!T.success)throw new M([r(g,T.error)]);return T.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Y({...this._def,args:A.create(e).rest(B.create())})}returns(e){return new Y({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,s,n){return new Y({args:e||A.create([]).rest(B.create()),returns:s||B.create(),typeName:m.ZodFunction,...v(n)})}}class de extends _{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})}}de.create=(t,e)=>new de({getter:t,typeName:m.ZodLazy,...v(e)});class le extends _{_parse(e){if(e.data!==this._def.value){const s=this._getOrReturnCtx(e);return l(s,{received:s.data,code:c.invalid_literal,expected:this._def.value}),y}return{status:"valid",value:e.data}}get value(){return this._def.value}}le.create=(t,e)=>new le({value:t,typeName:m.ZodLiteral,...v(e)});function We(t,e){return new G({values:t,typeName:m.ZodEnum,...v(e)})}class G extends _{constructor(){super(...arguments),F.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const s=this._getOrReturnCtx(e),n=this._def.values;return l(s,{expected:x.joinValues(n),received:s.parsedType,code:c.invalid_type}),y}if(be(this,F)||Be(this,F,new Set(this._def.values)),!be(this,F).has(e.data)){const s=this._getOrReturnCtx(e),n=this._def.values;return l(s,{received:s.data,code:c.invalid_enum_value,options:n}),y}return R(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 G.create(e,{...this._def,...s})}exclude(e,s=this._def){return G.create(this.options.filter(n=>!e.includes(n)),{...this._def,...s})}}F=new WeakMap;G.create=We;class fe extends _{constructor(){super(...arguments),ee.set(this,void 0)}_parse(e){const s=x.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==f.string&&n.parsedType!==f.number){const r=x.objectValues(s);return l(n,{expected:x.joinValues(r),received:n.parsedType,code:c.invalid_type}),y}if(be(this,ee)||Be(this,ee,new Set(x.getValidEnumValues(this._def.values))),!be(this,ee).has(e.data)){const r=x.objectValues(s);return l(n,{received:n.data,code:c.invalid_enum_value,options:r}),y}return R(e.data)}get enum(){return this._def.values}}ee=new WeakMap;fe.create=(t,e)=>new fe({values:t,typeName:m.ZodNativeEnum,...v(e)});class K extends _{unwrap(){return this._def.type}_parse(e){const{ctx:s}=this._processInputParams(e);if(s.parsedType!==f.promise&&s.common.async===!1)return l(s,{code:c.invalid_type,expected:f.promise,received:s.parsedType}),y;const n=s.parsedType===f.promise?s.data:Promise.resolve(s.data);return R(n.then(r=>this._def.type.parseAsync(r,{path:s.path,errorMap:s.common.contextualErrorMap})))}}K.create=(t,e)=>new K({type:t,typeName:m.ZodPromise,...v(e)});class Z extends _{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),r=this._def.effect||null,a={addIssue:i=>{l(n,i),i.fatal?s.abort():s.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),r.type==="preprocess"){const i=r.transform(n.data,a);if(n.common.async)return Promise.resolve(i).then(async o=>{if(s.value==="aborted")return y;const d=await this._def.schema._parseAsync({data:o,path:n.path,parent:n});return d.status==="aborted"?y:d.status==="dirty"||s.value==="dirty"?H(d.value):d});{if(s.value==="aborted")return y;const o=this._def.schema._parseSync({data:i,path:n.path,parent:n});return o.status==="aborted"?y:o.status==="dirty"||s.value==="dirty"?H(o.value):o}}if(r.type==="refinement"){const i=o=>{const d=r.refinement(o,a);if(n.common.async)return Promise.resolve(d);if(d instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?y:(o.status==="dirty"&&s.dirty(),i(o.value),{status:s.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?y:(o.status==="dirty"&&s.dirty(),i(o.value).then(()=>({status:s.value,value:o.value}))))}if(r.type==="transform")if(n.common.async===!1){const i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!se(i))return i;const o=r.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:s.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>se(i)?Promise.resolve(r.transform(i.value,a)).then(o=>({status:s.value,value:o})):i);x.assertNever(r)}}Z.create=(t,e,s)=>new Z({schema:t,typeName:m.ZodEffects,effect:e,...v(s)});Z.createWithPreprocess=(t,e,s)=>new Z({schema:e,effect:{type:"preprocess",transform:t},typeName:m.ZodEffects,...v(s)});class N extends _{_parse(e){return this._getType(e)===f.undefined?R(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}N.create=(t,e)=>new N({innerType:t,typeName:m.ZodOptional,...v(e)});class L extends _{_parse(e){return this._getType(e)===f.null?R(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}L.create=(t,e)=>new L({innerType:t,typeName:m.ZodNullable,...v(e)});class he extends _{_parse(e){const{ctx:s}=this._processInputParams(e);let n=s.data;return s.parsedType===f.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:s.path,parent:s})}removeDefault(){return this._def.innerType}}he.create=(t,e)=>new he({innerType:t,typeName:m.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...v(e)});class pe extends _{_parse(e){const{ctx:s}=this._processInputParams(e),n={...s,common:{...s.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return ne(r)?r.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new M(n.common.issues)},input:n.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new M(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}pe.create=(t,e)=>new pe({innerType:t,typeName:m.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...v(e)});class Re extends _{_parse(e){if(this._getType(e)!==f.nan){const n=this._getOrReturnCtx(e);return l(n,{code:c.invalid_type,expected:f.nan,received:n.parsedType}),y}return{status:"valid",value:e.data}}}Re.create=t=>new Re({typeName:m.ZodNaN,...v(t)});const rs=Symbol("zod_brand");class Oe extends _{_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 ge extends _{_parse(e){const{status:s,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?y:a.status==="dirty"?(s.dirty(),H(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{const r=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return r.status==="aborted"?y:r.status==="dirty"?(s.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:n.path,parent:n})}}static create(e,s){return new ge({in:e,out:s,typeName:m.ZodPipeline})}}class me extends _{_parse(e){const s=this._def.innerType._parse(e),n=r=>(se(r)&&(r.value=Object.freeze(r.value)),r);return ne(s)?s.then(r=>n(r)):n(s)}unwrap(){return this._def.innerType}}me.create=(t,e)=>new me({innerType:t,typeName:m.ZodReadonly,...v(e)});function He(t,e={},s){return t?X.create().superRefine((n,r)=>{var a,i;if(!t(n)){const o=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,d=(i=(a=o.fatal)!==null&&a!==void 0?a:s)!==null&&i!==void 0?i:!0,u=typeof o=="string"?{message:o}:o;r.addIssue({code:"custom",...u,fatal:d})}}):X.create()}const as={object: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 is=(t,e={message:`Input not instance of ${t.name}`})=>He(s=>s instanceof t,e),Ye=E.create,Je=$.create,os=Re.create,cs=U.create,Xe=re.create,us=D.create,ds=we.create,ls=ae.create,fs=ie.create,hs=X.create,ps=B.create,ms=j.create,gs=ke.create,ys=C.create,vs=b.create,_s=b.strictCreate,xs=oe.create,bs=Te.create,ws=ce.create,ks=A.create,Ss=ue.create,Rs=Se.create,Ts=z.create,Ms=Y.create,Es=de.create,Cs=le.create,Zs=G.create,Is=fe.create,Ns=K.create,Ge=Z.create,Os=N.create,As=L.create,qs=Z.createWithPreprocess,js=ge.create,Ps=()=>Ye().optional(),$s=()=>Je().optional(),Us=()=>Xe().optional(),Gs={string:t=>E.create({...t,coerce:!0}),number:t=>$.create({...t,coerce:!0}),boolean:t=>re.create({...t,coerce:!0}),bigint:t=>U.create({...t,coerce:!0}),date:t=>D.create({...t,coerce:!0})},Ls=y;var h=Object.freeze({__proto__:null,defaultErrorMap:J,setErrorMap:Lt,getErrorMap:_e,makeIssue:xe,EMPTY_PATH:Vt,addIssueToContext:l,ParseStatus:S,INVALID:y,DIRTY:H,OK:R,isAborted:Ze,isDirty:Ie,isValid:se,isAsync:ne,get util(){return x},get objectUtil(){return Ce},ZodParsedType:f,getParsedType:P,ZodType:_,datetimeRegex:Qe,ZodString:E,ZodNumber:$,ZodBigInt:U,ZodBoolean:re,ZodDate:D,ZodSymbol:we,ZodUndefined:ae,ZodNull:ie,ZodAny:X,ZodUnknown:B,ZodNever:j,ZodVoid:ke,ZodArray:C,ZodObject:b,ZodUnion:oe,ZodDiscriminatedUnion:Te,ZodIntersection:ce,ZodTuple:A,ZodRecord:ue,ZodMap:Se,ZodSet:z,ZodFunction:Y,ZodLazy:de,ZodLiteral:le,ZodEnum:G,ZodNativeEnum:fe,ZodPromise:K,ZodEffects:Z,ZodTransformer:Z,ZodOptional:N,ZodNullable:L,ZodDefault:he,ZodCatch:pe,ZodNaN:Re,BRAND:rs,ZodBranded:Oe,ZodPipeline:ge,ZodReadonly:me,custom:He,Schema:_,ZodSchema:_,late:as,get ZodFirstPartyTypeKind(){return m},coerce:Gs,any:hs,array:ys,bigint:cs,boolean:Xe,date:us,discriminatedUnion:bs,effect:Ge,enum:Zs,function:Ms,instanceof:is,intersection:ws,lazy:Es,literal:Cs,map:Rs,nan:os,nativeEnum:Is,never:ms,null:fs,nullable:As,number:Je,object:vs,oboolean:Us,onumber:$s,optional:Os,ostring:Ps,pipeline:js,preprocess:qs,promise:Ns,record:Ss,set:Ts,strictObject:_s,string:Ye,symbol:ds,transformer:Ge,tuple:ks,undefined:ls,union:xs,unknown:ps,void:gs,NEVER:Ls,ZodIssueCode:c,quotelessJson:Gt,ZodError:M});const w=h.object({type:h.literal("qp-bridge"),id:h.string().optional()}),Ke=w.extend({status:h.literal("answerChanged"),question:h.string(),answer:h.unknown()}),Q=w.extend({status:h.literal("success")}),Fe=w.extend({status:h.literal("error"),message:h.string()}),Ae=h.object({semanticColor:h.string().optional(),label:h.string(),description:h.string(),disabled:h.boolean(),required:h.boolean(),hidden:h.boolean(),errorMessage:h.string().optional(),answer:h.unknown().optional()}),et=Ae.partial(),tt=h.object({id:h.string().uuid(),name:h.string(),mimeType:h.string(),blobUrl:h.string()}),qe=h.record(h.unknown()),je=h.object({label:h.string(),hidden:h.boolean(),collapsed:h.boolean()}),st=je.partial(),nt=w.extend({action:h.literal("getQuestion"),question:h.string()}),rt=Q.extend({question:Ae}),at=w.extend({action:h.literal("setQuestion"),question:h.string(),questionData:et}),it=w.extend({action:h.literal("getGroup"),group:h.string()}),ot=Q.extend({group:je}),ct=Q.extend({canSave:h.boolean()}),ut=w.extend({action:h.literal("canSave")}),dt=w.extend({action:h.literal("setGroup"),group:h.string(),groupData:st}),lt=w.extend({action:h.literal("setAnswer"),question:h.string(),answer:h.unknown()}),ft=w.extend({action:h.literal("busyIndicatorStart")}),ht=w.extend({action:h.literal("busyIndicatorEnd")}),pt=w.extend({action:h.literal("saveQuestionnaire")}),mt=w.extend({action:h.literal("completeAndCloseQuestionnaire")}),gt=w.extend({action:h.literal("executeCustomCommand"),commandName:h.string()}),yt=w.extend({action:h.literal("fetchEntities"),fetchXml:h.string()}),vt=Q.extend({entities:h.array(qe)}),_t=w.extend({action:h.literal("getEntityById"),entityName:h.string(),entityId:h.string()}),xt=Q.extend({entity:qe}),bt=w.extend({action:h.literal("repeatGroup"),parentGroupName:h.string(),groupIndex:h.number()}),wt=w.extend({action:h.literal("addNewGroup"),groupName:h.string()}),kt=w.extend({action:h.literal("deleteGroup"),parentGroupName:h.string(),groupIndex:h.number()});function Vs(t){return tt.safeParse(t).success}function St(t){return Ke.safeParse(t).success}function Pe(t){return w.safeParse(t).success}function Rt(t){return Q.safeParse(t).success}function Tt(t){return Fe.safeParse(t).success}function Bs(t){return nt.safeParse(t).success}function Mt(t){return rt.safeParse(t).success}function Ds(t){return lt.safeParse(t).success}function zs(t){return at.safeParse(t).success}function Qs(t){return dt.safeParse(t).success}function Ws(t){return it.safeParse(t).success}function Et(t){return ot.safeParse(t).success}function Hs(t){return ct.safeParse(t).success}function Ct(t){return ut.safeParse(t).success}function Zt(t){return ft.safeParse(t).success}function It(t){return ht.safeParse(t).success}function Ys(t){return pt.safeParse(t).success}function Js(t){return mt.safeParse(t).success}function Xs(t){return gt.safeParse(t).success}function Ks(t){return Zt(t)||It(t)}function Nt(t,e){return!Pe(t)||t.id!==e||!("status"in t)}function Fs(t){return yt.safeParse(t).success}function Ot(t){return vt.safeParse(t).success}function en(t){return _t.safeParse(t).success}function At(t){return xt.safeParse(t).success}function tn(t){return bt.safeParse(t).success}function sn(t){return wt.safeParse(t).success}function nn(t){return kt.safeParse(t).success}function qt(t){if(t instanceof File||t instanceof Blob)return URL.createObjectURL(t);if(typeof t=="string"){if(/^data:/.test(t)){const a=t.match(/^data:([^;]+);base64,(.*)$/);if(a){const i=a[1],o=a[2],d=atob(o),u=new ArrayBuffer(d.length),g=new Uint8Array(u);for(let V=0;V<d.length;V++)g[V]=d.charCodeAt(V);const T=new Blob([u],{type:i});return URL.createObjectURL(T)}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 a=0;a<e.length;a++)n[a]=e.charCodeAt(a);const r=new Blob([s]);return URL.createObjectURL(r)}if(t instanceof ArrayBuffer){const e=new Blob([t]);return URL.createObjectURL(e)}throw new Error("Unsupported content type for blobUrl")}function rn(t,e,s,n){return{id:n??Le(),name:t,mimeType:e,blobUrl:qt(s)}}function an(t,e){let s=t.blobUrl;return e.content!==void 0&&(s=qt(e.content)),{...t,...e,blobUrl:s}}window.addEventListener("message",vn);async function on(t,e){await I({type:"qp-bridge",action:"setAnswer",question:t,answer:e})}async function cn(t){return await Sn({type:"qp-bridge",action:"getQuestion",question:t})}async function un(t,e){await I({type:"qp-bridge",action:"setQuestion",question:t,questionData:e})}async function dn(t){return await Rn({type:"qp-bridge",action:"getGroup",group:t})}async function ln(t,e){await I({type:"qp-bridge",action:"setGroup",group:t,groupData:e})}function fn(t){const e=s=>{St(s.data)&&t(s.data.question,s.data.answer)};return window.addEventListener("message",e),{cancelSubscription:()=>{window.removeEventListener("message",e)}}}async function hn(t){await I({type:"qp-bridge",action:"busyIndicatorStart"});try{return await t()}finally{await I({type:"qp-bridge",action:"busyIndicatorEnd"})}}async function pn(){await I({type:"qp-bridge",action:"saveQuestionnaire"})}async function mn(){await I({type:"qp-bridge",action:"completeAndCloseQuestionnaire"})}async function gn(t){await I({type:"qp-bridge",action:"executeCustomCommand",commandName:t})}const te=[];function yn(t){return te.includes(t)||te.push(t),{cancelSubscription:()=>{const e=te.indexOf(t);e!==-1&&te.splice(e,1)}}}async function vn(t){try{if(Ct(t.data)){const e=await Promise.all(te.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:Pe(t.data)?t.data.id:void 0,message:e instanceof Error?e.message:"Unknown error"};window.parent.postMessage(s,"*")}}async function _n(t){return await Tn({type:"qp-bridge",action:"fetchEntities",fetchXml:t})}async function xn(t,e){return await Mn({type:"qp-bridge",action:"getEntityById",entityName:t,entityId:e})}async function bn(t,e){await I({type:"qp-bridge",action:"repeatGroup",parentGroupName:t,groupIndex:e})}async function wn(t){await I({type:"qp-bridge",action:"addNewGroup",groupName:t})}async function kn(t,e){await I({type:"qp-bridge",action:"deleteGroup",parentGroupName:t,groupIndex:e})}async function ye(t,e){return new Promise((s,n)=>{const r=Le(),a=i=>{if(Nt(i.data,r))return;const o=e(i.data);o.success?s(o.data):Tt(i.data)?n(new Error(i.data.message)):n(new Error("Unknown message received")),window.removeEventListener("message",a)};window.addEventListener("message",a),window.parent.postMessage({...t,id:r},"*")})}async function Sn(t){return ye(t,e=>Mt(e)?{success:!0,data:e.question}:{success:!1})}async function Rn(t){return ye(t,e=>Et(e)?{success:!0,data:e.group}:{success:!1})}function I(t){return ye(t,e=>Rt(e)?{success:!0,data:void 0}:{success:!1})}async function Tn(t){return ye(t,e=>Ot(e)?{success:!0,data:e.entities}:{success:!1})}async function Mn(t){return ye(t,e=>At(e)?{success:!0,data:e.entity}:{success:!1})}exports.addNewGroup=wn;exports.addNewGroupRequestMessageSchema=wt;exports.busyIndicatorEndRequestMessageSchema=ht;exports.busyIndicatorStartRequestMessageSchema=ft;exports.canSaveRequestMessageSchema=ut;exports.canSaveSuccessResponseMessageSchema=ct;exports.completeAndCloseQuestionnaire=mn;exports.completeAndCloseQuestionnaireRequestMessageSchema=mt;exports.createMediaItem=rn;exports.deleteGroup=kn;exports.deleteGroupRequestMessageSchema=kt;exports.entitySchema=qe;exports.executeCustomCommand=gn;exports.executeCustomCommandRequestMessageSchema=gt;exports.fetchEntities=_n;exports.fetchEntitiesRequestMessageSchema=yt;exports.fetchEntitiesSuccessResponseMessageSchema=vt;exports.getEntityById=xn;exports.getEntityByIdRequestMessageSchema=_t;exports.getEntityByIdSuccessResponseMessageSchema=xt;exports.getGroup=dn;exports.getGroupRequestMessageSchema=it;exports.getGroupSuccessResponseMessageSchema=ot;exports.getQuestion=cn;exports.getQuestionRequestMessageSchema=nt;exports.getQuestionSuccessResponseMessageSchema=rt;exports.groupOptionalScheme=st;exports.groupSchema=je;exports.isAddNewGroupRequestMessage=sn;exports.isBusyIndicatorEndRequestMessage=It;exports.isBusyIndicatorStartRequestMessage=Zt;exports.isCanSaveRequestMessage=Ct;exports.isCanSaveSuccessResponseMessage=Hs;exports.isCompleteAndCloseQuestionnaireRequestMessage=Js;exports.isDeleteGroupRequestMessage=nn;exports.isErrorMessage=Tt;exports.isExecuteCustomCommandRequestMessage=Xs;exports.isFetchEntitiesRequestMessage=Fs;exports.isFetchEntitiesSuccessResponseMessage=Ot;exports.isGetEntityByIdRequestMessage=en;exports.isGetEntityByIdSuccessResponseMessage=At;exports.isGetGroupRequestMessage=Ws;exports.isGetGroupSuccessResponseMessage=Et;exports.isGetQuestionRequestMessage=Bs;exports.isGetQuestionSuccessResponseMessage=Mt;exports.isMediaItem=Vs;exports.isNotRelevantMessage=Nt;exports.isOnAnswerChangeMessage=St;exports.isQpBridgeMessage=Pe;exports.isRepeatGroupRequestMessage=tn;exports.isSaveQuestionnaireRequestMessage=Ys;exports.isSetAnswerRequestMessage=Ds;exports.isSetGroupRequestMessage=Qs;exports.isSetQuestionRequestMessage=zs;exports.isSuccessMessage=Rt;exports.isWithBusyIndicatorRequestMessage=Ks;exports.mediaItemSchema=tt;exports.onAnswerChange=fn;exports.onAnswerChangeMessageSchema=Ke;exports.onSave=yn;exports.qpBridgeMessageSchema=w;exports.questionOptionalScheme=et;exports.questionSchema=Ae;exports.repeatGroup=bn;exports.repeatGroupRequestMessageSchema=bt;exports.responseErrorMessageSchema=Fe;exports.responseSuccessMessageSchema=Q;exports.saveQuestionnaire=pn;exports.saveQuestionnaireRequestMessageSchema=pt;exports.setAnswer=on;exports.setAnswerRequestMessageSchema=lt;exports.setGroup=ln;exports.setGroupRequestMessageSchema=dt;exports.setQuestion=un;exports.setQuestionRequestMessageSchema=at;exports.updateMediaItem=an;exports.withBusyIndicator=hn;
|
package/index.mjs
CHANGED
|
@@ -152,10 +152,10 @@ class E extends Error {
|
|
|
152
152
|
else if (i.path.length === 0)
|
|
153
153
|
n._errors.push(s(i));
|
|
154
154
|
else {
|
|
155
|
-
let o = n,
|
|
156
|
-
for (;
|
|
157
|
-
const
|
|
158
|
-
|
|
155
|
+
let o = n, u = 0;
|
|
156
|
+
for (; u < i.path.length; ) {
|
|
157
|
+
const d = i.path[u];
|
|
158
|
+
u === i.path.length - 1 ? (o[d] = o[d] || { _errors: [] }, o[d]._errors.push(s(i))) : o[d] = o[d] || { _errors: [] }, o = o[d], u++;
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
161
|
};
|
|
@@ -260,9 +260,9 @@ const xe = (t) => {
|
|
|
260
260
|
message: r.message
|
|
261
261
|
};
|
|
262
262
|
let o = "";
|
|
263
|
-
const
|
|
264
|
-
for (const
|
|
265
|
-
o =
|
|
263
|
+
const u = n.filter((d) => !!d).slice().reverse();
|
|
264
|
+
for (const d of u)
|
|
265
|
+
o = d(i, { data: e, defaultError: o }).message;
|
|
266
266
|
return {
|
|
267
267
|
...r,
|
|
268
268
|
path: a,
|
|
@@ -373,9 +373,9 @@ function v(t) {
|
|
|
373
373
|
if (e && (s || n))
|
|
374
374
|
throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
|
|
375
375
|
return e ? { errorMap: e, description: r } : { errorMap: (i, o) => {
|
|
376
|
-
var
|
|
376
|
+
var u, d;
|
|
377
377
|
const { message: g } = t;
|
|
378
|
-
return i.code === "invalid_enum_value" ? { message: g ?? o.defaultError } : typeof o.data > "u" ? { message: (
|
|
378
|
+
return i.code === "invalid_enum_value" ? { message: g ?? o.defaultError } : typeof o.data > "u" ? { message: (u = g ?? n) !== null && u !== void 0 ? u : o.defaultError } : i.code !== "invalid_type" ? { message: o.defaultError } : { message: (d = g ?? s) !== null && d !== void 0 ? d : o.defaultError };
|
|
379
379
|
}, description: r };
|
|
380
380
|
}
|
|
381
381
|
class _ {
|
|
@@ -471,7 +471,7 @@ class _ {
|
|
|
471
471
|
code: c.custom,
|
|
472
472
|
...n(r)
|
|
473
473
|
});
|
|
474
|
-
return typeof Promise < "u" && i instanceof Promise ? i.then((
|
|
474
|
+
return typeof Promise < "u" && i instanceof Promise ? i.then((u) => u ? !0 : (o(), !1)) : i ? !0 : (o(), !1);
|
|
475
475
|
});
|
|
476
476
|
}
|
|
477
477
|
refinement(e, s) {
|
|
@@ -1546,48 +1546,48 @@ class b extends _ {
|
|
|
1546
1546
|
}
|
|
1547
1547
|
_parse(e) {
|
|
1548
1548
|
if (this._getType(e) !== f.object) {
|
|
1549
|
-
const
|
|
1550
|
-
return l(
|
|
1549
|
+
const d = this._getOrReturnCtx(e);
|
|
1550
|
+
return l(d, {
|
|
1551
1551
|
code: c.invalid_type,
|
|
1552
1552
|
expected: f.object,
|
|
1553
|
-
received:
|
|
1553
|
+
received: d.parsedType
|
|
1554
1554
|
}), y;
|
|
1555
1555
|
}
|
|
1556
1556
|
const { status: n, ctx: r } = this._processInputParams(e), { shape: a, keys: i } = this._getCached(), o = [];
|
|
1557
1557
|
if (!(this._def.catchall instanceof P && this._def.unknownKeys === "strip"))
|
|
1558
|
-
for (const
|
|
1559
|
-
i.includes(
|
|
1560
|
-
const
|
|
1561
|
-
for (const
|
|
1562
|
-
const g = a[
|
|
1563
|
-
|
|
1564
|
-
key: { status: "valid", value:
|
|
1565
|
-
value: g._parse(new O(r, R, r.path,
|
|
1566
|
-
alwaysSet:
|
|
1558
|
+
for (const d in r.data)
|
|
1559
|
+
i.includes(d) || o.push(d);
|
|
1560
|
+
const u = [];
|
|
1561
|
+
for (const d of i) {
|
|
1562
|
+
const g = a[d], R = r.data[d];
|
|
1563
|
+
u.push({
|
|
1564
|
+
key: { status: "valid", value: d },
|
|
1565
|
+
value: g._parse(new O(r, R, r.path, d)),
|
|
1566
|
+
alwaysSet: d in r.data
|
|
1567
1567
|
});
|
|
1568
1568
|
}
|
|
1569
1569
|
if (this._def.catchall instanceof P) {
|
|
1570
|
-
const
|
|
1571
|
-
if (
|
|
1570
|
+
const d = this._def.unknownKeys;
|
|
1571
|
+
if (d === "passthrough")
|
|
1572
1572
|
for (const g of o)
|
|
1573
|
-
|
|
1573
|
+
u.push({
|
|
1574
1574
|
key: { status: "valid", value: g },
|
|
1575
1575
|
value: { status: "valid", value: r.data[g] }
|
|
1576
1576
|
});
|
|
1577
|
-
else if (
|
|
1577
|
+
else if (d === "strict")
|
|
1578
1578
|
o.length > 0 && (l(r, {
|
|
1579
1579
|
code: c.unrecognized_keys,
|
|
1580
1580
|
keys: o
|
|
1581
1581
|
}), n.dirty());
|
|
1582
|
-
else if (
|
|
1582
|
+
else if (d !== "strip")
|
|
1583
1583
|
throw new Error("Internal ZodObject error: invalid unknownKeys value.");
|
|
1584
1584
|
} else {
|
|
1585
|
-
const
|
|
1585
|
+
const d = this._def.catchall;
|
|
1586
1586
|
for (const g of o) {
|
|
1587
1587
|
const R = r.data[g];
|
|
1588
|
-
|
|
1588
|
+
u.push({
|
|
1589
1589
|
key: { status: "valid", value: g },
|
|
1590
|
-
value:
|
|
1590
|
+
value: d._parse(
|
|
1591
1591
|
new O(r, R, r.path, g)
|
|
1592
1592
|
//, ctx.child(key), value, getParsedType(value)
|
|
1593
1593
|
),
|
|
@@ -1596,17 +1596,17 @@ class b extends _ {
|
|
|
1596
1596
|
}
|
|
1597
1597
|
}
|
|
1598
1598
|
return r.common.async ? Promise.resolve().then(async () => {
|
|
1599
|
-
const
|
|
1600
|
-
for (const g of
|
|
1599
|
+
const d = [];
|
|
1600
|
+
for (const g of u) {
|
|
1601
1601
|
const R = await g.key, D = await g.value;
|
|
1602
|
-
|
|
1602
|
+
d.push({
|
|
1603
1603
|
key: R,
|
|
1604
1604
|
value: D,
|
|
1605
1605
|
alwaysSet: g.alwaysSet
|
|
1606
1606
|
});
|
|
1607
1607
|
}
|
|
1608
|
-
return
|
|
1609
|
-
}).then((
|
|
1608
|
+
return d;
|
|
1609
|
+
}).then((d) => S.mergeObjectSync(n, d)) : S.mergeObjectSync(n, u);
|
|
1610
1610
|
}
|
|
1611
1611
|
get shape() {
|
|
1612
1612
|
return this._def.shape();
|
|
@@ -1618,11 +1618,11 @@ class b extends _ {
|
|
|
1618
1618
|
...e !== void 0 ? {
|
|
1619
1619
|
errorMap: (s, n) => {
|
|
1620
1620
|
var r, a, i, o;
|
|
1621
|
-
const
|
|
1621
|
+
const u = (i = (a = (r = this._def).errorMap) === null || a === void 0 ? void 0 : a.call(r, s, n).message) !== null && i !== void 0 ? i : n.defaultError;
|
|
1622
1622
|
return s.code === "unrecognized_keys" ? {
|
|
1623
|
-
message: (o = p.errToObj(e).message) !== null && o !== void 0 ? o :
|
|
1623
|
+
message: (o = p.errToObj(e).message) !== null && o !== void 0 ? o : u
|
|
1624
1624
|
} : {
|
|
1625
|
-
message:
|
|
1625
|
+
message: u
|
|
1626
1626
|
};
|
|
1627
1627
|
}
|
|
1628
1628
|
} : {}
|
|
@@ -1860,26 +1860,26 @@ class oe extends _ {
|
|
|
1860
1860
|
{
|
|
1861
1861
|
let a;
|
|
1862
1862
|
const i = [];
|
|
1863
|
-
for (const
|
|
1864
|
-
const
|
|
1863
|
+
for (const u of n) {
|
|
1864
|
+
const d = {
|
|
1865
1865
|
...s,
|
|
1866
1866
|
common: {
|
|
1867
1867
|
...s.common,
|
|
1868
1868
|
issues: []
|
|
1869
1869
|
},
|
|
1870
1870
|
parent: null
|
|
1871
|
-
}, g =
|
|
1871
|
+
}, g = u._parseSync({
|
|
1872
1872
|
data: s.data,
|
|
1873
1873
|
path: s.path,
|
|
1874
|
-
parent:
|
|
1874
|
+
parent: d
|
|
1875
1875
|
});
|
|
1876
1876
|
if (g.status === "valid")
|
|
1877
1877
|
return g;
|
|
1878
|
-
g.status === "dirty" && !a && (a = { result: g, ctx:
|
|
1878
|
+
g.status === "dirty" && !a && (a = { result: g, ctx: d }), d.common.issues.length && i.push(d.common.issues);
|
|
1879
1879
|
}
|
|
1880
1880
|
if (a)
|
|
1881
1881
|
return s.common.issues.push(...a.ctx.common.issues), a.result;
|
|
1882
|
-
const o = i.map((
|
|
1882
|
+
const o = i.map((u) => new E(u));
|
|
1883
1883
|
return l(s, {
|
|
1884
1884
|
code: c.invalid_union,
|
|
1885
1885
|
unionErrors: o
|
|
@@ -1965,10 +1965,10 @@ function Ie(t, e) {
|
|
|
1965
1965
|
if (s === f.object && n === f.object) {
|
|
1966
1966
|
const r = x.objectKeys(e), a = x.objectKeys(t).filter((o) => r.indexOf(o) !== -1), i = { ...t, ...e };
|
|
1967
1967
|
for (const o of a) {
|
|
1968
|
-
const
|
|
1969
|
-
if (!
|
|
1968
|
+
const u = Ie(t[o], e[o]);
|
|
1969
|
+
if (!u.valid)
|
|
1970
1970
|
return { valid: !1 };
|
|
1971
|
-
i[o] =
|
|
1971
|
+
i[o] = u.data;
|
|
1972
1972
|
}
|
|
1973
1973
|
return { valid: !0, data: i };
|
|
1974
1974
|
} else if (s === f.array && n === f.array) {
|
|
@@ -1976,10 +1976,10 @@ function Ie(t, e) {
|
|
|
1976
1976
|
return { valid: !1 };
|
|
1977
1977
|
const r = [];
|
|
1978
1978
|
for (let a = 0; a < t.length; a++) {
|
|
1979
|
-
const i = t[a], o = e[a],
|
|
1980
|
-
if (!
|
|
1979
|
+
const i = t[a], o = e[a], u = Ie(i, o);
|
|
1980
|
+
if (!u.valid)
|
|
1981
1981
|
return { valid: !1 };
|
|
1982
|
-
r.push(
|
|
1982
|
+
r.push(u.data);
|
|
1983
1983
|
}
|
|
1984
1984
|
return { valid: !0, data: r };
|
|
1985
1985
|
} else
|
|
@@ -2048,8 +2048,8 @@ class A extends _ {
|
|
|
2048
2048
|
type: "array"
|
|
2049
2049
|
}), s.dirty());
|
|
2050
2050
|
const a = [...n.data].map((i, o) => {
|
|
2051
|
-
const
|
|
2052
|
-
return
|
|
2051
|
+
const u = this._def.items[o] || this._def.rest;
|
|
2052
|
+
return u ? u._parse(new O(n, i, n.path, o)) : null;
|
|
2053
2053
|
}).filter((i) => !!i);
|
|
2054
2054
|
return n.common.async ? Promise.all(a).then((i) => S.mergeArray(s, i)) : S.mergeArray(s, a);
|
|
2055
2055
|
}
|
|
@@ -2129,28 +2129,28 @@ class Se extends _ {
|
|
|
2129
2129
|
expected: f.map,
|
|
2130
2130
|
received: n.parsedType
|
|
2131
2131
|
}), y;
|
|
2132
|
-
const r = this._def.keyType, a = this._def.valueType, i = [...n.data.entries()].map(([o,
|
|
2133
|
-
key: r._parse(new O(n, o, n.path, [
|
|
2134
|
-
value: a._parse(new O(n,
|
|
2132
|
+
const r = this._def.keyType, a = this._def.valueType, i = [...n.data.entries()].map(([o, u], d) => ({
|
|
2133
|
+
key: r._parse(new O(n, o, n.path, [d, "key"])),
|
|
2134
|
+
value: a._parse(new O(n, u, n.path, [d, "value"]))
|
|
2135
2135
|
}));
|
|
2136
2136
|
if (n.common.async) {
|
|
2137
2137
|
const o = /* @__PURE__ */ new Map();
|
|
2138
2138
|
return Promise.resolve().then(async () => {
|
|
2139
|
-
for (const
|
|
2140
|
-
const
|
|
2141
|
-
if (
|
|
2139
|
+
for (const u of i) {
|
|
2140
|
+
const d = await u.key, g = await u.value;
|
|
2141
|
+
if (d.status === "aborted" || g.status === "aborted")
|
|
2142
2142
|
return y;
|
|
2143
|
-
(
|
|
2143
|
+
(d.status === "dirty" || g.status === "dirty") && s.dirty(), o.set(d.value, g.value);
|
|
2144
2144
|
}
|
|
2145
2145
|
return { status: s.value, value: o };
|
|
2146
2146
|
});
|
|
2147
2147
|
} else {
|
|
2148
2148
|
const o = /* @__PURE__ */ new Map();
|
|
2149
|
-
for (const
|
|
2150
|
-
const
|
|
2151
|
-
if (
|
|
2149
|
+
for (const u of i) {
|
|
2150
|
+
const d = u.key, g = u.value;
|
|
2151
|
+
if (d.status === "aborted" || g.status === "aborted")
|
|
2152
2152
|
return y;
|
|
2153
|
-
(
|
|
2153
|
+
(d.status === "dirty" || g.status === "dirty") && s.dirty(), o.set(d.value, g.value);
|
|
2154
2154
|
}
|
|
2155
2155
|
return { status: s.value, value: o };
|
|
2156
2156
|
}
|
|
@@ -2188,17 +2188,17 @@ class G extends _ {
|
|
|
2188
2188
|
message: r.maxSize.message
|
|
2189
2189
|
}), s.dirty());
|
|
2190
2190
|
const a = this._def.valueType;
|
|
2191
|
-
function i(
|
|
2192
|
-
const
|
|
2193
|
-
for (const g of
|
|
2191
|
+
function i(u) {
|
|
2192
|
+
const d = /* @__PURE__ */ new Set();
|
|
2193
|
+
for (const g of u) {
|
|
2194
2194
|
if (g.status === "aborted")
|
|
2195
2195
|
return y;
|
|
2196
|
-
g.status === "dirty" && s.dirty(),
|
|
2196
|
+
g.status === "dirty" && s.dirty(), d.add(g.value);
|
|
2197
2197
|
}
|
|
2198
|
-
return { status: s.value, value:
|
|
2198
|
+
return { status: s.value, value: d };
|
|
2199
2199
|
}
|
|
2200
|
-
const o = [...n.data.values()].map((
|
|
2201
|
-
return n.common.async ? Promise.all(o).then((
|
|
2200
|
+
const o = [...n.data.values()].map((u, d) => a._parse(new O(n, u, n.path, d)));
|
|
2201
|
+
return n.common.async ? Promise.all(o).then((u) => i(u)) : i(o);
|
|
2202
2202
|
}
|
|
2203
2203
|
min(e, s) {
|
|
2204
2204
|
return new G({
|
|
@@ -2238,7 +2238,7 @@ class H extends _ {
|
|
|
2238
2238
|
expected: f.function,
|
|
2239
2239
|
received: s.parsedType
|
|
2240
2240
|
}), y;
|
|
2241
|
-
function n(o,
|
|
2241
|
+
function n(o, u) {
|
|
2242
2242
|
return xe({
|
|
2243
2243
|
data: o,
|
|
2244
2244
|
path: s.path,
|
|
@@ -2247,14 +2247,14 @@ class H extends _ {
|
|
|
2247
2247
|
s.schemaErrorMap,
|
|
2248
2248
|
_e(),
|
|
2249
2249
|
Y
|
|
2250
|
-
].filter((
|
|
2250
|
+
].filter((d) => !!d),
|
|
2251
2251
|
issueData: {
|
|
2252
2252
|
code: c.invalid_arguments,
|
|
2253
|
-
argumentsError:
|
|
2253
|
+
argumentsError: u
|
|
2254
2254
|
}
|
|
2255
2255
|
});
|
|
2256
2256
|
}
|
|
2257
|
-
function r(o,
|
|
2257
|
+
function r(o, u) {
|
|
2258
2258
|
return xe({
|
|
2259
2259
|
data: o,
|
|
2260
2260
|
path: s.path,
|
|
@@ -2263,31 +2263,31 @@ class H extends _ {
|
|
|
2263
2263
|
s.schemaErrorMap,
|
|
2264
2264
|
_e(),
|
|
2265
2265
|
Y
|
|
2266
|
-
].filter((
|
|
2266
|
+
].filter((d) => !!d),
|
|
2267
2267
|
issueData: {
|
|
2268
2268
|
code: c.invalid_return_type,
|
|
2269
|
-
returnTypeError:
|
|
2269
|
+
returnTypeError: u
|
|
2270
2270
|
}
|
|
2271
2271
|
});
|
|
2272
2272
|
}
|
|
2273
2273
|
const a = { errorMap: s.common.contextualErrorMap }, i = s.data;
|
|
2274
2274
|
if (this._def.returns instanceof X) {
|
|
2275
2275
|
const o = this;
|
|
2276
|
-
return T(async function(...
|
|
2277
|
-
const
|
|
2278
|
-
throw
|
|
2276
|
+
return T(async function(...u) {
|
|
2277
|
+
const d = new E([]), g = await o._def.args.parseAsync(u, a).catch((Ee) => {
|
|
2278
|
+
throw d.addIssue(n(u, Ee)), d;
|
|
2279
2279
|
}), R = await Reflect.apply(i, this, g);
|
|
2280
2280
|
return await o._def.returns._def.type.parseAsync(R, a).catch((Ee) => {
|
|
2281
|
-
throw
|
|
2281
|
+
throw d.addIssue(r(R, Ee)), d;
|
|
2282
2282
|
});
|
|
2283
2283
|
});
|
|
2284
2284
|
} else {
|
|
2285
2285
|
const o = this;
|
|
2286
|
-
return T(function(...
|
|
2287
|
-
const
|
|
2288
|
-
if (!
|
|
2289
|
-
throw new E([n(
|
|
2290
|
-
const g = Reflect.apply(i, this,
|
|
2286
|
+
return T(function(...u) {
|
|
2287
|
+
const d = o._def.args.safeParse(u, a);
|
|
2288
|
+
if (!d.success)
|
|
2289
|
+
throw new E([n(u, d.error)]);
|
|
2290
|
+
const g = Reflect.apply(i, this, d.data), R = o._def.returns.safeParse(g, a);
|
|
2291
2291
|
if (!R.success)
|
|
2292
2292
|
throw new E([r(g, R.error)]);
|
|
2293
2293
|
return R.data;
|
|
@@ -2508,12 +2508,12 @@ class N extends _ {
|
|
|
2508
2508
|
return Promise.resolve(i).then(async (o) => {
|
|
2509
2509
|
if (s.value === "aborted")
|
|
2510
2510
|
return y;
|
|
2511
|
-
const
|
|
2511
|
+
const u = await this._def.schema._parseAsync({
|
|
2512
2512
|
data: o,
|
|
2513
2513
|
path: n.path,
|
|
2514
2514
|
parent: n
|
|
2515
2515
|
});
|
|
2516
|
-
return
|
|
2516
|
+
return u.status === "aborted" ? y : u.status === "dirty" || s.value === "dirty" ? W(u.value) : u;
|
|
2517
2517
|
});
|
|
2518
2518
|
{
|
|
2519
2519
|
if (s.value === "aborted")
|
|
@@ -2528,10 +2528,10 @@ class N extends _ {
|
|
|
2528
2528
|
}
|
|
2529
2529
|
if (r.type === "refinement") {
|
|
2530
2530
|
const i = (o) => {
|
|
2531
|
-
const
|
|
2531
|
+
const u = r.refinement(o, a);
|
|
2532
2532
|
if (n.common.async)
|
|
2533
|
-
return Promise.resolve(
|
|
2534
|
-
if (
|
|
2533
|
+
return Promise.resolve(u);
|
|
2534
|
+
if (u instanceof Promise)
|
|
2535
2535
|
throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
2536
2536
|
return o;
|
|
2537
2537
|
};
|
|
@@ -2753,8 +2753,8 @@ function ze(t, e = {}, s) {
|
|
|
2753
2753
|
return t ? J.create().superRefine((n, r) => {
|
|
2754
2754
|
var a, i;
|
|
2755
2755
|
if (!t(n)) {
|
|
2756
|
-
const o = typeof e == "function" ? e(n) : typeof e == "string" ? { message: e } : e,
|
|
2757
|
-
r.addIssue({ code: "custom", ...
|
|
2756
|
+
const o = typeof e == "function" ? e(n) : typeof e == "string" ? { message: e } : e, u = (i = (a = o.fatal) !== null && a !== void 0 ? a : s) !== null && i !== void 0 ? i : !0, d = typeof o == "string" ? { message: o } : o;
|
|
2757
|
+
r.addIssue({ code: "custom", ...d, fatal: u });
|
|
2758
2758
|
}
|
|
2759
2759
|
}) : J.create();
|
|
2760
2760
|
}
|
|
@@ -2912,7 +2912,8 @@ const w = h.object({
|
|
|
2912
2912
|
disabled: h.boolean(),
|
|
2913
2913
|
required: h.boolean(),
|
|
2914
2914
|
hidden: h.boolean(),
|
|
2915
|
-
errorMessage: h.string().optional()
|
|
2915
|
+
errorMessage: h.string().optional(),
|
|
2916
|
+
answer: h.unknown().optional()
|
|
2916
2917
|
}), os = He.partial(), cs = h.object({
|
|
2917
2918
|
id: h.string().uuid(),
|
|
2918
2919
|
name: h.string(),
|
|
@@ -2982,7 +2983,7 @@ const w = h.object({
|
|
|
2982
2983
|
parentGroupName: h.string(),
|
|
2983
2984
|
groupIndex: h.number()
|
|
2984
2985
|
});
|
|
2985
|
-
function
|
|
2986
|
+
function Ws(t) {
|
|
2986
2987
|
return cs.safeParse(t).success;
|
|
2987
2988
|
}
|
|
2988
2989
|
function Ms(t) {
|
|
@@ -2997,28 +2998,28 @@ function Is(t) {
|
|
|
2997
2998
|
function Os(t) {
|
|
2998
2999
|
return is.safeParse(t).success;
|
|
2999
3000
|
}
|
|
3000
|
-
function
|
|
3001
|
+
function Hs(t) {
|
|
3001
3002
|
return us.safeParse(t).success;
|
|
3002
3003
|
}
|
|
3003
3004
|
function As(t) {
|
|
3004
3005
|
return ls.safeParse(t).success;
|
|
3005
3006
|
}
|
|
3006
|
-
function
|
|
3007
|
+
function Ys(t) {
|
|
3007
3008
|
return vs.safeParse(t).success;
|
|
3008
3009
|
}
|
|
3009
|
-
function
|
|
3010
|
+
function Js(t) {
|
|
3010
3011
|
return fs.safeParse(t).success;
|
|
3011
3012
|
}
|
|
3012
|
-
function
|
|
3013
|
+
function Xs(t) {
|
|
3013
3014
|
return ys.safeParse(t).success;
|
|
3014
3015
|
}
|
|
3015
|
-
function
|
|
3016
|
+
function Ks(t) {
|
|
3016
3017
|
return hs.safeParse(t).success;
|
|
3017
3018
|
}
|
|
3018
3019
|
function js(t) {
|
|
3019
3020
|
return ps.safeParse(t).success;
|
|
3020
3021
|
}
|
|
3021
|
-
function
|
|
3022
|
+
function Fs(t) {
|
|
3022
3023
|
return ms.safeParse(t).success;
|
|
3023
3024
|
}
|
|
3024
3025
|
function Ps(t) {
|
|
@@ -3030,37 +3031,40 @@ function qs(t) {
|
|
|
3030
3031
|
function $s(t) {
|
|
3031
3032
|
return xs.safeParse(t).success;
|
|
3032
3033
|
}
|
|
3033
|
-
function
|
|
3034
|
+
function en(t) {
|
|
3034
3035
|
return bs.safeParse(t).success;
|
|
3035
3036
|
}
|
|
3036
|
-
function
|
|
3037
|
+
function tn(t) {
|
|
3037
3038
|
return ws.safeParse(t).success;
|
|
3038
3039
|
}
|
|
3039
|
-
function
|
|
3040
|
+
function sn(t) {
|
|
3040
3041
|
return ks.safeParse(t).success;
|
|
3041
3042
|
}
|
|
3042
|
-
function
|
|
3043
|
+
function nn(t) {
|
|
3043
3044
|
return qs(t) || $s(t);
|
|
3044
3045
|
}
|
|
3045
|
-
function
|
|
3046
|
+
function Us(t, e) {
|
|
3047
|
+
return !Xe(t) || t.id !== e || !("status" in t);
|
|
3048
|
+
}
|
|
3049
|
+
function rn(t) {
|
|
3046
3050
|
return Ss.safeParse(t).success;
|
|
3047
3051
|
}
|
|
3048
|
-
function
|
|
3052
|
+
function Ls(t) {
|
|
3049
3053
|
return Ts.safeParse(t).success;
|
|
3050
3054
|
}
|
|
3051
|
-
function
|
|
3055
|
+
function an(t) {
|
|
3052
3056
|
return Rs.safeParse(t).success;
|
|
3053
3057
|
}
|
|
3054
|
-
function
|
|
3058
|
+
function Vs(t) {
|
|
3055
3059
|
return Es.safeParse(t).success;
|
|
3056
3060
|
}
|
|
3057
|
-
function
|
|
3061
|
+
function on(t) {
|
|
3058
3062
|
return Cs.safeParse(t).success;
|
|
3059
3063
|
}
|
|
3060
|
-
function
|
|
3064
|
+
function cn(t) {
|
|
3061
3065
|
return Zs.safeParse(t).success;
|
|
3062
3066
|
}
|
|
3063
|
-
function
|
|
3067
|
+
function dn(t) {
|
|
3064
3068
|
return Ns.safeParse(t).success;
|
|
3065
3069
|
}
|
|
3066
3070
|
function Ke(t) {
|
|
@@ -3070,10 +3074,10 @@ function Ke(t) {
|
|
|
3070
3074
|
if (/^data:/.test(t)) {
|
|
3071
3075
|
const a = t.match(/^data:([^;]+);base64,(.*)$/);
|
|
3072
3076
|
if (a) {
|
|
3073
|
-
const i = a[1], o = a[2],
|
|
3074
|
-
for (let D = 0; D <
|
|
3075
|
-
g[D] =
|
|
3076
|
-
const R = new Blob([
|
|
3077
|
+
const i = a[1], o = a[2], u = atob(o), d = new ArrayBuffer(u.length), g = new Uint8Array(d);
|
|
3078
|
+
for (let D = 0; D < u.length; D++)
|
|
3079
|
+
g[D] = u.charCodeAt(D);
|
|
3080
|
+
const R = new Blob([d], { type: i });
|
|
3077
3081
|
return URL.createObjectURL(R);
|
|
3078
3082
|
}
|
|
3079
3083
|
throw new Error("Invalid data URL format. Only base64 data URLs are supported.");
|
|
@@ -3090,7 +3094,7 @@ function Ke(t) {
|
|
|
3090
3094
|
}
|
|
3091
3095
|
throw new Error("Unsupported content type for blobUrl");
|
|
3092
3096
|
}
|
|
3093
|
-
function
|
|
3097
|
+
function un(t, e, s, n) {
|
|
3094
3098
|
return {
|
|
3095
3099
|
id: n ?? qe(),
|
|
3096
3100
|
name: t,
|
|
@@ -3098,7 +3102,7 @@ function dn(t, e, s, n) {
|
|
|
3098
3102
|
blobUrl: Ke(s)
|
|
3099
3103
|
};
|
|
3100
3104
|
}
|
|
3101
|
-
function
|
|
3105
|
+
function ln(t, e) {
|
|
3102
3106
|
let s = t.blobUrl;
|
|
3103
3107
|
return e.content !== void 0 && (s = Ke(e.content)), {
|
|
3104
3108
|
...t,
|
|
@@ -3106,8 +3110,8 @@ function un(t, e) {
|
|
|
3106
3110
|
blobUrl: s
|
|
3107
3111
|
};
|
|
3108
3112
|
}
|
|
3109
|
-
window.addEventListener("message",
|
|
3110
|
-
async function
|
|
3113
|
+
window.addEventListener("message", Ds);
|
|
3114
|
+
async function fn(t, e) {
|
|
3111
3115
|
await M({
|
|
3112
3116
|
type: "qp-bridge",
|
|
3113
3117
|
action: "setAnswer",
|
|
@@ -3115,14 +3119,14 @@ async function ln(t, e) {
|
|
|
3115
3119
|
answer: e
|
|
3116
3120
|
});
|
|
3117
3121
|
}
|
|
3118
|
-
async function
|
|
3119
|
-
return await
|
|
3122
|
+
async function hn(t) {
|
|
3123
|
+
return await Bs({
|
|
3120
3124
|
type: "qp-bridge",
|
|
3121
3125
|
action: "getQuestion",
|
|
3122
3126
|
question: t
|
|
3123
3127
|
});
|
|
3124
3128
|
}
|
|
3125
|
-
async function
|
|
3129
|
+
async function pn(t, e) {
|
|
3126
3130
|
await M({
|
|
3127
3131
|
type: "qp-bridge",
|
|
3128
3132
|
action: "setQuestion",
|
|
@@ -3130,14 +3134,14 @@ async function hn(t, e) {
|
|
|
3130
3134
|
questionData: e
|
|
3131
3135
|
});
|
|
3132
3136
|
}
|
|
3133
|
-
async function
|
|
3134
|
-
return await
|
|
3137
|
+
async function mn(t) {
|
|
3138
|
+
return await zs({
|
|
3135
3139
|
type: "qp-bridge",
|
|
3136
3140
|
action: "getGroup",
|
|
3137
3141
|
group: t
|
|
3138
3142
|
});
|
|
3139
3143
|
}
|
|
3140
|
-
async function
|
|
3144
|
+
async function gn(t, e) {
|
|
3141
3145
|
await M({
|
|
3142
3146
|
type: "qp-bridge",
|
|
3143
3147
|
action: "setGroup",
|
|
@@ -3145,7 +3149,7 @@ async function mn(t, e) {
|
|
|
3145
3149
|
groupData: e
|
|
3146
3150
|
});
|
|
3147
3151
|
}
|
|
3148
|
-
function
|
|
3152
|
+
function yn(t) {
|
|
3149
3153
|
const e = (s) => {
|
|
3150
3154
|
Ms(s.data) && t(s.data.question, s.data.answer);
|
|
3151
3155
|
};
|
|
@@ -3155,7 +3159,7 @@ function gn(t) {
|
|
|
3155
3159
|
}
|
|
3156
3160
|
};
|
|
3157
3161
|
}
|
|
3158
|
-
async function
|
|
3162
|
+
async function vn(t) {
|
|
3159
3163
|
await M({
|
|
3160
3164
|
type: "qp-bridge",
|
|
3161
3165
|
action: "busyIndicatorStart"
|
|
@@ -3169,19 +3173,19 @@ async function yn(t) {
|
|
|
3169
3173
|
});
|
|
3170
3174
|
}
|
|
3171
3175
|
}
|
|
3172
|
-
async function
|
|
3176
|
+
async function _n() {
|
|
3173
3177
|
await M({
|
|
3174
3178
|
type: "qp-bridge",
|
|
3175
3179
|
action: "saveQuestionnaire"
|
|
3176
3180
|
});
|
|
3177
3181
|
}
|
|
3178
|
-
async function
|
|
3182
|
+
async function xn() {
|
|
3179
3183
|
await M({
|
|
3180
3184
|
type: "qp-bridge",
|
|
3181
3185
|
action: "completeAndCloseQuestionnaire"
|
|
3182
3186
|
});
|
|
3183
3187
|
}
|
|
3184
|
-
async function
|
|
3188
|
+
async function bn(t) {
|
|
3185
3189
|
await M({
|
|
3186
3190
|
type: "qp-bridge",
|
|
3187
3191
|
action: "executeCustomCommand",
|
|
@@ -3189,7 +3193,7 @@ async function xn(t) {
|
|
|
3189
3193
|
});
|
|
3190
3194
|
}
|
|
3191
3195
|
const te = [];
|
|
3192
|
-
function
|
|
3196
|
+
function wn(t) {
|
|
3193
3197
|
return te.includes(t) || te.push(t), {
|
|
3194
3198
|
cancelSubscription: () => {
|
|
3195
3199
|
const e = te.indexOf(t);
|
|
@@ -3197,7 +3201,7 @@ function bn(t) {
|
|
|
3197
3201
|
}
|
|
3198
3202
|
};
|
|
3199
3203
|
}
|
|
3200
|
-
async function
|
|
3204
|
+
async function Ds(t) {
|
|
3201
3205
|
try {
|
|
3202
3206
|
if (Ps(t.data)) {
|
|
3203
3207
|
const e = await Promise.all(te.map((n) => n())), s = {
|
|
@@ -3218,22 +3222,22 @@ async function Vs(t) {
|
|
|
3218
3222
|
window.parent.postMessage(s, "*");
|
|
3219
3223
|
}
|
|
3220
3224
|
}
|
|
3221
|
-
async function
|
|
3222
|
-
return await
|
|
3225
|
+
async function kn(t) {
|
|
3226
|
+
return await Gs({
|
|
3223
3227
|
type: "qp-bridge",
|
|
3224
3228
|
action: "fetchEntities",
|
|
3225
3229
|
fetchXml: t
|
|
3226
3230
|
});
|
|
3227
3231
|
}
|
|
3228
|
-
async function
|
|
3229
|
-
return await
|
|
3232
|
+
async function Sn(t, e) {
|
|
3233
|
+
return await Qs({
|
|
3230
3234
|
type: "qp-bridge",
|
|
3231
3235
|
action: "getEntityById",
|
|
3232
3236
|
entityName: t,
|
|
3233
3237
|
entityId: e
|
|
3234
3238
|
});
|
|
3235
3239
|
}
|
|
3236
|
-
async function
|
|
3240
|
+
async function Tn(t, e) {
|
|
3237
3241
|
await M({
|
|
3238
3242
|
type: "qp-bridge",
|
|
3239
3243
|
action: "repeatGroup",
|
|
@@ -3241,14 +3245,14 @@ async function Sn(t, e) {
|
|
|
3241
3245
|
groupIndex: e
|
|
3242
3246
|
});
|
|
3243
3247
|
}
|
|
3244
|
-
async function
|
|
3248
|
+
async function Rn(t) {
|
|
3245
3249
|
await M({
|
|
3246
3250
|
type: "qp-bridge",
|
|
3247
3251
|
action: "addNewGroup",
|
|
3248
3252
|
groupName: t
|
|
3249
3253
|
});
|
|
3250
3254
|
}
|
|
3251
|
-
async function
|
|
3255
|
+
async function En(t, e) {
|
|
3252
3256
|
await M({
|
|
3253
3257
|
type: "qp-bridge",
|
|
3254
3258
|
action: "deleteGroup",
|
|
@@ -3259,104 +3263,105 @@ async function Rn(t, e) {
|
|
|
3259
3263
|
async function ye(t, e) {
|
|
3260
3264
|
return new Promise((s, n) => {
|
|
3261
3265
|
const r = qe(), a = (i) => {
|
|
3262
|
-
if (
|
|
3266
|
+
if (Us(i.data, r))
|
|
3263
3267
|
return;
|
|
3264
|
-
const
|
|
3265
|
-
|
|
3268
|
+
const o = e(i.data);
|
|
3269
|
+
o.success ? s(o.data) : Os(i.data) ? n(new Error(i.data.message)) : n(new Error("Unknown message received")), window.removeEventListener("message", a);
|
|
3266
3270
|
};
|
|
3267
3271
|
window.addEventListener("message", a), window.parent.postMessage({ ...t, id: r }, "*");
|
|
3268
3272
|
});
|
|
3269
3273
|
}
|
|
3270
|
-
async function
|
|
3274
|
+
async function Bs(t) {
|
|
3271
3275
|
return ye(t, (e) => As(e) ? { success: !0, data: e.question } : { success: !1 });
|
|
3272
3276
|
}
|
|
3273
|
-
async function
|
|
3277
|
+
async function zs(t) {
|
|
3274
3278
|
return ye(t, (e) => js(e) ? { success: !0, data: e.group } : { success: !1 });
|
|
3275
3279
|
}
|
|
3276
3280
|
function M(t) {
|
|
3277
3281
|
return ye(t, (e) => Is(e) ? { success: !0, data: void 0 } : { success: !1 });
|
|
3278
3282
|
}
|
|
3279
|
-
async function zs(t) {
|
|
3280
|
-
return ye(t, (e) => Us(e) ? { success: !0, data: e.entities } : { success: !1 });
|
|
3281
|
-
}
|
|
3282
3283
|
async function Gs(t) {
|
|
3283
|
-
return ye(t, (e) => Ls(e) ? { success: !0, data: e.
|
|
3284
|
+
return ye(t, (e) => Ls(e) ? { success: !0, data: e.entities } : { success: !1 });
|
|
3285
|
+
}
|
|
3286
|
+
async function Qs(t) {
|
|
3287
|
+
return ye(t, (e) => Vs(e) ? { success: !0, data: e.entity } : { success: !1 });
|
|
3284
3288
|
}
|
|
3285
3289
|
export {
|
|
3286
|
-
|
|
3290
|
+
Rn as addNewGroup,
|
|
3287
3291
|
Zs as addNewGroupRequestMessageSchema,
|
|
3288
3292
|
xs as busyIndicatorEndRequestMessageSchema,
|
|
3289
3293
|
_s as busyIndicatorStartRequestMessageSchema,
|
|
3290
3294
|
gs as canSaveRequestMessageSchema,
|
|
3291
3295
|
ms as canSaveSuccessResponseMessageSchema,
|
|
3292
|
-
|
|
3296
|
+
xn as completeAndCloseQuestionnaire,
|
|
3293
3297
|
ws as completeAndCloseQuestionnaireRequestMessageSchema,
|
|
3294
|
-
|
|
3295
|
-
|
|
3298
|
+
un as createMediaItem,
|
|
3299
|
+
En as deleteGroup,
|
|
3296
3300
|
Ns as deleteGroupRequestMessageSchema,
|
|
3297
3301
|
Ye as entitySchema,
|
|
3298
|
-
|
|
3302
|
+
bn as executeCustomCommand,
|
|
3299
3303
|
ks as executeCustomCommandRequestMessageSchema,
|
|
3300
|
-
|
|
3304
|
+
kn as fetchEntities,
|
|
3301
3305
|
Ss as fetchEntitiesRequestMessageSchema,
|
|
3302
3306
|
Ts as fetchEntitiesSuccessResponseMessageSchema,
|
|
3303
|
-
|
|
3307
|
+
Sn as getEntityById,
|
|
3304
3308
|
Rs as getEntityByIdRequestMessageSchema,
|
|
3305
3309
|
Es as getEntityByIdSuccessResponseMessageSchema,
|
|
3306
|
-
|
|
3310
|
+
mn as getGroup,
|
|
3307
3311
|
hs as getGroupRequestMessageSchema,
|
|
3308
3312
|
ps as getGroupSuccessResponseMessageSchema,
|
|
3309
|
-
|
|
3313
|
+
hn as getQuestion,
|
|
3310
3314
|
us as getQuestionRequestMessageSchema,
|
|
3311
3315
|
ls as getQuestionSuccessResponseMessageSchema,
|
|
3312
3316
|
ds as groupOptionalScheme,
|
|
3313
3317
|
Je as groupSchema,
|
|
3314
|
-
|
|
3318
|
+
cn as isAddNewGroupRequestMessage,
|
|
3315
3319
|
$s as isBusyIndicatorEndRequestMessage,
|
|
3316
3320
|
qs as isBusyIndicatorStartRequestMessage,
|
|
3317
3321
|
Ps as isCanSaveRequestMessage,
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3322
|
+
Fs as isCanSaveSuccessResponseMessage,
|
|
3323
|
+
tn as isCompleteAndCloseQuestionnaireRequestMessage,
|
|
3324
|
+
dn as isDeleteGroupRequestMessage,
|
|
3321
3325
|
Os as isErrorMessage,
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3326
|
+
sn as isExecuteCustomCommandRequestMessage,
|
|
3327
|
+
rn as isFetchEntitiesRequestMessage,
|
|
3328
|
+
Ls as isFetchEntitiesSuccessResponseMessage,
|
|
3329
|
+
an as isGetEntityByIdRequestMessage,
|
|
3330
|
+
Vs as isGetEntityByIdSuccessResponseMessage,
|
|
3331
|
+
Ks as isGetGroupRequestMessage,
|
|
3328
3332
|
js as isGetGroupSuccessResponseMessage,
|
|
3329
|
-
|
|
3333
|
+
Hs as isGetQuestionRequestMessage,
|
|
3330
3334
|
As as isGetQuestionSuccessResponseMessage,
|
|
3331
|
-
|
|
3335
|
+
Ws as isMediaItem,
|
|
3336
|
+
Us as isNotRelevantMessage,
|
|
3332
3337
|
Ms as isOnAnswerChangeMessage,
|
|
3333
3338
|
Xe as isQpBridgeMessage,
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
+
on as isRepeatGroupRequestMessage,
|
|
3340
|
+
en as isSaveQuestionnaireRequestMessage,
|
|
3341
|
+
Ys as isSetAnswerRequestMessage,
|
|
3342
|
+
Xs as isSetGroupRequestMessage,
|
|
3343
|
+
Js as isSetQuestionRequestMessage,
|
|
3339
3344
|
Is as isSuccessMessage,
|
|
3340
|
-
|
|
3345
|
+
nn as isWithBusyIndicatorRequestMessage,
|
|
3341
3346
|
cs as mediaItemSchema,
|
|
3342
|
-
|
|
3347
|
+
yn as onAnswerChange,
|
|
3343
3348
|
as as onAnswerChangeMessageSchema,
|
|
3344
|
-
|
|
3349
|
+
wn as onSave,
|
|
3345
3350
|
w as qpBridgeMessageSchema,
|
|
3346
3351
|
os as questionOptionalScheme,
|
|
3347
3352
|
He as questionSchema,
|
|
3348
|
-
|
|
3353
|
+
Tn as repeatGroup,
|
|
3349
3354
|
Cs as repeatGroupRequestMessageSchema,
|
|
3350
3355
|
is as responseErrorMessageSchema,
|
|
3351
3356
|
K as responseSuccessMessageSchema,
|
|
3352
|
-
|
|
3357
|
+
_n as saveQuestionnaire,
|
|
3353
3358
|
bs as saveQuestionnaireRequestMessageSchema,
|
|
3354
|
-
|
|
3359
|
+
fn as setAnswer,
|
|
3355
3360
|
vs as setAnswerRequestMessageSchema,
|
|
3356
|
-
|
|
3361
|
+
gn as setGroup,
|
|
3357
3362
|
ys as setGroupRequestMessageSchema,
|
|
3358
|
-
|
|
3363
|
+
pn as setQuestion,
|
|
3359
3364
|
fs as setQuestionRequestMessageSchema,
|
|
3360
|
-
|
|
3361
|
-
|
|
3365
|
+
ln as updateMediaItem,
|
|
3366
|
+
vn as withBusyIndicator
|
|
3362
3367
|
};
|
package/lib/qp-bridge-types.d.ts
CHANGED
|
@@ -68,12 +68,14 @@ export declare const questionSchema: z.ZodObject<{
|
|
|
68
68
|
required: z.ZodBoolean;
|
|
69
69
|
hidden: z.ZodBoolean;
|
|
70
70
|
errorMessage: z.ZodOptional<z.ZodString>;
|
|
71
|
+
answer: z.ZodOptional<z.ZodUnknown>;
|
|
71
72
|
}, "strip", z.ZodTypeAny, {
|
|
72
73
|
label: string;
|
|
73
74
|
description: string;
|
|
74
75
|
disabled: boolean;
|
|
75
76
|
required: boolean;
|
|
76
77
|
hidden: boolean;
|
|
78
|
+
answer?: unknown;
|
|
77
79
|
semanticColor?: string | undefined;
|
|
78
80
|
errorMessage?: string | undefined;
|
|
79
81
|
}, {
|
|
@@ -82,6 +84,7 @@ export declare const questionSchema: z.ZodObject<{
|
|
|
82
84
|
disabled: boolean;
|
|
83
85
|
required: boolean;
|
|
84
86
|
hidden: boolean;
|
|
87
|
+
answer?: unknown;
|
|
85
88
|
semanticColor?: string | undefined;
|
|
86
89
|
errorMessage?: string | undefined;
|
|
87
90
|
}>;
|
|
@@ -93,7 +96,9 @@ export declare const questionOptionalScheme: z.ZodObject<{
|
|
|
93
96
|
required: z.ZodOptional<z.ZodBoolean>;
|
|
94
97
|
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
95
98
|
errorMessage: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
99
|
+
answer: z.ZodOptional<z.ZodOptional<z.ZodUnknown>>;
|
|
96
100
|
}, "strip", z.ZodTypeAny, {
|
|
101
|
+
answer?: unknown;
|
|
97
102
|
semanticColor?: string | undefined;
|
|
98
103
|
label?: string | undefined;
|
|
99
104
|
description?: string | undefined;
|
|
@@ -102,6 +107,7 @@ export declare const questionOptionalScheme: z.ZodObject<{
|
|
|
102
107
|
hidden?: boolean | undefined;
|
|
103
108
|
errorMessage?: string | undefined;
|
|
104
109
|
}, {
|
|
110
|
+
answer?: unknown;
|
|
105
111
|
semanticColor?: string | undefined;
|
|
106
112
|
label?: string | undefined;
|
|
107
113
|
description?: string | undefined;
|
|
@@ -184,12 +190,14 @@ export declare const getQuestionSuccessResponseMessageSchema: z.ZodObject<z.obje
|
|
|
184
190
|
required: z.ZodBoolean;
|
|
185
191
|
hidden: z.ZodBoolean;
|
|
186
192
|
errorMessage: z.ZodOptional<z.ZodString>;
|
|
193
|
+
answer: z.ZodOptional<z.ZodUnknown>;
|
|
187
194
|
}, "strip", z.ZodTypeAny, {
|
|
188
195
|
label: string;
|
|
189
196
|
description: string;
|
|
190
197
|
disabled: boolean;
|
|
191
198
|
required: boolean;
|
|
192
199
|
hidden: boolean;
|
|
200
|
+
answer?: unknown;
|
|
193
201
|
semanticColor?: string | undefined;
|
|
194
202
|
errorMessage?: string | undefined;
|
|
195
203
|
}, {
|
|
@@ -198,6 +206,7 @@ export declare const getQuestionSuccessResponseMessageSchema: z.ZodObject<z.obje
|
|
|
198
206
|
disabled: boolean;
|
|
199
207
|
required: boolean;
|
|
200
208
|
hidden: boolean;
|
|
209
|
+
answer?: unknown;
|
|
201
210
|
semanticColor?: string | undefined;
|
|
202
211
|
errorMessage?: string | undefined;
|
|
203
212
|
}>;
|
|
@@ -210,6 +219,7 @@ export declare const getQuestionSuccessResponseMessageSchema: z.ZodObject<z.obje
|
|
|
210
219
|
disabled: boolean;
|
|
211
220
|
required: boolean;
|
|
212
221
|
hidden: boolean;
|
|
222
|
+
answer?: unknown;
|
|
213
223
|
semanticColor?: string | undefined;
|
|
214
224
|
errorMessage?: string | undefined;
|
|
215
225
|
};
|
|
@@ -223,6 +233,7 @@ export declare const getQuestionSuccessResponseMessageSchema: z.ZodObject<z.obje
|
|
|
223
233
|
disabled: boolean;
|
|
224
234
|
required: boolean;
|
|
225
235
|
hidden: boolean;
|
|
236
|
+
answer?: unknown;
|
|
226
237
|
semanticColor?: string | undefined;
|
|
227
238
|
errorMessage?: string | undefined;
|
|
228
239
|
};
|
|
@@ -242,7 +253,9 @@ export declare const setQuestionRequestMessageSchema: z.ZodObject<z.objectUtil.e
|
|
|
242
253
|
required: z.ZodOptional<z.ZodBoolean>;
|
|
243
254
|
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
244
255
|
errorMessage: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
256
|
+
answer: z.ZodOptional<z.ZodOptional<z.ZodUnknown>>;
|
|
245
257
|
}, "strip", z.ZodTypeAny, {
|
|
258
|
+
answer?: unknown;
|
|
246
259
|
semanticColor?: string | undefined;
|
|
247
260
|
label?: string | undefined;
|
|
248
261
|
description?: string | undefined;
|
|
@@ -251,6 +264,7 @@ export declare const setQuestionRequestMessageSchema: z.ZodObject<z.objectUtil.e
|
|
|
251
264
|
hidden?: boolean | undefined;
|
|
252
265
|
errorMessage?: string | undefined;
|
|
253
266
|
}, {
|
|
267
|
+
answer?: unknown;
|
|
254
268
|
semanticColor?: string | undefined;
|
|
255
269
|
label?: string | undefined;
|
|
256
270
|
description?: string | undefined;
|
|
@@ -264,6 +278,7 @@ export declare const setQuestionRequestMessageSchema: z.ZodObject<z.objectUtil.e
|
|
|
264
278
|
question: string;
|
|
265
279
|
action: "setQuestion";
|
|
266
280
|
questionData: {
|
|
281
|
+
answer?: unknown;
|
|
267
282
|
semanticColor?: string | undefined;
|
|
268
283
|
label?: string | undefined;
|
|
269
284
|
description?: string | undefined;
|
|
@@ -278,6 +293,7 @@ export declare const setQuestionRequestMessageSchema: z.ZodObject<z.objectUtil.e
|
|
|
278
293
|
question: string;
|
|
279
294
|
action: "setQuestion";
|
|
280
295
|
questionData: {
|
|
296
|
+
answer?: unknown;
|
|
281
297
|
semanticColor?: string | undefined;
|
|
282
298
|
label?: string | undefined;
|
|
283
299
|
description?: string | undefined;
|
|
@@ -690,6 +706,7 @@ export declare function isSaveQuestionnaireRequestMessage(data: unknown): data i
|
|
|
690
706
|
export declare function isCompleteAndCloseQuestionnaireRequestMessage(data: unknown): data is CompleteAndCloseQuestionnaireRequestMessage;
|
|
691
707
|
export declare function isExecuteCustomCommandRequestMessage(data: unknown): data is ExecuteCustomCommandRequestMessage;
|
|
692
708
|
export declare function isWithBusyIndicatorRequestMessage(data: unknown): data is WithBusyIndicatorRequestMessage;
|
|
709
|
+
export declare function isNotRelevantMessage(data: unknown, id: string): boolean;
|
|
693
710
|
export declare function isFetchEntitiesRequestMessage(data: unknown): data is FetchEntitiesRequestMessage;
|
|
694
711
|
export declare function isFetchEntitiesSuccessResponseMessage(data: unknown): data is FetchEntitiesSuccessResponseMessage;
|
|
695
712
|
export declare function isGetEntityByIdRequestMessage(data: unknown): data is GetEntityByIdRequestMessage;
|