@telemetryos/sdk 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var b;(function(a){a.assertEqual=n=>n;function e(n){}a.assertIs=e;function t(n){throw new Error}a.assertNever=t,a.arrayToEnum=n=>{const i={};for(const r of n)i[r]=r;return i},a.getValidEnumValues=n=>{const i=a.objectKeys(n).filter(o=>typeof n[n[o]]!="number"),r={};for(const o of i)r[o]=n[o];return a.objectValues(r)},a.objectValues=n=>a.objectKeys(n).map(function(i){return n[i]}),a.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{const i=[];for(const r in n)Object.prototype.hasOwnProperty.call(n,r)&&i.push(r);return i},a.find=(n,i)=>{for(const r of n)if(i(r))return r},a.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&isFinite(n)&&Math.floor(n)===n;function s(n,i=" | "){return n.map(r=>typeof r=="string"?`'${r}'`:r).join(i)}a.joinValues=s,a.jsonStringifyReplacer=(n,i)=>typeof i=="bigint"?i.toString():i})(b||(b={}));var Ie;(function(a){a.mergeShapes=(e,t)=>({...e,...t})})(Ie||(Ie={}));const h=b.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),E=a=>{switch(typeof a){case"undefined":return h.undefined;case"string":return h.string;case"number":return isNaN(a)?h.nan:h.number;case"boolean":return h.boolean;case"function":return h.function;case"bigint":return h.bigint;case"symbol":return h.symbol;case"object":return Array.isArray(a)?h.array:a===null?h.null:a.then&&typeof a.then=="function"&&a.catch&&typeof a.catch=="function"?h.promise:typeof Map<"u"&&a instanceof Map?h.map:typeof Set<"u"&&a instanceof Set?h.set:typeof Date<"u"&&a instanceof Date?h.date:h.object;default:return h.unknown}},c=b.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"]),it=a=>JSON.stringify(a,null,2).replace(/"([^"]+)":/g,"$1:");let C=class qe extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(i){return i.message},s={_errors:[]},n=i=>{for(const r of i.issues)if(r.code==="invalid_union")r.unionErrors.map(n);else if(r.code==="invalid_return_type")n(r.returnTypeError);else if(r.code==="invalid_arguments")n(r.argumentsError);else if(r.path.length===0)s._errors.push(t(r));else{let o=s,d=0;for(;d<r.path.length;){const u=r.path[d];d===r.path.length-1?(o[u]=o[u]||{_errors:[]},o[u]._errors.push(t(r))):o[u]=o[u]||{_errors:[]},o=o[u],d++}}};return n(this),s}static assert(e){if(!(e instanceof qe))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,b.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},s=[];for(const n of this.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):s.push(e(n));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}};C.create=a=>new C(a);const W=(a,e)=>{let t;switch(a.code){case c.invalid_type:a.received===h.undefined?t="Required":t=`Expected ${a.expected}, received ${a.received}`;break;case c.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(a.expected,b.jsonStringifyReplacer)}`;break;case c.unrecognized_keys:t=`Unrecognized key(s) in object: ${b.joinValues(a.keys,", ")}`;break;case c.invalid_union:t="Invalid input";break;case c.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${b.joinValues(a.options)}`;break;case c.invalid_enum_value:t=`Invalid enum value. Expected ${b.joinValues(a.options)}, received '${a.received}'`;break;case c.invalid_arguments:t="Invalid function arguments";break;case c.invalid_return_type:t="Invalid function return type";break;case c.invalid_date:t="Invalid date";break;case c.invalid_string:typeof a.validation=="object"?"includes"in a.validation?(t=`Invalid input: must include "${a.validation.includes}"`,typeof a.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${a.validation.position}`)):"startsWith"in a.validation?t=`Invalid input: must start with "${a.validation.startsWith}"`:"endsWith"in a.validation?t=`Invalid input: must end with "${a.validation.endsWith}"`:b.assertNever(a.validation):a.validation!=="regex"?t=`Invalid ${a.validation}`:t="Invalid";break;case c.too_small:a.type==="array"?t=`Array must contain ${a.exact?"exactly":a.inclusive?"at least":"more than"} ${a.minimum} element(s)`:a.type==="string"?t=`String must contain ${a.exact?"exactly":a.inclusive?"at least":"over"} ${a.minimum} character(s)`:a.type==="number"?t=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="date"?t=`Date must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(a.minimum))}`:t="Invalid input";break;case c.too_big:a.type==="array"?t=`Array must contain ${a.exact?"exactly":a.inclusive?"at most":"less than"} ${a.maximum} element(s)`:a.type==="string"?t=`String must contain ${a.exact?"exactly":a.inclusive?"at most":"under"} ${a.maximum} character(s)`:a.type==="number"?t=`Number must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="bigint"?t=`BigInt must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="date"?t=`Date must be ${a.exact?"exactly":a.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(a.maximum))}`:t="Invalid input";break;case c.custom:t="Invalid input";break;case c.invalid_intersection_types:t="Intersection results could not be merged";break;case c.not_multiple_of:t=`Number must be a multiple of ${a.multipleOf}`;break;case c.not_finite:t="Number must be finite";break;default:t=e.defaultError,b.assertNever(a)}return{message:t}};let Be=W;function rt(a){Be=a}function ve(){return Be}const be=a=>{const{data:e,path:t,errorMaps:s,issueData:n}=a,i=[...t,...n.path||[]],r={...n,path:i};if(n.message!==void 0)return{...n,path:i,message:n.message};let o="";const d=s.filter(u=>!!u).slice().reverse();for(const u of d)o=u(r,{data:e,defaultError:o}).message;return{...n,path:i,message:o}},ot=[];function l(a,e){const t=ve(),s=be({issueData:e,data:a.data,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,t,t===W?void 0:W].filter(n=>!!n)});a.common.issues.push(s)}let Z=class Ve{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const s=[];for(const n of t){if(n.status==="aborted")return f;n.status==="dirty"&&e.dirty(),s.push(n.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){const s=[];for(const n of t){const i=await n.key,r=await n.value;s.push({key:i,value:r})}return Ve.mergeObjectSync(e,s)}static mergeObjectSync(e,t){const s={};for(const n of t){const{key:i,value:r}=n;if(i.status==="aborted"||r.status==="aborted")return f;i.status==="dirty"&&e.dirty(),r.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof r.value<"u"||n.alwaysSet)&&(s[i.value]=r.value)}return{status:e.value,value:s}}};const f=Object.freeze({status:"aborted"}),ke=a=>({status:"dirty",value:a}),x=a=>({status:"valid",value:a}),Ee=a=>a.status==="aborted",$e=a=>a.status==="dirty",z=a=>a.status==="valid",ee=a=>typeof Promise<"u"&&a instanceof Promise;function we(a,e,t,s){if(typeof e=="function"?a!==e||!0:!e.has(a))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(a)}function Ue(a,e,t,s,n){if(typeof e=="function"?a!==e||!0:!e.has(a))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(a,t),t}var p;(function(a){a.errToObj=e=>typeof e=="string"?{message:e}:e||{},a.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(p||(p={}));var G,X;class A{constructor(e,t,s,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=n}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 Le=(a,e)=>{if(z(e))return{success:!0,data:e.value};if(!a.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new C(a.common.issues);return this._error=t,this._error}}};function y(a){if(!a)return{};const{errorMap:e,invalid_type_error:t,required_error:s,description:n}=a;if(e&&(t||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(i,r)=>{var o,d;const{message:u}=a;return i.code==="invalid_enum_value"?{message:u??r.defaultError}:typeof r.data>"u"?{message:(o=u??s)!==null&&o!==void 0?o:r.defaultError}:i.code!=="invalid_type"?{message:r.defaultError}:{message:(d=u??t)!==null&&d!==void 0?d:r.defaultError}},description:n}}class _{get description(){return this._def.description}_getType(e){return E(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:E(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Z,ctx:{common:e.parent.common,data:e.data,parsedType:E(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(ee(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){var s;const n={common:{issues:[],async:(s=t==null?void 0:t.async)!==null&&s!==void 0?s:!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:E(e)},i=this._parseSync({data:e,path:n.path,parent:n});return Le(n,i)}"~validate"(e){var t,s;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:E(e)};if(!this["~standard"].async)try{const i=this._parseSync({data:e,path:[],parent:n});return z(i)?{value:i.value}:{issues:n.common.issues}}catch(i){!((s=(t=i==null?void 0:i.message)===null||t===void 0?void 0:t.toLowerCase())===null||s===void 0)&&s.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(i=>z(i)?{value:i.value}:{issues:n.common.issues})}async parseAsync(e,t){const s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){const s={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:E(e)},n=this._parse({data:e,path:s.path,parent:s}),i=await(ee(n)?n:Promise.resolve(n));return Le(s,i)}refine(e,t){const s=n=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(n):t;return this._refinement((n,i)=>{const r=e(n),o=()=>i.addIssue({code:c.custom,...s(n)});return typeof Promise<"u"&&r instanceof Promise?r.then(d=>d?!0:(o(),!1)):r?!0:(o(),!1)})}refinement(e,t){return this._refinement((s,n)=>e(s)?!0:(n.addIssue(typeof t=="function"?t(s,n):t),!1))}_refinement(e){return new S({schema:this,typeName:m.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return O.create(this,this._def)}nullable(){return M.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return B.create(this)}promise(){return Y.create(this,this._def)}or(e){return ie.create([this,e],this._def)}and(e){return re.create(this,e,this._def)}transform(e){return new S({...y(this._def),schema:this,typeName:m.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new le({...y(this._def),innerType:this,defaultValue:t,typeName:m.ZodDefault})}brand(){return new Fe({typeName:m.ZodBranded,type:this,...y(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new he({...y(this._def),innerType:this,catchValue:t,typeName:m.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return fe.create(this,e)}readonly(){return pe.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const dt=/^c[^\s-]{8,}$/i,ct=/^[0-9a-z]+$/,ut=/^[0-9A-HJKMNP-TV-Z]{26}$/i,lt=/^[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,ht=/^[a-z0-9_-]{21}$/i,pt=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,mt=/^[-+]?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)?)??$/,ft=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,yt="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Ae;const gt=/^(?:(?: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])$/,_t=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,vt=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,bt=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,kt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,wt=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Ke="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",xt=new RegExp(`^${Ke}$`);function He(a){let e="[0-5]\\d";a.precision?e=`${e}\\.\\d{${a.precision}}`:a.precision==null&&(e=`${e}(\\.\\d+)?`);const t=a.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function Zt(a){return new RegExp(`^${He(a)}$`)}function We(a){let e=`${Ke}T${He(a)}`;const t=[];return t.push(a.local?"Z?":"Z"),a.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Tt(a,e){return!!((e==="v4"||!e)&&gt.test(a)||(e==="v6"||!e)&&vt.test(a))}function Nt(a,e){if(!pt.test(a))return!1;try{const[t]=a.split("."),s=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),n=JSON.parse(atob(s));return!(typeof n!="object"||n===null||!n.typ||!n.alg||e&&n.alg!==e)}catch{return!1}}function Ct(a,e){return!!((e==="v4"||!e)&&_t.test(a)||(e==="v6"||!e)&&bt.test(a))}class N extends _{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==h.string){const n=this._getOrReturnCtx(e);return l(n,{code:c.invalid_type,expected:h.string,received:n.parsedType}),f}const t=new Z;let s;for(const n of this._def.checks)if(n.kind==="min")e.data.length<n.value&&(s=this._getOrReturnCtx(e,s),l(s,{code:c.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),t.dirty());else if(n.kind==="max")e.data.length>n.value&&(s=this._getOrReturnCtx(e,s),l(s,{code:c.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),t.dirty());else if(n.kind==="length"){const i=e.data.length>n.value,r=e.data.length<n.value;(i||r)&&(s=this._getOrReturnCtx(e,s),i?l(s,{code:c.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):r&&l(s,{code:c.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),t.dirty())}else if(n.kind==="email")ft.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"email",code:c.invalid_string,message:n.message}),t.dirty());else if(n.kind==="emoji")Ae||(Ae=new RegExp(yt,"u")),Ae.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"emoji",code:c.invalid_string,message:n.message}),t.dirty());else if(n.kind==="uuid")lt.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"uuid",code:c.invalid_string,message:n.message}),t.dirty());else if(n.kind==="nanoid")ht.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"nanoid",code:c.invalid_string,message:n.message}),t.dirty());else if(n.kind==="cuid")dt.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"cuid",code:c.invalid_string,message:n.message}),t.dirty());else if(n.kind==="cuid2")ct.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"cuid2",code:c.invalid_string,message:n.message}),t.dirty());else if(n.kind==="ulid")ut.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"ulid",code:c.invalid_string,message:n.message}),t.dirty());else if(n.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),l(s,{validation:"url",code:c.invalid_string,message:n.message}),t.dirty()}else n.kind==="regex"?(n.regex.lastIndex=0,n.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"regex",code:c.invalid_string,message:n.message}),t.dirty())):n.kind==="trim"?e.data=e.data.trim():n.kind==="includes"?e.data.includes(n.value,n.position)||(s=this._getOrReturnCtx(e,s),l(s,{code:c.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),t.dirty()):n.kind==="toLowerCase"?e.data=e.data.toLowerCase():n.kind==="toUpperCase"?e.data=e.data.toUpperCase():n.kind==="startsWith"?e.data.startsWith(n.value)||(s=this._getOrReturnCtx(e,s),l(s,{code:c.invalid_string,validation:{startsWith:n.value},message:n.message}),t.dirty()):n.kind==="endsWith"?e.data.endsWith(n.value)||(s=this._getOrReturnCtx(e,s),l(s,{code:c.invalid_string,validation:{endsWith:n.value},message:n.message}),t.dirty()):n.kind==="datetime"?We(n).test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{code:c.invalid_string,validation:"datetime",message:n.message}),t.dirty()):n.kind==="date"?xt.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{code:c.invalid_string,validation:"date",message:n.message}),t.dirty()):n.kind==="time"?Zt(n).test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{code:c.invalid_string,validation:"time",message:n.message}),t.dirty()):n.kind==="duration"?mt.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"duration",code:c.invalid_string,message:n.message}),t.dirty()):n.kind==="ip"?Tt(e.data,n.version)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"ip",code:c.invalid_string,message:n.message}),t.dirty()):n.kind==="jwt"?Nt(e.data,n.alg)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"jwt",code:c.invalid_string,message:n.message}),t.dirty()):n.kind==="cidr"?Ct(e.data,n.version)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"cidr",code:c.invalid_string,message:n.message}),t.dirty()):n.kind==="base64"?kt.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"base64",code:c.invalid_string,message:n.message}),t.dirty()):n.kind==="base64url"?wt.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"base64url",code:c.invalid_string,message:n.message}),t.dirty()):b.assertNever(n);return{status:t.value,value:e.data}}_regex(e,t,s){return this.refinement(n=>e.test(n),{validation:t,code:c.invalid_string,...p.errToObj(s)})}_addCheck(e){return new N({...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)})}base64url(e){return this._addCheck({kind:"base64url",...p.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...p.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...p.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...p.errToObj(e)})}datetime(e){var t,s;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(t=e==null?void 0:e.offset)!==null&&t!==void 0?t:!1,local:(s=e==null?void 0:e.local)!==null&&s!==void 0?s:!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,t){return this._addCheck({kind:"regex",regex:e,...p.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...p.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...p.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...p.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...p.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...p.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...p.errToObj(t)})}nonempty(e){return this.min(1,p.errToObj(e))}trim(){return new N({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new N({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new N({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}N.create=a=>{var e;return new N({checks:[],typeName:m.ZodString,coerce:(e=a==null?void 0:a.coerce)!==null&&e!==void 0?e:!1,...y(a)})};function St(a,e){const t=(a.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,n=t>s?t:s,i=parseInt(a.toFixed(n).replace(".","")),r=parseInt(e.toFixed(n).replace(".",""));return i%r/Math.pow(10,n)}class R 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)!==h.number){const n=this._getOrReturnCtx(e);return l(n,{code:c.invalid_type,expected:h.number,received:n.parsedType}),f}let t;const s=new Z;for(const n of this._def.checks)n.kind==="int"?b.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),l(t,{code:c.invalid_type,expected:"integer",received:"float",message:n.message}),s.dirty()):n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),l(t,{code:c.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),s.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),l(t,{code:c.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),s.dirty()):n.kind==="multipleOf"?St(e.data,n.value)!==0&&(t=this._getOrReturnCtx(e,t),l(t,{code:c.not_multiple_of,multipleOf:n.value,message:n.message}),s.dirty()):n.kind==="finite"?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),l(t,{code:c.not_finite,message:n.message}),s.dirty()):b.assertNever(n);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,p.toString(t))}gt(e,t){return this.setLimit("min",e,!1,p.toString(t))}lte(e,t){return this.setLimit("max",e,!0,p.toString(t))}lt(e,t){return this.setLimit("max",e,!1,p.toString(t))}setLimit(e,t,s,n){return new R({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:p.toString(n)}]})}_addCheck(e){return new R({...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,t){return this._addCheck({kind:"multipleOf",value:e,message:p.toString(t)})}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 t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&b.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(t===null||s.value>t)&&(t=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}}R.create=a=>new R({checks:[],typeName:m.ZodNumber,coerce:(a==null?void 0:a.coerce)||!1,...y(a)});let te=class Pe extends _{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==h.bigint)return this._getInvalidInput(e);let t;const s=new Z;for(const n of this._def.checks)n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),l(t,{code:c.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),s.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),l(t,{code:c.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),s.dirty()):n.kind==="multipleOf"?e.data%n.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),l(t,{code:c.not_multiple_of,multipleOf:n.value,message:n.message}),s.dirty()):b.assertNever(n);return{status:s.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return l(t,{code:c.invalid_type,expected:h.bigint,received:t.parsedType}),f}gte(e,t){return this.setLimit("min",e,!0,p.toString(t))}gt(e,t){return this.setLimit("min",e,!1,p.toString(t))}lte(e,t){return this.setLimit("max",e,!0,p.toString(t))}lt(e,t){return this.setLimit("max",e,!1,p.toString(t))}setLimit(e,t,s,n){return new Pe({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:p.toString(n)}]})}_addCheck(e){return new Pe({...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,t){return this._addCheck({kind:"multipleOf",value:e,message:p.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};te.create=a=>{var e;return new te({checks:[],typeName:m.ZodBigInt,coerce:(e=a==null?void 0:a.coerce)!==null&&e!==void 0?e:!1,...y(a)})};class se extends _{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==h.boolean){const t=this._getOrReturnCtx(e);return l(t,{code:c.invalid_type,expected:h.boolean,received:t.parsedType}),f}return x(e.data)}}se.create=a=>new se({typeName:m.ZodBoolean,coerce:(a==null?void 0:a.coerce)||!1,...y(a)});class q extends _{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==h.date){const n=this._getOrReturnCtx(e);return l(n,{code:c.invalid_type,expected:h.date,received:n.parsedType}),f}if(isNaN(e.data.getTime())){const n=this._getOrReturnCtx(e);return l(n,{code:c.invalid_date}),f}const t=new Z;let s;for(const n of this._def.checks)n.kind==="min"?e.data.getTime()<n.value&&(s=this._getOrReturnCtx(e,s),l(s,{code:c.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),t.dirty()):n.kind==="max"?e.data.getTime()>n.value&&(s=this._getOrReturnCtx(e,s),l(s,{code:c.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),t.dirty()):b.assertNever(n);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new q({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:p.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:p.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}q.create=a=>new q({checks:[],coerce:(a==null?void 0:a.coerce)||!1,typeName:m.ZodDate,...y(a)});class xe extends _{_parse(e){if(this._getType(e)!==h.symbol){const t=this._getOrReturnCtx(e);return l(t,{code:c.invalid_type,expected:h.symbol,received:t.parsedType}),f}return x(e.data)}}xe.create=a=>new xe({typeName:m.ZodSymbol,...y(a)});class ae extends _{_parse(e){if(this._getType(e)!==h.undefined){const t=this._getOrReturnCtx(e);return l(t,{code:c.invalid_type,expected:h.undefined,received:t.parsedType}),f}return x(e.data)}}ae.create=a=>new ae({typeName:m.ZodUndefined,...y(a)});class ne extends _{_parse(e){if(this._getType(e)!==h.null){const t=this._getOrReturnCtx(e);return l(t,{code:c.invalid_type,expected:h.null,received:t.parsedType}),f}return x(e.data)}}ne.create=a=>new ne({typeName:m.ZodNull,...y(a)});let J=class extends _{constructor(){super(...arguments),this._any=!0}_parse(e){return x(e.data)}};J.create=a=>new J({typeName:m.ZodAny,...y(a)});class D extends _{constructor(){super(...arguments),this._unknown=!0}_parse(e){return x(e.data)}}D.create=a=>new D({typeName:m.ZodUnknown,...y(a)});let $=class extends _{_parse(e){const t=this._getOrReturnCtx(e);return l(t,{code:c.invalid_type,expected:h.never,received:t.parsedType}),f}};$.create=a=>new $({typeName:m.ZodNever,...y(a)});class Ze extends _{_parse(e){if(this._getType(e)!==h.undefined){const t=this._getOrReturnCtx(e);return l(t,{code:c.invalid_type,expected:h.void,received:t.parsedType}),f}return x(e.data)}}Ze.create=a=>new Ze({typeName:m.ZodVoid,...y(a)});let B=class _e extends _{_parse(e){const{ctx:t,status:s}=this._processInputParams(e),n=this._def;if(t.parsedType!==h.array)return l(t,{code:c.invalid_type,expected:h.array,received:t.parsedType}),f;if(n.exactLength!==null){const r=t.data.length>n.exactLength.value,o=t.data.length<n.exactLength.value;(r||o)&&(l(t,{code:r?c.too_big:c.too_small,minimum:o?n.exactLength.value:void 0,maximum:r?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),s.dirty())}if(n.minLength!==null&&t.data.length<n.minLength.value&&(l(t,{code:c.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),s.dirty()),n.maxLength!==null&&t.data.length>n.maxLength.value&&(l(t,{code:c.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map((r,o)=>n.type._parseAsync(new A(t,r,t.path,o)))).then(r=>Z.mergeArray(s,r));const i=[...t.data].map((r,o)=>n.type._parseSync(new A(t,r,t.path,o)));return Z.mergeArray(s,i)}get element(){return this._def.type}min(e,t){return new _e({...this._def,minLength:{value:e,message:p.toString(t)}})}max(e,t){return new _e({...this._def,maxLength:{value:e,message:p.toString(t)}})}length(e,t){return new _e({...this._def,exactLength:{value:e,message:p.toString(t)}})}nonempty(e){return this.min(1,e)}};B.create=(a,e)=>new B({type:a,minLength:null,maxLength:null,exactLength:null,typeName:m.ZodArray,...y(e)});function K(a){if(a instanceof k){const e={};for(const t in a.shape){const s=a.shape[t];e[t]=O.create(K(s))}return new k({...a._def,shape:()=>e})}else return a instanceof B?new B({...a._def,type:K(a.element)}):a instanceof O?O.create(K(a.unwrap())):a instanceof M?M.create(K(a.unwrap())):a instanceof j?j.create(a.items.map(e=>K(e))):a}class k 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(),t=b.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==h.object){const d=this._getOrReturnCtx(e);return l(d,{code:c.invalid_type,expected:h.object,received:d.parsedType}),f}const{status:t,ctx:s}=this._processInputParams(e),{shape:n,keys:i}=this._getCached(),r=[];if(!(this._def.catchall instanceof $&&this._def.unknownKeys==="strip"))for(const d in s.data)i.includes(d)||r.push(d);const o=[];for(const d of i){const u=n[d],g=s.data[d];o.push({key:{status:"valid",value:d},value:u._parse(new A(s,g,s.path,d)),alwaysSet:d in s.data})}if(this._def.catchall instanceof $){const d=this._def.unknownKeys;if(d==="passthrough")for(const u of r)o.push({key:{status:"valid",value:u},value:{status:"valid",value:s.data[u]}});else if(d==="strict")r.length>0&&(l(s,{code:c.unrecognized_keys,keys:r}),t.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const d=this._def.catchall;for(const u of r){const g=s.data[u];o.push({key:{status:"valid",value:u},value:d._parse(new A(s,g,s.path,u)),alwaysSet:u in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const d=[];for(const u of o){const g=await u.key,w=await u.value;d.push({key:g,value:w,alwaysSet:u.alwaysSet})}return d}).then(d=>Z.mergeObjectSync(t,d)):Z.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return p.errToObj,new k({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{var n,i,r,o;const d=(r=(i=(n=this._def).errorMap)===null||i===void 0?void 0:i.call(n,t,s).message)!==null&&r!==void 0?r:s.defaultError;return t.code==="unrecognized_keys"?{message:(o=p.errToObj(e).message)!==null&&o!==void 0?o:d}:{message:d}}}:{}})}strip(){return new k({...this._def,unknownKeys:"strip"})}passthrough(){return new k({...this._def,unknownKeys:"passthrough"})}extend(e){return new k({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new k({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:m.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new k({...this._def,catchall:e})}pick(e){const t={};return b.objectKeys(e).forEach(s=>{e[s]&&this.shape[s]&&(t[s]=this.shape[s])}),new k({...this._def,shape:()=>t})}omit(e){const t={};return b.objectKeys(this.shape).forEach(s=>{e[s]||(t[s]=this.shape[s])}),new k({...this._def,shape:()=>t})}deepPartial(){return K(this)}partial(e){const t={};return b.objectKeys(this.shape).forEach(s=>{const n=this.shape[s];e&&!e[s]?t[s]=n:t[s]=n.optional()}),new k({...this._def,shape:()=>t})}required(e){const t={};return b.objectKeys(this.shape).forEach(s=>{if(e&&!e[s])t[s]=this.shape[s];else{let n=this.shape[s];for(;n instanceof O;)n=n._def.innerType;t[s]=n}}),new k({...this._def,shape:()=>t})}keyof(){return Je(b.objectKeys(this.shape))}}k.create=(a,e)=>new k({shape:()=>a,unknownKeys:"strip",catchall:$.create(),typeName:m.ZodObject,...y(e)});k.strictCreate=(a,e)=>new k({shape:()=>a,unknownKeys:"strict",catchall:$.create(),typeName:m.ZodObject,...y(e)});k.lazycreate=(a,e)=>new k({shape:a,unknownKeys:"strip",catchall:$.create(),typeName:m.ZodObject,...y(e)});class ie extends _{_parse(e){const{ctx:t}=this._processInputParams(e),s=this._def.options;function n(i){for(const o of i)if(o.result.status==="valid")return o.result;for(const o of i)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const r=i.map(o=>new C(o.ctx.common.issues));return l(t,{code:c.invalid_union,unionErrors:r}),f}if(t.common.async)return Promise.all(s.map(async i=>{const r={...t,common:{...t.common,issues:[]},parent:null};return{result:await i._parseAsync({data:t.data,path:t.path,parent:r}),ctx:r}})).then(n);{let i;const r=[];for(const d of s){const u={...t,common:{...t.common,issues:[]},parent:null},g=d._parseSync({data:t.data,path:t.path,parent:u});if(g.status==="valid")return g;g.status==="dirty"&&!i&&(i={result:g,ctx:u}),u.common.issues.length&&r.push(u.common.issues)}if(i)return t.common.issues.push(...i.ctx.common.issues),i.result;const o=r.map(d=>new C(d));return l(t,{code:c.invalid_union,unionErrors:o}),f}}get options(){return this._def.options}}ie.create=(a,e)=>new ie({options:a,typeName:m.ZodUnion,...y(e)});const P=a=>a instanceof de?P(a.schema):a instanceof S?P(a.innerType()):a instanceof ce?[a.value]:a instanceof me?a.options:a instanceof ue?b.objectValues(a.enum):a instanceof le?P(a._def.innerType):a instanceof ae?[void 0]:a instanceof ne?[null]:a instanceof O?[void 0,...P(a.unwrap())]:a instanceof M?[null,...P(a.unwrap())]:a instanceof Fe||a instanceof pe?P(a.unwrap()):a instanceof he?P(a._def.innerType):[];class Ce extends _{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==h.object)return l(t,{code:c.invalid_type,expected:h.object,received:t.parsedType}),f;const s=this.discriminator,n=t.data[s],i=this.optionsMap.get(n);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(l(t,{code:c.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),f)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){const n=new Map;for(const i of t){const r=P(i.shape[e]);if(!r.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of r){if(n.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);n.set(o,i)}}return new Ce({typeName:m.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...y(s)})}}function Re(a,e){const t=E(a),s=E(e);if(a===e)return{valid:!0,data:a};if(t===h.object&&s===h.object){const n=b.objectKeys(e),i=b.objectKeys(a).filter(o=>n.indexOf(o)!==-1),r={...a,...e};for(const o of i){const d=Re(a[o],e[o]);if(!d.valid)return{valid:!1};r[o]=d.data}return{valid:!0,data:r}}else if(t===h.array&&s===h.array){if(a.length!==e.length)return{valid:!1};const n=[];for(let i=0;i<a.length;i++){const r=a[i],o=e[i],d=Re(r,o);if(!d.valid)return{valid:!1};n.push(d.data)}return{valid:!0,data:n}}else return t===h.date&&s===h.date&&+a==+e?{valid:!0,data:a}:{valid:!1}}class re extends _{_parse(e){const{status:t,ctx:s}=this._processInputParams(e),n=(i,r)=>{if(Ee(i)||Ee(r))return f;const o=Re(i.value,r.value);return o.valid?(($e(i)||$e(r))&&t.dirty(),{status:t.value,value:o.data}):(l(s,{code:c.invalid_intersection_types}),f)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([i,r])=>n(i,r)):n(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}re.create=(a,e,t)=>new re({left:a,right:e,typeName:m.ZodIntersection,...y(t)});class j extends _{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==h.array)return l(s,{code:c.invalid_type,expected:h.array,received:s.parsedType}),f;if(s.data.length<this._def.items.length)return l(s,{code:c.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),f;!this._def.rest&&s.data.length>this._def.items.length&&(l(s,{code:c.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const n=[...s.data].map((i,r)=>{const o=this._def.items[r]||this._def.rest;return o?o._parse(new A(s,i,s.path,r)):null}).filter(i=>!!i);return s.common.async?Promise.all(n).then(i=>Z.mergeArray(t,i)):Z.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new j({...this._def,rest:e})}}j.create=(a,e)=>{if(!Array.isArray(a))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new j({items:a,typeName:m.ZodTuple,rest:null,...y(e)})};class oe extends _{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==h.object)return l(s,{code:c.invalid_type,expected:h.object,received:s.parsedType}),f;const n=[],i=this._def.keyType,r=this._def.valueType;for(const o in s.data)n.push({key:i._parse(new A(s,o,s.path,o)),value:r._parse(new A(s,s.data[o],s.path,o)),alwaysSet:o in s.data});return s.common.async?Z.mergeObjectAsync(t,n):Z.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof _?new oe({keyType:e,valueType:t,typeName:m.ZodRecord,...y(s)}):new oe({keyType:N.create(),valueType:e,typeName:m.ZodRecord,...y(t)})}}class Te extends _{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==h.map)return l(s,{code:c.invalid_type,expected:h.map,received:s.parsedType}),f;const n=this._def.keyType,i=this._def.valueType,r=[...s.data.entries()].map(([o,d],u)=>({key:n._parse(new A(s,o,s.path,[u,"key"])),value:i._parse(new A(s,d,s.path,[u,"value"]))}));if(s.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const d of r){const u=await d.key,g=await d.value;if(u.status==="aborted"||g.status==="aborted")return f;(u.status==="dirty"||g.status==="dirty")&&t.dirty(),o.set(u.value,g.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const d of r){const u=d.key,g=d.value;if(u.status==="aborted"||g.status==="aborted")return f;(u.status==="dirty"||g.status==="dirty")&&t.dirty(),o.set(u.value,g.value)}return{status:t.value,value:o}}}}Te.create=(a,e,t)=>new Te({valueType:e,keyType:a,typeName:m.ZodMap,...y(t)});class V extends _{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==h.set)return l(s,{code:c.invalid_type,expected:h.set,received:s.parsedType}),f;const n=this._def;n.minSize!==null&&s.data.size<n.minSize.value&&(l(s,{code:c.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),n.maxSize!==null&&s.data.size>n.maxSize.value&&(l(s,{code:c.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());const i=this._def.valueType;function r(d){const u=new Set;for(const g of d){if(g.status==="aborted")return f;g.status==="dirty"&&t.dirty(),u.add(g.value)}return{status:t.value,value:u}}const o=[...s.data.values()].map((d,u)=>i._parse(new A(s,d,s.path,u)));return s.common.async?Promise.all(o).then(d=>r(d)):r(o)}min(e,t){return new V({...this._def,minSize:{value:e,message:p.toString(t)}})}max(e,t){return new V({...this._def,maxSize:{value:e,message:p.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}V.create=(a,e)=>new V({valueType:a,minSize:null,maxSize:null,typeName:m.ZodSet,...y(e)});class H extends _{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==h.function)return l(t,{code:c.invalid_type,expected:h.function,received:t.parsedType}),f;function s(o,d){return be({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ve(),W].filter(u=>!!u),issueData:{code:c.invalid_arguments,argumentsError:d}})}function n(o,d){return be({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ve(),W].filter(u=>!!u),issueData:{code:c.invalid_return_type,returnTypeError:d}})}const i={errorMap:t.common.contextualErrorMap},r=t.data;if(this._def.returns instanceof Y){const o=this;return x(async function(...d){const u=new C([]),g=await o._def.args.parseAsync(d,i).catch(I=>{throw u.addIssue(s(d,I)),u}),w=await Reflect.apply(r,this,g);return await o._def.returns._def.type.parseAsync(w,i).catch(I=>{throw u.addIssue(n(w,I)),u})})}else{const o=this;return x(function(...d){const u=o._def.args.safeParse(d,i);if(!u.success)throw new C([s(d,u.error)]);const g=Reflect.apply(r,this,u.data),w=o._def.returns.safeParse(g,i);if(!w.success)throw new C([n(g,w.error)]);return w.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new H({...this._def,args:j.create(e).rest(D.create())})}returns(e){return new H({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,s){return new H({args:e||j.create([]).rest(D.create()),returns:t||D.create(),typeName:m.ZodFunction,...y(s)})}}class de extends _{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}de.create=(a,e)=>new de({getter:a,typeName:m.ZodLazy,...y(e)});class ce extends _{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return l(t,{received:t.data,code:c.invalid_literal,expected:this._def.value}),f}return{status:"valid",value:e.data}}get value(){return this._def.value}}ce.create=(a,e)=>new ce({value:a,typeName:m.ZodLiteral,...y(e)});function Je(a,e){return new me({values:a,typeName:m.ZodEnum,...y(e)})}let me=class Me extends _{constructor(){super(...arguments),G.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),s=this._def.values;return l(t,{expected:b.joinValues(s),received:t.parsedType,code:c.invalid_type}),f}if(we(this,G)||Ue(this,G,new Set(this._def.values)),!we(this,G).has(e.data)){const t=this._getOrReturnCtx(e),s=this._def.values;return l(t,{received:t.data,code:c.invalid_enum_value,options:s}),f}return x(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return Me.create(e,{...this._def,...t})}exclude(e,t=this._def){return Me.create(this.options.filter(s=>!e.includes(s)),{...this._def,...t})}};G=new WeakMap;me.create=Je;class ue extends _{constructor(){super(...arguments),X.set(this,void 0)}_parse(e){const t=b.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==h.string&&s.parsedType!==h.number){const n=b.objectValues(t);return l(s,{expected:b.joinValues(n),received:s.parsedType,code:c.invalid_type}),f}if(we(this,X)||Ue(this,X,new Set(b.getValidEnumValues(this._def.values))),!we(this,X).has(e.data)){const n=b.objectValues(t);return l(s,{received:s.data,code:c.invalid_enum_value,options:n}),f}return x(e.data)}get enum(){return this._def.values}}X=new WeakMap;ue.create=(a,e)=>new ue({values:a,typeName:m.ZodNativeEnum,...y(e)});class Y extends _{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==h.promise&&t.common.async===!1)return l(t,{code:c.invalid_type,expected:h.promise,received:t.parsedType}),f;const s=t.parsedType===h.promise?t.data:Promise.resolve(t.data);return x(s.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Y.create=(a,e)=>new Y({type:a,typeName:m.ZodPromise,...y(e)});class S 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:t,ctx:s}=this._processInputParams(e),n=this._def.effect||null,i={addIssue:r=>{l(s,r),r.fatal?t.abort():t.dirty()},get path(){return s.path}};if(i.addIssue=i.addIssue.bind(i),n.type==="preprocess"){const r=n.transform(s.data,i);if(s.common.async)return Promise.resolve(r).then(async o=>{if(t.value==="aborted")return f;const d=await this._def.schema._parseAsync({data:o,path:s.path,parent:s});return d.status==="aborted"?f:d.status==="dirty"||t.value==="dirty"?ke(d.value):d});{if(t.value==="aborted")return f;const o=this._def.schema._parseSync({data:r,path:s.path,parent:s});return o.status==="aborted"?f:o.status==="dirty"||t.value==="dirty"?ke(o.value):o}}if(n.type==="refinement"){const r=o=>{const d=n.refinement(o,i);if(s.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(s.common.async===!1){const o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return o.status==="aborted"?f:(o.status==="dirty"&&t.dirty(),r(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>o.status==="aborted"?f:(o.status==="dirty"&&t.dirty(),r(o.value).then(()=>({status:t.value,value:o.value}))))}if(n.type==="transform")if(s.common.async===!1){const r=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!z(r))return r;const o=n.transform(r.value,i);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(r=>z(r)?Promise.resolve(n.transform(r.value,i)).then(o=>({status:t.value,value:o})):r);b.assertNever(n)}}S.create=(a,e,t)=>new S({schema:a,typeName:m.ZodEffects,effect:e,...y(t)});S.createWithPreprocess=(a,e,t)=>new S({schema:e,effect:{type:"preprocess",transform:a},typeName:m.ZodEffects,...y(t)});let O=class extends _{_parse(e){return this._getType(e)===h.undefined?x(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};O.create=(a,e)=>new O({innerType:a,typeName:m.ZodOptional,...y(e)});let M=class extends _{_parse(e){return this._getType(e)===h.null?x(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};M.create=(a,e)=>new M({innerType:a,typeName:m.ZodNullable,...y(e)});class le extends _{_parse(e){const{ctx:t}=this._processInputParams(e);let s=t.data;return t.parsedType===h.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}le.create=(a,e)=>new le({innerType:a,typeName:m.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...y(e)});class he extends _{_parse(e){const{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return ee(n)?n.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new C(s.common.issues)},input:s.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new C(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}he.create=(a,e)=>new he({innerType:a,typeName:m.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...y(e)});class Ne extends _{_parse(e){if(this._getType(e)!==h.nan){const t=this._getOrReturnCtx(e);return l(t,{code:c.invalid_type,expected:h.nan,received:t.parsedType}),f}return{status:"valid",value:e.data}}}Ne.create=a=>new Ne({typeName:m.ZodNaN,...y(a)});const Ot=Symbol("zod_brand");class Fe extends _{_parse(e){const{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}}class fe extends _{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{const n=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?f:n.status==="dirty"?(t.dirty(),ke(n.value)):this._def.out._parseAsync({data:n.value,path:s.path,parent:s})})();{const n=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?f:n.status==="dirty"?(t.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:s.path,parent:s})}}static create(e,t){return new fe({in:e,out:t,typeName:m.ZodPipeline})}}class pe extends _{_parse(e){const t=this._def.innerType._parse(e),s=n=>(z(n)&&(n.value=Object.freeze(n.value)),n);return ee(t)?t.then(n=>s(n)):s(t)}unwrap(){return this._def.innerType}}pe.create=(a,e)=>new pe({innerType:a,typeName:m.ZodReadonly,...y(e)});function De(a,e){const t=typeof a=="function"?a(e):typeof a=="string"?{message:a}:a;return typeof t=="string"?{message:t}:t}function Ye(a,e={},t){return a?J.create().superRefine((s,n)=>{var i,r;const o=a(s);if(o instanceof Promise)return o.then(d=>{var u,g;if(!d){const w=De(e,s),I=(g=(u=w.fatal)!==null&&u!==void 0?u:t)!==null&&g!==void 0?g:!0;n.addIssue({code:"custom",...w,fatal:I})}});if(!o){const d=De(e,s),u=(r=(i=d.fatal)!==null&&i!==void 0?i:t)!==null&&r!==void 0?r:!0;n.addIssue({code:"custom",...d,fatal:u})}}):J.create()}const At={object:k.lazycreate};var m;(function(a){a.ZodString="ZodString",a.ZodNumber="ZodNumber",a.ZodNaN="ZodNaN",a.ZodBigInt="ZodBigInt",a.ZodBoolean="ZodBoolean",a.ZodDate="ZodDate",a.ZodSymbol="ZodSymbol",a.ZodUndefined="ZodUndefined",a.ZodNull="ZodNull",a.ZodAny="ZodAny",a.ZodUnknown="ZodUnknown",a.ZodNever="ZodNever",a.ZodVoid="ZodVoid",a.ZodArray="ZodArray",a.ZodObject="ZodObject",a.ZodUnion="ZodUnion",a.ZodDiscriminatedUnion="ZodDiscriminatedUnion",a.ZodIntersection="ZodIntersection",a.ZodTuple="ZodTuple",a.ZodRecord="ZodRecord",a.ZodMap="ZodMap",a.ZodSet="ZodSet",a.ZodFunction="ZodFunction",a.ZodLazy="ZodLazy",a.ZodLiteral="ZodLiteral",a.ZodEnum="ZodEnum",a.ZodEffects="ZodEffects",a.ZodNativeEnum="ZodNativeEnum",a.ZodOptional="ZodOptional",a.ZodNullable="ZodNullable",a.ZodDefault="ZodDefault",a.ZodCatch="ZodCatch",a.ZodPromise="ZodPromise",a.ZodBranded="ZodBranded",a.ZodPipeline="ZodPipeline",a.ZodReadonly="ZodReadonly"})(m||(m={}));const jt=(a,e={message:`Input not instance of ${a.name}`})=>Ye(t=>t instanceof a,e),Ge=N.create,Xe=R.create,It=Ne.create,Et=te.create,Qe=se.create,$t=q.create,Pt=xe.create,Rt=ae.create,Mt=ne.create,Ft=J.create,Lt=D.create,Dt=$.create,zt=Ze.create,qt=B.create,Bt=k.create,Vt=k.strictCreate,Ut=ie.create,Kt=Ce.create,Ht=re.create,Wt=j.create,Jt=oe.create,Yt=Te.create,Gt=V.create,Xt=H.create,Qt=de.create,es=ce.create,ts=me.create,ss=ue.create,as=Y.create,ze=S.create,ns=O.create,is=M.create,rs=S.createWithPreprocess,os=fe.create,ds=()=>Ge().optional(),cs=()=>Xe().optional(),us=()=>Qe().optional(),ls={string:a=>N.create({...a,coerce:!0}),number:a=>R.create({...a,coerce:!0}),boolean:a=>se.create({...a,coerce:!0}),bigint:a=>te.create({...a,coerce:!0}),date:a=>q.create({...a,coerce:!0})},hs=f;var je=Object.freeze({__proto__:null,defaultErrorMap:W,setErrorMap:rt,getErrorMap:ve,makeIssue:be,EMPTY_PATH:ot,addIssueToContext:l,ParseStatus:Z,INVALID:f,DIRTY:ke,OK:x,isAborted:Ee,isDirty:$e,isValid:z,isAsync:ee,get util(){return b},get objectUtil(){return Ie},ZodParsedType:h,getParsedType:E,ZodType:_,datetimeRegex:We,ZodString:N,ZodNumber:R,ZodBigInt:te,ZodBoolean:se,ZodDate:q,ZodSymbol:xe,ZodUndefined:ae,ZodNull:ne,ZodAny:J,ZodUnknown:D,ZodNever:$,ZodVoid:Ze,ZodArray:B,ZodObject:k,ZodUnion:ie,ZodDiscriminatedUnion:Ce,ZodIntersection:re,ZodTuple:j,ZodRecord:oe,ZodMap:Te,ZodSet:V,ZodFunction:H,ZodLazy:de,ZodLiteral:ce,ZodEnum:me,ZodNativeEnum:ue,ZodPromise:Y,ZodEffects:S,ZodTransformer:S,ZodOptional:O,ZodNullable:M,ZodDefault:le,ZodCatch:he,ZodNaN:Ne,BRAND:Ot,ZodBranded:Fe,ZodPipeline:fe,ZodReadonly:pe,custom:Ye,Schema:_,ZodSchema:_,late:At,get ZodFirstPartyTypeKind(){return m},coerce:ls,any:Ft,array:qt,bigint:Et,boolean:Qe,date:$t,discriminatedUnion:Kt,effect:ze,enum:ts,function:Xt,instanceof:jt,intersection:Ht,lazy:Qt,literal:es,map:Yt,nan:It,nativeEnum:ss,never:Dt,null:Mt,nullable:is,number:Xe,object:Bt,oboolean:us,onumber:cs,optional:ns,ostring:ds,pipeline:os,preprocess:rs,promise:as,record:Jt,set:Gt,strictObject:Vt,string:Ge,symbol:Pt,transformer:ze,tuple:Wt,undefined:Rt,union:Ut,unknown:Lt,void:zt,NEVER:hs,ZodIssueCode:c,quotelessJson:it,ZodError:C});const ps="1.0.0",ms={version:ps};class et{constructor(e){this._client=e}async getCurrent(){return(await this._client.request("user.getCurrentAccount",{})).account}}class tt{constructor(e){this._client=e}async getAllByMountPoint(e){return(await this._client.request("applications.getByMountPoint",{mountPoint:e})).applications}async getByName(e){return(await this._client.request("applications.getByName",{name:e})).application}async getUrl(e,t){return(await this._client.request("applications.getUrl",{name:e,mountPoint:t})).url}}function fs(a,e=console.error){a().catch(e)}class ys{constructor(e){this._client=e}async getColorScheme(){return(await this._client.request("environment.getColorScheme",{})).colorScheme}subscribeColorScheme(e){fs(async()=>{this._client.on("environment.colorSchemeChanged",e),e(await this.getColorScheme())})}unsubscribeColorScheme(e){this._client.off("environment.colorSchemeChanged",e)}}class st{constructor(e){this._client=e}async queryFolders(e){return(await this._client.request("media.queryMediaFolders",{query:e})).folders}async getFoldersByTag(e){return(await this._client.request("media.getMediaFoldersByTag",{tagName:e})).folders}async getFolderById(e){return(await this._client.request("media.getMediaFolderById",{id:e})).folder}async getMediaContentByFolderId(e){return(await this._client.request("media.getMediaContentByFolderId",{folderId:e})).folders}async getMediaContentById(e){return(await this._client.request("media.getMediaContentById",{id:e})).content}}class at{constructor(e){this._client=e}get application(){return new ye("application","",this._client)}get instance(){return new ye("instance",this._client._applicationId,this._client)}get device(){return new ye("device",this._client._applicationId,this._client)}shared(e){return new ye("shared",e,this._client)}}class ye{constructor(e,t,s){this._kind=e,this._namespace=t,this._client=s}async set(e,t){return(await this._client.request("store.set",{kind:this._kind,namespace:this._namespace,key:e,value:t})).success}async get(e){return(await this._client.request("store.get",{kind:this._kind,namespace:this._namespace,key:e})).value}async subscribe(e,t){return(await this._client.subscribe("store.subscribe",{kind:this._kind,namespace:this._namespace,key:e},t)).success}async unsubscribe(e,t){return(await this._client.unsubscribe("store.unsubscribe",{kind:this._kind,namespace:this._namespace,key:e},t)).success}async delete(e){return(await this._client.request("store.delete",{kind:this._kind,namespace:this._namespace,key:e})).success}}class nt{constructor(e){this._client=e}async getCurrent(){return await this._client.request("user.getCurrentUser",{})}}const gs=je.object({name:je.string(),data:je.any()});class _s{constructor(e){if(e._client._applicationId!=="rootSettingsNavigation")throw new Error("RootSettingsNavigation can only be used in the rootSettingsNavigation mount point");this._store=e}async setRootSettingsNavigation(e){const t=this._store.shared("root-settings-navigation"),s=await t.get("navigation"),n=this._store._client._applicationId;s[n]={applicationId:n,entries:e.entries},t.set("navigation",s)}async getRootSettingsNavigation(){const e=await this._store.shared("root-settings-navigation").get("navigation"),t=this._store._client._applicationId;return e[t]}async getAllRootSettingsNavigation(){return this._store.shared("root-settings-navigation").get("navigation")}}const U=1e3*30;class vs{constructor(e){this._applicationName=e,this._applicationId="",this._onHandlers=new Map,this._onceHandlers=new Map,this._subscriptionNamesByHandler=new Map,this._subscriptionNamesBySubjectName=new Map}get accounts(){return new et(this)}get users(){return new nt(this)}get store(){return new at(this)}get applications(){return new tt(this)}get media(){return new st(this)}get rootSettingsNavigation(){return new _s(this.store)}bind(){var e;const t=new URL(window.location.href).searchParams;this._applicationId=(e=t.get("telemetryApplicationId"))!==null&&e!==void 0?e:"",this._windowMessageHandler=s=>{if(s.source===window)return;for(let d=0;d<window.frames.length;d+=1)window.frames[d].postMessage(s.data,"*");const n=gs.safeParse(s.data);if(!n.success)return;const i=n.data,r=this._onHandlers.get(i.name),o=this._onceHandlers.get(i.name);if(r)for(const d of r)d(i.data);if(o){for(const d of o)d(i.data);this._onceHandlers.delete(i.name)}},window.addEventListener("message",this._windowMessageHandler)}unbind(){this._windowMessageHandler&&window.removeEventListener("message",this._windowMessageHandler)}send(e,t){const s={telemetrySdkVersion:Q,applicationName:this._applicationName,name:e,data:t};window.parent.postMessage(s,"*")}request(e,t){const s=ge(),n={telemetrySdkVersion:Q,applicationName:this._applicationName,name:e,data:t,responseName:s};window.parent.postMessage(n,"*");let i=!1,r;const o=new Promise((u,g)=>{const w=new Error(`${e} message request with response name of ${s} timed out after ${U}`);setTimeout(()=>{i=!0,this.off(s,r),g(w)},U)}),d=new Promise(u=>{r=g=>{i||u(g)},this.once(s,u)});return Promise.race([o,d])}async subscribe(e,t,s){let n,i;typeof t=="function"?i=t:(n=t,i=s);const r=ge(),o=ge();let d=this._subscriptionNamesBySubjectName.get(e);d||(d=[],this._subscriptionNamesBySubjectName.set(e,d)),d.push(r),this._subscriptionNamesByHandler.set(i,r),this.on(r,i);const u={telemetrySdkVersion:Q,applicationName:this._applicationName,name:e,data:n,responseName:o,subscriptionName:r};window.parent.postMessage(u,"*");let g=!1,w;const I=new Promise((F,L)=>{const Oe=new Error(`${e} subscribe request with subscription name of ${r} and response name of ${o} timed out after ${U}`);setTimeout(()=>{g=!0,this.off(o,w),L(Oe)},U)}),Se=new Promise(F=>{w=L=>{g||F(L)},this.on(o,F)});return Promise.race([I,Se])}async unsubscribe(e,t,s){let n,i;typeof t=="function"?i=t:(n=t,i=s);const r=ge();let o=[];if(i){const d=this._subscriptionNamesByHandler.get(i);if(!d)return{success:!1};o=[d],this._subscriptionNamesByHandler.delete(i)}else if(!this._subscriptionNamesBySubjectName.get(e))return{success:!1};for await(const d of o){this.off(d,i);const u={telemetrySdkVersion:Q,applicationName:this._applicationName,name:e,data:n,responseName:r,unsubscribeName:d};window.parent.postMessage(u,"*");let g=!1,w;const I=new Promise((F,L)=>{const Oe=new Error(`${e} unsubscribe request with unsubscribe name of ${d} and response name of ${r} timed out after ${U}`);setTimeout(()=>{g=!0,this.off(r,w),L(Oe)},U)}),Se=new Promise(F=>{w=L=>{g||F(L)},this.once(r,F)});if(!(await Promise.race([I,Se])).success)return{success:!1}}return{success:!0}}on(e,t){var s;const n=(s=this._onHandlers.get(e))!==null&&s!==void 0?s:[];n.length===0&&this._onHandlers.set(e,n),n.push(t)}once(e,t){var s;const n=(s=this._onceHandlers.get(e))!==null&&s!==void 0?s:[];n.length===0&&this._onceHandlers.set(e,n),n.push(t)}off(e,t){const s=this._onHandlers.get(e),n=this._onceHandlers.get(e);if(!(!s&&!n)){if(s){for(let i=0;i<s.length;i+=1)t&&s[i]!==t||(s.splice(i,1),i-=1);s.length===0&&this._onHandlers.delete(e)}if(n){for(let i=0;i<n.length;i+=1)t&&n[i]!==t||(n.splice(i,1),i-=1);n.length===0&&this._onceHandlers.delete(e)}}}}function ge(){return Math.random().toString(36).slice(2,9)}const Q=ms.version;class bs{constructor(e){this._client=e}async setOverride(e){return await this._client.request("overrides.setOverride",{name:e})}async clearOverride(e){return await this._client.request("overrides.clearOverride",{name:e})}}class ks{constructor(e){this._client=e}async nextPage(){return await this._client.request("playlist.nextPage",{})}async previousPage(){return await this._client.request("playlist.previousPage",{})}async setDuration(e){return await this._client.request("playlist.setDuration",{duration:e})}}class ws extends vs{get playlist(){return new ks(this)}get overrides(){return new bs(this)}}let v=null;function xs(){return v}function Zs(a){v=new ws(a),v.bind()}function Ts(){v==null||v.unbind(),v=null}function Ns(...a){return T(v),v.on(...a)}function Cs(...a){return T(v),v.once(...a)}function Ss(...a){return T(v),v.off(...a)}function Os(...a){return T(v),v.send(...a)}function As(...a){return T(v),v.request(...a)}function js(...a){return T(v),v.subscribe(...a)}function Is(...a){return T(v),v.unsubscribe(...a)}function Es(){return T(v),v.store}function $s(){return T(v),v.applications}function Ps(){return T(v),v.media}function Rs(){return T(v),v.playlist}function Ms(){return T(v),v.overrides}function Fs(){return T(v),v.accounts}function Ls(){return T(v),v.users}function T(a){if(!a)throw new Error("SDK is not configured")}exports.Accounts=et;exports.Applications=tt;exports.Environment=ys;exports.Media=st;exports.Store=at;exports.Users=nt;exports.accounts=Fs;exports.applications=$s;exports.configure=Zs;exports.destroy=Ts;exports.globalClient=xs;exports.media=Ps;exports.off=Ss;exports.on=Ns;exports.once=Cs;exports.overrides=Ms;exports.playlist=Rs;exports.request=As;exports.send=Os;exports.store=Es;exports.subscribe=js;exports.telemetrySdkVersion=Q;exports.unsubscribe=Is;exports.users=Ls;
@@ -0,0 +1,210 @@
1
+ export { telemetrySdkVersion } from '@telemetryos/root-sdk';
2
+ export { Accounts, Applications, Environment, Media, Store, Users } from '@telemetryos/root-sdk';
3
+ import { Client } from './client.js';
4
+ /**
5
+ * Returns the global client instance used by the convenience functions in this package.
6
+ *
7
+ * This function provides direct access to the underlying Client instance that powers
8
+ * all the exported convenience functions (send, request, store, etc.). Most applications
9
+ * should use the convenience functions rather than accessing the client directly.
10
+ *
11
+ * Advanced use cases might require direct access to the client, such as extending
12
+ * the SDK's functionality or managing multiple client instances.
13
+ *
14
+ * @returns The global client instance, or null if configure() hasn't been called yet
15
+ */
16
+ export declare function globalClient(): Client | null;
17
+ /**
18
+ * Configures the SDK by initializing the global client instance.
19
+ *
20
+ * This function must be called before using any other exported functions that depend on the global client.
21
+ * The exported convenience functions (send, request, store, etc.) use this global instance internally,
22
+ * simplifying integration for applications that don't require multiple client instances.
23
+ *
24
+ * @param applicationName The name of your application - must match the 'name' property in your application's telemetry.config.json file
25
+ */
26
+ export declare function configure(applicationName: string): void;
27
+ /**
28
+ * Destroys the SDK by unbinding event listeners and clearing the global client instance.
29
+ *
30
+ * This function is useful when you need to clean up resources or prepare to unload
31
+ * the SDK from the page. It ensures proper cleanup of event listeners to prevent memory leaks.
32
+ */
33
+ export declare function destroy(): void;
34
+ /**
35
+ * Registers a handler function for a specific message type from the TelemetryOS platform.
36
+ *
37
+ * The handler will be called each time a message with the specified name is received.
38
+ * You can register multiple handlers for the same message type, and all will be executed
39
+ * when that message is received.
40
+ *
41
+ * NOTE: Most application developers should use resource-specific APIs instead of
42
+ * using raw message handlers through on(), send(), request(), etc.
43
+ *
44
+ * @param name The name of the message type to listen for
45
+ * @param handler The callback function to execute when messages are received
46
+ * @throws {Error} If called before configure() or after destroy()
47
+ */
48
+ export declare function on(...args: Parameters<Client['on']>): void;
49
+ /**
50
+ * Registers a one-time handler for a specific message type.
51
+ *
52
+ * Similar to the `on` function, but the handler will be automatically removed after it
53
+ * is called once. This is useful for initialization events or operations that should
54
+ * only happen once in response to a particular message.
55
+ *
56
+ * NOTE: Most application developers should use resource-specific APIs instead of
57
+ * using raw message handlers through on(), send(), request(), etc.
58
+ *
59
+ * @param name The name of the message type to listen for
60
+ * @param handler The callback function to execute when the message is received
61
+ * @throws {Error} If called before configure() or after destroy()
62
+ */
63
+ export declare function once(...args: Parameters<Client['once']>): void;
64
+ /**
65
+ * Removes previously registered message handlers.
66
+ *
67
+ * Use this function to stop receiving messages of a specific type or to remove
68
+ * specific handler functions when they're no longer needed.
69
+ *
70
+ * NOTE: Most application developers should use resource-specific APIs instead of
71
+ * using raw message handlers through on(), send(), request(), etc.
72
+ *
73
+ * @param name The name of the message type to stop listening for
74
+ * @param handler Optional. The specific handler function to remove. If omitted, all handlers for this message type will be removed.
75
+ * @throws {Error} If called before configure() or after destroy()
76
+ */
77
+ export declare function off(...args: Parameters<Client['off']>): void;
78
+ /**
79
+ * Sends a one-way message to the TelemetryOS platform.
80
+ *
81
+ * Use this function for fire-and-forget messages where no response is expected.
82
+ * The message is sent to the parent window using the postMessage API.
83
+ *
84
+ * NOTE: Most application developers should use resource-specific APIs instead of
85
+ * using raw message handlers through on(), send(), request(), etc.
86
+ *
87
+ * @param name The name of the message type to send
88
+ * @param data The data payload to include with the message
89
+ * @throws {Error} If called before configure() or after destroy()
90
+ */
91
+ export declare function send(...args: Parameters<Client['send']>): void;
92
+ /**
93
+ * Sends a message to the TelemetryOS platform and waits for a response.
94
+ *
95
+ * This implements a request-response pattern over the postMessage API. It generates
96
+ * a unique correlation ID and sets up a listener for the response. If no response is
97
+ * received within the timeout period (30 seconds by default), the promise will reject.
98
+ *
99
+ * NOTE: Most application developers should use resource-specific APIs instead of
100
+ * using raw message handlers through on(), send(), request(), etc.
101
+ *
102
+ * @param name The name of the message type (endpoint) to request
103
+ * @param data The data payload to include with the request
104
+ * @returns A promise that resolves with the response data when received
105
+ * @throws {Error} If the request times out
106
+ * @throws {Error} If called before configure() or after destroy()
107
+ */
108
+ export declare function request(...args: Parameters<Client['request']>): Promise<unknown>;
109
+ /**
110
+ * Sets up a persistent subscription to messages from the TelemetryOS platform.
111
+ *
112
+ * This function sends an initial subscription message and registers a handler for
113
+ * a specific message type. The handler will be called each time a message with the
114
+ * matching subscription name is received. Unlike the regular `on()` method, this
115
+ * establishes a formal subscription that can be managed with `unsubscribe()`.
116
+ *
117
+ * NOTE: Most application developers should use resource-specific APIs instead of
118
+ * using raw message handlers through on(), send(), request(), etc.
119
+ *
120
+ * @param name The name of the subscription endpoint
121
+ * @param key An identifier or parameters for what you're subscribing to
122
+ * @param handler The callback function that will be invoked when messages are received
123
+ * @returns A promise that resolves with the subscription result ({success: boolean})
124
+ * @throws {Error} If the subscription request times out
125
+ * @throws {Error} If called before configure() or after destroy()
126
+ */
127
+ export declare function subscribe(...args: Parameters<Client['subscribe']>): Promise<import("@telemetryos/root-sdk").SubscriptionResult<void>>;
128
+ /**
129
+ * Cancels a subscription previously created with subscribe().
130
+ *
131
+ * This function removes a subscription and stops the handler from receiving messages.
132
+ * It sends an unsubscribe message to the platform to clean up server-side resources
133
+ * and removes the local message handler.
134
+ *
135
+ * NOTE: Most application developers should use resource-specific APIs instead of
136
+ * using raw message handlers through on(), send(), request(), etc.
137
+ *
138
+ * @param name The name of the subscription endpoint (same as used in subscribe)
139
+ * @param key The identifier or parameters for the subscription to cancel
140
+ * @param handler Optional. The specific handler to unsubscribe. If omitted, all handlers for this key will be unsubscribed.
141
+ * @returns A promise that resolves with the unsubscription result ({success: boolean})
142
+ * @throws {Error} If the unsubscription request times out
143
+ * @throws {Error} If called before configure() or after destroy()
144
+ */
145
+ export declare function unsubscribe(...args: Parameters<Client['unsubscribe']>): Promise<import("@telemetryos/root-sdk").SubscriptionResult<void>>;
146
+ /**
147
+ * Provides access to the data storage API with multiple persistence scopes.
148
+ *
149
+ * The store API allows you to save, retrieve, and subscribe to data changes. It offers
150
+ * four different storage scopes for different persistence needs:
151
+ *
152
+ * - application: Data shared across all instances of this application within an account
153
+ * - instance: Data specific to the current instance of this application
154
+ * - device: Data available only on the current device
155
+ * - shared: Data shared between different applications through a common namespace
156
+ *
157
+ * Applications should generally use subscribe() for real-time data access since they may
158
+ * run indefinitely and need to respond to changes. The get() method is provided primarily
159
+ * for ad-hoc or initialization scenarios.
160
+ *
161
+ * @returns The Store API object with access to all storage scopes
162
+ * @throws {Error} If called before configure() or after destroy()
163
+ */
164
+ export declare function store(): import("@telemetryos/root-sdk").Store;
165
+ /**
166
+ * Provides access to the applications API for embedding other TelemetryOS applications.
167
+ *
168
+ * This API enables applications to discover and embed other applications within the
169
+ * TelemetryOS ecosystem. It allows querying for applications by name or mount point,
170
+ * and generating URLs that can be used to load applications in iframes.
171
+ *
172
+ * @returns The Applications API object
173
+ * @throws {Error} If called before configure() or after destroy()
174
+ */
175
+ export declare function applications(): import("@telemetryos/root-sdk").Applications;
176
+ /**
177
+ * Provides access to the media API for working with content hosted on the TelemetryOS platform.
178
+ *
179
+ * This API allows applications to browse and access media content uploaded to TelemetryOS.
180
+ * Applications can query media folders, retrieve content metadata, and get access to media files.
181
+ *
182
+ * @returns The Media API object
183
+ * @throws {Error} If called before configure() or after destroy()
184
+ */
185
+ export declare function media(): import("@telemetryos/root-sdk").Media;
186
+ /**
187
+ * Allows interaction with the current playlist state, providing methods to
188
+ * move forward, or backward a page, or change the current page's duration.
189
+ * @returns The Playlist API object
190
+ * @throws {Error} If called before configure() or after destroy()
191
+ */
192
+ export declare function playlist(): import("./playlist.js").Playlist;
193
+ /**
194
+ * Provides access to the overrides API for managing content overrides.
195
+ * @returns The Overrides API object
196
+ * @throws {Error} If called before configure() or after destroy()
197
+ */
198
+ export declare function overrides(): import("./overrides.js").Overrides;
199
+ /**
200
+ * Provides access to the accounts API for retrieving TelemetryOS account information.
201
+ * @returns The Accounts API object
202
+ * @throws {Error} If called before configure() or after destroy()
203
+ */
204
+ export declare function accounts(): import("@telemetryos/root-sdk").Accounts;
205
+ /**
206
+ * Provides access to the users API for retrieving TelemetryOS user information.
207
+ * @returns The Users API object
208
+ * @throws {Error} If called before configure() or after destroy()
209
+ */
210
+ export declare function users(): import("@telemetryos/root-sdk").Users;