@telemetryos/sdk 1.5.1 → 1.6.1
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 +28 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +25 -19
- package/dist/index.js +302 -284
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# @telemetryos/sdk
|
|
2
2
|
|
|
3
|
+
## 1.6.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Add scripts for release process
|
|
8
|
+
|
|
9
|
+
Adds a few scripts to help make the release process for these packages
|
|
10
|
+
smoother. Fixes a few issues with undeployed changes from the last release.
|
|
11
|
+
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
- @telemetryos/root-sdk@1.6.1
|
|
14
|
+
|
|
15
|
+
## 1.6.0
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- Fixes the init command, improvements
|
|
20
|
+
|
|
21
|
+
- Fixes an issue where the init command would fail
|
|
22
|
+
- Changes the location of the config file when you store an API token
|
|
23
|
+
- Improves CLAUDE.md for Claude Code integration
|
|
24
|
+
- Exports the environment API for the SDK
|
|
25
|
+
|
|
26
|
+
### Patch Changes
|
|
27
|
+
|
|
28
|
+
- Updated dependencies
|
|
29
|
+
- @telemetryos/root-sdk@1.6.0
|
|
30
|
+
|
|
3
31
|
## 1.5.1
|
|
4
32
|
|
|
5
33
|
### Patch 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=>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"&&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 $e;(function(a){a.mergeShapes=(e,t)=>({...e,...t})})($e||($e={}));const h=b.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),j=a=>{switch(typeof a){case"undefined":return h.undefined;case"string":return h.string;case"number":return isNaN(a)?h.nan:h.number;case"boolean":return h.boolean;case"function":return h.function;case"bigint":return h.bigint;case"symbol":return h.symbol;case"object":return Array.isArray(a)?h.array:a===null?h.null:a.then&&typeof a.then=="function"&&a.catch&&typeof a.catch=="function"?h.promise:typeof Map<"u"&&a instanceof Map?h.map:typeof Set<"u"&&a instanceof Set?h.set:typeof Date<"u"&&a instanceof Date?h.date:h.object;default:return h.unknown}},d=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"]),ft=a=>JSON.stringify(a,null,2).replace(/"([^"]+)":/g,"$1:");let O=class He 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 u=i.path[c];c===i.path.length-1?(o[u]=o[u]||{_errors:[]},o[u]._errors.push(t(i))):o[u]=o[u]||{_errors:[]},o=o[u],c++}}};return n(this),s}static assert(e){if(!(e instanceof He))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,b.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},s=[];for(const n of this.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):s.push(e(n));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}};O.create=a=>new O(a);const H=(a,e)=>{let t;switch(a.code){case d.invalid_type:a.received===h.undefined?t="Required":t=`Expected ${a.expected}, received ${a.received}`;break;case d.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(a.expected,b.jsonStringifyReplacer)}`;break;case d.unrecognized_keys:t=`Unrecognized key(s) in object: ${b.joinValues(a.keys,", ")}`;break;case d.invalid_union:t="Invalid input";break;case d.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${b.joinValues(a.options)}`;break;case d.invalid_enum_value:t=`Invalid enum value. Expected ${b.joinValues(a.options)}, received '${a.received}'`;break;case d.invalid_arguments:t="Invalid function arguments";break;case d.invalid_return_type:t="Invalid function return type";break;case d.invalid_date:t="Invalid date";break;case d.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 d.too_small:a.type==="array"?t=`Array must contain ${a.exact?"exactly":a.inclusive?"at least":"more than"} ${a.minimum} element(s)`:a.type==="string"?t=`String must contain ${a.exact?"exactly":a.inclusive?"at least":"over"} ${a.minimum} character(s)`:a.type==="number"?t=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="date"?t=`Date must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(a.minimum))}`:t="Invalid input";break;case d.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 d.custom:t="Invalid input";break;case d.invalid_intersection_types:t="Intersection results could not be merged";break;case d.not_multiple_of:t=`Number must be a multiple of ${a.multipleOf}`;break;case d.not_finite:t="Number must be finite";break;default:t=e.defaultError,b.assertNever(a)}return{message:t}};let Ke=H;function mt(a){Ke=a}function we(){return Ke}const ke=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(u=>!!u).slice().reverse();for(const u of c)o=u(i,{data:e,defaultError:o}).message;return{...n,path:r,message:o}},yt=[];function l(a,e){const t=we(),s=ke({issueData:e,data:a.data,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,t,t===H?void 0:H].filter(n=>!!n)});a.common.issues.push(s)}let S=class We{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 y;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 We.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 y;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 y=Object.freeze({status:"aborted"}),xe=a=>({status:"dirty",value:a}),x=a=>({status:"valid",value:a}),Pe=a=>a.status==="aborted",Re=a=>a.status==="dirty",q=a=>a.status==="valid",X=a=>typeof Promise<"u"&&a instanceof Promise;function Ze(a,e,t,s){if(typeof e=="function"?a!==e||!0:!e.has(a))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(a)}function Je(a,e,t,s,n){if(typeof e=="function"?a!==e||!0:!e.has(a))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(a,t),t}var p;(function(a){a.errToObj=e=>typeof e=="string"?{message:e}:e||{},a.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(p||(p={}));var J,Y;class I{constructor(e,t,s,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=n}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Ve=(a,e)=>{if(q(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 g(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)=>{var o,c;const{message:u}=a;return r.code==="invalid_enum_value"?{message:u??i.defaultError}:typeof i.data>"u"?{message:(o=u??s)!==null&&o!==void 0?o:i.defaultError}:r.code!=="invalid_type"?{message:i.defaultError}:{message:(c=u??t)!==null&&c!==void 0?c:i.defaultError}},description:n}}let v=class{get description(){return this._def.description}_getType(e){return j(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:j(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new S,ctx:{common:e.parent.common,data:e.data,parsedType:j(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(X(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){var s;const n={common:{issues:[],async:(s=t==null?void 0:t.async)!==null&&s!==void 0?s:!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:j(e)},r=this._parseSync({data:e,path:n.path,parent:n});return Ve(n,r)}"~validate"(e){var t,s;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:j(e)};if(!this["~standard"].async)try{const r=this._parseSync({data:e,path:[],parent:n});return q(r)?{value:r.value}:{issues:n.common.issues}}catch(r){!((s=(t=r==null?void 0:r.message)===null||t===void 0?void 0:t.toLowerCase())===null||s===void 0)&&s.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(r=>q(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:j(e)},n=this._parse({data:e,path:s.path,parent:s}),r=await(X(n)?n:Promise.resolve(n));return Ve(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:d.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 A({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 M.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return V.create(this)}promise(){return W.create(this,this._def)}or(e){return ne.create([this,e],this._def)}and(e){return ie.create(this,e,this._def)}transform(e){return new A({...g(this._def),schema:this,typeName:m.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new ue({...g(this._def),innerType:this,defaultValue:t,typeName:m.ZodDefault})}brand(){return new ze({typeName:m.ZodBranded,type:this,...g(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new le({...g(this._def),innerType:this,catchValue:t,typeName:m.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return fe.create(this,e)}readonly(){return he.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};const gt=/^c[^\s-]{8,}$/i,_t=/^[0-9a-z]+$/,vt=/^[0-9A-HJKMNP-TV-Z]{26}$/i,bt=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,wt=/^[a-z0-9_-]{21}$/i,kt=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,xt=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Zt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,St="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let je;const Tt=/^(?:(?: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])$/,Nt=/^(?:(?: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])$/,Ct=/^(([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]))$/,Ot=/^(([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])$/,At=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Et=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Ye="((\\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])))",It=new RegExp(`^${Ye}$`);function Ge(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 jt(a){return new RegExp(`^${Ge(a)}$`)}function Xe(a){let e=`${Ye}T${Ge(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 $t(a,e){return!!((e==="v4"||!e)&&Tt.test(a)||(e==="v6"||!e)&&Ct.test(a))}function Pt(a,e){if(!kt.test(a))return!1;try{const[t]=a.split("."),s=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),n=JSON.parse(atob(s));return!(typeof n!="object"||n===null||!n.typ||!n.alg||e&&n.alg!==e)}catch{return!1}}function Rt(a,e){return!!((e==="v4"||!e)&&Nt.test(a)||(e==="v6"||!e)&&Ot.test(a))}class C extends v{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==h.string){const n=this._getOrReturnCtx(e);return l(n,{code:d.invalid_type,expected:h.string,received:n.parsedType}),y}const t=new S;let s;for(const n of this._def.checks)if(n.kind==="min")e.data.length<n.value&&(s=this._getOrReturnCtx(e,s),l(s,{code:d.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),t.dirty());else if(n.kind==="max")e.data.length>n.value&&(s=this._getOrReturnCtx(e,s),l(s,{code:d.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?l(s,{code:d.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):i&&l(s,{code:d.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),t.dirty())}else if(n.kind==="email")Zt.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"email",code:d.invalid_string,message:n.message}),t.dirty());else if(n.kind==="emoji")je||(je=new RegExp(St,"u")),je.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"emoji",code:d.invalid_string,message:n.message}),t.dirty());else if(n.kind==="uuid")bt.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"uuid",code:d.invalid_string,message:n.message}),t.dirty());else if(n.kind==="nanoid")wt.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"nanoid",code:d.invalid_string,message:n.message}),t.dirty());else if(n.kind==="cuid")gt.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"cuid",code:d.invalid_string,message:n.message}),t.dirty());else if(n.kind==="cuid2")_t.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"cuid2",code:d.invalid_string,message:n.message}),t.dirty());else if(n.kind==="ulid")vt.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"ulid",code:d.invalid_string,message:n.message}),t.dirty());else if(n.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),l(s,{validation:"url",code:d.invalid_string,message:n.message}),t.dirty()}else n.kind==="regex"?(n.regex.lastIndex=0,n.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"regex",code:d.invalid_string,message:n.message}),t.dirty())):n.kind==="trim"?e.data=e.data.trim():n.kind==="includes"?e.data.includes(n.value,n.position)||(s=this._getOrReturnCtx(e,s),l(s,{code:d.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),t.dirty()):n.kind==="toLowerCase"?e.data=e.data.toLowerCase():n.kind==="toUpperCase"?e.data=e.data.toUpperCase():n.kind==="startsWith"?e.data.startsWith(n.value)||(s=this._getOrReturnCtx(e,s),l(s,{code:d.invalid_string,validation:{startsWith:n.value},message:n.message}),t.dirty()):n.kind==="endsWith"?e.data.endsWith(n.value)||(s=this._getOrReturnCtx(e,s),l(s,{code:d.invalid_string,validation:{endsWith:n.value},message:n.message}),t.dirty()):n.kind==="datetime"?Xe(n).test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{code:d.invalid_string,validation:"datetime",message:n.message}),t.dirty()):n.kind==="date"?It.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{code:d.invalid_string,validation:"date",message:n.message}),t.dirty()):n.kind==="time"?jt(n).test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{code:d.invalid_string,validation:"time",message:n.message}),t.dirty()):n.kind==="duration"?xt.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"duration",code:d.invalid_string,message:n.message}),t.dirty()):n.kind==="ip"?$t(e.data,n.version)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"ip",code:d.invalid_string,message:n.message}),t.dirty()):n.kind==="jwt"?Pt(e.data,n.alg)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"jwt",code:d.invalid_string,message:n.message}),t.dirty()):n.kind==="cidr"?Rt(e.data,n.version)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"cidr",code:d.invalid_string,message:n.message}),t.dirty()):n.kind==="base64"?At.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"base64",code:d.invalid_string,message:n.message}),t.dirty()):n.kind==="base64url"?Et.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"base64url",code:d.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:d.invalid_string,...p.errToObj(s)})}_addCheck(e){return new C({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...p.errToObj(e)})}url(e){return this._addCheck({kind:"url",...p.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...p.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...p.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...p.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...p.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...p.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...p.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...p.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...p.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...p.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...p.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...p.errToObj(e)})}datetime(e){var t,s;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(t=e==null?void 0:e.offset)!==null&&t!==void 0?t:!1,local:(s=e==null?void 0:e.local)!==null&&s!==void 0?s:!1,...p.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...p.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...p.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...p.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...p.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...p.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...p.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...p.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...p.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...p.errToObj(t)})}nonempty(e){return this.min(1,p.errToObj(e))}trim(){return new C({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new C({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new C({...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}}C.create=a=>{var e;return new C({checks:[],typeName:m.ZodString,coerce:(e=a==null?void 0:a.coerce)!==null&&e!==void 0?e:!1,...g(a)})};function Mt(a,e){const t=(a.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,n=t>s?t:s,r=parseInt(a.toFixed(n).replace(".","")),i=parseInt(e.toFixed(n).replace(".",""));return r%i/Math.pow(10,n)}let Q=class Me 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)!==h.number){const n=this._getOrReturnCtx(e);return l(n,{code:d.invalid_type,expected:h.number,received:n.parsedType}),y}let t;const s=new S;for(const n of this._def.checks)n.kind==="int"?b.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),l(t,{code:d.invalid_type,expected:"integer",received:"float",message:n.message}),s.dirty()):n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),l(t,{code:d.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),s.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),l(t,{code:d.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),s.dirty()):n.kind==="multipleOf"?Mt(e.data,n.value)!==0&&(t=this._getOrReturnCtx(e,t),l(t,{code:d.not_multiple_of,multipleOf:n.value,message:n.message}),s.dirty()):n.kind==="finite"?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),l(t,{code:d.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 Me({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:p.toString(n)}]})}_addCheck(e){return new Me({...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)}};Q.create=a=>new Q({checks:[],typeName:m.ZodNumber,coerce:(a==null?void 0:a.coerce)||!1,...g(a)});let ee=class Fe 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)!==h.bigint)return this._getInvalidInput(e);let t;const s=new S;for(const n of this._def.checks)n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),l(t,{code:d.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),s.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),l(t,{code:d.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),s.dirty()):n.kind==="multipleOf"?e.data%n.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),l(t,{code:d.not_multiple_of,multipleOf:n.value,message:n.message}),s.dirty()):b.assertNever(n);return{status:s.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return l(t,{code:d.invalid_type,expected:h.bigint,received:t.parsedType}),y}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 Fe({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:p.toString(n)}]})}_addCheck(e){return new Fe({...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}};ee.create=a=>{var e;return new ee({checks:[],typeName:m.ZodBigInt,coerce:(e=a==null?void 0:a.coerce)!==null&&e!==void 0?e:!1,...g(a)})};class te extends v{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==h.boolean){const t=this._getOrReturnCtx(e);return l(t,{code:d.invalid_type,expected:h.boolean,received:t.parsedType}),y}return x(e.data)}}te.create=a=>new te({typeName:m.ZodBoolean,coerce:(a==null?void 0:a.coerce)||!1,...g(a)});class z extends v{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==h.date){const n=this._getOrReturnCtx(e);return l(n,{code:d.invalid_type,expected:h.date,received:n.parsedType}),y}if(isNaN(e.data.getTime())){const n=this._getOrReturnCtx(e);return l(n,{code:d.invalid_date}),y}const t=new S;let s;for(const n of this._def.checks)n.kind==="min"?e.data.getTime()<n.value&&(s=this._getOrReturnCtx(e,s),l(s,{code:d.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),t.dirty()):n.kind==="max"?e.data.getTime()>n.value&&(s=this._getOrReturnCtx(e,s),l(s,{code:d.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 z({...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}}z.create=a=>new z({checks:[],coerce:(a==null?void 0:a.coerce)||!1,typeName:m.ZodDate,...g(a)});class Se extends v{_parse(e){if(this._getType(e)!==h.symbol){const t=this._getOrReturnCtx(e);return l(t,{code:d.invalid_type,expected:h.symbol,received:t.parsedType}),y}return x(e.data)}}Se.create=a=>new Se({typeName:m.ZodSymbol,...g(a)});class se extends v{_parse(e){if(this._getType(e)!==h.undefined){const t=this._getOrReturnCtx(e);return l(t,{code:d.invalid_type,expected:h.undefined,received:t.parsedType}),y}return x(e.data)}}se.create=a=>new se({typeName:m.ZodUndefined,...g(a)});class ae extends v{_parse(e){if(this._getType(e)!==h.null){const t=this._getOrReturnCtx(e);return l(t,{code:d.invalid_type,expected:h.null,received:t.parsedType}),y}return x(e.data)}}ae.create=a=>new ae({typeName:m.ZodNull,...g(a)});let K=class extends v{constructor(){super(...arguments),this._any=!0}_parse(e){return x(e.data)}};K.create=a=>new K({typeName:m.ZodAny,...g(a)});class D extends v{constructor(){super(...arguments),this._unknown=!0}_parse(e){return x(e.data)}}D.create=a=>new D({typeName:m.ZodUnknown,...g(a)});class $ extends v{_parse(e){const t=this._getOrReturnCtx(e);return l(t,{code:d.invalid_type,expected:h.never,received:t.parsedType}),y}}$.create=a=>new $({typeName:m.ZodNever,...g(a)});class Te extends v{_parse(e){if(this._getType(e)!==h.undefined){const t=this._getOrReturnCtx(e);return l(t,{code:d.invalid_type,expected:h.void,received:t.parsedType}),y}return x(e.data)}}Te.create=a=>new Te({typeName:m.ZodVoid,...g(a)});let V=class ve extends v{_parse(e){const{ctx:t,status:s}=this._processInputParams(e),n=this._def;if(t.parsedType!==h.array)return l(t,{code:d.invalid_type,expected:h.array,received:t.parsedType}),y;if(n.exactLength!==null){const i=t.data.length>n.exactLength.value,o=t.data.length<n.exactLength.value;(i||o)&&(l(t,{code:i?d.too_big:d.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&&(l(t,{code:d.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),s.dirty()),n.maxLength!==null&&t.data.length>n.maxLength.value&&(l(t,{code:d.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 I(t,i,t.path,o)))).then(i=>S.mergeArray(s,i));const r=[...t.data].map((i,o)=>n.type._parseSync(new I(t,i,t.path,o)));return S.mergeArray(s,r)}get element(){return this._def.type}min(e,t){return new ve({...this._def,minLength:{value:e,message:p.toString(t)}})}max(e,t){return new ve({...this._def,maxLength:{value:e,message:p.toString(t)}})}length(e,t){return new ve({...this._def,exactLength:{value:e,message:p.toString(t)}})}nonempty(e){return this.min(1,e)}};V.create=(a,e)=>new V({type:a,minLength:null,maxLength:null,exactLength:null,typeName:m.ZodArray,...g(e)});function U(a){if(a instanceof T){const e={};for(const t in a.shape){const s=a.shape[t];e[t]=E.create(U(s))}return new T({...a._def,shape:()=>e})}else return a instanceof V?new V({...a._def,type:U(a.element)}):a instanceof E?E.create(U(a.unwrap())):a instanceof M?M.create(U(a.unwrap())):a instanceof R?R.create(a.items.map(e=>U(e))):a}let T=class N 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}}_parse(e){if(this._getType(e)!==h.object){const c=this._getOrReturnCtx(e);return l(c,{code:d.invalid_type,expected:h.object,received:c.parsedType}),y}const{status:t,ctx:s}=this._processInputParams(e),{shape:n,keys:r}=this._getCached(),i=[];if(!(this._def.catchall instanceof $&&this._def.unknownKeys==="strip"))for(const c in s.data)r.includes(c)||i.push(c);const o=[];for(const c of r){const u=n[c],f=s.data[c];o.push({key:{status:"valid",value:c},value:u._parse(new I(s,f,s.path,c)),alwaysSet:c in s.data})}if(this._def.catchall instanceof $){const c=this._def.unknownKeys;if(c==="passthrough")for(const u of i)o.push({key:{status:"valid",value:u},value:{status:"valid",value:s.data[u]}});else if(c==="strict")i.length>0&&(l(s,{code:d.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 u of i){const f=s.data[u];o.push({key:{status:"valid",value:u},value:c._parse(new I(s,f,s.path,u)),alwaysSet:u in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const c=[];for(const u of o){const f=await u.key,w=await u.value;c.push({key:f,value:w,alwaysSet:u.alwaysSet})}return c}).then(c=>S.mergeObjectSync(t,c)):S.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return p.errToObj,new N({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{var n,r,i,o;const c=(i=(r=(n=this._def).errorMap)===null||r===void 0?void 0:r.call(n,t,s).message)!==null&&i!==void 0?i:s.defaultError;return t.code==="unrecognized_keys"?{message:(o=p.errToObj(e).message)!==null&&o!==void 0?o:c}:{message:c}}}:{}})}strip(){return new N({...this._def,unknownKeys:"strip"})}passthrough(){return new N({...this._def,unknownKeys:"passthrough"})}extend(e){return new N({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new N({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 N({...this._def,catchall:e})}pick(e){const t={};return b.objectKeys(e).forEach(s=>{e[s]&&this.shape[s]&&(t[s]=this.shape[s])}),new N({...this._def,shape:()=>t})}omit(e){const t={};return b.objectKeys(this.shape).forEach(s=>{e[s]||(t[s]=this.shape[s])}),new N({...this._def,shape:()=>t})}deepPartial(){return U(this)}partial(e){const t={};return b.objectKeys(this.shape).forEach(s=>{const n=this.shape[s];e&&!e[s]?t[s]=n:t[s]=n.optional()}),new N({...this._def,shape:()=>t})}required(e){const t={};return b.objectKeys(this.shape).forEach(s=>{if(e&&!e[s])t[s]=this.shape[s];else{let n=this.shape[s];for(;n instanceof E;)n=n._def.innerType;t[s]=n}}),new N({...this._def,shape:()=>t})}keyof(){return tt(b.objectKeys(this.shape))}};T.create=(a,e)=>new T({shape:()=>a,unknownKeys:"strip",catchall:$.create(),typeName:m.ZodObject,...g(e)});T.strictCreate=(a,e)=>new T({shape:()=>a,unknownKeys:"strict",catchall:$.create(),typeName:m.ZodObject,...g(e)});T.lazycreate=(a,e)=>new T({shape:a,unknownKeys:"strip",catchall:$.create(),typeName:m.ZodObject,...g(e)});class ne 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 l(t,{code:d.invalid_union,unionErrors:i}),y}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 u={...t,common:{...t.common,issues:[]},parent:null},f=c._parseSync({data:t.data,path:t.path,parent:u});if(f.status==="valid")return f;f.status==="dirty"&&!r&&(r={result:f,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(r)return t.common.issues.push(...r.ctx.common.issues),r.result;const o=i.map(c=>new O(c));return l(t,{code:d.invalid_union,unionErrors:o}),y}}get options(){return this._def.options}}ne.create=(a,e)=>new ne({options:a,typeName:m.ZodUnion,...g(e)});const P=a=>a instanceof oe?P(a.schema):a instanceof A?P(a.innerType()):a instanceof ce?[a.value]:a instanceof pe?a.options:a instanceof de?b.objectValues(a.enum):a instanceof ue?P(a._def.innerType):a instanceof se?[void 0]:a instanceof ae?[null]:a instanceof E?[void 0,...P(a.unwrap())]:a instanceof M?[null,...P(a.unwrap())]:a instanceof ze||a instanceof he?P(a.unwrap()):a instanceof le?P(a._def.innerType):[];class Ae extends v{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==h.object)return l(t,{code:d.invalid_type,expected:h.object,received:t.parsedType}),y;const s=this.discriminator,n=t.data[s],r=this.optionsMap.get(n);return r?t.common.async?r._parseAsync({data:t.data,path:t.path,parent:t}):r._parseSync({data:t.data,path:t.path,parent:t}):(l(t,{code:d.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),y)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){const n=new Map;for(const r of t){const i=P(r.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of i){if(n.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);n.set(o,r)}}return new Ae({typeName:m.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...g(s)})}}function Le(a,e){const t=j(a),s=j(e);if(a===e)return{valid:!0,data:a};if(t===h.object&&s===h.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=Le(a[o],e[o]);if(!c.valid)return{valid:!1};i[o]=c.data}return{valid:!0,data:i}}else if(t===h.array&&s===h.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=Le(i,o);if(!c.valid)return{valid:!1};n.push(c.data)}return{valid:!0,data:n}}else return t===h.date&&s===h.date&&+a==+e?{valid:!0,data:a}:{valid:!1}}class ie extends v{_parse(e){const{status:t,ctx:s}=this._processInputParams(e),n=(r,i)=>{if(Pe(r)||Pe(i))return y;const o=Le(r.value,i.value);return o.valid?((Re(r)||Re(i))&&t.dirty(),{status:t.value,value:o.data}):(l(s,{code:d.invalid_intersection_types}),y)};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}))}}ie.create=(a,e,t)=>new ie({left:a,right:e,typeName:m.ZodIntersection,...g(t)});let R=class Qe extends v{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==h.array)return l(s,{code:d.invalid_type,expected:h.array,received:s.parsedType}),y;if(s.data.length<this._def.items.length)return l(s,{code:d.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),y;!this._def.rest&&s.data.length>this._def.items.length&&(l(s,{code:d.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 I(s,r,s.path,i)):null}).filter(r=>!!r);return s.common.async?Promise.all(n).then(r=>S.mergeArray(t,r)):S.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new Qe({...this._def,rest:e})}};R.create=(a,e)=>{if(!Array.isArray(a))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new R({items:a,typeName:m.ZodTuple,rest:null,...g(e)})};class re 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!==h.object)return l(s,{code:d.invalid_type,expected:h.object,received:s.parsedType}),y;const n=[],r=this._def.keyType,i=this._def.valueType;for(const o in s.data)n.push({key:r._parse(new I(s,o,s.path,o)),value:i._parse(new I(s,s.data[o],s.path,o)),alwaysSet:o in s.data});return s.common.async?S.mergeObjectAsync(t,n):S.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof v?new re({keyType:e,valueType:t,typeName:m.ZodRecord,...g(s)}):new re({keyType:C.create(),valueType:e,typeName:m.ZodRecord,...g(t)})}}class Ne 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!==h.map)return l(s,{code:d.invalid_type,expected:h.map,received:s.parsedType}),y;const n=this._def.keyType,r=this._def.valueType,i=[...s.data.entries()].map(([o,c],u)=>({key:n._parse(new I(s,o,s.path,[u,"key"])),value:r._parse(new I(s,c,s.path,[u,"value"]))}));if(s.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const c of i){const u=await c.key,f=await c.value;if(u.status==="aborted"||f.status==="aborted")return y;(u.status==="dirty"||f.status==="dirty")&&t.dirty(),o.set(u.value,f.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const c of i){const u=c.key,f=c.value;if(u.status==="aborted"||f.status==="aborted")return y;(u.status==="dirty"||f.status==="dirty")&&t.dirty(),o.set(u.value,f.value)}return{status:t.value,value:o}}}}Ne.create=(a,e,t)=>new Ne({valueType:e,keyType:a,typeName:m.ZodMap,...g(t)});let Ce=class De extends v{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==h.set)return l(s,{code:d.invalid_type,expected:h.set,received:s.parsedType}),y;const n=this._def;n.minSize!==null&&s.data.size<n.minSize.value&&(l(s,{code:d.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),n.maxSize!==null&&s.data.size>n.maxSize.value&&(l(s,{code:d.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 u=new Set;for(const f of c){if(f.status==="aborted")return y;f.status==="dirty"&&t.dirty(),u.add(f.value)}return{status:t.value,value:u}}const o=[...s.data.values()].map((c,u)=>r._parse(new I(s,c,s.path,u)));return s.common.async?Promise.all(o).then(c=>i(c)):i(o)}min(e,t){return new De({...this._def,minSize:{value:e,message:p.toString(t)}})}max(e,t){return new De({...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)}};Ce.create=(a,e)=>new Ce({valueType:a,minSize:null,maxSize:null,typeName:m.ZodSet,...g(e)});let et=class be extends v{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==h.function)return l(t,{code:d.invalid_type,expected:h.function,received:t.parsedType}),y;function s(o,c){return ke({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,we(),H].filter(u=>!!u),issueData:{code:d.invalid_arguments,argumentsError:c}})}function n(o,c){return ke({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,we(),H].filter(u=>!!u),issueData:{code:d.invalid_return_type,returnTypeError:c}})}const r={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof W){const o=this;return x(async function(...c){const u=new O([]),f=await o._def.args.parseAsync(c,r).catch(Z=>{throw u.addIssue(s(c,Z)),u}),w=await Reflect.apply(i,this,f);return await o._def.returns._def.type.parseAsync(w,r).catch(Z=>{throw u.addIssue(n(w,Z)),u})})}else{const o=this;return x(function(...c){const u=o._def.args.safeParse(c,r);if(!u.success)throw new O([s(c,u.error)]);const f=Reflect.apply(i,this,u.data),w=o._def.returns.safeParse(f,r);if(!w.success)throw new O([n(f,w.error)]);return w.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new be({...this._def,args:R.create(e).rest(D.create())})}returns(e){return new be({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,s){return new be({args:e||R.create([]).rest(D.create()),returns:t||D.create(),typeName:m.ZodFunction,...g(s)})}};class oe 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})}}oe.create=(a,e)=>new oe({getter:a,typeName:m.ZodLazy,...g(e)});class ce extends v{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return l(t,{received:t.data,code:d.invalid_literal,expected:this._def.value}),y}return{status:"valid",value:e.data}}get value(){return this._def.value}}ce.create=(a,e)=>new ce({value:a,typeName:m.ZodLiteral,...g(e)});function tt(a,e){return new pe({values:a,typeName:m.ZodEnum,...g(e)})}let pe=class qe extends v{constructor(){super(...arguments),J.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),s=this._def.values;return l(t,{expected:b.joinValues(s),received:t.parsedType,code:d.invalid_type}),y}if(Ze(this,J)||Je(this,J,new Set(this._def.values)),!Ze(this,J).has(e.data)){const t=this._getOrReturnCtx(e),s=this._def.values;return l(t,{received:t.data,code:d.invalid_enum_value,options:s}),y}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 qe.create(e,{...this._def,...t})}exclude(e,t=this._def){return qe.create(this.options.filter(s=>!e.includes(s)),{...this._def,...t})}};J=new WeakMap;pe.create=tt;class de extends v{constructor(){super(...arguments),Y.set(this,void 0)}_parse(e){const t=b.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==h.string&&s.parsedType!==h.number){const n=b.objectValues(t);return l(s,{expected:b.joinValues(n),received:s.parsedType,code:d.invalid_type}),y}if(Ze(this,Y)||Je(this,Y,new Set(b.getValidEnumValues(this._def.values))),!Ze(this,Y).has(e.data)){const n=b.objectValues(t);return l(s,{received:s.data,code:d.invalid_enum_value,options:n}),y}return x(e.data)}get enum(){return this._def.values}}Y=new WeakMap;de.create=(a,e)=>new de({values:a,typeName:m.ZodNativeEnum,...g(e)});class W extends v{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==h.promise&&t.common.async===!1)return l(t,{code:d.invalid_type,expected:h.promise,received:t.parsedType}),y;const s=t.parsedType===h.promise?t.data:Promise.resolve(t.data);return x(s.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}}W.create=(a,e)=>new W({type:a,typeName:m.ZodPromise,...g(e)});let A=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=>{l(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 y;const c=await this._def.schema._parseAsync({data:o,path:s.path,parent:s});return c.status==="aborted"?y:c.status==="dirty"||t.value==="dirty"?xe(c.value):c});{if(t.value==="aborted")return y;const o=this._def.schema._parseSync({data:i,path:s.path,parent:s});return o.status==="aborted"?y:o.status==="dirty"||t.value==="dirty"?xe(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"?y:(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"?y:(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(!q(i))return i;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=>q(i)?Promise.resolve(n.transform(i.value,r)).then(o=>({status:t.value,value:o})):i);b.assertNever(n)}};A.create=(a,e,t)=>new A({schema:a,typeName:m.ZodEffects,effect:e,...g(t)});A.createWithPreprocess=(a,e,t)=>new A({schema:e,effect:{type:"preprocess",transform:a},typeName:m.ZodEffects,...g(t)});let E=class extends v{_parse(e){return this._getType(e)===h.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,...g(e)});let M=class extends v{_parse(e){return this._getType(e)===h.null?x(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};M.create=(a,e)=>new M({innerType:a,typeName:m.ZodNullable,...g(e)});class ue extends v{_parse(e){const{ctx:t}=this._processInputParams(e);let s=t.data;return t.parsedType===h.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}ue.create=(a,e)=>new ue({innerType:a,typeName:m.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...g(e)});class le 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 X(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}}le.create=(a,e)=>new le({innerType:a,typeName:m.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...g(e)});class Oe extends v{_parse(e){if(this._getType(e)!==h.nan){const t=this._getOrReturnCtx(e);return l(t,{code:d.invalid_type,expected:h.nan,received:t.parsedType}),y}return{status:"valid",value:e.data}}}Oe.create=a=>new Oe({typeName:m.ZodNaN,...g(a)});const Ft=Symbol("zod_brand");class ze 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 fe 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"?y:n.status==="dirty"?(t.dirty(),xe(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"?y:n.status==="dirty"?(t.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:s.path,parent:s})}}static create(e,t){return new fe({in:e,out:t,typeName:m.ZodPipeline})}}class he extends v{_parse(e){const t=this._def.innerType._parse(e),s=n=>(q(n)&&(n.value=Object.freeze(n.value)),n);return X(t)?t.then(n=>s(n)):s(t)}unwrap(){return this._def.innerType}}he.create=(a,e)=>new he({innerType:a,typeName:m.ZodReadonly,...g(e)});function Be(a,e){const t=typeof a=="function"?a(e):typeof a=="string"?{message:a}:a;return typeof t=="string"?{message:t}:t}function st(a,e={},t){return a?K.create().superRefine((s,n)=>{var r,i;const o=a(s);if(o instanceof Promise)return o.then(c=>{var u,f;if(!c){const w=Be(e,s),Z=(f=(u=w.fatal)!==null&&u!==void 0?u:t)!==null&&f!==void 0?f:!0;n.addIssue({code:"custom",...w,fatal:Z})}});if(!o){const c=Be(e,s),u=(i=(r=c.fatal)!==null&&r!==void 0?r:t)!==null&&i!==void 0?i:!0;n.addIssue({code:"custom",...c,fatal:u})}}):K.create()}const Lt={object:T.lazycreate};var m;(function(a){a.ZodString="ZodString",a.ZodNumber="ZodNumber",a.ZodNaN="ZodNaN",a.ZodBigInt="ZodBigInt",a.ZodBoolean="ZodBoolean",a.ZodDate="ZodDate",a.ZodSymbol="ZodSymbol",a.ZodUndefined="ZodUndefined",a.ZodNull="ZodNull",a.ZodAny="ZodAny",a.ZodUnknown="ZodUnknown",a.ZodNever="ZodNever",a.ZodVoid="ZodVoid",a.ZodArray="ZodArray",a.ZodObject="ZodObject",a.ZodUnion="ZodUnion",a.ZodDiscriminatedUnion="ZodDiscriminatedUnion",a.ZodIntersection="ZodIntersection",a.ZodTuple="ZodTuple",a.ZodRecord="ZodRecord",a.ZodMap="ZodMap",a.ZodSet="ZodSet",a.ZodFunction="ZodFunction",a.ZodLazy="ZodLazy",a.ZodLiteral="ZodLiteral",a.ZodEnum="ZodEnum",a.ZodEffects="ZodEffects",a.ZodNativeEnum="ZodNativeEnum",a.ZodOptional="ZodOptional",a.ZodNullable="ZodNullable",a.ZodDefault="ZodDefault",a.ZodCatch="ZodCatch",a.ZodPromise="ZodPromise",a.ZodBranded="ZodBranded",a.ZodPipeline="ZodPipeline",a.ZodReadonly="ZodReadonly"})(m||(m={}));const Dt=(a,e={message:`Input not instance of ${a.name}`})=>st(t=>t instanceof a,e),at=C.create,nt=Q.create,qt=Oe.create,zt=ee.create,it=te.create,Vt=z.create,Bt=Se.create,Ut=se.create,Ht=ae.create,Kt=K.create,Wt=D.create,Jt=$.create,Yt=Te.create,Gt=V.create,Xt=T.create,Qt=T.strictCreate,es=ne.create,ts=Ae.create,ss=ie.create,as=R.create,ns=re.create,is=Ne.create,rs=Ce.create,os=et.create,cs=oe.create,ds=ce.create,us=pe.create,ls=de.create,hs=W.create,Ue=A.create,ps=E.create,fs=M.create,ms=A.createWithPreprocess,ys=fe.create,gs=()=>at().optional(),_s=()=>nt().optional(),vs=()=>it().optional(),bs={string:a=>C.create({...a,coerce:!0}),number:a=>Q.create({...a,coerce:!0}),boolean:a=>te.create({...a,coerce:!0}),bigint:a=>ee.create({...a,coerce:!0}),date:a=>z.create({...a,coerce:!0})},ws=y;var me=Object.freeze({__proto__:null,defaultErrorMap:H,setErrorMap:mt,getErrorMap:we,makeIssue:ke,EMPTY_PATH:yt,addIssueToContext:l,ParseStatus:S,INVALID:y,DIRTY:xe,OK:x,isAborted:Pe,isDirty:Re,isValid:q,isAsync:X,get util(){return b},get objectUtil(){return $e},ZodParsedType:h,getParsedType:j,ZodType:v,datetimeRegex:Xe,ZodString:C,ZodNumber:Q,ZodBigInt:ee,ZodBoolean:te,ZodDate:z,ZodSymbol:Se,ZodUndefined:se,ZodNull:ae,ZodAny:K,ZodUnknown:D,ZodNever:$,ZodVoid:Te,ZodArray:V,ZodObject:T,ZodUnion:ne,ZodDiscriminatedUnion:Ae,ZodIntersection:ie,ZodTuple:R,ZodRecord:re,ZodMap:Ne,ZodSet:Ce,ZodFunction:et,ZodLazy:oe,ZodLiteral:ce,ZodEnum:pe,ZodNativeEnum:de,ZodPromise:W,ZodEffects:A,ZodTransformer:A,ZodOptional:E,ZodNullable:M,ZodDefault:ue,ZodCatch:le,ZodNaN:Oe,BRAND:Ft,ZodBranded:ze,ZodPipeline:fe,ZodReadonly:he,custom:st,Schema:v,ZodSchema:v,late:Lt,get ZodFirstPartyTypeKind(){return m},coerce:bs,any:Kt,array:Gt,bigint:zt,boolean:it,date:Vt,discriminatedUnion:ts,effect:Ue,enum:us,function:os,instanceof:Dt,intersection:ss,lazy:cs,literal:ds,map:is,nan:qt,nativeEnum:ls,never:Jt,null:Ht,nullable:fs,number:nt,object:Xt,oboolean:vs,onumber:_s,optional:ps,ostring:gs,pipeline:ys,preprocess:ms,promise:hs,record:ns,set:rs,strictObject:Qt,string:at,symbol:Bt,transformer:Ue,tuple:as,undefined:Ut,union:es,unknown:Wt,void:Yt,NEVER:ws,ZodIssueCode:d,quotelessJson:ft,ZodError:O});const ks="1.5.0",xs={version:ks};class rt{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 ot{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})}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 ct{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}}function Zs(a,e=console.error){a().catch(e)}class Ss{constructor(e){this._client=e}async getColorScheme(){return(await this._client.request("environment.getColorScheme",{})).colorScheme}subscribeColorScheme(e){Zs(async()=>{this._client.on("environment.colorSchemeChanged",e),e(await this.getColorScheme())})}unsubscribeColorScheme(e){this._client.off("environment.colorSchemeChanged",e)}}class dt{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}}class ut{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((f,w)=>{r[w]=f}):Array.isArray(t.headers)?t.headers.forEach(([f,w])=>{r[f]=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 u=null;if(i.body!==null&&i.body!==void 0)if(i.bodyType==="binary"){const f=atob(i.body),w=new Uint8Array(f.length);for(let Z=0;Z<f.length;Z++)w[Z]=f.charCodeAt(Z);u=w}else i.bodyType==="text"?u=i.body:i.bodyType==="json"&&(u=JSON.stringify(i.body));return new Response(u,c)}}class lt{constructor(e){this._client=e}get application(){return new ye("application","",this._client)}get instance(){return new ye("instance",this._client.applicationInstance,this._client)}get device(){return new ye("device",this._client.applicationInstance,this._client)}shared(e){return new ye("shared",e,this._client)}}class ye{constructor(e,t,s){this._kind=e,this._namespace=t,this._client=s}async set(e,t){return(await this._client.request("store.set",{kind:this._kind,namespace:this._namespace,key:e,value:t})).success}async get(e){return(await this._client.request("store.get",{kind:this._kind,namespace:this._namespace,key:e})).value}async subscribe(e,t){return(await this._client.subscribe("store.subscribe",{kind:this._kind,namespace:this._namespace,key:e},t)).success}async unsubscribe(e,t){return(await this._client.unsubscribe("store.unsubscribe",{kind:this._kind,namespace:this._namespace,key:e},t)).success}async delete(e){return(await this._client.request("store.delete",{kind:this._kind,namespace:this._namespace,key:e})).success}}class ht{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 pt{constructor(e){this._client=e}async getConditions(e){const t=await this._client.request("weather.getConditions",e);if(!t.success||!t.conditions)throw new Error(t.error||"Failed to fetch weather conditions");return t.conditions}async getDailyForecast(e){const t=await this._client.request("weather.getDailyForecast",e);if(!t.success||!t.forecast)throw new Error(t.error||"Failed to fetch daily forecast");return t.forecast}async getHourlyForecast(e){const t=await this._client.request("weather.getHourlyForecast",e);if(!t.success||!t.forecast)throw new Error(t.error||"Failed to fetch hourly forecast");return t.forecast}}function ge(a){return{...a,type:"client"}}const Ts=me.object({type:me.literal("bridge"),name:me.string(),data:me.any()});class Ns{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 B=1e3*30;class Cs{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 rt(this)}get users(){return new ht(this)}get store(){return new lt(this)}get applications(){return new ot(this)}get media(){return new dt(this)}get proxy(){return new ut(this)}get devices(){return new ct(this)}get rootSettingsNavigation(){return new Ns(this.store)}get weather(){return new pt(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(window.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===window||!i.data||!("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){window.parent.postMessage(i.data,"*");return}o={...c(i.data.data),type:"bridge"}}if(!o){const c=Ts.safeParse(i.data);if(!c.success)return;o=c.data;const u=this._onHandlers.get(o.name),f=this._onceHandlers.get(o.name);if(u)for(const w of u)w(o.data);if(f){for(const w of f)w(o.data);this._onceHandlers.delete(o.name)}}for(let c=0;c<window.frames.length;c+=1)window.frames[c].postMessage(o,"*")},window.addEventListener("message",this._windowMessageHandler)}unbind(){this._windowMessageHandler&&window.removeEventListener("message",this._windowMessageHandler)}send(e,t){const s=ge({telemetrySdkVersion:G,applicationName:this._applicationName,applicationSpecifier:this._applicationSpecifier,applicationInstance:this._applicationInstance,name:e,data:t});window.parent.postMessage(s,"*")}request(e,t){const s=_e(),n=ge({telemetrySdkVersion:G,applicationName:this._applicationName,applicationSpecifier:this._applicationSpecifier,applicationInstance:this._applicationInstance,name:e,data:t,responseName:s});window.parent.postMessage(n,"*");let r=!1,i;const o=new Promise((u,f)=>{const w=new Error(`${e} message request with response name of ${s} timed out after ${B}`);setTimeout(()=>{r=!0,this.off(s,i),f(w)},B)}),c=new Promise(u=>{i=f=>{r||u(f)},this.once(s,u)});return Promise.race([o,c])}async subscribe(e,t,s){let n,r;typeof t=="function"?r=t:(n=t,r=s);const i=_e(),o=_e();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 u=ge({telemetrySdkVersion:G,applicationName:this._applicationName,applicationSpecifier:this._applicationSpecifier,applicationInstance:this._applicationInstance,name:e,data:n,responseName:o,subscriptionName:i});window.parent.postMessage(u,"*");let f=!1,w;const Z=new Promise((F,L)=>{const Ie=new Error(`${e} subscribe request with subscription name of ${i} and response name of ${o} timed out after ${B}`);setTimeout(()=>{f=!0,this.off(o,w),L(Ie)},B)}),Ee=new Promise(F=>{w=L=>{f||F(L)},this.on(o,F)});return Promise.race([Z,Ee])}async unsubscribe(e,t,s){let n,r;typeof t=="function"?r=t:(n=t,r=s);const i=_e();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 u=ge({telemetrySdkVersion:G,applicationInstance:this._applicationInstance,applicationName:this._applicationName,applicationSpecifier:this._applicationSpecifier,name:e,data:n,responseName:i,unsubscribeName:c});window.parent.postMessage(u,"*");let f=!1,w;const Z=new Promise((F,L)=>{const Ie=new Error(`${e} unsubscribe request with unsubscribe name of ${c} and response name of ${i} timed out after ${B}`);setTimeout(()=>{f=!0,this.off(i,w),L(Ie)},B)}),Ee=new Promise(F=>{w=L=>{f||F(L)},this.once(i,F)});if(!(await Promise.race([Z,Ee])).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 _e(){return Math.random().toString(36).slice(2,9)}const G=xs.version;class Os{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 As{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 Es extends Cs{get playlist(){return new As(this)}get overrides(){return new Os(this)}}let _=null;function Is(){return _}function js(a){_=new Es(a),_.bind()}function $s(){_==null||_.unbind(),_=null}function Ps(...a){return k(_),_.on(...a)}function Rs(...a){return k(_),_.once(...a)}function Ms(...a){return k(_),_.off(...a)}function Fs(...a){return k(_),_.send(...a)}function Ls(...a){return k(_),_.request(...a)}function Ds(...a){return k(_),_.subscribe(...a)}function qs(...a){return k(_),_.unsubscribe(...a)}function zs(){return k(_),_.accounts}function Vs(){return k(_),_.users}function Bs(){return k(_),_.store}function Us(){return k(_),_.applications}function Hs(){return k(_),_.media}function Ks(){return k(_),_.proxy}function Ws(){return k(_),_.devices}function Js(){return k(_),_.weather}function Ys(){return k(_),_.playlist}function Gs(){return k(_),_.overrides}function k(a){if(!a)throw new Error("SDK is not configured")}exports.Accounts=rt;exports.Applications=ot;exports.Devices=ct;exports.Environment=Ss;exports.Media=dt;exports.Proxy=ut;exports.Store=lt;exports.Users=ht;exports.Weather=pt;exports.accounts=zs;exports.applications=Us;exports.configure=js;exports.destroy=$s;exports.devices=Ws;exports.globalClient=Is;exports.media=Hs;exports.off=Ms;exports.on=Ps;exports.once=Rs;exports.overrides=Gs;exports.playlist=Ys;exports.proxy=Ks;exports.request=Ls;exports.send=Fs;exports.store=Bs;exports.subscribe=Ds;exports.telemetrySdkVersion=G;exports.unsubscribe=qs;exports.users=Vs;exports.weather=Js;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var b;(function(a){a.assertEqual=n=>n;function e(n){}a.assertIs=e;function t(n){throw new Error}a.assertNever=t,a.arrayToEnum=n=>{const 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"&&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 $e;(function(a){a.mergeShapes=(e,t)=>({...e,...t})})($e||($e={}));const h=b.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),j=a=>{switch(typeof a){case"undefined":return h.undefined;case"string":return h.string;case"number":return isNaN(a)?h.nan:h.number;case"boolean":return h.boolean;case"function":return h.function;case"bigint":return h.bigint;case"symbol":return h.symbol;case"object":return Array.isArray(a)?h.array:a===null?h.null:a.then&&typeof a.then=="function"&&a.catch&&typeof a.catch=="function"?h.promise:typeof Map<"u"&&a instanceof Map?h.map:typeof Set<"u"&&a instanceof Set?h.set:typeof Date<"u"&&a instanceof Date?h.date:h.object;default:return h.unknown}},d=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"]),mt=a=>JSON.stringify(a,null,2).replace(/"([^"]+)":/g,"$1:");let O=class Ue 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 u=i.path[c];c===i.path.length-1?(o[u]=o[u]||{_errors:[]},o[u]._errors.push(t(i))):o[u]=o[u]||{_errors:[]},o=o[u],c++}}};return n(this),s}static assert(e){if(!(e instanceof Ue))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,b.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},s=[];for(const n of this.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):s.push(e(n));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}};O.create=a=>new O(a);const H=(a,e)=>{let t;switch(a.code){case d.invalid_type:a.received===h.undefined?t="Required":t=`Expected ${a.expected}, received ${a.received}`;break;case d.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(a.expected,b.jsonStringifyReplacer)}`;break;case d.unrecognized_keys:t=`Unrecognized key(s) in object: ${b.joinValues(a.keys,", ")}`;break;case d.invalid_union:t="Invalid input";break;case d.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${b.joinValues(a.options)}`;break;case d.invalid_enum_value:t=`Invalid enum value. Expected ${b.joinValues(a.options)}, received '${a.received}'`;break;case d.invalid_arguments:t="Invalid function arguments";break;case d.invalid_return_type:t="Invalid function return type";break;case d.invalid_date:t="Invalid date";break;case d.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 d.too_small:a.type==="array"?t=`Array must contain ${a.exact?"exactly":a.inclusive?"at least":"more than"} ${a.minimum} element(s)`:a.type==="string"?t=`String must contain ${a.exact?"exactly":a.inclusive?"at least":"over"} ${a.minimum} character(s)`:a.type==="number"?t=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="date"?t=`Date must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(a.minimum))}`:t="Invalid input";break;case d.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 d.custom:t="Invalid input";break;case d.invalid_intersection_types:t="Intersection results could not be merged";break;case d.not_multiple_of:t=`Number must be a multiple of ${a.multipleOf}`;break;case d.not_finite:t="Number must be finite";break;default:t=e.defaultError,b.assertNever(a)}return{message:t}};let He=H;function yt(a){He=a}function ke(){return He}const xe=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(u=>!!u).slice().reverse();for(const u of c)o=u(i,{data:e,defaultError:o}).message;return{...n,path:r,message:o}},gt=[];function l(a,e){const t=ke(),s=xe({issueData:e,data:a.data,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,t,t===H?void 0:H].filter(n=>!!n)});a.common.issues.push(s)}let S=class Ke{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 y;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 Ke.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 y;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 y=Object.freeze({status:"aborted"}),Ze=a=>({status:"dirty",value:a}),x=a=>({status:"valid",value:a}),Pe=a=>a.status==="aborted",Re=a=>a.status==="dirty",q=a=>a.status==="valid",X=a=>typeof Promise<"u"&&a instanceof Promise;function Se(a,e,t,s){if(typeof e=="function"?a!==e||!0:!e.has(a))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(a)}function We(a,e,t,s,n){if(typeof e=="function"?a!==e||!0:!e.has(a))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(a,t),t}var p;(function(a){a.errToObj=e=>typeof e=="string"?{message:e}:e||{},a.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(p||(p={}));var J,Y;class I{constructor(e,t,s,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=n}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const ze=(a,e)=>{if(q(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)=>{var o,c;const{message:u}=a;return r.code==="invalid_enum_value"?{message:u??i.defaultError}:typeof i.data>"u"?{message:(o=u??s)!==null&&o!==void 0?o:i.defaultError}:r.code!=="invalid_type"?{message:i.defaultError}:{message:(c=u??t)!==null&&c!==void 0?c:i.defaultError}},description:n}}class v{get description(){return this._def.description}_getType(e){return j(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:j(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new S,ctx:{common:e.parent.common,data:e.data,parsedType:j(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(X(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){var s;const n={common:{issues:[],async:(s=t==null?void 0:t.async)!==null&&s!==void 0?s:!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:j(e)},r=this._parseSync({data:e,path:n.path,parent:n});return ze(n,r)}"~validate"(e){var t,s;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:j(e)};if(!this["~standard"].async)try{const r=this._parseSync({data:e,path:[],parent:n});return q(r)?{value:r.value}:{issues:n.common.issues}}catch(r){!((s=(t=r==null?void 0:r.message)===null||t===void 0?void 0:t.toLowerCase())===null||s===void 0)&&s.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(r=>q(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:j(e)},n=this._parse({data:e,path:s.path,parent:s}),r=await(X(n)?n:Promise.resolve(n));return ze(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:d.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 A({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 M.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return z.create(this)}promise(){return W.create(this,this._def)}or(e){return ie.create([this,e],this._def)}and(e){return re.create(this,e,this._def)}transform(e){return new A({..._(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 qe({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 _t=/^c[^\s-]{8,}$/i,vt=/^[0-9a-z]+$/,bt=/^[0-9A-HJKMNP-TV-Z]{26}$/i,wt=/^[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,kt=/^[a-z0-9_-]{21}$/i,xt=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Zt=/^[-+]?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)?)??$/,St=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Tt="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let je;const Nt=/^(?:(?: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])$/,Ot=/^(([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]))$/,At=/^(([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])$/,Et=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,It=/^([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])))",jt=new RegExp(`^${Je}$`);function Ye(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 $t(a){return new RegExp(`^${Ye(a)}$`)}function Ge(a){let e=`${Je}T${Ye(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 Pt(a,e){return!!((e==="v4"||!e)&&Nt.test(a)||(e==="v6"||!e)&&Ot.test(a))}function Rt(a,e){if(!xt.test(a))return!1;try{const[t]=a.split("."),s=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),n=JSON.parse(atob(s));return!(typeof n!="object"||n===null||!n.typ||!n.alg||e&&n.alg!==e)}catch{return!1}}function Mt(a,e){return!!((e==="v4"||!e)&&Ct.test(a)||(e==="v6"||!e)&&At.test(a))}class C extends v{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==h.string){const n=this._getOrReturnCtx(e);return l(n,{code:d.invalid_type,expected:h.string,received:n.parsedType}),y}const t=new S;let s;for(const n of this._def.checks)if(n.kind==="min")e.data.length<n.value&&(s=this._getOrReturnCtx(e,s),l(s,{code:d.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),t.dirty());else if(n.kind==="max")e.data.length>n.value&&(s=this._getOrReturnCtx(e,s),l(s,{code:d.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?l(s,{code:d.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):i&&l(s,{code:d.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),t.dirty())}else if(n.kind==="email")St.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"email",code:d.invalid_string,message:n.message}),t.dirty());else if(n.kind==="emoji")je||(je=new RegExp(Tt,"u")),je.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"emoji",code:d.invalid_string,message:n.message}),t.dirty());else if(n.kind==="uuid")wt.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"uuid",code:d.invalid_string,message:n.message}),t.dirty());else if(n.kind==="nanoid")kt.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"nanoid",code:d.invalid_string,message:n.message}),t.dirty());else if(n.kind==="cuid")_t.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"cuid",code:d.invalid_string,message:n.message}),t.dirty());else if(n.kind==="cuid2")vt.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"cuid2",code:d.invalid_string,message:n.message}),t.dirty());else if(n.kind==="ulid")bt.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"ulid",code:d.invalid_string,message:n.message}),t.dirty());else if(n.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),l(s,{validation:"url",code:d.invalid_string,message:n.message}),t.dirty()}else n.kind==="regex"?(n.regex.lastIndex=0,n.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"regex",code:d.invalid_string,message:n.message}),t.dirty())):n.kind==="trim"?e.data=e.data.trim():n.kind==="includes"?e.data.includes(n.value,n.position)||(s=this._getOrReturnCtx(e,s),l(s,{code:d.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),t.dirty()):n.kind==="toLowerCase"?e.data=e.data.toLowerCase():n.kind==="toUpperCase"?e.data=e.data.toUpperCase():n.kind==="startsWith"?e.data.startsWith(n.value)||(s=this._getOrReturnCtx(e,s),l(s,{code:d.invalid_string,validation:{startsWith:n.value},message:n.message}),t.dirty()):n.kind==="endsWith"?e.data.endsWith(n.value)||(s=this._getOrReturnCtx(e,s),l(s,{code:d.invalid_string,validation:{endsWith:n.value},message:n.message}),t.dirty()):n.kind==="datetime"?Ge(n).test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{code:d.invalid_string,validation:"datetime",message:n.message}),t.dirty()):n.kind==="date"?jt.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{code:d.invalid_string,validation:"date",message:n.message}),t.dirty()):n.kind==="time"?$t(n).test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{code:d.invalid_string,validation:"time",message:n.message}),t.dirty()):n.kind==="duration"?Zt.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"duration",code:d.invalid_string,message:n.message}),t.dirty()):n.kind==="ip"?Pt(e.data,n.version)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"ip",code:d.invalid_string,message:n.message}),t.dirty()):n.kind==="jwt"?Rt(e.data,n.alg)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"jwt",code:d.invalid_string,message:n.message}),t.dirty()):n.kind==="cidr"?Mt(e.data,n.version)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"cidr",code:d.invalid_string,message:n.message}),t.dirty()):n.kind==="base64"?Et.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"base64",code:d.invalid_string,message:n.message}),t.dirty()):n.kind==="base64url"?It.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"base64url",code:d.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:d.invalid_string,...p.errToObj(s)})}_addCheck(e){return new C({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...p.errToObj(e)})}url(e){return this._addCheck({kind:"url",...p.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...p.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...p.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...p.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...p.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...p.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...p.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...p.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...p.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...p.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...p.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...p.errToObj(e)})}datetime(e){var t,s;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(t=e==null?void 0:e.offset)!==null&&t!==void 0?t:!1,local:(s=e==null?void 0:e.local)!==null&&s!==void 0?s:!1,...p.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...p.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...p.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...p.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...p.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...p.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...p.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...p.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...p.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...p.errToObj(t)})}nonempty(e){return this.min(1,p.errToObj(e))}trim(){return new C({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new C({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new C({...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}}C.create=a=>{var e;return new C({checks:[],typeName:m.ZodString,coerce:(e=a==null?void 0:a.coerce)!==null&&e!==void 0?e:!1,..._(a)})};function Ft(a,e){const t=(a.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,n=t>s?t:s,r=parseInt(a.toFixed(n).replace(".","")),i=parseInt(e.toFixed(n).replace(".",""));return r%i/Math.pow(10,n)}let Q=class Me 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)!==h.number){const n=this._getOrReturnCtx(e);return l(n,{code:d.invalid_type,expected:h.number,received:n.parsedType}),y}let t;const s=new S;for(const n of this._def.checks)n.kind==="int"?b.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),l(t,{code:d.invalid_type,expected:"integer",received:"float",message:n.message}),s.dirty()):n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),l(t,{code:d.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),s.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),l(t,{code:d.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),s.dirty()):n.kind==="multipleOf"?Ft(e.data,n.value)!==0&&(t=this._getOrReturnCtx(e,t),l(t,{code:d.not_multiple_of,multipleOf:n.value,message:n.message}),s.dirty()):n.kind==="finite"?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),l(t,{code:d.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 Me({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:p.toString(n)}]})}_addCheck(e){return new Me({...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)}};Q.create=a=>new Q({checks:[],typeName:m.ZodNumber,coerce:(a==null?void 0:a.coerce)||!1,..._(a)});let ee=class Fe 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)!==h.bigint)return this._getInvalidInput(e);let t;const s=new S;for(const n of this._def.checks)n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),l(t,{code:d.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),s.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),l(t,{code:d.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),s.dirty()):n.kind==="multipleOf"?e.data%n.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),l(t,{code:d.not_multiple_of,multipleOf:n.value,message:n.message}),s.dirty()):b.assertNever(n);return{status:s.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return l(t,{code:d.invalid_type,expected:h.bigint,received:t.parsedType}),y}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 Fe({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:p.toString(n)}]})}_addCheck(e){return new Fe({...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}};ee.create=a=>{var e;return new ee({checks:[],typeName:m.ZodBigInt,coerce:(e=a==null?void 0:a.coerce)!==null&&e!==void 0?e:!1,..._(a)})};class te extends v{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==h.boolean){const t=this._getOrReturnCtx(e);return l(t,{code:d.invalid_type,expected:h.boolean,received:t.parsedType}),y}return x(e.data)}}te.create=a=>new te({typeName:m.ZodBoolean,coerce:(a==null?void 0:a.coerce)||!1,..._(a)});let se=class Xe extends v{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==h.date){const n=this._getOrReturnCtx(e);return l(n,{code:d.invalid_type,expected:h.date,received:n.parsedType}),y}if(isNaN(e.data.getTime())){const n=this._getOrReturnCtx(e);return l(n,{code:d.invalid_date}),y}const t=new S;let s;for(const n of this._def.checks)n.kind==="min"?e.data.getTime()<n.value&&(s=this._getOrReturnCtx(e,s),l(s,{code:d.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),t.dirty()):n.kind==="max"?e.data.getTime()>n.value&&(s=this._getOrReturnCtx(e,s),l(s,{code:d.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 Xe({...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}};se.create=a=>new se({checks:[],coerce:(a==null?void 0:a.coerce)||!1,typeName:m.ZodDate,..._(a)});class Te extends v{_parse(e){if(this._getType(e)!==h.symbol){const t=this._getOrReturnCtx(e);return l(t,{code:d.invalid_type,expected:h.symbol,received:t.parsedType}),y}return x(e.data)}}Te.create=a=>new Te({typeName:m.ZodSymbol,..._(a)});class ae extends v{_parse(e){if(this._getType(e)!==h.undefined){const t=this._getOrReturnCtx(e);return l(t,{code:d.invalid_type,expected:h.undefined,received:t.parsedType}),y}return x(e.data)}}ae.create=a=>new ae({typeName:m.ZodUndefined,..._(a)});class ne extends v{_parse(e){if(this._getType(e)!==h.null){const t=this._getOrReturnCtx(e);return l(t,{code:d.invalid_type,expected:h.null,received:t.parsedType}),y}return x(e.data)}}ne.create=a=>new ne({typeName:m.ZodNull,..._(a)});let K=class extends v{constructor(){super(...arguments),this._any=!0}_parse(e){return x(e.data)}};K.create=a=>new K({typeName:m.ZodAny,..._(a)});class L extends v{constructor(){super(...arguments),this._unknown=!0}_parse(e){return x(e.data)}}L.create=a=>new L({typeName:m.ZodUnknown,..._(a)});class $ extends v{_parse(e){const t=this._getOrReturnCtx(e);return l(t,{code:d.invalid_type,expected:h.never,received:t.parsedType}),y}}$.create=a=>new $({typeName:m.ZodNever,..._(a)});class Ne extends v{_parse(e){if(this._getType(e)!==h.undefined){const t=this._getOrReturnCtx(e);return l(t,{code:d.invalid_type,expected:h.void,received:t.parsedType}),y}return x(e.data)}}Ne.create=a=>new Ne({typeName:m.ZodVoid,..._(a)});let z=class be extends v{_parse(e){const{ctx:t,status:s}=this._processInputParams(e),n=this._def;if(t.parsedType!==h.array)return l(t,{code:d.invalid_type,expected:h.array,received:t.parsedType}),y;if(n.exactLength!==null){const i=t.data.length>n.exactLength.value,o=t.data.length<n.exactLength.value;(i||o)&&(l(t,{code:i?d.too_big:d.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&&(l(t,{code:d.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),s.dirty()),n.maxLength!==null&&t.data.length>n.maxLength.value&&(l(t,{code:d.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 I(t,i,t.path,o)))).then(i=>S.mergeArray(s,i));const r=[...t.data].map((i,o)=>n.type._parseSync(new I(t,i,t.path,o)));return S.mergeArray(s,r)}get element(){return this._def.type}min(e,t){return new be({...this._def,minLength:{value:e,message:p.toString(t)}})}max(e,t){return new be({...this._def,maxLength:{value:e,message:p.toString(t)}})}length(e,t){return new be({...this._def,exactLength:{value:e,message:p.toString(t)}})}nonempty(e){return this.min(1,e)}};z.create=(a,e)=>new z({type:a,minLength:null,maxLength:null,exactLength:null,typeName:m.ZodArray,..._(e)});function U(a){if(a instanceof T){const e={};for(const t in a.shape){const s=a.shape[t];e[t]=E.create(U(s))}return new T({...a._def,shape:()=>e})}else return a instanceof z?new z({...a._def,type:U(a.element)}):a instanceof E?E.create(U(a.unwrap())):a instanceof M?M.create(U(a.unwrap())):a instanceof R?R.create(a.items.map(e=>U(e))):a}let T=class N 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}}_parse(e){if(this._getType(e)!==h.object){const c=this._getOrReturnCtx(e);return l(c,{code:d.invalid_type,expected:h.object,received:c.parsedType}),y}const{status:t,ctx:s}=this._processInputParams(e),{shape:n,keys:r}=this._getCached(),i=[];if(!(this._def.catchall instanceof $&&this._def.unknownKeys==="strip"))for(const c in s.data)r.includes(c)||i.push(c);const o=[];for(const c of r){const u=n[c],f=s.data[c];o.push({key:{status:"valid",value:c},value:u._parse(new I(s,f,s.path,c)),alwaysSet:c in s.data})}if(this._def.catchall instanceof $){const c=this._def.unknownKeys;if(c==="passthrough")for(const u of i)o.push({key:{status:"valid",value:u},value:{status:"valid",value:s.data[u]}});else if(c==="strict")i.length>0&&(l(s,{code:d.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 u of i){const f=s.data[u];o.push({key:{status:"valid",value:u},value:c._parse(new I(s,f,s.path,u)),alwaysSet:u in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const c=[];for(const u of o){const f=await u.key,w=await u.value;c.push({key:f,value:w,alwaysSet:u.alwaysSet})}return c}).then(c=>S.mergeObjectSync(t,c)):S.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return p.errToObj,new N({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{var n,r,i,o;const c=(i=(r=(n=this._def).errorMap)===null||r===void 0?void 0:r.call(n,t,s).message)!==null&&i!==void 0?i:s.defaultError;return t.code==="unrecognized_keys"?{message:(o=p.errToObj(e).message)!==null&&o!==void 0?o:c}:{message:c}}}:{}})}strip(){return new N({...this._def,unknownKeys:"strip"})}passthrough(){return new N({...this._def,unknownKeys:"passthrough"})}extend(e){return new N({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new N({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 N({...this._def,catchall:e})}pick(e){const t={};return b.objectKeys(e).forEach(s=>{e[s]&&this.shape[s]&&(t[s]=this.shape[s])}),new N({...this._def,shape:()=>t})}omit(e){const t={};return b.objectKeys(this.shape).forEach(s=>{e[s]||(t[s]=this.shape[s])}),new N({...this._def,shape:()=>t})}deepPartial(){return U(this)}partial(e){const t={};return b.objectKeys(this.shape).forEach(s=>{const n=this.shape[s];e&&!e[s]?t[s]=n:t[s]=n.optional()}),new N({...this._def,shape:()=>t})}required(e){const t={};return b.objectKeys(this.shape).forEach(s=>{if(e&&!e[s])t[s]=this.shape[s];else{let n=this.shape[s];for(;n instanceof E;)n=n._def.innerType;t[s]=n}}),new N({...this._def,shape:()=>t})}keyof(){return tt(b.objectKeys(this.shape))}};T.create=(a,e)=>new T({shape:()=>a,unknownKeys:"strip",catchall:$.create(),typeName:m.ZodObject,..._(e)});T.strictCreate=(a,e)=>new T({shape:()=>a,unknownKeys:"strict",catchall:$.create(),typeName:m.ZodObject,..._(e)});T.lazycreate=(a,e)=>new T({shape:a,unknownKeys:"strip",catchall:$.create(),typeName:m.ZodObject,..._(e)});class ie 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 l(t,{code:d.invalid_union,unionErrors:i}),y}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 u={...t,common:{...t.common,issues:[]},parent:null},f=c._parseSync({data:t.data,path:t.path,parent:u});if(f.status==="valid")return f;f.status==="dirty"&&!r&&(r={result:f,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(r)return t.common.issues.push(...r.ctx.common.issues),r.result;const o=i.map(c=>new O(c));return l(t,{code:d.invalid_union,unionErrors:o}),y}}get options(){return this._def.options}}ie.create=(a,e)=>new ie({options:a,typeName:m.ZodUnion,..._(e)});const P=a=>a instanceof ce?P(a.schema):a instanceof A?P(a.innerType()):a instanceof de?[a.value]:a instanceof fe?a.options:a instanceof ue?b.objectValues(a.enum):a instanceof le?P(a._def.innerType):a instanceof ae?[void 0]:a instanceof ne?[null]:a instanceof E?[void 0,...P(a.unwrap())]:a instanceof M?[null,...P(a.unwrap())]:a instanceof qe||a instanceof pe?P(a.unwrap()):a instanceof he?P(a._def.innerType):[];class Ae extends v{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==h.object)return l(t,{code:d.invalid_type,expected:h.object,received:t.parsedType}),y;const s=this.discriminator,n=t.data[s],r=this.optionsMap.get(n);return r?t.common.async?r._parseAsync({data:t.data,path:t.path,parent:t}):r._parseSync({data:t.data,path:t.path,parent:t}):(l(t,{code:d.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),y)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){const n=new Map;for(const r of t){const i=P(r.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of i){if(n.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);n.set(o,r)}}return new Ae({typeName:m.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,..._(s)})}}function De(a,e){const t=j(a),s=j(e);if(a===e)return{valid:!0,data:a};if(t===h.object&&s===h.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=De(a[o],e[o]);if(!c.valid)return{valid:!1};i[o]=c.data}return{valid:!0,data:i}}else if(t===h.array&&s===h.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=De(i,o);if(!c.valid)return{valid:!1};n.push(c.data)}return{valid:!0,data:n}}else return t===h.date&&s===h.date&&+a==+e?{valid:!0,data:a}:{valid:!1}}class re extends v{_parse(e){const{status:t,ctx:s}=this._processInputParams(e),n=(r,i)=>{if(Pe(r)||Pe(i))return y;const o=De(r.value,i.value);return o.valid?((Re(r)||Re(i))&&t.dirty(),{status:t.value,value:o.data}):(l(s,{code:d.invalid_intersection_types}),y)};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}))}}re.create=(a,e,t)=>new re({left:a,right:e,typeName:m.ZodIntersection,..._(t)});let R=class Qe extends v{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==h.array)return l(s,{code:d.invalid_type,expected:h.array,received:s.parsedType}),y;if(s.data.length<this._def.items.length)return l(s,{code:d.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),y;!this._def.rest&&s.data.length>this._def.items.length&&(l(s,{code:d.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 I(s,r,s.path,i)):null}).filter(r=>!!r);return s.common.async?Promise.all(n).then(r=>S.mergeArray(t,r)):S.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new Qe({...this._def,rest:e})}};R.create=(a,e)=>{if(!Array.isArray(a))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new R({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!==h.object)return l(s,{code:d.invalid_type,expected:h.object,received:s.parsedType}),y;const n=[],r=this._def.keyType,i=this._def.valueType;for(const o in s.data)n.push({key:r._parse(new I(s,o,s.path,o)),value:i._parse(new I(s,s.data[o],s.path,o)),alwaysSet:o in s.data});return s.common.async?S.mergeObjectAsync(t,n):S.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof v?new oe({keyType:e,valueType:t,typeName:m.ZodRecord,..._(s)}):new oe({keyType:C.create(),valueType:e,typeName:m.ZodRecord,..._(t)})}}class Ce 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!==h.map)return l(s,{code:d.invalid_type,expected:h.map,received:s.parsedType}),y;const n=this._def.keyType,r=this._def.valueType,i=[...s.data.entries()].map(([o,c],u)=>({key:n._parse(new I(s,o,s.path,[u,"key"])),value:r._parse(new I(s,c,s.path,[u,"value"]))}));if(s.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const c of i){const u=await c.key,f=await c.value;if(u.status==="aborted"||f.status==="aborted")return y;(u.status==="dirty"||f.status==="dirty")&&t.dirty(),o.set(u.value,f.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const c of i){const u=c.key,f=c.value;if(u.status==="aborted"||f.status==="aborted")return y;(u.status==="dirty"||f.status==="dirty")&&t.dirty(),o.set(u.value,f.value)}return{status:t.value,value:o}}}}Ce.create=(a,e,t)=>new Ce({valueType:e,keyType:a,typeName:m.ZodMap,..._(t)});class V extends v{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==h.set)return l(s,{code:d.invalid_type,expected:h.set,received:s.parsedType}),y;const n=this._def;n.minSize!==null&&s.data.size<n.minSize.value&&(l(s,{code:d.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),n.maxSize!==null&&s.data.size>n.maxSize.value&&(l(s,{code:d.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 u=new Set;for(const f of c){if(f.status==="aborted")return y;f.status==="dirty"&&t.dirty(),u.add(f.value)}return{status:t.value,value:u}}const o=[...s.data.values()].map((c,u)=>r._parse(new I(s,c,s.path,u)));return s.common.async?Promise.all(o).then(c=>i(c)):i(o)}min(e,t){return new V({...this._def,minSize:{value:e,message:p.toString(t)}})}max(e,t){return new V({...this._def,maxSize:{value:e,message:p.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}V.create=(a,e)=>new V({valueType:a,minSize:null,maxSize:null,typeName:m.ZodSet,..._(e)});let et=class we extends v{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==h.function)return l(t,{code:d.invalid_type,expected:h.function,received:t.parsedType}),y;function s(o,c){return xe({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ke(),H].filter(u=>!!u),issueData:{code:d.invalid_arguments,argumentsError:c}})}function n(o,c){return xe({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ke(),H].filter(u=>!!u),issueData:{code:d.invalid_return_type,returnTypeError:c}})}const r={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof W){const o=this;return x(async function(...c){const u=new O([]),f=await o._def.args.parseAsync(c,r).catch(Z=>{throw u.addIssue(s(c,Z)),u}),w=await Reflect.apply(i,this,f);return await o._def.returns._def.type.parseAsync(w,r).catch(Z=>{throw u.addIssue(n(w,Z)),u})})}else{const o=this;return x(function(...c){const u=o._def.args.safeParse(c,r);if(!u.success)throw new O([s(c,u.error)]);const f=Reflect.apply(i,this,u.data),w=o._def.returns.safeParse(f,r);if(!w.success)throw new O([n(f,w.error)]);return w.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new we({...this._def,args:R.create(e).rest(L.create())})}returns(e){return new we({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,s){return new we({args:e||R.create([]).rest(L.create()),returns:t||L.create(),typeName:m.ZodFunction,..._(s)})}};class ce 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})}}ce.create=(a,e)=>new ce({getter:a,typeName:m.ZodLazy,..._(e)});class de extends v{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return l(t,{received:t.data,code:d.invalid_literal,expected:this._def.value}),y}return{status:"valid",value:e.data}}get value(){return this._def.value}}de.create=(a,e)=>new de({value:a,typeName:m.ZodLiteral,..._(e)});function tt(a,e){return new fe({values:a,typeName:m.ZodEnum,..._(e)})}let fe=class Le extends v{constructor(){super(...arguments),J.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),s=this._def.values;return l(t,{expected:b.joinValues(s),received:t.parsedType,code:d.invalid_type}),y}if(Se(this,J)||We(this,J,new Set(this._def.values)),!Se(this,J).has(e.data)){const t=this._getOrReturnCtx(e),s=this._def.values;return l(t,{received:t.data,code:d.invalid_enum_value,options:s}),y}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 Le.create(e,{...this._def,...t})}exclude(e,t=this._def){return Le.create(this.options.filter(s=>!e.includes(s)),{...this._def,...t})}};J=new WeakMap;fe.create=tt;class ue extends v{constructor(){super(...arguments),Y.set(this,void 0)}_parse(e){const t=b.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==h.string&&s.parsedType!==h.number){const n=b.objectValues(t);return l(s,{expected:b.joinValues(n),received:s.parsedType,code:d.invalid_type}),y}if(Se(this,Y)||We(this,Y,new Set(b.getValidEnumValues(this._def.values))),!Se(this,Y).has(e.data)){const n=b.objectValues(t);return l(s,{received:s.data,code:d.invalid_enum_value,options:n}),y}return x(e.data)}get enum(){return this._def.values}}Y=new WeakMap;ue.create=(a,e)=>new ue({values:a,typeName:m.ZodNativeEnum,..._(e)});class W extends v{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==h.promise&&t.common.async===!1)return l(t,{code:d.invalid_type,expected:h.promise,received:t.parsedType}),y;const s=t.parsedType===h.promise?t.data:Promise.resolve(t.data);return x(s.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}}W.create=(a,e)=>new W({type:a,typeName:m.ZodPromise,..._(e)});let A=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=>{l(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 y;const c=await this._def.schema._parseAsync({data:o,path:s.path,parent:s});return c.status==="aborted"?y:c.status==="dirty"||t.value==="dirty"?Ze(c.value):c});{if(t.value==="aborted")return y;const o=this._def.schema._parseSync({data:i,path:s.path,parent:s});return o.status==="aborted"?y:o.status==="dirty"||t.value==="dirty"?Ze(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"?y:(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"?y:(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(!q(i))return i;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=>q(i)?Promise.resolve(n.transform(i.value,r)).then(o=>({status:t.value,value:o})):i);b.assertNever(n)}};A.create=(a,e,t)=>new A({schema:a,typeName:m.ZodEffects,effect:e,..._(t)});A.createWithPreprocess=(a,e,t)=>new A({schema:e,effect:{type:"preprocess",transform:a},typeName:m.ZodEffects,..._(t)});let E=class extends v{_parse(e){return this._getType(e)===h.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 M=class extends v{_parse(e){return this._getType(e)===h.null?x(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};M.create=(a,e)=>new M({innerType:a,typeName:m.ZodNullable,..._(e)});class le extends v{_parse(e){const{ctx:t}=this._processInputParams(e);let s=t.data;return t.parsedType===h.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}le.create=(a,e)=>new le({innerType:a,typeName:m.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,..._(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 X(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 Oe extends v{_parse(e){if(this._getType(e)!==h.nan){const t=this._getOrReturnCtx(e);return l(t,{code:d.invalid_type,expected:h.nan,received:t.parsedType}),y}return{status:"valid",value:e.data}}}Oe.create=a=>new Oe({typeName:m.ZodNaN,..._(a)});const Dt=Symbol("zod_brand");class qe 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"?y:n.status==="dirty"?(t.dirty(),Ze(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"?y: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=>(q(n)&&(n.value=Object.freeze(n.value)),n);return X(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)});function Ve(a,e){const t=typeof a=="function"?a(e):typeof a=="string"?{message:a}:a;return typeof t=="string"?{message:t}:t}function st(a,e={},t){return a?K.create().superRefine((s,n)=>{var r,i;const o=a(s);if(o instanceof Promise)return o.then(c=>{var u,f;if(!c){const w=Ve(e,s),Z=(f=(u=w.fatal)!==null&&u!==void 0?u:t)!==null&&f!==void 0?f:!0;n.addIssue({code:"custom",...w,fatal:Z})}});if(!o){const c=Ve(e,s),u=(i=(r=c.fatal)!==null&&r!==void 0?r:t)!==null&&i!==void 0?i:!0;n.addIssue({code:"custom",...c,fatal:u})}}):K.create()}const Lt={object:T.lazycreate};var m;(function(a){a.ZodString="ZodString",a.ZodNumber="ZodNumber",a.ZodNaN="ZodNaN",a.ZodBigInt="ZodBigInt",a.ZodBoolean="ZodBoolean",a.ZodDate="ZodDate",a.ZodSymbol="ZodSymbol",a.ZodUndefined="ZodUndefined",a.ZodNull="ZodNull",a.ZodAny="ZodAny",a.ZodUnknown="ZodUnknown",a.ZodNever="ZodNever",a.ZodVoid="ZodVoid",a.ZodArray="ZodArray",a.ZodObject="ZodObject",a.ZodUnion="ZodUnion",a.ZodDiscriminatedUnion="ZodDiscriminatedUnion",a.ZodIntersection="ZodIntersection",a.ZodTuple="ZodTuple",a.ZodRecord="ZodRecord",a.ZodMap="ZodMap",a.ZodSet="ZodSet",a.ZodFunction="ZodFunction",a.ZodLazy="ZodLazy",a.ZodLiteral="ZodLiteral",a.ZodEnum="ZodEnum",a.ZodEffects="ZodEffects",a.ZodNativeEnum="ZodNativeEnum",a.ZodOptional="ZodOptional",a.ZodNullable="ZodNullable",a.ZodDefault="ZodDefault",a.ZodCatch="ZodCatch",a.ZodPromise="ZodPromise",a.ZodBranded="ZodBranded",a.ZodPipeline="ZodPipeline",a.ZodReadonly="ZodReadonly"})(m||(m={}));const qt=(a,e={message:`Input not instance of ${a.name}`})=>st(t=>t instanceof a,e),at=C.create,nt=Q.create,zt=Oe.create,Vt=ee.create,it=te.create,Bt=se.create,Ut=Te.create,Ht=ae.create,Kt=ne.create,Wt=K.create,Jt=L.create,Yt=$.create,Gt=Ne.create,Xt=z.create,Qt=T.create,es=T.strictCreate,ts=ie.create,ss=Ae.create,as=re.create,ns=R.create,is=oe.create,rs=Ce.create,os=V.create,cs=et.create,ds=ce.create,us=de.create,ls=fe.create,hs=ue.create,ps=W.create,Be=A.create,fs=E.create,ms=M.create,ys=A.createWithPreprocess,gs=me.create,_s=()=>at().optional(),vs=()=>nt().optional(),bs=()=>it().optional(),ws={string:a=>C.create({...a,coerce:!0}),number:a=>Q.create({...a,coerce:!0}),boolean:a=>te.create({...a,coerce:!0}),bigint:a=>ee.create({...a,coerce:!0}),date:a=>se.create({...a,coerce:!0})},ks=y;var ye=Object.freeze({__proto__:null,defaultErrorMap:H,setErrorMap:yt,getErrorMap:ke,makeIssue:xe,EMPTY_PATH:gt,addIssueToContext:l,ParseStatus:S,INVALID:y,DIRTY:Ze,OK:x,isAborted:Pe,isDirty:Re,isValid:q,isAsync:X,get util(){return b},get objectUtil(){return $e},ZodParsedType:h,getParsedType:j,ZodType:v,datetimeRegex:Ge,ZodString:C,ZodNumber:Q,ZodBigInt:ee,ZodBoolean:te,ZodDate:se,ZodSymbol:Te,ZodUndefined:ae,ZodNull:ne,ZodAny:K,ZodUnknown:L,ZodNever:$,ZodVoid:Ne,ZodArray:z,ZodObject:T,ZodUnion:ie,ZodDiscriminatedUnion:Ae,ZodIntersection:re,ZodTuple:R,ZodRecord:oe,ZodMap:Ce,ZodSet:V,ZodFunction:et,ZodLazy:ce,ZodLiteral:de,ZodEnum:fe,ZodNativeEnum:ue,ZodPromise:W,ZodEffects:A,ZodTransformer:A,ZodOptional:E,ZodNullable:M,ZodDefault:le,ZodCatch:he,ZodNaN:Oe,BRAND:Dt,ZodBranded:qe,ZodPipeline:me,ZodReadonly:pe,custom:st,Schema:v,ZodSchema:v,late:Lt,get ZodFirstPartyTypeKind(){return m},coerce:ws,any:Wt,array:Xt,bigint:Vt,boolean:it,date:Bt,discriminatedUnion:ss,effect:Be,enum:ls,function:cs,instanceof:qt,intersection:as,lazy:ds,literal:us,map:rs,nan:zt,nativeEnum:hs,never:Yt,null:Kt,nullable:ms,number:nt,object:Qt,oboolean:bs,onumber:vs,optional:fs,ostring:_s,pipeline:gs,preprocess:ys,promise:ps,record:is,set:os,strictObject:es,string:at,symbol:Ut,transformer:Be,tuple:ns,undefined:Ht,union:ts,unknown:Jt,void:Gt,NEVER:ks,ZodIssueCode:d,quotelessJson:mt,ZodError:O});const xs="1.6.1",Zs={version:xs};class rt{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 ot{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})}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 ct{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}}function Ss(a,e=console.error){a().catch(e)}class dt{constructor(e){this._client=e}async getColorScheme(){return(await this._client.request("environment.getColorScheme",{})).colorScheme}subscribeColorScheme(e){Ss(async()=>{this._client.on("environment.colorSchemeChanged",e),e(await this.getColorScheme())})}unsubscribeColorScheme(e){this._client.off("environment.colorSchemeChanged",e)}}class ut{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}}class lt{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((f,w)=>{r[w]=f}):Array.isArray(t.headers)?t.headers.forEach(([f,w])=>{r[f]=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 u=null;if(i.body!==null&&i.body!==void 0)if(i.bodyType==="binary"){const f=atob(i.body),w=new Uint8Array(f.length);for(let Z=0;Z<f.length;Z++)w[Z]=f.charCodeAt(Z);u=w}else i.bodyType==="text"?u=i.body:i.bodyType==="json"&&(u=JSON.stringify(i.body));return new Response(u,c)}}class ht{constructor(e){this._client=e}get application(){return new ge("application","",this._client)}get instance(){return new ge("instance",this._client.applicationInstance,this._client)}get device(){return new ge("device",this._client.applicationInstance,this._client)}shared(e){return new ge("shared",e,this._client)}}class ge{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 pt{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 ft{constructor(e){this._client=e}async getConditions(e){const t=await this._client.request("weather.getConditions",e);if(!t.success||!t.conditions)throw new Error(t.error||"Failed to fetch weather conditions");return t.conditions}async getDailyForecast(e){const t=await this._client.request("weather.getDailyForecast",e);if(!t.success||!t.forecast)throw new Error(t.error||"Failed to fetch daily forecast");return t.forecast}async getHourlyForecast(e){const t=await this._client.request("weather.getHourlyForecast",e);if(!t.success||!t.forecast)throw new Error(t.error||"Failed to fetch hourly forecast");return t.forecast}}function _e(a){return{...a,type:"client"}}const Ts=ye.object({type:ye.literal("bridge"),name:ye.string(),data:ye.any()});class Ns{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 B=1e3*30;class Cs{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 rt(this)}get users(){return new pt(this)}get store(){return new ht(this)}get applications(){return new ot(this)}get media(){return new ut(this)}get proxy(){return new lt(this)}get devices(){return new ct(this)}get rootSettingsNavigation(){return new Ns(this.store)}get weather(){return new ft(this)}get environment(){return new dt(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(window.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===window||!i.data||!("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){window.parent.postMessage(i.data,"*");return}o={...c(i.data.data),type:"bridge"}}if(!o){const c=Ts.safeParse(i.data);if(!c.success)return;o=c.data;const u=this._onHandlers.get(o.name),f=this._onceHandlers.get(o.name);if(u)for(const w of u)w(o.data);if(f){for(const w of f)w(o.data);this._onceHandlers.delete(o.name)}}for(let c=0;c<window.frames.length;c+=1)window.frames[c].postMessage(o,"*")},window.addEventListener("message",this._windowMessageHandler)}unbind(){this._windowMessageHandler&&window.removeEventListener("message",this._windowMessageHandler)}send(e,t){const s=_e({telemetrySdkVersion:G,applicationName:this._applicationName,applicationSpecifier:this._applicationSpecifier,applicationInstance:this._applicationInstance,name:e,data:t});window.parent.postMessage(s,"*")}request(e,t){const s=ve(),n=_e({telemetrySdkVersion:G,applicationName:this._applicationName,applicationSpecifier:this._applicationSpecifier,applicationInstance:this._applicationInstance,name:e,data:t,responseName:s});window.parent.postMessage(n,"*");let r=!1,i;const o=new Promise((u,f)=>{const w=new Error(`${e} message request with response name of ${s} timed out after ${B}`);setTimeout(()=>{r=!0,this.off(s,i),f(w)},B)}),c=new Promise(u=>{i=f=>{r||u(f)},this.once(s,u)});return Promise.race([o,c])}async subscribe(e,t,s){let n,r;typeof t=="function"?r=t:(n=t,r=s);const i=ve(),o=ve();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 u=_e({telemetrySdkVersion:G,applicationName:this._applicationName,applicationSpecifier:this._applicationSpecifier,applicationInstance:this._applicationInstance,name:e,data:n,responseName:o,subscriptionName:i});window.parent.postMessage(u,"*");let f=!1,w;const Z=new Promise((F,D)=>{const Ie=new Error(`${e} subscribe request with subscription name of ${i} and response name of ${o} timed out after ${B}`);setTimeout(()=>{f=!0,this.off(o,w),D(Ie)},B)}),Ee=new Promise(F=>{w=D=>{f||F(D)},this.on(o,F)});return Promise.race([Z,Ee])}async unsubscribe(e,t,s){let n,r;typeof t=="function"?r=t:(n=t,r=s);const i=ve();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 u=_e({telemetrySdkVersion:G,applicationInstance:this._applicationInstance,applicationName:this._applicationName,applicationSpecifier:this._applicationSpecifier,name:e,data:n,responseName:i,unsubscribeName:c});window.parent.postMessage(u,"*");let f=!1,w;const Z=new Promise((F,D)=>{const Ie=new Error(`${e} unsubscribe request with unsubscribe name of ${c} and response name of ${i} timed out after ${B}`);setTimeout(()=>{f=!0,this.off(i,w),D(Ie)},B)}),Ee=new Promise(F=>{w=D=>{f||F(D)},this.once(i,F)});if(!(await Promise.race([Z,Ee])).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 ve(){return Math.random().toString(36).slice(2,9)}const G=Zs.version;class Os{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 As{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 Es extends Cs{get playlist(){return new As(this)}get overrides(){return new Os(this)}}let g=null;function Is(){return g}function js(a){g=new Es(a),g.bind()}function $s(){g==null||g.unbind(),g=null}function Ps(...a){return k(g),g.on(...a)}function Rs(...a){return k(g),g.once(...a)}function Ms(...a){return k(g),g.off(...a)}function Fs(...a){return k(g),g.send(...a)}function Ds(...a){return k(g),g.request(...a)}function Ls(...a){return k(g),g.subscribe(...a)}function qs(...a){return k(g),g.unsubscribe(...a)}function zs(){return k(g),g.store}function Vs(){return k(g),g.applications}function Bs(){return k(g),g.media}function Us(){return k(g),g.accounts}function Hs(){return k(g),g.users}function Ks(){return k(g),g.devices}function Ws(){return k(g),g.proxy}function Js(){return k(g),g.weather}function Ys(){return k(g),g.environment}function Gs(){return k(g),g.playlist}function Xs(){return k(g),g.overrides}function k(a){if(!a)throw new Error("SDK is not configured")}exports.Accounts=rt;exports.Applications=ot;exports.Devices=ct;exports.Environment=dt;exports.Media=ut;exports.Proxy=lt;exports.Store=ht;exports.Users=pt;exports.Weather=ft;exports.accounts=Us;exports.applications=Vs;exports.configure=js;exports.destroy=$s;exports.devices=Ks;exports.environment=Ys;exports.globalClient=Is;exports.media=Bs;exports.off=Ms;exports.on=Ps;exports.once=Rs;exports.overrides=Xs;exports.playlist=Gs;exports.proxy=Ws;exports.request=Ds;exports.send=Fs;exports.store=zs;exports.subscribe=Ls;exports.telemetrySdkVersion=G;exports.unsubscribe=qs;exports.users=Hs;exports.weather=Js;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { telemetrySdkVersion } from '@telemetryos/root-sdk';
|
|
2
|
-
export { Accounts, Applications, Devices, Environment, Media, Proxy, Store, Users, Weather, } from '@telemetryos/root-sdk';
|
|
2
|
+
export { Accounts, Applications, Devices, Environment, Media, Proxy, Store, Users, Weather, type ColorScheme, } from '@telemetryos/root-sdk';
|
|
3
3
|
import { Client } from './client.js';
|
|
4
4
|
/**
|
|
5
5
|
* Returns the global client instance used by the convenience functions in this package.
|
|
@@ -143,18 +143,6 @@ export declare function subscribe(...args: Parameters<Client['subscribe']>): Pro
|
|
|
143
143
|
* @throws {Error} If called before configure() or after destroy()
|
|
144
144
|
*/
|
|
145
145
|
export declare function unsubscribe(...args: Parameters<Client['unsubscribe']>): Promise<import("@telemetryos/root-sdk").SubscriptionResult<void>>;
|
|
146
|
-
/**
|
|
147
|
-
* Provides access to the accounts API for retrieving TelemetryOS account information.
|
|
148
|
-
* @returns The Accounts API object
|
|
149
|
-
* @throws {Error} If called before configure() or after destroy()
|
|
150
|
-
*/
|
|
151
|
-
export declare function accounts(): import("@telemetryos/root-sdk").Accounts;
|
|
152
|
-
/**
|
|
153
|
-
* Provides access to the users API for retrieving TelemetryOS user information.
|
|
154
|
-
* @returns The Users API object
|
|
155
|
-
* @throws {Error} If called before configure() or after destroy()
|
|
156
|
-
*/
|
|
157
|
-
export declare function users(): import("@telemetryos/root-sdk").Users;
|
|
158
146
|
/**
|
|
159
147
|
* Provides access to the data storage API with multiple persistence scopes.
|
|
160
148
|
*
|
|
@@ -195,6 +183,24 @@ export declare function applications(): import("@telemetryos/root-sdk").Applicat
|
|
|
195
183
|
* @throws {Error} If called before configure() or after destroy()
|
|
196
184
|
*/
|
|
197
185
|
export declare function media(): import("@telemetryos/root-sdk").Media;
|
|
186
|
+
/**
|
|
187
|
+
* Provides access to the accounts API for retrieving TelemetryOS account information.
|
|
188
|
+
* @returns The Accounts API object
|
|
189
|
+
* @throws {Error} If called before configure() or after destroy()
|
|
190
|
+
*/
|
|
191
|
+
export declare function accounts(): import("@telemetryos/root-sdk").Accounts;
|
|
192
|
+
/**
|
|
193
|
+
* Provides access to the users API for retrieving TelemetryOS user information.
|
|
194
|
+
* @returns The Users API object
|
|
195
|
+
* @throws {Error} If called before configure() or after destroy()
|
|
196
|
+
*/
|
|
197
|
+
export declare function users(): import("@telemetryos/root-sdk").Users;
|
|
198
|
+
/**
|
|
199
|
+
* Provides access to the devices API for retrieving TelemetryOS device information.
|
|
200
|
+
* @returns The Devices API object
|
|
201
|
+
* @throws {Error} If called before configure() or after destroy()
|
|
202
|
+
*/
|
|
203
|
+
export declare function devices(): import("@telemetryos/root-sdk").Devices;
|
|
198
204
|
/**
|
|
199
205
|
* Provides access to the proxy API for fetching third-party content through the TelemetryOS API.
|
|
200
206
|
*
|
|
@@ -210,18 +216,18 @@ export declare function media(): import("@telemetryos/root-sdk").Media;
|
|
|
210
216
|
* const data = await response.json();
|
|
211
217
|
*/
|
|
212
218
|
export declare function proxy(): import("@telemetryos/root-sdk").Proxy;
|
|
213
|
-
/**
|
|
214
|
-
* Provides access to the devices API for retrieving TelemetryOS device information.
|
|
215
|
-
* @returns The Devices API object
|
|
216
|
-
* @throws {Error} If called before configure() or after destroy()
|
|
217
|
-
*/
|
|
218
|
-
export declare function devices(): import("@telemetryos/root-sdk").Devices;
|
|
219
219
|
/**
|
|
220
220
|
* Provides access to the weather API for retrieving weather information.
|
|
221
221
|
* @returns The Weather API object
|
|
222
222
|
* @throws {Error} If called before configure() or after destroy()
|
|
223
223
|
*/
|
|
224
224
|
export declare function weather(): import("@telemetryos/root-sdk").Weather;
|
|
225
|
+
/**
|
|
226
|
+
* Provides access to the environment API for accessing environment settings.
|
|
227
|
+
* @returns The Environment API object
|
|
228
|
+
* @throws {Error} If called before configure() or after destroy()
|
|
229
|
+
*/
|
|
230
|
+
export declare function environment(): import("@telemetryos/root-sdk").Environment;
|
|
225
231
|
/**
|
|
226
232
|
* Allows interaction with the current playlist state, providing methods to
|
|
227
233
|
* move forward, or backward a page, or change the current page's duration.
|