@tokmizer/plugin 0.5.6 → 0.5.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/codex-plugin/plugin.json +1 -1
- package/dist/bin/tkr-daemon.js +9 -9
- package/dist/bin/tkr-exec.js +11 -11
- package/dist/bin/tkr.js +16 -16
- package/dist/hooks-host/reducer-stop.js +1 -1
- package/dist/index.js +5 -5
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __tkrCreateRequire } from "node:module"; const require = __tkrCreateRequire(import.meta.url);
|
|
3
|
-
var Ye=Object.defineProperty;var qe=(r,e)=>{for(var t in e)Ye(r,t,{get:e[t],enumerable:!0})};import{openSync as Pr,fstatSync as zr,readSync as Mr,closeSync as Lr}from"node:fs";import{readFile as dr,writeFile as Ss,mkdir as Rs,chmod as Cs}from"node:fs/promises";import{join as lr}from"node:path";var R={};qe(R,{BRAND:()=>kt,DIRTY:()=>F,EMPTY_PATH:()=>et,INVALID:()=>m,NEVER:()=>ir,OK:()=>b,ParseStatus:()=>x,Schema:()=>y,ZodAny:()=>M,ZodArray:()=>$,ZodBigInt:()=>B,ZodBoolean:()=>K,ZodBranded:()=>pe,ZodCatch:()=>re,ZodDate:()=>H,ZodDefault:()=>te,ZodDiscriminatedUnion:()=>ye,ZodEffects:()=>S,ZodEnum:()=>Q,ZodError:()=>k,ZodFirstPartyTypeKind:()=>h,ZodFunction:()=>ve,ZodIntersection:()=>q,ZodIssueCode:()=>c,ZodLazy:()=>J,ZodLiteral:()=>X,ZodMap:()=>ue,ZodNaN:()=>le,ZodNativeEnum:()=>ee,ZodNever:()=>C,ZodNull:()=>G,ZodNullable:()=>I,ZodNumber:()=>U,ZodObject:()=>E,ZodOptional:()=>A,ZodParsedType:()=>d,ZodPipeline:()=>me,ZodPromise:()=>L,ZodReadonly:()=>se,ZodRecord:()=>_e,ZodSchema:()=>y,ZodSet:()=>de,ZodString:()=>z,ZodSymbol:()=>oe,ZodTransformer:()=>S,ZodTuple:()=>D,ZodType:()=>y,ZodUndefined:()=>W,ZodUnion:()=>Y,ZodUnknown:()=>Z,ZodVoid:()=>ce,addIssueToContext:()=>u,any:()=>Dt,array:()=>Zt,bigint:()=>Tt,boolean:()=>Me,coerce:()=>ar,custom:()=>$e,date:()=>St,datetimeRegex:()=>je,defaultErrorMap:()=>N,discriminatedUnion:()=>Mt,effect:()=>Jt,enum:()=>Gt,function:()=>Kt,getErrorMap:()=>ne,getParsedType:()=>O,instanceof:()=>wt,intersection:()=>Lt,isAborted:()=>he,isAsync:()=>ae,isDirty:()=>ge,isValid:()=>P,late:()=>Et,lazy:()=>Ht,literal:()=>Wt,makeIssue:()=>fe,map:()=>Ut,nan:()=>At,nativeEnum:()=>Yt,never:()=>Nt,null:()=>Ot,nullable:()=>Qt,number:()=>ze,object:()=>$t,objectUtil:()=>be,oboolean:()=>nr,onumber:()=>sr,optional:()=>Xt,ostring:()=>rr,pipeline:()=>tr,preprocess:()=>er,promise:()=>qt,quotelessJson:()=>Je,record:()=>Ft,set:()=>Bt,setErrorMap:()=>Qe,strictObject:()=>Pt,string:()=>Pe,symbol:()=>Rt,transformer:()=>Jt,tuple:()=>Vt,undefined:()=>Ct,union:()=>zt,unknown:()=>It,util:()=>_,void:()=>jt});var _;(function(r){r.assertEqual=n=>{};function e(n){}r.assertIs=e;function t(n){throw new Error}r.assertNever=t,r.arrayToEnum=n=>{let a={};for(let o of n)a[o]=o;return a},r.getValidEnumValues=n=>{let a=r.objectKeys(n).filter(i=>typeof n[n[i]]!="number"),o={};for(let i of a)o[i]=n[i];return r.objectValues(o)},r.objectValues=n=>r.objectKeys(n).map(function(a){return n[a]}),r.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{let a=[];for(let o in n)Object.prototype.hasOwnProperty.call(n,o)&&a.push(o);return a},r.find=(n,a)=>{for(let o of n)if(a(o))return o},r.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function s(n,a=" | "){return n.map(o=>typeof o=="string"?`'${o}'`:o).join(a)}r.joinValues=s,r.jsonStringifyReplacer=(n,a)=>typeof a=="bigint"?a.toString():a})(_||(_={}));var be;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(be||(be={}));var d=_.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),O=r=>{switch(typeof r){case"undefined":return d.undefined;case"string":return d.string;case"number":return Number.isNaN(r)?d.nan:d.number;case"boolean":return d.boolean;case"function":return d.function;case"bigint":return d.bigint;case"symbol":return d.symbol;case"object":return Array.isArray(r)?d.array:r===null?d.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?d.promise:typeof Map<"u"&&r instanceof Map?d.map:typeof Set<"u"&&r instanceof Set?d.set:typeof Date<"u"&&r instanceof Date?d.date:d.object;default:return d.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"]),Je=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:"),k=class r extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};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},s={_errors:[]},n=a=>{for(let o of a.issues)if(o.code==="invalid_union")o.unionErrors.map(n);else if(o.code==="invalid_return_type")n(o.returnTypeError);else if(o.code==="invalid_arguments")n(o.argumentsError);else if(o.path.length===0)s._errors.push(t(o));else{let i=s,l=0;for(;l<o.path.length;){let f=o.path[l];l===o.path.length-1?(i[f]=i[f]||{_errors:[]},i[f]._errors.push(t(o))):i[f]=i[f]||{_errors:[]},i=i[f],l++}}};return n(this),s}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={},s=[];for(let n of this.issues)if(n.path.length>0){let a=n.path[0];t[a]=t[a]||[],t[a].push(e(n))}else s.push(e(n));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}};k.create=r=>new k(r);var Xe=(r,e)=>{let t;switch(r.code){case c.invalid_type:r.received===d.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}},N=Xe;var Ce=N;function Qe(r){Ce=r}function ne(){return Ce}var fe=r=>{let{data:e,path:t,errorMaps:s,issueData:n}=r,a=[...t,...n.path||[]],o={...n,path:a};if(n.message!==void 0)return{...n,path:a,message:n.message};let i="",l=s.filter(f=>!!f).slice().reverse();for(let f of l)i=f(o,{data:e,defaultError:i}).message;return{...n,path:a,message:i}},et=[];function u(r,e){let t=ne(),s=fe({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===N?void 0:N].filter(n=>!!n)});r.common.issues.push(s)}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 s=[];for(let n of t){if(n.status==="aborted")return m;n.status==="dirty"&&e.dirty(),s.push(n.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){let s=[];for(let n of t){let a=await n.key,o=await n.value;s.push({key:a,value:o})}return r.mergeObjectSync(e,s)}static mergeObjectSync(e,t){let s={};for(let n of t){let{key:a,value:o}=n;if(a.status==="aborted"||o.status==="aborted")return m;a.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof o.value<"u"||n.alwaysSet)&&(s[a.value]=o.value)}return{status:e.value,value:s}}},m=Object.freeze({status:"aborted"}),F=r=>({status:"dirty",value:r}),b=r=>({status:"valid",value:r}),he=r=>r.status==="aborted",ge=r=>r.status==="dirty",P=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 T=class{constructor(e,t,s,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=n}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Oe=(r,e)=>{if(P(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 k(r.common.issues);return this._error=t,this._error}}};function g(r){if(!r)return{};let{errorMap:e,invalid_type_error:t,required_error:s,description:n}=r;if(e&&(t||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(o,i)=>{let{message:l}=r;return o.code==="invalid_enum_value"?{message:l??i.defaultError}:typeof i.data>"u"?{message:l??s??i.defaultError}:o.code!=="invalid_type"?{message:i.defaultError}:{message:l??t??i.defaultError}},description:n}}var y=class{get description(){return this._def.description}_getType(e){return O(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:O(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:O(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 s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){let s={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:O(e)},n=this._parseSync({data:e,path:s.path,parent:s});return Oe(s,n)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:O(e)};if(!this["~standard"].async)try{let s=this._parseSync({data:e,path:[],parent:t});return P(s)?{value:s.value}:{issues:t.common.issues}}catch(s){s?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(s=>P(s)?{value:s.value}:{issues:t.common.issues})}async parseAsync(e,t){let s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){let s={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:O(e)},n=this._parse({data:e,path:s.path,parent:s}),a=await(ae(n)?n:Promise.resolve(n));return Oe(s,a)}refine(e,t){let s=n=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(n):t;return this._refinement((n,a)=>{let o=e(n),i=()=>a.addIssue({code:c.custom,...s(n)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(i(),!1)):o?!0:(i(),!1)})}refinement(e,t){return this._refinement((s,n)=>e(s)?!0:(n.addIssue(typeof t=="function"?t(s,n):t),!1))}_refinement(e){return new S({schema:this,typeName:h.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 A.create(this,this._def)}nullable(){return I.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return $.create(this)}promise(){return L.create(this,this._def)}or(e){return Y.create([this,e],this._def)}and(e){return q.create(this,e,this._def)}transform(e){return new S({...g(this._def),schema:this,typeName:h.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:h.ZodDefault})}brand(){return new pe({typeName:h.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:h.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return me.create(this,e)}readonly(){return se.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},tt=/^c[^\s-]{8,}$/i,rt=/^[0-9a-z]+$/,st=/^[0-9A-HJKMNP-TV-Z]{26}$/i,nt=/^[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,at=/^[a-z0-9_-]{21}$/i,it=/^[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,ut="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",ke,dt=/^(?:(?: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])$/,lt=/^(?:(?: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])$/,ft=/^(([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]))$/,pt=/^(([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])$/,mt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ht=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Ie="((\\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])))",gt=new RegExp(`^${Ie}$`);function Ne(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 yt(r){return new RegExp(`^${Ne(r)}$`)}function je(r){let e=`${Ie}T${Ne(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 _t(r,e){return!!((e==="v4"||!e)&&dt.test(r)||(e==="v6"||!e)&&ft.test(r))}function vt(r,e){if(!it.test(r))return!1;try{let[t]=r.split(".");if(!t)return!1;let s=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),n=JSON.parse(atob(s));return!(typeof n!="object"||n===null||"typ"in n&&n?.typ!=="JWT"||!n.alg||e&&n.alg!==e)}catch{return!1}}function xt(r,e){return!!((e==="v4"||!e)&<.test(r)||(e==="v6"||!e)&&pt.test(r))}var z=class r extends y{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==d.string){let a=this._getOrReturnCtx(e);return u(a,{code:c.invalid_type,expected:d.string,received:a.parsedType}),m}let s=new x,n;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(n=this._getOrReturnCtx(e,n),u(n,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="max")e.data.length>a.value&&(n=this._getOrReturnCtx(e,n),u(n,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="length"){let o=e.data.length>a.value,i=e.data.length<a.value;(o||i)&&(n=this._getOrReturnCtx(e,n),o?u(n,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):i&&u(n,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),s.dirty())}else if(a.kind==="email")ct.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"email",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="emoji")ke||(ke=new RegExp(ut,"u")),ke.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"emoji",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="uuid")nt.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"uuid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="nanoid")at.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"nanoid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid")tt.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"cuid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid2")rt.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"cuid2",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="ulid")st.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"ulid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),u(n,{validation:"url",code:c.invalid_string,message:a.message}),s.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"regex",code:c.invalid_string,message:a.message}),s.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(n=this._getOrReturnCtx(e,n),u(n,{code:c.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),s.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)||(n=this._getOrReturnCtx(e,n),u(n,{code:c.invalid_string,validation:{startsWith:a.value},message:a.message}),s.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(n=this._getOrReturnCtx(e,n),u(n,{code:c.invalid_string,validation:{endsWith:a.value},message:a.message}),s.dirty()):a.kind==="datetime"?je(a).test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{code:c.invalid_string,validation:"datetime",message:a.message}),s.dirty()):a.kind==="date"?gt.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{code:c.invalid_string,validation:"date",message:a.message}),s.dirty()):a.kind==="time"?yt(a).test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{code:c.invalid_string,validation:"time",message:a.message}),s.dirty()):a.kind==="duration"?ot.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"duration",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="ip"?_t(e.data,a.version)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"ip",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="jwt"?vt(e.data,a.alg)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"jwt",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="cidr"?xt(e.data,a.version)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"cidr",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="base64"?mt.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"base64",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="base64url"?ht.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"base64url",code:c.invalid_string,message:a.message}),s.dirty()):_.assertNever(a);return{status:s.value,value:e.data}}_regex(e,t,s){return this.refinement(n=>e.test(n),{validation:t,code:c.invalid_string,...p.errToObj(s)})}_addCheck(e){return new 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:h.ZodString,coerce:r?.coerce??!1,...g(r)});function bt(r,e){let t=(r.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,n=t>s?t:s,a=Number.parseInt(r.toFixed(n).replace(".","")),o=Number.parseInt(e.toFixed(n).replace(".",""));return a%o/10**n}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)!==d.number){let a=this._getOrReturnCtx(e);return u(a,{code:c.invalid_type,expected:d.number,received:a.parsedType}),m}let s,n=new x;for(let a of this._def.checks)a.kind==="int"?_.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),u(s,{code:c.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),u(s,{code:c.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),u(s,{code:c.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="multipleOf"?bt(e.data,a.value)!==0&&(s=this._getOrReturnCtx(e,s),u(s,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),u(s,{code:c.not_finite,message:a.message}),n.dirty()):_.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,p.toString(t))}gt(e,t){return this.setLimit("min",e,!1,p.toString(t))}lte(e,t){return this.setLimit("max",e,!0,p.toString(t))}lt(e,t){return this.setLimit("max",e,!1,p.toString(t))}setLimit(e,t,s,n){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:p.toString(n)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:p.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:p.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:p.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:p.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:p.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:p.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:p.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:p.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:p.toString(e)})}get minValue(){let e=null;for(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 s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(t===null||s.value>t)&&(t=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}};U.create=r=>new U({checks:[],typeName:h.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)!==d.bigint)return this._getInvalidInput(e);let s,n=new x;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),u(s,{code:c.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),u(s,{code:c.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),u(s,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):_.assertNever(a);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return u(t,{code:c.invalid_type,expected:d.bigint,received:t.parsedType}),m}gte(e,t){return this.setLimit("min",e,!0,p.toString(t))}gt(e,t){return this.setLimit("min",e,!1,p.toString(t))}lte(e,t){return this.setLimit("max",e,!0,p.toString(t))}lt(e,t){return this.setLimit("max",e,!1,p.toString(t))}setLimit(e,t,s,n){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:p.toString(n)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}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:h.ZodBigInt,coerce:r?.coerce??!1,...g(r)});var K=class extends y{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==d.boolean){let s=this._getOrReturnCtx(e);return u(s,{code:c.invalid_type,expected:d.boolean,received:s.parsedType}),m}return b(e.data)}};K.create=r=>new K({typeName:h.ZodBoolean,coerce:r?.coerce||!1,...g(r)});var H=class r extends y{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==d.date){let a=this._getOrReturnCtx(e);return u(a,{code:c.invalid_type,expected:d.date,received:a.parsedType}),m}if(Number.isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return u(a,{code:c.invalid_date}),m}let s=new x,n;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(n=this._getOrReturnCtx(e,n),u(n,{code:c.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),s.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(n=this._getOrReturnCtx(e,n),u(n,{code:c.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),s.dirty()):_.assertNever(a);return{status:s.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}};H.create=r=>new H({checks:[],coerce:r?.coerce||!1,typeName:h.ZodDate,...g(r)});var oe=class extends y{_parse(e){if(this._getType(e)!==d.symbol){let s=this._getOrReturnCtx(e);return u(s,{code:c.invalid_type,expected:d.symbol,received:s.parsedType}),m}return b(e.data)}};oe.create=r=>new oe({typeName:h.ZodSymbol,...g(r)});var W=class extends y{_parse(e){if(this._getType(e)!==d.undefined){let s=this._getOrReturnCtx(e);return u(s,{code:c.invalid_type,expected:d.undefined,received:s.parsedType}),m}return b(e.data)}};W.create=r=>new W({typeName:h.ZodUndefined,...g(r)});var G=class extends y{_parse(e){if(this._getType(e)!==d.null){let s=this._getOrReturnCtx(e);return u(s,{code:c.invalid_type,expected:d.null,received:s.parsedType}),m}return b(e.data)}};G.create=r=>new G({typeName:h.ZodNull,...g(r)});var M=class extends y{constructor(){super(...arguments),this._any=!0}_parse(e){return b(e.data)}};M.create=r=>new M({typeName:h.ZodAny,...g(r)});var Z=class extends y{constructor(){super(...arguments),this._unknown=!0}_parse(e){return b(e.data)}};Z.create=r=>new Z({typeName:h.ZodUnknown,...g(r)});var C=class extends y{_parse(e){let t=this._getOrReturnCtx(e);return u(t,{code:c.invalid_type,expected:d.never,received:t.parsedType}),m}};C.create=r=>new C({typeName:h.ZodNever,...g(r)});var ce=class extends y{_parse(e){if(this._getType(e)!==d.undefined){let s=this._getOrReturnCtx(e);return u(s,{code:c.invalid_type,expected:d.void,received:s.parsedType}),m}return b(e.data)}};ce.create=r=>new ce({typeName:h.ZodVoid,...g(r)});var $=class r extends y{_parse(e){let{ctx:t,status:s}=this._processInputParams(e),n=this._def;if(t.parsedType!==d.array)return u(t,{code:c.invalid_type,expected:d.array,received:t.parsedType}),m;if(n.exactLength!==null){let o=t.data.length>n.exactLength.value,i=t.data.length<n.exactLength.value;(o||i)&&(u(t,{code:o?c.too_big:c.too_small,minimum:i?n.exactLength.value:void 0,maximum:o?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),s.dirty())}if(n.minLength!==null&&t.data.length<n.minLength.value&&(u(t,{code:c.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),s.dirty()),n.maxLength!==null&&t.data.length>n.maxLength.value&&(u(t,{code:c.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map((o,i)=>n.type._parseAsync(new T(t,o,t.path,i)))).then(o=>x.mergeArray(s,o));let a=[...t.data].map((o,i)=>n.type._parseSync(new T(t,o,t.path,i)));return x.mergeArray(s,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)}};$.create=(r,e)=>new $({type:r,minLength:null,maxLength:null,exactLength:null,typeName:h.ZodArray,...g(e)});function ie(r){if(r instanceof E){let e={};for(let t in r.shape){let s=r.shape[t];e[t]=A.create(ie(s))}return new E({...r._def,shape:()=>e})}else return r instanceof $?new $({...r._def,type:ie(r.element)}):r instanceof A?A.create(ie(r.unwrap())):r instanceof I?I.create(ie(r.unwrap())):r instanceof D?D.create(r.items.map(e=>ie(e))):r}var E=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)!==d.object){let f=this._getOrReturnCtx(e);return u(f,{code:c.invalid_type,expected:d.object,received:f.parsedType}),m}let{status:s,ctx:n}=this._processInputParams(e),{shape:a,keys:o}=this._getCached(),i=[];if(!(this._def.catchall instanceof C&&this._def.unknownKeys==="strip"))for(let f in n.data)o.includes(f)||i.push(f);let l=[];for(let f of o){let v=a[f],w=n.data[f];l.push({key:{status:"valid",value:f},value:v._parse(new T(n,w,n.path,f)),alwaysSet:f in n.data})}if(this._def.catchall instanceof C){let f=this._def.unknownKeys;if(f==="passthrough")for(let v of i)l.push({key:{status:"valid",value:v},value:{status:"valid",value:n.data[v]}});else if(f==="strict")i.length>0&&(u(n,{code:c.unrecognized_keys,keys:i}),s.dirty());else if(f!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let f=this._def.catchall;for(let v of i){let w=n.data[v];l.push({key:{status:"valid",value:v},value:f._parse(new T(n,w,n.path,v)),alwaysSet:v in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let f=[];for(let v of l){let w=await v.key,Re=await v.value;f.push({key:w,value:Re,alwaysSet:v.alwaysSet})}return f}).then(f=>x.mergeObjectSync(s,f)):x.mergeObjectSync(s,l)}get shape(){return this._def.shape()}strict(e){return p.errToObj,new r({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{let n=this._def.errorMap?.(t,s).message??s.defaultError;return t.code==="unrecognized_keys"?{message:p.errToObj(e).message??n}:{message:n}}}:{}})}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:h.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new r({...this._def,catchall:e})}pick(e){let t={};for(let s of _.objectKeys(e))e[s]&&this.shape[s]&&(t[s]=this.shape[s]);return new r({...this._def,shape:()=>t})}omit(e){let t={};for(let s of _.objectKeys(this.shape))e[s]||(t[s]=this.shape[s]);return new r({...this._def,shape:()=>t})}deepPartial(){return ie(this)}partial(e){let t={};for(let s of _.objectKeys(this.shape)){let n=this.shape[s];e&&!e[s]?t[s]=n:t[s]=n.optional()}return new r({...this._def,shape:()=>t})}required(e){let t={};for(let s of _.objectKeys(this.shape))if(e&&!e[s])t[s]=this.shape[s];else{let a=this.shape[s];for(;a instanceof A;)a=a._def.innerType;t[s]=a}return new r({...this._def,shape:()=>t})}keyof(){return Ze(_.objectKeys(this.shape))}};E.create=(r,e)=>new E({shape:()=>r,unknownKeys:"strip",catchall:C.create(),typeName:h.ZodObject,...g(e)});E.strictCreate=(r,e)=>new E({shape:()=>r,unknownKeys:"strict",catchall:C.create(),typeName:h.ZodObject,...g(e)});E.lazycreate=(r,e)=>new E({shape:r,unknownKeys:"strip",catchall:C.create(),typeName:h.ZodObject,...g(e)});var Y=class extends y{_parse(e){let{ctx:t}=this._processInputParams(e),s=this._def.options;function n(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 t.common.issues.push(...i.ctx.common.issues),i.result;let o=a.map(i=>new k(i.ctx.common.issues));return u(t,{code:c.invalid_union,unionErrors:o}),m}if(t.common.async)return Promise.all(s.map(async a=>{let o={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:o}),ctx:o}})).then(n);{let a,o=[];for(let l of s){let f={...t,common:{...t.common,issues:[]},parent:null},v=l._parseSync({data:t.data,path:t.path,parent:f});if(v.status==="valid")return v;v.status==="dirty"&&!a&&(a={result:v,ctx:f}),f.common.issues.length&&o.push(f.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;let i=o.map(l=>new k(l));return u(t,{code:c.invalid_union,unionErrors:i}),m}}get options(){return this._def.options}};Y.create=(r,e)=>new Y({options:r,typeName:h.ZodUnion,...g(e)});var j=r=>r instanceof J?j(r.schema):r instanceof S?j(r.innerType()):r instanceof X?[r.value]:r instanceof Q?r.options:r instanceof ee?_.objectValues(r.enum):r instanceof te?j(r._def.innerType):r instanceof W?[void 0]:r instanceof G?[null]:r instanceof A?[void 0,...j(r.unwrap())]:r instanceof I?[null,...j(r.unwrap())]:r instanceof pe||r instanceof se?j(r.unwrap()):r instanceof re?j(r._def.innerType):[],ye=class r extends y{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==d.object)return u(t,{code:c.invalid_type,expected:d.object,received:t.parsedType}),m;let s=this.discriminator,n=t.data[s],a=this.optionsMap.get(n);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}):(u(t,{code:c.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),m)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){let n=new Map;for(let a of t){let o=j(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(n.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);n.set(i,a)}}return new r({typeName:h.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...g(s)})}};function Ee(r,e){let t=O(r),s=O(e);if(r===e)return{valid:!0,data:r};if(t===d.object&&s===d.object){let n=_.objectKeys(e),a=_.objectKeys(r).filter(i=>n.indexOf(i)!==-1),o={...r,...e};for(let i of a){let l=Ee(r[i],e[i]);if(!l.valid)return{valid:!1};o[i]=l.data}return{valid:!0,data:o}}else if(t===d.array&&s===d.array){if(r.length!==e.length)return{valid:!1};let n=[];for(let a=0;a<r.length;a++){let o=r[a],i=e[a],l=Ee(o,i);if(!l.valid)return{valid:!1};n.push(l.data)}return{valid:!0,data:n}}else return t===d.date&&s===d.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}var q=class extends y{_parse(e){let{status:t,ctx:s}=this._processInputParams(e),n=(a,o)=>{if(he(a)||he(o))return m;let i=Ee(a.value,o.value);return i.valid?((ge(a)||ge(o))&&t.dirty(),{status:t.value,value:i.data}):(u(s,{code:c.invalid_intersection_types}),m)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([a,o])=>n(a,o)):n(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}};q.create=(r,e,t)=>new q({left:r,right:e,typeName:h.ZodIntersection,...g(t)});var D=class r extends y{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==d.array)return u(s,{code:c.invalid_type,expected:d.array,received:s.parsedType}),m;if(s.data.length<this._def.items.length)return u(s,{code:c.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),m;!this._def.rest&&s.data.length>this._def.items.length&&(u(s,{code:c.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let a=[...s.data].map((o,i)=>{let l=this._def.items[i]||this._def.rest;return l?l._parse(new T(s,o,s.path,i)):null}).filter(o=>!!o);return s.common.async?Promise.all(a).then(o=>x.mergeArray(t,o)):x.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new r({...this._def,rest:e})}};D.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new D({items:r,typeName:h.ZodTuple,rest:null,...g(e)})};var _e=class r extends y{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==d.object)return u(s,{code:c.invalid_type,expected:d.object,received:s.parsedType}),m;let n=[],a=this._def.keyType,o=this._def.valueType;for(let i in s.data)n.push({key:a._parse(new T(s,i,s.path,i)),value:o._parse(new T(s,s.data[i],s.path,i)),alwaysSet:i in s.data});return s.common.async?x.mergeObjectAsync(t,n):x.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof y?new r({keyType:e,valueType:t,typeName:h.ZodRecord,...g(s)}):new r({keyType:z.create(),valueType:e,typeName:h.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:s}=this._processInputParams(e);if(s.parsedType!==d.map)return u(s,{code:c.invalid_type,expected:d.map,received:s.parsedType}),m;let n=this._def.keyType,a=this._def.valueType,o=[...s.data.entries()].map(([i,l],f)=>({key:n._parse(new T(s,i,s.path,[f,"key"])),value:a._parse(new T(s,l,s.path,[f,"value"]))}));if(s.common.async){let i=new Map;return Promise.resolve().then(async()=>{for(let l of o){let f=await l.key,v=await l.value;if(f.status==="aborted"||v.status==="aborted")return m;(f.status==="dirty"||v.status==="dirty")&&t.dirty(),i.set(f.value,v.value)}return{status:t.value,value:i}})}else{let i=new Map;for(let l of o){let f=l.key,v=l.value;if(f.status==="aborted"||v.status==="aborted")return m;(f.status==="dirty"||v.status==="dirty")&&t.dirty(),i.set(f.value,v.value)}return{status:t.value,value:i}}}};ue.create=(r,e,t)=>new ue({valueType:e,keyType:r,typeName:h.ZodMap,...g(t)});var de=class r extends y{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==d.set)return u(s,{code:c.invalid_type,expected:d.set,received:s.parsedType}),m;let n=this._def;n.minSize!==null&&s.data.size<n.minSize.value&&(u(s,{code:c.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),n.maxSize!==null&&s.data.size>n.maxSize.value&&(u(s,{code:c.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());let a=this._def.valueType;function o(l){let f=new Set;for(let v of l){if(v.status==="aborted")return m;v.status==="dirty"&&t.dirty(),f.add(v.value)}return{status:t.value,value:f}}let i=[...s.data.values()].map((l,f)=>a._parse(new T(s,l,s.path,f)));return s.common.async?Promise.all(i).then(l=>o(l)):o(i)}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:h.ZodSet,...g(e)});var ve=class r extends y{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==d.function)return u(t,{code:c.invalid_type,expected:d.function,received:t.parsedType}),m;function s(i,l){return fe({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ne(),N].filter(f=>!!f),issueData:{code:c.invalid_arguments,argumentsError:l}})}function n(i,l){return fe({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ne(),N].filter(f=>!!f),issueData:{code:c.invalid_return_type,returnTypeError:l}})}let a={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof L){let i=this;return b(async function(...l){let f=new k([]),v=await i._def.args.parseAsync(l,a).catch(xe=>{throw f.addIssue(s(l,xe)),f}),w=await Reflect.apply(o,this,v);return await i._def.returns._def.type.parseAsync(w,a).catch(xe=>{throw f.addIssue(n(w,xe)),f})})}else{let i=this;return b(function(...l){let f=i._def.args.safeParse(l,a);if(!f.success)throw new k([s(l,f.error)]);let v=Reflect.apply(o,this,f.data),w=i._def.returns.safeParse(v,a);if(!w.success)throw new k([n(v,w.error)]);return w.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new r({...this._def,args:D.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,s){return new r({args:e||D.create([]).rest(Z.create()),returns:t||Z.create(),typeName:h.ZodFunction,...g(s)})}},J=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})}};J.create=(r,e)=>new J({getter:r,typeName:h.ZodLazy,...g(e)});var X=class extends y{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return u(t,{received:t.data,code:c.invalid_literal,expected:this._def.value}),m}return{status:"valid",value:e.data}}get value(){return this._def.value}};X.create=(r,e)=>new X({value:r,typeName:h.ZodLiteral,...g(e)});function Ze(r,e){return new Q({values:r,typeName:h.ZodEnum,...g(e)})}var Q=class r extends y{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),s=this._def.values;return u(t,{expected:_.joinValues(s),received:t.parsedType,code:c.invalid_type}),m}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),s=this._def.values;return u(t,{received:t.data,code:c.invalid_enum_value,options:s}),m}return b(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(s=>!e.includes(s)),{...this._def,...t})}};Q.create=Ze;var ee=class extends y{_parse(e){let t=_.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==d.string&&s.parsedType!==d.number){let n=_.objectValues(t);return u(s,{expected:_.joinValues(n),received:s.parsedType,code:c.invalid_type}),m}if(this._cache||(this._cache=new Set(_.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let n=_.objectValues(t);return u(s,{received:s.data,code:c.invalid_enum_value,options:n}),m}return b(e.data)}get enum(){return this._def.values}};ee.create=(r,e)=>new ee({values:r,typeName:h.ZodNativeEnum,...g(e)});var L=class extends y{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==d.promise&&t.common.async===!1)return u(t,{code:c.invalid_type,expected:d.promise,received:t.parsedType}),m;let s=t.parsedType===d.promise?t.data:Promise.resolve(t.data);return b(s.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}};L.create=(r,e)=>new L({type:r,typeName:h.ZodPromise,...g(e)});var S=class extends y{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===h.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:s}=this._processInputParams(e),n=this._def.effect||null,a={addIssue:o=>{u(s,o),o.fatal?t.abort():t.dirty()},get path(){return s.path}};if(a.addIssue=a.addIssue.bind(a),n.type==="preprocess"){let o=n.transform(s.data,a);if(s.common.async)return Promise.resolve(o).then(async i=>{if(t.value==="aborted")return m;let l=await this._def.schema._parseAsync({data:i,path:s.path,parent:s});return l.status==="aborted"?m:l.status==="dirty"?F(l.value):t.value==="dirty"?F(l.value):l});{if(t.value==="aborted")return m;let i=this._def.schema._parseSync({data:o,path:s.path,parent:s});return i.status==="aborted"?m:i.status==="dirty"?F(i.value):t.value==="dirty"?F(i.value):i}}if(n.type==="refinement"){let o=i=>{let l=n.refinement(i,a);if(s.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return i};if(s.common.async===!1){let i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return i.status==="aborted"?m:(i.status==="dirty"&&t.dirty(),o(i.value),{status:t.value,value:i.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>i.status==="aborted"?m:(i.status==="dirty"&&t.dirty(),o(i.value).then(()=>({status:t.value,value:i.value}))))}if(n.type==="transform")if(s.common.async===!1){let o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!P(o))return m;let i=n.transform(o.value,a);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:i}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>P(o)?Promise.resolve(n.transform(o.value,a)).then(i=>({status:t.value,value:i})):m);_.assertNever(n)}};S.create=(r,e,t)=>new S({schema:r,typeName:h.ZodEffects,effect:e,...g(t)});S.createWithPreprocess=(r,e,t)=>new S({schema:e,effect:{type:"preprocess",transform:r},typeName:h.ZodEffects,...g(t)});var A=class extends y{_parse(e){return this._getType(e)===d.undefined?b(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};A.create=(r,e)=>new A({innerType:r,typeName:h.ZodOptional,...g(e)});var I=class extends y{_parse(e){return this._getType(e)===d.null?b(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};I.create=(r,e)=>new I({innerType:r,typeName:h.ZodNullable,...g(e)});var te=class extends y{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return t.parsedType===d.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};te.create=(r,e)=>new te({innerType:r,typeName:h.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),s={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return ae(n)?n.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new k(s.common.issues)},input:s.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new k(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}};re.create=(r,e)=>new re({innerType:r,typeName:h.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...g(e)});var le=class extends y{_parse(e){if(this._getType(e)!==d.nan){let s=this._getOrReturnCtx(e);return u(s,{code:c.invalid_type,expected:d.nan,received:s.parsedType}),m}return{status:"valid",value:e.data}}};le.create=r=>new le({typeName:h.ZodNaN,...g(r)});var kt=Symbol("zod_brand"),pe=class extends y{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}},me=class r extends y{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{let a=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?m:a.status==="dirty"?(t.dirty(),F(a.value)):this._def.out._parseAsync({data:a.value,path:s.path,parent:s})})();{let n=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?m:n.status==="dirty"?(t.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:s.path,parent:s})}}static create(e,t){return new r({in:e,out:t,typeName:h.ZodPipeline})}},se=class extends y{_parse(e){let t=this._def.innerType._parse(e),s=n=>(P(n)&&(n.value=Object.freeze(n.value)),n);return ae(t)?t.then(n=>s(n)):s(t)}unwrap(){return this._def.innerType}};se.create=(r,e)=>new se({innerType:r,typeName:h.ZodReadonly,...g(e)});function De(r,e){let t=typeof r=="function"?r(e):typeof r=="string"?{message:r}:r;return typeof t=="string"?{message:t}:t}function $e(r,e={},t){return r?M.create().superRefine((s,n)=>{let a=r(s);if(a instanceof Promise)return a.then(o=>{if(!o){let i=De(e,s),l=i.fatal??t??!0;n.addIssue({code:"custom",...i,fatal:l})}});if(!a){let o=De(e,s),i=o.fatal??t??!0;n.addIssue({code:"custom",...o,fatal:i})}}):M.create()}var Et={object:E.lazycreate},h;(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"})(h||(h={}));var wt=(r,e={message:`Input not instance of ${r.name}`})=>$e(t=>t instanceof r,e),Pe=z.create,ze=U.create,At=le.create,Tt=B.create,Me=K.create,St=H.create,Rt=oe.create,Ct=W.create,Ot=G.create,Dt=M.create,It=Z.create,Nt=C.create,jt=ce.create,Zt=$.create,$t=E.create,Pt=E.strictCreate,zt=Y.create,Mt=ye.create,Lt=q.create,Vt=D.create,Ft=_e.create,Ut=ue.create,Bt=de.create,Kt=ve.create,Ht=J.create,Wt=X.create,Gt=Q.create,Yt=ee.create,qt=L.create,Jt=S.create,Xt=A.create,Qt=I.create,er=S.createWithPreprocess,tr=me.create,rr=()=>Pe().optional(),sr=()=>ze().optional(),nr=()=>Me().optional(),ar={string:(r=>z.create({...r,coerce:!0})),number:(r=>U.create({...r,coerce:!0})),boolean:(r=>K.create({...r,coerce:!0})),bigint:(r=>B.create({...r,coerce:!0})),date:(r=>H.create({...r,coerce:!0}))};var ir=m;var or=R.enum(["normal","compact","minimal"]),cr=R.enum(["off","light","balanced","max"]),we=R.object({enabled:R.boolean().default(!0),telemetryOptIn:R.boolean().default(!0),outputVerbosity:or.default("compact"),reducer:cr.default("off"),filters:R.object({enableAll:R.boolean().default(!0),disabled:R.array(R.string().max(64)).max(100).default([])}).default({enableAll:!0,disabled:[]})});import ur from"node:os";import{join as Ae}from"node:path";function V(){return process.env.TOKMIZER_HOME||Ae(ur.homedir(),".tokmizer")}function Le(){return Ae(V(),"skills")}function Te(r){return Ae(Le(),`${r}.md`)}var fr="settings-cache.json",Ve=we.parse({});async function Fe(){try{let r=await dr(lr(V(),fr),"utf8"),e=JSON.parse(r);return we.parse({...Ve,...e})}catch{return Ve}}import{mkdir as zs,readFile as pr,writeFile as Ms,stat as mr,readdir as Ls,rm as Vs}from"node:fs/promises";var Us=3600*1e3,hr=10080*60*1e3;function gr(){let r=Number(process.env.TOKMIZER_MAX_BUNDLE_AGE_MS);return Number.isFinite(r)&&r>0?r:hr}async function Ue(r){try{let e=await mr(Te(r));return Date.now()-e.mtimeMs>gr()?null:await pr(Te(r),"utf8")}catch{return null}}var yr=[[/(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]+-)*(?: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+.-]*:\/\/[^:/\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]"]];function Se(r){let e=r;for(let[t,s]of yr)e=e.replace(t,s);return e}import{join as Be}from"node:path";import{appendFileSync as Er,existsSync as wr,mkdirSync as Ar,readFileSync as fn,renameSync as pn,statSync as Tr,unlinkSync as mn}from"node:fs";var Ws={lastSettingsRevision:0,timeZone:_r(),bonusActive:!1};function _r(){try{let r=Intl.DateTimeFormat().resolvedOptions().timeZone;return r&&r.length>0?r:"Etc/UTC"}catch{return"Etc/UTC"}}import{createRequire as vr}from"node:module";var xr=vr(import.meta.url);function br(){for(let r of["../package.json","../../package.json"])try{let e=xr(r).version;if(typeof e=="string"&&e)return e}catch{}return"0.0.0"}var kr=br();var nn=300*1e3;var Sr=512*1024;function Ke(){return Be(V(),"spool")}function Rr(r){return Be(Ke(),`${r}.jsonl`)}function He(r,e){try{Ar(Ke(),{recursive:!0,mode:448});let t=Rr(r);if(wr(t)&&Tr(t).size>=Sr)return;Er(t,JSON.stringify(e)+`
|
|
3
|
+
var Ye=Object.defineProperty;var qe=(r,e)=>{for(var t in e)Ye(r,t,{get:e[t],enumerable:!0})};import{openSync as Pr,fstatSync as zr,readSync as Mr,closeSync as Lr}from"node:fs";import{readFile as dr,writeFile as Ss,mkdir as Rs,chmod as Cs}from"node:fs/promises";import{join as lr}from"node:path";var R={};qe(R,{BRAND:()=>bt,DIRTY:()=>F,EMPTY_PATH:()=>et,INVALID:()=>m,NEVER:()=>ir,OK:()=>k,ParseStatus:()=>x,Schema:()=>y,ZodAny:()=>M,ZodArray:()=>$,ZodBigInt:()=>B,ZodBoolean:()=>K,ZodBranded:()=>pe,ZodCatch:()=>re,ZodDate:()=>H,ZodDefault:()=>te,ZodDiscriminatedUnion:()=>ye,ZodEffects:()=>S,ZodEnum:()=>Q,ZodError:()=>b,ZodFirstPartyTypeKind:()=>h,ZodFunction:()=>ve,ZodIntersection:()=>q,ZodIssueCode:()=>c,ZodLazy:()=>J,ZodLiteral:()=>X,ZodMap:()=>ue,ZodNaN:()=>le,ZodNativeEnum:()=>ee,ZodNever:()=>C,ZodNull:()=>G,ZodNullable:()=>I,ZodNumber:()=>U,ZodObject:()=>E,ZodOptional:()=>A,ZodParsedType:()=>d,ZodPipeline:()=>me,ZodPromise:()=>L,ZodReadonly:()=>se,ZodRecord:()=>_e,ZodSchema:()=>y,ZodSet:()=>de,ZodString:()=>z,ZodSymbol:()=>oe,ZodTransformer:()=>S,ZodTuple:()=>D,ZodType:()=>y,ZodUndefined:()=>W,ZodUnion:()=>Y,ZodUnknown:()=>Z,ZodVoid:()=>ce,addIssueToContext:()=>u,any:()=>Dt,array:()=>Zt,bigint:()=>Tt,boolean:()=>Me,coerce:()=>ar,custom:()=>$e,date:()=>St,datetimeRegex:()=>je,defaultErrorMap:()=>N,discriminatedUnion:()=>Mt,effect:()=>Jt,enum:()=>Gt,function:()=>Kt,getErrorMap:()=>ne,getParsedType:()=>O,instanceof:()=>wt,intersection:()=>Lt,isAborted:()=>he,isAsync:()=>ae,isDirty:()=>ge,isValid:()=>P,late:()=>Et,lazy:()=>Ht,literal:()=>Wt,makeIssue:()=>fe,map:()=>Ut,nan:()=>At,nativeEnum:()=>Yt,never:()=>Nt,null:()=>Ot,nullable:()=>Qt,number:()=>ze,object:()=>$t,objectUtil:()=>ke,oboolean:()=>nr,onumber:()=>sr,optional:()=>Xt,ostring:()=>rr,pipeline:()=>tr,preprocess:()=>er,promise:()=>qt,quotelessJson:()=>Je,record:()=>Ft,set:()=>Bt,setErrorMap:()=>Qe,strictObject:()=>Pt,string:()=>Pe,symbol:()=>Rt,transformer:()=>Jt,tuple:()=>Vt,undefined:()=>Ct,union:()=>zt,unknown:()=>It,util:()=>_,void:()=>jt});var _;(function(r){r.assertEqual=n=>{};function e(n){}r.assertIs=e;function t(n){throw new Error}r.assertNever=t,r.arrayToEnum=n=>{let a={};for(let o of n)a[o]=o;return a},r.getValidEnumValues=n=>{let a=r.objectKeys(n).filter(i=>typeof n[n[i]]!="number"),o={};for(let i of a)o[i]=n[i];return r.objectValues(o)},r.objectValues=n=>r.objectKeys(n).map(function(a){return n[a]}),r.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{let a=[];for(let o in n)Object.prototype.hasOwnProperty.call(n,o)&&a.push(o);return a},r.find=(n,a)=>{for(let o of n)if(a(o))return o},r.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function s(n,a=" | "){return n.map(o=>typeof o=="string"?`'${o}'`:o).join(a)}r.joinValues=s,r.jsonStringifyReplacer=(n,a)=>typeof a=="bigint"?a.toString():a})(_||(_={}));var ke;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(ke||(ke={}));var d=_.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),O=r=>{switch(typeof r){case"undefined":return d.undefined;case"string":return d.string;case"number":return Number.isNaN(r)?d.nan:d.number;case"boolean":return d.boolean;case"function":return d.function;case"bigint":return d.bigint;case"symbol":return d.symbol;case"object":return Array.isArray(r)?d.array:r===null?d.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?d.promise:typeof Map<"u"&&r instanceof Map?d.map:typeof Set<"u"&&r instanceof Set?d.set:typeof Date<"u"&&r instanceof Date?d.date:d.object;default:return d.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"]),Je=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=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};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},s={_errors:[]},n=a=>{for(let o of a.issues)if(o.code==="invalid_union")o.unionErrors.map(n);else if(o.code==="invalid_return_type")n(o.returnTypeError);else if(o.code==="invalid_arguments")n(o.argumentsError);else if(o.path.length===0)s._errors.push(t(o));else{let i=s,l=0;for(;l<o.path.length;){let f=o.path[l];l===o.path.length-1?(i[f]=i[f]||{_errors:[]},i[f]._errors.push(t(o))):i[f]=i[f]||{_errors:[]},i=i[f],l++}}};return n(this),s}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={},s=[];for(let n of this.issues)if(n.path.length>0){let a=n.path[0];t[a]=t[a]||[],t[a].push(e(n))}else s.push(e(n));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}};b.create=r=>new b(r);var Xe=(r,e)=>{let t;switch(r.code){case c.invalid_type:r.received===d.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}},N=Xe;var Ce=N;function Qe(r){Ce=r}function ne(){return Ce}var fe=r=>{let{data:e,path:t,errorMaps:s,issueData:n}=r,a=[...t,...n.path||[]],o={...n,path:a};if(n.message!==void 0)return{...n,path:a,message:n.message};let i="",l=s.filter(f=>!!f).slice().reverse();for(let f of l)i=f(o,{data:e,defaultError:i}).message;return{...n,path:a,message:i}},et=[];function u(r,e){let t=ne(),s=fe({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===N?void 0:N].filter(n=>!!n)});r.common.issues.push(s)}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 s=[];for(let n of t){if(n.status==="aborted")return m;n.status==="dirty"&&e.dirty(),s.push(n.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){let s=[];for(let n of t){let a=await n.key,o=await n.value;s.push({key:a,value:o})}return r.mergeObjectSync(e,s)}static mergeObjectSync(e,t){let s={};for(let n of t){let{key:a,value:o}=n;if(a.status==="aborted"||o.status==="aborted")return m;a.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof o.value<"u"||n.alwaysSet)&&(s[a.value]=o.value)}return{status:e.value,value:s}}},m=Object.freeze({status:"aborted"}),F=r=>({status:"dirty",value:r}),k=r=>({status:"valid",value:r}),he=r=>r.status==="aborted",ge=r=>r.status==="dirty",P=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 T=class{constructor(e,t,s,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=n}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Oe=(r,e)=>{if(P(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:s,description:n}=r;if(e&&(t||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(o,i)=>{let{message:l}=r;return o.code==="invalid_enum_value"?{message:l??i.defaultError}:typeof i.data>"u"?{message:l??s??i.defaultError}:o.code!=="invalid_type"?{message:i.defaultError}:{message:l??t??i.defaultError}},description:n}}var y=class{get description(){return this._def.description}_getType(e){return O(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:O(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:O(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 s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){let s={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:O(e)},n=this._parseSync({data:e,path:s.path,parent:s});return Oe(s,n)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:O(e)};if(!this["~standard"].async)try{let s=this._parseSync({data:e,path:[],parent:t});return P(s)?{value:s.value}:{issues:t.common.issues}}catch(s){s?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(s=>P(s)?{value:s.value}:{issues:t.common.issues})}async parseAsync(e,t){let s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){let s={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:O(e)},n=this._parse({data:e,path:s.path,parent:s}),a=await(ae(n)?n:Promise.resolve(n));return Oe(s,a)}refine(e,t){let s=n=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(n):t;return this._refinement((n,a)=>{let o=e(n),i=()=>a.addIssue({code:c.custom,...s(n)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(i(),!1)):o?!0:(i(),!1)})}refinement(e,t){return this._refinement((s,n)=>e(s)?!0:(n.addIssue(typeof t=="function"?t(s,n):t),!1))}_refinement(e){return new S({schema:this,typeName:h.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 A.create(this,this._def)}nullable(){return I.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return $.create(this)}promise(){return L.create(this,this._def)}or(e){return Y.create([this,e],this._def)}and(e){return q.create(this,e,this._def)}transform(e){return new S({...g(this._def),schema:this,typeName:h.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:h.ZodDefault})}brand(){return new pe({typeName:h.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:h.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return me.create(this,e)}readonly(){return se.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},tt=/^c[^\s-]{8,}$/i,rt=/^[0-9a-z]+$/,st=/^[0-9A-HJKMNP-TV-Z]{26}$/i,nt=/^[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,at=/^[a-z0-9_-]{21}$/i,it=/^[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,ut="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",be,dt=/^(?:(?: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])$/,lt=/^(?:(?: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])$/,ft=/^(([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]))$/,pt=/^(([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])$/,mt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ht=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Ie="((\\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])))",gt=new RegExp(`^${Ie}$`);function Ne(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 yt(r){return new RegExp(`^${Ne(r)}$`)}function je(r){let e=`${Ie}T${Ne(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 _t(r,e){return!!((e==="v4"||!e)&&dt.test(r)||(e==="v6"||!e)&&ft.test(r))}function vt(r,e){if(!it.test(r))return!1;try{let[t]=r.split(".");if(!t)return!1;let s=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),n=JSON.parse(atob(s));return!(typeof n!="object"||n===null||"typ"in n&&n?.typ!=="JWT"||!n.alg||e&&n.alg!==e)}catch{return!1}}function xt(r,e){return!!((e==="v4"||!e)&<.test(r)||(e==="v6"||!e)&&pt.test(r))}var z=class r extends y{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==d.string){let a=this._getOrReturnCtx(e);return u(a,{code:c.invalid_type,expected:d.string,received:a.parsedType}),m}let s=new x,n;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(n=this._getOrReturnCtx(e,n),u(n,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="max")e.data.length>a.value&&(n=this._getOrReturnCtx(e,n),u(n,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="length"){let o=e.data.length>a.value,i=e.data.length<a.value;(o||i)&&(n=this._getOrReturnCtx(e,n),o?u(n,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):i&&u(n,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),s.dirty())}else if(a.kind==="email")ct.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"email",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="emoji")be||(be=new RegExp(ut,"u")),be.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"emoji",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="uuid")nt.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"uuid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="nanoid")at.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"nanoid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid")tt.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"cuid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid2")rt.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"cuid2",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="ulid")st.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"ulid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),u(n,{validation:"url",code:c.invalid_string,message:a.message}),s.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"regex",code:c.invalid_string,message:a.message}),s.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(n=this._getOrReturnCtx(e,n),u(n,{code:c.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),s.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)||(n=this._getOrReturnCtx(e,n),u(n,{code:c.invalid_string,validation:{startsWith:a.value},message:a.message}),s.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(n=this._getOrReturnCtx(e,n),u(n,{code:c.invalid_string,validation:{endsWith:a.value},message:a.message}),s.dirty()):a.kind==="datetime"?je(a).test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{code:c.invalid_string,validation:"datetime",message:a.message}),s.dirty()):a.kind==="date"?gt.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{code:c.invalid_string,validation:"date",message:a.message}),s.dirty()):a.kind==="time"?yt(a).test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{code:c.invalid_string,validation:"time",message:a.message}),s.dirty()):a.kind==="duration"?ot.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"duration",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="ip"?_t(e.data,a.version)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"ip",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="jwt"?vt(e.data,a.alg)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"jwt",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="cidr"?xt(e.data,a.version)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"cidr",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="base64"?mt.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"base64",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="base64url"?ht.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"base64url",code:c.invalid_string,message:a.message}),s.dirty()):_.assertNever(a);return{status:s.value,value:e.data}}_regex(e,t,s){return this.refinement(n=>e.test(n),{validation:t,code:c.invalid_string,...p.errToObj(s)})}_addCheck(e){return new 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:h.ZodString,coerce:r?.coerce??!1,...g(r)});function kt(r,e){let t=(r.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,n=t>s?t:s,a=Number.parseInt(r.toFixed(n).replace(".","")),o=Number.parseInt(e.toFixed(n).replace(".",""));return a%o/10**n}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)!==d.number){let a=this._getOrReturnCtx(e);return u(a,{code:c.invalid_type,expected:d.number,received:a.parsedType}),m}let s,n=new x;for(let a of this._def.checks)a.kind==="int"?_.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),u(s,{code:c.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),u(s,{code:c.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),u(s,{code:c.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="multipleOf"?kt(e.data,a.value)!==0&&(s=this._getOrReturnCtx(e,s),u(s,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),u(s,{code:c.not_finite,message:a.message}),n.dirty()):_.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,p.toString(t))}gt(e,t){return this.setLimit("min",e,!1,p.toString(t))}lte(e,t){return this.setLimit("max",e,!0,p.toString(t))}lt(e,t){return this.setLimit("max",e,!1,p.toString(t))}setLimit(e,t,s,n){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:p.toString(n)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:p.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:p.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:p.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:p.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:p.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:p.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:p.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:p.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:p.toString(e)})}get minValue(){let e=null;for(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 s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(t===null||s.value>t)&&(t=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}};U.create=r=>new U({checks:[],typeName:h.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)!==d.bigint)return this._getInvalidInput(e);let s,n=new x;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),u(s,{code:c.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),u(s,{code:c.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),u(s,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):_.assertNever(a);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return u(t,{code:c.invalid_type,expected:d.bigint,received:t.parsedType}),m}gte(e,t){return this.setLimit("min",e,!0,p.toString(t))}gt(e,t){return this.setLimit("min",e,!1,p.toString(t))}lte(e,t){return this.setLimit("max",e,!0,p.toString(t))}lt(e,t){return this.setLimit("max",e,!1,p.toString(t))}setLimit(e,t,s,n){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:p.toString(n)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}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:h.ZodBigInt,coerce:r?.coerce??!1,...g(r)});var K=class extends y{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==d.boolean){let s=this._getOrReturnCtx(e);return u(s,{code:c.invalid_type,expected:d.boolean,received:s.parsedType}),m}return k(e.data)}};K.create=r=>new K({typeName:h.ZodBoolean,coerce:r?.coerce||!1,...g(r)});var H=class r extends y{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==d.date){let a=this._getOrReturnCtx(e);return u(a,{code:c.invalid_type,expected:d.date,received:a.parsedType}),m}if(Number.isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return u(a,{code:c.invalid_date}),m}let s=new x,n;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(n=this._getOrReturnCtx(e,n),u(n,{code:c.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),s.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(n=this._getOrReturnCtx(e,n),u(n,{code:c.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),s.dirty()):_.assertNever(a);return{status:s.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}};H.create=r=>new H({checks:[],coerce:r?.coerce||!1,typeName:h.ZodDate,...g(r)});var oe=class extends y{_parse(e){if(this._getType(e)!==d.symbol){let s=this._getOrReturnCtx(e);return u(s,{code:c.invalid_type,expected:d.symbol,received:s.parsedType}),m}return k(e.data)}};oe.create=r=>new oe({typeName:h.ZodSymbol,...g(r)});var W=class extends y{_parse(e){if(this._getType(e)!==d.undefined){let s=this._getOrReturnCtx(e);return u(s,{code:c.invalid_type,expected:d.undefined,received:s.parsedType}),m}return k(e.data)}};W.create=r=>new W({typeName:h.ZodUndefined,...g(r)});var G=class extends y{_parse(e){if(this._getType(e)!==d.null){let s=this._getOrReturnCtx(e);return u(s,{code:c.invalid_type,expected:d.null,received:s.parsedType}),m}return k(e.data)}};G.create=r=>new G({typeName:h.ZodNull,...g(r)});var M=class extends y{constructor(){super(...arguments),this._any=!0}_parse(e){return k(e.data)}};M.create=r=>new M({typeName:h.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:h.ZodUnknown,...g(r)});var C=class extends y{_parse(e){let t=this._getOrReturnCtx(e);return u(t,{code:c.invalid_type,expected:d.never,received:t.parsedType}),m}};C.create=r=>new C({typeName:h.ZodNever,...g(r)});var ce=class extends y{_parse(e){if(this._getType(e)!==d.undefined){let s=this._getOrReturnCtx(e);return u(s,{code:c.invalid_type,expected:d.void,received:s.parsedType}),m}return k(e.data)}};ce.create=r=>new ce({typeName:h.ZodVoid,...g(r)});var $=class r extends y{_parse(e){let{ctx:t,status:s}=this._processInputParams(e),n=this._def;if(t.parsedType!==d.array)return u(t,{code:c.invalid_type,expected:d.array,received:t.parsedType}),m;if(n.exactLength!==null){let o=t.data.length>n.exactLength.value,i=t.data.length<n.exactLength.value;(o||i)&&(u(t,{code:o?c.too_big:c.too_small,minimum:i?n.exactLength.value:void 0,maximum:o?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),s.dirty())}if(n.minLength!==null&&t.data.length<n.minLength.value&&(u(t,{code:c.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),s.dirty()),n.maxLength!==null&&t.data.length>n.maxLength.value&&(u(t,{code:c.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map((o,i)=>n.type._parseAsync(new T(t,o,t.path,i)))).then(o=>x.mergeArray(s,o));let a=[...t.data].map((o,i)=>n.type._parseSync(new T(t,o,t.path,i)));return x.mergeArray(s,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)}};$.create=(r,e)=>new $({type:r,minLength:null,maxLength:null,exactLength:null,typeName:h.ZodArray,...g(e)});function ie(r){if(r instanceof E){let e={};for(let t in r.shape){let s=r.shape[t];e[t]=A.create(ie(s))}return new E({...r._def,shape:()=>e})}else return r instanceof $?new $({...r._def,type:ie(r.element)}):r instanceof A?A.create(ie(r.unwrap())):r instanceof I?I.create(ie(r.unwrap())):r instanceof D?D.create(r.items.map(e=>ie(e))):r}var E=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)!==d.object){let f=this._getOrReturnCtx(e);return u(f,{code:c.invalid_type,expected:d.object,received:f.parsedType}),m}let{status:s,ctx:n}=this._processInputParams(e),{shape:a,keys:o}=this._getCached(),i=[];if(!(this._def.catchall instanceof C&&this._def.unknownKeys==="strip"))for(let f in n.data)o.includes(f)||i.push(f);let l=[];for(let f of o){let v=a[f],w=n.data[f];l.push({key:{status:"valid",value:f},value:v._parse(new T(n,w,n.path,f)),alwaysSet:f in n.data})}if(this._def.catchall instanceof C){let f=this._def.unknownKeys;if(f==="passthrough")for(let v of i)l.push({key:{status:"valid",value:v},value:{status:"valid",value:n.data[v]}});else if(f==="strict")i.length>0&&(u(n,{code:c.unrecognized_keys,keys:i}),s.dirty());else if(f!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let f=this._def.catchall;for(let v of i){let w=n.data[v];l.push({key:{status:"valid",value:v},value:f._parse(new T(n,w,n.path,v)),alwaysSet:v in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let f=[];for(let v of l){let w=await v.key,Re=await v.value;f.push({key:w,value:Re,alwaysSet:v.alwaysSet})}return f}).then(f=>x.mergeObjectSync(s,f)):x.mergeObjectSync(s,l)}get shape(){return this._def.shape()}strict(e){return p.errToObj,new r({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{let n=this._def.errorMap?.(t,s).message??s.defaultError;return t.code==="unrecognized_keys"?{message:p.errToObj(e).message??n}:{message:n}}}:{}})}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:h.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new r({...this._def,catchall:e})}pick(e){let t={};for(let s of _.objectKeys(e))e[s]&&this.shape[s]&&(t[s]=this.shape[s]);return new r({...this._def,shape:()=>t})}omit(e){let t={};for(let s of _.objectKeys(this.shape))e[s]||(t[s]=this.shape[s]);return new r({...this._def,shape:()=>t})}deepPartial(){return ie(this)}partial(e){let t={};for(let s of _.objectKeys(this.shape)){let n=this.shape[s];e&&!e[s]?t[s]=n:t[s]=n.optional()}return new r({...this._def,shape:()=>t})}required(e){let t={};for(let s of _.objectKeys(this.shape))if(e&&!e[s])t[s]=this.shape[s];else{let a=this.shape[s];for(;a instanceof A;)a=a._def.innerType;t[s]=a}return new r({...this._def,shape:()=>t})}keyof(){return Ze(_.objectKeys(this.shape))}};E.create=(r,e)=>new E({shape:()=>r,unknownKeys:"strip",catchall:C.create(),typeName:h.ZodObject,...g(e)});E.strictCreate=(r,e)=>new E({shape:()=>r,unknownKeys:"strict",catchall:C.create(),typeName:h.ZodObject,...g(e)});E.lazycreate=(r,e)=>new E({shape:r,unknownKeys:"strip",catchall:C.create(),typeName:h.ZodObject,...g(e)});var Y=class extends y{_parse(e){let{ctx:t}=this._processInputParams(e),s=this._def.options;function n(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 t.common.issues.push(...i.ctx.common.issues),i.result;let o=a.map(i=>new b(i.ctx.common.issues));return u(t,{code:c.invalid_union,unionErrors:o}),m}if(t.common.async)return Promise.all(s.map(async a=>{let o={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:o}),ctx:o}})).then(n);{let a,o=[];for(let l of s){let f={...t,common:{...t.common,issues:[]},parent:null},v=l._parseSync({data:t.data,path:t.path,parent:f});if(v.status==="valid")return v;v.status==="dirty"&&!a&&(a={result:v,ctx:f}),f.common.issues.length&&o.push(f.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;let i=o.map(l=>new b(l));return u(t,{code:c.invalid_union,unionErrors:i}),m}}get options(){return this._def.options}};Y.create=(r,e)=>new Y({options:r,typeName:h.ZodUnion,...g(e)});var j=r=>r instanceof J?j(r.schema):r instanceof S?j(r.innerType()):r instanceof X?[r.value]:r instanceof Q?r.options:r instanceof ee?_.objectValues(r.enum):r instanceof te?j(r._def.innerType):r instanceof W?[void 0]:r instanceof G?[null]:r instanceof A?[void 0,...j(r.unwrap())]:r instanceof I?[null,...j(r.unwrap())]:r instanceof pe||r instanceof se?j(r.unwrap()):r instanceof re?j(r._def.innerType):[],ye=class r extends y{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==d.object)return u(t,{code:c.invalid_type,expected:d.object,received:t.parsedType}),m;let s=this.discriminator,n=t.data[s],a=this.optionsMap.get(n);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}):(u(t,{code:c.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),m)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){let n=new Map;for(let a of t){let o=j(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(n.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);n.set(i,a)}}return new r({typeName:h.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...g(s)})}};function Ee(r,e){let t=O(r),s=O(e);if(r===e)return{valid:!0,data:r};if(t===d.object&&s===d.object){let n=_.objectKeys(e),a=_.objectKeys(r).filter(i=>n.indexOf(i)!==-1),o={...r,...e};for(let i of a){let l=Ee(r[i],e[i]);if(!l.valid)return{valid:!1};o[i]=l.data}return{valid:!0,data:o}}else if(t===d.array&&s===d.array){if(r.length!==e.length)return{valid:!1};let n=[];for(let a=0;a<r.length;a++){let o=r[a],i=e[a],l=Ee(o,i);if(!l.valid)return{valid:!1};n.push(l.data)}return{valid:!0,data:n}}else return t===d.date&&s===d.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}var q=class extends y{_parse(e){let{status:t,ctx:s}=this._processInputParams(e),n=(a,o)=>{if(he(a)||he(o))return m;let i=Ee(a.value,o.value);return i.valid?((ge(a)||ge(o))&&t.dirty(),{status:t.value,value:i.data}):(u(s,{code:c.invalid_intersection_types}),m)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([a,o])=>n(a,o)):n(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}};q.create=(r,e,t)=>new q({left:r,right:e,typeName:h.ZodIntersection,...g(t)});var D=class r extends y{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==d.array)return u(s,{code:c.invalid_type,expected:d.array,received:s.parsedType}),m;if(s.data.length<this._def.items.length)return u(s,{code:c.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),m;!this._def.rest&&s.data.length>this._def.items.length&&(u(s,{code:c.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let a=[...s.data].map((o,i)=>{let l=this._def.items[i]||this._def.rest;return l?l._parse(new T(s,o,s.path,i)):null}).filter(o=>!!o);return s.common.async?Promise.all(a).then(o=>x.mergeArray(t,o)):x.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new r({...this._def,rest:e})}};D.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new D({items:r,typeName:h.ZodTuple,rest:null,...g(e)})};var _e=class r extends y{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==d.object)return u(s,{code:c.invalid_type,expected:d.object,received:s.parsedType}),m;let n=[],a=this._def.keyType,o=this._def.valueType;for(let i in s.data)n.push({key:a._parse(new T(s,i,s.path,i)),value:o._parse(new T(s,s.data[i],s.path,i)),alwaysSet:i in s.data});return s.common.async?x.mergeObjectAsync(t,n):x.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof y?new r({keyType:e,valueType:t,typeName:h.ZodRecord,...g(s)}):new r({keyType:z.create(),valueType:e,typeName:h.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:s}=this._processInputParams(e);if(s.parsedType!==d.map)return u(s,{code:c.invalid_type,expected:d.map,received:s.parsedType}),m;let n=this._def.keyType,a=this._def.valueType,o=[...s.data.entries()].map(([i,l],f)=>({key:n._parse(new T(s,i,s.path,[f,"key"])),value:a._parse(new T(s,l,s.path,[f,"value"]))}));if(s.common.async){let i=new Map;return Promise.resolve().then(async()=>{for(let l of o){let f=await l.key,v=await l.value;if(f.status==="aborted"||v.status==="aborted")return m;(f.status==="dirty"||v.status==="dirty")&&t.dirty(),i.set(f.value,v.value)}return{status:t.value,value:i}})}else{let i=new Map;for(let l of o){let f=l.key,v=l.value;if(f.status==="aborted"||v.status==="aborted")return m;(f.status==="dirty"||v.status==="dirty")&&t.dirty(),i.set(f.value,v.value)}return{status:t.value,value:i}}}};ue.create=(r,e,t)=>new ue({valueType:e,keyType:r,typeName:h.ZodMap,...g(t)});var de=class r extends y{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==d.set)return u(s,{code:c.invalid_type,expected:d.set,received:s.parsedType}),m;let n=this._def;n.minSize!==null&&s.data.size<n.minSize.value&&(u(s,{code:c.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),n.maxSize!==null&&s.data.size>n.maxSize.value&&(u(s,{code:c.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());let a=this._def.valueType;function o(l){let f=new Set;for(let v of l){if(v.status==="aborted")return m;v.status==="dirty"&&t.dirty(),f.add(v.value)}return{status:t.value,value:f}}let i=[...s.data.values()].map((l,f)=>a._parse(new T(s,l,s.path,f)));return s.common.async?Promise.all(i).then(l=>o(l)):o(i)}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:h.ZodSet,...g(e)});var ve=class r extends y{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==d.function)return u(t,{code:c.invalid_type,expected:d.function,received:t.parsedType}),m;function s(i,l){return fe({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ne(),N].filter(f=>!!f),issueData:{code:c.invalid_arguments,argumentsError:l}})}function n(i,l){return fe({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ne(),N].filter(f=>!!f),issueData:{code:c.invalid_return_type,returnTypeError:l}})}let a={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof L){let i=this;return k(async function(...l){let f=new b([]),v=await i._def.args.parseAsync(l,a).catch(xe=>{throw f.addIssue(s(l,xe)),f}),w=await Reflect.apply(o,this,v);return await i._def.returns._def.type.parseAsync(w,a).catch(xe=>{throw f.addIssue(n(w,xe)),f})})}else{let i=this;return k(function(...l){let f=i._def.args.safeParse(l,a);if(!f.success)throw new b([s(l,f.error)]);let v=Reflect.apply(o,this,f.data),w=i._def.returns.safeParse(v,a);if(!w.success)throw new b([n(v,w.error)]);return w.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new r({...this._def,args:D.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,s){return new r({args:e||D.create([]).rest(Z.create()),returns:t||Z.create(),typeName:h.ZodFunction,...g(s)})}},J=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})}};J.create=(r,e)=>new J({getter:r,typeName:h.ZodLazy,...g(e)});var X=class extends y{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return u(t,{received:t.data,code:c.invalid_literal,expected:this._def.value}),m}return{status:"valid",value:e.data}}get value(){return this._def.value}};X.create=(r,e)=>new X({value:r,typeName:h.ZodLiteral,...g(e)});function Ze(r,e){return new Q({values:r,typeName:h.ZodEnum,...g(e)})}var Q=class r extends y{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),s=this._def.values;return u(t,{expected:_.joinValues(s),received:t.parsedType,code:c.invalid_type}),m}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),s=this._def.values;return u(t,{received:t.data,code:c.invalid_enum_value,options:s}),m}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(s=>!e.includes(s)),{...this._def,...t})}};Q.create=Ze;var ee=class extends y{_parse(e){let t=_.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==d.string&&s.parsedType!==d.number){let n=_.objectValues(t);return u(s,{expected:_.joinValues(n),received:s.parsedType,code:c.invalid_type}),m}if(this._cache||(this._cache=new Set(_.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let n=_.objectValues(t);return u(s,{received:s.data,code:c.invalid_enum_value,options:n}),m}return k(e.data)}get enum(){return this._def.values}};ee.create=(r,e)=>new ee({values:r,typeName:h.ZodNativeEnum,...g(e)});var L=class extends y{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==d.promise&&t.common.async===!1)return u(t,{code:c.invalid_type,expected:d.promise,received:t.parsedType}),m;let s=t.parsedType===d.promise?t.data:Promise.resolve(t.data);return k(s.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}};L.create=(r,e)=>new L({type:r,typeName:h.ZodPromise,...g(e)});var S=class extends y{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===h.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:s}=this._processInputParams(e),n=this._def.effect||null,a={addIssue:o=>{u(s,o),o.fatal?t.abort():t.dirty()},get path(){return s.path}};if(a.addIssue=a.addIssue.bind(a),n.type==="preprocess"){let o=n.transform(s.data,a);if(s.common.async)return Promise.resolve(o).then(async i=>{if(t.value==="aborted")return m;let l=await this._def.schema._parseAsync({data:i,path:s.path,parent:s});return l.status==="aborted"?m:l.status==="dirty"?F(l.value):t.value==="dirty"?F(l.value):l});{if(t.value==="aborted")return m;let i=this._def.schema._parseSync({data:o,path:s.path,parent:s});return i.status==="aborted"?m:i.status==="dirty"?F(i.value):t.value==="dirty"?F(i.value):i}}if(n.type==="refinement"){let o=i=>{let l=n.refinement(i,a);if(s.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return i};if(s.common.async===!1){let i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return i.status==="aborted"?m:(i.status==="dirty"&&t.dirty(),o(i.value),{status:t.value,value:i.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>i.status==="aborted"?m:(i.status==="dirty"&&t.dirty(),o(i.value).then(()=>({status:t.value,value:i.value}))))}if(n.type==="transform")if(s.common.async===!1){let o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!P(o))return m;let i=n.transform(o.value,a);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:i}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>P(o)?Promise.resolve(n.transform(o.value,a)).then(i=>({status:t.value,value:i})):m);_.assertNever(n)}};S.create=(r,e,t)=>new S({schema:r,typeName:h.ZodEffects,effect:e,...g(t)});S.createWithPreprocess=(r,e,t)=>new S({schema:e,effect:{type:"preprocess",transform:r},typeName:h.ZodEffects,...g(t)});var A=class extends y{_parse(e){return this._getType(e)===d.undefined?k(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};A.create=(r,e)=>new A({innerType:r,typeName:h.ZodOptional,...g(e)});var I=class extends y{_parse(e){return this._getType(e)===d.null?k(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};I.create=(r,e)=>new I({innerType:r,typeName:h.ZodNullable,...g(e)});var te=class extends y{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return t.parsedType===d.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};te.create=(r,e)=>new te({innerType:r,typeName:h.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),s={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return ae(n)?n.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new b(s.common.issues)},input:s.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new b(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}};re.create=(r,e)=>new re({innerType:r,typeName:h.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...g(e)});var le=class extends y{_parse(e){if(this._getType(e)!==d.nan){let s=this._getOrReturnCtx(e);return u(s,{code:c.invalid_type,expected:d.nan,received:s.parsedType}),m}return{status:"valid",value:e.data}}};le.create=r=>new le({typeName:h.ZodNaN,...g(r)});var bt=Symbol("zod_brand"),pe=class extends y{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}},me=class r extends y{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{let a=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?m:a.status==="dirty"?(t.dirty(),F(a.value)):this._def.out._parseAsync({data:a.value,path:s.path,parent:s})})();{let n=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?m:n.status==="dirty"?(t.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:s.path,parent:s})}}static create(e,t){return new r({in:e,out:t,typeName:h.ZodPipeline})}},se=class extends y{_parse(e){let t=this._def.innerType._parse(e),s=n=>(P(n)&&(n.value=Object.freeze(n.value)),n);return ae(t)?t.then(n=>s(n)):s(t)}unwrap(){return this._def.innerType}};se.create=(r,e)=>new se({innerType:r,typeName:h.ZodReadonly,...g(e)});function De(r,e){let t=typeof r=="function"?r(e):typeof r=="string"?{message:r}:r;return typeof t=="string"?{message:t}:t}function $e(r,e={},t){return r?M.create().superRefine((s,n)=>{let a=r(s);if(a instanceof Promise)return a.then(o=>{if(!o){let i=De(e,s),l=i.fatal??t??!0;n.addIssue({code:"custom",...i,fatal:l})}});if(!a){let o=De(e,s),i=o.fatal??t??!0;n.addIssue({code:"custom",...o,fatal:i})}}):M.create()}var Et={object:E.lazycreate},h;(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"})(h||(h={}));var wt=(r,e={message:`Input not instance of ${r.name}`})=>$e(t=>t instanceof r,e),Pe=z.create,ze=U.create,At=le.create,Tt=B.create,Me=K.create,St=H.create,Rt=oe.create,Ct=W.create,Ot=G.create,Dt=M.create,It=Z.create,Nt=C.create,jt=ce.create,Zt=$.create,$t=E.create,Pt=E.strictCreate,zt=Y.create,Mt=ye.create,Lt=q.create,Vt=D.create,Ft=_e.create,Ut=ue.create,Bt=de.create,Kt=ve.create,Ht=J.create,Wt=X.create,Gt=Q.create,Yt=ee.create,qt=L.create,Jt=S.create,Xt=A.create,Qt=I.create,er=S.createWithPreprocess,tr=me.create,rr=()=>Pe().optional(),sr=()=>ze().optional(),nr=()=>Me().optional(),ar={string:(r=>z.create({...r,coerce:!0})),number:(r=>U.create({...r,coerce:!0})),boolean:(r=>K.create({...r,coerce:!0})),bigint:(r=>B.create({...r,coerce:!0})),date:(r=>H.create({...r,coerce:!0}))};var ir=m;var or=R.enum(["normal","compact","minimal"]),cr=R.enum(["off","light","balanced","max"]),we=R.object({enabled:R.boolean().default(!0),telemetryOptIn:R.boolean().default(!0),outputVerbosity:or.default("compact"),reducer:cr.default("off"),filters:R.object({enableAll:R.boolean().default(!0),disabled:R.array(R.string().max(64)).max(100).default([])}).default({enableAll:!0,disabled:[]})});import ur from"node:os";import{join as Ae}from"node:path";function V(){return process.env.TOKMIZER_HOME||Ae(ur.homedir(),".tokmizer")}function Le(){return Ae(V(),"skills")}function Te(r){return Ae(Le(),`${r}.md`)}var fr="settings-cache.json",Ve=we.parse({});async function Fe(){try{let r=await dr(lr(V(),fr),"utf8"),e=JSON.parse(r);return we.parse({...Ve,...e})}catch{return Ve}}import{mkdir as zs,readFile as pr,writeFile as Ms,stat as mr,readdir as Ls,rm as Vs}from"node:fs/promises";var Us=3600*1e3,hr=10080*60*1e3;function gr(){let r=Number(process.env.TOKMIZER_MAX_BUNDLE_AGE_MS);return Number.isFinite(r)&&r>0?r:hr}async function Ue(r){try{let e=await mr(Te(r));return Date.now()-e.mtimeMs>gr()?null:await pr(Te(r),"utf8")}catch{return null}}var yr=[[/(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]+-)*(?: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+.-]*:\/\/[^:/\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]"]];function Se(r){let e=r;for(let[t,s]of yr)e=e.replace(t,s);return e}import{join as Be}from"node:path";import{appendFileSync as Er,existsSync as wr,mkdirSync as Ar,readFileSync as fn,renameSync as pn,statSync as Tr,unlinkSync as mn}from"node:fs";var Ws={lastSettingsRevision:0,timeZone:_r(),bonusActive:!1};function _r(){try{let r=Intl.DateTimeFormat().resolvedOptions().timeZone;return r&&r.length>0?r:"Etc/UTC"}catch{return"Etc/UTC"}}import{createRequire as vr}from"node:module";var xr=vr(import.meta.url);function kr(){for(let r of["../package.json","../../package.json"])try{let e=xr(r).version;if(typeof e=="string"&&e)return e}catch{}return"0.0.0"}var br=kr();var nn=300*1e3;var Sr=512*1024;function Ke(){return Be(V(),"spool")}function Rr(r){return Be(Ke(),`${r}.jsonl`)}function He(r,e){try{Ar(Ke(),{recursive:!0,mode:448});let t=Rr(r);if(wr(t)&&Tr(t).size>=Sr)return;Er(t,JSON.stringify(e)+`
|
|
4
4
|
`,{mode:384})}catch{return}}var Cr=/^[a-z0-9][a-z0-9._-]*$/i,Or=/^[a-z][a-z-]+$/,Dr=/^[A-Za-z_][A-Za-z0-9_]*=/,Ir=new Set(["gh","glab","gup","hub","gist"]),Nr=/^(gh[a-z]_|github_pat_|gl(?:pat|rt|soat|imt|dt|ft|agent|oas)-|npm_|xox|sk-|sk_|eyj|a(?:kia|sia|gpa|ida|roa|npa)|aiza|hv[sb]\.)/i,jr=24,Zr=new Set(["docker","podman","npm","pnpm","yarn","npx","bun","deno","cargo","rustup","go","pip","pip3","uv","poetry","brew","apt","apt-get","dnf","yum","pacman","kubectl","helm","terraform","aws","gcloud","az","systemctl","composer","bundle","gem","dotnet","prisma","tkr","rtk","token"]);function We(r){let e=r.toLowerCase();return e.startsWith("git")||Ir.has(e)}function $r(r){let e=r.trim().split(/\s+/).filter(i=>i.length>0),t=0;for(;t<e.length&&Dr.test(e[t]??"");)t+=1;let s=e[t];if(!s||!Cr.test(s)||s.length>jr||We(s)||Nr.test(s)||Se(s)!==s)return"";let n=e[t+1];return n&&We(n)?"":(n&&Zr.has(s.toLowerCase())&&Or.test(n)?`${s} ${n}`:s).slice(0,64)}async function Ge(r){if(!r.telemetryOptIn)return;let e=$r(r.cmd),t=e&&Se(e)===e?e:"other";He("telemetry",{cmd:t,tokensSaved:Math.max(0,Math.round(r.tokensSaved)),optimized:r.optimized})}var Vr={light:.25,balanced:.45,max:.7},Fr=256*1024,Ur=2e3,Br=5;function Kr(r){let e=Pr(r,"r");try{let t=zr(e).size,s=Math.max(0,t-Fr),n=Buffer.alloc(t-s);return Mr(e,n,0,n.length,s),n.toString("utf8")}finally{Lr(e)}}function Hr(r){let e=r.split(`
|
|
5
5
|
`);for(let t=e.length-1;t>=0;t--){let s=e[t];if(!(!s||!s.includes('"assistant"')))try{let n=JSON.parse(s);if(n.type!=="assistant")continue;let a=n.message?.content;if(!Array.isArray(a))continue;let o=0;for(let i of a)i?.type==="text"&&typeof i.text=="string"&&(o+=i.text.length);return o}catch{continue}}return 0}async function Wr(){let r=[];for await(let l of process.stdin)r.push(l);let t=JSON.parse(Buffer.concat(r).toString("utf8")).transcript_path;if(typeof t!="string"||!t)return;let s=await Fe();if(!s.enabled)return;let n=Vr[s.reducer];if(!n||!await Ue(`reducer-${s.reducer}`))return;let a=Hr(Kr(t));if(a<=0)return;let o=Math.ceil(a/4),i=Math.min(Ur,Math.round(o*n/(1-n)));i<Br||await Ge({cmd:"reducer",tokensSaved:i,optimized:!0,telemetryOptIn:s.telemetryOptIn})}Wr().catch(()=>{});
|