@tokmizer/plugin 0.9.68 → 0.9.69

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.
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __tkrCreateRequire } from "node:module"; const require = __tkrCreateRequire(import.meta.url);
3
- var Yr=Object.defineProperty;var w=(t,e,n)=>()=>{if(n)throw n[0];try{return t&&(e=t(t=0)),e}catch(r){throw n=[r],r}};var ke=(t,e)=>{for(var n in e)Yr(t,n,{get:e[n],enumerable:!0})};import an from"node:os";import{join as J}from"node:path";function S(){return process.env.TOKMIZER_HOME||J(an.homedir(),".tokmizer")}function je(){return J(S(),"install-id")}function Ye(){return J(S(),"bundle-refresh.json")}function Je(){return J(S(),"skills")}function re(t){return J(Je(),`${t}.md`)}function kt(){return J(S(),"managed-commands.json")}function qe(){return process.env.TOKMIZER_CLAUDE_COMMANDS_DIR||J(an.homedir(),".claude","commands")}function se(t){return J(qe(),`${t}.md`)}var Z=w(()=>{"use strict"});var v,xt,p,U,ze=w(()=>{(function(t){t.assertEqual=s=>{};function e(s){}t.assertIs=e;function n(s){throw new Error}t.assertNever=n,t.arrayToEnum=s=>{let a={};for(let o of s)a[o]=o;return a},t.getValidEnumValues=s=>{let a=t.objectKeys(s).filter(i=>typeof s[s[i]]!="number"),o={};for(let i of a)o[i]=s[i];return t.objectValues(o)},t.objectValues=s=>t.objectKeys(s).map(function(a){return s[a]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{let a=[];for(let o in s)Object.prototype.hasOwnProperty.call(s,o)&&a.push(o);return a},t.find=(s,a)=>{for(let o of s)if(a(o))return o},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function r(s,a=" | "){return s.map(o=>typeof o=="string"?`'${o}'`:o).join(a)}t.joinValues=r,t.jsonStringifyReplacer=(s,a)=>typeof a=="bigint"?a.toString():a})(v||(v={}));(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(xt||(xt={}));p=v.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),U=t=>{switch(typeof t){case"undefined":return p.undefined;case"string":return p.string;case"number":return Number.isNaN(t)?p.nan:p.number;case"boolean":return p.boolean;case"function":return p.function;case"bigint":return p.bigint;case"symbol":return p.symbol;case"object":return Array.isArray(t)?p.array:t===null?p.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?p.promise:typeof Map<"u"&&t instanceof Map?p.map:typeof Set<"u"&&t instanceof Set?p.set:typeof Date<"u"&&t instanceof Date?p.date:p.object;default:return p.unknown}}});var d,Qr,D,Qe=w(()=>{ze();d=v.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Qr=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),D=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){let n=e||function(a){return a.message},r={_errors:[]},s=a=>{for(let o of a.issues)if(o.code==="invalid_union")o.unionErrors.map(s);else if(o.code==="invalid_return_type")s(o.returnTypeError);else if(o.code==="invalid_arguments")s(o.argumentsError);else if(o.path.length===0)r._errors.push(n(o));else{let i=r,c=0;for(;c<o.path.length;){let u=o.path[c];c===o.path.length-1?(i[u]=i[u]||{_errors:[]},i[u]._errors.push(n(o))):i[u]=i[u]||{_errors:[]},i=i[u],c++}}};return s(this),r}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,v.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){let n={},r=[];for(let s of this.issues)if(s.path.length>0){let a=s.path[0];n[a]=n[a]||[],n[a].push(e(s))}else r.push(e(s));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}};D.create=t=>new D(t)});var Xr,K,wt=w(()=>{Qe();ze();Xr=(t,e)=>{let n;switch(t.code){case d.invalid_type:t.received===p.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case d.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,v.jsonStringifyReplacer)}`;break;case d.unrecognized_keys:n=`Unrecognized key(s) in object: ${v.joinValues(t.keys,", ")}`;break;case d.invalid_union:n="Invalid input";break;case d.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${v.joinValues(t.options)}`;break;case d.invalid_enum_value:n=`Invalid enum value. Expected ${v.joinValues(t.options)}, received '${t.received}'`;break;case d.invalid_arguments:n="Invalid function arguments";break;case d.invalid_return_type:n="Invalid function return type";break;case d.invalid_date:n="Invalid date";break;case d.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:v.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case d.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case d.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case d.custom:n="Invalid input";break;case d.invalid_intersection_types:n="Intersection results could not be merged";break;case d.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case d.not_finite:n="Number must be finite";break;default:n=e.defaultError,v.assertNever(t)}return{message:n}},K=Xr});function es(t){cn=t}function xe(){return cn}var cn,Xe=w(()=>{wt();cn=K});function f(t,e){let n=xe(),r=Ze({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===K?void 0:K].filter(s=>!!s)});t.common.issues.push(r)}var Ze,ts,$,h,ae,R,et,tt,q,we,St=w(()=>{Xe();wt();Ze=t=>{let{data:e,path:n,errorMaps:r,issueData:s}=t,a=[...n,...s.path||[]],o={...s,path:a};if(s.message!==void 0)return{...s,path:a,message:s.message};let i="",c=r.filter(u=>!!u).slice().reverse();for(let u of c)i=u(o,{data:e,defaultError:i}).message;return{...s,path:a,message:i}},ts=[];$=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){let r=[];for(let s of n){if(s.status==="aborted")return h;s.status==="dirty"&&e.dirty(),r.push(s.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){let r=[];for(let s of n){let a=await s.key,o=await s.value;r.push({key:a,value:o})}return t.mergeObjectSync(e,r)}static mergeObjectSync(e,n){let r={};for(let s of n){let{key:a,value:o}=s;if(a.status==="aborted"||o.status==="aborted")return h;a.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof o.value<"u"||s.alwaysSet)&&(r[a.value]=o.value)}return{status:e.value,value:r}}},h=Object.freeze({status:"aborted"}),ae=t=>({status:"dirty",value:t}),R=t=>({status:"valid",value:t}),et=t=>t.status==="aborted",tt=t=>t.status==="dirty",q=t=>t.status==="valid",we=t=>typeof Promise<"u"&&t instanceof Promise});var un=w(()=>{});var m,dn=w(()=>{(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(m||(m={}))});function _(t){if(!t)return{};let{errorMap:e,invalid_type_error:n,required_error:r,description:s}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(o,i)=>{let{message:c}=t;return o.code==="invalid_enum_value"?{message:c??i.defaultError}:typeof i.data>"u"?{message:c??r??i.defaultError}:o.code!=="invalid_type"?{message:i.defaultError}:{message:c??n??i.defaultError}},description:s}}function mn(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}function _s(t){return new RegExp(`^${mn(t)}$`)}function hn(t){let e=`${pn}T${mn(t)}`,n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function bs(t,e){return!!((e==="v4"||!e)&&ls.test(t)||(e==="v6"||!e)&&ps.test(t))}function vs(t,e){if(!is.test(t))return!1;try{let[n]=t.split(".");if(!n)return!1;let r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),s=JSON.parse(atob(r));return!(typeof s!="object"||s===null||"typ"in s&&s?.typ!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function ks(t,e){return!!((e==="v4"||!e)&&fs.test(t)||(e==="v6"||!e)&&ms.test(t))}function xs(t,e){let n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,s=n>r?n:r,a=Number.parseInt(t.toFixed(s).replace(".","")),o=Number.parseInt(e.toFixed(s).replace(".",""));return a%o/10**s}function Se(t){if(t instanceof I){let e={};for(let n in t.shape){let r=t.shape[n];e[n]=P.create(Se(r))}return new I({...t._def,shape:()=>e})}else return t instanceof G?new G({...t._def,type:Se(t.element)}):t instanceof P?P.create(Se(t.unwrap())):t instanceof B?B.create(Se(t.unwrap())):t instanceof V?V.create(t.items.map(e=>Se(e))):t}function Et(t,e){let n=U(t),r=U(e);if(t===e)return{valid:!0,data:t};if(n===p.object&&r===p.object){let s=v.objectKeys(e),a=v.objectKeys(t).filter(i=>s.indexOf(i)!==-1),o={...t,...e};for(let i of a){let c=Et(t[i],e[i]);if(!c.valid)return{valid:!1};o[i]=c.data}return{valid:!0,data:o}}else if(n===p.array&&r===p.array){if(t.length!==e.length)return{valid:!1};let s=[];for(let a=0;a<t.length;a++){let o=t[a],i=e[a],c=Et(o,i);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return n===p.date&&r===p.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}function gn(t,e){return new ge({values:t,typeName:g.ZodEnum,..._(e)})}function fn(t,e){let n=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof n=="string"?{message:n}:n}function yn(t,e={},n){return t?X.create().superRefine((r,s)=>{let a=t(r);if(a instanceof Promise)return a.then(o=>{if(!o){let i=fn(e,r),c=i.fatal??n??!0;s.addIssue({code:"custom",...i,fatal:c})}});if(!a){let o=fn(e,r),i=o.fatal??n??!0;s.addIssue({code:"custom",...o,fatal:i})}}):X.create()}var M,ln,b,ns,rs,ss,as,os,is,cs,us,ds,Tt,ls,fs,ps,ms,hs,gs,pn,ys,Q,oe,ie,ce,ue,Te,de,le,X,W,L,Ee,G,I,fe,H,nt,pe,V,rt,Ae,$e,st,me,he,ge,ye,ee,j,P,B,_e,be,Re,ws,Le,Fe,ve,Ss,g,Ts,_n,bn,Es,As,vn,$s,Rs,Cs,Os,Ns,Ds,Is,Ps,Ms,js,zs,Zs,Ls,Fs,Us,Vs,Bs,Ks,Hs,Ws,Gs,Ys,Js,qs,Qs,Xs,ea,ta,na,ra,sa,aa,oa,ia,kn=w(()=>{Qe();Xe();dn();St();ze();M=class{constructor(e,n,r,s){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},ln=(t,e)=>{if(q(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let n=new D(t.common.issues);return this._error=n,this._error}}};b=class{get description(){return this._def.description}_getType(e){return U(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:U(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new $,ctx:{common:e.parent.common,data:e.data,parsedType:U(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let n=this._parse(e);if(we(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){let n=this._parse(e);return Promise.resolve(n)}parse(e,n){let r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){let r={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:U(e)},s=this._parseSync({data:e,path:r.path,parent:r});return ln(r,s)}"~validate"(e){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:U(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:n});return q(r)?{value:r.value}:{issues:n.common.issues}}catch(r){r?.message?.toLowerCase()?.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,n){let r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){let r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:U(e)},s=this._parse({data:e,path:r.path,parent:r}),a=await(we(s)?s:Promise.resolve(s));return ln(r,a)}refine(e,n){let r=s=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(s):n;return this._refinement((s,a)=>{let o=e(s),i=()=>a.addIssue({code:d.custom,...r(s)});return typeof Promise<"u"&&o instanceof Promise?o.then(c=>c?!0:(i(),!1)):o?!0:(i(),!1)})}refinement(e,n){return this._refinement((r,s)=>e(r)?!0:(s.addIssue(typeof n=="function"?n(r,s):n),!1))}_refinement(e){return new j({schema:this,typeName:g.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:n=>this["~validate"](n)}}optional(){return P.create(this,this._def)}nullable(){return B.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return G.create(this)}promise(){return ee.create(this,this._def)}or(e){return fe.create([this,e],this._def)}and(e){return pe.create(this,e,this._def)}transform(e){return new j({..._(this._def),schema:this,typeName:g.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let n=typeof e=="function"?e:()=>e;return new _e({..._(this._def),innerType:this,defaultValue:n,typeName:g.ZodDefault})}brand(){return new Le({typeName:g.ZodBranded,type:this,..._(this._def)})}catch(e){let n=typeof e=="function"?e:()=>e;return new be({..._(this._def),innerType:this,catchValue:n,typeName:g.ZodCatch})}describe(e){let n=this.constructor;return new n({...this._def,description:e})}pipe(e){return Fe.create(this,e)}readonly(){return ve.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},ns=/^c[^\s-]{8,}$/i,rs=/^[0-9a-z]+$/,ss=/^[0-9A-HJKMNP-TV-Z]{26}$/i,as=/^[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,os=/^[a-z0-9_-]{21}$/i,is=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,cs=/^[-+]?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)?)??$/,us=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ds="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",ls=/^(?:(?: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])$/,fs=/^(?:(?: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])$/,ps=/^(([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]))$/,ms=/^(([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])$/,hs=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,gs=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,pn="((\\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])))",ys=new RegExp(`^${pn}$`);Q=class t extends b{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==p.string){let a=this._getOrReturnCtx(e);return f(a,{code:d.invalid_type,expected:p.string,received:a.parsedType}),h}let r=new $,s;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(s=this._getOrReturnCtx(e,s),f(s,{code:d.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="max")e.data.length>a.value&&(s=this._getOrReturnCtx(e,s),f(s,{code:d.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="length"){let o=e.data.length>a.value,i=e.data.length<a.value;(o||i)&&(s=this._getOrReturnCtx(e,s),o?f(s,{code:d.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):i&&f(s,{code:d.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),r.dirty())}else if(a.kind==="email")us.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"email",code:d.invalid_string,message:a.message}),r.dirty());else if(a.kind==="emoji")Tt||(Tt=new RegExp(ds,"u")),Tt.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"emoji",code:d.invalid_string,message:a.message}),r.dirty());else if(a.kind==="uuid")as.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"uuid",code:d.invalid_string,message:a.message}),r.dirty());else if(a.kind==="nanoid")os.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"nanoid",code:d.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid")ns.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"cuid",code:d.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid2")rs.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"cuid2",code:d.invalid_string,message:a.message}),r.dirty());else if(a.kind==="ulid")ss.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"ulid",code:d.invalid_string,message:a.message}),r.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),f(s,{validation:"url",code:d.invalid_string,message:a.message}),r.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"regex",code:d.invalid_string,message:a.message}),r.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(s=this._getOrReturnCtx(e,s),f(s,{code:d.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),r.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(s=this._getOrReturnCtx(e,s),f(s,{code:d.invalid_string,validation:{startsWith:a.value},message:a.message}),r.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(s=this._getOrReturnCtx(e,s),f(s,{code:d.invalid_string,validation:{endsWith:a.value},message:a.message}),r.dirty()):a.kind==="datetime"?hn(a).test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{code:d.invalid_string,validation:"datetime",message:a.message}),r.dirty()):a.kind==="date"?ys.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{code:d.invalid_string,validation:"date",message:a.message}),r.dirty()):a.kind==="time"?_s(a).test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{code:d.invalid_string,validation:"time",message:a.message}),r.dirty()):a.kind==="duration"?cs.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"duration",code:d.invalid_string,message:a.message}),r.dirty()):a.kind==="ip"?bs(e.data,a.version)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"ip",code:d.invalid_string,message:a.message}),r.dirty()):a.kind==="jwt"?vs(e.data,a.alg)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"jwt",code:d.invalid_string,message:a.message}),r.dirty()):a.kind==="cidr"?ks(e.data,a.version)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"cidr",code:d.invalid_string,message:a.message}),r.dirty()):a.kind==="base64"?hs.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"base64",code:d.invalid_string,message:a.message}),r.dirty()):a.kind==="base64url"?gs.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"base64url",code:d.invalid_string,message:a.message}),r.dirty()):v.assertNever(a);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(s=>e.test(s),{validation:n,code:d.invalid_string,...m.errToObj(r)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...m.errToObj(e)})}url(e){return this._addCheck({kind:"url",...m.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...m.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...m.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...m.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...m.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...m.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...m.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...m.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...m.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...m.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...m.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...m.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...m.errToObj(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?.precision>"u"?null:e?.precision,...m.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...m.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...m.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n?.position,...m.errToObj(n?.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...m.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...m.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...m.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...m.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...m.errToObj(n)})}nonempty(e){return this.min(1,m.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...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(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};Q.create=t=>new Q({checks:[],typeName:g.ZodString,coerce:t?.coerce??!1,..._(t)});oe=class t extends b{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)!==p.number){let a=this._getOrReturnCtx(e);return f(a,{code:d.invalid_type,expected:p.number,received:a.parsedType}),h}let r,s=new $;for(let a of this._def.checks)a.kind==="int"?v.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{code:d.invalid_type,expected:"integer",received:"float",message:a.message}),s.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(r=this._getOrReturnCtx(e,r),f(r,{code:d.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(r=this._getOrReturnCtx(e,r),f(r,{code:d.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?xs(e.data,a.value)!==0&&(r=this._getOrReturnCtx(e,r),f(r,{code:d.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{code:d.not_finite,message:a.message}),s.dirty()):v.assertNever(a);return{status:s.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,m.toString(n))}gt(e,n){return this.setLimit("min",e,!1,m.toString(n))}lte(e,n){return this.setLimit("max",e,!0,m.toString(n))}lt(e,n){return this.setLimit("max",e,!1,m.toString(n))}setLimit(e,n,r,s){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:m.toString(s)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:m.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:m.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:m.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:m.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:m.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:m.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:m.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:m.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:m.toString(e)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&v.isInteger(e.value))}get isFinite(){let e=null,n=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}};oe.create=t=>new oe({checks:[],typeName:g.ZodNumber,coerce:t?.coerce||!1,..._(t)});ie=class t extends b{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)!==p.bigint)return this._getInvalidInput(e);let r,s=new $;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(r=this._getOrReturnCtx(e,r),f(r,{code:d.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(r=this._getOrReturnCtx(e,r),f(r,{code:d.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),f(r,{code:d.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):v.assertNever(a);return{status:s.value,value:e.data}}_getInvalidInput(e){let n=this._getOrReturnCtx(e);return f(n,{code:d.invalid_type,expected:p.bigint,received:n.parsedType}),h}gte(e,n){return this.setLimit("min",e,!0,m.toString(n))}gt(e,n){return this.setLimit("min",e,!1,m.toString(n))}lte(e,n){return this.setLimit("max",e,!0,m.toString(n))}lt(e,n){return this.setLimit("max",e,!1,m.toString(n))}setLimit(e,n,r,s){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:m.toString(s)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:m.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:m.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:m.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:m.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:m.toString(n)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};ie.create=t=>new ie({checks:[],typeName:g.ZodBigInt,coerce:t?.coerce??!1,..._(t)});ce=class extends b{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==p.boolean){let r=this._getOrReturnCtx(e);return f(r,{code:d.invalid_type,expected:p.boolean,received:r.parsedType}),h}return R(e.data)}};ce.create=t=>new ce({typeName:g.ZodBoolean,coerce:t?.coerce||!1,..._(t)});ue=class t extends b{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==p.date){let a=this._getOrReturnCtx(e);return f(a,{code:d.invalid_type,expected:p.date,received:a.parsedType}),h}if(Number.isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return f(a,{code:d.invalid_date}),h}let r=new $,s;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(s=this._getOrReturnCtx(e,s),f(s,{code:d.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),r.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(s=this._getOrReturnCtx(e,s),f(s,{code:d.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),r.dirty()):v.assertNever(a);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:m.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:m.toString(n)})}get minDate(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}};ue.create=t=>new ue({checks:[],coerce:t?.coerce||!1,typeName:g.ZodDate,..._(t)});Te=class extends b{_parse(e){if(this._getType(e)!==p.symbol){let r=this._getOrReturnCtx(e);return f(r,{code:d.invalid_type,expected:p.symbol,received:r.parsedType}),h}return R(e.data)}};Te.create=t=>new Te({typeName:g.ZodSymbol,..._(t)});de=class extends b{_parse(e){if(this._getType(e)!==p.undefined){let r=this._getOrReturnCtx(e);return f(r,{code:d.invalid_type,expected:p.undefined,received:r.parsedType}),h}return R(e.data)}};de.create=t=>new de({typeName:g.ZodUndefined,..._(t)});le=class extends b{_parse(e){if(this._getType(e)!==p.null){let r=this._getOrReturnCtx(e);return f(r,{code:d.invalid_type,expected:p.null,received:r.parsedType}),h}return R(e.data)}};le.create=t=>new le({typeName:g.ZodNull,..._(t)});X=class extends b{constructor(){super(...arguments),this._any=!0}_parse(e){return R(e.data)}};X.create=t=>new X({typeName:g.ZodAny,..._(t)});W=class extends b{constructor(){super(...arguments),this._unknown=!0}_parse(e){return R(e.data)}};W.create=t=>new W({typeName:g.ZodUnknown,..._(t)});L=class extends b{_parse(e){let n=this._getOrReturnCtx(e);return f(n,{code:d.invalid_type,expected:p.never,received:n.parsedType}),h}};L.create=t=>new L({typeName:g.ZodNever,..._(t)});Ee=class extends b{_parse(e){if(this._getType(e)!==p.undefined){let r=this._getOrReturnCtx(e);return f(r,{code:d.invalid_type,expected:p.void,received:r.parsedType}),h}return R(e.data)}};Ee.create=t=>new Ee({typeName:g.ZodVoid,..._(t)});G=class t extends b{_parse(e){let{ctx:n,status:r}=this._processInputParams(e),s=this._def;if(n.parsedType!==p.array)return f(n,{code:d.invalid_type,expected:p.array,received:n.parsedType}),h;if(s.exactLength!==null){let o=n.data.length>s.exactLength.value,i=n.data.length<s.exactLength.value;(o||i)&&(f(n,{code:o?d.too_big:d.too_small,minimum:i?s.exactLength.value:void 0,maximum:o?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&n.data.length<s.minLength.value&&(f(n,{code:d.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&n.data.length>s.maxLength.value&&(f(n,{code:d.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,i)=>s.type._parseAsync(new M(n,o,n.path,i)))).then(o=>$.mergeArray(r,o));let a=[...n.data].map((o,i)=>s.type._parseSync(new M(n,o,n.path,i)));return $.mergeArray(r,a)}get element(){return this._def.type}min(e,n){return new t({...this._def,minLength:{value:e,message:m.toString(n)}})}max(e,n){return new t({...this._def,maxLength:{value:e,message:m.toString(n)}})}length(e,n){return new t({...this._def,exactLength:{value:e,message:m.toString(n)}})}nonempty(e){return this.min(1,e)}};G.create=(t,e)=>new G({type:t,minLength:null,maxLength:null,exactLength:null,typeName:g.ZodArray,..._(e)});I=class t extends b{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),n=v.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==p.object){let u=this._getOrReturnCtx(e);return f(u,{code:d.invalid_type,expected:p.object,received:u.parsedType}),h}let{status:r,ctx:s}=this._processInputParams(e),{shape:a,keys:o}=this._getCached(),i=[];if(!(this._def.catchall instanceof L&&this._def.unknownKeys==="strip"))for(let u in s.data)o.includes(u)||i.push(u);let c=[];for(let u of o){let l=a[u],y=s.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new M(s,y,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof L){let u=this._def.unknownKeys;if(u==="passthrough")for(let l of i)c.push({key:{status:"valid",value:l},value:{status:"valid",value:s.data[l]}});else if(u==="strict")i.length>0&&(f(s,{code:d.unrecognized_keys,keys:i}),r.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let l of i){let y=s.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new M(s,y,s.path,l)),alwaysSet:l in s.data})}}return s.common.async?Promise.resolve().then(async()=>{let u=[];for(let l of c){let y=await l.key,k=await l.value;u.push({key:y,value:k,alwaysSet:l.alwaysSet})}return u}).then(u=>$.mergeObjectSync(r,u)):$.mergeObjectSync(r,c)}get shape(){return this._def.shape()}strict(e){return m.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{let s=this._def.errorMap?.(n,r).message??r.defaultError;return n.code==="unrecognized_keys"?{message:m.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:g.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let n={};for(let r of v.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new t({...this._def,shape:()=>n})}omit(e){let n={};for(let r of v.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new t({...this._def,shape:()=>n})}deepPartial(){return Se(this)}partial(e){let n={};for(let r of v.objectKeys(this.shape)){let s=this.shape[r];e&&!e[r]?n[r]=s:n[r]=s.optional()}return new t({...this._def,shape:()=>n})}required(e){let n={};for(let r of v.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let a=this.shape[r];for(;a instanceof P;)a=a._def.innerType;n[r]=a}return new t({...this._def,shape:()=>n})}keyof(){return gn(v.objectKeys(this.shape))}};I.create=(t,e)=>new I({shape:()=>t,unknownKeys:"strip",catchall:L.create(),typeName:g.ZodObject,..._(e)});I.strictCreate=(t,e)=>new I({shape:()=>t,unknownKeys:"strict",catchall:L.create(),typeName:g.ZodObject,..._(e)});I.lazycreate=(t,e)=>new I({shape:t,unknownKeys:"strip",catchall:L.create(),typeName:g.ZodObject,..._(e)});fe=class extends b{_parse(e){let{ctx:n}=this._processInputParams(e),r=this._def.options;function s(a){for(let i of a)if(i.result.status==="valid")return i.result;for(let i of a)if(i.result.status==="dirty")return n.common.issues.push(...i.ctx.common.issues),i.result;let o=a.map(i=>new D(i.ctx.common.issues));return f(n,{code:d.invalid_union,unionErrors:o}),h}if(n.common.async)return Promise.all(r.map(async a=>{let o={...n,common:{...n.common,issues:[]},parent:null};return{result:await a._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(s);{let a,o=[];for(let c of r){let u={...n,common:{...n.common,issues:[]},parent:null},l=c._parseSync({data:n.data,path:n.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!a&&(a={result:l,ctx:u}),u.common.issues.length&&o.push(u.common.issues)}if(a)return n.common.issues.push(...a.ctx.common.issues),a.result;let i=o.map(c=>new D(c));return f(n,{code:d.invalid_union,unionErrors:i}),h}}get options(){return this._def.options}};fe.create=(t,e)=>new fe({options:t,typeName:g.ZodUnion,..._(e)});H=t=>t instanceof me?H(t.schema):t instanceof j?H(t.innerType()):t instanceof he?[t.value]:t instanceof ge?t.options:t instanceof ye?v.objectValues(t.enum):t instanceof _e?H(t._def.innerType):t instanceof de?[void 0]:t instanceof le?[null]:t instanceof P?[void 0,...H(t.unwrap())]:t instanceof B?[null,...H(t.unwrap())]:t instanceof Le||t instanceof ve?H(t.unwrap()):t instanceof be?H(t._def.innerType):[],nt=class t extends b{_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==p.object)return f(n,{code:d.invalid_type,expected:p.object,received:n.parsedType}),h;let r=this.discriminator,s=n.data[r],a=this.optionsMap.get(s);return a?n.common.async?a._parseAsync({data:n.data,path:n.path,parent:n}):a._parseSync({data:n.data,path:n.path,parent:n}):(f(n,{code:d.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),h)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){let s=new Map;for(let a of n){let o=H(a.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of o){if(s.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);s.set(i,a)}}return new t({typeName:g.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:s,..._(r)})}};pe=class extends b{_parse(e){let{status:n,ctx:r}=this._processInputParams(e),s=(a,o)=>{if(et(a)||et(o))return h;let i=Et(a.value,o.value);return i.valid?((tt(a)||tt(o))&&n.dirty(),{status:n.value,value:i.data}):(f(r,{code:d.invalid_intersection_types}),h)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([a,o])=>s(a,o)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};pe.create=(t,e,n)=>new pe({left:t,right:e,typeName:g.ZodIntersection,..._(n)});V=class t extends b{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==p.array)return f(r,{code:d.invalid_type,expected:p.array,received:r.parsedType}),h;if(r.data.length<this._def.items.length)return f(r,{code:d.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),h;!this._def.rest&&r.data.length>this._def.items.length&&(f(r,{code:d.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let a=[...r.data].map((o,i)=>{let c=this._def.items[i]||this._def.rest;return c?c._parse(new M(r,o,r.path,i)):null}).filter(o=>!!o);return r.common.async?Promise.all(a).then(o=>$.mergeArray(n,o)):$.mergeArray(n,a)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};V.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new V({items:t,typeName:g.ZodTuple,rest:null,..._(e)})};rt=class t extends b{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==p.object)return f(r,{code:d.invalid_type,expected:p.object,received:r.parsedType}),h;let s=[],a=this._def.keyType,o=this._def.valueType;for(let i in r.data)s.push({key:a._parse(new M(r,i,r.path,i)),value:o._parse(new M(r,r.data[i],r.path,i)),alwaysSet:i in r.data});return r.common.async?$.mergeObjectAsync(n,s):$.mergeObjectSync(n,s)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof b?new t({keyType:e,valueType:n,typeName:g.ZodRecord,..._(r)}):new t({keyType:Q.create(),valueType:e,typeName:g.ZodRecord,..._(n)})}},Ae=class extends b{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==p.map)return f(r,{code:d.invalid_type,expected:p.map,received:r.parsedType}),h;let s=this._def.keyType,a=this._def.valueType,o=[...r.data.entries()].map(([i,c],u)=>({key:s._parse(new M(r,i,r.path,[u,"key"])),value:a._parse(new M(r,c,r.path,[u,"value"]))}));if(r.common.async){let i=new Map;return Promise.resolve().then(async()=>{for(let c of o){let u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return h;(u.status==="dirty"||l.status==="dirty")&&n.dirty(),i.set(u.value,l.value)}return{status:n.value,value:i}})}else{let i=new Map;for(let c of o){let u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return h;(u.status==="dirty"||l.status==="dirty")&&n.dirty(),i.set(u.value,l.value)}return{status:n.value,value:i}}}};Ae.create=(t,e,n)=>new Ae({valueType:e,keyType:t,typeName:g.ZodMap,..._(n)});$e=class t extends b{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==p.set)return f(r,{code:d.invalid_type,expected:p.set,received:r.parsedType}),h;let s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(f(r,{code:d.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),n.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(f(r,{code:d.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),n.dirty());let a=this._def.valueType;function o(c){let u=new Set;for(let l of c){if(l.status==="aborted")return h;l.status==="dirty"&&n.dirty(),u.add(l.value)}return{status:n.value,value:u}}let i=[...r.data.values()].map((c,u)=>a._parse(new M(r,c,r.path,u)));return r.common.async?Promise.all(i).then(c=>o(c)):o(i)}min(e,n){return new t({...this._def,minSize:{value:e,message:m.toString(n)}})}max(e,n){return new t({...this._def,maxSize:{value:e,message:m.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}};$e.create=(t,e)=>new $e({valueType:t,minSize:null,maxSize:null,typeName:g.ZodSet,..._(e)});st=class t extends b{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==p.function)return f(n,{code:d.invalid_type,expected:p.function,received:n.parsedType}),h;function r(i,c){return Ze({data:i,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,xe(),K].filter(u=>!!u),issueData:{code:d.invalid_arguments,argumentsError:c}})}function s(i,c){return Ze({data:i,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,xe(),K].filter(u=>!!u),issueData:{code:d.invalid_return_type,returnTypeError:c}})}let a={errorMap:n.common.contextualErrorMap},o=n.data;if(this._def.returns instanceof ee){let i=this;return R(async function(...c){let u=new D([]),l=await i._def.args.parseAsync(c,a).catch(T=>{throw u.addIssue(r(c,T)),u}),y=await Reflect.apply(o,this,l);return await i._def.returns._def.type.parseAsync(y,a).catch(T=>{throw u.addIssue(s(y,T)),u})})}else{let i=this;return R(function(...c){let u=i._def.args.safeParse(c,a);if(!u.success)throw new D([r(c,u.error)]);let l=Reflect.apply(o,this,u.data),y=i._def.returns.safeParse(l,a);if(!y.success)throw new D([s(l,y.error)]);return y.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:V.create(e).rest(W.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new t({args:e||V.create([]).rest(W.create()),returns:n||W.create(),typeName:g.ZodFunction,..._(r)})}},me=class extends b{get schema(){return this._def.getter()}_parse(e){let{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};me.create=(t,e)=>new me({getter:t,typeName:g.ZodLazy,..._(e)});he=class extends b{_parse(e){if(e.data!==this._def.value){let n=this._getOrReturnCtx(e);return f(n,{received:n.data,code:d.invalid_literal,expected:this._def.value}),h}return{status:"valid",value:e.data}}get value(){return this._def.value}};he.create=(t,e)=>new he({value:t,typeName:g.ZodLiteral,..._(e)});ge=class t extends b{_parse(e){if(typeof e.data!="string"){let n=this._getOrReturnCtx(e),r=this._def.values;return f(n,{expected:v.joinValues(r),received:n.parsedType,code:d.invalid_type}),h}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let n=this._getOrReturnCtx(e),r=this._def.values;return f(n,{received:n.data,code:d.invalid_enum_value,options:r}),h}return R(e.data)}get options(){return this._def.values}get enum(){let e={};for(let n of this._def.values)e[n]=n;return e}get Values(){let e={};for(let n of this._def.values)e[n]=n;return e}get Enum(){let e={};for(let n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return t.create(e,{...this._def,...n})}exclude(e,n=this._def){return t.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}};ge.create=gn;ye=class extends b{_parse(e){let n=v.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==p.string&&r.parsedType!==p.number){let s=v.objectValues(n);return f(r,{expected:v.joinValues(s),received:r.parsedType,code:d.invalid_type}),h}if(this._cache||(this._cache=new Set(v.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let s=v.objectValues(n);return f(r,{received:r.data,code:d.invalid_enum_value,options:s}),h}return R(e.data)}get enum(){return this._def.values}};ye.create=(t,e)=>new ye({values:t,typeName:g.ZodNativeEnum,..._(e)});ee=class extends b{unwrap(){return this._def.type}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==p.promise&&n.common.async===!1)return f(n,{code:d.invalid_type,expected:p.promise,received:n.parsedType}),h;let r=n.parsedType===p.promise?n.data:Promise.resolve(n.data);return R(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}};ee.create=(t,e)=>new ee({type:t,typeName:g.ZodPromise,..._(e)});j=class extends b{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===g.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:n,ctx:r}=this._processInputParams(e),s=this._def.effect||null,a={addIssue:o=>{f(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(a.addIssue=a.addIssue.bind(a),s.type==="preprocess"){let o=s.transform(r.data,a);if(r.common.async)return Promise.resolve(o).then(async i=>{if(n.value==="aborted")return h;let c=await this._def.schema._parseAsync({data:i,path:r.path,parent:r});return c.status==="aborted"?h:c.status==="dirty"?ae(c.value):n.value==="dirty"?ae(c.value):c});{if(n.value==="aborted")return h;let i=this._def.schema._parseSync({data:o,path:r.path,parent:r});return i.status==="aborted"?h:i.status==="dirty"?ae(i.value):n.value==="dirty"?ae(i.value):i}}if(s.type==="refinement"){let o=i=>{let c=s.refinement(i,a);if(r.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return i};if(r.common.async===!1){let i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?h:(i.status==="dirty"&&n.dirty(),o(i.value),{status:n.value,value:i.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(i=>i.status==="aborted"?h:(i.status==="dirty"&&n.dirty(),o(i.value).then(()=>({status:n.value,value:i.value}))))}if(s.type==="transform")if(r.common.async===!1){let o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!q(o))return h;let i=s.transform(o.value,a);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:i}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>q(o)?Promise.resolve(s.transform(o.value,a)).then(i=>({status:n.value,value:i})):h);v.assertNever(s)}};j.create=(t,e,n)=>new j({schema:t,typeName:g.ZodEffects,effect:e,..._(n)});j.createWithPreprocess=(t,e,n)=>new j({schema:e,effect:{type:"preprocess",transform:t},typeName:g.ZodEffects,..._(n)});P=class extends b{_parse(e){return this._getType(e)===p.undefined?R(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};P.create=(t,e)=>new P({innerType:t,typeName:g.ZodOptional,..._(e)});B=class extends b{_parse(e){return this._getType(e)===p.null?R(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};B.create=(t,e)=>new B({innerType:t,typeName:g.ZodNullable,..._(e)});_e=class extends b{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return n.parsedType===p.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};_e.create=(t,e)=>new _e({innerType:t,typeName:g.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,..._(e)});be=class extends b{_parse(e){let{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return we(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new D(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new D(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};be.create=(t,e)=>new be({innerType:t,typeName:g.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,..._(e)});Re=class extends b{_parse(e){if(this._getType(e)!==p.nan){let r=this._getOrReturnCtx(e);return f(r,{code:d.invalid_type,expected:p.nan,received:r.parsedType}),h}return{status:"valid",value:e.data}}};Re.create=t=>new Re({typeName:g.ZodNaN,..._(t)});ws=Symbol("zod_brand"),Le=class extends b{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}},Fe=class t extends b{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let a=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?h:a.status==="dirty"?(n.dirty(),ae(a.value)):this._def.out._parseAsync({data:a.value,path:r.path,parent:r})})();{let s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?h:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(e,n){return new t({in:e,out:n,typeName:g.ZodPipeline})}},ve=class extends b{_parse(e){let n=this._def.innerType._parse(e),r=s=>(q(s)&&(s.value=Object.freeze(s.value)),s);return we(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}};ve.create=(t,e)=>new ve({innerType:t,typeName:g.ZodReadonly,..._(e)});Ss={object:I.lazycreate};(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(g||(g={}));Ts=(t,e={message:`Input not instance of ${t.name}`})=>yn(n=>n instanceof t,e),_n=Q.create,bn=oe.create,Es=Re.create,As=ie.create,vn=ce.create,$s=ue.create,Rs=Te.create,Cs=de.create,Os=le.create,Ns=X.create,Ds=W.create,Is=L.create,Ps=Ee.create,Ms=G.create,js=I.create,zs=I.strictCreate,Zs=fe.create,Ls=nt.create,Fs=pe.create,Us=V.create,Vs=rt.create,Bs=Ae.create,Ks=$e.create,Hs=st.create,Ws=me.create,Gs=he.create,Ys=ge.create,Js=ye.create,qs=ee.create,Qs=j.create,Xs=P.create,ea=B.create,ta=j.createWithPreprocess,na=Fe.create,ra=()=>_n().optional(),sa=()=>bn().optional(),aa=()=>vn().optional(),oa={string:(t=>Q.create({...t,coerce:!0})),number:(t=>oe.create({...t,coerce:!0})),boolean:(t=>ce.create({...t,coerce:!0})),bigint:(t=>ie.create({...t,coerce:!0})),date:(t=>ue.create({...t,coerce:!0}))},ia=h});var z={};ke(z,{BRAND:()=>ws,DIRTY:()=>ae,EMPTY_PATH:()=>ts,INVALID:()=>h,NEVER:()=>ia,OK:()=>R,ParseStatus:()=>$,Schema:()=>b,ZodAny:()=>X,ZodArray:()=>G,ZodBigInt:()=>ie,ZodBoolean:()=>ce,ZodBranded:()=>Le,ZodCatch:()=>be,ZodDate:()=>ue,ZodDefault:()=>_e,ZodDiscriminatedUnion:()=>nt,ZodEffects:()=>j,ZodEnum:()=>ge,ZodError:()=>D,ZodFirstPartyTypeKind:()=>g,ZodFunction:()=>st,ZodIntersection:()=>pe,ZodIssueCode:()=>d,ZodLazy:()=>me,ZodLiteral:()=>he,ZodMap:()=>Ae,ZodNaN:()=>Re,ZodNativeEnum:()=>ye,ZodNever:()=>L,ZodNull:()=>le,ZodNullable:()=>B,ZodNumber:()=>oe,ZodObject:()=>I,ZodOptional:()=>P,ZodParsedType:()=>p,ZodPipeline:()=>Fe,ZodPromise:()=>ee,ZodReadonly:()=>ve,ZodRecord:()=>rt,ZodSchema:()=>b,ZodSet:()=>$e,ZodString:()=>Q,ZodSymbol:()=>Te,ZodTransformer:()=>j,ZodTuple:()=>V,ZodType:()=>b,ZodUndefined:()=>de,ZodUnion:()=>fe,ZodUnknown:()=>W,ZodVoid:()=>Ee,addIssueToContext:()=>f,any:()=>Ns,array:()=>Ms,bigint:()=>As,boolean:()=>vn,coerce:()=>oa,custom:()=>yn,date:()=>$s,datetimeRegex:()=>hn,defaultErrorMap:()=>K,discriminatedUnion:()=>Ls,effect:()=>Qs,enum:()=>Ys,function:()=>Hs,getErrorMap:()=>xe,getParsedType:()=>U,instanceof:()=>Ts,intersection:()=>Fs,isAborted:()=>et,isAsync:()=>we,isDirty:()=>tt,isValid:()=>q,late:()=>Ss,lazy:()=>Ws,literal:()=>Gs,makeIssue:()=>Ze,map:()=>Bs,nan:()=>Es,nativeEnum:()=>Js,never:()=>Is,null:()=>Os,nullable:()=>ea,number:()=>bn,object:()=>js,objectUtil:()=>xt,oboolean:()=>aa,onumber:()=>sa,optional:()=>Xs,ostring:()=>ra,pipeline:()=>na,preprocess:()=>ta,promise:()=>qs,quotelessJson:()=>Qr,record:()=>Vs,set:()=>Ks,setErrorMap:()=>es,strictObject:()=>zs,string:()=>_n,symbol:()=>Rs,transformer:()=>Qs,tuple:()=>Us,undefined:()=>Cs,union:()=>Zs,unknown:()=>Ds,util:()=>v,void:()=>Ps});var At=w(()=>{Xe();St();un();ze();kn();Qe()});var xn=w(()=>{At();At()});var ca,ua,Ce,wn=w(()=>{"use strict";xn();ca=z.enum(["normal","compact","minimal"]),ua=z.enum(["off","light","balanced","max"]),Ce=z.object({enabled:z.boolean().default(!0),telemetryOptIn:z.boolean().default(!0),outputVerbosity:ca.default("compact"),reducer:ua.default("off"),filters:z.object({enableAll:z.boolean().default(!0),disabled:z.array(z.string().max(64)).max(100).default([])}).default({enableAll:!0,disabled:[]})})});var Nn={};ke(Nn,{clearSettingsCache:()=>ha,loadSettingsCache:()=>Ne,saveSettingsCache:()=>On,updateSettingsCache:()=>ma});import{readFile as An,writeFile as $n,mkdir as Rn,chmod as da,rm as Ue,rename as Cn,readdir as la}from"node:fs/promises";import{randomUUID as fa}from"node:crypto";import{join as Oe}from"node:path";import{setTimeout as Sn}from"node:timers/promises";async function Ne(){let t=null;try{let e=JSON.parse(await An(Oe(S(),$t),"utf8"));typeof e=="object"&&e!==null&&!Array.isArray(e)&&(t=e)}catch{}return t?Ce.parse({...Tn,...t}):Tn}async function On(t){await Rn(S(),{recursive:!0});let e=Oe(S(),$t),n=`${e}.tmp-${process.pid}-${process.hrtime.bigint()}`;await $n(n,JSON.stringify(t,null,2),{mode:384});try{await da(n,384),await Cn(n,e)}catch(r){try{await Ue(n,{force:!0})}catch{}throw r}}async function En(t){let e=[];for(let n of await la(t)){let r=/^([1-9]\d*)-[0-9a-f-]{36}\.json$/.exec(n);if(!r)continue;let s=Oe(t,n);try{process.kill(Number(r[1]),0)}catch(a){let o=a.code;if(o==="ESRCH"){await Ue(s,{force:!0});continue}if(o!=="EPERM")throw a}try{let a=JSON.parse(await An(s,"utf8"));if(!Number.isSafeInteger(a)||a<0)throw new Error("Invalid local settings lock");e.push({id:n,ticket:a})}catch(a){if(a.code!=="ENOENT")throw a}}return e}async function ma(t){let e=pa.parse(t),n=Oe(S(),"settings-cache-locks");await Rn(n,{recursive:!0,mode:448});let r=`${process.pid}-${fa()}.json`,s=Oe(n,r),a=`${s}.tmp`,o=performance.now()+3e3,i=async c=>{for(await $n(a,String(c),{mode:384});;)try{await Cn(a,s);return}catch(u){let l=u.code;if(process.platform!=="win32"||l!=="EPERM"&&l!=="EBUSY"||performance.now()>=o)throw u;await Sn(10)}};try{await i(0);let c=Math.max(0,...(await En(n)).map(u=>u.ticket))+1;if(!Number.isSafeInteger(c))throw new Error("Invalid local settings lock");for(await i(c);;){if(!(await En(n)).some(l=>l.id!==r&&(l.ticket===0||l.ticket<c||l.ticket===c&&l.id<r))){let l=await Ne(),y=Ce.parse({...l,...e,filters:{...l.filters,...e.filters}});return await On(y),y}if(performance.now()>=o)throw new Error("Timed out waiting for local settings lock after 3 seconds; another process may still be updating settings");await Sn(10)}}finally{await Promise.all([Ue(s,{force:!0}),Ue(a,{force:!0})])}}async function ha(){try{await Ue(Oe(S(),$t),{force:!0})}catch{}}var $t,Tn,pa,at=w(()=>{"use strict";wn();Z();$t="settings-cache.json",Tn=Ce.parse({}),pa=Ce.partial().extend({filters:Ce.shape.filters.removeDefault().partial().optional()})});var Ln={};ke(Ln,{STATIC_COMMAND_NAMES:()=>ot,commandInstalled:()=>Zn,commandsInstallStatus:()=>Ea,installCommand:()=>Sa,isFresh:()=>ka,pruneCommands:()=>Ta,pruneSkills:()=>wa,readBundleRefresh:()=>$a,readSkill:()=>Ra,recordBundleRefresh:()=>Aa,writeSkill:()=>xa});import{chmod as Rt,mkdir as it,readFile as Ve,writeFile as ct,stat as Ct,readdir as ga,rm as In}from"node:fs/promises";import{existsSync as ya}from"node:fs";import{dirname as _a}from"node:path";async function Mn(){try{let t=JSON.parse(await Ve(kt(),"utf8"));return Array.isArray(t)?t.filter(e=>typeof e=="string"):[]}catch{return[]}}async function jn(t){try{await it(S(),{recursive:!0}),await ct(kt(),JSON.stringify(t),{mode:384})}catch{}}function zn(){let t=Number(process.env.TOKMIZER_MAX_BUNDLE_AGE_MS);return Number.isFinite(t)&&t>0?Math.min(t,Dn):Dn}async function ka(t){try{let e=await Ct(re(t)),n=Date.now()-e.mtimeMs;return n<va&&n<=zn()}catch{return!1}}async function xa(t,e){await it(Je(),{recursive:!0}),await ct(re(t),e,{mode:384}),await Rt(re(t),384)}async function wa(t){let e=new Set(t),n;try{n=await ga(Je())}catch{return}for(let r of n){if(!r.endsWith(".md"))continue;let s=r.slice(0,-3);if(!e.has(s))try{await In(re(s))}catch{}}}async function Sa(t,e){if(!process.env.TOKMIZER_CLAUDE_COMMANDS_DIR&&!ya(_a(qe())))return;await it(qe(),{recursive:!0});try{if(!(await Ve(se(t),"utf8")).includes(Pn))return}catch{}await ct(se(t),e,{mode:384}),await Rt(se(t),384);let n=await Mn();n.includes(t)||await jn([...n,t])}async function Ta(t){let e=new Set([...t,...ot]),n=await Mn(),r=new Set([...n,...ba]);for(let s of r)if(!e.has(s))try{if(!(await Ve(se(s),"utf8")).includes(Pn))continue;await In(se(s))}catch{}await jn(n.filter(s=>e.has(s)))}async function Ea(){let t=0;for(let e of ot)await Zn(e)&&t++;return{installed:t,total:ot.length}}async function Zn(t){try{return await Ct(se(t)),!0}catch{return!1}}async function Aa(t){try{await it(S(),{recursive:!0}),await ct(Ye(),JSON.stringify({at:Date.now(),error:t}),{mode:384}),await Rt(Ye(),384)}catch{}}async function $a(){try{return JSON.parse(await Ve(Ye(),"utf8"))}catch{return null}}async function Ra(t){try{let e=await Ct(re(t));return Date.now()-e.mtimeMs>zn()?null:await Ve(re(t),"utf8")}catch{return null}}var Pn,ot,ba,va,Dn,Fn=w(()=>{"use strict";Z();Pn="managed-by: tokmizer",ot=["tkr","tkr-gain","tkr-status","tkr-link","tkr-unlink","tkr-compression","tkr-telemetry","tkr-update","tkr-yolo"],ba=["power","tkr-reducer"];va=3600*1e3,Dn=10080*60*1e3});import{join as Ca}from"node:path";import{mkdir as Fc,readFile as Oa,writeFile as Uc,unlink as Vc,rename as Bc}from"node:fs/promises";function Da(){try{let t=Intl.DateTimeFormat().resolvedOptions().timeZone;return t&&t.length>0?t:"Etc/UTC"}catch{return"Etc/UTC"}}function Ia(t){return t?.dir??S()}async function ut(t){let e=Ia(t);try{let n=await Oa(Ca(e,Na),"utf8"),r=JSON.parse(n),s=r.timeZone;return{...r,lastSettingsRevision:r.lastSettingsRevision??0,get timeZone(){return s??=Da()},bonusActive:r.bonusActive??!1,...r.bonusResetAt!==void 0?{bonusResetAt:r.bonusResetAt}:{}}}catch{return null}}var Na,Ot=w(()=>{"use strict";Z();Na="state.json"});function Un(t,e=Date.now()){return t.plan}function Vn(t,e=Date.now()){return t.bonusActive??!1}var Bn=w(()=>{"use strict"});function Kn(t,e=!1){return!0}var Hn=w(()=>{"use strict"});var Wn={};ke(Wn,{reducerStillEntitled:()=>Pa});async function Pa(){let t=await ut();return t?Kn(Un(t),Vn(t)):!1}var Gn=w(()=>{"use strict";Ot();Bn();Hn()});function Nt(t){let e=t;for(let[n,r]of Ma)e=e.replace(n,r);return e}var Ma,Y,Qc,Yn=w(()=>{"use strict";Ma=[[/(authorization\s*:\s*)([A-Za-z][A-Za-z0-9._-]*)\s+[^\s'"]+/gi,"$1$2 [REDACTED]"],[/(authorization\s*:\s*)[A-Za-z0-9._\-+/=]{8,}/gi,"$1[REDACTED]"],[/(bearer\s+)[A-Za-z0-9._\-+/=]{8,}/gi,"$1[REDACTED]"],[/((?:^|\s)(?:-b|--cookie)[=\s]+['"]?)[^\s'";=]+=[^\s'";]+(?:\s*;\s*[^\s'";=]+=[^\s'";]+)*/gi,"$1[REDACTED]"],[/((?:^|[\s'"])(?:Set-)?Cookie\s*:\s*)[^\s'";=]+=[^\s'";]+(?:\s*;\s*[^\s'";=]+=[^\s'";]+)*/gi,"$1[REDACTED]"],[/(--?(?:password|passwd|passphrase|apipass|pass|pwd|token|api[-_]?key|secret|bearer|cookie|jwt)(?:-[a-z0-9]+)*[=\s]+)\S+/gi,"$1[REDACTED]"],[/((?:^|\s)-b[=\s]?['"]?)[^\s'"=]+=[^\s'"]+/gi,"$1[REDACTED]"],[/((?:^|\s)(?:-u[=\s]?|(?:--user|-a)[=\s])['"]?[^\s:/'"]*:)(\/[^/\s'"][^\s'"]*|[^\s/'"0-9][^\s'"]*|[0-9][^\s'"]*[^\s'"0-9][^\s'"]*)/gi,"$1[REDACTED]"],[/((?:^|\s)(?:-u[=\s]?|(?:--user|-a)[=\s])['"]?[^\s:/'"]*[^\s:/'"0-9][^\s:/'"]*:)(?:\/[^/\s'"]|[^\s/'"])[^\s'"]*/gi,"$1[REDACTED]"],[/((?:^|\s)(?:-u[=\s]?|(?:--user|-a)[=\s])['"]?:)(?:\/[^/\s'"]|[^\s/'"])[^\s'"]*/gi,"$1[REDACTED]"],[/((?:[A-Za-z0-9]+-){0,8}(?:X-Api-Key|Private-Token|[A-Za-z0-9]+-(?:Token|Key|Auth|Secret))\s*:\s*)[^\s'"]+/gi,"$1[REDACTED]"],[/((?:^|[\s'"])(?:Set-)?Cookie\s*:\s*)[^\s'"]+/gi,"$1[REDACTED]"],[/(-i\s+)(\/[^\s]+|~\/[^\s]+|[A-Z]:\\[^\s]+)/g,"$1[REDACTED]"],[/([a-zA-Z][a-zA-Z0-9+.-]{0,31}:\/\/[^:/\s@]*:)[^\s@]+(@[^@/\s]+)/g,"$1[REDACTED]$2"],[/(AWS_(?:ACCESS_KEY_ID|SECRET_ACCESS_KEY|SESSION_TOKEN)\s*=\s*)\S+/g,"$1[REDACTED]"],[/(GOOGLE_APPLICATION_CREDENTIALS\s*=\s*)\S+/g,"$1[REDACTED]"],[/(AZURE_(?:CLIENT_SECRET|TENANT_ID|CLIENT_ID)\s*=\s*)\S+/g,"$1[REDACTED]"],[/(sk-(?:proj-)?[A-Za-z0-9_-]{20,})/g,"sk-[REDACTED]"],[/\b(OPENAI_API_KEY\s*=\s*)\S+/g,"$1[REDACTED]"],[/\b(ANTHROPIC_API_KEY\s*=\s*)\S+/g,"$1[REDACTED]"],[/(sk-ant-[A-Za-z0-9_-]{20,})/g,"sk-ant-[REDACTED]"],[/\b(GH(?:_|ITHUB_)?TOKEN\s*=\s*)\S+/g,"$1[REDACTED]"],[/\b(GITLAB_TOKEN\s*=\s*)\S+/g,"$1[REDACTED]"],[/\b(SLACK_(?:BOT_)?TOKEN\s*=\s*)\S+/g,"$1[REDACTED]"],[/(xox[bpsoa]-[A-Za-z0-9-]{10,})/g,"xox[REDACTED]"],[/(xapp-[A-Za-z0-9-]{10,})/g,"[REDACTED]"],[/(sk_(?:test|live)_[A-Za-z0-9]{16,})/g,"sk_[REDACTED]"],[/(gh[a-z])_[A-Za-z0-9]{20,}/g,"$1_[REDACTED]"],[/(github_pat)_[A-Za-z0-9_]{20,}/g,"$1_[REDACTED]"],[/(gl(?:pat|rt|soat|imt|dt|ft|agent|oas|cbt|ptt))-[A-Za-z0-9_-]{16,}/g,"$1-[REDACTED]"],[/(npm_[A-Za-z0-9_-]{20,})/g,"npm_[REDACTED]"],[/(?:AKIA|ASIA|AGPA|AIDA|AROA|ANPA)[0-9A-Z]{16,}/g,"[REDACTED_AWS_KEY]"],[/AIza[A-Za-z0-9_-]{35}/g,"[REDACTED_GOOGLE_KEY]"],[/hv[sb]\.[A-Za-z0-9_-]{20,}/g,"[REDACTED_VAULT_TOKEN]"],[/dop_v1_[A-Za-z0-9]{40,}/g,"[REDACTED]"],[/dckr_pat_[A-Za-z0-9_-]{20,}/g,"[REDACTED]"],[/pypi-[A-Za-z0-9_-]{16,}/g,"[REDACTED]"],[/rk_(?:live|test)_[A-Za-z0-9]{16,}/g,"[REDACTED]"],[/whsec_[A-Za-z0-9]{16,}/g,"[REDACTED]"],[/SG\.[A-Za-z0-9_-]{20,}\.[A-Za-z0-9_-]{20,}/g,"[REDACTED]"],[/(eyJ[A-Za-z0-9_-]{6,}(?:\.[A-Za-z0-9_-]{4,}){1,2})/g,"[REDACTED_JWT]"],[/-----BEGIN [A-Z ]*PRIVATE KEY-----(?:[\s\S]*?-----END[^\n]*-----|\r?\n[A-Za-z0-9+/=][A-Za-z0-9+/=\r\n]*)?/g,"[REDACTED_PEM]"],[/\b((?:--?)?[A-Za-z0-9_]*(?:TOKEN|SECRET|PASSWORD|PASSWD|PASS|APIKEY|KEY|CRED|CREDS|CREDENTIAL|CREDENTIALS|AUTH|_PWD)[A-Za-z0-9_]*['"]?\s*=\s*)(?:"[^"]*"|'[^']*'|[^"'\s]\S*)/gi,"$1[REDACTED]"],[/\b([A-Za-z0-9_]*(?:TOKEN|SECRET|PASSWORD|PASSWD|PASS|APIKEY|KEY|CRED|CREDS|CREDENTIAL|CREDENTIALS|_PWD)[A-Za-z0-9_]*['"]?\s*:\s*)(?:"[^"]*"|'[^']*'|[^\s'",}]+)/gi,"$1[REDACTED]"],[/((?:^|[\s'"{,])['"]?(?:[A-Za-z0-9_]+_)?auth['"]?\s*:\s*)(?:"[^"]*"|'[^']*'|[^\s'",}]+)/gi,"$1[REDACTED]"],[/(\bpwd\s*[=:]\s*)(?:"[^"]*"|'[^']*'|[^/~\s][^\s;'"]*)/gi,"$1[REDACTED]"],[/([=:]\s*["']?)[A-Za-z0-9_\-+/=]{40,}/g,"$1[REDACTED]"]];Y="[tkr: secret masked]",Qc=[[/(-----BEGIN [A-Z0-9 ]*PRIVATE KEY-----)(?:\r?\n(?:[A-Za-z0-9+/=]{16,}|[A-Za-z-]+: [^\r\n]*|\r?(?=\n)))*(?:(?:\r?\n[A-Za-z0-9+/=]{1,15})?\r?\n-----END [A-Z0-9 ]*PRIVATE KEY-----)?/g,`$1${Y}`],[/(?<![A-Za-z0-9_])(gh[pousr])_[A-Za-z0-9]{36,255}(?![A-Za-z0-9])/g,`$1_${Y}`],[/(?<![A-Za-z0-9_])github_pat_[A-Za-z0-9_]{22,255}/g,`github_pat_${Y}`],[/(?<![A-Za-z0-9_])npm_[A-Za-z0-9]{36}(?![A-Za-z0-9])/g,`npm_${Y}`],[/(?<![A-Z0-9])(AKIA|ASIA)[A-Z0-9]{16}(?![A-Z0-9])/g,`$1${Y}`],[/(?<![A-Za-z0-9])(xox[abpors]-)[A-Za-z0-9-]{10,}/g,`$1${Y}`],[/(?<![A-Za-z0-9])((?:sk|rk)_live_)[A-Za-z0-9]{16,}/g,`$1${Y}`],[/(authorization["']?\s*[:=]\s*["']?bearer\s+)[A-Za-z0-9._~+/=-]{8,}/gi,`$1${Y}`],[/(?<![A-Za-z0-9+.-])([a-zA-Z][a-zA-Z0-9+.-]{0,31}:\/\/[^\s:/@]*:)[^\s@/]+(@[^\s@/]+)/g,`$1${Y}$2`]]});function Jn(){let t=process.env.TOKMIZER_BASE_URL;if(t===De||t===`${De}/`||!t)return De;try{let e=new URL(t);return e.protocol==="http:"&&ja.has(e.hostname)&&!e.username&&!e.password?t:De}catch{return De}}var De,ja,qn=w(()=>{"use strict";De="https://tokmizer.com",ja=new Set(["127.0.0.1","localhost"])});import Ie from"node:os";import{createHash as za,createHmac as Qn,randomUUID as Za}from"node:crypto";import{readFile as Xn,writeFile as er,mkdir as La}from"node:fs/promises";async function Fa(){try{let n=(await Xn(je(),"utf8")).trim();if(/^[0-9a-f-]{36}$/i.test(n))return n}catch{}await La(S(),{recursive:!0});let t=Za();try{return await er(je(),t,{mode:384,flag:"wx"}),t}catch{try{let e=(await Xn(je(),"utf8")).trim();if(/^[0-9a-f-]{36}$/i.test(e))return e}catch{}return await er(je(),t,{mode:384}),t}}function Dt(t){return za("sha256").update(t).digest("hex")}function Ua(){let t=Ie.networkInterfaces();for(let e of Object.keys(t))for(let n of t[e]??[])if(!n.internal&&n.mac&&n.mac!=="00:00:00:00:00:00")return n.mac;return"no-mac"}async function tr(){let t=await Fa(),e=Ie.hostname(),n=Ie.platform(),r=Ie.release(),s=Ie.cpus(),a=s[0]?.model??"unknown",o=s.length,i=Ua(),c=Ie.userInfo().username,u=[e,n,r,a,String(o),Dt(i),Dt(c),t].join("|");return{fingerprint:Dt(u),installId:t,hostname:e,os:n,osVersion:r,cpuModel:a,cpuCores:o,macHash:Qn("sha256",t).update(i).digest("hex"),usernameHash:Qn("sha256",t).update(c).digest("hex")}}var nr=w(()=>{"use strict";Z()});import{createRequire as Va}from"node:module";function Ka(){let t="0.9.68";if(t)return t;for(let e of["../package.json","../../package.json"])try{let n=Ba(e).version;if(typeof n=="string"&&n)return n}catch{}return"0.0.0"}var Ba,It,Pt=w(()=>{"use strict";Ba=Va(import.meta.url);It=Ka()});var rr=w(()=>{"use strict"});import{existsSync as Ha,mkdirSync as du,rmSync as lu,writeFileSync as fu}from"node:fs";import{join as Wa}from"node:path";function Ja(){return Wa(S(),"network-off")}function qa(){let t=process.env.TOKMIZER_NETWORK;return t!==void 0&&Ga.has(t.trim().toLowerCase())}function Be(){return qa()?!1:!Ha(Ja())}function sr(){if(!Be())throw new Mt}var Ga,Ya,hu,Mt,dt=w(()=>{"use strict";Z();Ga=new Set(["0","off","false","no"]),Ya="Network is off for Tokmizer. Turn it back on with: tkr network on",hu=["Tokmizer contacts tokmizer.com to keep its rules up to date and to improve the product. No account or email is needed.","It sends a random install ID, your computer name, OS and CPU model, a hash of your network card address and of your user name, and the plugin version. Command contents and output are never sent.","Usage stats (command names, token counts and install health counts) are sent only while they are on. Check with: tkr telemetry status.","Turn all network access off: tkr network off. Usage stats only: tkr telemetry off."].join(`
3
+ var Yr=Object.defineProperty;var w=(t,e,n)=>()=>{if(n)throw n[0];try{return t&&(e=t(t=0)),e}catch(r){throw n=[r],r}};var ke=(t,e)=>{for(var n in e)Yr(t,n,{get:e[n],enumerable:!0})};import an from"node:os";import{join as J}from"node:path";function S(){return process.env.TOKMIZER_HOME||J(an.homedir(),".tokmizer")}function je(){return J(S(),"install-id")}function Ye(){return J(S(),"bundle-refresh.json")}function Je(){return J(S(),"skills")}function re(t){return J(Je(),`${t}.md`)}function kt(){return J(S(),"managed-commands.json")}function qe(){return process.env.TOKMIZER_CLAUDE_COMMANDS_DIR||J(an.homedir(),".claude","commands")}function se(t){return J(qe(),`${t}.md`)}var Z=w(()=>{"use strict"});var v,xt,p,U,ze=w(()=>{(function(t){t.assertEqual=s=>{};function e(s){}t.assertIs=e;function n(s){throw new Error}t.assertNever=n,t.arrayToEnum=s=>{let a={};for(let o of s)a[o]=o;return a},t.getValidEnumValues=s=>{let a=t.objectKeys(s).filter(i=>typeof s[s[i]]!="number"),o={};for(let i of a)o[i]=s[i];return t.objectValues(o)},t.objectValues=s=>t.objectKeys(s).map(function(a){return s[a]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{let a=[];for(let o in s)Object.prototype.hasOwnProperty.call(s,o)&&a.push(o);return a},t.find=(s,a)=>{for(let o of s)if(a(o))return o},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function r(s,a=" | "){return s.map(o=>typeof o=="string"?`'${o}'`:o).join(a)}t.joinValues=r,t.jsonStringifyReplacer=(s,a)=>typeof a=="bigint"?a.toString():a})(v||(v={}));(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(xt||(xt={}));p=v.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),U=t=>{switch(typeof t){case"undefined":return p.undefined;case"string":return p.string;case"number":return Number.isNaN(t)?p.nan:p.number;case"boolean":return p.boolean;case"function":return p.function;case"bigint":return p.bigint;case"symbol":return p.symbol;case"object":return Array.isArray(t)?p.array:t===null?p.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?p.promise:typeof Map<"u"&&t instanceof Map?p.map:typeof Set<"u"&&t instanceof Set?p.set:typeof Date<"u"&&t instanceof Date?p.date:p.object;default:return p.unknown}}});var d,Qr,D,Qe=w(()=>{ze();d=v.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Qr=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),D=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){let n=e||function(a){return a.message},r={_errors:[]},s=a=>{for(let o of a.issues)if(o.code==="invalid_union")o.unionErrors.map(s);else if(o.code==="invalid_return_type")s(o.returnTypeError);else if(o.code==="invalid_arguments")s(o.argumentsError);else if(o.path.length===0)r._errors.push(n(o));else{let i=r,c=0;for(;c<o.path.length;){let u=o.path[c];c===o.path.length-1?(i[u]=i[u]||{_errors:[]},i[u]._errors.push(n(o))):i[u]=i[u]||{_errors:[]},i=i[u],c++}}};return s(this),r}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,v.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){let n={},r=[];for(let s of this.issues)if(s.path.length>0){let a=s.path[0];n[a]=n[a]||[],n[a].push(e(s))}else r.push(e(s));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}};D.create=t=>new D(t)});var Xr,K,wt=w(()=>{Qe();ze();Xr=(t,e)=>{let n;switch(t.code){case d.invalid_type:t.received===p.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case d.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,v.jsonStringifyReplacer)}`;break;case d.unrecognized_keys:n=`Unrecognized key(s) in object: ${v.joinValues(t.keys,", ")}`;break;case d.invalid_union:n="Invalid input";break;case d.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${v.joinValues(t.options)}`;break;case d.invalid_enum_value:n=`Invalid enum value. Expected ${v.joinValues(t.options)}, received '${t.received}'`;break;case d.invalid_arguments:n="Invalid function arguments";break;case d.invalid_return_type:n="Invalid function return type";break;case d.invalid_date:n="Invalid date";break;case d.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:v.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case d.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case d.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case d.custom:n="Invalid input";break;case d.invalid_intersection_types:n="Intersection results could not be merged";break;case d.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case d.not_finite:n="Number must be finite";break;default:n=e.defaultError,v.assertNever(t)}return{message:n}},K=Xr});function es(t){cn=t}function xe(){return cn}var cn,Xe=w(()=>{wt();cn=K});function f(t,e){let n=xe(),r=Ze({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===K?void 0:K].filter(s=>!!s)});t.common.issues.push(r)}var Ze,ts,$,h,ae,R,et,tt,q,we,St=w(()=>{Xe();wt();Ze=t=>{let{data:e,path:n,errorMaps:r,issueData:s}=t,a=[...n,...s.path||[]],o={...s,path:a};if(s.message!==void 0)return{...s,path:a,message:s.message};let i="",c=r.filter(u=>!!u).slice().reverse();for(let u of c)i=u(o,{data:e,defaultError:i}).message;return{...s,path:a,message:i}},ts=[];$=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){let r=[];for(let s of n){if(s.status==="aborted")return h;s.status==="dirty"&&e.dirty(),r.push(s.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){let r=[];for(let s of n){let a=await s.key,o=await s.value;r.push({key:a,value:o})}return t.mergeObjectSync(e,r)}static mergeObjectSync(e,n){let r={};for(let s of n){let{key:a,value:o}=s;if(a.status==="aborted"||o.status==="aborted")return h;a.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof o.value<"u"||s.alwaysSet)&&(r[a.value]=o.value)}return{status:e.value,value:r}}},h=Object.freeze({status:"aborted"}),ae=t=>({status:"dirty",value:t}),R=t=>({status:"valid",value:t}),et=t=>t.status==="aborted",tt=t=>t.status==="dirty",q=t=>t.status==="valid",we=t=>typeof Promise<"u"&&t instanceof Promise});var un=w(()=>{});var m,dn=w(()=>{(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(m||(m={}))});function _(t){if(!t)return{};let{errorMap:e,invalid_type_error:n,required_error:r,description:s}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(o,i)=>{let{message:c}=t;return o.code==="invalid_enum_value"?{message:c??i.defaultError}:typeof i.data>"u"?{message:c??r??i.defaultError}:o.code!=="invalid_type"?{message:i.defaultError}:{message:c??n??i.defaultError}},description:s}}function mn(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}function _s(t){return new RegExp(`^${mn(t)}$`)}function hn(t){let e=`${pn}T${mn(t)}`,n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function bs(t,e){return!!((e==="v4"||!e)&&ls.test(t)||(e==="v6"||!e)&&ps.test(t))}function vs(t,e){if(!is.test(t))return!1;try{let[n]=t.split(".");if(!n)return!1;let r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),s=JSON.parse(atob(r));return!(typeof s!="object"||s===null||"typ"in s&&s?.typ!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function ks(t,e){return!!((e==="v4"||!e)&&fs.test(t)||(e==="v6"||!e)&&ms.test(t))}function xs(t,e){let n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,s=n>r?n:r,a=Number.parseInt(t.toFixed(s).replace(".","")),o=Number.parseInt(e.toFixed(s).replace(".",""));return a%o/10**s}function Se(t){if(t instanceof I){let e={};for(let n in t.shape){let r=t.shape[n];e[n]=P.create(Se(r))}return new I({...t._def,shape:()=>e})}else return t instanceof G?new G({...t._def,type:Se(t.element)}):t instanceof P?P.create(Se(t.unwrap())):t instanceof B?B.create(Se(t.unwrap())):t instanceof V?V.create(t.items.map(e=>Se(e))):t}function Et(t,e){let n=U(t),r=U(e);if(t===e)return{valid:!0,data:t};if(n===p.object&&r===p.object){let s=v.objectKeys(e),a=v.objectKeys(t).filter(i=>s.indexOf(i)!==-1),o={...t,...e};for(let i of a){let c=Et(t[i],e[i]);if(!c.valid)return{valid:!1};o[i]=c.data}return{valid:!0,data:o}}else if(n===p.array&&r===p.array){if(t.length!==e.length)return{valid:!1};let s=[];for(let a=0;a<t.length;a++){let o=t[a],i=e[a],c=Et(o,i);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return n===p.date&&r===p.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}function gn(t,e){return new ge({values:t,typeName:g.ZodEnum,..._(e)})}function fn(t,e){let n=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof n=="string"?{message:n}:n}function yn(t,e={},n){return t?X.create().superRefine((r,s)=>{let a=t(r);if(a instanceof Promise)return a.then(o=>{if(!o){let i=fn(e,r),c=i.fatal??n??!0;s.addIssue({code:"custom",...i,fatal:c})}});if(!a){let o=fn(e,r),i=o.fatal??n??!0;s.addIssue({code:"custom",...o,fatal:i})}}):X.create()}var M,ln,b,ns,rs,ss,as,os,is,cs,us,ds,Tt,ls,fs,ps,ms,hs,gs,pn,ys,Q,oe,ie,ce,ue,Te,de,le,X,W,L,Ee,G,I,fe,H,nt,pe,V,rt,Ae,$e,st,me,he,ge,ye,ee,j,P,B,_e,be,Re,ws,Le,Fe,ve,Ss,g,Ts,_n,bn,Es,As,vn,$s,Rs,Cs,Os,Ns,Ds,Is,Ps,Ms,js,zs,Zs,Ls,Fs,Us,Vs,Bs,Ks,Hs,Ws,Gs,Ys,Js,qs,Qs,Xs,ea,ta,na,ra,sa,aa,oa,ia,kn=w(()=>{Qe();Xe();dn();St();ze();M=class{constructor(e,n,r,s){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},ln=(t,e)=>{if(q(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let n=new D(t.common.issues);return this._error=n,this._error}}};b=class{get description(){return this._def.description}_getType(e){return U(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:U(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new $,ctx:{common:e.parent.common,data:e.data,parsedType:U(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let n=this._parse(e);if(we(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){let n=this._parse(e);return Promise.resolve(n)}parse(e,n){let r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){let r={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:U(e)},s=this._parseSync({data:e,path:r.path,parent:r});return ln(r,s)}"~validate"(e){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:U(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:n});return q(r)?{value:r.value}:{issues:n.common.issues}}catch(r){r?.message?.toLowerCase()?.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,n){let r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){let r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:U(e)},s=this._parse({data:e,path:r.path,parent:r}),a=await(we(s)?s:Promise.resolve(s));return ln(r,a)}refine(e,n){let r=s=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(s):n;return this._refinement((s,a)=>{let o=e(s),i=()=>a.addIssue({code:d.custom,...r(s)});return typeof Promise<"u"&&o instanceof Promise?o.then(c=>c?!0:(i(),!1)):o?!0:(i(),!1)})}refinement(e,n){return this._refinement((r,s)=>e(r)?!0:(s.addIssue(typeof n=="function"?n(r,s):n),!1))}_refinement(e){return new j({schema:this,typeName:g.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:n=>this["~validate"](n)}}optional(){return P.create(this,this._def)}nullable(){return B.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return G.create(this)}promise(){return ee.create(this,this._def)}or(e){return fe.create([this,e],this._def)}and(e){return pe.create(this,e,this._def)}transform(e){return new j({..._(this._def),schema:this,typeName:g.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let n=typeof e=="function"?e:()=>e;return new _e({..._(this._def),innerType:this,defaultValue:n,typeName:g.ZodDefault})}brand(){return new Le({typeName:g.ZodBranded,type:this,..._(this._def)})}catch(e){let n=typeof e=="function"?e:()=>e;return new be({..._(this._def),innerType:this,catchValue:n,typeName:g.ZodCatch})}describe(e){let n=this.constructor;return new n({...this._def,description:e})}pipe(e){return Fe.create(this,e)}readonly(){return ve.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},ns=/^c[^\s-]{8,}$/i,rs=/^[0-9a-z]+$/,ss=/^[0-9A-HJKMNP-TV-Z]{26}$/i,as=/^[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,os=/^[a-z0-9_-]{21}$/i,is=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,cs=/^[-+]?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)?)??$/,us=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ds="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",ls=/^(?:(?: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])$/,fs=/^(?:(?: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])$/,ps=/^(([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]))$/,ms=/^(([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])$/,hs=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,gs=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,pn="((\\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])))",ys=new RegExp(`^${pn}$`);Q=class t extends b{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==p.string){let a=this._getOrReturnCtx(e);return f(a,{code:d.invalid_type,expected:p.string,received:a.parsedType}),h}let r=new $,s;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(s=this._getOrReturnCtx(e,s),f(s,{code:d.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="max")e.data.length>a.value&&(s=this._getOrReturnCtx(e,s),f(s,{code:d.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="length"){let o=e.data.length>a.value,i=e.data.length<a.value;(o||i)&&(s=this._getOrReturnCtx(e,s),o?f(s,{code:d.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):i&&f(s,{code:d.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),r.dirty())}else if(a.kind==="email")us.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"email",code:d.invalid_string,message:a.message}),r.dirty());else if(a.kind==="emoji")Tt||(Tt=new RegExp(ds,"u")),Tt.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"emoji",code:d.invalid_string,message:a.message}),r.dirty());else if(a.kind==="uuid")as.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"uuid",code:d.invalid_string,message:a.message}),r.dirty());else if(a.kind==="nanoid")os.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"nanoid",code:d.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid")ns.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"cuid",code:d.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid2")rs.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"cuid2",code:d.invalid_string,message:a.message}),r.dirty());else if(a.kind==="ulid")ss.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"ulid",code:d.invalid_string,message:a.message}),r.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),f(s,{validation:"url",code:d.invalid_string,message:a.message}),r.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"regex",code:d.invalid_string,message:a.message}),r.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(s=this._getOrReturnCtx(e,s),f(s,{code:d.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),r.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(s=this._getOrReturnCtx(e,s),f(s,{code:d.invalid_string,validation:{startsWith:a.value},message:a.message}),r.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(s=this._getOrReturnCtx(e,s),f(s,{code:d.invalid_string,validation:{endsWith:a.value},message:a.message}),r.dirty()):a.kind==="datetime"?hn(a).test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{code:d.invalid_string,validation:"datetime",message:a.message}),r.dirty()):a.kind==="date"?ys.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{code:d.invalid_string,validation:"date",message:a.message}),r.dirty()):a.kind==="time"?_s(a).test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{code:d.invalid_string,validation:"time",message:a.message}),r.dirty()):a.kind==="duration"?cs.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"duration",code:d.invalid_string,message:a.message}),r.dirty()):a.kind==="ip"?bs(e.data,a.version)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"ip",code:d.invalid_string,message:a.message}),r.dirty()):a.kind==="jwt"?vs(e.data,a.alg)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"jwt",code:d.invalid_string,message:a.message}),r.dirty()):a.kind==="cidr"?ks(e.data,a.version)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"cidr",code:d.invalid_string,message:a.message}),r.dirty()):a.kind==="base64"?hs.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"base64",code:d.invalid_string,message:a.message}),r.dirty()):a.kind==="base64url"?gs.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"base64url",code:d.invalid_string,message:a.message}),r.dirty()):v.assertNever(a);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(s=>e.test(s),{validation:n,code:d.invalid_string,...m.errToObj(r)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...m.errToObj(e)})}url(e){return this._addCheck({kind:"url",...m.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...m.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...m.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...m.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...m.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...m.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...m.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...m.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...m.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...m.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...m.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...m.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...m.errToObj(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?.precision>"u"?null:e?.precision,...m.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...m.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...m.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n?.position,...m.errToObj(n?.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...m.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...m.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...m.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...m.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...m.errToObj(n)})}nonempty(e){return this.min(1,m.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...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(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};Q.create=t=>new Q({checks:[],typeName:g.ZodString,coerce:t?.coerce??!1,..._(t)});oe=class t extends b{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)!==p.number){let a=this._getOrReturnCtx(e);return f(a,{code:d.invalid_type,expected:p.number,received:a.parsedType}),h}let r,s=new $;for(let a of this._def.checks)a.kind==="int"?v.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{code:d.invalid_type,expected:"integer",received:"float",message:a.message}),s.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(r=this._getOrReturnCtx(e,r),f(r,{code:d.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(r=this._getOrReturnCtx(e,r),f(r,{code:d.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?xs(e.data,a.value)!==0&&(r=this._getOrReturnCtx(e,r),f(r,{code:d.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{code:d.not_finite,message:a.message}),s.dirty()):v.assertNever(a);return{status:s.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,m.toString(n))}gt(e,n){return this.setLimit("min",e,!1,m.toString(n))}lte(e,n){return this.setLimit("max",e,!0,m.toString(n))}lt(e,n){return this.setLimit("max",e,!1,m.toString(n))}setLimit(e,n,r,s){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:m.toString(s)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:m.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:m.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:m.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:m.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:m.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:m.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:m.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:m.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:m.toString(e)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&v.isInteger(e.value))}get isFinite(){let e=null,n=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}};oe.create=t=>new oe({checks:[],typeName:g.ZodNumber,coerce:t?.coerce||!1,..._(t)});ie=class t extends b{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)!==p.bigint)return this._getInvalidInput(e);let r,s=new $;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(r=this._getOrReturnCtx(e,r),f(r,{code:d.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(r=this._getOrReturnCtx(e,r),f(r,{code:d.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),f(r,{code:d.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):v.assertNever(a);return{status:s.value,value:e.data}}_getInvalidInput(e){let n=this._getOrReturnCtx(e);return f(n,{code:d.invalid_type,expected:p.bigint,received:n.parsedType}),h}gte(e,n){return this.setLimit("min",e,!0,m.toString(n))}gt(e,n){return this.setLimit("min",e,!1,m.toString(n))}lte(e,n){return this.setLimit("max",e,!0,m.toString(n))}lt(e,n){return this.setLimit("max",e,!1,m.toString(n))}setLimit(e,n,r,s){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:m.toString(s)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:m.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:m.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:m.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:m.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:m.toString(n)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};ie.create=t=>new ie({checks:[],typeName:g.ZodBigInt,coerce:t?.coerce??!1,..._(t)});ce=class extends b{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==p.boolean){let r=this._getOrReturnCtx(e);return f(r,{code:d.invalid_type,expected:p.boolean,received:r.parsedType}),h}return R(e.data)}};ce.create=t=>new ce({typeName:g.ZodBoolean,coerce:t?.coerce||!1,..._(t)});ue=class t extends b{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==p.date){let a=this._getOrReturnCtx(e);return f(a,{code:d.invalid_type,expected:p.date,received:a.parsedType}),h}if(Number.isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return f(a,{code:d.invalid_date}),h}let r=new $,s;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(s=this._getOrReturnCtx(e,s),f(s,{code:d.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),r.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(s=this._getOrReturnCtx(e,s),f(s,{code:d.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),r.dirty()):v.assertNever(a);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:m.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:m.toString(n)})}get minDate(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}};ue.create=t=>new ue({checks:[],coerce:t?.coerce||!1,typeName:g.ZodDate,..._(t)});Te=class extends b{_parse(e){if(this._getType(e)!==p.symbol){let r=this._getOrReturnCtx(e);return f(r,{code:d.invalid_type,expected:p.symbol,received:r.parsedType}),h}return R(e.data)}};Te.create=t=>new Te({typeName:g.ZodSymbol,..._(t)});de=class extends b{_parse(e){if(this._getType(e)!==p.undefined){let r=this._getOrReturnCtx(e);return f(r,{code:d.invalid_type,expected:p.undefined,received:r.parsedType}),h}return R(e.data)}};de.create=t=>new de({typeName:g.ZodUndefined,..._(t)});le=class extends b{_parse(e){if(this._getType(e)!==p.null){let r=this._getOrReturnCtx(e);return f(r,{code:d.invalid_type,expected:p.null,received:r.parsedType}),h}return R(e.data)}};le.create=t=>new le({typeName:g.ZodNull,..._(t)});X=class extends b{constructor(){super(...arguments),this._any=!0}_parse(e){return R(e.data)}};X.create=t=>new X({typeName:g.ZodAny,..._(t)});W=class extends b{constructor(){super(...arguments),this._unknown=!0}_parse(e){return R(e.data)}};W.create=t=>new W({typeName:g.ZodUnknown,..._(t)});L=class extends b{_parse(e){let n=this._getOrReturnCtx(e);return f(n,{code:d.invalid_type,expected:p.never,received:n.parsedType}),h}};L.create=t=>new L({typeName:g.ZodNever,..._(t)});Ee=class extends b{_parse(e){if(this._getType(e)!==p.undefined){let r=this._getOrReturnCtx(e);return f(r,{code:d.invalid_type,expected:p.void,received:r.parsedType}),h}return R(e.data)}};Ee.create=t=>new Ee({typeName:g.ZodVoid,..._(t)});G=class t extends b{_parse(e){let{ctx:n,status:r}=this._processInputParams(e),s=this._def;if(n.parsedType!==p.array)return f(n,{code:d.invalid_type,expected:p.array,received:n.parsedType}),h;if(s.exactLength!==null){let o=n.data.length>s.exactLength.value,i=n.data.length<s.exactLength.value;(o||i)&&(f(n,{code:o?d.too_big:d.too_small,minimum:i?s.exactLength.value:void 0,maximum:o?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&n.data.length<s.minLength.value&&(f(n,{code:d.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&n.data.length>s.maxLength.value&&(f(n,{code:d.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,i)=>s.type._parseAsync(new M(n,o,n.path,i)))).then(o=>$.mergeArray(r,o));let a=[...n.data].map((o,i)=>s.type._parseSync(new M(n,o,n.path,i)));return $.mergeArray(r,a)}get element(){return this._def.type}min(e,n){return new t({...this._def,minLength:{value:e,message:m.toString(n)}})}max(e,n){return new t({...this._def,maxLength:{value:e,message:m.toString(n)}})}length(e,n){return new t({...this._def,exactLength:{value:e,message:m.toString(n)}})}nonempty(e){return this.min(1,e)}};G.create=(t,e)=>new G({type:t,minLength:null,maxLength:null,exactLength:null,typeName:g.ZodArray,..._(e)});I=class t extends b{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),n=v.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==p.object){let u=this._getOrReturnCtx(e);return f(u,{code:d.invalid_type,expected:p.object,received:u.parsedType}),h}let{status:r,ctx:s}=this._processInputParams(e),{shape:a,keys:o}=this._getCached(),i=[];if(!(this._def.catchall instanceof L&&this._def.unknownKeys==="strip"))for(let u in s.data)o.includes(u)||i.push(u);let c=[];for(let u of o){let l=a[u],y=s.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new M(s,y,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof L){let u=this._def.unknownKeys;if(u==="passthrough")for(let l of i)c.push({key:{status:"valid",value:l},value:{status:"valid",value:s.data[l]}});else if(u==="strict")i.length>0&&(f(s,{code:d.unrecognized_keys,keys:i}),r.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let l of i){let y=s.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new M(s,y,s.path,l)),alwaysSet:l in s.data})}}return s.common.async?Promise.resolve().then(async()=>{let u=[];for(let l of c){let y=await l.key,k=await l.value;u.push({key:y,value:k,alwaysSet:l.alwaysSet})}return u}).then(u=>$.mergeObjectSync(r,u)):$.mergeObjectSync(r,c)}get shape(){return this._def.shape()}strict(e){return m.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{let s=this._def.errorMap?.(n,r).message??r.defaultError;return n.code==="unrecognized_keys"?{message:m.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:g.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let n={};for(let r of v.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new t({...this._def,shape:()=>n})}omit(e){let n={};for(let r of v.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new t({...this._def,shape:()=>n})}deepPartial(){return Se(this)}partial(e){let n={};for(let r of v.objectKeys(this.shape)){let s=this.shape[r];e&&!e[r]?n[r]=s:n[r]=s.optional()}return new t({...this._def,shape:()=>n})}required(e){let n={};for(let r of v.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let a=this.shape[r];for(;a instanceof P;)a=a._def.innerType;n[r]=a}return new t({...this._def,shape:()=>n})}keyof(){return gn(v.objectKeys(this.shape))}};I.create=(t,e)=>new I({shape:()=>t,unknownKeys:"strip",catchall:L.create(),typeName:g.ZodObject,..._(e)});I.strictCreate=(t,e)=>new I({shape:()=>t,unknownKeys:"strict",catchall:L.create(),typeName:g.ZodObject,..._(e)});I.lazycreate=(t,e)=>new I({shape:t,unknownKeys:"strip",catchall:L.create(),typeName:g.ZodObject,..._(e)});fe=class extends b{_parse(e){let{ctx:n}=this._processInputParams(e),r=this._def.options;function s(a){for(let i of a)if(i.result.status==="valid")return i.result;for(let i of a)if(i.result.status==="dirty")return n.common.issues.push(...i.ctx.common.issues),i.result;let o=a.map(i=>new D(i.ctx.common.issues));return f(n,{code:d.invalid_union,unionErrors:o}),h}if(n.common.async)return Promise.all(r.map(async a=>{let o={...n,common:{...n.common,issues:[]},parent:null};return{result:await a._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(s);{let a,o=[];for(let c of r){let u={...n,common:{...n.common,issues:[]},parent:null},l=c._parseSync({data:n.data,path:n.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!a&&(a={result:l,ctx:u}),u.common.issues.length&&o.push(u.common.issues)}if(a)return n.common.issues.push(...a.ctx.common.issues),a.result;let i=o.map(c=>new D(c));return f(n,{code:d.invalid_union,unionErrors:i}),h}}get options(){return this._def.options}};fe.create=(t,e)=>new fe({options:t,typeName:g.ZodUnion,..._(e)});H=t=>t instanceof me?H(t.schema):t instanceof j?H(t.innerType()):t instanceof he?[t.value]:t instanceof ge?t.options:t instanceof ye?v.objectValues(t.enum):t instanceof _e?H(t._def.innerType):t instanceof de?[void 0]:t instanceof le?[null]:t instanceof P?[void 0,...H(t.unwrap())]:t instanceof B?[null,...H(t.unwrap())]:t instanceof Le||t instanceof ve?H(t.unwrap()):t instanceof be?H(t._def.innerType):[],nt=class t extends b{_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==p.object)return f(n,{code:d.invalid_type,expected:p.object,received:n.parsedType}),h;let r=this.discriminator,s=n.data[r],a=this.optionsMap.get(s);return a?n.common.async?a._parseAsync({data:n.data,path:n.path,parent:n}):a._parseSync({data:n.data,path:n.path,parent:n}):(f(n,{code:d.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),h)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){let s=new Map;for(let a of n){let o=H(a.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of o){if(s.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);s.set(i,a)}}return new t({typeName:g.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:s,..._(r)})}};pe=class extends b{_parse(e){let{status:n,ctx:r}=this._processInputParams(e),s=(a,o)=>{if(et(a)||et(o))return h;let i=Et(a.value,o.value);return i.valid?((tt(a)||tt(o))&&n.dirty(),{status:n.value,value:i.data}):(f(r,{code:d.invalid_intersection_types}),h)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([a,o])=>s(a,o)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};pe.create=(t,e,n)=>new pe({left:t,right:e,typeName:g.ZodIntersection,..._(n)});V=class t extends b{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==p.array)return f(r,{code:d.invalid_type,expected:p.array,received:r.parsedType}),h;if(r.data.length<this._def.items.length)return f(r,{code:d.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),h;!this._def.rest&&r.data.length>this._def.items.length&&(f(r,{code:d.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let a=[...r.data].map((o,i)=>{let c=this._def.items[i]||this._def.rest;return c?c._parse(new M(r,o,r.path,i)):null}).filter(o=>!!o);return r.common.async?Promise.all(a).then(o=>$.mergeArray(n,o)):$.mergeArray(n,a)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};V.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new V({items:t,typeName:g.ZodTuple,rest:null,..._(e)})};rt=class t extends b{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==p.object)return f(r,{code:d.invalid_type,expected:p.object,received:r.parsedType}),h;let s=[],a=this._def.keyType,o=this._def.valueType;for(let i in r.data)s.push({key:a._parse(new M(r,i,r.path,i)),value:o._parse(new M(r,r.data[i],r.path,i)),alwaysSet:i in r.data});return r.common.async?$.mergeObjectAsync(n,s):$.mergeObjectSync(n,s)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof b?new t({keyType:e,valueType:n,typeName:g.ZodRecord,..._(r)}):new t({keyType:Q.create(),valueType:e,typeName:g.ZodRecord,..._(n)})}},Ae=class extends b{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==p.map)return f(r,{code:d.invalid_type,expected:p.map,received:r.parsedType}),h;let s=this._def.keyType,a=this._def.valueType,o=[...r.data.entries()].map(([i,c],u)=>({key:s._parse(new M(r,i,r.path,[u,"key"])),value:a._parse(new M(r,c,r.path,[u,"value"]))}));if(r.common.async){let i=new Map;return Promise.resolve().then(async()=>{for(let c of o){let u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return h;(u.status==="dirty"||l.status==="dirty")&&n.dirty(),i.set(u.value,l.value)}return{status:n.value,value:i}})}else{let i=new Map;for(let c of o){let u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return h;(u.status==="dirty"||l.status==="dirty")&&n.dirty(),i.set(u.value,l.value)}return{status:n.value,value:i}}}};Ae.create=(t,e,n)=>new Ae({valueType:e,keyType:t,typeName:g.ZodMap,..._(n)});$e=class t extends b{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==p.set)return f(r,{code:d.invalid_type,expected:p.set,received:r.parsedType}),h;let s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(f(r,{code:d.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),n.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(f(r,{code:d.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),n.dirty());let a=this._def.valueType;function o(c){let u=new Set;for(let l of c){if(l.status==="aborted")return h;l.status==="dirty"&&n.dirty(),u.add(l.value)}return{status:n.value,value:u}}let i=[...r.data.values()].map((c,u)=>a._parse(new M(r,c,r.path,u)));return r.common.async?Promise.all(i).then(c=>o(c)):o(i)}min(e,n){return new t({...this._def,minSize:{value:e,message:m.toString(n)}})}max(e,n){return new t({...this._def,maxSize:{value:e,message:m.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}};$e.create=(t,e)=>new $e({valueType:t,minSize:null,maxSize:null,typeName:g.ZodSet,..._(e)});st=class t extends b{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==p.function)return f(n,{code:d.invalid_type,expected:p.function,received:n.parsedType}),h;function r(i,c){return Ze({data:i,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,xe(),K].filter(u=>!!u),issueData:{code:d.invalid_arguments,argumentsError:c}})}function s(i,c){return Ze({data:i,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,xe(),K].filter(u=>!!u),issueData:{code:d.invalid_return_type,returnTypeError:c}})}let a={errorMap:n.common.contextualErrorMap},o=n.data;if(this._def.returns instanceof ee){let i=this;return R(async function(...c){let u=new D([]),l=await i._def.args.parseAsync(c,a).catch(T=>{throw u.addIssue(r(c,T)),u}),y=await Reflect.apply(o,this,l);return await i._def.returns._def.type.parseAsync(y,a).catch(T=>{throw u.addIssue(s(y,T)),u})})}else{let i=this;return R(function(...c){let u=i._def.args.safeParse(c,a);if(!u.success)throw new D([r(c,u.error)]);let l=Reflect.apply(o,this,u.data),y=i._def.returns.safeParse(l,a);if(!y.success)throw new D([s(l,y.error)]);return y.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:V.create(e).rest(W.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new t({args:e||V.create([]).rest(W.create()),returns:n||W.create(),typeName:g.ZodFunction,..._(r)})}},me=class extends b{get schema(){return this._def.getter()}_parse(e){let{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};me.create=(t,e)=>new me({getter:t,typeName:g.ZodLazy,..._(e)});he=class extends b{_parse(e){if(e.data!==this._def.value){let n=this._getOrReturnCtx(e);return f(n,{received:n.data,code:d.invalid_literal,expected:this._def.value}),h}return{status:"valid",value:e.data}}get value(){return this._def.value}};he.create=(t,e)=>new he({value:t,typeName:g.ZodLiteral,..._(e)});ge=class t extends b{_parse(e){if(typeof e.data!="string"){let n=this._getOrReturnCtx(e),r=this._def.values;return f(n,{expected:v.joinValues(r),received:n.parsedType,code:d.invalid_type}),h}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let n=this._getOrReturnCtx(e),r=this._def.values;return f(n,{received:n.data,code:d.invalid_enum_value,options:r}),h}return R(e.data)}get options(){return this._def.values}get enum(){let e={};for(let n of this._def.values)e[n]=n;return e}get Values(){let e={};for(let n of this._def.values)e[n]=n;return e}get Enum(){let e={};for(let n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return t.create(e,{...this._def,...n})}exclude(e,n=this._def){return t.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}};ge.create=gn;ye=class extends b{_parse(e){let n=v.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==p.string&&r.parsedType!==p.number){let s=v.objectValues(n);return f(r,{expected:v.joinValues(s),received:r.parsedType,code:d.invalid_type}),h}if(this._cache||(this._cache=new Set(v.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let s=v.objectValues(n);return f(r,{received:r.data,code:d.invalid_enum_value,options:s}),h}return R(e.data)}get enum(){return this._def.values}};ye.create=(t,e)=>new ye({values:t,typeName:g.ZodNativeEnum,..._(e)});ee=class extends b{unwrap(){return this._def.type}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==p.promise&&n.common.async===!1)return f(n,{code:d.invalid_type,expected:p.promise,received:n.parsedType}),h;let r=n.parsedType===p.promise?n.data:Promise.resolve(n.data);return R(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}};ee.create=(t,e)=>new ee({type:t,typeName:g.ZodPromise,..._(e)});j=class extends b{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===g.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:n,ctx:r}=this._processInputParams(e),s=this._def.effect||null,a={addIssue:o=>{f(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(a.addIssue=a.addIssue.bind(a),s.type==="preprocess"){let o=s.transform(r.data,a);if(r.common.async)return Promise.resolve(o).then(async i=>{if(n.value==="aborted")return h;let c=await this._def.schema._parseAsync({data:i,path:r.path,parent:r});return c.status==="aborted"?h:c.status==="dirty"?ae(c.value):n.value==="dirty"?ae(c.value):c});{if(n.value==="aborted")return h;let i=this._def.schema._parseSync({data:o,path:r.path,parent:r});return i.status==="aborted"?h:i.status==="dirty"?ae(i.value):n.value==="dirty"?ae(i.value):i}}if(s.type==="refinement"){let o=i=>{let c=s.refinement(i,a);if(r.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return i};if(r.common.async===!1){let i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?h:(i.status==="dirty"&&n.dirty(),o(i.value),{status:n.value,value:i.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(i=>i.status==="aborted"?h:(i.status==="dirty"&&n.dirty(),o(i.value).then(()=>({status:n.value,value:i.value}))))}if(s.type==="transform")if(r.common.async===!1){let o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!q(o))return h;let i=s.transform(o.value,a);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:i}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>q(o)?Promise.resolve(s.transform(o.value,a)).then(i=>({status:n.value,value:i})):h);v.assertNever(s)}};j.create=(t,e,n)=>new j({schema:t,typeName:g.ZodEffects,effect:e,..._(n)});j.createWithPreprocess=(t,e,n)=>new j({schema:e,effect:{type:"preprocess",transform:t},typeName:g.ZodEffects,..._(n)});P=class extends b{_parse(e){return this._getType(e)===p.undefined?R(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};P.create=(t,e)=>new P({innerType:t,typeName:g.ZodOptional,..._(e)});B=class extends b{_parse(e){return this._getType(e)===p.null?R(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};B.create=(t,e)=>new B({innerType:t,typeName:g.ZodNullable,..._(e)});_e=class extends b{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return n.parsedType===p.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};_e.create=(t,e)=>new _e({innerType:t,typeName:g.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,..._(e)});be=class extends b{_parse(e){let{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return we(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new D(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new D(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};be.create=(t,e)=>new be({innerType:t,typeName:g.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,..._(e)});Re=class extends b{_parse(e){if(this._getType(e)!==p.nan){let r=this._getOrReturnCtx(e);return f(r,{code:d.invalid_type,expected:p.nan,received:r.parsedType}),h}return{status:"valid",value:e.data}}};Re.create=t=>new Re({typeName:g.ZodNaN,..._(t)});ws=Symbol("zod_brand"),Le=class extends b{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}},Fe=class t extends b{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let a=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?h:a.status==="dirty"?(n.dirty(),ae(a.value)):this._def.out._parseAsync({data:a.value,path:r.path,parent:r})})();{let s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?h:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(e,n){return new t({in:e,out:n,typeName:g.ZodPipeline})}},ve=class extends b{_parse(e){let n=this._def.innerType._parse(e),r=s=>(q(s)&&(s.value=Object.freeze(s.value)),s);return we(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}};ve.create=(t,e)=>new ve({innerType:t,typeName:g.ZodReadonly,..._(e)});Ss={object:I.lazycreate};(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(g||(g={}));Ts=(t,e={message:`Input not instance of ${t.name}`})=>yn(n=>n instanceof t,e),_n=Q.create,bn=oe.create,Es=Re.create,As=ie.create,vn=ce.create,$s=ue.create,Rs=Te.create,Cs=de.create,Os=le.create,Ns=X.create,Ds=W.create,Is=L.create,Ps=Ee.create,Ms=G.create,js=I.create,zs=I.strictCreate,Zs=fe.create,Ls=nt.create,Fs=pe.create,Us=V.create,Vs=rt.create,Bs=Ae.create,Ks=$e.create,Hs=st.create,Ws=me.create,Gs=he.create,Ys=ge.create,Js=ye.create,qs=ee.create,Qs=j.create,Xs=P.create,ea=B.create,ta=j.createWithPreprocess,na=Fe.create,ra=()=>_n().optional(),sa=()=>bn().optional(),aa=()=>vn().optional(),oa={string:(t=>Q.create({...t,coerce:!0})),number:(t=>oe.create({...t,coerce:!0})),boolean:(t=>ce.create({...t,coerce:!0})),bigint:(t=>ie.create({...t,coerce:!0})),date:(t=>ue.create({...t,coerce:!0}))},ia=h});var z={};ke(z,{BRAND:()=>ws,DIRTY:()=>ae,EMPTY_PATH:()=>ts,INVALID:()=>h,NEVER:()=>ia,OK:()=>R,ParseStatus:()=>$,Schema:()=>b,ZodAny:()=>X,ZodArray:()=>G,ZodBigInt:()=>ie,ZodBoolean:()=>ce,ZodBranded:()=>Le,ZodCatch:()=>be,ZodDate:()=>ue,ZodDefault:()=>_e,ZodDiscriminatedUnion:()=>nt,ZodEffects:()=>j,ZodEnum:()=>ge,ZodError:()=>D,ZodFirstPartyTypeKind:()=>g,ZodFunction:()=>st,ZodIntersection:()=>pe,ZodIssueCode:()=>d,ZodLazy:()=>me,ZodLiteral:()=>he,ZodMap:()=>Ae,ZodNaN:()=>Re,ZodNativeEnum:()=>ye,ZodNever:()=>L,ZodNull:()=>le,ZodNullable:()=>B,ZodNumber:()=>oe,ZodObject:()=>I,ZodOptional:()=>P,ZodParsedType:()=>p,ZodPipeline:()=>Fe,ZodPromise:()=>ee,ZodReadonly:()=>ve,ZodRecord:()=>rt,ZodSchema:()=>b,ZodSet:()=>$e,ZodString:()=>Q,ZodSymbol:()=>Te,ZodTransformer:()=>j,ZodTuple:()=>V,ZodType:()=>b,ZodUndefined:()=>de,ZodUnion:()=>fe,ZodUnknown:()=>W,ZodVoid:()=>Ee,addIssueToContext:()=>f,any:()=>Ns,array:()=>Ms,bigint:()=>As,boolean:()=>vn,coerce:()=>oa,custom:()=>yn,date:()=>$s,datetimeRegex:()=>hn,defaultErrorMap:()=>K,discriminatedUnion:()=>Ls,effect:()=>Qs,enum:()=>Ys,function:()=>Hs,getErrorMap:()=>xe,getParsedType:()=>U,instanceof:()=>Ts,intersection:()=>Fs,isAborted:()=>et,isAsync:()=>we,isDirty:()=>tt,isValid:()=>q,late:()=>Ss,lazy:()=>Ws,literal:()=>Gs,makeIssue:()=>Ze,map:()=>Bs,nan:()=>Es,nativeEnum:()=>Js,never:()=>Is,null:()=>Os,nullable:()=>ea,number:()=>bn,object:()=>js,objectUtil:()=>xt,oboolean:()=>aa,onumber:()=>sa,optional:()=>Xs,ostring:()=>ra,pipeline:()=>na,preprocess:()=>ta,promise:()=>qs,quotelessJson:()=>Qr,record:()=>Vs,set:()=>Ks,setErrorMap:()=>es,strictObject:()=>zs,string:()=>_n,symbol:()=>Rs,transformer:()=>Qs,tuple:()=>Us,undefined:()=>Cs,union:()=>Zs,unknown:()=>Ds,util:()=>v,void:()=>Ps});var At=w(()=>{Xe();St();un();ze();kn();Qe()});var xn=w(()=>{At();At()});var ca,ua,Ce,wn=w(()=>{"use strict";xn();ca=z.enum(["normal","compact","minimal"]),ua=z.enum(["off","light","balanced","max"]),Ce=z.object({enabled:z.boolean().default(!0),telemetryOptIn:z.boolean().default(!0),outputVerbosity:ca.default("compact"),reducer:ua.default("off"),filters:z.object({enableAll:z.boolean().default(!0),disabled:z.array(z.string().max(64)).max(100).default([])}).default({enableAll:!0,disabled:[]})})});var Nn={};ke(Nn,{clearSettingsCache:()=>ha,loadSettingsCache:()=>Ne,saveSettingsCache:()=>On,updateSettingsCache:()=>ma});import{readFile as An,writeFile as $n,mkdir as Rn,chmod as da,rm as Ue,rename as Cn,readdir as la}from"node:fs/promises";import{randomUUID as fa}from"node:crypto";import{join as Oe}from"node:path";import{setTimeout as Sn}from"node:timers/promises";async function Ne(){let t=null;try{let e=JSON.parse(await An(Oe(S(),$t),"utf8"));typeof e=="object"&&e!==null&&!Array.isArray(e)&&(t=e)}catch{}return t?Ce.parse({...Tn,...t}):Tn}async function On(t){await Rn(S(),{recursive:!0});let e=Oe(S(),$t),n=`${e}.tmp-${process.pid}-${process.hrtime.bigint()}`;await $n(n,JSON.stringify(t,null,2),{mode:384});try{await da(n,384),await Cn(n,e)}catch(r){try{await Ue(n,{force:!0})}catch{}throw r}}async function En(t){let e=[];for(let n of await la(t)){let r=/^([1-9]\d*)-[0-9a-f-]{36}\.json$/.exec(n);if(!r)continue;let s=Oe(t,n);try{process.kill(Number(r[1]),0)}catch(a){let o=a.code;if(o==="ESRCH"){await Ue(s,{force:!0});continue}if(o!=="EPERM")throw a}try{let a=JSON.parse(await An(s,"utf8"));if(!Number.isSafeInteger(a)||a<0)throw new Error("Invalid local settings lock");e.push({id:n,ticket:a})}catch(a){if(a.code!=="ENOENT")throw a}}return e}async function ma(t){let e=pa.parse(t),n=Oe(S(),"settings-cache-locks");await Rn(n,{recursive:!0,mode:448});let r=`${process.pid}-${fa()}.json`,s=Oe(n,r),a=`${s}.tmp`,o=performance.now()+3e3,i=async c=>{for(await $n(a,String(c),{mode:384});;)try{await Cn(a,s);return}catch(u){let l=u.code;if(process.platform!=="win32"||l!=="EPERM"&&l!=="EBUSY"||performance.now()>=o)throw u;await Sn(10)}};try{await i(0);let c=Math.max(0,...(await En(n)).map(u=>u.ticket))+1;if(!Number.isSafeInteger(c))throw new Error("Invalid local settings lock");for(await i(c);;){if(!(await En(n)).some(l=>l.id!==r&&(l.ticket===0||l.ticket<c||l.ticket===c&&l.id<r))){let l=await Ne(),y=Ce.parse({...l,...e,filters:{...l.filters,...e.filters}});return await On(y),y}if(performance.now()>=o)throw new Error("Timed out waiting for local settings lock after 3 seconds; another process may still be updating settings");await Sn(10)}}finally{await Promise.all([Ue(s,{force:!0}),Ue(a,{force:!0})])}}async function ha(){try{await Ue(Oe(S(),$t),{force:!0})}catch{}}var $t,Tn,pa,at=w(()=>{"use strict";wn();Z();$t="settings-cache.json",Tn=Ce.parse({}),pa=Ce.partial().extend({filters:Ce.shape.filters.removeDefault().partial().optional()})});var Ln={};ke(Ln,{STATIC_COMMAND_NAMES:()=>ot,commandInstalled:()=>Zn,commandsInstallStatus:()=>Ea,installCommand:()=>Sa,isFresh:()=>ka,pruneCommands:()=>Ta,pruneSkills:()=>wa,readBundleRefresh:()=>$a,readSkill:()=>Ra,recordBundleRefresh:()=>Aa,writeSkill:()=>xa});import{chmod as Rt,mkdir as it,readFile as Ve,writeFile as ct,stat as Ct,readdir as ga,rm as In}from"node:fs/promises";import{existsSync as ya}from"node:fs";import{dirname as _a}from"node:path";async function Mn(){try{let t=JSON.parse(await Ve(kt(),"utf8"));return Array.isArray(t)?t.filter(e=>typeof e=="string"):[]}catch{return[]}}async function jn(t){try{await it(S(),{recursive:!0}),await ct(kt(),JSON.stringify(t),{mode:384})}catch{}}function zn(){let t=Number(process.env.TOKMIZER_MAX_BUNDLE_AGE_MS);return Number.isFinite(t)&&t>0?Math.min(t,Dn):Dn}async function ka(t){try{let e=await Ct(re(t)),n=Date.now()-e.mtimeMs;return n<va&&n<=zn()}catch{return!1}}async function xa(t,e){await it(Je(),{recursive:!0}),await ct(re(t),e,{mode:384}),await Rt(re(t),384)}async function wa(t){let e=new Set(t),n;try{n=await ga(Je())}catch{return}for(let r of n){if(!r.endsWith(".md"))continue;let s=r.slice(0,-3);if(!e.has(s))try{await In(re(s))}catch{}}}async function Sa(t,e){if(!process.env.TOKMIZER_CLAUDE_COMMANDS_DIR&&!ya(_a(qe())))return;await it(qe(),{recursive:!0});try{if(!(await Ve(se(t),"utf8")).includes(Pn))return}catch{}await ct(se(t),e,{mode:384}),await Rt(se(t),384);let n=await Mn();n.includes(t)||await jn([...n,t])}async function Ta(t){let e=new Set([...t,...ot]),n=await Mn(),r=new Set([...n,...ba]);for(let s of r)if(!e.has(s))try{if(!(await Ve(se(s),"utf8")).includes(Pn))continue;await In(se(s))}catch{}await jn(n.filter(s=>e.has(s)))}async function Ea(){let t=0;for(let e of ot)await Zn(e)&&t++;return{installed:t,total:ot.length}}async function Zn(t){try{return await Ct(se(t)),!0}catch{return!1}}async function Aa(t){try{await it(S(),{recursive:!0}),await ct(Ye(),JSON.stringify({at:Date.now(),error:t}),{mode:384}),await Rt(Ye(),384)}catch{}}async function $a(){try{return JSON.parse(await Ve(Ye(),"utf8"))}catch{return null}}async function Ra(t){try{let e=await Ct(re(t));return Date.now()-e.mtimeMs>zn()?null:await Ve(re(t),"utf8")}catch{return null}}var Pn,ot,ba,va,Dn,Fn=w(()=>{"use strict";Z();Pn="managed-by: tokmizer",ot=["tkr","tkr-gain","tkr-status","tkr-link","tkr-unlink","tkr-compression","tkr-telemetry","tkr-update","tkr-yolo"],ba=["power","tkr-reducer"];va=3600*1e3,Dn=10080*60*1e3});import{join as Ca}from"node:path";import{mkdir as Fc,readFile as Oa,writeFile as Uc,unlink as Vc,rename as Bc}from"node:fs/promises";function Da(){try{let t=Intl.DateTimeFormat().resolvedOptions().timeZone;return t&&t.length>0?t:"Etc/UTC"}catch{return"Etc/UTC"}}function Ia(t){return t?.dir??S()}async function ut(t){let e=Ia(t);try{let n=await Oa(Ca(e,Na),"utf8"),r=JSON.parse(n),s=r.timeZone;return{...r,lastSettingsRevision:r.lastSettingsRevision??0,get timeZone(){return s??=Da()},bonusActive:r.bonusActive??!1,...r.bonusResetAt!==void 0?{bonusResetAt:r.bonusResetAt}:{}}}catch{return null}}var Na,Ot=w(()=>{"use strict";Z();Na="state.json"});function Un(t,e=Date.now()){return t.plan}function Vn(t,e=Date.now()){return t.bonusActive??!1}var Bn=w(()=>{"use strict"});function Kn(t,e=!1){return!0}var Hn=w(()=>{"use strict"});var Wn={};ke(Wn,{reducerStillEntitled:()=>Pa});async function Pa(){let t=await ut();return t?Kn(Un(t),Vn(t)):!1}var Gn=w(()=>{"use strict";Ot();Bn();Hn()});function Nt(t){let e=t;for(let[n,r]of Ma)e=e.replace(n,r);return e}var Ma,Y,Qc,Yn=w(()=>{"use strict";Ma=[[/(authorization\s*:\s*)([A-Za-z][A-Za-z0-9._-]*)\s+[^\s'"]+/gi,"$1$2 [REDACTED]"],[/(authorization\s*:\s*)[A-Za-z0-9._\-+/=]{8,}/gi,"$1[REDACTED]"],[/(bearer\s+)[A-Za-z0-9._\-+/=]{8,}/gi,"$1[REDACTED]"],[/((?:^|\s)(?:-b|--cookie)[=\s]+['"]?)[^\s'";=]+=[^\s'";]+(?:\s*;\s*[^\s'";=]+=[^\s'";]+)*/gi,"$1[REDACTED]"],[/((?:^|[\s'"])(?:Set-)?Cookie\s*:\s*)[^\s'";=]+=[^\s'";]+(?:\s*;\s*[^\s'";=]+=[^\s'";]+)*/gi,"$1[REDACTED]"],[/(--?(?:password|passwd|passphrase|apipass|pass|pwd|token|api[-_]?key|secret|bearer|cookie|jwt)(?:-[a-z0-9]+)*[=\s]+)\S+/gi,"$1[REDACTED]"],[/((?:^|\s)-b[=\s]?['"]?)[^\s'"=]+=[^\s'"]+/gi,"$1[REDACTED]"],[/((?:^|\s)(?:-u[=\s]?|(?:--user|-a)[=\s])['"]?[^\s:/'"]*:)(\/[^/\s'"][^\s'"]*|[^\s/'"0-9][^\s'"]*|[0-9][^\s'"]*[^\s'"0-9][^\s'"]*)/gi,"$1[REDACTED]"],[/((?:^|\s)(?:-u[=\s]?|(?:--user|-a)[=\s])['"]?[^\s:/'"]*[^\s:/'"0-9][^\s:/'"]*:)(?:\/[^/\s'"]|[^\s/'"])[^\s'"]*/gi,"$1[REDACTED]"],[/((?:^|\s)(?:-u[=\s]?|(?:--user|-a)[=\s])['"]?:)(?:\/[^/\s'"]|[^\s/'"])[^\s'"]*/gi,"$1[REDACTED]"],[/((?:[A-Za-z0-9]+-){0,8}(?:X-Api-Key|Private-Token|[A-Za-z0-9]+-(?:Token|Key|Auth|Secret))\s*:\s*)[^\s'"]+/gi,"$1[REDACTED]"],[/((?:^|[\s'"])(?:Set-)?Cookie\s*:\s*)[^\s'"]+/gi,"$1[REDACTED]"],[/(-i\s+)(\/[^\s]+|~\/[^\s]+|[A-Z]:\\[^\s]+)/g,"$1[REDACTED]"],[/([a-zA-Z][a-zA-Z0-9+.-]{0,31}:\/\/[^:/\s@]*:)[^\s@]+(@[^@/\s]+)/g,"$1[REDACTED]$2"],[/(AWS_(?:ACCESS_KEY_ID|SECRET_ACCESS_KEY|SESSION_TOKEN)\s*=\s*)\S+/g,"$1[REDACTED]"],[/(GOOGLE_APPLICATION_CREDENTIALS\s*=\s*)\S+/g,"$1[REDACTED]"],[/(AZURE_(?:CLIENT_SECRET|TENANT_ID|CLIENT_ID)\s*=\s*)\S+/g,"$1[REDACTED]"],[/(sk-(?:proj-)?[A-Za-z0-9_-]{20,})/g,"sk-[REDACTED]"],[/\b(OPENAI_API_KEY\s*=\s*)\S+/g,"$1[REDACTED]"],[/\b(ANTHROPIC_API_KEY\s*=\s*)\S+/g,"$1[REDACTED]"],[/(sk-ant-[A-Za-z0-9_-]{20,})/g,"sk-ant-[REDACTED]"],[/\b(GH(?:_|ITHUB_)?TOKEN\s*=\s*)\S+/g,"$1[REDACTED]"],[/\b(GITLAB_TOKEN\s*=\s*)\S+/g,"$1[REDACTED]"],[/\b(SLACK_(?:BOT_)?TOKEN\s*=\s*)\S+/g,"$1[REDACTED]"],[/(xox[bpsoa]-[A-Za-z0-9-]{10,})/g,"xox[REDACTED]"],[/(xapp-[A-Za-z0-9-]{10,})/g,"[REDACTED]"],[/(sk_(?:test|live)_[A-Za-z0-9]{16,})/g,"sk_[REDACTED]"],[/(gh[a-z])_[A-Za-z0-9]{20,}/g,"$1_[REDACTED]"],[/(github_pat)_[A-Za-z0-9_]{20,}/g,"$1_[REDACTED]"],[/(gl(?:pat|rt|soat|imt|dt|ft|agent|oas|cbt|ptt))-[A-Za-z0-9_-]{16,}/g,"$1-[REDACTED]"],[/(npm_[A-Za-z0-9_-]{20,})/g,"npm_[REDACTED]"],[/(?:AKIA|ASIA|AGPA|AIDA|AROA|ANPA)[0-9A-Z]{16,}/g,"[REDACTED_AWS_KEY]"],[/AIza[A-Za-z0-9_-]{35}/g,"[REDACTED_GOOGLE_KEY]"],[/hv[sb]\.[A-Za-z0-9_-]{20,}/g,"[REDACTED_VAULT_TOKEN]"],[/dop_v1_[A-Za-z0-9]{40,}/g,"[REDACTED]"],[/dckr_pat_[A-Za-z0-9_-]{20,}/g,"[REDACTED]"],[/pypi-[A-Za-z0-9_-]{16,}/g,"[REDACTED]"],[/rk_(?:live|test)_[A-Za-z0-9]{16,}/g,"[REDACTED]"],[/whsec_[A-Za-z0-9]{16,}/g,"[REDACTED]"],[/SG\.[A-Za-z0-9_-]{20,}\.[A-Za-z0-9_-]{20,}/g,"[REDACTED]"],[/(eyJ[A-Za-z0-9_-]{6,}(?:\.[A-Za-z0-9_-]{4,}){1,2})/g,"[REDACTED_JWT]"],[/-----BEGIN [A-Z ]*PRIVATE KEY-----(?:[\s\S]*?-----END[^\n]*-----|\r?\n[A-Za-z0-9+/=][A-Za-z0-9+/=\r\n]*)?/g,"[REDACTED_PEM]"],[/\b((?:--?)?[A-Za-z0-9_]*(?:TOKEN|SECRET|PASSWORD|PASSWD|PASS|APIKEY|KEY|CRED|CREDS|CREDENTIAL|CREDENTIALS|AUTH|_PWD)[A-Za-z0-9_]*['"]?\s*=\s*)(?:"[^"]*"|'[^']*'|[^"'\s]\S*)/gi,"$1[REDACTED]"],[/\b([A-Za-z0-9_]*(?:TOKEN|SECRET|PASSWORD|PASSWD|PASS|APIKEY|KEY|CRED|CREDS|CREDENTIAL|CREDENTIALS|_PWD)[A-Za-z0-9_]*['"]?\s*:\s*)(?:"[^"]*"|'[^']*'|[^\s'",}]+)/gi,"$1[REDACTED]"],[/((?:^|[\s'"{,])['"]?(?:[A-Za-z0-9_]+_)?auth['"]?\s*:\s*)(?:"[^"]*"|'[^']*'|[^\s'",}]+)/gi,"$1[REDACTED]"],[/(\bpwd\s*[=:]\s*)(?:"[^"]*"|'[^']*'|[^/~\s][^\s;'"]*)/gi,"$1[REDACTED]"],[/([=:]\s*["']?)[A-Za-z0-9_\-+/=]{40,}/g,"$1[REDACTED]"]];Y="[tkr: secret masked]",Qc=[[/(-----BEGIN [A-Z0-9 ]*PRIVATE KEY-----)(?:\r?\n(?:[A-Za-z0-9+/=]{16,}|[A-Za-z-]+: [^\r\n]*|\r?(?=\n)))*(?:(?:\r?\n[A-Za-z0-9+/=]{1,15})?\r?\n-----END [A-Z0-9 ]*PRIVATE KEY-----)?/g,`$1${Y}`],[/(?<![A-Za-z0-9_])(gh[pousr])_[A-Za-z0-9]{36,255}(?![A-Za-z0-9])/g,`$1_${Y}`],[/(?<![A-Za-z0-9_])github_pat_[A-Za-z0-9_]{22,255}/g,`github_pat_${Y}`],[/(?<![A-Za-z0-9_])npm_[A-Za-z0-9]{36}(?![A-Za-z0-9])/g,`npm_${Y}`],[/(?<![A-Z0-9])(AKIA|ASIA)[A-Z0-9]{16}(?![A-Z0-9])/g,`$1${Y}`],[/(?<![A-Za-z0-9])(xox[abpors]-)[A-Za-z0-9-]{10,}/g,`$1${Y}`],[/(?<![A-Za-z0-9])((?:sk|rk)_live_)[A-Za-z0-9]{16,}/g,`$1${Y}`],[/(authorization["']?\s*[:=]\s*["']?bearer\s+)[A-Za-z0-9._~+/=-]{8,}/gi,`$1${Y}`],[/(?<![A-Za-z0-9+.-])([a-zA-Z][a-zA-Z0-9+.-]{0,31}:\/\/[^\s:/@]*:)[^\s@/]+(@[^\s@/]+)/g,`$1${Y}$2`]]});function Jn(){let t=process.env.TOKMIZER_BASE_URL;if(t===De||t===`${De}/`||!t)return De;try{let e=new URL(t);return e.protocol==="http:"&&ja.has(e.hostname)&&!e.username&&!e.password?t:De}catch{return De}}var De,ja,qn=w(()=>{"use strict";De="https://tokmizer.com",ja=new Set(["127.0.0.1","localhost"])});import Ie from"node:os";import{createHash as za,createHmac as Qn,randomUUID as Za}from"node:crypto";import{readFile as Xn,writeFile as er,mkdir as La}from"node:fs/promises";async function Fa(){try{let n=(await Xn(je(),"utf8")).trim();if(/^[0-9a-f-]{36}$/i.test(n))return n}catch{}await La(S(),{recursive:!0});let t=Za();try{return await er(je(),t,{mode:384,flag:"wx"}),t}catch{try{let e=(await Xn(je(),"utf8")).trim();if(/^[0-9a-f-]{36}$/i.test(e))return e}catch{}return await er(je(),t,{mode:384}),t}}function Dt(t){return za("sha256").update(t).digest("hex")}function Ua(){let t=Ie.networkInterfaces();for(let e of Object.keys(t))for(let n of t[e]??[])if(!n.internal&&n.mac&&n.mac!=="00:00:00:00:00:00")return n.mac;return"no-mac"}async function tr(){let t=await Fa(),e=Ie.hostname(),n=Ie.platform(),r=Ie.release(),s=Ie.cpus(),a=s[0]?.model??"unknown",o=s.length,i=Ua(),c=Ie.userInfo().username,u=[e,n,r,a,String(o),Dt(i),Dt(c),t].join("|");return{fingerprint:Dt(u),installId:t,hostname:e,os:n,osVersion:r,cpuModel:a,cpuCores:o,macHash:Qn("sha256",t).update(i).digest("hex"),usernameHash:Qn("sha256",t).update(c).digest("hex")}}var nr=w(()=>{"use strict";Z()});import{createRequire as Va}from"node:module";function Ka(){let t="0.9.69";if(t)return t;for(let e of["../package.json","../../package.json"])try{let n=Ba(e).version;if(typeof n=="string"&&n)return n}catch{}return"0.0.0"}var Ba,It,Pt=w(()=>{"use strict";Ba=Va(import.meta.url);It=Ka()});var rr=w(()=>{"use strict"});import{existsSync as Ha,mkdirSync as du,rmSync as lu,writeFileSync as fu}from"node:fs";import{join as Wa}from"node:path";function Ja(){return Wa(S(),"network-off")}function qa(){let t=process.env.TOKMIZER_NETWORK;return t!==void 0&&Ga.has(t.trim().toLowerCase())}function Be(){return qa()?!1:!Ha(Ja())}function sr(){if(!Be())throw new Mt}var Ga,Ya,hu,Mt,dt=w(()=>{"use strict";Z();Ga=new Set(["0","off","false","no"]),Ya="Network is off for Tokmizer. Turn it back on with: tkr network on",hu=["Tokmizer contacts tokmizer.com to keep its rules up to date and to improve the product. No account or email is needed.","It sends a random install ID, your computer name, OS and CPU model, a hash of your network card address and of your user name, and the plugin version. Command contents and output are never sent.","Usage stats (command names, token counts and install health counts) are sent only while they are on. Check with: tkr telemetry status.","Turn all network access off: tkr network off. Usage stats only: tkr telemetry off."].join(`
4
4
  `),Mt=class extends Error{constructor(){super(Ya),this.name="NetworkDisabledError"}}});import{createHmac as Qa,createPublicKey as bu,verify as vu}from"node:crypto";function eo(t,e,n,r,s){return Qa("sha256",s).update(`${t}
5
5
  ${e}
6
6
  ${r}
@@ -2,5 +2,5 @@ import { createRequire as __tkrCreateRequire } from "node:module"; const require
2
2
  var rt=Object.defineProperty;var nt=(r,e)=>{for(var t in e)rt(r,t,{get:e[t],enumerable:!0})};function Oe(r=5e3){return new Promise(e=>{let t=[],n=process.stdin,s=!1,a=()=>{s||(s=!0,clearTimeout(o),n.off("data",i),n.pause(),n.unref?.(),e(Buffer.concat(t).toString("utf8")))},i=u=>{t.push(Buffer.isBuffer(u)?u:Buffer.from(u))},o=setTimeout(a,r);n.on("data",i).once("end",a).once("error",a),n.resume()})}import{realpathSync as Ce}from"node:fs";import{fileURLToPath as st,pathToFileURL as at}from"node:url";var Ne=null;function Re(r,e,t){if(t!==void 0&&Ne===t)return!0;if(Ne!==null||!r)return!1;if(e===at(r).href)return!0;try{return Ce(r)===Ce(st(e))}catch{return!1}}import{appendFileSync as ln,mkdirSync as fn,readFileSync as ct,writeFileSync as pn,renameSync as hn,statSync as ut,readdirSync as dt,rmSync as lt,chmodSync as mn}from"node:fs";import{join as be}from"node:path";import it from"node:os";import{join as ot}from"node:path";function S(){return process.env.TOKMIZER_HOME||ot(it.homedir(),".tokmizer")}var _n=96*1024;var ft=168*3600*1e3;function Ae(){return be(S(),"sessions")}function pt(r){let e=r.replace(/[^A-Za-z0-9._-]/g,"-").replace(/\.\./g,"-").slice(0,80)||"default";return be(Ae(),`${e}.jsonl`)}function Ie(r){try{let e=ct(pt(r),"utf8"),t=[];for(let n of e.split(`
3
3
  `))if(n.trim())try{let s=JSON.parse(n);typeof s.tool=="string"&&typeof s.target=="string"&&t.push(s)}catch{}return t}catch{return[]}}function je(){try{let r=Ae(),e=Date.now();for(let t of dt(r)){let n=be(r,t);try{e-ut(n).mtimeMs>ft&&lt(n,{force:!0})}catch{}}}catch{}}function $e(r){if(r.length===0)return"";let e=new Map,t=[],n=[];for(let u of r)u.tool==="Read"?e.set(u.target,(e.get(u.target)??0)+1):u.tool==="Grep"||u.tool==="Glob"?t.includes(u.target)||t.push(u.target):u.tool==="Bash"&&n.push({target:u.target,fail:u.fail===1});let s=["Tokmizer session recap (this session before context trimming):"],a=[...e.entries()].slice(-12);if(a.length>0){s.push("Files read:");for(let[u,l]of a)s.push(l>1?` ${u} \xD7${l}`:` ${u}`)}t.length>0&&s.push(`Searches: ${t.slice(-5).join(", ")}`);let i=new Set,o=[];for(let u=n.length-1;u>=0&&o.length<8;u--){let l=n[u];i.has(l.target)||(i.add(l.target),o.unshift(l))}if(o.length>0){s.push("Recent commands:");for(let u of o)s.push(u.fail?` ${u.target} \u2717 failed`:` ${u.target}`)}return s.push("Originals of trimmed outputs stay recoverable: tkr restore <hash>."),s.slice(0,30).join(`
4
4
  `)}import{appendFileSync as kn,chmodSync as bn,mkdirSync as wn,readFileSync as Sn,rmSync as ht,statSync as Tn}from"node:fs";import{join as mt}from"node:path";var Cn=256*1024;function gt(r){let e=r.replace(/[^A-Za-z0-9._-]/g,"-").replace(/\.\./g,"-").slice(0,80)||"default";return mt(S(),"sessions",`${e}.seen`)}function Me(r){try{ht(gt(r),{force:!0})}catch{}}import{existsSync as Xe,mkdirSync as Lr,writeFileSync as Dr}from"node:fs";import{join as Fr}from"node:path";import{readFile as Nr,writeFile as as,mkdir as is,chmod as os,rm as cs,rename as us,readdir as ds}from"node:fs/promises";import{join as Rr}from"node:path";var N={};nt(N,{BRAND:()=>Ft,DIRTY:()=>F,EMPTY_PATH:()=>xt,INVALID:()=>h,NEVER:()=>Er,OK:()=>k,ParseStatus:()=>x,Schema:()=>y,ZodAny:()=>L,ZodArray:()=>P,ZodBigInt:()=>B,ZodBoolean:()=>H,ZodBranded:()=>pe,ZodCatch:()=>re,ZodDate:()=>W,ZodDefault:()=>te,ZodDiscriminatedUnion:()=>_e,ZodEffects:()=>C,ZodEnum:()=>Q,ZodError:()=>b,ZodFirstPartyTypeKind:()=>m,ZodFunction:()=>xe,ZodIntersection:()=>Y,ZodIssueCode:()=>c,ZodLazy:()=>G,ZodLiteral:()=>X,ZodMap:()=>ue,ZodNaN:()=>le,ZodNativeEnum:()=>ee,ZodNever:()=>R,ZodNull:()=>J,ZodNullable:()=>j,ZodNumber:()=>U,ZodObject:()=>w,ZodOptional:()=>E,ZodParsedType:()=>f,ZodPipeline:()=>he,ZodPromise:()=>D,ZodReadonly:()=>ne,ZodRecord:()=>ve,ZodSchema:()=>y,ZodSet:()=>de,ZodString:()=>z,ZodSymbol:()=>oe,ZodTransformer:()=>C,ZodTuple:()=>I,ZodType:()=>y,ZodUndefined:()=>q,ZodUnion:()=>K,ZodUnknown:()=>Z,ZodVoid:()=>ce,addIssueToContext:()=>d,any:()=>Gt,array:()=>tr,bigint:()=>Wt,boolean:()=>We,coerce:()=>Tr,custom:()=>Ue,date:()=>qt,datetimeRegex:()=>De,defaultErrorMap:()=>$,discriminatedUnion:()=>ar,effect:()=>yr,enum:()=>hr,function:()=>lr,getErrorMap:()=>se,getParsedType:()=>A,instanceof:()=>Bt,intersection:()=>ir,isAborted:()=>ge,isAsync:()=>ae,isDirty:()=>ye,isValid:()=>V,late:()=>Ut,lazy:()=>fr,literal:()=>pr,makeIssue:()=>fe,map:()=>ur,nan:()=>Ht,nativeEnum:()=>mr,never:()=>Qt,null:()=>Yt,nullable:()=>vr,number:()=>He,object:()=>rr,objectUtil:()=>we,oboolean:()=>Sr,onumber:()=>wr,optional:()=>_r,ostring:()=>br,pipeline:()=>kr,preprocess:()=>xr,promise:()=>gr,quotelessJson:()=>yt,record:()=>cr,set:()=>dr,setErrorMap:()=>vt,strictObject:()=>nr,string:()=>Be,symbol:()=>Jt,transformer:()=>yr,tuple:()=>or,undefined:()=>Kt,union:()=>sr,unknown:()=>Xt,util:()=>_,void:()=>er});var _;(function(r){r.assertEqual=s=>{};function e(s){}r.assertIs=e;function t(s){throw new Error}r.assertNever=t,r.arrayToEnum=s=>{let a={};for(let i of s)a[i]=i;return a},r.getValidEnumValues=s=>{let a=r.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),i={};for(let o of a)i[o]=s[o];return r.objectValues(i)},r.objectValues=s=>r.objectKeys(s).map(function(a){return s[a]}),r.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{let a=[];for(let i in s)Object.prototype.hasOwnProperty.call(s,i)&&a.push(i);return a},r.find=(s,a)=>{for(let i of s)if(a(i))return i},r.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function n(s,a=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}r.joinValues=n,r.jsonStringifyReplacer=(s,a)=>typeof a=="bigint"?a.toString():a})(_||(_={}));var we;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(we||(we={}));var f=_.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),A=r=>{switch(typeof r){case"undefined":return f.undefined;case"string":return f.string;case"number":return Number.isNaN(r)?f.nan:f.number;case"boolean":return f.boolean;case"function":return f.function;case"bigint":return f.bigint;case"symbol":return f.symbol;case"object":return Array.isArray(r)?f.array:r===null?f.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?f.promise:typeof Map<"u"&&r instanceof Map?f.map:typeof Set<"u"&&r instanceof Set?f.set:typeof Date<"u"&&r instanceof Date?f.date:f.object;default:return f.unknown}};var c=_.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"]),yt=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:"),b=class r extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(a){return a.message},n={_errors:[]},s=a=>{for(let i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let o=n,u=0;for(;u<i.path.length;){let l=i.path[u];u===i.path.length-1?(o[l]=o[l]||{_errors:[]},o[l]._errors.push(t(i))):o[l]=o[l]||{_errors:[]},o=o[l],u++}}};return s(this),n}static assert(e){if(!(e instanceof r))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,_.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},n=[];for(let s of this.issues)if(s.path.length>0){let a=s.path[0];t[a]=t[a]||[],t[a].push(e(s))}else n.push(e(s));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};b.create=r=>new b(r);var _t=(r,e)=>{let t;switch(r.code){case c.invalid_type:r.received===f.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case c.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,_.jsonStringifyReplacer)}`;break;case c.unrecognized_keys:t=`Unrecognized key(s) in object: ${_.joinValues(r.keys,", ")}`;break;case c.invalid_union:t="Invalid input";break;case c.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${_.joinValues(r.options)}`;break;case c.invalid_enum_value:t=`Invalid enum value. Expected ${_.joinValues(r.options)}, received '${r.received}'`;break;case c.invalid_arguments:t="Invalid function arguments";break;case c.invalid_return_type:t="Invalid function return type";break;case c.invalid_date:t="Invalid date";break;case c.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:_.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case c.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="bigint"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case c.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case c.custom:t="Invalid input";break;case c.invalid_intersection_types:t="Intersection results could not be merged";break;case c.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case c.not_finite:t="Number must be finite";break;default:t=e.defaultError,_.assertNever(r)}return{message:t}},$=_t;var Ze=$;function vt(r){Ze=r}function se(){return Ze}var fe=r=>{let{data:e,path:t,errorMaps:n,issueData:s}=r,a=[...t,...s.path||[]],i={...s,path:a};if(s.message!==void 0)return{...s,path:a,message:s.message};let o="",u=n.filter(l=>!!l).slice().reverse();for(let l of u)o=l(i,{data:e,defaultError:o}).message;return{...s,path:a,message:o}},xt=[];function d(r,e){let t=se(),n=fe({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===$?void 0:$].filter(s=>!!s)});r.common.issues.push(n)}var x=class r{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let n=[];for(let s of t){if(s.status==="aborted")return h;s.status==="dirty"&&e.dirty(),n.push(s.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){let n=[];for(let s of t){let a=await s.key,i=await s.value;n.push({key:a,value:i})}return r.mergeObjectSync(e,n)}static mergeObjectSync(e,t){let n={};for(let s of t){let{key:a,value:i}=s;if(a.status==="aborted"||i.status==="aborted")return h;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(n[a.value]=i.value)}return{status:e.value,value:n}}},h=Object.freeze({status:"aborted"}),F=r=>({status:"dirty",value:r}),k=r=>({status:"valid",value:r}),ge=r=>r.status==="aborted",ye=r=>r.status==="dirty",V=r=>r.status==="valid",ae=r=>typeof Promise<"u"&&r instanceof Promise;var p;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e?.message})(p||(p={}));var O=class{constructor(e,t,n,s){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Pe=(r,e)=>{if(V(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new b(r.common.issues);return this._error=t,this._error}}};function g(r){if(!r)return{};let{errorMap:e,invalid_type_error:t,required_error:n,description:s}=r;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(i,o)=>{let{message:u}=r;return i.code==="invalid_enum_value"?{message:u??o.defaultError}:typeof o.data>"u"?{message:u??n??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:u??t??o.defaultError}},description:s}}var y=class{get description(){return this._def.description}_getType(e){return A(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:A(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new x,ctx:{common:e.parent.common,data:e.data,parsedType:A(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(ae(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){let n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:A(e)},s=this._parseSync({data:e,path:n.path,parent:n});return Pe(n,s)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:A(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:t});return V(n)?{value:n.value}:{issues:t.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(n=>V(n)?{value:n.value}:{issues:t.common.issues})}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:A(e)},s=this._parse({data:e,path:n.path,parent:n}),a=await(ae(s)?s:Promise.resolve(s));return Pe(n,a)}refine(e,t){let n=s=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(s):t;return this._refinement((s,a)=>{let i=e(s),o=()=>a.addIssue({code:c.custom,...n(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(u=>u?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,t){return this._refinement((n,s)=>e(n)?!0:(s.addIssue(typeof t=="function"?t(n,s):t),!1))}_refinement(e){return new C({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 j.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return P.create(this)}promise(){return D.create(this,this._def)}or(e){return K.create([this,e],this._def)}and(e){return Y.create(this,e,this._def)}transform(e){return new C({...g(this._def),schema:this,typeName:m.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new te({...g(this._def),innerType:this,defaultValue:t,typeName:m.ZodDefault})}brand(){return new pe({typeName:m.ZodBranded,type:this,...g(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new re({...g(this._def),innerType:this,catchValue:t,typeName:m.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return he.create(this,e)}readonly(){return ne.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},kt=/^c[^\s-]{8,}$/i,bt=/^[0-9a-z]+$/,wt=/^[0-9A-HJKMNP-TV-Z]{26}$/i,St=/^[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,Tt=/^[a-z0-9_-]{21}$/i,Et=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Ot=/^[-+]?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)?)??$/,Ct=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Nt="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Se,Rt=/^(?:(?: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])$/,At=/^(?:(?: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])$/,It=/^(([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]))$/,jt=/^(([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])$/,$t=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Mt=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ze="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Zt=new RegExp(`^${ze}$`);function Le(r){let e="[0-5]\\d";r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`);let t=r.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function Pt(r){return new RegExp(`^${Le(r)}$`)}function De(r){let e=`${ze}T${Le(r)}`,t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Vt(r,e){return!!((e==="v4"||!e)&&Rt.test(r)||(e==="v6"||!e)&&It.test(r))}function zt(r,e){if(!Et.test(r))return!1;try{let[t]=r.split(".");if(!t)return!1;let n=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),s=JSON.parse(atob(n));return!(typeof s!="object"||s===null||"typ"in s&&s?.typ!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function Lt(r,e){return!!((e==="v4"||!e)&&At.test(r)||(e==="v6"||!e)&&jt.test(r))}var z=class r extends y{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==f.string){let a=this._getOrReturnCtx(e);return d(a,{code:c.invalid_type,expected:f.string,received:a.parsedType}),h}let n=new x,s;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(s=this._getOrReturnCtx(e,s),d(s,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")e.data.length>a.value&&(s=this._getOrReturnCtx(e,s),d(s,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){let i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(s=this._getOrReturnCtx(e,s),i?d(s,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&d(s,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")Ct.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"email",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")Se||(Se=new RegExp(Nt,"u")),Se.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"emoji",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")St.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"uuid",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")Tt.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"nanoid",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")kt.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"cuid",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")bt.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"cuid2",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")wt.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"ulid",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),d(s,{validation:"url",code:c.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"regex",code:c.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(s=this._getOrReturnCtx(e,s),d(s,{code:c.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(s=this._getOrReturnCtx(e,s),d(s,{code:c.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(s=this._getOrReturnCtx(e,s),d(s,{code:c.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?De(a).test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{code:c.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?Zt.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{code:c.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?Pt(a).test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{code:c.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?Ot.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"duration",code:c.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?Vt(e.data,a.version)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"ip",code:c.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?zt(e.data,a.alg)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"jwt",code:c.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?Lt(e.data,a.version)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"cidr",code:c.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?$t.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"base64",code:c.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?Mt.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"base64url",code:c.invalid_string,message:a.message}),n.dirty()):_.assertNever(a);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(s=>e.test(s),{validation:t,code:c.invalid_string,...p.errToObj(n)})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...p.errToObj(e)})}url(e){return this._addCheck({kind:"url",...p.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...p.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...p.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...p.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...p.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...p.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...p.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...p.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...p.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...p.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...p.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...p.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...p.errToObj(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?.precision>"u"?null:e?.precision,...p.errToObj(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?.position,...p.errToObj(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 r({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new r({...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(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};z.create=r=>new z({checks:[],typeName:m.ZodString,coerce:r?.coerce??!1,...g(r)});function Dt(r,e){let t=(r.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=t>n?t:n,a=Number.parseInt(r.toFixed(s).replace(".","")),i=Number.parseInt(e.toFixed(s).replace(".",""));return a%i/10**s}var U=class r extends y{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==f.number){let a=this._getOrReturnCtx(e);return d(a,{code:c.invalid_type,expected:f.number,received:a.parsedType}),h}let n,s=new x;for(let a of this._def.checks)a.kind==="int"?_.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{code:c.invalid_type,expected:"integer",received:"float",message:a.message}),s.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),d(n,{code:c.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),d(n,{code:c.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?Dt(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),d(n,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{code:c.not_finite,message:a.message}),s.dirty()):_.assertNever(a);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,n,s){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:p.toString(s)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:p.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:p.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:p.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:p.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:p.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:p.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:p.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:p.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:p.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let 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"&&_.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}};U.create=r=>new U({checks:[],typeName:m.ZodNumber,coerce:r?.coerce||!1,...g(r)});var B=class r extends y{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==f.bigint)return this._getInvalidInput(e);let n,s=new x;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),d(n,{code:c.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),d(n,{code:c.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),d(n,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):_.assertNever(a);return{status:s.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return d(t,{code:c.invalid_type,expected:f.bigint,received:t.parsedType}),h}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,n,s){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:p.toString(s)}]})}_addCheck(e){return new r({...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(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};B.create=r=>new B({checks:[],typeName:m.ZodBigInt,coerce:r?.coerce??!1,...g(r)});var H=class extends y{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==f.boolean){let n=this._getOrReturnCtx(e);return d(n,{code:c.invalid_type,expected:f.boolean,received:n.parsedType}),h}return k(e.data)}};H.create=r=>new H({typeName:m.ZodBoolean,coerce:r?.coerce||!1,...g(r)});var W=class r extends y{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==f.date){let a=this._getOrReturnCtx(e);return d(a,{code:c.invalid_type,expected:f.date,received:a.parsedType}),h}if(Number.isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return d(a,{code:c.invalid_date}),h}let n=new x,s;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(s=this._getOrReturnCtx(e,s),d(s,{code:c.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(s=this._getOrReturnCtx(e,s),d(s,{code:c.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):_.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new r({...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(let 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(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};W.create=r=>new W({checks:[],coerce:r?.coerce||!1,typeName:m.ZodDate,...g(r)});var oe=class extends y{_parse(e){if(this._getType(e)!==f.symbol){let n=this._getOrReturnCtx(e);return d(n,{code:c.invalid_type,expected:f.symbol,received:n.parsedType}),h}return k(e.data)}};oe.create=r=>new oe({typeName:m.ZodSymbol,...g(r)});var q=class extends y{_parse(e){if(this._getType(e)!==f.undefined){let n=this._getOrReturnCtx(e);return d(n,{code:c.invalid_type,expected:f.undefined,received:n.parsedType}),h}return k(e.data)}};q.create=r=>new q({typeName:m.ZodUndefined,...g(r)});var J=class extends y{_parse(e){if(this._getType(e)!==f.null){let n=this._getOrReturnCtx(e);return d(n,{code:c.invalid_type,expected:f.null,received:n.parsedType}),h}return k(e.data)}};J.create=r=>new J({typeName:m.ZodNull,...g(r)});var L=class extends y{constructor(){super(...arguments),this._any=!0}_parse(e){return k(e.data)}};L.create=r=>new L({typeName:m.ZodAny,...g(r)});var Z=class extends y{constructor(){super(...arguments),this._unknown=!0}_parse(e){return k(e.data)}};Z.create=r=>new Z({typeName:m.ZodUnknown,...g(r)});var R=class extends y{_parse(e){let t=this._getOrReturnCtx(e);return d(t,{code:c.invalid_type,expected:f.never,received:t.parsedType}),h}};R.create=r=>new R({typeName:m.ZodNever,...g(r)});var ce=class extends y{_parse(e){if(this._getType(e)!==f.undefined){let n=this._getOrReturnCtx(e);return d(n,{code:c.invalid_type,expected:f.void,received:n.parsedType}),h}return k(e.data)}};ce.create=r=>new ce({typeName:m.ZodVoid,...g(r)});var P=class r extends y{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),s=this._def;if(t.parsedType!==f.array)return d(t,{code:c.invalid_type,expected:f.array,received:t.parsedType}),h;if(s.exactLength!==null){let i=t.data.length>s.exactLength.value,o=t.data.length<s.exactLength.value;(i||o)&&(d(t,{code:i?c.too_big:c.too_small,minimum:o?s.exactLength.value:void 0,maximum:i?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&t.data.length<s.minLength.value&&(d(t,{code:c.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&t.data.length>s.maxLength.value&&(d(t,{code:c.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((i,o)=>s.type._parseAsync(new O(t,i,t.path,o)))).then(i=>x.mergeArray(n,i));let a=[...t.data].map((i,o)=>s.type._parseSync(new O(t,i,t.path,o)));return x.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new r({...this._def,minLength:{value:e,message:p.toString(t)}})}max(e,t){return new r({...this._def,maxLength:{value:e,message:p.toString(t)}})}length(e,t){return new r({...this._def,exactLength:{value:e,message:p.toString(t)}})}nonempty(e){return this.min(1,e)}};P.create=(r,e)=>new P({type:r,minLength:null,maxLength:null,exactLength:null,typeName:m.ZodArray,...g(e)});function ie(r){if(r instanceof w){let e={};for(let t in r.shape){let n=r.shape[t];e[t]=E.create(ie(n))}return new w({...r._def,shape:()=>e})}else return r instanceof P?new P({...r._def,type:ie(r.element)}):r instanceof E?E.create(ie(r.unwrap())):r instanceof j?j.create(ie(r.unwrap())):r instanceof I?I.create(r.items.map(e=>ie(e))):r}var w=class r extends y{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=_.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==f.object){let l=this._getOrReturnCtx(e);return d(l,{code:c.invalid_type,expected:f.object,received:l.parsedType}),h}let{status:n,ctx:s}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof R&&this._def.unknownKeys==="strip"))for(let l in s.data)i.includes(l)||o.push(l);let u=[];for(let l of i){let v=a[l],T=s.data[l];u.push({key:{status:"valid",value:l},value:v._parse(new O(s,T,s.path,l)),alwaysSet:l in s.data})}if(this._def.catchall instanceof R){let l=this._def.unknownKeys;if(l==="passthrough")for(let v of o)u.push({key:{status:"valid",value:v},value:{status:"valid",value:s.data[v]}});else if(l==="strict")o.length>0&&(d(s,{code:c.unrecognized_keys,keys:o}),n.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let v of o){let T=s.data[v];u.push({key:{status:"valid",value:v},value:l._parse(new O(s,T,s.path,v)),alwaysSet:v in s.data})}}return s.common.async?Promise.resolve().then(async()=>{let l=[];for(let v of u){let T=await v.key,Ee=await v.value;l.push({key:T,value:Ee,alwaysSet:v.alwaysSet})}return l}).then(l=>x.mergeObjectSync(n,l)):x.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(e){return p.errToObj,new r({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{let s=this._def.errorMap?.(t,n).message??n.defaultError;return t.code==="unrecognized_keys"?{message:p.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new r({...this._def,unknownKeys:"strip"})}passthrough(){return new r({...this._def,unknownKeys:"passthrough"})}extend(e){return new r({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new r({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 r({...this._def,catchall:e})}pick(e){let t={};for(let n of _.objectKeys(e))e[n]&&this.shape[n]&&(t[n]=this.shape[n]);return new r({...this._def,shape:()=>t})}omit(e){let t={};for(let n of _.objectKeys(this.shape))e[n]||(t[n]=this.shape[n]);return new r({...this._def,shape:()=>t})}deepPartial(){return ie(this)}partial(e){let t={};for(let n of _.objectKeys(this.shape)){let s=this.shape[n];e&&!e[n]?t[n]=s:t[n]=s.optional()}return new r({...this._def,shape:()=>t})}required(e){let t={};for(let n of _.objectKeys(this.shape))if(e&&!e[n])t[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof E;)a=a._def.innerType;t[n]=a}return new r({...this._def,shape:()=>t})}keyof(){return Fe(_.objectKeys(this.shape))}};w.create=(r,e)=>new w({shape:()=>r,unknownKeys:"strip",catchall:R.create(),typeName:m.ZodObject,...g(e)});w.strictCreate=(r,e)=>new w({shape:()=>r,unknownKeys:"strict",catchall:R.create(),typeName:m.ZodObject,...g(e)});w.lazycreate=(r,e)=>new w({shape:r,unknownKeys:"strip",catchall:R.create(),typeName:m.ZodObject,...g(e)});var K=class extends y{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function s(a){for(let o of a)if(o.result.status==="valid")return o.result;for(let o of a)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;let i=a.map(o=>new b(o.ctx.common.issues));return d(t,{code:c.invalid_union,unionErrors:i}),h}if(t.common.async)return Promise.all(n.map(async a=>{let i={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(s);{let a,i=[];for(let u of n){let l={...t,common:{...t.common,issues:[]},parent:null},v=u._parseSync({data:t.data,path:t.path,parent:l});if(v.status==="valid")return v;v.status==="dirty"&&!a&&(a={result:v,ctx:l}),l.common.issues.length&&i.push(l.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;let o=i.map(u=>new b(u));return d(t,{code:c.invalid_union,unionErrors:o}),h}}get options(){return this._def.options}};K.create=(r,e)=>new K({options:r,typeName:m.ZodUnion,...g(e)});var M=r=>r instanceof G?M(r.schema):r instanceof C?M(r.innerType()):r instanceof X?[r.value]:r instanceof Q?r.options:r instanceof ee?_.objectValues(r.enum):r instanceof te?M(r._def.innerType):r instanceof q?[void 0]:r instanceof J?[null]:r instanceof E?[void 0,...M(r.unwrap())]:r instanceof j?[null,...M(r.unwrap())]:r instanceof pe||r instanceof ne?M(r.unwrap()):r instanceof re?M(r._def.innerType):[],_e=class r extends y{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.object)return d(t,{code:c.invalid_type,expected:f.object,received:t.parsedType}),h;let n=this.discriminator,s=t.data[n],a=this.optionsMap.get(s);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(d(t,{code:c.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),h)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){let s=new Map;for(let a of t){let i=M(a.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let o of i){if(s.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);s.set(o,a)}}return new r({typeName:m.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,...g(n)})}};function Te(r,e){let t=A(r),n=A(e);if(r===e)return{valid:!0,data:r};if(t===f.object&&n===f.object){let s=_.objectKeys(e),a=_.objectKeys(r).filter(o=>s.indexOf(o)!==-1),i={...r,...e};for(let o of a){let u=Te(r[o],e[o]);if(!u.valid)return{valid:!1};i[o]=u.data}return{valid:!0,data:i}}else if(t===f.array&&n===f.array){if(r.length!==e.length)return{valid:!1};let s=[];for(let a=0;a<r.length;a++){let i=r[a],o=e[a],u=Te(i,o);if(!u.valid)return{valid:!1};s.push(u.data)}return{valid:!0,data:s}}else return t===f.date&&n===f.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}var Y=class extends y{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),s=(a,i)=>{if(ge(a)||ge(i))return h;let o=Te(a.value,i.value);return o.valid?((ye(a)||ye(i))&&t.dirty(),{status:t.value,value:o.data}):(d(n,{code:c.invalid_intersection_types}),h)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,i])=>s(a,i)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Y.create=(r,e,t)=>new Y({left:r,right:e,typeName:m.ZodIntersection,...g(t)});var I=class r extends y{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.array)return d(n,{code:c.invalid_type,expected:f.array,received:n.parsedType}),h;if(n.data.length<this._def.items.length)return d(n,{code:c.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),h;!this._def.rest&&n.data.length>this._def.items.length&&(d(n,{code:c.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let a=[...n.data].map((i,o)=>{let u=this._def.items[o]||this._def.rest;return u?u._parse(new O(n,i,n.path,o)):null}).filter(i=>!!i);return n.common.async?Promise.all(a).then(i=>x.mergeArray(t,i)):x.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new r({...this._def,rest:e})}};I.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new I({items:r,typeName:m.ZodTuple,rest:null,...g(e)})};var ve=class r extends y{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.object)return d(n,{code:c.invalid_type,expected:f.object,received:n.parsedType}),h;let s=[],a=this._def.keyType,i=this._def.valueType;for(let o in n.data)s.push({key:a._parse(new O(n,o,n.path,o)),value:i._parse(new O(n,n.data[o],n.path,o)),alwaysSet:o in n.data});return n.common.async?x.mergeObjectAsync(t,s):x.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof y?new r({keyType:e,valueType:t,typeName:m.ZodRecord,...g(n)}):new r({keyType:z.create(),valueType:e,typeName:m.ZodRecord,...g(t)})}},ue=class extends y{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.map)return d(n,{code:c.invalid_type,expected:f.map,received:n.parsedType}),h;let s=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([o,u],l)=>({key:s._parse(new O(n,o,n.path,[l,"key"])),value:a._parse(new O(n,u,n.path,[l,"value"]))}));if(n.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let u of i){let l=await u.key,v=await u.value;if(l.status==="aborted"||v.status==="aborted")return h;(l.status==="dirty"||v.status==="dirty")&&t.dirty(),o.set(l.value,v.value)}return{status:t.value,value:o}})}else{let o=new Map;for(let u of i){let l=u.key,v=u.value;if(l.status==="aborted"||v.status==="aborted")return h;(l.status==="dirty"||v.status==="dirty")&&t.dirty(),o.set(l.value,v.value)}return{status:t.value,value:o}}}};ue.create=(r,e,t)=>new ue({valueType:e,keyType:r,typeName:m.ZodMap,...g(t)});var de=class r extends y{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.set)return d(n,{code:c.invalid_type,expected:f.set,received:n.parsedType}),h;let s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(d(n,{code:c.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),t.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(d(n,{code:c.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),t.dirty());let a=this._def.valueType;function i(u){let l=new Set;for(let v of u){if(v.status==="aborted")return h;v.status==="dirty"&&t.dirty(),l.add(v.value)}return{status:t.value,value:l}}let o=[...n.data.values()].map((u,l)=>a._parse(new O(n,u,n.path,l)));return n.common.async?Promise.all(o).then(u=>i(u)):i(o)}min(e,t){return new r({...this._def,minSize:{value:e,message:p.toString(t)}})}max(e,t){return new r({...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)}};de.create=(r,e)=>new de({valueType:r,minSize:null,maxSize:null,typeName:m.ZodSet,...g(e)});var xe=class r extends y{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.function)return d(t,{code:c.invalid_type,expected:f.function,received:t.parsedType}),h;function n(o,u){return fe({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,se(),$].filter(l=>!!l),issueData:{code:c.invalid_arguments,argumentsError:u}})}function s(o,u){return fe({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,se(),$].filter(l=>!!l),issueData:{code:c.invalid_return_type,returnTypeError:u}})}let a={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof D){let o=this;return k(async function(...u){let l=new b([]),v=await o._def.args.parseAsync(u,a).catch(ke=>{throw l.addIssue(n(u,ke)),l}),T=await Reflect.apply(i,this,v);return await o._def.returns._def.type.parseAsync(T,a).catch(ke=>{throw l.addIssue(s(T,ke)),l})})}else{let o=this;return k(function(...u){let l=o._def.args.safeParse(u,a);if(!l.success)throw new b([n(u,l.error)]);let v=Reflect.apply(i,this,l.data),T=o._def.returns.safeParse(v,a);if(!T.success)throw new b([s(v,T.error)]);return T.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new r({...this._def,args:I.create(e).rest(Z.create())})}returns(e){return new r({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new r({args:e||I.create([]).rest(Z.create()),returns:t||Z.create(),typeName:m.ZodFunction,...g(n)})}},G=class extends y{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};G.create=(r,e)=>new G({getter:r,typeName:m.ZodLazy,...g(e)});var X=class extends y{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return d(t,{received:t.data,code:c.invalid_literal,expected:this._def.value}),h}return{status:"valid",value:e.data}}get value(){return this._def.value}};X.create=(r,e)=>new X({value:r,typeName:m.ZodLiteral,...g(e)});function Fe(r,e){return new Q({values:r,typeName:m.ZodEnum,...g(e)})}var Q=class r extends y{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),n=this._def.values;return d(t,{expected:_.joinValues(n),received:t.parsedType,code:c.invalid_type}),h}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return d(t,{received:t.data,code:c.invalid_enum_value,options:n}),h}return k(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return r.create(e,{...this._def,...t})}exclude(e,t=this._def){return r.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}};Q.create=Fe;var ee=class extends y{_parse(e){let t=_.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==f.string&&n.parsedType!==f.number){let s=_.objectValues(t);return d(n,{expected:_.joinValues(s),received:n.parsedType,code:c.invalid_type}),h}if(this._cache||(this._cache=new Set(_.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let s=_.objectValues(t);return d(n,{received:n.data,code:c.invalid_enum_value,options:s}),h}return k(e.data)}get enum(){return this._def.values}};ee.create=(r,e)=>new ee({values:r,typeName:m.ZodNativeEnum,...g(e)});var D=class extends y{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.promise&&t.common.async===!1)return d(t,{code:c.invalid_type,expected:f.promise,received:t.parsedType}),h;let n=t.parsedType===f.promise?t.data:Promise.resolve(t.data);return k(n.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}};D.create=(r,e)=>new D({type:r,typeName:m.ZodPromise,...g(e)});var C=class extends y{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===m.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),s=this._def.effect||null,a={addIssue:i=>{d(n,i),i.fatal?t.abort():t.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),s.type==="preprocess"){let i=s.transform(n.data,a);if(n.common.async)return Promise.resolve(i).then(async o=>{if(t.value==="aborted")return h;let u=await this._def.schema._parseAsync({data:o,path:n.path,parent:n});return u.status==="aborted"?h:u.status==="dirty"?F(u.value):t.value==="dirty"?F(u.value):u});{if(t.value==="aborted")return h;let o=this._def.schema._parseSync({data:i,path:n.path,parent:n});return o.status==="aborted"?h:o.status==="dirty"?F(o.value):t.value==="dirty"?F(o.value):o}}if(s.type==="refinement"){let i=o=>{let u=s.refinement(o,a);if(n.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?h:(o.status==="dirty"&&t.dirty(),i(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?h:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(s.type==="transform")if(n.common.async===!1){let i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!V(i))return h;let o=s.transform(i.value,a);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:n.data,path:n.path,parent:n}).then(i=>V(i)?Promise.resolve(s.transform(i.value,a)).then(o=>({status:t.value,value:o})):h);_.assertNever(s)}};C.create=(r,e,t)=>new C({schema:r,typeName:m.ZodEffects,effect:e,...g(t)});C.createWithPreprocess=(r,e,t)=>new C({schema:e,effect:{type:"preprocess",transform:r},typeName:m.ZodEffects,...g(t)});var E=class extends y{_parse(e){return this._getType(e)===f.undefined?k(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};E.create=(r,e)=>new E({innerType:r,typeName:m.ZodOptional,...g(e)});var j=class extends y{_parse(e){return this._getType(e)===f.null?k(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};j.create=(r,e)=>new j({innerType:r,typeName:m.ZodNullable,...g(e)});var te=class extends y{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===f.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};te.create=(r,e)=>new te({innerType:r,typeName:m.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...g(e)});var re=class extends y{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return ae(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new b(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new b(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};re.create=(r,e)=>new re({innerType:r,typeName:m.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...g(e)});var le=class extends y{_parse(e){if(this._getType(e)!==f.nan){let n=this._getOrReturnCtx(e);return d(n,{code:c.invalid_type,expected:f.nan,received:n.parsedType}),h}return{status:"valid",value:e.data}}};le.create=r=>new le({typeName:m.ZodNaN,...g(r)});var Ft=Symbol("zod_brand"),pe=class extends y{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},he=class r extends y{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?h:a.status==="dirty"?(t.dirty(),F(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{let s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?h:s.status==="dirty"?(t.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(e,t){return new r({in:e,out:t,typeName:m.ZodPipeline})}},ne=class extends y{_parse(e){let t=this._def.innerType._parse(e),n=s=>(V(s)&&(s.value=Object.freeze(s.value)),s);return ae(t)?t.then(s=>n(s)):n(t)}unwrap(){return this._def.innerType}};ne.create=(r,e)=>new ne({innerType:r,typeName:m.ZodReadonly,...g(e)});function Ve(r,e){let t=typeof r=="function"?r(e):typeof r=="string"?{message:r}:r;return typeof t=="string"?{message:t}:t}function Ue(r,e={},t){return r?L.create().superRefine((n,s)=>{let a=r(n);if(a instanceof Promise)return a.then(i=>{if(!i){let o=Ve(e,n),u=o.fatal??t??!0;s.addIssue({code:"custom",...o,fatal:u})}});if(!a){let i=Ve(e,n),o=i.fatal??t??!0;s.addIssue({code:"custom",...i,fatal:o})}}):L.create()}var Ut={object:w.lazycreate},m;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(m||(m={}));var Bt=(r,e={message:`Input not instance of ${r.name}`})=>Ue(t=>t instanceof r,e),Be=z.create,He=U.create,Ht=le.create,Wt=B.create,We=H.create,qt=W.create,Jt=oe.create,Kt=q.create,Yt=J.create,Gt=L.create,Xt=Z.create,Qt=R.create,er=ce.create,tr=P.create,rr=w.create,nr=w.strictCreate,sr=K.create,ar=_e.create,ir=Y.create,or=I.create,cr=ve.create,ur=ue.create,dr=de.create,lr=xe.create,fr=G.create,pr=X.create,hr=Q.create,mr=ee.create,gr=D.create,yr=C.create,_r=E.create,vr=j.create,xr=C.createWithPreprocess,kr=he.create,br=()=>Be().optional(),wr=()=>He().optional(),Sr=()=>We().optional(),Tr={string:(r=>z.create({...r,coerce:!0})),number:(r=>U.create({...r,coerce:!0})),boolean:(r=>H.create({...r,coerce:!0})),bigint:(r=>B.create({...r,coerce:!0})),date:(r=>W.create({...r,coerce:!0}))};var Er=h;var Or=N.enum(["normal","compact","minimal"]),Cr=N.enum(["off","light","balanced","max"]),me=N.object({enabled:N.boolean().default(!0),telemetryOptIn:N.boolean().default(!0),outputVerbosity:Or.default("compact"),reducer:Cr.default("off"),filters:N.object({enableAll:N.boolean().default(!0),disabled:N.array(N.string().max(64)).max(100).default([])}).default({enableAll:!0,disabled:[]})});var Ar="settings-cache.json",qe=me.parse({}),hs=me.partial().extend({filters:me.shape.filters.removeDefault().partial().optional()});async function Je(){let r=null;try{let e=JSON.parse(await Nr(Rr(S(),Ar),"utf8"));typeof e=="object"&&e!==null&&!Array.isArray(e)&&(r=e)}catch{}return r?me.parse({...qe,...r}):qe}import{existsSync as Ir,mkdirSync as ys,rmSync as _s,writeFileSync as vs}from"node:fs";import{join as jr}from"node:path";var $r=new Set(["0","off","false","no"]);var bs=["Tokmizer contacts tokmizer.com to keep its rules up to date and to improve the product. No account or email is needed.","It sends a random install ID, your computer name, OS and CPU model, a hash of your network card address and of your user name, and the plugin version. Command contents and output are never sent.","Usage stats (command names, token counts and install health counts) are sent only while they are on. Check with: tkr telemetry status.","Turn all network access off: tkr network off. Usage stats only: tkr telemetry off."].join(`
5
- `);function Mr(){return jr(S(),"network-off")}function Zr(){let r=process.env.TOKMIZER_NETWORK;return r!==void 0&&$r.has(r.trim().toLowerCase())}function Ke(){return Zr()?!1:!Ir(Mr())}import{createRequire as Pr}from"node:module";var Vr=Pr(import.meta.url);function zr(){let r="0.9.68";if(r)return r;for(let e of["../package.json","../../package.json"])try{let t=Vr(e).version;if(typeof t=="string"&&t)return t}catch{}return"0.0.0"}var Ye=zr();var Ur="telemetry-notice-shown";var Br="Tokmizer sends usage stats (command names and tokens saved, never content, files or arguments) to improve the product. No account or email needed. To turn off: tkr telemetry off (or tkr network off to cut all network access).";function Ge(){return Fr(S(),Ur)}function Hr(r,e){if(Xe(r))return!1;try{Lr(S(),{recursive:!0}),Dr(r,e,{mode:384})}catch{return!1}return!0}async function Qe(){return!Ke()||Xe(Ge())||!(await Je()).telemetryOptIn?null:Hr(Ge(),`${Ye} ${Date.now()}`)?Br:null}import{existsSync as Wr,mkdirSync as $s,rmSync as qr,writeFileSync as Ms}from"node:fs";import{join as Jr}from"node:path";var Kr="An automatic Tokmizer update added its hook to Codex (hooks.json) so Codex commands are optimized too. To remove it: tkr setup-codex --remove";function et(){return Jr(S(),"codex-hook-notice")}function tt(){if(!Wr(et()))return null;try{qr(et())}catch{return null}return Kr}async function Yr(r){if(r.source!=="compact"&&r.source!=="resume"||!r.session_id)return null;let e=Ie(r.session_id);return $e(e)||null}async function Gr(){let r=await Oe();r||process.exit(0);let e;try{e=JSON.parse(r)}catch{process.exit(0)}let t=[await Qe().catch(()=>null),tt()].filter(s=>s!==null),n=Xr(await Qr(e),t.length?t.join(`
5
+ `);function Mr(){return jr(S(),"network-off")}function Zr(){let r=process.env.TOKMIZER_NETWORK;return r!==void 0&&$r.has(r.trim().toLowerCase())}function Ke(){return Zr()?!1:!Ir(Mr())}import{createRequire as Pr}from"node:module";var Vr=Pr(import.meta.url);function zr(){let r="0.9.69";if(r)return r;for(let e of["../package.json","../../package.json"])try{let t=Vr(e).version;if(typeof t=="string"&&t)return t}catch{}return"0.0.0"}var Ye=zr();var Ur="telemetry-notice-shown";var Br="Tokmizer sends usage stats (command names and tokens saved, never content, files or arguments) to improve the product. No account or email needed. To turn off: tkr telemetry off (or tkr network off to cut all network access).";function Ge(){return Fr(S(),Ur)}function Hr(r,e){if(Xe(r))return!1;try{Lr(S(),{recursive:!0}),Dr(r,e,{mode:384})}catch{return!1}return!0}async function Qe(){return!Ke()||Xe(Ge())||!(await Je()).telemetryOptIn?null:Hr(Ge(),`${Ye} ${Date.now()}`)?Br:null}import{existsSync as Wr,mkdirSync as $s,rmSync as qr,writeFileSync as Ms}from"node:fs";import{join as Jr}from"node:path";var Kr="An automatic Tokmizer update added its hook to Codex (hooks.json) so Codex commands are optimized too. To remove it: tkr setup-codex --remove";function et(){return Jr(S(),"codex-hook-notice")}function tt(){if(!Wr(et()))return null;try{qr(et())}catch{return null}return Kr}async function Yr(r){if(r.source!=="compact"&&r.source!=="resume"||!r.session_id)return null;let e=Ie(r.session_id);return $e(e)||null}async function Gr(){let r=await Oe();r||process.exit(0);let e;try{e=JSON.parse(r)}catch{process.exit(0)}let t=[await Qe().catch(()=>null),tt()].filter(s=>s!==null),n=Xr(await Qr(e),t.length?t.join(`
6
6
  `):null);n&&process.stdout.write(n)}function Xr(r,e){return e?JSON.stringify({systemMessage:e,...r?{hookSpecificOutput:{hookEventName:"SessionStart",additionalContext:r}}:{}}):r}async function Qr(r){try{je()}catch{}return r.session_id&&r.source!=="startup"&&Me(r.session_id),Yr(r)}var en=process.argv[1]??"";Re(en,import.meta.url,"session-recap")&&Gr().catch(()=>{process.exit(0)});export{Qr as handleSessionStart,Yr as recapForSessionStart,Xr as sessionStartOutput};