@telemetryos/sdk 1.11.0 → 1.12.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/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # @telemetryos/sdk
2
2
 
3
+ ## 1.12.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Revamp the dev host
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+ - @telemetryos/root-sdk@1.12.0
13
+
3
14
  ## 1.11.0
4
15
 
5
16
  ### Minor Changes
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var b;(function(a){a.assertEqual=n=>{};function e(n){}a.assertIs=e;function t(n){throw new Error}a.assertNever=t,a.arrayToEnum=n=>{const r={};for(const i of n)r[i]=i;return r},a.getValidEnumValues=n=>{const r=a.objectKeys(n).filter(o=>typeof n[n[o]]!="number"),i={};for(const o of r)i[o]=n[o];return a.objectValues(i)},a.objectValues=n=>a.objectKeys(n).map(function(r){return n[r]}),a.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{const r=[];for(const i in n)Object.prototype.hasOwnProperty.call(n,i)&&r.push(i);return r},a.find=(n,r)=>{for(const i of n)if(r(i))return i},a.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function s(n,r=" | "){return n.map(i=>typeof i=="string"?`'${i}'`:i).join(r)}a.joinValues=s,a.jsonStringifyReplacer=(n,r)=>typeof r=="bigint"?r.toString():r})(b||(b={}));var ye;(function(a){a.mergeShapes=(e,t)=>({...e,...t})})(ye||(ye={}));const l=b.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),I=a=>{switch(typeof a){case"undefined":return l.undefined;case"string":return l.string;case"number":return Number.isNaN(a)?l.nan:l.number;case"boolean":return l.boolean;case"function":return l.function;case"bigint":return l.bigint;case"symbol":return l.symbol;case"object":return Array.isArray(a)?l.array:a===null?l.null:a.then&&typeof a.then=="function"&&a.catch&&typeof a.catch=="function"?l.promise:typeof Map<"u"&&a instanceof Map?l.map:typeof Set<"u"&&a instanceof Set?l.set:typeof Date<"u"&&a instanceof Date?l.date:l.object;default:return l.unknown}},u=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"]);class O 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(r){return r.message},s={_errors:[]},n=r=>{for(const i of r.issues)if(i.code==="invalid_union")i.unionErrors.map(n);else if(i.code==="invalid_return_type")n(i.returnTypeError);else if(i.code==="invalid_arguments")n(i.argumentsError);else if(i.path.length===0)s._errors.push(t(i));else{let o=s,c=0;for(;c<i.path.length;){const h=i.path[c];c===i.path.length-1?(o[h]=o[h]||{_errors:[]},o[h]._errors.push(t(i))):o[h]=o[h]||{_errors:[]},o=o[h],c++}}};return n(this),s}static assert(e){if(!(e instanceof O))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)if(n.path.length>0){const r=n.path[0];t[r]=t[r]||[],t[r].push(e(n))}else s.push(e(n));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}}O.create=a=>new O(a);const ae=(a,e)=>{let t;switch(a.code){case u.invalid_type:a.received===l.undefined?t="Required":t=`Expected ${a.expected}, received ${a.received}`;break;case u.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(a.expected,b.jsonStringifyReplacer)}`;break;case u.unrecognized_keys:t=`Unrecognized key(s) in object: ${b.joinValues(a.keys,", ")}`;break;case u.invalid_union:t="Invalid input";break;case u.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${b.joinValues(a.options)}`;break;case u.invalid_enum_value:t=`Invalid enum value. Expected ${b.joinValues(a.options)}, received '${a.received}'`;break;case u.invalid_arguments:t="Invalid function arguments";break;case u.invalid_return_type:t="Invalid function return type";break;case u.invalid_date:t="Invalid date";break;case u.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 u.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==="bigint"?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 u.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 u.custom:t="Invalid input";break;case u.invalid_intersection_types:t="Intersection results could not be merged";break;case u.not_multiple_of:t=`Number must be a multiple of ${a.multipleOf}`;break;case u.not_finite:t="Number must be finite";break;default:t=e.defaultError,b.assertNever(a)}return{message:t}};let Je=ae;function Qe(){return Je}const Ge=a=>{const{data:e,path:t,errorMaps:s,issueData:n}=a,r=[...t,...n.path||[]],i={...n,path:r};if(n.message!==void 0)return{...n,path:r,message:n.message};let o="";const c=s.filter(h=>!!h).slice().reverse();for(const h of c)o=h(i,{data:e,defaultError:o}).message;return{...n,path:r,message:o}};function d(a,e){const t=Qe(),s=Ge({issueData:e,data:a.data,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,t,t===ae?void 0:ae].filter(n=>!!n)});a.common.issues.push(s)}let N=class $e{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 g;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 r=await n.key,i=await n.value;s.push({key:r,value:i})}return $e.mergeObjectSync(e,s)}static mergeObjectSync(e,t){const s={};for(const n of t){const{key:r,value:i}=n;if(r.status==="aborted"||i.status==="aborted")return g;r.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),r.value!=="__proto__"&&(typeof i.value<"u"||n.alwaysSet)&&(s[r.value]=i.value)}return{status:e.value,value:s}}};const g=Object.freeze({status:"aborted"}),re=a=>({status:"dirty",value:a}),x=a=>({status:"valid",value:a}),_e=a=>a.status==="aborted",ve=a=>a.status==="dirty",L=a=>a.status==="valid",Y=a=>typeof Promise<"u"&&a instanceof Promise;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={}));let j=class{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||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}};const be=(a,e)=>{if(L(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 O(a.common.issues);return this._error=t,this._error}}};function _(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:(r,i)=>{const{message:o}=a;return r.code==="invalid_enum_value"?{message:o??i.defaultError}:typeof i.data>"u"?{message:o??s??i.defaultError}:r.code!=="invalid_type"?{message:i.defaultError}:{message:o??t??i.defaultError}},description:n}}let v=class{get description(){return this._def.description}_getType(e){return I(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:I(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new N,ctx:{common:e.parent.common,data:e.data,parsedType:I(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(Y(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){const s={common:{issues:[],async:(t==null?void 0:t.async)??!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:I(e)},n=this._parseSync({data:e,path:s.path,parent:s});return be(s,n)}"~validate"(e){var t,s;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:I(e)};if(!this["~standard"].async)try{const r=this._parseSync({data:e,path:[],parent:n});return L(r)?{value:r.value}:{issues:n.common.issues}}catch(r){(s=(t=r==null?void 0:r.message)==null?void 0:t.toLowerCase())!=null&&s.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(r=>L(r)?{value:r.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:I(e)},n=this._parse({data:e,path:s.path,parent:s}),r=await(Y(n)?n:Promise.resolve(n));return be(s,r)}refine(e,t){const s=n=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(n):t;return this._refinement((n,r)=>{const i=e(n),o=()=>r.addIssue({code:u.custom,...s(n)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(o(),!1)):i?!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 D({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 $.create(this,this._def)}nullable(){return V.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return T.create(this)}promise(){return te.create(this,this._def)}or(e){return X.create([this,e],this._def)}and(e){return ee.create(this,e,this._def)}transform(e){return new D({..._(this._def),schema:this,typeName:m.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new le({..._(this._def),innerType:this,defaultValue:t,typeName:m.ZodDefault})}brand(){return new bt({typeName:m.ZodBranded,type:this,..._(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new he({..._(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 me.create(this,e)}readonly(){return pe.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};const Ye=/^c[^\s-]{8,}$/i,Xe=/^[0-9a-z]+$/,et=/^[0-9A-HJKMNP-TV-Z]{26}$/i,tt=/^[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,st=/^[a-z0-9_-]{21}$/i,nt=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,at=/^[-+]?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)?)??$/,rt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,it="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let ne;const ot=/^(?:(?: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])$/,ct=/^(?:(?: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])$/,ut=/^(([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]))$/,dt=/^(([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])$/,lt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ht=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,je="((\\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])))",pt=new RegExp(`^${je}$`);function Pe(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 ft(a){return new RegExp(`^${Pe(a)}$`)}function mt(a){let e=`${je}T${Pe(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 gt(a,e){return!!((e==="v4"||!e)&&ot.test(a)||(e==="v6"||!e)&&ut.test(a))}function yt(a,e){if(!nt.test(a))return!1;try{const[t]=a.split(".");if(!t)return!1;const 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||"typ"in n&&(n==null?void 0:n.typ)!=="JWT"||!n.alg||e&&n.alg!==e)}catch{return!1}}function _t(a,e){return!!((e==="v4"||!e)&&ct.test(a)||(e==="v6"||!e)&&dt.test(a))}class E extends v{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==l.string){const n=this._getOrReturnCtx(e);return d(n,{code:u.invalid_type,expected:l.string,received:n.parsedType}),g}const t=new N;let s;for(const n of this._def.checks)if(n.kind==="min")e.data.length<n.value&&(s=this._getOrReturnCtx(e,s),d(s,{code:u.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),d(s,{code:u.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),t.dirty());else if(n.kind==="length"){const r=e.data.length>n.value,i=e.data.length<n.value;(r||i)&&(s=this._getOrReturnCtx(e,s),r?d(s,{code:u.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):i&&d(s,{code:u.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),t.dirty())}else if(n.kind==="email")rt.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"email",code:u.invalid_string,message:n.message}),t.dirty());else if(n.kind==="emoji")ne||(ne=new RegExp(it,"u")),ne.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"emoji",code:u.invalid_string,message:n.message}),t.dirty());else if(n.kind==="uuid")tt.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"uuid",code:u.invalid_string,message:n.message}),t.dirty());else if(n.kind==="nanoid")st.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"nanoid",code:u.invalid_string,message:n.message}),t.dirty());else if(n.kind==="cuid")Ye.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"cuid",code:u.invalid_string,message:n.message}),t.dirty());else if(n.kind==="cuid2")Xe.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"cuid2",code:u.invalid_string,message:n.message}),t.dirty());else if(n.kind==="ulid")et.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"ulid",code:u.invalid_string,message:n.message}),t.dirty());else if(n.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),d(s,{validation:"url",code:u.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),d(s,{validation:"regex",code:u.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),d(s,{code:u.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),d(s,{code:u.invalid_string,validation:{startsWith:n.value},message:n.message}),t.dirty()):n.kind==="endsWith"?e.data.endsWith(n.value)||(s=this._getOrReturnCtx(e,s),d(s,{code:u.invalid_string,validation:{endsWith:n.value},message:n.message}),t.dirty()):n.kind==="datetime"?mt(n).test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{code:u.invalid_string,validation:"datetime",message:n.message}),t.dirty()):n.kind==="date"?pt.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{code:u.invalid_string,validation:"date",message:n.message}),t.dirty()):n.kind==="time"?ft(n).test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{code:u.invalid_string,validation:"time",message:n.message}),t.dirty()):n.kind==="duration"?at.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"duration",code:u.invalid_string,message:n.message}),t.dirty()):n.kind==="ip"?gt(e.data,n.version)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"ip",code:u.invalid_string,message:n.message}),t.dirty()):n.kind==="jwt"?yt(e.data,n.alg)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"jwt",code:u.invalid_string,message:n.message}),t.dirty()):n.kind==="cidr"?_t(e.data,n.version)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"cidr",code:u.invalid_string,message:n.message}),t.dirty()):n.kind==="base64"?lt.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"base64",code:u.invalid_string,message:n.message}),t.dirty()):n.kind==="base64url"?ht.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"base64url",code:u.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:u.invalid_string,...p.errToObj(s)})}_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)})}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){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...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 E({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new E({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new E({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const 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}}E.create=a=>new E({checks:[],typeName:m.ZodString,coerce:(a==null?void 0:a.coerce)??!1,..._(a)});function vt(a,e){const t=(a.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,n=t>s?t:s,r=Number.parseInt(a.toFixed(n).replace(".","")),i=Number.parseInt(e.toFixed(n).replace(".",""));return r%i/10**n}let we=class ie extends v{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==l.number){const n=this._getOrReturnCtx(e);return d(n,{code:u.invalid_type,expected:l.number,received:n.parsedType}),g}let t;const s=new N;for(const n of this._def.checks)n.kind==="int"?b.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),d(t,{code:u.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),d(t,{code:u.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),d(t,{code:u.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),s.dirty()):n.kind==="multipleOf"?vt(e.data,n.value)!==0&&(t=this._getOrReturnCtx(e,t),d(t,{code:u.not_multiple_of,multipleOf:n.value,message:n.message}),s.dirty()):n.kind==="finite"?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),d(t,{code:u.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 ie({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:p.toString(n)}]})}_addCheck(e){return new ie({...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)}};we.create=a=>new we({checks:[],typeName:m.ZodNumber,coerce:(a==null?void 0:a.coerce)||!1,..._(a)});class W extends v{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==l.bigint)return this._getInvalidInput(e);let t;const s=new N;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),d(t,{code:u.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),d(t,{code:u.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),d(t,{code:u.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 d(t,{code:u.invalid_type,expected:l.bigint,received:t.parsedType}),g}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 W({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:p.toString(n)}]})}_addCheck(e){return new W({...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}}W.create=a=>new W({checks:[],typeName:m.ZodBigInt,coerce:(a==null?void 0:a.coerce)??!1,..._(a)});class ke extends v{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==l.boolean){const t=this._getOrReturnCtx(e);return d(t,{code:u.invalid_type,expected:l.boolean,received:t.parsedType}),g}return x(e.data)}}ke.create=a=>new ke({typeName:m.ZodBoolean,coerce:(a==null?void 0:a.coerce)||!1,..._(a)});let xe=class Fe extends v{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==l.date){const n=this._getOrReturnCtx(e);return d(n,{code:u.invalid_type,expected:l.date,received:n.parsedType}),g}if(Number.isNaN(e.data.getTime())){const n=this._getOrReturnCtx(e);return d(n,{code:u.invalid_date}),g}const t=new N;let s;for(const n of this._def.checks)n.kind==="min"?e.data.getTime()<n.value&&(s=this._getOrReturnCtx(e,s),d(s,{code:u.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),d(s,{code:u.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 Fe({...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}};xe.create=a=>new xe({checks:[],coerce:(a==null?void 0:a.coerce)||!1,typeName:m.ZodDate,..._(a)});class Se extends v{_parse(e){if(this._getType(e)!==l.symbol){const t=this._getOrReturnCtx(e);return d(t,{code:u.invalid_type,expected:l.symbol,received:t.parsedType}),g}return x(e.data)}}Se.create=a=>new Se({typeName:m.ZodSymbol,..._(a)});class Ce extends v{_parse(e){if(this._getType(e)!==l.undefined){const t=this._getOrReturnCtx(e);return d(t,{code:u.invalid_type,expected:l.undefined,received:t.parsedType}),g}return x(e.data)}}Ce.create=a=>new Ce({typeName:m.ZodUndefined,..._(a)});class Ne extends v{_parse(e){if(this._getType(e)!==l.null){const t=this._getOrReturnCtx(e);return d(t,{code:u.invalid_type,expected:l.null,received:t.parsedType}),g}return x(e.data)}}Ne.create=a=>new Ne({typeName:m.ZodNull,..._(a)});class oe extends v{constructor(){super(...arguments),this._any=!0}_parse(e){return x(e.data)}}oe.create=a=>new oe({typeName:m.ZodAny,..._(a)});class Te extends v{constructor(){super(...arguments),this._unknown=!0}_parse(e){return x(e.data)}}Te.create=a=>new Te({typeName:m.ZodUnknown,..._(a)});let P=class extends v{_parse(e){const t=this._getOrReturnCtx(e);return d(t,{code:u.invalid_type,expected:l.never,received:t.parsedType}),g}};P.create=a=>new P({typeName:m.ZodNever,..._(a)});class Ze extends v{_parse(e){if(this._getType(e)!==l.undefined){const t=this._getOrReturnCtx(e);return d(t,{code:u.invalid_type,expected:l.void,received:t.parsedType}),g}return x(e.data)}}Ze.create=a=>new Ze({typeName:m.ZodVoid,..._(a)});class T extends v{_parse(e){const{ctx:t,status:s}=this._processInputParams(e),n=this._def;if(t.parsedType!==l.array)return d(t,{code:u.invalid_type,expected:l.array,received:t.parsedType}),g;if(n.exactLength!==null){const i=t.data.length>n.exactLength.value,o=t.data.length<n.exactLength.value;(i||o)&&(d(t,{code:i?u.too_big:u.too_small,minimum:o?n.exactLength.value:void 0,maximum:i?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&&(d(t,{code:u.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&&(d(t,{code:u.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((i,o)=>n.type._parseAsync(new j(t,i,t.path,o)))).then(i=>N.mergeArray(s,i));const r=[...t.data].map((i,o)=>n.type._parseSync(new j(t,i,t.path,o)));return N.mergeArray(s,r)}get element(){return this._def.type}min(e,t){return new T({...this._def,minLength:{value:e,message:p.toString(t)}})}max(e,t){return new T({...this._def,maxLength:{value:e,message:p.toString(t)}})}length(e,t){return new T({...this._def,exactLength:{value:e,message:p.toString(t)}})}nonempty(e){return this.min(1,e)}}T.create=(a,e)=>new T({type:a,minLength:null,maxLength:null,exactLength:null,typeName:m.ZodArray,..._(e)});function M(a){if(a instanceof A){const e={};for(const t in a.shape){const s=a.shape[t];e[t]=$.create(M(s))}return new A({...a._def,shape:()=>e})}else return a instanceof T?new T({...a._def,type:M(a.element)}):a instanceof $?$.create(M(a.unwrap())):a instanceof V?V.create(M(a.unwrap())):a instanceof q?q.create(a.items.map(e=>M(e))):a}let A=class C extends v{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=b.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==l.object){const c=this._getOrReturnCtx(e);return d(c,{code:u.invalid_type,expected:l.object,received:c.parsedType}),g}const{status:t,ctx:s}=this._processInputParams(e),{shape:n,keys:r}=this._getCached(),i=[];if(!(this._def.catchall instanceof P&&this._def.unknownKeys==="strip"))for(const c in s.data)r.includes(c)||i.push(c);const o=[];for(const c of r){const h=n[c],y=s.data[c];o.push({key:{status:"valid",value:c},value:h._parse(new j(s,y,s.path,c)),alwaysSet:c in s.data})}if(this._def.catchall instanceof P){const c=this._def.unknownKeys;if(c==="passthrough")for(const h of i)o.push({key:{status:"valid",value:h},value:{status:"valid",value:s.data[h]}});else if(c==="strict")i.length>0&&(d(s,{code:u.unrecognized_keys,keys:i}),t.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const h of i){const y=s.data[h];o.push({key:{status:"valid",value:h},value:c._parse(new j(s,y,s.path,h)),alwaysSet:h in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const c=[];for(const h of o){const y=await h.key,w=await h.value;c.push({key:y,value:w,alwaysSet:h.alwaysSet})}return c}).then(c=>N.mergeObjectSync(t,c)):N.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return p.errToObj,new C({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{var n,r;const i=((r=(n=this._def).errorMap)==null?void 0:r.call(n,t,s).message)??s.defaultError;return t.code==="unrecognized_keys"?{message:p.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new C({...this._def,unknownKeys:"strip"})}passthrough(){return new C({...this._def,unknownKeys:"passthrough"})}extend(e){return new C({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new C({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 C({...this._def,catchall:e})}pick(e){const t={};for(const s of b.objectKeys(e))e[s]&&this.shape[s]&&(t[s]=this.shape[s]);return new C({...this._def,shape:()=>t})}omit(e){const t={};for(const s of b.objectKeys(this.shape))e[s]||(t[s]=this.shape[s]);return new C({...this._def,shape:()=>t})}deepPartial(){return M(this)}partial(e){const t={};for(const s of b.objectKeys(this.shape)){const n=this.shape[s];e&&!e[s]?t[s]=n:t[s]=n.optional()}return new C({...this._def,shape:()=>t})}required(e){const t={};for(const s of b.objectKeys(this.shape))if(e&&!e[s])t[s]=this.shape[s];else{let n=this.shape[s];for(;n instanceof $;)n=n._def.innerType;t[s]=n}return new C({...this._def,shape:()=>t})}keyof(){return Re(b.objectKeys(this.shape))}};A.create=(a,e)=>new A({shape:()=>a,unknownKeys:"strip",catchall:P.create(),typeName:m.ZodObject,..._(e)});A.strictCreate=(a,e)=>new A({shape:()=>a,unknownKeys:"strict",catchall:P.create(),typeName:m.ZodObject,..._(e)});A.lazycreate=(a,e)=>new A({shape:a,unknownKeys:"strip",catchall:P.create(),typeName:m.ZodObject,..._(e)});let X=class extends v{_parse(e){const{ctx:t}=this._processInputParams(e),s=this._def.options;function n(r){for(const o of r)if(o.result.status==="valid")return o.result;for(const o of r)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const i=r.map(o=>new O(o.ctx.common.issues));return d(t,{code:u.invalid_union,unionErrors:i}),g}if(t.common.async)return Promise.all(s.map(async r=>{const i={...t,common:{...t.common,issues:[]},parent:null};return{result:await r._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(n);{let r;const i=[];for(const c of s){const h={...t,common:{...t.common,issues:[]},parent:null},y=c._parseSync({data:t.data,path:t.path,parent:h});if(y.status==="valid")return y;y.status==="dirty"&&!r&&(r={result:y,ctx:h}),h.common.issues.length&&i.push(h.common.issues)}if(r)return t.common.issues.push(...r.ctx.common.issues),r.result;const o=i.map(c=>new O(c));return d(t,{code:u.invalid_union,unionErrors:o}),g}}get options(){return this._def.options}};X.create=(a,e)=>new X({options:a,typeName:m.ZodUnion,..._(e)});function ce(a,e){const t=I(a),s=I(e);if(a===e)return{valid:!0,data:a};if(t===l.object&&s===l.object){const n=b.objectKeys(e),r=b.objectKeys(a).filter(o=>n.indexOf(o)!==-1),i={...a,...e};for(const o of r){const c=ce(a[o],e[o]);if(!c.valid)return{valid:!1};i[o]=c.data}return{valid:!0,data:i}}else if(t===l.array&&s===l.array){if(a.length!==e.length)return{valid:!1};const n=[];for(let r=0;r<a.length;r++){const i=a[r],o=e[r],c=ce(i,o);if(!c.valid)return{valid:!1};n.push(c.data)}return{valid:!0,data:n}}else return t===l.date&&s===l.date&&+a==+e?{valid:!0,data:a}:{valid:!1}}let ee=class extends v{_parse(e){const{status:t,ctx:s}=this._processInputParams(e),n=(r,i)=>{if(_e(r)||_e(i))return g;const o=ce(r.value,i.value);return o.valid?((ve(r)||ve(i))&&t.dirty(),{status:t.value,value:o.data}):(d(s,{code:u.invalid_intersection_types}),g)};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(([r,i])=>n(r,i)):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}))}};ee.create=(a,e,t)=>new ee({left:a,right:e,typeName:m.ZodIntersection,..._(t)});class q extends v{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==l.array)return d(s,{code:u.invalid_type,expected:l.array,received:s.parsedType}),g;if(s.data.length<this._def.items.length)return d(s,{code:u.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),g;!this._def.rest&&s.data.length>this._def.items.length&&(d(s,{code:u.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const n=[...s.data].map((r,i)=>{const o=this._def.items[i]||this._def.rest;return o?o._parse(new j(s,r,s.path,i)):null}).filter(r=>!!r);return s.common.async?Promise.all(n).then(r=>N.mergeArray(t,r)):N.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new q({...this._def,rest:e})}}q.create=(a,e)=>{if(!Array.isArray(a))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new q({items:a,typeName:m.ZodTuple,rest:null,..._(e)})};class Oe extends v{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!==l.map)return d(s,{code:u.invalid_type,expected:l.map,received:s.parsedType}),g;const n=this._def.keyType,r=this._def.valueType,i=[...s.data.entries()].map(([o,c],h)=>({key:n._parse(new j(s,o,s.path,[h,"key"])),value:r._parse(new j(s,c,s.path,[h,"value"]))}));if(s.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const c of i){const h=await c.key,y=await c.value;if(h.status==="aborted"||y.status==="aborted")return g;(h.status==="dirty"||y.status==="dirty")&&t.dirty(),o.set(h.value,y.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const c of i){const h=c.key,y=c.value;if(h.status==="aborted"||y.status==="aborted")return g;(h.status==="dirty"||y.status==="dirty")&&t.dirty(),o.set(h.value,y.value)}return{status:t.value,value:o}}}}Oe.create=(a,e,t)=>new Oe({valueType:e,keyType:a,typeName:m.ZodMap,..._(t)});class J extends v{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==l.set)return d(s,{code:u.invalid_type,expected:l.set,received:s.parsedType}),g;const n=this._def;n.minSize!==null&&s.data.size<n.minSize.value&&(d(s,{code:u.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&&(d(s,{code:u.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());const r=this._def.valueType;function i(c){const h=new Set;for(const y of c){if(y.status==="aborted")return g;y.status==="dirty"&&t.dirty(),h.add(y.value)}return{status:t.value,value:h}}const o=[...s.data.values()].map((c,h)=>r._parse(new j(s,c,s.path,h)));return s.common.async?Promise.all(o).then(c=>i(c)):i(o)}min(e,t){return new J({...this._def,minSize:{value:e,message:p.toString(t)}})}max(e,t){return new J({...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)}}J.create=(a,e)=>new J({valueType:a,minSize:null,maxSize:null,typeName:m.ZodSet,..._(e)});class Ae extends v{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})}}Ae.create=(a,e)=>new Ae({getter:a,typeName:m.ZodLazy,..._(e)});let ue=class extends v{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return d(t,{received:t.data,code:u.invalid_literal,expected:this._def.value}),g}return{status:"valid",value:e.data}}get value(){return this._def.value}};ue.create=(a,e)=>new ue({value:a,typeName:m.ZodLiteral,..._(e)});function Re(a,e){return new fe({values:a,typeName:m.ZodEnum,..._(e)})}let fe=class de extends v{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),s=this._def.values;return d(t,{expected:b.joinValues(s),received:t.parsedType,code:u.invalid_type}),g}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),s=this._def.values;return d(t,{received:t.data,code:u.invalid_enum_value,options:s}),g}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 de.create(e,{...this._def,...t})}exclude(e,t=this._def){return de.create(this.options.filter(s=>!e.includes(s)),{...this._def,...t})}};fe.create=Re;class Ie extends v{_parse(e){const t=b.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==l.string&&s.parsedType!==l.number){const n=b.objectValues(t);return d(s,{expected:b.joinValues(n),received:s.parsedType,code:u.invalid_type}),g}if(this._cache||(this._cache=new Set(b.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const n=b.objectValues(t);return d(s,{received:s.data,code:u.invalid_enum_value,options:n}),g}return x(e.data)}get enum(){return this._def.values}}Ie.create=(a,e)=>new Ie({values:a,typeName:m.ZodNativeEnum,..._(e)});let te=class extends v{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==l.promise&&t.common.async===!1)return d(t,{code:u.invalid_type,expected:l.promise,received:t.parsedType}),g;const s=t.parsedType===l.promise?t.data:Promise.resolve(t.data);return x(s.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}};te.create=(a,e)=>new te({type:a,typeName:m.ZodPromise,..._(e)});let D=class extends v{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===m.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:s}=this._processInputParams(e),n=this._def.effect||null,r={addIssue:i=>{d(s,i),i.fatal?t.abort():t.dirty()},get path(){return s.path}};if(r.addIssue=r.addIssue.bind(r),n.type==="preprocess"){const i=n.transform(s.data,r);if(s.common.async)return Promise.resolve(i).then(async o=>{if(t.value==="aborted")return g;const c=await this._def.schema._parseAsync({data:o,path:s.path,parent:s});return c.status==="aborted"?g:c.status==="dirty"||t.value==="dirty"?re(c.value):c});{if(t.value==="aborted")return g;const o=this._def.schema._parseSync({data:i,path:s.path,parent:s});return o.status==="aborted"?g:o.status==="dirty"||t.value==="dirty"?re(o.value):o}}if(n.type==="refinement"){const i=o=>{const c=n.refinement(o,r);if(s.common.async)return Promise.resolve(c);if(c 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"?g:(o.status==="dirty"&&t.dirty(),i(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"?g:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(n.type==="transform")if(s.common.async===!1){const i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!L(i))return g;const o=n.transform(i.value,r);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(i=>L(i)?Promise.resolve(n.transform(i.value,r)).then(o=>({status:t.value,value:o})):g);b.assertNever(n)}};D.create=(a,e,t)=>new D({schema:a,typeName:m.ZodEffects,effect:e,..._(t)});D.createWithPreprocess=(a,e,t)=>new D({schema:e,effect:{type:"preprocess",transform:a},typeName:m.ZodEffects,..._(t)});let $=class extends v{_parse(e){return this._getType(e)===l.undefined?x(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};$.create=(a,e)=>new $({innerType:a,typeName:m.ZodOptional,..._(e)});let V=class extends v{_parse(e){return this._getType(e)===l.null?x(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};V.create=(a,e)=>new V({innerType:a,typeName:m.ZodNullable,..._(e)});let le=class extends v{_parse(e){const{ctx:t}=this._processInputParams(e);let s=t.data;return t.parsedType===l.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,..._(e)});class he extends v{_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 Y(n)?n.then(r=>({status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new O(s.common.issues)},input:s.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new O(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,..._(e)});class Ee extends v{_parse(e){if(this._getType(e)!==l.nan){const t=this._getOrReturnCtx(e);return d(t,{code:u.invalid_type,expected:l.nan,received:t.parsedType}),g}return{status:"valid",value:e.data}}}Ee.create=a=>new Ee({typeName:m.ZodNaN,..._(a)});class bt extends v{_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 me extends v{_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"?g:n.status==="dirty"?(t.dirty(),re(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"?g: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 me({in:e,out:t,typeName:m.ZodPipeline})}}class pe extends v{_parse(e){const t=this._def.innerType._parse(e),s=n=>(L(n)&&(n.value=Object.freeze(n.value)),n);return Y(t)?t.then(n=>s(n)):s(t)}unwrap(){return this._def.innerType}}pe.create=(a,e)=>new pe({innerType:a,typeName:m.ZodReadonly,..._(e)});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 wt=E.create,kt=oe.create;P.create;T.create;const xt=A.create;X.create;ee.create;q.create;const St=ue.create;fe.create;te.create;$.create;V.create;const Ct="1.11.0",Nt={version:Ct};class qe{constructor(e){this._client=e}async getCurrent(){const e=await this._client.request("accounts.getCurrent",{});if(!e.success)throw new Error("Failed to fetch current account");return e.account}}class Me{constructor(e){this._client=e}async getAllByMountPoint(e){return(await this._client.request("applications.getAllByMountPoint",{mountPoint:e})).applications}async getByName(e){return(await this._client.request("applications.getByName",{name:e})).application}async setDependencies(e){return await this._client.request("applications.setDependencies",{applicationSpecifiers:e},{timeout:0})}bind(e,t){if(this._client._messageInterceptors.has(e))throw new Error(`Interceptor already bound for message ${e}`);this._client._messageInterceptors.set(e,t)}}class Le{constructor(e){this._client=e}async getInformation(){const e=await this._client.request("devices.getInformation",{});if(!e.success)throw new Error("Failed to get device information");return e.deviceInformation}async getCapabilities(){const e=await this._client.request("devices.getCapabilities",{});if(!e.success)throw new Error("Failed to get device capabilities");return e.capabilities}}class De{constructor(e){this._client=e}async getColorScheme(){return(await this._client.request("environment.getColorScheme",{})).colorScheme}async subscribeColorScheme(e){return(await this._client.subscribe("environment.subscribeColorScheme",{},e)).success}async unsubscribeColorScheme(e){return(await this._client.unsubscribe("environment.unsubscribeColorScheme",{},e)).success}}class Ve{constructor(e){this._client=e}async getAllFolders(){return(await this._client.request("mediaFolders.getAll",{})).folders}async getAllByFolderId(e){return(await this._client.request("media.getAllByFolderId",{folderId:e})).contents}async getAllByTag(e){return(await this._client.request("media.getAllByTag",{tagName:e})).contents}async getById(e){return(await this._client.request("media.getById",{id:e})).content}async openPicker(e){return(await this._client.request("media.openPicker",{accept:e==null?void 0:e.accept,currentValue:e==null?void 0:e.currentValue})).selection}}class ze{constructor(e){this._client=e}async fetch(e,t){var s;let n;typeof e=="string"?n=e:e instanceof URL?n=e.toString():(n=e.url,t||(t={method:e.method,headers:e.headers,body:e.body,credentials:e.credentials,cache:e.cache,redirect:e.redirect,referrer:e.referrer,integrity:e.integrity}));let r={};t!=null&&t.headers&&(t.headers instanceof Headers?t.headers.forEach((y,w)=>{r[w]=y}):Array.isArray(t.headers)?t.headers.forEach(([y,w])=>{r[y]=w}):r=t.headers);const i=await this._client.request("proxy.fetch",{url:n,method:(t==null?void 0:t.method)||"GET",headers:r,body:(s=t==null?void 0:t.body)!==null&&s!==void 0?s:null});if(!i.success)throw new TypeError(i.errorMessage,{cause:i.errorCause?Error(i.errorCause):void 0});const o=new Headers(i.headers),c={status:i.status,statusText:i.statusText,headers:o};let h=null;if(i.body!==null&&i.body!==void 0)if(i.bodyType==="binary"){const y=atob(i.body),w=new Uint8Array(y.length);for(let S=0;S<y.length;S++)w[S]=y.charCodeAt(S);h=w}else i.bodyType==="text"?h=i.body:i.bodyType==="json"&&(h=JSON.stringify(i.body));return new Response(h,c)}}class Be{constructor(e){this._client=e}get application(){return new U("application","",this._client)}get instance(){return new U("instance",this._client.applicationInstance,this._client)}get device(){return new U("device",this._client.applicationInstance,this._client)}shared(e){return new U("shared",e,this._client)}}class U{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 Ue{constructor(e){this._client=e}async getCurrent(){const e=await this._client.request("users.getCurrent",{});if(!e.success)throw new Error("Failed to fetch current user");return e.user}}class He{constructor(e){this._client=e}async getCities(e){const t=await this._client.request("weather.getCities",e);if(!t.success)throw new Error(t.error||"Failed to fetch cities");return t.data||[]}async getConditions(e){const t=await this._client.request("weather.getConditions",e);if(!t.success)throw new Error(t.error||"Failed to fetch weather conditions");return t}async getDailyForecast(e){const t=await this._client.request("weather.getDailyForecast",e);if(!t.success)throw new Error(t.error||"Failed to fetch daily forecast");return t}async getHourlyForecast(e){const t=await this._client.request("weather.getHourlyForecast",e);if(!t.success)throw new Error(t.error||"Failed to fetch hourly forecast");return t}async getAlerts(e){const t=await this._client.request("weather.getAlerts",e);if(!t.success)throw new Error(t.error||"Failed to fetch weather alerts");return t}}class Ke{constructor(e){this._client=e}async getSymbols(){const e=await this._client.request("currency.getSymbols",{});if(!e.success||!e.symbols)throw new Error("Failed to fetch currency symbols");return e.symbols}async getRates(e){var t,s,n;const r=await this._client.request("currency.getRates",e);if(!r.success||!r.rates)throw((t=r.error)===null||t===void 0?void 0:t.code)===201?new Error(`Invalid base currency '${e.base}'`):((s=r.error)===null||s===void 0?void 0:s.code)===202?new Error(`Invalid target currency symbol '${e.symbols}'`):new Error(((n=r.error)===null||n===void 0?void 0:n.message)||"Failed to fetch currency rates");return r.rates}}class We{constructor(e){this._client=e}async discover(){const e=await this._client.request("mqtt.discover",{});if(!e.success)throw new Error("Failed to discover MQTT brokers");return e.brokers}async connect(e,t){const s=await this._client.request("mqtt.connect",{brokerUrl:e,...t});if(!s.success)throw new Error("Failed to connect to MQTT broker");return s.clientId}async disconnect(e){if(!(await this._client.request("mqtt.disconnect",{clientId:e})).success)throw new Error("Failed to disconnect from MQTT broker")}async publish(e,t,s,n){if(!(await this._client.request("mqtt.publish",{clientId:e,topic:t,payload:s,...n})).success)throw new Error("Failed to publish MQTT message")}async subscribe(e,t,s,n){return(await this._client.subscribe("mqtt.subscribe",{clientId:e,topic:t,...n},s)).success}async unsubscribe(e,t,s){return(await this._client.unsubscribe("mqtt.unsubscribe",{clientId:e,topic:t},s)).success}async getConnectionStatus(e){const t=await this._client.request("mqtt.getConnectionStatus",{clientId:e});if(!t.success)throw new Error("Failed to get MQTT connection status");return t.status}async subscribeConnectionStatus(e,t){return(await this._client.subscribe("mqtt.subscribeConnectionStatus",{clientId:e},t)).success}async unsubscribeConnectionStatus(e,t){return(await this._client.unsubscribe("mqtt.unsubscribeConnectionStatus",{clientId:e},t)).success}}function Q(a){return{...a,type:"client"}}const Tt=xt({type:St("bridge"),name:wt(),data:kt()});class Zt{constructor(e){if(e._client._applicationSpecifier!=="rootSettingsNavigation")throw new Error("RootSettingsNavigation can only be used in the rootSettingsNavigation mount point");this._store=e}async setRootSettingsNavigation(e){var t;const s=this._store.shared("root-settings-navigation"),n=(t=await s.get("navigation"))!==null&&t!==void 0?t:{},r=this._store._client._applicationSpecifier;n[r]={applicationSpecifier:r,entries:e.entries},s.set("navigation",n)}async getRootSettingsNavigation(){var e;const t=(e=await this._store.shared("root-settings-navigation").get("navigation"))!==null&&e!==void 0?e:{},s=this._store._client._applicationSpecifier;return t[s]}async getAllRootSettingsNavigation(){var e;return(e=await this._store.shared("root-settings-navigation").get("navigation"))!==null&&e!==void 0?e:{}}}const z=1e3*30,ge=typeof window>"u"&&typeof self<"u",H=ge?self:window;function B(a){ge?self.postMessage(a):H.parent.postMessage(a,"*")}class Ot{constructor(e){this._applicationName=e,this._applicationInstance="",this._applicationSpecifier="",this._messageInterceptors=new Map,this._onHandlers=new Map,this._onceHandlers=new Map,this._subscriptionNamesByHandler=new Map,this._subscriptionNamesBySubjectName=new Map}get accounts(){return new qe(this)}get users(){return new Ue(this)}get store(){return new Be(this)}get applications(){return new Me(this)}get media(){return new Ve(this)}get proxy(){return new ze(this)}get devices(){return new Le(this)}get rootSettingsNavigation(){return new Zt(this.store)}get weather(){return new He(this)}get currency(){return new Ke(this)}get environment(){return new De(this)}get mqtt(){return new We(this)}get applicationName(){return this._applicationName}get applicationSpecifier(){return this._applicationSpecifier}get applicationInstance(){return this._applicationInstance}bind(){var e,t,s;const n=new URL(H.location.href),r=n.searchParams;if(this._applicationInstance=(e=r.get("applicationInstance"))!==null&&e!==void 0?e:"",!this._applicationInstance)throw new Error("Missing applicationInstance query parameter");if(this._applicationSpecifier=(t=r.get("applicationSpecifier"))!==null&&t!==void 0?t:"",!this._applicationSpecifier){const i=n.hostname.split(".");this._applicationSpecifier=(s=i[0])!==null&&s!==void 0?s:""}if(!this._applicationSpecifier||this._applicationSpecifier.length!==40)throw new Error(`Invalid applicationSpecifier: expected 40-character hash, got "${this._applicationSpecifier}"`);this._windowMessageHandler=i=>{if(i.source===H||!i.data||typeof i.data!="object"||!("type"in i.data)||i.data.type!=="client"&&i.data.type!=="bridge")return;let o;if(i.data.type==="client"){const c=this._messageInterceptors.get(i.data.name);if(!c){B(i.data);return}o={...c(i.data.data),type:"bridge"}}if(!o){const c=Tt.safeParse(i.data);if(!c.success)return;o=c.data;const h=this._onHandlers.get(o.name),y=this._onceHandlers.get(o.name);if(h)for(const w of h)w(o.data);if(y){for(const w of y)w(o.data);this._onceHandlers.delete(o.name)}}if(!ge)for(let c=0;c<window.frames.length;c+=1)window.frames[c].postMessage(o,"*")},H.addEventListener("message",this._windowMessageHandler)}unbind(){this._windowMessageHandler&&H.removeEventListener("message",this._windowMessageHandler)}send(e,t){const s=Q({telemetrySdkVersion:K,applicationName:this._applicationName,applicationSpecifier:this._applicationSpecifier,applicationInstance:this._applicationInstance,name:e,data:t});B(s)}request(e,t,s){var n;const r=G(),i=Q({telemetrySdkVersion:K,applicationName:this._applicationName,applicationSpecifier:this._applicationSpecifier,applicationInstance:this._applicationInstance,name:e,data:t,responseName:r});B(i);const o=(n=s==null?void 0:s.timeout)!==null&&n!==void 0?n:z;let c=!1,h;const y=new Promise(S=>{h=F=>{c||S(F)},this.once(r,h)});if(o===0)return y;const w=new Promise((S,F)=>{const Z=new Error(`${e} message request with response name of ${r} timed out after ${o}`);setTimeout(()=>{c=!0,this.off(r,h),F(Z)},o)});return Promise.race([w,y])}async subscribe(e,t,s){let n,r;typeof t=="function"?r=t:(n=t,r=s);const i=G(),o=G();let c=this._subscriptionNamesBySubjectName.get(e);c||(c=[],this._subscriptionNamesBySubjectName.set(e,c)),c.push(i),this._subscriptionNamesByHandler.set(r,i),this.on(i,r);const h=Q({telemetrySdkVersion:K,applicationName:this._applicationName,applicationSpecifier:this._applicationSpecifier,applicationInstance:this._applicationInstance,name:e,data:n,responseName:o,subscriptionName:i});B(h);let y=!1,w;const S=new Promise((Z,R)=>{const se=new Error(`${e} subscribe request with subscription name of ${i} and response name of ${o} timed out after ${z}`);setTimeout(()=>{y=!0,this.off(o,w),R(se)},z)}),F=new Promise(Z=>{w=R=>{y||Z(R)},this.on(o,Z)});return Promise.race([S,F])}async unsubscribe(e,t,s){let n,r;typeof t=="function"?r=t:(n=t,r=s);const i=G();let o=[];if(r){const c=this._subscriptionNamesByHandler.get(r);if(!c)return{success:!1};o=[c],this._subscriptionNamesByHandler.delete(r)}else if(!this._subscriptionNamesBySubjectName.get(e))return{success:!1};for await(const c of o){this.off(c,r);const h=Q({telemetrySdkVersion:K,applicationInstance:this._applicationInstance,applicationName:this._applicationName,applicationSpecifier:this._applicationSpecifier,name:e,data:n,responseName:i,unsubscribeName:c});B(h);let y=!1,w;const S=new Promise((Z,R)=>{const se=new Error(`${e} unsubscribe request with unsubscribe name of ${c} and response name of ${i} timed out after ${z}`);setTimeout(()=>{y=!0,this.off(i,w),R(se)},z)}),F=new Promise(Z=>{w=R=>{y||Z(R)},this.once(i,Z)});if(!(await Promise.race([S,F])).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 r=0;r<s.length;r+=1)t&&s[r]!==t||(s.splice(r,1),r-=1);s.length===0&&this._onHandlers.delete(e)}if(n){for(let r=0;r<n.length;r+=1)t&&n[r]!==t||(n.splice(r,1),r-=1);n.length===0&&this._onceHandlers.delete(e)}}}}function G(){return Math.random().toString(36).slice(2,9)}const K=Nt.version;class At{constructor(e){this._client=e}async setOverride(e){if(!(await this._client.request("overrides.setOverride",{name:e})).success)throw new Error("Failed to set override");return!0}async clearOverride(e){if(!(await this._client.request("overrides.clearOverride",{name:e})).success)throw new Error("Failed to clear override");return!0}}class It{constructor(e){this._client=e}async nextPage(){if(!(await this._client.request("playlist.nextPage",{})).success)throw new Error("Failed to advance to next page");return!0}async previousPage(){if(!(await this._client.request("playlist.previousPage",{})).success)throw new Error("Failed to return to previous page");return!0}async setDuration(e){if(!(await this._client.request("playlist.setDuration",{duration:e})).success)throw new Error("Failed to set page duration");return!0}}class Et extends Ot{get playlist(){return new It(this)}get overrides(){return new At(this)}}let f=null;function $t(){return f}function jt(a){f=new Et(a),f.bind()}function Pt(){f==null||f.unbind(),f=null}function Ft(...a){return k(f),f.on(...a)}function Rt(...a){return k(f),f.once(...a)}function qt(...a){return k(f),f.off(...a)}function Mt(...a){return k(f),f.send(...a)}function Lt(...a){return k(f),f.request(...a)}function Dt(...a){return k(f),f.subscribe(...a)}function Vt(...a){return k(f),f.unsubscribe(...a)}function zt(){return k(f),f.store}function Bt(){return k(f),f.applications}function Ut(){return k(f),f.media}function Ht(){return k(f),f.accounts}function Kt(){return k(f),f.users}function Wt(){return k(f),f.devices}function Jt(){return k(f),f.proxy}function Qt(){return k(f),f.weather}function Gt(){return k(f),f.currency}function Yt(){return k(f),f.environment}function Xt(){return k(f),f.playlist}function es(){return k(f),f.overrides}function ts(){return k(f),f.mqtt}function k(a){if(!a)throw new Error("SDK is not configured")}exports.Accounts=qe;exports.Applications=Me;exports.Currency=Ke;exports.Devices=Le;exports.Environment=De;exports.Media=Ve;exports.Mqtt=We;exports.Proxy=ze;exports.Store=Be;exports.StoreSlice=U;exports.Users=Ue;exports.Weather=He;exports.accounts=Ht;exports.applications=Bt;exports.configure=jt;exports.currency=Gt;exports.destroy=Pt;exports.devices=Wt;exports.environment=Yt;exports.globalClient=$t;exports.media=Ut;exports.mqtt=ts;exports.off=qt;exports.on=Ft;exports.once=Rt;exports.overrides=es;exports.playlist=Xt;exports.proxy=Jt;exports.request=Lt;exports.send=Mt;exports.store=zt;exports.subscribe=Dt;exports.telemetrySdkVersion=K;exports.unsubscribe=Vt;exports.users=Kt;exports.weather=Qt;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var b;(function(a){a.assertEqual=n=>{};function e(n){}a.assertIs=e;function t(n){throw new Error}a.assertNever=t,a.arrayToEnum=n=>{const r={};for(const i of n)r[i]=i;return r},a.getValidEnumValues=n=>{const r=a.objectKeys(n).filter(o=>typeof n[n[o]]!="number"),i={};for(const o of r)i[o]=n[o];return a.objectValues(i)},a.objectValues=n=>a.objectKeys(n).map(function(r){return n[r]}),a.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{const r=[];for(const i in n)Object.prototype.hasOwnProperty.call(n,i)&&r.push(i);return r},a.find=(n,r)=>{for(const i of n)if(r(i))return i},a.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function s(n,r=" | "){return n.map(i=>typeof i=="string"?`'${i}'`:i).join(r)}a.joinValues=s,a.jsonStringifyReplacer=(n,r)=>typeof r=="bigint"?r.toString():r})(b||(b={}));var ye;(function(a){a.mergeShapes=(e,t)=>({...e,...t})})(ye||(ye={}));const l=b.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),A=a=>{switch(typeof a){case"undefined":return l.undefined;case"string":return l.string;case"number":return Number.isNaN(a)?l.nan:l.number;case"boolean":return l.boolean;case"function":return l.function;case"bigint":return l.bigint;case"symbol":return l.symbol;case"object":return Array.isArray(a)?l.array:a===null?l.null:a.then&&typeof a.then=="function"&&a.catch&&typeof a.catch=="function"?l.promise:typeof Map<"u"&&a instanceof Map?l.map:typeof Set<"u"&&a instanceof Set?l.set:typeof Date<"u"&&a instanceof Date?l.date:l.object;default:return l.unknown}},u=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"]);class Z 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(r){return r.message},s={_errors:[]},n=r=>{for(const i of r.issues)if(i.code==="invalid_union")i.unionErrors.map(n);else if(i.code==="invalid_return_type")n(i.returnTypeError);else if(i.code==="invalid_arguments")n(i.argumentsError);else if(i.path.length===0)s._errors.push(t(i));else{let o=s,c=0;for(;c<i.path.length;){const h=i.path[c];c===i.path.length-1?(o[h]=o[h]||{_errors:[]},o[h]._errors.push(t(i))):o[h]=o[h]||{_errors:[]},o=o[h],c++}}};return n(this),s}static assert(e){if(!(e instanceof Z))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,b.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},s=[];for(const n of this.issues)if(n.path.length>0){const r=n.path[0];t[r]=t[r]||[],t[r].push(e(n))}else s.push(e(n));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}}Z.create=a=>new Z(a);const ae=(a,e)=>{let t;switch(a.code){case u.invalid_type:a.received===l.undefined?t="Required":t=`Expected ${a.expected}, received ${a.received}`;break;case u.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(a.expected,b.jsonStringifyReplacer)}`;break;case u.unrecognized_keys:t=`Unrecognized key(s) in object: ${b.joinValues(a.keys,", ")}`;break;case u.invalid_union:t="Invalid input";break;case u.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${b.joinValues(a.options)}`;break;case u.invalid_enum_value:t=`Invalid enum value. Expected ${b.joinValues(a.options)}, received '${a.received}'`;break;case u.invalid_arguments:t="Invalid function arguments";break;case u.invalid_return_type:t="Invalid function return type";break;case u.invalid_date:t="Invalid date";break;case u.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 u.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==="bigint"?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 u.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 u.custom:t="Invalid input";break;case u.invalid_intersection_types:t="Intersection results could not be merged";break;case u.not_multiple_of:t=`Number must be a multiple of ${a.multipleOf}`;break;case u.not_finite:t="Number must be finite";break;default:t=e.defaultError,b.assertNever(a)}return{message:t}};let Je=ae;function Qe(){return Je}const Ge=a=>{const{data:e,path:t,errorMaps:s,issueData:n}=a,r=[...t,...n.path||[]],i={...n,path:r};if(n.message!==void 0)return{...n,path:r,message:n.message};let o="";const c=s.filter(h=>!!h).slice().reverse();for(const h of c)o=h(i,{data:e,defaultError:o}).message;return{...n,path:r,message:o}};function d(a,e){const t=Qe(),s=Ge({issueData:e,data:a.data,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,t,t===ae?void 0:ae].filter(n=>!!n)});a.common.issues.push(s)}let N=class $e{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 g;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 r=await n.key,i=await n.value;s.push({key:r,value:i})}return $e.mergeObjectSync(e,s)}static mergeObjectSync(e,t){const s={};for(const n of t){const{key:r,value:i}=n;if(r.status==="aborted"||i.status==="aborted")return g;r.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),r.value!=="__proto__"&&(typeof i.value<"u"||n.alwaysSet)&&(s[r.value]=i.value)}return{status:e.value,value:s}}};const g=Object.freeze({status:"aborted"}),re=a=>({status:"dirty",value:a}),x=a=>({status:"valid",value:a}),_e=a=>a.status==="aborted",ve=a=>a.status==="dirty",L=a=>a.status==="valid",Y=a=>typeof Promise<"u"&&a instanceof Promise;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={}));let $=class{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||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}};const be=(a,e)=>{if(L(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 Z(a.common.issues);return this._error=t,this._error}}};function _(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:(r,i)=>{const{message:o}=a;return r.code==="invalid_enum_value"?{message:o??i.defaultError}:typeof i.data>"u"?{message:o??s??i.defaultError}:r.code!=="invalid_type"?{message:i.defaultError}:{message:o??t??i.defaultError}},description:n}}let v=class{get description(){return this._def.description}_getType(e){return A(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:A(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new N,ctx:{common:e.parent.common,data:e.data,parsedType:A(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(Y(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){const s={common:{issues:[],async:(t==null?void 0:t.async)??!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:A(e)},n=this._parseSync({data:e,path:s.path,parent:s});return be(s,n)}"~validate"(e){var t,s;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:A(e)};if(!this["~standard"].async)try{const r=this._parseSync({data:e,path:[],parent:n});return L(r)?{value:r.value}:{issues:n.common.issues}}catch(r){(s=(t=r==null?void 0:r.message)==null?void 0:t.toLowerCase())!=null&&s.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(r=>L(r)?{value:r.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:A(e)},n=this._parse({data:e,path:s.path,parent:s}),r=await(Y(n)?n:Promise.resolve(n));return be(s,r)}refine(e,t){const s=n=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(n):t;return this._refinement((n,r)=>{const i=e(n),o=()=>r.addIssue({code:u.custom,...s(n)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(o(),!1)):i?!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 D({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 E.create(this,this._def)}nullable(){return V.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return T.create(this)}promise(){return te.create(this,this._def)}or(e){return X.create([this,e],this._def)}and(e){return ee.create(this,e,this._def)}transform(e){return new D({..._(this._def),schema:this,typeName:m.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new le({..._(this._def),innerType:this,defaultValue:t,typeName:m.ZodDefault})}brand(){return new bt({typeName:m.ZodBranded,type:this,..._(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new he({..._(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 me.create(this,e)}readonly(){return pe.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};const Ye=/^c[^\s-]{8,}$/i,Xe=/^[0-9a-z]+$/,et=/^[0-9A-HJKMNP-TV-Z]{26}$/i,tt=/^[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,st=/^[a-z0-9_-]{21}$/i,nt=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,at=/^[-+]?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)?)??$/,rt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,it="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let ne;const ot=/^(?:(?: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])$/,ct=/^(?:(?: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])$/,ut=/^(([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]))$/,dt=/^(([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])$/,lt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ht=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,je="((\\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])))",pt=new RegExp(`^${je}$`);function Pe(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 ft(a){return new RegExp(`^${Pe(a)}$`)}function mt(a){let e=`${je}T${Pe(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 gt(a,e){return!!((e==="v4"||!e)&&ot.test(a)||(e==="v6"||!e)&&ut.test(a))}function yt(a,e){if(!nt.test(a))return!1;try{const[t]=a.split(".");if(!t)return!1;const 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||"typ"in n&&(n==null?void 0:n.typ)!=="JWT"||!n.alg||e&&n.alg!==e)}catch{return!1}}function _t(a,e){return!!((e==="v4"||!e)&&ct.test(a)||(e==="v6"||!e)&&dt.test(a))}class I extends v{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==l.string){const n=this._getOrReturnCtx(e);return d(n,{code:u.invalid_type,expected:l.string,received:n.parsedType}),g}const t=new N;let s;for(const n of this._def.checks)if(n.kind==="min")e.data.length<n.value&&(s=this._getOrReturnCtx(e,s),d(s,{code:u.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),d(s,{code:u.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),t.dirty());else if(n.kind==="length"){const r=e.data.length>n.value,i=e.data.length<n.value;(r||i)&&(s=this._getOrReturnCtx(e,s),r?d(s,{code:u.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):i&&d(s,{code:u.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),t.dirty())}else if(n.kind==="email")rt.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"email",code:u.invalid_string,message:n.message}),t.dirty());else if(n.kind==="emoji")ne||(ne=new RegExp(it,"u")),ne.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"emoji",code:u.invalid_string,message:n.message}),t.dirty());else if(n.kind==="uuid")tt.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"uuid",code:u.invalid_string,message:n.message}),t.dirty());else if(n.kind==="nanoid")st.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"nanoid",code:u.invalid_string,message:n.message}),t.dirty());else if(n.kind==="cuid")Ye.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"cuid",code:u.invalid_string,message:n.message}),t.dirty());else if(n.kind==="cuid2")Xe.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"cuid2",code:u.invalid_string,message:n.message}),t.dirty());else if(n.kind==="ulid")et.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"ulid",code:u.invalid_string,message:n.message}),t.dirty());else if(n.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),d(s,{validation:"url",code:u.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),d(s,{validation:"regex",code:u.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),d(s,{code:u.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),d(s,{code:u.invalid_string,validation:{startsWith:n.value},message:n.message}),t.dirty()):n.kind==="endsWith"?e.data.endsWith(n.value)||(s=this._getOrReturnCtx(e,s),d(s,{code:u.invalid_string,validation:{endsWith:n.value},message:n.message}),t.dirty()):n.kind==="datetime"?mt(n).test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{code:u.invalid_string,validation:"datetime",message:n.message}),t.dirty()):n.kind==="date"?pt.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{code:u.invalid_string,validation:"date",message:n.message}),t.dirty()):n.kind==="time"?ft(n).test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{code:u.invalid_string,validation:"time",message:n.message}),t.dirty()):n.kind==="duration"?at.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"duration",code:u.invalid_string,message:n.message}),t.dirty()):n.kind==="ip"?gt(e.data,n.version)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"ip",code:u.invalid_string,message:n.message}),t.dirty()):n.kind==="jwt"?yt(e.data,n.alg)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"jwt",code:u.invalid_string,message:n.message}),t.dirty()):n.kind==="cidr"?_t(e.data,n.version)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"cidr",code:u.invalid_string,message:n.message}),t.dirty()):n.kind==="base64"?lt.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"base64",code:u.invalid_string,message:n.message}),t.dirty()):n.kind==="base64url"?ht.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"base64url",code:u.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:u.invalid_string,...p.errToObj(s)})}_addCheck(e){return new I({...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){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...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 I({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new I({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new I({...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}}I.create=a=>new I({checks:[],typeName:m.ZodString,coerce:(a==null?void 0:a.coerce)??!1,..._(a)});function vt(a,e){const t=(a.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,n=t>s?t:s,r=Number.parseInt(a.toFixed(n).replace(".","")),i=Number.parseInt(e.toFixed(n).replace(".",""));return r%i/10**n}let we=class ie extends v{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==l.number){const n=this._getOrReturnCtx(e);return d(n,{code:u.invalid_type,expected:l.number,received:n.parsedType}),g}let t;const s=new N;for(const n of this._def.checks)n.kind==="int"?b.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),d(t,{code:u.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),d(t,{code:u.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),d(t,{code:u.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),s.dirty()):n.kind==="multipleOf"?vt(e.data,n.value)!==0&&(t=this._getOrReturnCtx(e,t),d(t,{code:u.not_multiple_of,multipleOf:n.value,message:n.message}),s.dirty()):n.kind==="finite"?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),d(t,{code:u.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 ie({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:p.toString(n)}]})}_addCheck(e){return new ie({...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)}};we.create=a=>new we({checks:[],typeName:m.ZodNumber,coerce:(a==null?void 0:a.coerce)||!1,..._(a)});class W extends v{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==l.bigint)return this._getInvalidInput(e);let t;const s=new N;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),d(t,{code:u.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),d(t,{code:u.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),d(t,{code:u.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 d(t,{code:u.invalid_type,expected:l.bigint,received:t.parsedType}),g}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 W({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:p.toString(n)}]})}_addCheck(e){return new W({...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}}W.create=a=>new W({checks:[],typeName:m.ZodBigInt,coerce:(a==null?void 0:a.coerce)??!1,..._(a)});class ke extends v{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==l.boolean){const t=this._getOrReturnCtx(e);return d(t,{code:u.invalid_type,expected:l.boolean,received:t.parsedType}),g}return x(e.data)}}ke.create=a=>new ke({typeName:m.ZodBoolean,coerce:(a==null?void 0:a.coerce)||!1,..._(a)});let xe=class Fe extends v{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==l.date){const n=this._getOrReturnCtx(e);return d(n,{code:u.invalid_type,expected:l.date,received:n.parsedType}),g}if(Number.isNaN(e.data.getTime())){const n=this._getOrReturnCtx(e);return d(n,{code:u.invalid_date}),g}const t=new N;let s;for(const n of this._def.checks)n.kind==="min"?e.data.getTime()<n.value&&(s=this._getOrReturnCtx(e,s),d(s,{code:u.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),d(s,{code:u.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 Fe({...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}};xe.create=a=>new xe({checks:[],coerce:(a==null?void 0:a.coerce)||!1,typeName:m.ZodDate,..._(a)});class Se extends v{_parse(e){if(this._getType(e)!==l.symbol){const t=this._getOrReturnCtx(e);return d(t,{code:u.invalid_type,expected:l.symbol,received:t.parsedType}),g}return x(e.data)}}Se.create=a=>new Se({typeName:m.ZodSymbol,..._(a)});class Ce extends v{_parse(e){if(this._getType(e)!==l.undefined){const t=this._getOrReturnCtx(e);return d(t,{code:u.invalid_type,expected:l.undefined,received:t.parsedType}),g}return x(e.data)}}Ce.create=a=>new Ce({typeName:m.ZodUndefined,..._(a)});class Ne extends v{_parse(e){if(this._getType(e)!==l.null){const t=this._getOrReturnCtx(e);return d(t,{code:u.invalid_type,expected:l.null,received:t.parsedType}),g}return x(e.data)}}Ne.create=a=>new Ne({typeName:m.ZodNull,..._(a)});class oe extends v{constructor(){super(...arguments),this._any=!0}_parse(e){return x(e.data)}}oe.create=a=>new oe({typeName:m.ZodAny,..._(a)});class Te extends v{constructor(){super(...arguments),this._unknown=!0}_parse(e){return x(e.data)}}Te.create=a=>new Te({typeName:m.ZodUnknown,..._(a)});let j=class extends v{_parse(e){const t=this._getOrReturnCtx(e);return d(t,{code:u.invalid_type,expected:l.never,received:t.parsedType}),g}};j.create=a=>new j({typeName:m.ZodNever,..._(a)});class Ze extends v{_parse(e){if(this._getType(e)!==l.undefined){const t=this._getOrReturnCtx(e);return d(t,{code:u.invalid_type,expected:l.void,received:t.parsedType}),g}return x(e.data)}}Ze.create=a=>new Ze({typeName:m.ZodVoid,..._(a)});class T extends v{_parse(e){const{ctx:t,status:s}=this._processInputParams(e),n=this._def;if(t.parsedType!==l.array)return d(t,{code:u.invalid_type,expected:l.array,received:t.parsedType}),g;if(n.exactLength!==null){const i=t.data.length>n.exactLength.value,o=t.data.length<n.exactLength.value;(i||o)&&(d(t,{code:i?u.too_big:u.too_small,minimum:o?n.exactLength.value:void 0,maximum:i?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&&(d(t,{code:u.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&&(d(t,{code:u.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((i,o)=>n.type._parseAsync(new $(t,i,t.path,o)))).then(i=>N.mergeArray(s,i));const r=[...t.data].map((i,o)=>n.type._parseSync(new $(t,i,t.path,o)));return N.mergeArray(s,r)}get element(){return this._def.type}min(e,t){return new T({...this._def,minLength:{value:e,message:p.toString(t)}})}max(e,t){return new T({...this._def,maxLength:{value:e,message:p.toString(t)}})}length(e,t){return new T({...this._def,exactLength:{value:e,message:p.toString(t)}})}nonempty(e){return this.min(1,e)}}T.create=(a,e)=>new T({type:a,minLength:null,maxLength:null,exactLength:null,typeName:m.ZodArray,..._(e)});function M(a){if(a instanceof O){const e={};for(const t in a.shape){const s=a.shape[t];e[t]=E.create(M(s))}return new O({...a._def,shape:()=>e})}else return a instanceof T?new T({...a._def,type:M(a.element)}):a instanceof E?E.create(M(a.unwrap())):a instanceof V?V.create(M(a.unwrap())):a instanceof q?q.create(a.items.map(e=>M(e))):a}let O=class C extends v{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=b.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==l.object){const c=this._getOrReturnCtx(e);return d(c,{code:u.invalid_type,expected:l.object,received:c.parsedType}),g}const{status:t,ctx:s}=this._processInputParams(e),{shape:n,keys:r}=this._getCached(),i=[];if(!(this._def.catchall instanceof j&&this._def.unknownKeys==="strip"))for(const c in s.data)r.includes(c)||i.push(c);const o=[];for(const c of r){const h=n[c],y=s.data[c];o.push({key:{status:"valid",value:c},value:h._parse(new $(s,y,s.path,c)),alwaysSet:c in s.data})}if(this._def.catchall instanceof j){const c=this._def.unknownKeys;if(c==="passthrough")for(const h of i)o.push({key:{status:"valid",value:h},value:{status:"valid",value:s.data[h]}});else if(c==="strict")i.length>0&&(d(s,{code:u.unrecognized_keys,keys:i}),t.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const h of i){const y=s.data[h];o.push({key:{status:"valid",value:h},value:c._parse(new $(s,y,s.path,h)),alwaysSet:h in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const c=[];for(const h of o){const y=await h.key,w=await h.value;c.push({key:y,value:w,alwaysSet:h.alwaysSet})}return c}).then(c=>N.mergeObjectSync(t,c)):N.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return p.errToObj,new C({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{var n,r;const i=((r=(n=this._def).errorMap)==null?void 0:r.call(n,t,s).message)??s.defaultError;return t.code==="unrecognized_keys"?{message:p.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new C({...this._def,unknownKeys:"strip"})}passthrough(){return new C({...this._def,unknownKeys:"passthrough"})}extend(e){return new C({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new C({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 C({...this._def,catchall:e})}pick(e){const t={};for(const s of b.objectKeys(e))e[s]&&this.shape[s]&&(t[s]=this.shape[s]);return new C({...this._def,shape:()=>t})}omit(e){const t={};for(const s of b.objectKeys(this.shape))e[s]||(t[s]=this.shape[s]);return new C({...this._def,shape:()=>t})}deepPartial(){return M(this)}partial(e){const t={};for(const s of b.objectKeys(this.shape)){const n=this.shape[s];e&&!e[s]?t[s]=n:t[s]=n.optional()}return new C({...this._def,shape:()=>t})}required(e){const t={};for(const s of b.objectKeys(this.shape))if(e&&!e[s])t[s]=this.shape[s];else{let n=this.shape[s];for(;n instanceof E;)n=n._def.innerType;t[s]=n}return new C({...this._def,shape:()=>t})}keyof(){return Re(b.objectKeys(this.shape))}};O.create=(a,e)=>new O({shape:()=>a,unknownKeys:"strip",catchall:j.create(),typeName:m.ZodObject,..._(e)});O.strictCreate=(a,e)=>new O({shape:()=>a,unknownKeys:"strict",catchall:j.create(),typeName:m.ZodObject,..._(e)});O.lazycreate=(a,e)=>new O({shape:a,unknownKeys:"strip",catchall:j.create(),typeName:m.ZodObject,..._(e)});let X=class extends v{_parse(e){const{ctx:t}=this._processInputParams(e),s=this._def.options;function n(r){for(const o of r)if(o.result.status==="valid")return o.result;for(const o of r)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const i=r.map(o=>new Z(o.ctx.common.issues));return d(t,{code:u.invalid_union,unionErrors:i}),g}if(t.common.async)return Promise.all(s.map(async r=>{const i={...t,common:{...t.common,issues:[]},parent:null};return{result:await r._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(n);{let r;const i=[];for(const c of s){const h={...t,common:{...t.common,issues:[]},parent:null},y=c._parseSync({data:t.data,path:t.path,parent:h});if(y.status==="valid")return y;y.status==="dirty"&&!r&&(r={result:y,ctx:h}),h.common.issues.length&&i.push(h.common.issues)}if(r)return t.common.issues.push(...r.ctx.common.issues),r.result;const o=i.map(c=>new Z(c));return d(t,{code:u.invalid_union,unionErrors:o}),g}}get options(){return this._def.options}};X.create=(a,e)=>new X({options:a,typeName:m.ZodUnion,..._(e)});function ce(a,e){const t=A(a),s=A(e);if(a===e)return{valid:!0,data:a};if(t===l.object&&s===l.object){const n=b.objectKeys(e),r=b.objectKeys(a).filter(o=>n.indexOf(o)!==-1),i={...a,...e};for(const o of r){const c=ce(a[o],e[o]);if(!c.valid)return{valid:!1};i[o]=c.data}return{valid:!0,data:i}}else if(t===l.array&&s===l.array){if(a.length!==e.length)return{valid:!1};const n=[];for(let r=0;r<a.length;r++){const i=a[r],o=e[r],c=ce(i,o);if(!c.valid)return{valid:!1};n.push(c.data)}return{valid:!0,data:n}}else return t===l.date&&s===l.date&&+a==+e?{valid:!0,data:a}:{valid:!1}}let ee=class extends v{_parse(e){const{status:t,ctx:s}=this._processInputParams(e),n=(r,i)=>{if(_e(r)||_e(i))return g;const o=ce(r.value,i.value);return o.valid?((ve(r)||ve(i))&&t.dirty(),{status:t.value,value:o.data}):(d(s,{code:u.invalid_intersection_types}),g)};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(([r,i])=>n(r,i)):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}))}};ee.create=(a,e,t)=>new ee({left:a,right:e,typeName:m.ZodIntersection,..._(t)});class q extends v{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==l.array)return d(s,{code:u.invalid_type,expected:l.array,received:s.parsedType}),g;if(s.data.length<this._def.items.length)return d(s,{code:u.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),g;!this._def.rest&&s.data.length>this._def.items.length&&(d(s,{code:u.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const n=[...s.data].map((r,i)=>{const o=this._def.items[i]||this._def.rest;return o?o._parse(new $(s,r,s.path,i)):null}).filter(r=>!!r);return s.common.async?Promise.all(n).then(r=>N.mergeArray(t,r)):N.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new q({...this._def,rest:e})}}q.create=(a,e)=>{if(!Array.isArray(a))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new q({items:a,typeName:m.ZodTuple,rest:null,..._(e)})};class Oe extends v{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!==l.map)return d(s,{code:u.invalid_type,expected:l.map,received:s.parsedType}),g;const n=this._def.keyType,r=this._def.valueType,i=[...s.data.entries()].map(([o,c],h)=>({key:n._parse(new $(s,o,s.path,[h,"key"])),value:r._parse(new $(s,c,s.path,[h,"value"]))}));if(s.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const c of i){const h=await c.key,y=await c.value;if(h.status==="aborted"||y.status==="aborted")return g;(h.status==="dirty"||y.status==="dirty")&&t.dirty(),o.set(h.value,y.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const c of i){const h=c.key,y=c.value;if(h.status==="aborted"||y.status==="aborted")return g;(h.status==="dirty"||y.status==="dirty")&&t.dirty(),o.set(h.value,y.value)}return{status:t.value,value:o}}}}Oe.create=(a,e,t)=>new Oe({valueType:e,keyType:a,typeName:m.ZodMap,..._(t)});class J extends v{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==l.set)return d(s,{code:u.invalid_type,expected:l.set,received:s.parsedType}),g;const n=this._def;n.minSize!==null&&s.data.size<n.minSize.value&&(d(s,{code:u.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&&(d(s,{code:u.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());const r=this._def.valueType;function i(c){const h=new Set;for(const y of c){if(y.status==="aborted")return g;y.status==="dirty"&&t.dirty(),h.add(y.value)}return{status:t.value,value:h}}const o=[...s.data.values()].map((c,h)=>r._parse(new $(s,c,s.path,h)));return s.common.async?Promise.all(o).then(c=>i(c)):i(o)}min(e,t){return new J({...this._def,minSize:{value:e,message:p.toString(t)}})}max(e,t){return new J({...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)}}J.create=(a,e)=>new J({valueType:a,minSize:null,maxSize:null,typeName:m.ZodSet,..._(e)});class Ae extends v{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})}}Ae.create=(a,e)=>new Ae({getter:a,typeName:m.ZodLazy,..._(e)});let ue=class extends v{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return d(t,{received:t.data,code:u.invalid_literal,expected:this._def.value}),g}return{status:"valid",value:e.data}}get value(){return this._def.value}};ue.create=(a,e)=>new ue({value:a,typeName:m.ZodLiteral,..._(e)});function Re(a,e){return new fe({values:a,typeName:m.ZodEnum,..._(e)})}let fe=class de extends v{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),s=this._def.values;return d(t,{expected:b.joinValues(s),received:t.parsedType,code:u.invalid_type}),g}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),s=this._def.values;return d(t,{received:t.data,code:u.invalid_enum_value,options:s}),g}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 de.create(e,{...this._def,...t})}exclude(e,t=this._def){return de.create(this.options.filter(s=>!e.includes(s)),{...this._def,...t})}};fe.create=Re;class Ie extends v{_parse(e){const t=b.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==l.string&&s.parsedType!==l.number){const n=b.objectValues(t);return d(s,{expected:b.joinValues(n),received:s.parsedType,code:u.invalid_type}),g}if(this._cache||(this._cache=new Set(b.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const n=b.objectValues(t);return d(s,{received:s.data,code:u.invalid_enum_value,options:n}),g}return x(e.data)}get enum(){return this._def.values}}Ie.create=(a,e)=>new Ie({values:a,typeName:m.ZodNativeEnum,..._(e)});let te=class extends v{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==l.promise&&t.common.async===!1)return d(t,{code:u.invalid_type,expected:l.promise,received:t.parsedType}),g;const s=t.parsedType===l.promise?t.data:Promise.resolve(t.data);return x(s.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}};te.create=(a,e)=>new te({type:a,typeName:m.ZodPromise,..._(e)});let D=class extends v{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===m.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:s}=this._processInputParams(e),n=this._def.effect||null,r={addIssue:i=>{d(s,i),i.fatal?t.abort():t.dirty()},get path(){return s.path}};if(r.addIssue=r.addIssue.bind(r),n.type==="preprocess"){const i=n.transform(s.data,r);if(s.common.async)return Promise.resolve(i).then(async o=>{if(t.value==="aborted")return g;const c=await this._def.schema._parseAsync({data:o,path:s.path,parent:s});return c.status==="aborted"?g:c.status==="dirty"||t.value==="dirty"?re(c.value):c});{if(t.value==="aborted")return g;const o=this._def.schema._parseSync({data:i,path:s.path,parent:s});return o.status==="aborted"?g:o.status==="dirty"||t.value==="dirty"?re(o.value):o}}if(n.type==="refinement"){const i=o=>{const c=n.refinement(o,r);if(s.common.async)return Promise.resolve(c);if(c 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"?g:(o.status==="dirty"&&t.dirty(),i(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"?g:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(n.type==="transform")if(s.common.async===!1){const i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!L(i))return g;const o=n.transform(i.value,r);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(i=>L(i)?Promise.resolve(n.transform(i.value,r)).then(o=>({status:t.value,value:o})):g);b.assertNever(n)}};D.create=(a,e,t)=>new D({schema:a,typeName:m.ZodEffects,effect:e,..._(t)});D.createWithPreprocess=(a,e,t)=>new D({schema:e,effect:{type:"preprocess",transform:a},typeName:m.ZodEffects,..._(t)});let E=class extends v{_parse(e){return this._getType(e)===l.undefined?x(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};E.create=(a,e)=>new E({innerType:a,typeName:m.ZodOptional,..._(e)});let V=class extends v{_parse(e){return this._getType(e)===l.null?x(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};V.create=(a,e)=>new V({innerType:a,typeName:m.ZodNullable,..._(e)});let le=class extends v{_parse(e){const{ctx:t}=this._processInputParams(e);let s=t.data;return t.parsedType===l.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,..._(e)});class he extends v{_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 Y(n)?n.then(r=>({status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new Z(s.common.issues)},input:s.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new Z(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,..._(e)});class Ee extends v{_parse(e){if(this._getType(e)!==l.nan){const t=this._getOrReturnCtx(e);return d(t,{code:u.invalid_type,expected:l.nan,received:t.parsedType}),g}return{status:"valid",value:e.data}}}Ee.create=a=>new Ee({typeName:m.ZodNaN,..._(a)});class bt extends v{_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 me extends v{_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"?g:n.status==="dirty"?(t.dirty(),re(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"?g: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 me({in:e,out:t,typeName:m.ZodPipeline})}}class pe extends v{_parse(e){const t=this._def.innerType._parse(e),s=n=>(L(n)&&(n.value=Object.freeze(n.value)),n);return Y(t)?t.then(n=>s(n)):s(t)}unwrap(){return this._def.innerType}}pe.create=(a,e)=>new pe({innerType:a,typeName:m.ZodReadonly,..._(e)});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 wt=I.create,kt=oe.create;j.create;T.create;const xt=O.create;X.create;ee.create;q.create;const St=ue.create;fe.create;te.create;E.create;V.create;const Ct="1.12.0",Nt={version:Ct};class qe{constructor(e){this._client=e}async getCurrent(){const e=await this._client.request("accounts.getCurrent",{});if(!e.success)throw new Error("Failed to fetch current account");return e.account}}class Me{constructor(e){this._client=e}async getAllByMountPoint(e){return(await this._client.request("applications.getAllByMountPoint",{mountPoint:e})).applications}async getByName(e){return(await this._client.request("applications.getByName",{name:e})).application}async setDependencies(e){return await this._client.request("applications.setDependencies",{applicationSpecifiers:e},{timeout:0})}bind(e,t){if(this._client._messageInterceptors.has(e))throw new Error(`Interceptor already bound for message ${e}`);this._client._messageInterceptors.set(e,t)}}class Le{constructor(e){this._client=e}async getInformation(){const e=await this._client.request("devices.getInformation",{});if(!e.success)throw new Error("Failed to get device information");return e.deviceInformation}async getCapabilities(){const e=await this._client.request("devices.getCapabilities",{});if(!e.success)throw new Error("Failed to get device capabilities");return e.capabilities}}class De{constructor(e){this._client=e}async getColorScheme(){return(await this._client.request("environment.getColorScheme",{})).colorScheme}async subscribeColorScheme(e){return(await this._client.subscribe("environment.subscribeColorScheme",{},e)).success}async unsubscribeColorScheme(e){return(await this._client.unsubscribe("environment.unsubscribeColorScheme",{},e)).success}}class Ve{constructor(e){this._client=e}async getAllFolders(){return(await this._client.request("mediaFolders.getAll",{})).folders}async getAllByFolderId(e){return(await this._client.request("media.getAllByFolderId",{folderId:e})).contents}async getAllByTag(e){return(await this._client.request("media.getAllByTag",{tagName:e})).contents}async getById(e){return(await this._client.request("media.getById",{id:e})).content}async openPicker(e){return(await this._client.request("media.openPicker",{accept:e==null?void 0:e.accept,currentValue:e==null?void 0:e.currentValue})).selection}}class ze{constructor(e){this._client=e}async fetch(e,t){var s;let n;typeof e=="string"?n=e:e instanceof URL?n=e.toString():(n=e.url,t||(t={method:e.method,headers:e.headers,body:e.body,credentials:e.credentials,cache:e.cache,redirect:e.redirect,referrer:e.referrer,integrity:e.integrity}));let r={};t!=null&&t.headers&&(t.headers instanceof Headers?t.headers.forEach((y,w)=>{r[w]=y}):Array.isArray(t.headers)?t.headers.forEach(([y,w])=>{r[y]=w}):r=t.headers);const i=await this._client.request("proxy.fetch",{url:n,method:(t==null?void 0:t.method)||"GET",headers:r,body:(s=t==null?void 0:t.body)!==null&&s!==void 0?s:null});if(!i.success)throw new TypeError(i.errorMessage,{cause:i.errorCause?Error(i.errorCause):void 0});const o=new Headers(i.headers),c={status:i.status,statusText:i.statusText,headers:o};let h=null;if(i.body!==null&&i.body!==void 0)if(i.bodyType==="binary"){const y=atob(i.body),w=new Uint8Array(y.length);for(let S=0;S<y.length;S++)w[S]=y.charCodeAt(S);h=w}else i.bodyType==="text"?h=i.body:i.bodyType==="json"&&(h=JSON.stringify(i.body));return new Response(h,c)}}class Be{constructor(e){this._client=e}get application(){return new U("application","",this._client)}get instance(){return new U("instance",this._client.applicationInstance,this._client)}get device(){return new U("device",this._client.applicationInstance,this._client)}shared(e){return new U("shared",e,this._client)}}class U{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 Ue{constructor(e){this._client=e}async getCurrent(){const e=await this._client.request("users.getCurrent",{});if(!e.success)throw new Error("Failed to fetch current user");return e.user}}class He{constructor(e){this._client=e}async getCities(e){const t=await this._client.request("weather.getCities",e);if(!t.success)throw new Error(t.error||"Failed to fetch cities");return t.data||[]}async getConditions(e){const t=await this._client.request("weather.getConditions",e);if(!t.success)throw new Error(t.error||"Failed to fetch weather conditions");return t}async getDailyForecast(e){const t=await this._client.request("weather.getDailyForecast",e);if(!t.success)throw new Error(t.error||"Failed to fetch daily forecast");return t}async getHourlyForecast(e){const t=await this._client.request("weather.getHourlyForecast",e);if(!t.success)throw new Error(t.error||"Failed to fetch hourly forecast");return t}async getAlerts(e){const t=await this._client.request("weather.getAlerts",e);if(!t.success)throw new Error(t.error||"Failed to fetch weather alerts");return t}}class Ke{constructor(e){this._client=e}async getSymbols(){const e=await this._client.request("currency.getSymbols",{});if(!e.success||!e.symbols)throw new Error("Failed to fetch currency symbols");return e.symbols}async getRates(e){var t,s,n;const r=await this._client.request("currency.getRates",e);if(!r.success||!r.rates)throw((t=r.error)===null||t===void 0?void 0:t.code)===201?new Error(`Invalid base currency '${e.base}'`):((s=r.error)===null||s===void 0?void 0:s.code)===202?new Error(`Invalid target currency symbol '${e.symbols}'`):new Error(((n=r.error)===null||n===void 0?void 0:n.message)||"Failed to fetch currency rates");return r.rates}}class We{constructor(e){this._client=e}async discover(){const e=await this._client.request("mqtt.discover",{});if(!e.success)throw new Error("Failed to discover MQTT brokers");return e.brokers}async connect(e,t){const s=await this._client.request("mqtt.connect",{brokerUrl:e,...t});if(!s.success)throw new Error("Failed to connect to MQTT broker");return s.clientId}async disconnect(e){if(!(await this._client.request("mqtt.disconnect",{clientId:e})).success)throw new Error("Failed to disconnect from MQTT broker")}async publish(e,t,s,n){if(!(await this._client.request("mqtt.publish",{clientId:e,topic:t,payload:s,...n})).success)throw new Error("Failed to publish MQTT message")}async subscribe(e,t,s,n){return(await this._client.subscribe("mqtt.subscribe",{clientId:e,topic:t,...n},s)).success}async unsubscribe(e,t,s){return(await this._client.unsubscribe("mqtt.unsubscribe",{clientId:e,topic:t},s)).success}async getConnectionStatus(e){const t=await this._client.request("mqtt.getConnectionStatus",{clientId:e});if(!t.success)throw new Error("Failed to get MQTT connection status");return t.status}async subscribeConnectionStatus(e,t){return(await this._client.subscribe("mqtt.subscribeConnectionStatus",{clientId:e},t)).success}async unsubscribeConnectionStatus(e,t){return(await this._client.unsubscribe("mqtt.unsubscribeConnectionStatus",{clientId:e},t)).success}}function Q(a){return{...a,type:"client"}}const Tt=xt({type:St("bridge"),name:wt(),data:kt()});class Zt{constructor(e){if(e._client._applicationSpecifier!=="rootSettingsNavigation")throw new Error("RootSettingsNavigation can only be used in the rootSettingsNavigation mount point");this._store=e}async setRootSettingsNavigation(e){var t;const s=this._store.shared("root-settings-navigation"),n=(t=await s.get("navigation"))!==null&&t!==void 0?t:{},r=this._store._client._applicationSpecifier;n[r]={applicationSpecifier:r,entries:e.entries},s.set("navigation",n)}async getRootSettingsNavigation(){var e;const t=(e=await this._store.shared("root-settings-navigation").get("navigation"))!==null&&e!==void 0?e:{},s=this._store._client._applicationSpecifier;return t[s]}async getAllRootSettingsNavigation(){var e;return(e=await this._store.shared("root-settings-navigation").get("navigation"))!==null&&e!==void 0?e:{}}}const z=1e3*30,ge=typeof window>"u"&&typeof self<"u",H=ge?self:window;function B(a){ge?self.postMessage(a):H.parent.postMessage(a,"*")}class Ot{constructor(e){this._applicationName=e,this._applicationInstance="",this._applicationSpecifier="",this._messageInterceptors=new Map,this._onHandlers=new Map,this._onceHandlers=new Map,this._subscriptionNamesByHandler=new Map,this._subscriptionNamesBySubjectName=new Map}get accounts(){return new qe(this)}get users(){return new Ue(this)}get store(){return new Be(this)}get applications(){return new Me(this)}get media(){return new Ve(this)}get proxy(){return new ze(this)}get devices(){return new Le(this)}get rootSettingsNavigation(){return new Zt(this.store)}get weather(){return new He(this)}get currency(){return new Ke(this)}get environment(){return new De(this)}get mqtt(){return new We(this)}get applicationName(){return this._applicationName}get applicationSpecifier(){return this._applicationSpecifier}get applicationInstance(){return this._applicationInstance}bind(){var e,t,s;const n=new URL(H.location.href),r=n.searchParams;if(this._applicationInstance=(e=r.get("applicationInstance"))!==null&&e!==void 0?e:"",!this._applicationInstance)throw new Error("Missing applicationInstance query parameter");if(this._applicationSpecifier=(t=r.get("applicationSpecifier"))!==null&&t!==void 0?t:"",!this._applicationSpecifier){const i=n.hostname.split(".");this._applicationSpecifier=(s=i[0])!==null&&s!==void 0?s:""}if(!this._applicationSpecifier||this._applicationSpecifier.length!==40)throw new Error(`Invalid applicationSpecifier: expected 40-character hash, got "${this._applicationSpecifier}"`);this._windowMessageHandler=i=>{if(i.source===H||!i.data||typeof i.data!="object"||!("type"in i.data)||i.data.type!=="client"&&i.data.type!=="bridge")return;let o;if(i.data.type==="client"){const c=this._messageInterceptors.get(i.data.name);if(!c){B(i.data);return}o={...c(i.data.data),type:"bridge"}}if(!o){const c=Tt.safeParse(i.data);if(!c.success)return;o=c.data;const h=this._onHandlers.get(o.name),y=this._onceHandlers.get(o.name);if(h)for(const w of h)w(o.data);if(y){for(const w of y)w(o.data);this._onceHandlers.delete(o.name)}}if(!ge)for(let c=0;c<window.frames.length;c+=1)window.frames[c].postMessage(o,"*")},H.addEventListener("message",this._windowMessageHandler)}unbind(){this._windowMessageHandler&&H.removeEventListener("message",this._windowMessageHandler)}send(e,t){const s=Q({telemetrySdkVersion:K,applicationName:this._applicationName,applicationSpecifier:this._applicationSpecifier,applicationInstance:this._applicationInstance,name:e,data:t});B(s)}request(e,t,s){var n;const r=G(),i=Q({telemetrySdkVersion:K,applicationName:this._applicationName,applicationSpecifier:this._applicationSpecifier,applicationInstance:this._applicationInstance,name:e,data:t,responseName:r});B(i);const o=(n=s==null?void 0:s.timeout)!==null&&n!==void 0?n:z;let c=!1,h;const y=new Promise(S=>{h=P=>{c||S(P)},this.once(r,h)});if(o===0)return y;const w=new Promise((S,P)=>{const F=new Error(`${e} message request with response name of ${r} timed out after ${o}`);setTimeout(()=>{c=!0,this.off(r,h),P(F)},o)});return Promise.race([w,y])}async subscribe(e,t,s){let n,r;typeof t=="function"?r=t:(n=t,r=s);const i=G(),o=G();let c=this._subscriptionNamesBySubjectName.get(e);c||(c=[],this._subscriptionNamesBySubjectName.set(e,c)),c.push(i),this._subscriptionNamesByHandler.set(r,i),this.on(i,r);const h=Q({telemetrySdkVersion:K,applicationName:this._applicationName,applicationSpecifier:this._applicationSpecifier,applicationInstance:this._applicationInstance,name:e,data:n,responseName:o,subscriptionName:i});B(h);let y=!1,w;const S=new Promise((F,R)=>{const se=new Error(`${e} subscribe request with subscription name of ${i} and response name of ${o} timed out after ${z}`);setTimeout(()=>{y=!0,this.off(o,w),R(se)},z)}),P=new Promise(F=>{w=R=>{y||F(R)},this.once(o,w)});return Promise.race([S,P])}async unsubscribe(e,t,s){let n,r;typeof t=="function"?r=t:(n=t,r=s);const i=G();let o=[];if(r){const c=this._subscriptionNamesByHandler.get(r);if(!c)return{success:!1};o=[c],this._subscriptionNamesByHandler.delete(r)}else if(!this._subscriptionNamesBySubjectName.get(e))return{success:!1};for await(const c of o){this.off(c,r);const h=Q({telemetrySdkVersion:K,applicationInstance:this._applicationInstance,applicationName:this._applicationName,applicationSpecifier:this._applicationSpecifier,name:e,data:n,responseName:i,unsubscribeName:c});B(h);let y=!1,w;const S=new Promise((F,R)=>{const se=new Error(`${e} unsubscribe request with unsubscribe name of ${c} and response name of ${i} timed out after ${z}`);setTimeout(()=>{y=!0,this.off(i,w),R(se)},z)}),P=new Promise(F=>{w=R=>{y||F(R)},this.once(i,w)});if(!(await Promise.race([S,P])).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 r=0;r<s.length;r+=1)t&&s[r]!==t||(s.splice(r,1),r-=1);s.length===0&&this._onHandlers.delete(e)}if(n){for(let r=0;r<n.length;r+=1)t&&n[r]!==t||(n.splice(r,1),r-=1);n.length===0&&this._onceHandlers.delete(e)}}}}function G(){return Math.random().toString(36).slice(2,9)}const K=Nt.version;class At{constructor(e){this._client=e}async setOverride(e){if(!(await this._client.request("overrides.setOverride",{name:e})).success)throw new Error("Failed to set override");return!0}async clearOverride(e){if(!(await this._client.request("overrides.clearOverride",{name:e})).success)throw new Error("Failed to clear override");return!0}}class It{constructor(e){this._client=e}async nextPage(){if(!(await this._client.request("playlist.nextPage",{})).success)throw new Error("Failed to advance to next page");return!0}async previousPage(){if(!(await this._client.request("playlist.previousPage",{})).success)throw new Error("Failed to return to previous page");return!0}async setDuration(e){if(!(await this._client.request("playlist.setDuration",{duration:e})).success)throw new Error("Failed to set page duration");return!0}}class Et extends Ot{get playlist(){return new It(this)}get overrides(){return new At(this)}}let f=null;function $t(){return f}function jt(a){f=new Et(a),f.bind()}function Pt(){f==null||f.unbind(),f=null}function Ft(...a){return k(f),f.on(...a)}function Rt(...a){return k(f),f.once(...a)}function qt(...a){return k(f),f.off(...a)}function Mt(...a){return k(f),f.send(...a)}function Lt(...a){return k(f),f.request(...a)}function Dt(...a){return k(f),f.subscribe(...a)}function Vt(...a){return k(f),f.unsubscribe(...a)}function zt(){return k(f),f.store}function Bt(){return k(f),f.applications}function Ut(){return k(f),f.media}function Ht(){return k(f),f.accounts}function Kt(){return k(f),f.users}function Wt(){return k(f),f.devices}function Jt(){return k(f),f.proxy}function Qt(){return k(f),f.weather}function Gt(){return k(f),f.currency}function Yt(){return k(f),f.environment}function Xt(){return k(f),f.playlist}function es(){return k(f),f.overrides}function ts(){return k(f),f.mqtt}function k(a){if(!a)throw new Error("SDK is not configured")}exports.Accounts=qe;exports.Applications=Me;exports.Currency=Ke;exports.Devices=Le;exports.Environment=De;exports.Media=Ve;exports.Mqtt=We;exports.Proxy=ze;exports.Store=Be;exports.StoreSlice=U;exports.Users=Ue;exports.Weather=He;exports.accounts=Ht;exports.applications=Bt;exports.configure=jt;exports.currency=Gt;exports.destroy=Pt;exports.devices=Wt;exports.environment=Yt;exports.globalClient=$t;exports.media=Ut;exports.mqtt=ts;exports.off=qt;exports.on=Ft;exports.once=Rt;exports.overrides=es;exports.playlist=Xt;exports.proxy=Jt;exports.request=Lt;exports.send=Mt;exports.store=zt;exports.subscribe=Dt;exports.telemetrySdkVersion=K;exports.unsubscribe=Vt;exports.users=Kt;exports.weather=Qt;
package/dist/index.js CHANGED
@@ -64,7 +64,7 @@ const l = b.arrayToEnum([
64
64
  "never",
65
65
  "map",
66
66
  "set"
67
- ]), I = (a) => {
67
+ ]), A = (a) => {
68
68
  switch (typeof a) {
69
69
  case "undefined":
70
70
  return l.undefined;
@@ -103,7 +103,7 @@ const l = b.arrayToEnum([
103
103
  "not_multiple_of",
104
104
  "not_finite"
105
105
  ]);
106
- class O extends Error {
106
+ class Z extends Error {
107
107
  get errors() {
108
108
  return this.issues;
109
109
  }
@@ -140,7 +140,7 @@ class O extends Error {
140
140
  return n(this), s;
141
141
  }
142
142
  static assert(e) {
143
- if (!(e instanceof O))
143
+ if (!(e instanceof Z))
144
144
  throw new Error(`Not a ZodError: ${e}`);
145
145
  }
146
146
  toString() {
@@ -166,7 +166,7 @@ class O extends Error {
166
166
  return this.flatten();
167
167
  }
168
168
  }
169
- O.create = (a) => new O(a);
169
+ Z.create = (a) => new Z(a);
170
170
  const ae = (a, e) => {
171
171
  let t;
172
172
  switch (a.code) {
@@ -314,7 +314,7 @@ var p;
314
314
  (function(a) {
315
315
  a.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, a.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
316
316
  })(p || (p = {}));
317
- let j = class {
317
+ let $ = class {
318
318
  constructor(e, t, s, n) {
319
319
  this._cachedPath = [], this.parent = e, this.data = t, this._path = s, this._key = n;
320
320
  }
@@ -332,7 +332,7 @@ const be = (a, e) => {
332
332
  get error() {
333
333
  if (this._error)
334
334
  return this._error;
335
- const t = new O(a.common.issues);
335
+ const t = new Z(a.common.issues);
336
336
  return this._error = t, this._error;
337
337
  }
338
338
  };
@@ -353,13 +353,13 @@ let v = class {
353
353
  return this._def.description;
354
354
  }
355
355
  _getType(e) {
356
- return I(e.data);
356
+ return A(e.data);
357
357
  }
358
358
  _getOrReturnCtx(e, t) {
359
359
  return t || {
360
360
  common: e.parent.common,
361
361
  data: e.data,
362
- parsedType: I(e.data),
362
+ parsedType: A(e.data),
363
363
  schemaErrorMap: this._def.errorMap,
364
364
  path: e.path,
365
365
  parent: e.parent
@@ -371,7 +371,7 @@ let v = class {
371
371
  ctx: {
372
372
  common: e.parent.common,
373
373
  data: e.data,
374
- parsedType: I(e.data),
374
+ parsedType: A(e.data),
375
375
  schemaErrorMap: this._def.errorMap,
376
376
  path: e.path,
377
377
  parent: e.parent
@@ -405,7 +405,7 @@ let v = class {
405
405
  schemaErrorMap: this._def.errorMap,
406
406
  parent: null,
407
407
  data: e,
408
- parsedType: I(e)
408
+ parsedType: A(e)
409
409
  }, n = this._parseSync({ data: e, path: s.path, parent: s });
410
410
  return be(s, n);
411
411
  }
@@ -420,7 +420,7 @@ let v = class {
420
420
  schemaErrorMap: this._def.errorMap,
421
421
  parent: null,
422
422
  data: e,
423
- parsedType: I(e)
423
+ parsedType: A(e)
424
424
  };
425
425
  if (!this["~standard"].async)
426
426
  try {
@@ -459,7 +459,7 @@ let v = class {
459
459
  schemaErrorMap: this._def.errorMap,
460
460
  parent: null,
461
461
  data: e,
462
- parsedType: I(e)
462
+ parsedType: A(e)
463
463
  }, n = this._parse({ data: e, path: s.path, parent: s }), r = await (Y(n) ? n : Promise.resolve(n));
464
464
  return be(s, r);
465
465
  }
@@ -494,7 +494,7 @@ let v = class {
494
494
  };
495
495
  }
496
496
  optional() {
497
- return $.create(this, this._def);
497
+ return E.create(this, this._def);
498
498
  }
499
499
  nullable() {
500
500
  return V.create(this, this._def);
@@ -603,7 +603,7 @@ function it(a, e) {
603
603
  function ot(a, e) {
604
604
  return !!((e === "v4" || !e) && Ge.test(a) || (e === "v6" || !e) && Xe.test(a));
605
605
  }
606
- class E extends v {
606
+ class I extends v {
607
607
  _parse(e) {
608
608
  if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== l.string) {
609
609
  const n = this._getOrReturnCtx(e);
@@ -766,7 +766,7 @@ class E extends v {
766
766
  });
767
767
  }
768
768
  _addCheck(e) {
769
- return new E({
769
+ return new I({
770
770
  ...this._def,
771
771
  checks: [...this._def.checks, e]
772
772
  });
@@ -902,19 +902,19 @@ class E extends v {
902
902
  return this.min(1, p.errToObj(e));
903
903
  }
904
904
  trim() {
905
- return new E({
905
+ return new I({
906
906
  ...this._def,
907
907
  checks: [...this._def.checks, { kind: "trim" }]
908
908
  });
909
909
  }
910
910
  toLowerCase() {
911
- return new E({
911
+ return new I({
912
912
  ...this._def,
913
913
  checks: [...this._def.checks, { kind: "toLowerCase" }]
914
914
  });
915
915
  }
916
916
  toUpperCase() {
917
- return new E({
917
+ return new I({
918
918
  ...this._def,
919
919
  checks: [...this._def.checks, { kind: "toUpperCase" }]
920
920
  });
@@ -980,7 +980,7 @@ class E extends v {
980
980
  return e;
981
981
  }
982
982
  }
983
- E.create = (a) => new E({
983
+ I.create = (a) => new I({
984
984
  checks: [],
985
985
  typeName: m.ZodString,
986
986
  coerce: (a == null ? void 0 : a.coerce) ?? !1,
@@ -1466,7 +1466,7 @@ Te.create = (a) => new Te({
1466
1466
  typeName: m.ZodUnknown,
1467
1467
  ...y(a)
1468
1468
  });
1469
- let P = class extends v {
1469
+ let j = class extends v {
1470
1470
  _parse(e) {
1471
1471
  const t = this._getOrReturnCtx(e);
1472
1472
  return d(t, {
@@ -1476,7 +1476,7 @@ let P = class extends v {
1476
1476
  }), _;
1477
1477
  }
1478
1478
  };
1479
- P.create = (a) => new P({
1479
+ j.create = (a) => new j({
1480
1480
  typeName: m.ZodNever,
1481
1481
  ...y(a)
1482
1482
  });
@@ -1533,8 +1533,8 @@ class T extends v {
1533
1533
  exact: !1,
1534
1534
  message: n.maxLength.message
1535
1535
  }), s.dirty()), t.common.async)
1536
- return Promise.all([...t.data].map((i, o) => n.type._parseAsync(new j(t, i, t.path, o)))).then((i) => C.mergeArray(s, i));
1537
- const r = [...t.data].map((i, o) => n.type._parseSync(new j(t, i, t.path, o)));
1536
+ return Promise.all([...t.data].map((i, o) => n.type._parseAsync(new $(t, i, t.path, o)))).then((i) => C.mergeArray(s, i));
1537
+ const r = [...t.data].map((i, o) => n.type._parseSync(new $(t, i, t.path, o)));
1538
1538
  return C.mergeArray(s, r);
1539
1539
  }
1540
1540
  get element() {
@@ -1571,22 +1571,22 @@ T.create = (a, e) => new T({
1571
1571
  ...y(e)
1572
1572
  });
1573
1573
  function M(a) {
1574
- if (a instanceof A) {
1574
+ if (a instanceof O) {
1575
1575
  const e = {};
1576
1576
  for (const t in a.shape) {
1577
1577
  const s = a.shape[t];
1578
- e[t] = $.create(M(s));
1578
+ e[t] = E.create(M(s));
1579
1579
  }
1580
- return new A({
1580
+ return new O({
1581
1581
  ...a._def,
1582
1582
  shape: () => e
1583
1583
  });
1584
1584
  } else return a instanceof T ? new T({
1585
1585
  ...a._def,
1586
1586
  type: M(a.element)
1587
- }) : a instanceof $ ? $.create(M(a.unwrap())) : a instanceof V ? V.create(M(a.unwrap())) : a instanceof q ? q.create(a.items.map((e) => M(e))) : a;
1587
+ }) : a instanceof E ? E.create(M(a.unwrap())) : a instanceof V ? V.create(M(a.unwrap())) : a instanceof q ? q.create(a.items.map((e) => M(e))) : a;
1588
1588
  }
1589
- let A = class N extends v {
1589
+ let O = class N extends v {
1590
1590
  constructor() {
1591
1591
  super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
1592
1592
  }
@@ -1606,7 +1606,7 @@ let A = class N extends v {
1606
1606
  }), _;
1607
1607
  }
1608
1608
  const { status: t, ctx: s } = this._processInputParams(e), { shape: n, keys: r } = this._getCached(), i = [];
1609
- if (!(this._def.catchall instanceof P && this._def.unknownKeys === "strip"))
1609
+ if (!(this._def.catchall instanceof j && this._def.unknownKeys === "strip"))
1610
1610
  for (const c in s.data)
1611
1611
  r.includes(c) || i.push(c);
1612
1612
  const o = [];
@@ -1614,11 +1614,11 @@ let A = class N extends v {
1614
1614
  const h = n[c], g = s.data[c];
1615
1615
  o.push({
1616
1616
  key: { status: "valid", value: c },
1617
- value: h._parse(new j(s, g, s.path, c)),
1617
+ value: h._parse(new $(s, g, s.path, c)),
1618
1618
  alwaysSet: c in s.data
1619
1619
  });
1620
1620
  }
1621
- if (this._def.catchall instanceof P) {
1621
+ if (this._def.catchall instanceof j) {
1622
1622
  const c = this._def.unknownKeys;
1623
1623
  if (c === "passthrough")
1624
1624
  for (const h of i)
@@ -1639,7 +1639,7 @@ let A = class N extends v {
1639
1639
  o.push({
1640
1640
  key: { status: "valid", value: h },
1641
1641
  value: c._parse(
1642
- new j(s, g, s.path, h)
1642
+ new $(s, g, s.path, h)
1643
1643
  //, ctx.child(key), value, getParsedType(value)
1644
1644
  ),
1645
1645
  alwaysSet: h in s.data
@@ -1840,7 +1840,7 @@ let A = class N extends v {
1840
1840
  t[s] = this.shape[s];
1841
1841
  else {
1842
1842
  let n = this.shape[s];
1843
- for (; n instanceof $; )
1843
+ for (; n instanceof E; )
1844
1844
  n = n._def.innerType;
1845
1845
  t[s] = n;
1846
1846
  }
@@ -1853,24 +1853,24 @@ let A = class N extends v {
1853
1853
  return Re(b.objectKeys(this.shape));
1854
1854
  }
1855
1855
  };
1856
- A.create = (a, e) => new A({
1856
+ O.create = (a, e) => new O({
1857
1857
  shape: () => a,
1858
1858
  unknownKeys: "strip",
1859
- catchall: P.create(),
1859
+ catchall: j.create(),
1860
1860
  typeName: m.ZodObject,
1861
1861
  ...y(e)
1862
1862
  });
1863
- A.strictCreate = (a, e) => new A({
1863
+ O.strictCreate = (a, e) => new O({
1864
1864
  shape: () => a,
1865
1865
  unknownKeys: "strict",
1866
- catchall: P.create(),
1866
+ catchall: j.create(),
1867
1867
  typeName: m.ZodObject,
1868
1868
  ...y(e)
1869
1869
  });
1870
- A.lazycreate = (a, e) => new A({
1870
+ O.lazycreate = (a, e) => new O({
1871
1871
  shape: a,
1872
1872
  unknownKeys: "strip",
1873
- catchall: P.create(),
1873
+ catchall: j.create(),
1874
1874
  typeName: m.ZodObject,
1875
1875
  ...y(e)
1876
1876
  });
@@ -1884,7 +1884,7 @@ let X = class extends v {
1884
1884
  for (const o of r)
1885
1885
  if (o.result.status === "dirty")
1886
1886
  return t.common.issues.push(...o.ctx.common.issues), o.result;
1887
- const i = r.map((o) => new O(o.ctx.common.issues));
1887
+ const i = r.map((o) => new Z(o.ctx.common.issues));
1888
1888
  return d(t, {
1889
1889
  code: u.invalid_union,
1890
1890
  unionErrors: i
@@ -1931,7 +1931,7 @@ let X = class extends v {
1931
1931
  }
1932
1932
  if (r)
1933
1933
  return t.common.issues.push(...r.ctx.common.issues), r.result;
1934
- const o = i.map((c) => new O(c));
1934
+ const o = i.map((c) => new Z(c));
1935
1935
  return d(t, {
1936
1936
  code: u.invalid_union,
1937
1937
  unionErrors: o
@@ -1948,7 +1948,7 @@ X.create = (a, e) => new X({
1948
1948
  ...y(e)
1949
1949
  });
1950
1950
  function ce(a, e) {
1951
- const t = I(a), s = I(e);
1951
+ const t = A(a), s = A(e);
1952
1952
  if (a === e)
1953
1953
  return { valid: !0, data: a };
1954
1954
  if (t === l.object && s === l.object) {
@@ -2037,7 +2037,7 @@ class q extends v {
2037
2037
  }), t.dirty());
2038
2038
  const n = [...s.data].map((r, i) => {
2039
2039
  const o = this._def.items[i] || this._def.rest;
2040
- return o ? o._parse(new j(s, r, s.path, i)) : null;
2040
+ return o ? o._parse(new $(s, r, s.path, i)) : null;
2041
2041
  }).filter((r) => !!r);
2042
2042
  return s.common.async ? Promise.all(n).then((r) => C.mergeArray(t, r)) : C.mergeArray(t, n);
2043
2043
  }
@@ -2077,8 +2077,8 @@ class Oe extends v {
2077
2077
  received: s.parsedType
2078
2078
  }), _;
2079
2079
  const n = this._def.keyType, r = this._def.valueType, i = [...s.data.entries()].map(([o, c], h) => ({
2080
- key: n._parse(new j(s, o, s.path, [h, "key"])),
2081
- value: r._parse(new j(s, c, s.path, [h, "value"]))
2080
+ key: n._parse(new $(s, o, s.path, [h, "key"])),
2081
+ value: r._parse(new $(s, c, s.path, [h, "value"]))
2082
2082
  }));
2083
2083
  if (s.common.async) {
2084
2084
  const o = /* @__PURE__ */ new Map();
@@ -2144,7 +2144,7 @@ class K extends v {
2144
2144
  }
2145
2145
  return { status: t.value, value: h };
2146
2146
  }
2147
- const o = [...s.data.values()].map((c, h) => r._parse(new j(s, c, s.path, h)));
2147
+ const o = [...s.data.values()].map((c, h) => r._parse(new $(s, c, s.path, h)));
2148
2148
  return s.common.async ? Promise.all(o).then((c) => i(c)) : i(o);
2149
2149
  }
2150
2150
  min(e, t) {
@@ -2416,7 +2416,7 @@ D.createWithPreprocess = (a, e, t) => new D({
2416
2416
  typeName: m.ZodEffects,
2417
2417
  ...y(t)
2418
2418
  });
2419
- let $ = class extends v {
2419
+ let E = class extends v {
2420
2420
  _parse(e) {
2421
2421
  return this._getType(e) === l.undefined ? x(void 0) : this._def.innerType._parse(e);
2422
2422
  }
@@ -2424,7 +2424,7 @@ let $ = class extends v {
2424
2424
  return this._def.innerType;
2425
2425
  }
2426
2426
  };
2427
- $.create = (a, e) => new $({
2427
+ E.create = (a, e) => new E({
2428
2428
  innerType: a,
2429
2429
  typeName: m.ZodOptional,
2430
2430
  ...y(e)
@@ -2481,7 +2481,7 @@ class he extends v {
2481
2481
  status: "valid",
2482
2482
  value: r.status === "valid" ? r.value : this._def.catchValue({
2483
2483
  get error() {
2484
- return new O(s.common.issues);
2484
+ return new Z(s.common.issues);
2485
2485
  },
2486
2486
  input: s.data
2487
2487
  })
@@ -2489,7 +2489,7 @@ class he extends v {
2489
2489
  status: "valid",
2490
2490
  value: n.status === "valid" ? n.value : this._def.catchValue({
2491
2491
  get error() {
2492
- return new O(s.common.issues);
2492
+ return new Z(s.common.issues);
2493
2493
  },
2494
2494
  input: s.data
2495
2495
  })
@@ -2593,19 +2593,19 @@ var m;
2593
2593
  (function(a) {
2594
2594
  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";
2595
2595
  })(m || (m = {}));
2596
- const dt = E.create, lt = oe.create;
2597
- P.create;
2596
+ const dt = I.create, lt = oe.create;
2597
+ j.create;
2598
2598
  T.create;
2599
- const ht = A.create;
2599
+ const ht = O.create;
2600
2600
  X.create;
2601
2601
  ee.create;
2602
2602
  q.create;
2603
2603
  const pt = ue.create;
2604
2604
  fe.create;
2605
2605
  te.create;
2606
- $.create;
2606
+ E.create;
2607
2607
  V.create;
2608
- const ft = "1.11.0", mt = {
2608
+ const ft = "1.12.0", mt = {
2609
2609
  version: ft
2610
2610
  };
2611
2611
  class _t {
@@ -3708,16 +3708,16 @@ class Ot {
3708
3708
  const o = (n = s == null ? void 0 : s.timeout) !== null && n !== void 0 ? n : z;
3709
3709
  let c = !1, h;
3710
3710
  const g = new Promise((S) => {
3711
- h = (F) => {
3712
- c || S(F);
3711
+ h = (P) => {
3712
+ c || S(P);
3713
3713
  }, this.once(r, h);
3714
3714
  });
3715
3715
  if (o === 0)
3716
3716
  return g;
3717
- const w = new Promise((S, F) => {
3718
- const Z = new Error(`${e} message request with response name of ${r} timed out after ${o}`);
3717
+ const w = new Promise((S, P) => {
3718
+ const F = new Error(`${e} message request with response name of ${r} timed out after ${o}`);
3719
3719
  setTimeout(() => {
3720
- c = !0, this.off(r, h), F(Z);
3720
+ c = !0, this.off(r, h), P(F);
3721
3721
  }, o);
3722
3722
  });
3723
3723
  return Promise.race([w, g]);
@@ -3740,17 +3740,17 @@ class Ot {
3740
3740
  });
3741
3741
  B(h);
3742
3742
  let g = !1, w;
3743
- const S = new Promise((Z, R) => {
3743
+ const S = new Promise((F, R) => {
3744
3744
  const se = new Error(`${e} subscribe request with subscription name of ${i} and response name of ${o} timed out after ${z}`);
3745
3745
  setTimeout(() => {
3746
3746
  g = !0, this.off(o, w), R(se);
3747
3747
  }, z);
3748
- }), F = new Promise((Z) => {
3748
+ }), P = new Promise((F) => {
3749
3749
  w = (R) => {
3750
- g || Z(R);
3751
- }, this.on(o, Z);
3750
+ g || F(R);
3751
+ }, this.once(o, w);
3752
3752
  });
3753
- return Promise.race([S, F]);
3753
+ return Promise.race([S, P]);
3754
3754
  }
3755
3755
  async unsubscribe(e, t, s) {
3756
3756
  let n, r;
@@ -3778,17 +3778,17 @@ class Ot {
3778
3778
  });
3779
3779
  B(h);
3780
3780
  let g = !1, w;
3781
- const S = new Promise((Z, R) => {
3781
+ const S = new Promise((F, R) => {
3782
3782
  const se = new Error(`${e} unsubscribe request with unsubscribe name of ${c} and response name of ${i} timed out after ${z}`);
3783
3783
  setTimeout(() => {
3784
3784
  g = !0, this.off(i, w), R(se);
3785
3785
  }, z);
3786
- }), F = new Promise((Z) => {
3786
+ }), P = new Promise((F) => {
3787
3787
  w = (R) => {
3788
- g || Z(R);
3789
- }, this.once(i, Z);
3788
+ g || F(R);
3789
+ }, this.once(i, w);
3790
3790
  });
3791
- if (!(await Promise.race([S, F])).success)
3791
+ if (!(await Promise.race([S, P])).success)
3792
3792
  return { success: !1 };
3793
3793
  }
3794
3794
  return { success: !0 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telemetryos/sdk",
3
- "version": "1.11.0",
3
+ "version": "1.12.0",
4
4
  "description": "The official TelemetryOS application API package. Use it to build applications that run on the TelemetryOS platform",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -42,7 +42,7 @@
42
42
  "license": "",
43
43
  "repository": "github:TelemetryTV/Application-API",
44
44
  "dependencies": {
45
- "@telemetryos/root-sdk": "^1.11.0",
45
+ "@telemetryos/root-sdk": "^1.12.0",
46
46
  "zod": "^3.24.4"
47
47
  },
48
48
  "peerDependencies": {