@automagik/genie 3.260227.1 → 3.260227.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/claudio.js CHANGED
@@ -27,7 +27,7 @@ Expecting one of '${E.join("', '")}'`);let B=`${D}Help`;return this.on(B,($)=>{l
27
27
  `)$+=g3(q)}}return $};m3.exports=(D,F,E)=>{return String(D).normalize().replace(/\r\n/g,`
28
28
  `).split(`
29
29
  `).map((B)=>M6(B,F,E)).join(`
30
- `)}});var i3=y((Y7,n3)=>{var R6=UD("stream");class c3 extends R6{#E=null;constructor(D={}){super(D);this.writable=this.readable=!0,this.muted=!1,this.on("pipe",this._onpipe),this.replace=D.replace,this._prompt=D.prompt||null,this._hadControl=!1}#F(D,F){if(this._dest)return this._dest[D];if(this._src)return this._src[D];return F}#D(D,...F){if(typeof this._dest?.[D]==="function")this._dest[D](...F);if(typeof this._src?.[D]==="function")this._src[D](...F)}get isTTY(){if(this.#E!==null)return this.#E;return this.#F("isTTY",!1)}set isTTY(D){this.#E=D}get rows(){return this.#F("rows")}get columns(){return this.#F("columns")}mute(){this.muted=!0}unmute(){this.muted=!1}_onpipe(D){this._src=D}pipe(D,F){return this._dest=D,super.pipe(D,F)}pause(){if(this._src)return this._src.pause()}resume(){if(this._src)return this._src.resume()}write(D){if(this.muted){if(!this.replace)return!0;if(D.match(/^\u001b/)){if(D.indexOf(this._prompt)===0)D=D.slice(this._prompt.length),D=D.replace(/./g,this.replace),D=this._prompt+D;return this._hadControl=!0,this.emit("data",D)}else{if(this._prompt&&this._hadControl&&D.indexOf(this._prompt)===0)this._hadControl=!1,this.emit("data",this._prompt),D=D.slice(this._prompt.length);D=D.toString().replace(/./g,this.replace)}}this.emit("data",D)}end(D){if(this.muted)if(D&&this.replace)D=D.toString().replace(/./g,this.replace);else D=null;if(D)this.emit("data",D);this.emit("end")}destroy(...D){return this.#D("destroy",...D)}destroySoon(...D){return this.#D("destroySoon",...D)}close(...D){return this.#D("close",...D)}}n3.exports=c3});var I,T0,W,YD=(D)=>{switch(typeof D){case"undefined":return W.undefined;case"string":return W.string;case"number":return Number.isNaN(D)?W.nan:W.number;case"boolean":return W.boolean;case"function":return W.function;case"bigint":return W.bigint;case"symbol":return W.symbol;case"object":if(Array.isArray(D))return W.array;if(D===null)return W.null;if(D.then&&typeof D.then==="function"&&D.catch&&typeof D.catch==="function")return W.promise;if(typeof Map<"u"&&D instanceof Map)return W.map;if(typeof Set<"u"&&D instanceof Set)return W.set;if(typeof Date<"u"&&D instanceof Date)return W.date;return W.object;default:return W.unknown}};var z2=JD(()=>{(function(D){D.assertEqual=($)=>{};function F($){}D.assertIs=F;function E($){throw Error()}D.assertNever=E,D.arrayToEnum=($)=>{let q={};for(let X of $)q[X]=X;return q},D.getValidEnumValues=($)=>{let q=D.objectKeys($).filter((Q)=>typeof $[$[Q]]!=="number"),X={};for(let Q of q)X[Q]=$[Q];return D.objectValues(X)},D.objectValues=($)=>{return D.objectKeys($).map(function(q){return $[q]})},D.objectKeys=typeof Object.keys==="function"?($)=>Object.keys($):($)=>{let q=[];for(let X in $)if(Object.prototype.hasOwnProperty.call($,X))q.push(X);return q},D.find=($,q)=>{for(let X of $)if(q(X))return X;return},D.isInteger=typeof Number.isInteger==="function"?($)=>Number.isInteger($):($)=>typeof $==="number"&&Number.isFinite($)&&Math.floor($)===$;function B($,q=" | "){return $.map((X)=>typeof X==="string"?`'${X}'`:X).join(q)}D.joinValues=B,D.jsonStringifyReplacer=($,q)=>{if(typeof q==="bigint")return q.toString();return q}})(I||(I={}));(function(D){D.mergeShapes=(F,E)=>{return{...F,...E}}})(T0||(T0={}));W=I.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"])});var Y,T6=(D)=>{return JSON.stringify(D,null,2).replace(/"([^"]+)":/g,"$1:")},p;var v2=JD(()=>{z2();Y=I.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"]);p=class p extends Error{get errors(){return this.issues}constructor(D){super();this.issues=[],this.addIssue=(E)=>{this.issues=[...this.issues,E]},this.addIssues=(E=[])=>{this.issues=[...this.issues,...E]};let F=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,F);else this.__proto__=F;this.name="ZodError",this.issues=D}format(D){let F=D||function($){return $.message},E={_errors:[]},B=($)=>{for(let q of $.issues)if(q.code==="invalid_union")q.unionErrors.map(B);else if(q.code==="invalid_return_type")B(q.returnTypeError);else if(q.code==="invalid_arguments")B(q.argumentsError);else if(q.path.length===0)E._errors.push(F(q));else{let X=E,Q=0;while(Q<q.path.length){let C=q.path[Q];if(Q!==q.path.length-1)X[C]=X[C]||{_errors:[]};else X[C]=X[C]||{_errors:[]},X[C]._errors.push(F(q));X=X[C],Q++}}};return B(this),E}static assert(D){if(!(D instanceof p))throw Error(`Not a ZodError: ${D}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,I.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(D=(F)=>F.message){let F={},E=[];for(let B of this.issues)if(B.path.length>0){let $=B.path[0];F[$]=F[$]||[],F[$].push(D(B))}else E.push(D(B));return{formErrors:E,fieldErrors:F}}get formErrors(){return this.flatten()}};p.create=(D)=>{return new p(D)}});var b6=(D,F)=>{let E;switch(D.code){case Y.invalid_type:if(D.received===W.undefined)E="Required";else E=`Expected ${D.expected}, received ${D.received}`;break;case Y.invalid_literal:E=`Invalid literal value, expected ${JSON.stringify(D.expected,I.jsonStringifyReplacer)}`;break;case Y.unrecognized_keys:E=`Unrecognized key(s) in object: ${I.joinValues(D.keys,", ")}`;break;case Y.invalid_union:E="Invalid input";break;case Y.invalid_union_discriminator:E=`Invalid discriminator value. Expected ${I.joinValues(D.options)}`;break;case Y.invalid_enum_value:E=`Invalid enum value. Expected ${I.joinValues(D.options)}, received '${D.received}'`;break;case Y.invalid_arguments:E="Invalid function arguments";break;case Y.invalid_return_type:E="Invalid function return type";break;case Y.invalid_date:E="Invalid date";break;case Y.invalid_string:if(typeof D.validation==="object")if("includes"in D.validation){if(E=`Invalid input: must include "${D.validation.includes}"`,typeof D.validation.position==="number")E=`${E} at one or more positions greater than or equal to ${D.validation.position}`}else if("startsWith"in D.validation)E=`Invalid input: must start with "${D.validation.startsWith}"`;else if("endsWith"in D.validation)E=`Invalid input: must end with "${D.validation.endsWith}"`;else I.assertNever(D.validation);else if(D.validation!=="regex")E=`Invalid ${D.validation}`;else E="Invalid";break;case Y.too_small:if(D.type==="array")E=`Array must contain ${D.exact?"exactly":D.inclusive?"at least":"more than"} ${D.minimum} element(s)`;else if(D.type==="string")E=`String must contain ${D.exact?"exactly":D.inclusive?"at least":"over"} ${D.minimum} character(s)`;else if(D.type==="number")E=`Number must be ${D.exact?"exactly equal to ":D.inclusive?"greater than or equal to ":"greater than "}${D.minimum}`;else if(D.type==="bigint")E=`Number must be ${D.exact?"exactly equal to ":D.inclusive?"greater than or equal to ":"greater than "}${D.minimum}`;else if(D.type==="date")E=`Date must be ${D.exact?"exactly equal to ":D.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(D.minimum))}`;else E="Invalid input";break;case Y.too_big:if(D.type==="array")E=`Array must contain ${D.exact?"exactly":D.inclusive?"at most":"less than"} ${D.maximum} element(s)`;else if(D.type==="string")E=`String must contain ${D.exact?"exactly":D.inclusive?"at most":"under"} ${D.maximum} character(s)`;else if(D.type==="number")E=`Number must be ${D.exact?"exactly":D.inclusive?"less than or equal to":"less than"} ${D.maximum}`;else if(D.type==="bigint")E=`BigInt must be ${D.exact?"exactly":D.inclusive?"less than or equal to":"less than"} ${D.maximum}`;else if(D.type==="date")E=`Date must be ${D.exact?"exactly":D.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(D.maximum))}`;else E="Invalid input";break;case Y.custom:E="Invalid input";break;case Y.invalid_intersection_types:E="Intersection results could not be merged";break;case Y.not_multiple_of:E=`Number must be a multiple of ${D.multipleOf}`;break;case Y.not_finite:E="Number must be finite";break;default:E=F.defaultError,I.assertNever(D)}return{message:E}},RD;var b0=JD(()=>{v2();z2();RD=b6});function k6(D){X8=D}function rD(){return X8}var X8;var Z2=JD(()=>{b0();X8=RD});function H(D,F){let E=rD(),B=u2({issueData:F,data:D.data,path:D.path,errorMaps:[D.common.contextualErrorMap,D.schemaErrorMap,E,E===RD?void 0:RD].filter(($)=>!!$)});D.common.issues.push(B)}class h{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray(D,F){let E=[];for(let B of F){if(B.status==="aborted")return R;if(B.status==="dirty")D.dirty();E.push(B.value)}return{status:D.value,value:E}}static async mergeObjectAsync(D,F){let E=[];for(let B of F){let $=await B.key,q=await B.value;E.push({key:$,value:q})}return h.mergeObjectSync(D,E)}static mergeObjectSync(D,F){let E={};for(let B of F){let{key:$,value:q}=B;if($.status==="aborted")return R;if(q.status==="aborted")return R;if($.status==="dirty")D.dirty();if(q.status==="dirty")D.dirty();if($.value!=="__proto__"&&(typeof q.value<"u"||B.alwaysSet))E[$.value]=q.value}return{status:D.value,value:E}}}var u2=(D)=>{let{data:F,path:E,errorMaps:B,issueData:$}=D,q=[...E,...$.path||[]],X={...$,path:q};if($.message!==void 0)return{...$,path:q,message:$.message};let Q="",C=B.filter((J)=>!!J).slice().reverse();for(let J of C)Q=J(X,{data:F,defaultError:Q}).message;return{...$,path:q,message:Q}},f6,R,xD=(D)=>({status:"dirty",value:D}),l=(D)=>({status:"valid",value:D}),x2=(D)=>D.status==="aborted",y2=(D)=>D.status==="dirty",VD=(D)=>D.status==="valid",aD=(D)=>typeof Promise<"u"&&D instanceof Promise;var k0=JD(()=>{Z2();b0();f6=[];R=Object.freeze({status:"aborted"})});var Q8=()=>{};var A;var C8=JD(()=>{(function(D){D.errToObj=(F)=>typeof F==="string"?{message:F}:F||{},D.toString=(F)=>typeof F==="string"?F:F?.message})(A||(A={}))});class QD{constructor(D,F,E,B){this._cachedPath=[],this.parent=D,this.data=F,this._path=E,this._key=B}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}function V(D){if(!D)return{};let{errorMap:F,invalid_type_error:E,required_error:B,description:$}=D;if(F&&(E||B))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(F)return{errorMap:F,description:$};return{errorMap:(X,Q)=>{let{message:C}=D;if(X.code==="invalid_enum_value")return{message:C??Q.defaultError};if(typeof Q.data>"u")return{message:C??B??Q.defaultError};if(X.code!=="invalid_type")return{message:Q.defaultError};return{message:C??E??Q.defaultError}},description:$}}class O{get description(){return this._def.description}_getType(D){return YD(D.data)}_getOrReturnCtx(D,F){return F||{common:D.parent.common,data:D.data,parsedType:YD(D.data),schemaErrorMap:this._def.errorMap,path:D.path,parent:D.parent}}_processInputParams(D){return{status:new h,ctx:{common:D.parent.common,data:D.data,parsedType:YD(D.data),schemaErrorMap:this._def.errorMap,path:D.path,parent:D.parent}}}_parseSync(D){let F=this._parse(D);if(aD(F))throw Error("Synchronous parse encountered promise.");return F}_parseAsync(D){let F=this._parse(D);return Promise.resolve(F)}parse(D,F){let E=this.safeParse(D,F);if(E.success)return E.data;throw E.error}safeParse(D,F){let E={common:{issues:[],async:F?.async??!1,contextualErrorMap:F?.errorMap},path:F?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:D,parsedType:YD(D)},B=this._parseSync({data:D,path:E.path,parent:E});return J8(E,B)}"~validate"(D){let F={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:D,parsedType:YD(D)};if(!this["~standard"].async)try{let E=this._parseSync({data:D,path:[],parent:F});return VD(E)?{value:E.value}:{issues:F.common.issues}}catch(E){if(E?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;F.common={issues:[],async:!0}}return this._parseAsync({data:D,path:[],parent:F}).then((E)=>VD(E)?{value:E.value}:{issues:F.common.issues})}async parseAsync(D,F){let E=await this.safeParseAsync(D,F);if(E.success)return E.data;throw E.error}async safeParseAsync(D,F){let E={common:{issues:[],contextualErrorMap:F?.errorMap,async:!0},path:F?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:D,parsedType:YD(D)},B=this._parse({data:D,path:E.path,parent:E}),$=await(aD(B)?B:Promise.resolve(B));return J8(E,$)}refine(D,F){let E=(B)=>{if(typeof F==="string"||typeof F>"u")return{message:F};else if(typeof F==="function")return F(B);else return F};return this._refinement((B,$)=>{let q=D(B),X=()=>$.addIssue({code:Y.custom,...E(B)});if(typeof Promise<"u"&&q instanceof Promise)return q.then((Q)=>{if(!Q)return X(),!1;else return!0});if(!q)return X(),!1;else return!0})}refinement(D,F){return this._refinement((E,B)=>{if(!D(E))return B.addIssue(typeof F==="function"?F(E,B):F),!1;else return!0})}_refinement(D){return new CD({schema:this,typeName:u.ZodEffects,effect:{type:"refinement",refinement:D}})}superRefine(D){return this._refinement(D)}constructor(D){this.spa=this.safeParseAsync,this._def=D,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:(F)=>this["~validate"](F)}}optional(){return XD.create(this,this._def)}nullable(){return uD.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return qD.create(this)}promise(){return mD.create(this,this._def)}or(D){return F2.create([this,D],this._def)}and(D){return E2.create(this,D,this._def)}transform(D){return new CD({...V(this._def),schema:this,typeName:u.ZodEffects,effect:{type:"transform",transform:D}})}default(D){let F=typeof D==="function"?D:()=>D;return new X2({...V(this._def),innerType:this,defaultValue:F,typeName:u.ZodDefault})}brand(){return new g2({typeName:u.ZodBranded,type:this,...V(this._def)})}catch(D){let F=typeof D==="function"?D:()=>D;return new Q2({...V(this._def),innerType:this,catchValue:F,typeName:u.ZodCatch})}describe(D){return new this.constructor({...this._def,description:D})}pipe(D){return K2.create(this,D)}readonly(){return C2.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}function W8(D){let F="[0-5]\\d";if(D.precision)F=`${F}\\.\\d{${D.precision}}`;else if(D.precision==null)F=`${F}(\\.\\d+)?`;let E=D.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${F})${E}`}function s6(D){return new RegExp(`^${W8(D)}$`)}function G8(D){let F=`${Y8}T${W8(D)}`,E=[];if(E.push(D.local?"Z?":"Z"),D.offset)E.push("([+-]\\d{2}:?\\d{2})");return F=`${F}(${E.join("|")})`,new RegExp(`^${F}$`)}function t6(D,F){if((F==="v4"||!F)&&d6.test(D))return!0;if((F==="v6"||!F)&&n6.test(D))return!0;return!1}function e6(D,F){if(!g6.test(D))return!1;try{let[E]=D.split(".");if(!E)return!1;let B=E.replace(/-/g,"+").replace(/_/g,"/").padEnd(E.length+(4-E.length%4)%4,"="),$=JSON.parse(atob(B));if(typeof $!=="object"||$===null)return!1;if("typ"in $&&$?.typ!=="JWT")return!1;if(!$.alg)return!1;if(F&&$.alg!==F)return!1;return!0}catch{return!1}}function D1(D,F){if((F==="v4"||!F)&&c6.test(D))return!0;if((F==="v6"||!F)&&i6.test(D))return!0;return!1}function F1(D,F){let E=(D.toString().split(".")[1]||"").length,B=(F.toString().split(".")[1]||"").length,$=E>B?E:B,q=Number.parseInt(D.toFixed($).replace(".","")),X=Number.parseInt(F.toFixed($).replace(".",""));return q%X/10**$}function oD(D){if(D instanceof Z){let F={};for(let E in D.shape){let B=D.shape[E];F[E]=XD.create(oD(B))}return new Z({...D._def,shape:()=>F})}else if(D instanceof qD)return new qD({...D._def,type:oD(D.element)});else if(D instanceof XD)return XD.create(oD(D.unwrap()));else if(D instanceof uD)return uD.create(oD(D.unwrap()));else if(D instanceof GD)return GD.create(D.items.map((F)=>oD(F)));else return D}function v0(D,F){let E=YD(D),B=YD(F);if(D===F)return{valid:!0,data:D};else if(E===W.object&&B===W.object){let $=I.objectKeys(F),q=I.objectKeys(D).filter((Q)=>$.indexOf(Q)!==-1),X={...D,...F};for(let Q of q){let C=v0(D[Q],F[Q]);if(!C.valid)return{valid:!1};X[Q]=C.data}return{valid:!0,data:X}}else if(E===W.array&&B===W.array){if(D.length!==F.length)return{valid:!1};let $=[];for(let q=0;q<D.length;q++){let X=D[q],Q=F[q],C=v0(X,Q);if(!C.valid)return{valid:!1};$.push(C.data)}return{valid:!0,data:$}}else if(E===W.date&&B===W.date&&+D===+F)return{valid:!0,data:D};else return{valid:!1}}function H8(D,F){return new wD({values:D,typeName:u.ZodEnum,...V(F)})}function _8(D,F){let E=typeof D==="function"?D(F):typeof D==="string"?{message:D}:D;return typeof E==="string"?{message:E}:E}function M8(D,F={},E){if(D)return hD.create().superRefine((B,$)=>{let q=D(B);if(q instanceof Promise)return q.then((X)=>{if(!X){let Q=_8(F,B),C=Q.fatal??E??!0;$.addIssue({code:"custom",...Q,fatal:C})}});if(!q){let X=_8(F,B),Q=X.fatal??E??!0;$.addIssue({code:"custom",...X,fatal:Q})}return});return hD.create()}var J8=(D,F)=>{if(VD(F))return{success:!0,data:F.value};else{if(!D.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let E=new p(D.common.issues);return this._error=E,this._error}}}},v6,Z6,x6,y6,h6,g6,m6,l6,p6="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",f0,d6,c6,n6,i6,r6,a6,Y8="((\\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])))",o6,$D,KD,OD,tD,yD,j2,eD,D2,hD,ND,WD,U2,qD,Z,F2,zD=(D)=>{if(D instanceof B2)return zD(D.schema);else if(D instanceof CD)return zD(D.innerType());else if(D instanceof $2)return[D.value];else if(D instanceof wD)return D.options;else if(D instanceof q2)return I.objectValues(D.enum);else if(D instanceof X2)return zD(D._def.innerType);else if(D instanceof eD)return[void 0];else if(D instanceof D2)return[null];else if(D instanceof XD)return[void 0,...zD(D.unwrap())];else if(D instanceof uD)return[null,...zD(D.unwrap())];else if(D instanceof g2)return zD(D.unwrap());else if(D instanceof C2)return zD(D.unwrap());else if(D instanceof Q2)return zD(D._def.innerType);else return[]},h2,E2,GD,L2,V2,gD,sD,B2,$2,wD,q2,mD,CD,XD,uD,X2,Q2,N2,E1,g2,K2,C2,B1,u,$1=(D,F={message:`Input not instance of ${D.name}`})=>M8((E)=>E instanceof D,F),A8,R8,q1,X1,z8,Q1,C1,J1,_1,Y1,W1,G1,H1,M1,A1,R1,z1,u1,j1,U1,L1,V1,N1,K1,O1,w1,S1,I1,P1,T1,b1,k1,f1,v1,Z1=()=>A8().optional(),x1=()=>R8().optional(),y1=()=>z8().optional(),h1,g1;var u8=JD(()=>{v2();Z2();C8();k0();z2();v6=/^c[^\s-]{8,}$/i,Z6=/^[0-9a-z]+$/,x6=/^[0-9A-HJKMNP-TV-Z]{26}$/i,y6=/^[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,h6=/^[a-z0-9_-]{21}$/i,g6=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,m6=/^[-+]?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)?)??$/,l6=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,d6=/^(?:(?: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])$/,c6=/^(?:(?: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])$/,n6=/^(([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]))$/,i6=/^(([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])$/,r6=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,a6=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,o6=new RegExp(`^${Y8}$`);$D=class $D extends O{_parse(D){if(this._def.coerce)D.data=String(D.data);if(this._getType(D)!==W.string){let $=this._getOrReturnCtx(D);return H($,{code:Y.invalid_type,expected:W.string,received:$.parsedType}),R}let E=new h,B=void 0;for(let $ of this._def.checks)if($.kind==="min"){if(D.data.length<$.value)B=this._getOrReturnCtx(D,B),H(B,{code:Y.too_small,minimum:$.value,type:"string",inclusive:!0,exact:!1,message:$.message}),E.dirty()}else if($.kind==="max"){if(D.data.length>$.value)B=this._getOrReturnCtx(D,B),H(B,{code:Y.too_big,maximum:$.value,type:"string",inclusive:!0,exact:!1,message:$.message}),E.dirty()}else if($.kind==="length"){let q=D.data.length>$.value,X=D.data.length<$.value;if(q||X){if(B=this._getOrReturnCtx(D,B),q)H(B,{code:Y.too_big,maximum:$.value,type:"string",inclusive:!0,exact:!0,message:$.message});else if(X)H(B,{code:Y.too_small,minimum:$.value,type:"string",inclusive:!0,exact:!0,message:$.message});E.dirty()}}else if($.kind==="email"){if(!l6.test(D.data))B=this._getOrReturnCtx(D,B),H(B,{validation:"email",code:Y.invalid_string,message:$.message}),E.dirty()}else if($.kind==="emoji"){if(!f0)f0=new RegExp(p6,"u");if(!f0.test(D.data))B=this._getOrReturnCtx(D,B),H(B,{validation:"emoji",code:Y.invalid_string,message:$.message}),E.dirty()}else if($.kind==="uuid"){if(!y6.test(D.data))B=this._getOrReturnCtx(D,B),H(B,{validation:"uuid",code:Y.invalid_string,message:$.message}),E.dirty()}else if($.kind==="nanoid"){if(!h6.test(D.data))B=this._getOrReturnCtx(D,B),H(B,{validation:"nanoid",code:Y.invalid_string,message:$.message}),E.dirty()}else if($.kind==="cuid"){if(!v6.test(D.data))B=this._getOrReturnCtx(D,B),H(B,{validation:"cuid",code:Y.invalid_string,message:$.message}),E.dirty()}else if($.kind==="cuid2"){if(!Z6.test(D.data))B=this._getOrReturnCtx(D,B),H(B,{validation:"cuid2",code:Y.invalid_string,message:$.message}),E.dirty()}else if($.kind==="ulid"){if(!x6.test(D.data))B=this._getOrReturnCtx(D,B),H(B,{validation:"ulid",code:Y.invalid_string,message:$.message}),E.dirty()}else if($.kind==="url")try{new URL(D.data)}catch{B=this._getOrReturnCtx(D,B),H(B,{validation:"url",code:Y.invalid_string,message:$.message}),E.dirty()}else if($.kind==="regex"){if($.regex.lastIndex=0,!$.regex.test(D.data))B=this._getOrReturnCtx(D,B),H(B,{validation:"regex",code:Y.invalid_string,message:$.message}),E.dirty()}else if($.kind==="trim")D.data=D.data.trim();else if($.kind==="includes"){if(!D.data.includes($.value,$.position))B=this._getOrReturnCtx(D,B),H(B,{code:Y.invalid_string,validation:{includes:$.value,position:$.position},message:$.message}),E.dirty()}else if($.kind==="toLowerCase")D.data=D.data.toLowerCase();else if($.kind==="toUpperCase")D.data=D.data.toUpperCase();else if($.kind==="startsWith"){if(!D.data.startsWith($.value))B=this._getOrReturnCtx(D,B),H(B,{code:Y.invalid_string,validation:{startsWith:$.value},message:$.message}),E.dirty()}else if($.kind==="endsWith"){if(!D.data.endsWith($.value))B=this._getOrReturnCtx(D,B),H(B,{code:Y.invalid_string,validation:{endsWith:$.value},message:$.message}),E.dirty()}else if($.kind==="datetime"){if(!G8($).test(D.data))B=this._getOrReturnCtx(D,B),H(B,{code:Y.invalid_string,validation:"datetime",message:$.message}),E.dirty()}else if($.kind==="date"){if(!o6.test(D.data))B=this._getOrReturnCtx(D,B),H(B,{code:Y.invalid_string,validation:"date",message:$.message}),E.dirty()}else if($.kind==="time"){if(!s6($).test(D.data))B=this._getOrReturnCtx(D,B),H(B,{code:Y.invalid_string,validation:"time",message:$.message}),E.dirty()}else if($.kind==="duration"){if(!m6.test(D.data))B=this._getOrReturnCtx(D,B),H(B,{validation:"duration",code:Y.invalid_string,message:$.message}),E.dirty()}else if($.kind==="ip"){if(!t6(D.data,$.version))B=this._getOrReturnCtx(D,B),H(B,{validation:"ip",code:Y.invalid_string,message:$.message}),E.dirty()}else if($.kind==="jwt"){if(!e6(D.data,$.alg))B=this._getOrReturnCtx(D,B),H(B,{validation:"jwt",code:Y.invalid_string,message:$.message}),E.dirty()}else if($.kind==="cidr"){if(!D1(D.data,$.version))B=this._getOrReturnCtx(D,B),H(B,{validation:"cidr",code:Y.invalid_string,message:$.message}),E.dirty()}else if($.kind==="base64"){if(!r6.test(D.data))B=this._getOrReturnCtx(D,B),H(B,{validation:"base64",code:Y.invalid_string,message:$.message}),E.dirty()}else if($.kind==="base64url"){if(!a6.test(D.data))B=this._getOrReturnCtx(D,B),H(B,{validation:"base64url",code:Y.invalid_string,message:$.message}),E.dirty()}else I.assertNever($);return{status:E.value,value:D.data}}_regex(D,F,E){return this.refinement((B)=>D.test(B),{validation:F,code:Y.invalid_string,...A.errToObj(E)})}_addCheck(D){return new $D({...this._def,checks:[...this._def.checks,D]})}email(D){return this._addCheck({kind:"email",...A.errToObj(D)})}url(D){return this._addCheck({kind:"url",...A.errToObj(D)})}emoji(D){return this._addCheck({kind:"emoji",...A.errToObj(D)})}uuid(D){return this._addCheck({kind:"uuid",...A.errToObj(D)})}nanoid(D){return this._addCheck({kind:"nanoid",...A.errToObj(D)})}cuid(D){return this._addCheck({kind:"cuid",...A.errToObj(D)})}cuid2(D){return this._addCheck({kind:"cuid2",...A.errToObj(D)})}ulid(D){return this._addCheck({kind:"ulid",...A.errToObj(D)})}base64(D){return this._addCheck({kind:"base64",...A.errToObj(D)})}base64url(D){return this._addCheck({kind:"base64url",...A.errToObj(D)})}jwt(D){return this._addCheck({kind:"jwt",...A.errToObj(D)})}ip(D){return this._addCheck({kind:"ip",...A.errToObj(D)})}cidr(D){return this._addCheck({kind:"cidr",...A.errToObj(D)})}datetime(D){if(typeof D==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:D});return this._addCheck({kind:"datetime",precision:typeof D?.precision>"u"?null:D?.precision,offset:D?.offset??!1,local:D?.local??!1,...A.errToObj(D?.message)})}date(D){return this._addCheck({kind:"date",message:D})}time(D){if(typeof D==="string")return this._addCheck({kind:"time",precision:null,message:D});return this._addCheck({kind:"time",precision:typeof D?.precision>"u"?null:D?.precision,...A.errToObj(D?.message)})}duration(D){return this._addCheck({kind:"duration",...A.errToObj(D)})}regex(D,F){return this._addCheck({kind:"regex",regex:D,...A.errToObj(F)})}includes(D,F){return this._addCheck({kind:"includes",value:D,position:F?.position,...A.errToObj(F?.message)})}startsWith(D,F){return this._addCheck({kind:"startsWith",value:D,...A.errToObj(F)})}endsWith(D,F){return this._addCheck({kind:"endsWith",value:D,...A.errToObj(F)})}min(D,F){return this._addCheck({kind:"min",value:D,...A.errToObj(F)})}max(D,F){return this._addCheck({kind:"max",value:D,...A.errToObj(F)})}length(D,F){return this._addCheck({kind:"length",value:D,...A.errToObj(F)})}nonempty(D){return this.min(1,A.errToObj(D))}trim(){return new $D({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new $D({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new $D({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((D)=>D.kind==="datetime")}get isDate(){return!!this._def.checks.find((D)=>D.kind==="date")}get isTime(){return!!this._def.checks.find((D)=>D.kind==="time")}get isDuration(){return!!this._def.checks.find((D)=>D.kind==="duration")}get isEmail(){return!!this._def.checks.find((D)=>D.kind==="email")}get isURL(){return!!this._def.checks.find((D)=>D.kind==="url")}get isEmoji(){return!!this._def.checks.find((D)=>D.kind==="emoji")}get isUUID(){return!!this._def.checks.find((D)=>D.kind==="uuid")}get isNANOID(){return!!this._def.checks.find((D)=>D.kind==="nanoid")}get isCUID(){return!!this._def.checks.find((D)=>D.kind==="cuid")}get isCUID2(){return!!this._def.checks.find((D)=>D.kind==="cuid2")}get isULID(){return!!this._def.checks.find((D)=>D.kind==="ulid")}get isIP(){return!!this._def.checks.find((D)=>D.kind==="ip")}get isCIDR(){return!!this._def.checks.find((D)=>D.kind==="cidr")}get isBase64(){return!!this._def.checks.find((D)=>D.kind==="base64")}get isBase64url(){return!!this._def.checks.find((D)=>D.kind==="base64url")}get minLength(){let D=null;for(let F of this._def.checks)if(F.kind==="min"){if(D===null||F.value>D)D=F.value}return D}get maxLength(){let D=null;for(let F of this._def.checks)if(F.kind==="max"){if(D===null||F.value<D)D=F.value}return D}};$D.create=(D)=>{return new $D({checks:[],typeName:u.ZodString,coerce:D?.coerce??!1,...V(D)})};KD=class KD extends O{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(D){if(this._def.coerce)D.data=Number(D.data);if(this._getType(D)!==W.number){let $=this._getOrReturnCtx(D);return H($,{code:Y.invalid_type,expected:W.number,received:$.parsedType}),R}let E=void 0,B=new h;for(let $ of this._def.checks)if($.kind==="int"){if(!I.isInteger(D.data))E=this._getOrReturnCtx(D,E),H(E,{code:Y.invalid_type,expected:"integer",received:"float",message:$.message}),B.dirty()}else if($.kind==="min"){if($.inclusive?D.data<$.value:D.data<=$.value)E=this._getOrReturnCtx(D,E),H(E,{code:Y.too_small,minimum:$.value,type:"number",inclusive:$.inclusive,exact:!1,message:$.message}),B.dirty()}else if($.kind==="max"){if($.inclusive?D.data>$.value:D.data>=$.value)E=this._getOrReturnCtx(D,E),H(E,{code:Y.too_big,maximum:$.value,type:"number",inclusive:$.inclusive,exact:!1,message:$.message}),B.dirty()}else if($.kind==="multipleOf"){if(F1(D.data,$.value)!==0)E=this._getOrReturnCtx(D,E),H(E,{code:Y.not_multiple_of,multipleOf:$.value,message:$.message}),B.dirty()}else if($.kind==="finite"){if(!Number.isFinite(D.data))E=this._getOrReturnCtx(D,E),H(E,{code:Y.not_finite,message:$.message}),B.dirty()}else I.assertNever($);return{status:B.value,value:D.data}}gte(D,F){return this.setLimit("min",D,!0,A.toString(F))}gt(D,F){return this.setLimit("min",D,!1,A.toString(F))}lte(D,F){return this.setLimit("max",D,!0,A.toString(F))}lt(D,F){return this.setLimit("max",D,!1,A.toString(F))}setLimit(D,F,E,B){return new KD({...this._def,checks:[...this._def.checks,{kind:D,value:F,inclusive:E,message:A.toString(B)}]})}_addCheck(D){return new KD({...this._def,checks:[...this._def.checks,D]})}int(D){return this._addCheck({kind:"int",message:A.toString(D)})}positive(D){return this._addCheck({kind:"min",value:0,inclusive:!1,message:A.toString(D)})}negative(D){return this._addCheck({kind:"max",value:0,inclusive:!1,message:A.toString(D)})}nonpositive(D){return this._addCheck({kind:"max",value:0,inclusive:!0,message:A.toString(D)})}nonnegative(D){return this._addCheck({kind:"min",value:0,inclusive:!0,message:A.toString(D)})}multipleOf(D,F){return this._addCheck({kind:"multipleOf",value:D,message:A.toString(F)})}finite(D){return this._addCheck({kind:"finite",message:A.toString(D)})}safe(D){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:A.toString(D)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:A.toString(D)})}get minValue(){let D=null;for(let F of this._def.checks)if(F.kind==="min"){if(D===null||F.value>D)D=F.value}return D}get maxValue(){let D=null;for(let F of this._def.checks)if(F.kind==="max"){if(D===null||F.value<D)D=F.value}return D}get isInt(){return!!this._def.checks.find((D)=>D.kind==="int"||D.kind==="multipleOf"&&I.isInteger(D.value))}get isFinite(){let D=null,F=null;for(let E of this._def.checks)if(E.kind==="finite"||E.kind==="int"||E.kind==="multipleOf")return!0;else if(E.kind==="min"){if(F===null||E.value>F)F=E.value}else if(E.kind==="max"){if(D===null||E.value<D)D=E.value}return Number.isFinite(F)&&Number.isFinite(D)}};KD.create=(D)=>{return new KD({checks:[],typeName:u.ZodNumber,coerce:D?.coerce||!1,...V(D)})};OD=class OD extends O{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse(D){if(this._def.coerce)try{D.data=BigInt(D.data)}catch{return this._getInvalidInput(D)}if(this._getType(D)!==W.bigint)return this._getInvalidInput(D);let E=void 0,B=new h;for(let $ of this._def.checks)if($.kind==="min"){if($.inclusive?D.data<$.value:D.data<=$.value)E=this._getOrReturnCtx(D,E),H(E,{code:Y.too_small,type:"bigint",minimum:$.value,inclusive:$.inclusive,message:$.message}),B.dirty()}else if($.kind==="max"){if($.inclusive?D.data>$.value:D.data>=$.value)E=this._getOrReturnCtx(D,E),H(E,{code:Y.too_big,type:"bigint",maximum:$.value,inclusive:$.inclusive,message:$.message}),B.dirty()}else if($.kind==="multipleOf"){if(D.data%$.value!==BigInt(0))E=this._getOrReturnCtx(D,E),H(E,{code:Y.not_multiple_of,multipleOf:$.value,message:$.message}),B.dirty()}else I.assertNever($);return{status:B.value,value:D.data}}_getInvalidInput(D){let F=this._getOrReturnCtx(D);return H(F,{code:Y.invalid_type,expected:W.bigint,received:F.parsedType}),R}gte(D,F){return this.setLimit("min",D,!0,A.toString(F))}gt(D,F){return this.setLimit("min",D,!1,A.toString(F))}lte(D,F){return this.setLimit("max",D,!0,A.toString(F))}lt(D,F){return this.setLimit("max",D,!1,A.toString(F))}setLimit(D,F,E,B){return new OD({...this._def,checks:[...this._def.checks,{kind:D,value:F,inclusive:E,message:A.toString(B)}]})}_addCheck(D){return new OD({...this._def,checks:[...this._def.checks,D]})}positive(D){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:A.toString(D)})}negative(D){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:A.toString(D)})}nonpositive(D){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:A.toString(D)})}nonnegative(D){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:A.toString(D)})}multipleOf(D,F){return this._addCheck({kind:"multipleOf",value:D,message:A.toString(F)})}get minValue(){let D=null;for(let F of this._def.checks)if(F.kind==="min"){if(D===null||F.value>D)D=F.value}return D}get maxValue(){let D=null;for(let F of this._def.checks)if(F.kind==="max"){if(D===null||F.value<D)D=F.value}return D}};OD.create=(D)=>{return new OD({checks:[],typeName:u.ZodBigInt,coerce:D?.coerce??!1,...V(D)})};tD=class tD extends O{_parse(D){if(this._def.coerce)D.data=Boolean(D.data);if(this._getType(D)!==W.boolean){let E=this._getOrReturnCtx(D);return H(E,{code:Y.invalid_type,expected:W.boolean,received:E.parsedType}),R}return l(D.data)}};tD.create=(D)=>{return new tD({typeName:u.ZodBoolean,coerce:D?.coerce||!1,...V(D)})};yD=class yD extends O{_parse(D){if(this._def.coerce)D.data=new Date(D.data);if(this._getType(D)!==W.date){let $=this._getOrReturnCtx(D);return H($,{code:Y.invalid_type,expected:W.date,received:$.parsedType}),R}if(Number.isNaN(D.data.getTime())){let $=this._getOrReturnCtx(D);return H($,{code:Y.invalid_date}),R}let E=new h,B=void 0;for(let $ of this._def.checks)if($.kind==="min"){if(D.data.getTime()<$.value)B=this._getOrReturnCtx(D,B),H(B,{code:Y.too_small,message:$.message,inclusive:!0,exact:!1,minimum:$.value,type:"date"}),E.dirty()}else if($.kind==="max"){if(D.data.getTime()>$.value)B=this._getOrReturnCtx(D,B),H(B,{code:Y.too_big,message:$.message,inclusive:!0,exact:!1,maximum:$.value,type:"date"}),E.dirty()}else I.assertNever($);return{status:E.value,value:new Date(D.data.getTime())}}_addCheck(D){return new yD({...this._def,checks:[...this._def.checks,D]})}min(D,F){return this._addCheck({kind:"min",value:D.getTime(),message:A.toString(F)})}max(D,F){return this._addCheck({kind:"max",value:D.getTime(),message:A.toString(F)})}get minDate(){let D=null;for(let F of this._def.checks)if(F.kind==="min"){if(D===null||F.value>D)D=F.value}return D!=null?new Date(D):null}get maxDate(){let D=null;for(let F of this._def.checks)if(F.kind==="max"){if(D===null||F.value<D)D=F.value}return D!=null?new Date(D):null}};yD.create=(D)=>{return new yD({checks:[],coerce:D?.coerce||!1,typeName:u.ZodDate,...V(D)})};j2=class j2 extends O{_parse(D){if(this._getType(D)!==W.symbol){let E=this._getOrReturnCtx(D);return H(E,{code:Y.invalid_type,expected:W.symbol,received:E.parsedType}),R}return l(D.data)}};j2.create=(D)=>{return new j2({typeName:u.ZodSymbol,...V(D)})};eD=class eD extends O{_parse(D){if(this._getType(D)!==W.undefined){let E=this._getOrReturnCtx(D);return H(E,{code:Y.invalid_type,expected:W.undefined,received:E.parsedType}),R}return l(D.data)}};eD.create=(D)=>{return new eD({typeName:u.ZodUndefined,...V(D)})};D2=class D2 extends O{_parse(D){if(this._getType(D)!==W.null){let E=this._getOrReturnCtx(D);return H(E,{code:Y.invalid_type,expected:W.null,received:E.parsedType}),R}return l(D.data)}};D2.create=(D)=>{return new D2({typeName:u.ZodNull,...V(D)})};hD=class hD extends O{constructor(){super(...arguments);this._any=!0}_parse(D){return l(D.data)}};hD.create=(D)=>{return new hD({typeName:u.ZodAny,...V(D)})};ND=class ND extends O{constructor(){super(...arguments);this._unknown=!0}_parse(D){return l(D.data)}};ND.create=(D)=>{return new ND({typeName:u.ZodUnknown,...V(D)})};WD=class WD extends O{_parse(D){let F=this._getOrReturnCtx(D);return H(F,{code:Y.invalid_type,expected:W.never,received:F.parsedType}),R}};WD.create=(D)=>{return new WD({typeName:u.ZodNever,...V(D)})};U2=class U2 extends O{_parse(D){if(this._getType(D)!==W.undefined){let E=this._getOrReturnCtx(D);return H(E,{code:Y.invalid_type,expected:W.void,received:E.parsedType}),R}return l(D.data)}};U2.create=(D)=>{return new U2({typeName:u.ZodVoid,...V(D)})};qD=class qD extends O{_parse(D){let{ctx:F,status:E}=this._processInputParams(D),B=this._def;if(F.parsedType!==W.array)return H(F,{code:Y.invalid_type,expected:W.array,received:F.parsedType}),R;if(B.exactLength!==null){let q=F.data.length>B.exactLength.value,X=F.data.length<B.exactLength.value;if(q||X)H(F,{code:q?Y.too_big:Y.too_small,minimum:X?B.exactLength.value:void 0,maximum:q?B.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:B.exactLength.message}),E.dirty()}if(B.minLength!==null){if(F.data.length<B.minLength.value)H(F,{code:Y.too_small,minimum:B.minLength.value,type:"array",inclusive:!0,exact:!1,message:B.minLength.message}),E.dirty()}if(B.maxLength!==null){if(F.data.length>B.maxLength.value)H(F,{code:Y.too_big,maximum:B.maxLength.value,type:"array",inclusive:!0,exact:!1,message:B.maxLength.message}),E.dirty()}if(F.common.async)return Promise.all([...F.data].map((q,X)=>{return B.type._parseAsync(new QD(F,q,F.path,X))})).then((q)=>{return h.mergeArray(E,q)});let $=[...F.data].map((q,X)=>{return B.type._parseSync(new QD(F,q,F.path,X))});return h.mergeArray(E,$)}get element(){return this._def.type}min(D,F){return new qD({...this._def,minLength:{value:D,message:A.toString(F)}})}max(D,F){return new qD({...this._def,maxLength:{value:D,message:A.toString(F)}})}length(D,F){return new qD({...this._def,exactLength:{value:D,message:A.toString(F)}})}nonempty(D){return this.min(1,D)}};qD.create=(D,F)=>{return new qD({type:D,minLength:null,maxLength:null,exactLength:null,typeName:u.ZodArray,...V(F)})};Z=class Z extends O{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let D=this._def.shape(),F=I.objectKeys(D);return this._cached={shape:D,keys:F},this._cached}_parse(D){if(this._getType(D)!==W.object){let C=this._getOrReturnCtx(D);return H(C,{code:Y.invalid_type,expected:W.object,received:C.parsedType}),R}let{status:E,ctx:B}=this._processInputParams(D),{shape:$,keys:q}=this._getCached(),X=[];if(!(this._def.catchall instanceof WD&&this._def.unknownKeys==="strip")){for(let C in B.data)if(!q.includes(C))X.push(C)}let Q=[];for(let C of q){let J=$[C],_=B.data[C];Q.push({key:{status:"valid",value:C},value:J._parse(new QD(B,_,B.path,C)),alwaysSet:C in B.data})}if(this._def.catchall instanceof WD){let C=this._def.unknownKeys;if(C==="passthrough")for(let J of X)Q.push({key:{status:"valid",value:J},value:{status:"valid",value:B.data[J]}});else if(C==="strict"){if(X.length>0)H(B,{code:Y.unrecognized_keys,keys:X}),E.dirty()}else if(C==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let C=this._def.catchall;for(let J of X){let _=B.data[J];Q.push({key:{status:"valid",value:J},value:C._parse(new QD(B,_,B.path,J)),alwaysSet:J in B.data})}}if(B.common.async)return Promise.resolve().then(async()=>{let C=[];for(let J of Q){let _=await J.key,G=await J.value;C.push({key:_,value:G,alwaysSet:J.alwaysSet})}return C}).then((C)=>{return h.mergeObjectSync(E,C)});else return h.mergeObjectSync(E,Q)}get shape(){return this._def.shape()}strict(D){return A.errToObj,new Z({...this._def,unknownKeys:"strict",...D!==void 0?{errorMap:(F,E)=>{let B=this._def.errorMap?.(F,E).message??E.defaultError;if(F.code==="unrecognized_keys")return{message:A.errToObj(D).message??B};return{message:B}}}:{}})}strip(){return new Z({...this._def,unknownKeys:"strip"})}passthrough(){return new Z({...this._def,unknownKeys:"passthrough"})}extend(D){return new Z({...this._def,shape:()=>({...this._def.shape(),...D})})}merge(D){return new Z({unknownKeys:D._def.unknownKeys,catchall:D._def.catchall,shape:()=>({...this._def.shape(),...D._def.shape()}),typeName:u.ZodObject})}setKey(D,F){return this.augment({[D]:F})}catchall(D){return new Z({...this._def,catchall:D})}pick(D){let F={};for(let E of I.objectKeys(D))if(D[E]&&this.shape[E])F[E]=this.shape[E];return new Z({...this._def,shape:()=>F})}omit(D){let F={};for(let E of I.objectKeys(this.shape))if(!D[E])F[E]=this.shape[E];return new Z({...this._def,shape:()=>F})}deepPartial(){return oD(this)}partial(D){let F={};for(let E of I.objectKeys(this.shape)){let B=this.shape[E];if(D&&!D[E])F[E]=B;else F[E]=B.optional()}return new Z({...this._def,shape:()=>F})}required(D){let F={};for(let E of I.objectKeys(this.shape))if(D&&!D[E])F[E]=this.shape[E];else{let $=this.shape[E];while($ instanceof XD)$=$._def.innerType;F[E]=$}return new Z({...this._def,shape:()=>F})}keyof(){return H8(I.objectKeys(this.shape))}};Z.create=(D,F)=>{return new Z({shape:()=>D,unknownKeys:"strip",catchall:WD.create(),typeName:u.ZodObject,...V(F)})};Z.strictCreate=(D,F)=>{return new Z({shape:()=>D,unknownKeys:"strict",catchall:WD.create(),typeName:u.ZodObject,...V(F)})};Z.lazycreate=(D,F)=>{return new Z({shape:D,unknownKeys:"strip",catchall:WD.create(),typeName:u.ZodObject,...V(F)})};F2=class F2 extends O{_parse(D){let{ctx:F}=this._processInputParams(D),E=this._def.options;function B($){for(let X of $)if(X.result.status==="valid")return X.result;for(let X of $)if(X.result.status==="dirty")return F.common.issues.push(...X.ctx.common.issues),X.result;let q=$.map((X)=>new p(X.ctx.common.issues));return H(F,{code:Y.invalid_union,unionErrors:q}),R}if(F.common.async)return Promise.all(E.map(async($)=>{let q={...F,common:{...F.common,issues:[]},parent:null};return{result:await $._parseAsync({data:F.data,path:F.path,parent:q}),ctx:q}})).then(B);else{let $=void 0,q=[];for(let Q of E){let C={...F,common:{...F.common,issues:[]},parent:null},J=Q._parseSync({data:F.data,path:F.path,parent:C});if(J.status==="valid")return J;else if(J.status==="dirty"&&!$)$={result:J,ctx:C};if(C.common.issues.length)q.push(C.common.issues)}if($)return F.common.issues.push(...$.ctx.common.issues),$.result;let X=q.map((Q)=>new p(Q));return H(F,{code:Y.invalid_union,unionErrors:X}),R}}get options(){return this._def.options}};F2.create=(D,F)=>{return new F2({options:D,typeName:u.ZodUnion,...V(F)})};h2=class h2 extends O{_parse(D){let{ctx:F}=this._processInputParams(D);if(F.parsedType!==W.object)return H(F,{code:Y.invalid_type,expected:W.object,received:F.parsedType}),R;let E=this.discriminator,B=F.data[E],$=this.optionsMap.get(B);if(!$)return H(F,{code:Y.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[E]}),R;if(F.common.async)return $._parseAsync({data:F.data,path:F.path,parent:F});else return $._parseSync({data:F.data,path:F.path,parent:F})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(D,F,E){let B=new Map;for(let $ of F){let q=zD($.shape[D]);if(!q.length)throw Error(`A discriminator value for key \`${D}\` could not be extracted from all schema options`);for(let X of q){if(B.has(X))throw Error(`Discriminator property ${String(D)} has duplicate value ${String(X)}`);B.set(X,$)}}return new h2({typeName:u.ZodDiscriminatedUnion,discriminator:D,options:F,optionsMap:B,...V(E)})}};E2=class E2 extends O{_parse(D){let{status:F,ctx:E}=this._processInputParams(D),B=($,q)=>{if(x2($)||x2(q))return R;let X=v0($.value,q.value);if(!X.valid)return H(E,{code:Y.invalid_intersection_types}),R;if(y2($)||y2(q))F.dirty();return{status:F.value,value:X.data}};if(E.common.async)return Promise.all([this._def.left._parseAsync({data:E.data,path:E.path,parent:E}),this._def.right._parseAsync({data:E.data,path:E.path,parent:E})]).then(([$,q])=>B($,q));else return B(this._def.left._parseSync({data:E.data,path:E.path,parent:E}),this._def.right._parseSync({data:E.data,path:E.path,parent:E}))}};E2.create=(D,F,E)=>{return new E2({left:D,right:F,typeName:u.ZodIntersection,...V(E)})};GD=class GD extends O{_parse(D){let{status:F,ctx:E}=this._processInputParams(D);if(E.parsedType!==W.array)return H(E,{code:Y.invalid_type,expected:W.array,received:E.parsedType}),R;if(E.data.length<this._def.items.length)return H(E,{code:Y.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),R;if(!this._def.rest&&E.data.length>this._def.items.length)H(E,{code:Y.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),F.dirty();let $=[...E.data].map((q,X)=>{let Q=this._def.items[X]||this._def.rest;if(!Q)return null;return Q._parse(new QD(E,q,E.path,X))}).filter((q)=>!!q);if(E.common.async)return Promise.all($).then((q)=>{return h.mergeArray(F,q)});else return h.mergeArray(F,$)}get items(){return this._def.items}rest(D){return new GD({...this._def,rest:D})}};GD.create=(D,F)=>{if(!Array.isArray(D))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new GD({items:D,typeName:u.ZodTuple,rest:null,...V(F)})};L2=class L2 extends O{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(D){let{status:F,ctx:E}=this._processInputParams(D);if(E.parsedType!==W.object)return H(E,{code:Y.invalid_type,expected:W.object,received:E.parsedType}),R;let B=[],$=this._def.keyType,q=this._def.valueType;for(let X in E.data)B.push({key:$._parse(new QD(E,X,E.path,X)),value:q._parse(new QD(E,E.data[X],E.path,X)),alwaysSet:X in E.data});if(E.common.async)return h.mergeObjectAsync(F,B);else return h.mergeObjectSync(F,B)}get element(){return this._def.valueType}static create(D,F,E){if(F instanceof O)return new L2({keyType:D,valueType:F,typeName:u.ZodRecord,...V(E)});return new L2({keyType:$D.create(),valueType:D,typeName:u.ZodRecord,...V(F)})}};V2=class V2 extends O{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(D){let{status:F,ctx:E}=this._processInputParams(D);if(E.parsedType!==W.map)return H(E,{code:Y.invalid_type,expected:W.map,received:E.parsedType}),R;let B=this._def.keyType,$=this._def.valueType,q=[...E.data.entries()].map(([X,Q],C)=>{return{key:B._parse(new QD(E,X,E.path,[C,"key"])),value:$._parse(new QD(E,Q,E.path,[C,"value"]))}});if(E.common.async){let X=new Map;return Promise.resolve().then(async()=>{for(let Q of q){let C=await Q.key,J=await Q.value;if(C.status==="aborted"||J.status==="aborted")return R;if(C.status==="dirty"||J.status==="dirty")F.dirty();X.set(C.value,J.value)}return{status:F.value,value:X}})}else{let X=new Map;for(let Q of q){let{key:C,value:J}=Q;if(C.status==="aborted"||J.status==="aborted")return R;if(C.status==="dirty"||J.status==="dirty")F.dirty();X.set(C.value,J.value)}return{status:F.value,value:X}}}};V2.create=(D,F,E)=>{return new V2({valueType:F,keyType:D,typeName:u.ZodMap,...V(E)})};gD=class gD extends O{_parse(D){let{status:F,ctx:E}=this._processInputParams(D);if(E.parsedType!==W.set)return H(E,{code:Y.invalid_type,expected:W.set,received:E.parsedType}),R;let B=this._def;if(B.minSize!==null){if(E.data.size<B.minSize.value)H(E,{code:Y.too_small,minimum:B.minSize.value,type:"set",inclusive:!0,exact:!1,message:B.minSize.message}),F.dirty()}if(B.maxSize!==null){if(E.data.size>B.maxSize.value)H(E,{code:Y.too_big,maximum:B.maxSize.value,type:"set",inclusive:!0,exact:!1,message:B.maxSize.message}),F.dirty()}let $=this._def.valueType;function q(Q){let C=new Set;for(let J of Q){if(J.status==="aborted")return R;if(J.status==="dirty")F.dirty();C.add(J.value)}return{status:F.value,value:C}}let X=[...E.data.values()].map((Q,C)=>$._parse(new QD(E,Q,E.path,C)));if(E.common.async)return Promise.all(X).then((Q)=>q(Q));else return q(X)}min(D,F){return new gD({...this._def,minSize:{value:D,message:A.toString(F)}})}max(D,F){return new gD({...this._def,maxSize:{value:D,message:A.toString(F)}})}size(D,F){return this.min(D,F).max(D,F)}nonempty(D){return this.min(1,D)}};gD.create=(D,F)=>{return new gD({valueType:D,minSize:null,maxSize:null,typeName:u.ZodSet,...V(F)})};sD=class sD extends O{constructor(){super(...arguments);this.validate=this.implement}_parse(D){let{ctx:F}=this._processInputParams(D);if(F.parsedType!==W.function)return H(F,{code:Y.invalid_type,expected:W.function,received:F.parsedType}),R;function E(X,Q){return u2({data:X,path:F.path,errorMaps:[F.common.contextualErrorMap,F.schemaErrorMap,rD(),RD].filter((C)=>!!C),issueData:{code:Y.invalid_arguments,argumentsError:Q}})}function B(X,Q){return u2({data:X,path:F.path,errorMaps:[F.common.contextualErrorMap,F.schemaErrorMap,rD(),RD].filter((C)=>!!C),issueData:{code:Y.invalid_return_type,returnTypeError:Q}})}let $={errorMap:F.common.contextualErrorMap},q=F.data;if(this._def.returns instanceof mD){let X=this;return l(async function(...Q){let C=new p([]),J=await X._def.args.parseAsync(Q,$).catch((j)=>{throw C.addIssue(E(Q,j)),C}),_=await Reflect.apply(q,this,J);return await X._def.returns._def.type.parseAsync(_,$).catch((j)=>{throw C.addIssue(B(_,j)),C})})}else{let X=this;return l(function(...Q){let C=X._def.args.safeParse(Q,$);if(!C.success)throw new p([E(Q,C.error)]);let J=Reflect.apply(q,this,C.data),_=X._def.returns.safeParse(J,$);if(!_.success)throw new p([B(J,_.error)]);return _.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...D){return new sD({...this._def,args:GD.create(D).rest(ND.create())})}returns(D){return new sD({...this._def,returns:D})}implement(D){return this.parse(D)}strictImplement(D){return this.parse(D)}static create(D,F,E){return new sD({args:D?D:GD.create([]).rest(ND.create()),returns:F||ND.create(),typeName:u.ZodFunction,...V(E)})}};B2=class B2 extends O{get schema(){return this._def.getter()}_parse(D){let{ctx:F}=this._processInputParams(D);return this._def.getter()._parse({data:F.data,path:F.path,parent:F})}};B2.create=(D,F)=>{return new B2({getter:D,typeName:u.ZodLazy,...V(F)})};$2=class $2 extends O{_parse(D){if(D.data!==this._def.value){let F=this._getOrReturnCtx(D);return H(F,{received:F.data,code:Y.invalid_literal,expected:this._def.value}),R}return{status:"valid",value:D.data}}get value(){return this._def.value}};$2.create=(D,F)=>{return new $2({value:D,typeName:u.ZodLiteral,...V(F)})};wD=class wD extends O{_parse(D){if(typeof D.data!=="string"){let F=this._getOrReturnCtx(D),E=this._def.values;return H(F,{expected:I.joinValues(E),received:F.parsedType,code:Y.invalid_type}),R}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(D.data)){let F=this._getOrReturnCtx(D),E=this._def.values;return H(F,{received:F.data,code:Y.invalid_enum_value,options:E}),R}return l(D.data)}get options(){return this._def.values}get enum(){let D={};for(let F of this._def.values)D[F]=F;return D}get Values(){let D={};for(let F of this._def.values)D[F]=F;return D}get Enum(){let D={};for(let F of this._def.values)D[F]=F;return D}extract(D,F=this._def){return wD.create(D,{...this._def,...F})}exclude(D,F=this._def){return wD.create(this.options.filter((E)=>!D.includes(E)),{...this._def,...F})}};wD.create=H8;q2=class q2 extends O{_parse(D){let F=I.getValidEnumValues(this._def.values),E=this._getOrReturnCtx(D);if(E.parsedType!==W.string&&E.parsedType!==W.number){let B=I.objectValues(F);return H(E,{expected:I.joinValues(B),received:E.parsedType,code:Y.invalid_type}),R}if(!this._cache)this._cache=new Set(I.getValidEnumValues(this._def.values));if(!this._cache.has(D.data)){let B=I.objectValues(F);return H(E,{received:E.data,code:Y.invalid_enum_value,options:B}),R}return l(D.data)}get enum(){return this._def.values}};q2.create=(D,F)=>{return new q2({values:D,typeName:u.ZodNativeEnum,...V(F)})};mD=class mD extends O{unwrap(){return this._def.type}_parse(D){let{ctx:F}=this._processInputParams(D);if(F.parsedType!==W.promise&&F.common.async===!1)return H(F,{code:Y.invalid_type,expected:W.promise,received:F.parsedType}),R;let E=F.parsedType===W.promise?F.data:Promise.resolve(F.data);return l(E.then((B)=>{return this._def.type.parseAsync(B,{path:F.path,errorMap:F.common.contextualErrorMap})}))}};mD.create=(D,F)=>{return new mD({type:D,typeName:u.ZodPromise,...V(F)})};CD=class CD extends O{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===u.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(D){let{status:F,ctx:E}=this._processInputParams(D),B=this._def.effect||null,$={addIssue:(q)=>{if(H(E,q),q.fatal)F.abort();else F.dirty()},get path(){return E.path}};if($.addIssue=$.addIssue.bind($),B.type==="preprocess"){let q=B.transform(E.data,$);if(E.common.async)return Promise.resolve(q).then(async(X)=>{if(F.value==="aborted")return R;let Q=await this._def.schema._parseAsync({data:X,path:E.path,parent:E});if(Q.status==="aborted")return R;if(Q.status==="dirty")return xD(Q.value);if(F.value==="dirty")return xD(Q.value);return Q});else{if(F.value==="aborted")return R;let X=this._def.schema._parseSync({data:q,path:E.path,parent:E});if(X.status==="aborted")return R;if(X.status==="dirty")return xD(X.value);if(F.value==="dirty")return xD(X.value);return X}}if(B.type==="refinement"){let q=(X)=>{let Q=B.refinement(X,$);if(E.common.async)return Promise.resolve(Q);if(Q instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return X};if(E.common.async===!1){let X=this._def.schema._parseSync({data:E.data,path:E.path,parent:E});if(X.status==="aborted")return R;if(X.status==="dirty")F.dirty();return q(X.value),{status:F.value,value:X.value}}else return this._def.schema._parseAsync({data:E.data,path:E.path,parent:E}).then((X)=>{if(X.status==="aborted")return R;if(X.status==="dirty")F.dirty();return q(X.value).then(()=>{return{status:F.value,value:X.value}})})}if(B.type==="transform")if(E.common.async===!1){let q=this._def.schema._parseSync({data:E.data,path:E.path,parent:E});if(!VD(q))return R;let X=B.transform(q.value,$);if(X instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:F.value,value:X}}else return this._def.schema._parseAsync({data:E.data,path:E.path,parent:E}).then((q)=>{if(!VD(q))return R;return Promise.resolve(B.transform(q.value,$)).then((X)=>({status:F.value,value:X}))});I.assertNever(B)}};CD.create=(D,F,E)=>{return new CD({schema:D,typeName:u.ZodEffects,effect:F,...V(E)})};CD.createWithPreprocess=(D,F,E)=>{return new CD({schema:F,effect:{type:"preprocess",transform:D},typeName:u.ZodEffects,...V(E)})};XD=class XD extends O{_parse(D){if(this._getType(D)===W.undefined)return l(void 0);return this._def.innerType._parse(D)}unwrap(){return this._def.innerType}};XD.create=(D,F)=>{return new XD({innerType:D,typeName:u.ZodOptional,...V(F)})};uD=class uD extends O{_parse(D){if(this._getType(D)===W.null)return l(null);return this._def.innerType._parse(D)}unwrap(){return this._def.innerType}};uD.create=(D,F)=>{return new uD({innerType:D,typeName:u.ZodNullable,...V(F)})};X2=class X2 extends O{_parse(D){let{ctx:F}=this._processInputParams(D),E=F.data;if(F.parsedType===W.undefined)E=this._def.defaultValue();return this._def.innerType._parse({data:E,path:F.path,parent:F})}removeDefault(){return this._def.innerType}};X2.create=(D,F)=>{return new X2({innerType:D,typeName:u.ZodDefault,defaultValue:typeof F.default==="function"?F.default:()=>F.default,...V(F)})};Q2=class Q2 extends O{_parse(D){let{ctx:F}=this._processInputParams(D),E={...F,common:{...F.common,issues:[]}},B=this._def.innerType._parse({data:E.data,path:E.path,parent:{...E}});if(aD(B))return B.then(($)=>{return{status:"valid",value:$.status==="valid"?$.value:this._def.catchValue({get error(){return new p(E.common.issues)},input:E.data})}});else return{status:"valid",value:B.status==="valid"?B.value:this._def.catchValue({get error(){return new p(E.common.issues)},input:E.data})}}removeCatch(){return this._def.innerType}};Q2.create=(D,F)=>{return new Q2({innerType:D,typeName:u.ZodCatch,catchValue:typeof F.catch==="function"?F.catch:()=>F.catch,...V(F)})};N2=class N2 extends O{_parse(D){if(this._getType(D)!==W.nan){let E=this._getOrReturnCtx(D);return H(E,{code:Y.invalid_type,expected:W.nan,received:E.parsedType}),R}return{status:"valid",value:D.data}}};N2.create=(D)=>{return new N2({typeName:u.ZodNaN,...V(D)})};E1=Symbol("zod_brand");g2=class g2 extends O{_parse(D){let{ctx:F}=this._processInputParams(D),E=F.data;return this._def.type._parse({data:E,path:F.path,parent:F})}unwrap(){return this._def.type}};K2=class K2 extends O{_parse(D){let{status:F,ctx:E}=this._processInputParams(D);if(E.common.async)return(async()=>{let $=await this._def.in._parseAsync({data:E.data,path:E.path,parent:E});if($.status==="aborted")return R;if($.status==="dirty")return F.dirty(),xD($.value);else return this._def.out._parseAsync({data:$.value,path:E.path,parent:E})})();else{let B=this._def.in._parseSync({data:E.data,path:E.path,parent:E});if(B.status==="aborted")return R;if(B.status==="dirty")return F.dirty(),{status:"dirty",value:B.value};else return this._def.out._parseSync({data:B.value,path:E.path,parent:E})}}static create(D,F){return new K2({in:D,out:F,typeName:u.ZodPipeline})}};C2=class C2 extends O{_parse(D){let F=this._def.innerType._parse(D),E=(B)=>{if(VD(B))B.value=Object.freeze(B.value);return B};return aD(F)?F.then((B)=>E(B)):E(F)}unwrap(){return this._def.innerType}};C2.create=(D,F)=>{return new C2({innerType:D,typeName:u.ZodReadonly,...V(F)})};B1={object:Z.lazycreate};(function(D){D.ZodString="ZodString",D.ZodNumber="ZodNumber",D.ZodNaN="ZodNaN",D.ZodBigInt="ZodBigInt",D.ZodBoolean="ZodBoolean",D.ZodDate="ZodDate",D.ZodSymbol="ZodSymbol",D.ZodUndefined="ZodUndefined",D.ZodNull="ZodNull",D.ZodAny="ZodAny",D.ZodUnknown="ZodUnknown",D.ZodNever="ZodNever",D.ZodVoid="ZodVoid",D.ZodArray="ZodArray",D.ZodObject="ZodObject",D.ZodUnion="ZodUnion",D.ZodDiscriminatedUnion="ZodDiscriminatedUnion",D.ZodIntersection="ZodIntersection",D.ZodTuple="ZodTuple",D.ZodRecord="ZodRecord",D.ZodMap="ZodMap",D.ZodSet="ZodSet",D.ZodFunction="ZodFunction",D.ZodLazy="ZodLazy",D.ZodLiteral="ZodLiteral",D.ZodEnum="ZodEnum",D.ZodEffects="ZodEffects",D.ZodNativeEnum="ZodNativeEnum",D.ZodOptional="ZodOptional",D.ZodNullable="ZodNullable",D.ZodDefault="ZodDefault",D.ZodCatch="ZodCatch",D.ZodPromise="ZodPromise",D.ZodBranded="ZodBranded",D.ZodPipeline="ZodPipeline",D.ZodReadonly="ZodReadonly"})(u||(u={}));A8=$D.create,R8=KD.create,q1=N2.create,X1=OD.create,z8=tD.create,Q1=yD.create,C1=j2.create,J1=eD.create,_1=D2.create,Y1=hD.create,W1=ND.create,G1=WD.create,H1=U2.create,M1=qD.create,A1=Z.create,R1=Z.strictCreate,z1=F2.create,u1=h2.create,j1=E2.create,U1=GD.create,L1=L2.create,V1=V2.create,N1=gD.create,K1=sD.create,O1=B2.create,w1=$2.create,S1=wD.create,I1=q2.create,P1=mD.create,T1=CD.create,b1=XD.create,k1=uD.create,f1=CD.createWithPreprocess,v1=K2.create,h1={string:(D)=>$D.create({...D,coerce:!0}),number:(D)=>KD.create({...D,coerce:!0}),boolean:(D)=>tD.create({...D,coerce:!0}),bigint:(D)=>OD.create({...D,coerce:!0}),date:(D)=>yD.create({...D,coerce:!0})},g1=R});var o={};r8(o,{void:()=>H1,util:()=>I,unknown:()=>W1,union:()=>z1,undefined:()=>J1,tuple:()=>U1,transformer:()=>T1,symbol:()=>C1,string:()=>A8,strictObject:()=>R1,setErrorMap:()=>k6,set:()=>N1,record:()=>L1,quotelessJson:()=>T6,promise:()=>P1,preprocess:()=>f1,pipeline:()=>v1,ostring:()=>Z1,optional:()=>b1,onumber:()=>x1,oboolean:()=>y1,objectUtil:()=>T0,object:()=>A1,number:()=>R8,nullable:()=>k1,null:()=>_1,never:()=>G1,nativeEnum:()=>I1,nan:()=>q1,map:()=>V1,makeIssue:()=>u2,literal:()=>w1,lazy:()=>O1,late:()=>B1,isValid:()=>VD,isDirty:()=>y2,isAsync:()=>aD,isAborted:()=>x2,intersection:()=>j1,instanceof:()=>$1,getParsedType:()=>YD,getErrorMap:()=>rD,function:()=>K1,enum:()=>S1,effect:()=>T1,discriminatedUnion:()=>u1,defaultErrorMap:()=>RD,datetimeRegex:()=>G8,date:()=>Q1,custom:()=>M8,coerce:()=>h1,boolean:()=>z8,bigint:()=>X1,array:()=>M1,any:()=>Y1,addIssueToContext:()=>H,ZodVoid:()=>U2,ZodUnknown:()=>ND,ZodUnion:()=>F2,ZodUndefined:()=>eD,ZodType:()=>O,ZodTuple:()=>GD,ZodTransformer:()=>CD,ZodSymbol:()=>j2,ZodString:()=>$D,ZodSet:()=>gD,ZodSchema:()=>O,ZodRecord:()=>L2,ZodReadonly:()=>C2,ZodPromise:()=>mD,ZodPipeline:()=>K2,ZodParsedType:()=>W,ZodOptional:()=>XD,ZodObject:()=>Z,ZodNumber:()=>KD,ZodNullable:()=>uD,ZodNull:()=>D2,ZodNever:()=>WD,ZodNativeEnum:()=>q2,ZodNaN:()=>N2,ZodMap:()=>V2,ZodLiteral:()=>$2,ZodLazy:()=>B2,ZodIssueCode:()=>Y,ZodIntersection:()=>E2,ZodFunction:()=>sD,ZodFirstPartyTypeKind:()=>u,ZodError:()=>p,ZodEnum:()=>wD,ZodEffects:()=>CD,ZodDiscriminatedUnion:()=>h2,ZodDefault:()=>X2,ZodDate:()=>yD,ZodCatch:()=>Q2,ZodBranded:()=>g2,ZodBoolean:()=>tD,ZodBigInt:()=>OD,ZodArray:()=>qD,ZodAny:()=>hD,Schema:()=>O,ParseStatus:()=>h,OK:()=>l,NEVER:()=>g1,INVALID:()=>R,EMPTY_PATH:()=>f6,DIRTY:()=>xD,BRAND:()=>E1});var Z0=JD(()=>{Z2();k0();Q8();z2();u8();v2()});var j8=JD(()=>{Z0();Z0()});var B3=jD(E3(),1),{program:X5,createCommand:Q5,createArgument:C5,createOption:J5,CommanderError:_5,InvalidArgumentError:Y5,InvalidOptionArgumentError:W5,Command:$3,Argument:G5,Option:H5,Help:M5}=B3.default;var q3="3.260227.1";var AD=(D,F=[])=>D.name==="up"||F.includes("vim")&&D.name==="k"||F.includes("emacs")&&D.ctrl&&D.name==="p",ID=(D,F=[])=>D.name==="down"||F.includes("vim")&&D.name==="j"||F.includes("emacs")&&D.ctrl&&D.name==="n";var _2=(D)=>D.name==="backspace",PD=(D)=>D.name==="tab",B0=(D)=>"1234567890".includes(D.name),e=(D)=>D.name==="enter"||D.name==="return";class $0 extends Error{name="AbortPromptError";message="Prompt was aborted";constructor(D){super();this.cause=D?.cause}}class q0 extends Error{name="CancelPromptError";message="Prompt was canceled"}class S2 extends Error{name="ExitPromptError"}class X0 extends Error{name="HookError"}class Y2 extends Error{name="ValidationError"}import{AsyncResource as gF}from"async_hooks";import{AsyncLocalStorage as xF,AsyncResource as yF}from"async_hooks";var X3=new xF;function hF(D){return{rl:D,hooks:[],hooksCleanup:[],hooksEffect:[],index:0,handleChange(){}}}function Q3(D,F){let E=hF(D);return X3.run(E,()=>{function B($){E.handleChange=()=>{E.index=0,$()},E.handleChange()}return F(B)})}function TD(){let D=X3.getStore();if(!D)throw new X0("[Inquirer] Hook functions can only be called from within a prompt");return D}function Q0(){return TD().rl}function C0(D){let F=(...E)=>{let B=TD(),$=!1,q=B.handleChange;B.handleChange=()=>{$=!0};let X=D(...E);if($)q();return B.handleChange=q,X};return yF.bind(F)}function lD(D){let F=TD(),{index:E}=F,B={get(){return F.hooks[E]},set(q){F.hooks[E]=q},initialized:E in F.hooks},$=D(B);return F.index++,$}function C3(){TD().handleChange()}var bD={queue(D){let F=TD(),{index:E}=F;F.hooksEffect.push(()=>{F.hooksCleanup[E]?.();let B=D(Q0());if(B!=null&&typeof B!=="function")throw new Y2("useEffect return value must be a cleanup function or nothing.");F.hooksCleanup[E]=B})},run(){let D=TD();C0(()=>{D.hooksEffect.forEach((F)=>{F()}),D.hooksEffect.length=0})()},clearAll(){let D=TD();D.hooksCleanup.forEach((F)=>{F?.()}),D.hooksEffect.length=0,D.hooksCleanup.length=0}};function k(D){return lD((F)=>{let E=gF.bind(function(q){if(F.get()!==q)F.set(q),C3()});if(F.initialized)return[F.get(),E];let B=typeof D==="function"?D():D;return F.set(B),[B,E]})}function DD(D,F){lD((E)=>{let B=E.get();if(!Array.isArray(B)||F.some((q,X)=>!Object.is(q,B[X])))bD.queue(D);E.set(F)})}var r=jD(W2(),1);import _D from"process";function pF(){if(_D.platform!=="win32")return _D.env.TERM!=="linux";return Boolean(_D.env.WT_SESSION)||Boolean(_D.env.TERMINUS_SUBLIME)||_D.env.ConEmuTask==="{cmd::Cmder}"||_D.env.TERM_PROGRAM==="Terminus-Sublime"||_D.env.TERM_PROGRAM==="vscode"||_D.env.TERM==="xterm-256color"||_D.env.TERM==="alacritty"||_D.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var _3={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"\u2588",squareDarkShade:"\u2593",squareMediumShade:"\u2592",squareLightShade:"\u2591",squareTop:"\u2580",squareBottom:"\u2584",squareLeft:"\u258C",squareRight:"\u2590",squareCenter:"\u25A0",bullet:"\u25CF",dot:"\u2024",ellipsis:"\u2026",pointerSmall:"\u203A",triangleUp:"\u25B2",triangleUpSmall:"\u25B4",triangleDown:"\u25BC",triangleDownSmall:"\u25BE",triangleLeftSmall:"\u25C2",triangleRightSmall:"\u25B8",home:"\u2302",heart:"\u2665",musicNote:"\u266A",musicNoteBeamed:"\u266B",arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",arrowLeftRight:"\u2194",arrowUpDown:"\u2195",almostEqual:"\u2248",notEqual:"\u2260",lessOrEqual:"\u2264",greaterOrEqual:"\u2265",identical:"\u2261",infinity:"\u221E",subscriptZero:"\u2080",subscriptOne:"\u2081",subscriptTwo:"\u2082",subscriptThree:"\u2083",subscriptFour:"\u2084",subscriptFive:"\u2085",subscriptSix:"\u2086",subscriptSeven:"\u2087",subscriptEight:"\u2088",subscriptNine:"\u2089",oneHalf:"\xBD",oneThird:"\u2153",oneQuarter:"\xBC",oneFifth:"\u2155",oneSixth:"\u2159",oneEighth:"\u215B",twoThirds:"\u2154",twoFifths:"\u2156",threeQuarters:"\xBE",threeFifths:"\u2157",threeEighths:"\u215C",fourFifths:"\u2158",fiveSixths:"\u215A",fiveEighths:"\u215D",sevenEighths:"\u215E",line:"\u2500",lineBold:"\u2501",lineDouble:"\u2550",lineDashed0:"\u2504",lineDashed1:"\u2505",lineDashed2:"\u2508",lineDashed3:"\u2509",lineDashed4:"\u254C",lineDashed5:"\u254D",lineDashed6:"\u2574",lineDashed7:"\u2576",lineDashed8:"\u2578",lineDashed9:"\u257A",lineDashed10:"\u257C",lineDashed11:"\u257E",lineDashed12:"\u2212",lineDashed13:"\u2013",lineDashed14:"\u2010",lineDashed15:"\u2043",lineVertical:"\u2502",lineVerticalBold:"\u2503",lineVerticalDouble:"\u2551",lineVerticalDashed0:"\u2506",lineVerticalDashed1:"\u2507",lineVerticalDashed2:"\u250A",lineVerticalDashed3:"\u250B",lineVerticalDashed4:"\u254E",lineVerticalDashed5:"\u254F",lineVerticalDashed6:"\u2575",lineVerticalDashed7:"\u2577",lineVerticalDashed8:"\u2579",lineVerticalDashed9:"\u257B",lineVerticalDashed10:"\u257D",lineVerticalDashed11:"\u257F",lineDownLeft:"\u2510",lineDownLeftArc:"\u256E",lineDownBoldLeftBold:"\u2513",lineDownBoldLeft:"\u2512",lineDownLeftBold:"\u2511",lineDownDoubleLeftDouble:"\u2557",lineDownDoubleLeft:"\u2556",lineDownLeftDouble:"\u2555",lineDownRight:"\u250C",lineDownRightArc:"\u256D",lineDownBoldRightBold:"\u250F",lineDownBoldRight:"\u250E",lineDownRightBold:"\u250D",lineDownDoubleRightDouble:"\u2554",lineDownDoubleRight:"\u2553",lineDownRightDouble:"\u2552",lineUpLeft:"\u2518",lineUpLeftArc:"\u256F",lineUpBoldLeftBold:"\u251B",lineUpBoldLeft:"\u251A",lineUpLeftBold:"\u2519",lineUpDoubleLeftDouble:"\u255D",lineUpDoubleLeft:"\u255C",lineUpLeftDouble:"\u255B",lineUpRight:"\u2514",lineUpRightArc:"\u2570",lineUpBoldRightBold:"\u2517",lineUpBoldRight:"\u2516",lineUpRightBold:"\u2515",lineUpDoubleRightDouble:"\u255A",lineUpDoubleRight:"\u2559",lineUpRightDouble:"\u2558",lineUpDownLeft:"\u2524",lineUpBoldDownBoldLeftBold:"\u252B",lineUpBoldDownBoldLeft:"\u2528",lineUpDownLeftBold:"\u2525",lineUpBoldDownLeftBold:"\u2529",lineUpDownBoldLeftBold:"\u252A",lineUpDownBoldLeft:"\u2527",lineUpBoldDownLeft:"\u2526",lineUpDoubleDownDoubleLeftDouble:"\u2563",lineUpDoubleDownDoubleLeft:"\u2562",lineUpDownLeftDouble:"\u2561",lineUpDownRight:"\u251C",lineUpBoldDownBoldRightBold:"\u2523",lineUpBoldDownBoldRight:"\u2520",lineUpDownRightBold:"\u251D",lineUpBoldDownRightBold:"\u2521",lineUpDownBoldRightBold:"\u2522",lineUpDownBoldRight:"\u251F",lineUpBoldDownRight:"\u251E",lineUpDoubleDownDoubleRightDouble:"\u2560",lineUpDoubleDownDoubleRight:"\u255F",lineUpDownRightDouble:"\u255E",lineDownLeftRight:"\u252C",lineDownBoldLeftBoldRightBold:"\u2533",lineDownLeftBoldRightBold:"\u252F",lineDownBoldLeftRight:"\u2530",lineDownBoldLeftBoldRight:"\u2531",lineDownBoldLeftRightBold:"\u2532",lineDownLeftRightBold:"\u252E",lineDownLeftBoldRight:"\u252D",lineDownDoubleLeftDoubleRightDouble:"\u2566",lineDownDoubleLeftRight:"\u2565",lineDownLeftDoubleRightDouble:"\u2564",lineUpLeftRight:"\u2534",lineUpBoldLeftBoldRightBold:"\u253B",lineUpLeftBoldRightBold:"\u2537",lineUpBoldLeftRight:"\u2538",lineUpBoldLeftBoldRight:"\u2539",lineUpBoldLeftRightBold:"\u253A",lineUpLeftRightBold:"\u2536",lineUpLeftBoldRight:"\u2535",lineUpDoubleLeftDoubleRightDouble:"\u2569",lineUpDoubleLeftRight:"\u2568",lineUpLeftDoubleRightDouble:"\u2567",lineUpDownLeftRight:"\u253C",lineUpBoldDownBoldLeftBoldRightBold:"\u254B",lineUpDownBoldLeftBoldRightBold:"\u2548",lineUpBoldDownLeftBoldRightBold:"\u2547",lineUpBoldDownBoldLeftRightBold:"\u254A",lineUpBoldDownBoldLeftBoldRight:"\u2549",lineUpBoldDownLeftRight:"\u2540",lineUpDownBoldLeftRight:"\u2541",lineUpDownLeftBoldRight:"\u253D",lineUpDownLeftRightBold:"\u253E",lineUpBoldDownBoldLeftRight:"\u2542",lineUpDownLeftBoldRightBold:"\u253F",lineUpBoldDownLeftBoldRight:"\u2543",lineUpBoldDownLeftRightBold:"\u2544",lineUpDownBoldLeftBoldRight:"\u2545",lineUpDownBoldLeftRightBold:"\u2546",lineUpDoubleDownDoubleLeftDoubleRightDouble:"\u256C",lineUpDoubleDownDoubleLeftRight:"\u256B",lineUpDownLeftDoubleRightDouble:"\u256A",lineCross:"\u2573",lineBackslash:"\u2572",lineSlash:"\u2571"},Y3={tick:"\u2714",info:"\u2139",warning:"\u26A0",cross:"\u2718",squareSmall:"\u25FB",squareSmallFilled:"\u25FC",circle:"\u25EF",circleFilled:"\u25C9",circleDotted:"\u25CC",circleDouble:"\u25CE",circleCircle:"\u24DE",circleCross:"\u24E7",circlePipe:"\u24BE",radioOn:"\u25C9",radioOff:"\u25EF",checkboxOn:"\u2612",checkboxOff:"\u2610",checkboxCircleOn:"\u24E7",checkboxCircleOff:"\u24BE",pointer:"\u276F",triangleUpOutline:"\u25B3",triangleLeft:"\u25C0",triangleRight:"\u25B6",lozenge:"\u25C6",lozengeOutline:"\u25C7",hamburger:"\u2630",smiley:"\u32E1",mustache:"\u0DF4",star:"\u2605",play:"\u25B6",nodejs:"\u2B22",oneSeventh:"\u2150",oneNinth:"\u2151",oneTenth:"\u2152"},dF={tick:"\u221A",info:"i",warning:"\u203C",cross:"\xD7",squareSmall:"\u25A1",squareSmallFilled:"\u25A0",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(\u25CB)",circleCross:"(\xD7)",circlePipe:"(\u2502)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[\xD7]",checkboxOff:"[ ]",checkboxCircleOn:"(\xD7)",checkboxCircleOff:"( )",pointer:">",triangleUpOutline:"\u2206",triangleLeft:"\u25C4",triangleRight:"\u25BA",lozenge:"\u2666",lozengeOutline:"\u25CA",hamburger:"\u2261",smiley:"\u263A",mustache:"\u250C\u2500\u2510",star:"\u2736",play:"\u25BA",nodejs:"\u2666",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"},cF={..._3,...Y3},nF={..._3,...dF},iF=pF(),rF=iF?cF:nF,LD=rF,P5=Object.entries(Y3);var W3={prefix:{idle:r.default.blue("?"),done:r.default.green(LD.tick)},spinner:{interval:80,frames:["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"].map((D)=>r.default.yellow(D))},style:{answer:r.default.cyan,message:r.default.bold,error:(D)=>r.default.red(`> ${D}`),defaultAnswer:(D)=>r.default.dim(`(${D})`),help:r.default.dim,highlight:r.default.cyan,key:(D)=>r.default.cyan(r.default.bold(`<${D}>`))}};function G3(D){if(typeof D!=="object"||D===null)return!1;let F=D;while(Object.getPrototypeOf(F)!==null)F=Object.getPrototypeOf(F);return Object.getPrototypeOf(D)===F}function H3(...D){let F={};for(let E of D)for(let[B,$]of Object.entries(E)){let q=F[B];F[B]=G3(q)&&G3($)?H3(q,$):$}return F}function c(...D){let F=[W3,...D.filter((E)=>E!=null)];return H3(...F)}function FD({status:D="idle",theme:F}){let[E,B]=k(!1),[$,q]=k(0),{prefix:X,spinner:Q}=c(F);if(DD(()=>{if(D==="loading"){let J,_=-1,G=setTimeout(()=>{B(!0),J=setInterval(()=>{_=_+1,q(_%Q.frames.length)},Q.interval)},300);return()=>{clearTimeout(G),clearInterval(J)}}else B(!1)},[D]),E)return Q.frames[$];return typeof X==="string"?X:X[D==="loading"?"idle":D]??X.idle}function kD(D,F){return lD((E)=>{let B=E.get();if(!B||B.dependencies.length!==F.length||B.dependencies.some(($,q)=>$!==F[q])){let $=D();return E.set({value:$,dependencies:F}),$}return B.value})}function fD(D){return k({current:D})[0]}function ED(D){let F=fD(D);F.current=D,DD((E)=>{let B=!1,$=C0((q,X)=>{if(B)return;F.current(X,E)});return E.input.on("keypress",$),()=>{B=!0,E.input.removeListener("keypress",$)}},[])}var p3=jD(A3(),1),d3=jD(l3(),1);function M2(D,F){return D.split(`
30
+ `)}});var i3=y((Y7,n3)=>{var R6=UD("stream");class c3 extends R6{#E=null;constructor(D={}){super(D);this.writable=this.readable=!0,this.muted=!1,this.on("pipe",this._onpipe),this.replace=D.replace,this._prompt=D.prompt||null,this._hadControl=!1}#F(D,F){if(this._dest)return this._dest[D];if(this._src)return this._src[D];return F}#D(D,...F){if(typeof this._dest?.[D]==="function")this._dest[D](...F);if(typeof this._src?.[D]==="function")this._src[D](...F)}get isTTY(){if(this.#E!==null)return this.#E;return this.#F("isTTY",!1)}set isTTY(D){this.#E=D}get rows(){return this.#F("rows")}get columns(){return this.#F("columns")}mute(){this.muted=!0}unmute(){this.muted=!1}_onpipe(D){this._src=D}pipe(D,F){return this._dest=D,super.pipe(D,F)}pause(){if(this._src)return this._src.pause()}resume(){if(this._src)return this._src.resume()}write(D){if(this.muted){if(!this.replace)return!0;if(D.match(/^\u001b/)){if(D.indexOf(this._prompt)===0)D=D.slice(this._prompt.length),D=D.replace(/./g,this.replace),D=this._prompt+D;return this._hadControl=!0,this.emit("data",D)}else{if(this._prompt&&this._hadControl&&D.indexOf(this._prompt)===0)this._hadControl=!1,this.emit("data",this._prompt),D=D.slice(this._prompt.length);D=D.toString().replace(/./g,this.replace)}}this.emit("data",D)}end(D){if(this.muted)if(D&&this.replace)D=D.toString().replace(/./g,this.replace);else D=null;if(D)this.emit("data",D);this.emit("end")}destroy(...D){return this.#D("destroy",...D)}destroySoon(...D){return this.#D("destroySoon",...D)}close(...D){return this.#D("close",...D)}}n3.exports=c3});var I,T0,W,YD=(D)=>{switch(typeof D){case"undefined":return W.undefined;case"string":return W.string;case"number":return Number.isNaN(D)?W.nan:W.number;case"boolean":return W.boolean;case"function":return W.function;case"bigint":return W.bigint;case"symbol":return W.symbol;case"object":if(Array.isArray(D))return W.array;if(D===null)return W.null;if(D.then&&typeof D.then==="function"&&D.catch&&typeof D.catch==="function")return W.promise;if(typeof Map<"u"&&D instanceof Map)return W.map;if(typeof Set<"u"&&D instanceof Set)return W.set;if(typeof Date<"u"&&D instanceof Date)return W.date;return W.object;default:return W.unknown}};var z2=JD(()=>{(function(D){D.assertEqual=($)=>{};function F($){}D.assertIs=F;function E($){throw Error()}D.assertNever=E,D.arrayToEnum=($)=>{let q={};for(let X of $)q[X]=X;return q},D.getValidEnumValues=($)=>{let q=D.objectKeys($).filter((Q)=>typeof $[$[Q]]!=="number"),X={};for(let Q of q)X[Q]=$[Q];return D.objectValues(X)},D.objectValues=($)=>{return D.objectKeys($).map(function(q){return $[q]})},D.objectKeys=typeof Object.keys==="function"?($)=>Object.keys($):($)=>{let q=[];for(let X in $)if(Object.prototype.hasOwnProperty.call($,X))q.push(X);return q},D.find=($,q)=>{for(let X of $)if(q(X))return X;return},D.isInteger=typeof Number.isInteger==="function"?($)=>Number.isInteger($):($)=>typeof $==="number"&&Number.isFinite($)&&Math.floor($)===$;function B($,q=" | "){return $.map((X)=>typeof X==="string"?`'${X}'`:X).join(q)}D.joinValues=B,D.jsonStringifyReplacer=($,q)=>{if(typeof q==="bigint")return q.toString();return q}})(I||(I={}));(function(D){D.mergeShapes=(F,E)=>{return{...F,...E}}})(T0||(T0={}));W=I.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"])});var Y,T6=(D)=>{return JSON.stringify(D,null,2).replace(/"([^"]+)":/g,"$1:")},p;var v2=JD(()=>{z2();Y=I.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"]);p=class p extends Error{get errors(){return this.issues}constructor(D){super();this.issues=[],this.addIssue=(E)=>{this.issues=[...this.issues,E]},this.addIssues=(E=[])=>{this.issues=[...this.issues,...E]};let F=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,F);else this.__proto__=F;this.name="ZodError",this.issues=D}format(D){let F=D||function($){return $.message},E={_errors:[]},B=($)=>{for(let q of $.issues)if(q.code==="invalid_union")q.unionErrors.map(B);else if(q.code==="invalid_return_type")B(q.returnTypeError);else if(q.code==="invalid_arguments")B(q.argumentsError);else if(q.path.length===0)E._errors.push(F(q));else{let X=E,Q=0;while(Q<q.path.length){let C=q.path[Q];if(Q!==q.path.length-1)X[C]=X[C]||{_errors:[]};else X[C]=X[C]||{_errors:[]},X[C]._errors.push(F(q));X=X[C],Q++}}};return B(this),E}static assert(D){if(!(D instanceof p))throw Error(`Not a ZodError: ${D}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,I.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(D=(F)=>F.message){let F={},E=[];for(let B of this.issues)if(B.path.length>0){let $=B.path[0];F[$]=F[$]||[],F[$].push(D(B))}else E.push(D(B));return{formErrors:E,fieldErrors:F}}get formErrors(){return this.flatten()}};p.create=(D)=>{return new p(D)}});var b6=(D,F)=>{let E;switch(D.code){case Y.invalid_type:if(D.received===W.undefined)E="Required";else E=`Expected ${D.expected}, received ${D.received}`;break;case Y.invalid_literal:E=`Invalid literal value, expected ${JSON.stringify(D.expected,I.jsonStringifyReplacer)}`;break;case Y.unrecognized_keys:E=`Unrecognized key(s) in object: ${I.joinValues(D.keys,", ")}`;break;case Y.invalid_union:E="Invalid input";break;case Y.invalid_union_discriminator:E=`Invalid discriminator value. Expected ${I.joinValues(D.options)}`;break;case Y.invalid_enum_value:E=`Invalid enum value. Expected ${I.joinValues(D.options)}, received '${D.received}'`;break;case Y.invalid_arguments:E="Invalid function arguments";break;case Y.invalid_return_type:E="Invalid function return type";break;case Y.invalid_date:E="Invalid date";break;case Y.invalid_string:if(typeof D.validation==="object")if("includes"in D.validation){if(E=`Invalid input: must include "${D.validation.includes}"`,typeof D.validation.position==="number")E=`${E} at one or more positions greater than or equal to ${D.validation.position}`}else if("startsWith"in D.validation)E=`Invalid input: must start with "${D.validation.startsWith}"`;else if("endsWith"in D.validation)E=`Invalid input: must end with "${D.validation.endsWith}"`;else I.assertNever(D.validation);else if(D.validation!=="regex")E=`Invalid ${D.validation}`;else E="Invalid";break;case Y.too_small:if(D.type==="array")E=`Array must contain ${D.exact?"exactly":D.inclusive?"at least":"more than"} ${D.minimum} element(s)`;else if(D.type==="string")E=`String must contain ${D.exact?"exactly":D.inclusive?"at least":"over"} ${D.minimum} character(s)`;else if(D.type==="number")E=`Number must be ${D.exact?"exactly equal to ":D.inclusive?"greater than or equal to ":"greater than "}${D.minimum}`;else if(D.type==="bigint")E=`Number must be ${D.exact?"exactly equal to ":D.inclusive?"greater than or equal to ":"greater than "}${D.minimum}`;else if(D.type==="date")E=`Date must be ${D.exact?"exactly equal to ":D.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(D.minimum))}`;else E="Invalid input";break;case Y.too_big:if(D.type==="array")E=`Array must contain ${D.exact?"exactly":D.inclusive?"at most":"less than"} ${D.maximum} element(s)`;else if(D.type==="string")E=`String must contain ${D.exact?"exactly":D.inclusive?"at most":"under"} ${D.maximum} character(s)`;else if(D.type==="number")E=`Number must be ${D.exact?"exactly":D.inclusive?"less than or equal to":"less than"} ${D.maximum}`;else if(D.type==="bigint")E=`BigInt must be ${D.exact?"exactly":D.inclusive?"less than or equal to":"less than"} ${D.maximum}`;else if(D.type==="date")E=`Date must be ${D.exact?"exactly":D.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(D.maximum))}`;else E="Invalid input";break;case Y.custom:E="Invalid input";break;case Y.invalid_intersection_types:E="Intersection results could not be merged";break;case Y.not_multiple_of:E=`Number must be a multiple of ${D.multipleOf}`;break;case Y.not_finite:E="Number must be finite";break;default:E=F.defaultError,I.assertNever(D)}return{message:E}},RD;var b0=JD(()=>{v2();z2();RD=b6});function k6(D){X8=D}function rD(){return X8}var X8;var Z2=JD(()=>{b0();X8=RD});function H(D,F){let E=rD(),B=u2({issueData:F,data:D.data,path:D.path,errorMaps:[D.common.contextualErrorMap,D.schemaErrorMap,E,E===RD?void 0:RD].filter(($)=>!!$)});D.common.issues.push(B)}class h{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray(D,F){let E=[];for(let B of F){if(B.status==="aborted")return R;if(B.status==="dirty")D.dirty();E.push(B.value)}return{status:D.value,value:E}}static async mergeObjectAsync(D,F){let E=[];for(let B of F){let $=await B.key,q=await B.value;E.push({key:$,value:q})}return h.mergeObjectSync(D,E)}static mergeObjectSync(D,F){let E={};for(let B of F){let{key:$,value:q}=B;if($.status==="aborted")return R;if(q.status==="aborted")return R;if($.status==="dirty")D.dirty();if(q.status==="dirty")D.dirty();if($.value!=="__proto__"&&(typeof q.value<"u"||B.alwaysSet))E[$.value]=q.value}return{status:D.value,value:E}}}var u2=(D)=>{let{data:F,path:E,errorMaps:B,issueData:$}=D,q=[...E,...$.path||[]],X={...$,path:q};if($.message!==void 0)return{...$,path:q,message:$.message};let Q="",C=B.filter((J)=>!!J).slice().reverse();for(let J of C)Q=J(X,{data:F,defaultError:Q}).message;return{...$,path:q,message:Q}},f6,R,xD=(D)=>({status:"dirty",value:D}),l=(D)=>({status:"valid",value:D}),x2=(D)=>D.status==="aborted",y2=(D)=>D.status==="dirty",VD=(D)=>D.status==="valid",aD=(D)=>typeof Promise<"u"&&D instanceof Promise;var k0=JD(()=>{Z2();b0();f6=[];R=Object.freeze({status:"aborted"})});var Q8=()=>{};var A;var C8=JD(()=>{(function(D){D.errToObj=(F)=>typeof F==="string"?{message:F}:F||{},D.toString=(F)=>typeof F==="string"?F:F?.message})(A||(A={}))});class QD{constructor(D,F,E,B){this._cachedPath=[],this.parent=D,this.data=F,this._path=E,this._key=B}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}function V(D){if(!D)return{};let{errorMap:F,invalid_type_error:E,required_error:B,description:$}=D;if(F&&(E||B))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(F)return{errorMap:F,description:$};return{errorMap:(X,Q)=>{let{message:C}=D;if(X.code==="invalid_enum_value")return{message:C??Q.defaultError};if(typeof Q.data>"u")return{message:C??B??Q.defaultError};if(X.code!=="invalid_type")return{message:Q.defaultError};return{message:C??E??Q.defaultError}},description:$}}class O{get description(){return this._def.description}_getType(D){return YD(D.data)}_getOrReturnCtx(D,F){return F||{common:D.parent.common,data:D.data,parsedType:YD(D.data),schemaErrorMap:this._def.errorMap,path:D.path,parent:D.parent}}_processInputParams(D){return{status:new h,ctx:{common:D.parent.common,data:D.data,parsedType:YD(D.data),schemaErrorMap:this._def.errorMap,path:D.path,parent:D.parent}}}_parseSync(D){let F=this._parse(D);if(aD(F))throw Error("Synchronous parse encountered promise.");return F}_parseAsync(D){let F=this._parse(D);return Promise.resolve(F)}parse(D,F){let E=this.safeParse(D,F);if(E.success)return E.data;throw E.error}safeParse(D,F){let E={common:{issues:[],async:F?.async??!1,contextualErrorMap:F?.errorMap},path:F?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:D,parsedType:YD(D)},B=this._parseSync({data:D,path:E.path,parent:E});return J8(E,B)}"~validate"(D){let F={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:D,parsedType:YD(D)};if(!this["~standard"].async)try{let E=this._parseSync({data:D,path:[],parent:F});return VD(E)?{value:E.value}:{issues:F.common.issues}}catch(E){if(E?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;F.common={issues:[],async:!0}}return this._parseAsync({data:D,path:[],parent:F}).then((E)=>VD(E)?{value:E.value}:{issues:F.common.issues})}async parseAsync(D,F){let E=await this.safeParseAsync(D,F);if(E.success)return E.data;throw E.error}async safeParseAsync(D,F){let E={common:{issues:[],contextualErrorMap:F?.errorMap,async:!0},path:F?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:D,parsedType:YD(D)},B=this._parse({data:D,path:E.path,parent:E}),$=await(aD(B)?B:Promise.resolve(B));return J8(E,$)}refine(D,F){let E=(B)=>{if(typeof F==="string"||typeof F>"u")return{message:F};else if(typeof F==="function")return F(B);else return F};return this._refinement((B,$)=>{let q=D(B),X=()=>$.addIssue({code:Y.custom,...E(B)});if(typeof Promise<"u"&&q instanceof Promise)return q.then((Q)=>{if(!Q)return X(),!1;else return!0});if(!q)return X(),!1;else return!0})}refinement(D,F){return this._refinement((E,B)=>{if(!D(E))return B.addIssue(typeof F==="function"?F(E,B):F),!1;else return!0})}_refinement(D){return new CD({schema:this,typeName:u.ZodEffects,effect:{type:"refinement",refinement:D}})}superRefine(D){return this._refinement(D)}constructor(D){this.spa=this.safeParseAsync,this._def=D,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:(F)=>this["~validate"](F)}}optional(){return XD.create(this,this._def)}nullable(){return uD.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return qD.create(this)}promise(){return mD.create(this,this._def)}or(D){return F2.create([this,D],this._def)}and(D){return E2.create(this,D,this._def)}transform(D){return new CD({...V(this._def),schema:this,typeName:u.ZodEffects,effect:{type:"transform",transform:D}})}default(D){let F=typeof D==="function"?D:()=>D;return new X2({...V(this._def),innerType:this,defaultValue:F,typeName:u.ZodDefault})}brand(){return new g2({typeName:u.ZodBranded,type:this,...V(this._def)})}catch(D){let F=typeof D==="function"?D:()=>D;return new Q2({...V(this._def),innerType:this,catchValue:F,typeName:u.ZodCatch})}describe(D){return new this.constructor({...this._def,description:D})}pipe(D){return K2.create(this,D)}readonly(){return C2.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}function W8(D){let F="[0-5]\\d";if(D.precision)F=`${F}\\.\\d{${D.precision}}`;else if(D.precision==null)F=`${F}(\\.\\d+)?`;let E=D.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${F})${E}`}function s6(D){return new RegExp(`^${W8(D)}$`)}function G8(D){let F=`${Y8}T${W8(D)}`,E=[];if(E.push(D.local?"Z?":"Z"),D.offset)E.push("([+-]\\d{2}:?\\d{2})");return F=`${F}(${E.join("|")})`,new RegExp(`^${F}$`)}function t6(D,F){if((F==="v4"||!F)&&d6.test(D))return!0;if((F==="v6"||!F)&&n6.test(D))return!0;return!1}function e6(D,F){if(!g6.test(D))return!1;try{let[E]=D.split(".");if(!E)return!1;let B=E.replace(/-/g,"+").replace(/_/g,"/").padEnd(E.length+(4-E.length%4)%4,"="),$=JSON.parse(atob(B));if(typeof $!=="object"||$===null)return!1;if("typ"in $&&$?.typ!=="JWT")return!1;if(!$.alg)return!1;if(F&&$.alg!==F)return!1;return!0}catch{return!1}}function D1(D,F){if((F==="v4"||!F)&&c6.test(D))return!0;if((F==="v6"||!F)&&i6.test(D))return!0;return!1}function F1(D,F){let E=(D.toString().split(".")[1]||"").length,B=(F.toString().split(".")[1]||"").length,$=E>B?E:B,q=Number.parseInt(D.toFixed($).replace(".","")),X=Number.parseInt(F.toFixed($).replace(".",""));return q%X/10**$}function oD(D){if(D instanceof Z){let F={};for(let E in D.shape){let B=D.shape[E];F[E]=XD.create(oD(B))}return new Z({...D._def,shape:()=>F})}else if(D instanceof qD)return new qD({...D._def,type:oD(D.element)});else if(D instanceof XD)return XD.create(oD(D.unwrap()));else if(D instanceof uD)return uD.create(oD(D.unwrap()));else if(D instanceof GD)return GD.create(D.items.map((F)=>oD(F)));else return D}function v0(D,F){let E=YD(D),B=YD(F);if(D===F)return{valid:!0,data:D};else if(E===W.object&&B===W.object){let $=I.objectKeys(F),q=I.objectKeys(D).filter((Q)=>$.indexOf(Q)!==-1),X={...D,...F};for(let Q of q){let C=v0(D[Q],F[Q]);if(!C.valid)return{valid:!1};X[Q]=C.data}return{valid:!0,data:X}}else if(E===W.array&&B===W.array){if(D.length!==F.length)return{valid:!1};let $=[];for(let q=0;q<D.length;q++){let X=D[q],Q=F[q],C=v0(X,Q);if(!C.valid)return{valid:!1};$.push(C.data)}return{valid:!0,data:$}}else if(E===W.date&&B===W.date&&+D===+F)return{valid:!0,data:D};else return{valid:!1}}function H8(D,F){return new wD({values:D,typeName:u.ZodEnum,...V(F)})}function _8(D,F){let E=typeof D==="function"?D(F):typeof D==="string"?{message:D}:D;return typeof E==="string"?{message:E}:E}function M8(D,F={},E){if(D)return hD.create().superRefine((B,$)=>{let q=D(B);if(q instanceof Promise)return q.then((X)=>{if(!X){let Q=_8(F,B),C=Q.fatal??E??!0;$.addIssue({code:"custom",...Q,fatal:C})}});if(!q){let X=_8(F,B),Q=X.fatal??E??!0;$.addIssue({code:"custom",...X,fatal:Q})}return});return hD.create()}var J8=(D,F)=>{if(VD(F))return{success:!0,data:F.value};else{if(!D.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let E=new p(D.common.issues);return this._error=E,this._error}}}},v6,Z6,x6,y6,h6,g6,m6,l6,p6="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",f0,d6,c6,n6,i6,r6,a6,Y8="((\\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])))",o6,$D,KD,OD,tD,yD,j2,eD,D2,hD,ND,WD,U2,qD,Z,F2,zD=(D)=>{if(D instanceof B2)return zD(D.schema);else if(D instanceof CD)return zD(D.innerType());else if(D instanceof $2)return[D.value];else if(D instanceof wD)return D.options;else if(D instanceof q2)return I.objectValues(D.enum);else if(D instanceof X2)return zD(D._def.innerType);else if(D instanceof eD)return[void 0];else if(D instanceof D2)return[null];else if(D instanceof XD)return[void 0,...zD(D.unwrap())];else if(D instanceof uD)return[null,...zD(D.unwrap())];else if(D instanceof g2)return zD(D.unwrap());else if(D instanceof C2)return zD(D.unwrap());else if(D instanceof Q2)return zD(D._def.innerType);else return[]},h2,E2,GD,L2,V2,gD,sD,B2,$2,wD,q2,mD,CD,XD,uD,X2,Q2,N2,E1,g2,K2,C2,B1,u,$1=(D,F={message:`Input not instance of ${D.name}`})=>M8((E)=>E instanceof D,F),A8,R8,q1,X1,z8,Q1,C1,J1,_1,Y1,W1,G1,H1,M1,A1,R1,z1,u1,j1,U1,L1,V1,N1,K1,O1,w1,S1,I1,P1,T1,b1,k1,f1,v1,Z1=()=>A8().optional(),x1=()=>R8().optional(),y1=()=>z8().optional(),h1,g1;var u8=JD(()=>{v2();Z2();C8();k0();z2();v6=/^c[^\s-]{8,}$/i,Z6=/^[0-9a-z]+$/,x6=/^[0-9A-HJKMNP-TV-Z]{26}$/i,y6=/^[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,h6=/^[a-z0-9_-]{21}$/i,g6=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,m6=/^[-+]?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)?)??$/,l6=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,d6=/^(?:(?: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])$/,c6=/^(?:(?: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])$/,n6=/^(([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]))$/,i6=/^(([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])$/,r6=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,a6=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,o6=new RegExp(`^${Y8}$`);$D=class $D extends O{_parse(D){if(this._def.coerce)D.data=String(D.data);if(this._getType(D)!==W.string){let $=this._getOrReturnCtx(D);return H($,{code:Y.invalid_type,expected:W.string,received:$.parsedType}),R}let E=new h,B=void 0;for(let $ of this._def.checks)if($.kind==="min"){if(D.data.length<$.value)B=this._getOrReturnCtx(D,B),H(B,{code:Y.too_small,minimum:$.value,type:"string",inclusive:!0,exact:!1,message:$.message}),E.dirty()}else if($.kind==="max"){if(D.data.length>$.value)B=this._getOrReturnCtx(D,B),H(B,{code:Y.too_big,maximum:$.value,type:"string",inclusive:!0,exact:!1,message:$.message}),E.dirty()}else if($.kind==="length"){let q=D.data.length>$.value,X=D.data.length<$.value;if(q||X){if(B=this._getOrReturnCtx(D,B),q)H(B,{code:Y.too_big,maximum:$.value,type:"string",inclusive:!0,exact:!0,message:$.message});else if(X)H(B,{code:Y.too_small,minimum:$.value,type:"string",inclusive:!0,exact:!0,message:$.message});E.dirty()}}else if($.kind==="email"){if(!l6.test(D.data))B=this._getOrReturnCtx(D,B),H(B,{validation:"email",code:Y.invalid_string,message:$.message}),E.dirty()}else if($.kind==="emoji"){if(!f0)f0=new RegExp(p6,"u");if(!f0.test(D.data))B=this._getOrReturnCtx(D,B),H(B,{validation:"emoji",code:Y.invalid_string,message:$.message}),E.dirty()}else if($.kind==="uuid"){if(!y6.test(D.data))B=this._getOrReturnCtx(D,B),H(B,{validation:"uuid",code:Y.invalid_string,message:$.message}),E.dirty()}else if($.kind==="nanoid"){if(!h6.test(D.data))B=this._getOrReturnCtx(D,B),H(B,{validation:"nanoid",code:Y.invalid_string,message:$.message}),E.dirty()}else if($.kind==="cuid"){if(!v6.test(D.data))B=this._getOrReturnCtx(D,B),H(B,{validation:"cuid",code:Y.invalid_string,message:$.message}),E.dirty()}else if($.kind==="cuid2"){if(!Z6.test(D.data))B=this._getOrReturnCtx(D,B),H(B,{validation:"cuid2",code:Y.invalid_string,message:$.message}),E.dirty()}else if($.kind==="ulid"){if(!x6.test(D.data))B=this._getOrReturnCtx(D,B),H(B,{validation:"ulid",code:Y.invalid_string,message:$.message}),E.dirty()}else if($.kind==="url")try{new URL(D.data)}catch{B=this._getOrReturnCtx(D,B),H(B,{validation:"url",code:Y.invalid_string,message:$.message}),E.dirty()}else if($.kind==="regex"){if($.regex.lastIndex=0,!$.regex.test(D.data))B=this._getOrReturnCtx(D,B),H(B,{validation:"regex",code:Y.invalid_string,message:$.message}),E.dirty()}else if($.kind==="trim")D.data=D.data.trim();else if($.kind==="includes"){if(!D.data.includes($.value,$.position))B=this._getOrReturnCtx(D,B),H(B,{code:Y.invalid_string,validation:{includes:$.value,position:$.position},message:$.message}),E.dirty()}else if($.kind==="toLowerCase")D.data=D.data.toLowerCase();else if($.kind==="toUpperCase")D.data=D.data.toUpperCase();else if($.kind==="startsWith"){if(!D.data.startsWith($.value))B=this._getOrReturnCtx(D,B),H(B,{code:Y.invalid_string,validation:{startsWith:$.value},message:$.message}),E.dirty()}else if($.kind==="endsWith"){if(!D.data.endsWith($.value))B=this._getOrReturnCtx(D,B),H(B,{code:Y.invalid_string,validation:{endsWith:$.value},message:$.message}),E.dirty()}else if($.kind==="datetime"){if(!G8($).test(D.data))B=this._getOrReturnCtx(D,B),H(B,{code:Y.invalid_string,validation:"datetime",message:$.message}),E.dirty()}else if($.kind==="date"){if(!o6.test(D.data))B=this._getOrReturnCtx(D,B),H(B,{code:Y.invalid_string,validation:"date",message:$.message}),E.dirty()}else if($.kind==="time"){if(!s6($).test(D.data))B=this._getOrReturnCtx(D,B),H(B,{code:Y.invalid_string,validation:"time",message:$.message}),E.dirty()}else if($.kind==="duration"){if(!m6.test(D.data))B=this._getOrReturnCtx(D,B),H(B,{validation:"duration",code:Y.invalid_string,message:$.message}),E.dirty()}else if($.kind==="ip"){if(!t6(D.data,$.version))B=this._getOrReturnCtx(D,B),H(B,{validation:"ip",code:Y.invalid_string,message:$.message}),E.dirty()}else if($.kind==="jwt"){if(!e6(D.data,$.alg))B=this._getOrReturnCtx(D,B),H(B,{validation:"jwt",code:Y.invalid_string,message:$.message}),E.dirty()}else if($.kind==="cidr"){if(!D1(D.data,$.version))B=this._getOrReturnCtx(D,B),H(B,{validation:"cidr",code:Y.invalid_string,message:$.message}),E.dirty()}else if($.kind==="base64"){if(!r6.test(D.data))B=this._getOrReturnCtx(D,B),H(B,{validation:"base64",code:Y.invalid_string,message:$.message}),E.dirty()}else if($.kind==="base64url"){if(!a6.test(D.data))B=this._getOrReturnCtx(D,B),H(B,{validation:"base64url",code:Y.invalid_string,message:$.message}),E.dirty()}else I.assertNever($);return{status:E.value,value:D.data}}_regex(D,F,E){return this.refinement((B)=>D.test(B),{validation:F,code:Y.invalid_string,...A.errToObj(E)})}_addCheck(D){return new $D({...this._def,checks:[...this._def.checks,D]})}email(D){return this._addCheck({kind:"email",...A.errToObj(D)})}url(D){return this._addCheck({kind:"url",...A.errToObj(D)})}emoji(D){return this._addCheck({kind:"emoji",...A.errToObj(D)})}uuid(D){return this._addCheck({kind:"uuid",...A.errToObj(D)})}nanoid(D){return this._addCheck({kind:"nanoid",...A.errToObj(D)})}cuid(D){return this._addCheck({kind:"cuid",...A.errToObj(D)})}cuid2(D){return this._addCheck({kind:"cuid2",...A.errToObj(D)})}ulid(D){return this._addCheck({kind:"ulid",...A.errToObj(D)})}base64(D){return this._addCheck({kind:"base64",...A.errToObj(D)})}base64url(D){return this._addCheck({kind:"base64url",...A.errToObj(D)})}jwt(D){return this._addCheck({kind:"jwt",...A.errToObj(D)})}ip(D){return this._addCheck({kind:"ip",...A.errToObj(D)})}cidr(D){return this._addCheck({kind:"cidr",...A.errToObj(D)})}datetime(D){if(typeof D==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:D});return this._addCheck({kind:"datetime",precision:typeof D?.precision>"u"?null:D?.precision,offset:D?.offset??!1,local:D?.local??!1,...A.errToObj(D?.message)})}date(D){return this._addCheck({kind:"date",message:D})}time(D){if(typeof D==="string")return this._addCheck({kind:"time",precision:null,message:D});return this._addCheck({kind:"time",precision:typeof D?.precision>"u"?null:D?.precision,...A.errToObj(D?.message)})}duration(D){return this._addCheck({kind:"duration",...A.errToObj(D)})}regex(D,F){return this._addCheck({kind:"regex",regex:D,...A.errToObj(F)})}includes(D,F){return this._addCheck({kind:"includes",value:D,position:F?.position,...A.errToObj(F?.message)})}startsWith(D,F){return this._addCheck({kind:"startsWith",value:D,...A.errToObj(F)})}endsWith(D,F){return this._addCheck({kind:"endsWith",value:D,...A.errToObj(F)})}min(D,F){return this._addCheck({kind:"min",value:D,...A.errToObj(F)})}max(D,F){return this._addCheck({kind:"max",value:D,...A.errToObj(F)})}length(D,F){return this._addCheck({kind:"length",value:D,...A.errToObj(F)})}nonempty(D){return this.min(1,A.errToObj(D))}trim(){return new $D({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new $D({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new $D({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((D)=>D.kind==="datetime")}get isDate(){return!!this._def.checks.find((D)=>D.kind==="date")}get isTime(){return!!this._def.checks.find((D)=>D.kind==="time")}get isDuration(){return!!this._def.checks.find((D)=>D.kind==="duration")}get isEmail(){return!!this._def.checks.find((D)=>D.kind==="email")}get isURL(){return!!this._def.checks.find((D)=>D.kind==="url")}get isEmoji(){return!!this._def.checks.find((D)=>D.kind==="emoji")}get isUUID(){return!!this._def.checks.find((D)=>D.kind==="uuid")}get isNANOID(){return!!this._def.checks.find((D)=>D.kind==="nanoid")}get isCUID(){return!!this._def.checks.find((D)=>D.kind==="cuid")}get isCUID2(){return!!this._def.checks.find((D)=>D.kind==="cuid2")}get isULID(){return!!this._def.checks.find((D)=>D.kind==="ulid")}get isIP(){return!!this._def.checks.find((D)=>D.kind==="ip")}get isCIDR(){return!!this._def.checks.find((D)=>D.kind==="cidr")}get isBase64(){return!!this._def.checks.find((D)=>D.kind==="base64")}get isBase64url(){return!!this._def.checks.find((D)=>D.kind==="base64url")}get minLength(){let D=null;for(let F of this._def.checks)if(F.kind==="min"){if(D===null||F.value>D)D=F.value}return D}get maxLength(){let D=null;for(let F of this._def.checks)if(F.kind==="max"){if(D===null||F.value<D)D=F.value}return D}};$D.create=(D)=>{return new $D({checks:[],typeName:u.ZodString,coerce:D?.coerce??!1,...V(D)})};KD=class KD extends O{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(D){if(this._def.coerce)D.data=Number(D.data);if(this._getType(D)!==W.number){let $=this._getOrReturnCtx(D);return H($,{code:Y.invalid_type,expected:W.number,received:$.parsedType}),R}let E=void 0,B=new h;for(let $ of this._def.checks)if($.kind==="int"){if(!I.isInteger(D.data))E=this._getOrReturnCtx(D,E),H(E,{code:Y.invalid_type,expected:"integer",received:"float",message:$.message}),B.dirty()}else if($.kind==="min"){if($.inclusive?D.data<$.value:D.data<=$.value)E=this._getOrReturnCtx(D,E),H(E,{code:Y.too_small,minimum:$.value,type:"number",inclusive:$.inclusive,exact:!1,message:$.message}),B.dirty()}else if($.kind==="max"){if($.inclusive?D.data>$.value:D.data>=$.value)E=this._getOrReturnCtx(D,E),H(E,{code:Y.too_big,maximum:$.value,type:"number",inclusive:$.inclusive,exact:!1,message:$.message}),B.dirty()}else if($.kind==="multipleOf"){if(F1(D.data,$.value)!==0)E=this._getOrReturnCtx(D,E),H(E,{code:Y.not_multiple_of,multipleOf:$.value,message:$.message}),B.dirty()}else if($.kind==="finite"){if(!Number.isFinite(D.data))E=this._getOrReturnCtx(D,E),H(E,{code:Y.not_finite,message:$.message}),B.dirty()}else I.assertNever($);return{status:B.value,value:D.data}}gte(D,F){return this.setLimit("min",D,!0,A.toString(F))}gt(D,F){return this.setLimit("min",D,!1,A.toString(F))}lte(D,F){return this.setLimit("max",D,!0,A.toString(F))}lt(D,F){return this.setLimit("max",D,!1,A.toString(F))}setLimit(D,F,E,B){return new KD({...this._def,checks:[...this._def.checks,{kind:D,value:F,inclusive:E,message:A.toString(B)}]})}_addCheck(D){return new KD({...this._def,checks:[...this._def.checks,D]})}int(D){return this._addCheck({kind:"int",message:A.toString(D)})}positive(D){return this._addCheck({kind:"min",value:0,inclusive:!1,message:A.toString(D)})}negative(D){return this._addCheck({kind:"max",value:0,inclusive:!1,message:A.toString(D)})}nonpositive(D){return this._addCheck({kind:"max",value:0,inclusive:!0,message:A.toString(D)})}nonnegative(D){return this._addCheck({kind:"min",value:0,inclusive:!0,message:A.toString(D)})}multipleOf(D,F){return this._addCheck({kind:"multipleOf",value:D,message:A.toString(F)})}finite(D){return this._addCheck({kind:"finite",message:A.toString(D)})}safe(D){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:A.toString(D)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:A.toString(D)})}get minValue(){let D=null;for(let F of this._def.checks)if(F.kind==="min"){if(D===null||F.value>D)D=F.value}return D}get maxValue(){let D=null;for(let F of this._def.checks)if(F.kind==="max"){if(D===null||F.value<D)D=F.value}return D}get isInt(){return!!this._def.checks.find((D)=>D.kind==="int"||D.kind==="multipleOf"&&I.isInteger(D.value))}get isFinite(){let D=null,F=null;for(let E of this._def.checks)if(E.kind==="finite"||E.kind==="int"||E.kind==="multipleOf")return!0;else if(E.kind==="min"){if(F===null||E.value>F)F=E.value}else if(E.kind==="max"){if(D===null||E.value<D)D=E.value}return Number.isFinite(F)&&Number.isFinite(D)}};KD.create=(D)=>{return new KD({checks:[],typeName:u.ZodNumber,coerce:D?.coerce||!1,...V(D)})};OD=class OD extends O{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse(D){if(this._def.coerce)try{D.data=BigInt(D.data)}catch{return this._getInvalidInput(D)}if(this._getType(D)!==W.bigint)return this._getInvalidInput(D);let E=void 0,B=new h;for(let $ of this._def.checks)if($.kind==="min"){if($.inclusive?D.data<$.value:D.data<=$.value)E=this._getOrReturnCtx(D,E),H(E,{code:Y.too_small,type:"bigint",minimum:$.value,inclusive:$.inclusive,message:$.message}),B.dirty()}else if($.kind==="max"){if($.inclusive?D.data>$.value:D.data>=$.value)E=this._getOrReturnCtx(D,E),H(E,{code:Y.too_big,type:"bigint",maximum:$.value,inclusive:$.inclusive,message:$.message}),B.dirty()}else if($.kind==="multipleOf"){if(D.data%$.value!==BigInt(0))E=this._getOrReturnCtx(D,E),H(E,{code:Y.not_multiple_of,multipleOf:$.value,message:$.message}),B.dirty()}else I.assertNever($);return{status:B.value,value:D.data}}_getInvalidInput(D){let F=this._getOrReturnCtx(D);return H(F,{code:Y.invalid_type,expected:W.bigint,received:F.parsedType}),R}gte(D,F){return this.setLimit("min",D,!0,A.toString(F))}gt(D,F){return this.setLimit("min",D,!1,A.toString(F))}lte(D,F){return this.setLimit("max",D,!0,A.toString(F))}lt(D,F){return this.setLimit("max",D,!1,A.toString(F))}setLimit(D,F,E,B){return new OD({...this._def,checks:[...this._def.checks,{kind:D,value:F,inclusive:E,message:A.toString(B)}]})}_addCheck(D){return new OD({...this._def,checks:[...this._def.checks,D]})}positive(D){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:A.toString(D)})}negative(D){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:A.toString(D)})}nonpositive(D){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:A.toString(D)})}nonnegative(D){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:A.toString(D)})}multipleOf(D,F){return this._addCheck({kind:"multipleOf",value:D,message:A.toString(F)})}get minValue(){let D=null;for(let F of this._def.checks)if(F.kind==="min"){if(D===null||F.value>D)D=F.value}return D}get maxValue(){let D=null;for(let F of this._def.checks)if(F.kind==="max"){if(D===null||F.value<D)D=F.value}return D}};OD.create=(D)=>{return new OD({checks:[],typeName:u.ZodBigInt,coerce:D?.coerce??!1,...V(D)})};tD=class tD extends O{_parse(D){if(this._def.coerce)D.data=Boolean(D.data);if(this._getType(D)!==W.boolean){let E=this._getOrReturnCtx(D);return H(E,{code:Y.invalid_type,expected:W.boolean,received:E.parsedType}),R}return l(D.data)}};tD.create=(D)=>{return new tD({typeName:u.ZodBoolean,coerce:D?.coerce||!1,...V(D)})};yD=class yD extends O{_parse(D){if(this._def.coerce)D.data=new Date(D.data);if(this._getType(D)!==W.date){let $=this._getOrReturnCtx(D);return H($,{code:Y.invalid_type,expected:W.date,received:$.parsedType}),R}if(Number.isNaN(D.data.getTime())){let $=this._getOrReturnCtx(D);return H($,{code:Y.invalid_date}),R}let E=new h,B=void 0;for(let $ of this._def.checks)if($.kind==="min"){if(D.data.getTime()<$.value)B=this._getOrReturnCtx(D,B),H(B,{code:Y.too_small,message:$.message,inclusive:!0,exact:!1,minimum:$.value,type:"date"}),E.dirty()}else if($.kind==="max"){if(D.data.getTime()>$.value)B=this._getOrReturnCtx(D,B),H(B,{code:Y.too_big,message:$.message,inclusive:!0,exact:!1,maximum:$.value,type:"date"}),E.dirty()}else I.assertNever($);return{status:E.value,value:new Date(D.data.getTime())}}_addCheck(D){return new yD({...this._def,checks:[...this._def.checks,D]})}min(D,F){return this._addCheck({kind:"min",value:D.getTime(),message:A.toString(F)})}max(D,F){return this._addCheck({kind:"max",value:D.getTime(),message:A.toString(F)})}get minDate(){let D=null;for(let F of this._def.checks)if(F.kind==="min"){if(D===null||F.value>D)D=F.value}return D!=null?new Date(D):null}get maxDate(){let D=null;for(let F of this._def.checks)if(F.kind==="max"){if(D===null||F.value<D)D=F.value}return D!=null?new Date(D):null}};yD.create=(D)=>{return new yD({checks:[],coerce:D?.coerce||!1,typeName:u.ZodDate,...V(D)})};j2=class j2 extends O{_parse(D){if(this._getType(D)!==W.symbol){let E=this._getOrReturnCtx(D);return H(E,{code:Y.invalid_type,expected:W.symbol,received:E.parsedType}),R}return l(D.data)}};j2.create=(D)=>{return new j2({typeName:u.ZodSymbol,...V(D)})};eD=class eD extends O{_parse(D){if(this._getType(D)!==W.undefined){let E=this._getOrReturnCtx(D);return H(E,{code:Y.invalid_type,expected:W.undefined,received:E.parsedType}),R}return l(D.data)}};eD.create=(D)=>{return new eD({typeName:u.ZodUndefined,...V(D)})};D2=class D2 extends O{_parse(D){if(this._getType(D)!==W.null){let E=this._getOrReturnCtx(D);return H(E,{code:Y.invalid_type,expected:W.null,received:E.parsedType}),R}return l(D.data)}};D2.create=(D)=>{return new D2({typeName:u.ZodNull,...V(D)})};hD=class hD extends O{constructor(){super(...arguments);this._any=!0}_parse(D){return l(D.data)}};hD.create=(D)=>{return new hD({typeName:u.ZodAny,...V(D)})};ND=class ND extends O{constructor(){super(...arguments);this._unknown=!0}_parse(D){return l(D.data)}};ND.create=(D)=>{return new ND({typeName:u.ZodUnknown,...V(D)})};WD=class WD extends O{_parse(D){let F=this._getOrReturnCtx(D);return H(F,{code:Y.invalid_type,expected:W.never,received:F.parsedType}),R}};WD.create=(D)=>{return new WD({typeName:u.ZodNever,...V(D)})};U2=class U2 extends O{_parse(D){if(this._getType(D)!==W.undefined){let E=this._getOrReturnCtx(D);return H(E,{code:Y.invalid_type,expected:W.void,received:E.parsedType}),R}return l(D.data)}};U2.create=(D)=>{return new U2({typeName:u.ZodVoid,...V(D)})};qD=class qD extends O{_parse(D){let{ctx:F,status:E}=this._processInputParams(D),B=this._def;if(F.parsedType!==W.array)return H(F,{code:Y.invalid_type,expected:W.array,received:F.parsedType}),R;if(B.exactLength!==null){let q=F.data.length>B.exactLength.value,X=F.data.length<B.exactLength.value;if(q||X)H(F,{code:q?Y.too_big:Y.too_small,minimum:X?B.exactLength.value:void 0,maximum:q?B.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:B.exactLength.message}),E.dirty()}if(B.minLength!==null){if(F.data.length<B.minLength.value)H(F,{code:Y.too_small,minimum:B.minLength.value,type:"array",inclusive:!0,exact:!1,message:B.minLength.message}),E.dirty()}if(B.maxLength!==null){if(F.data.length>B.maxLength.value)H(F,{code:Y.too_big,maximum:B.maxLength.value,type:"array",inclusive:!0,exact:!1,message:B.maxLength.message}),E.dirty()}if(F.common.async)return Promise.all([...F.data].map((q,X)=>{return B.type._parseAsync(new QD(F,q,F.path,X))})).then((q)=>{return h.mergeArray(E,q)});let $=[...F.data].map((q,X)=>{return B.type._parseSync(new QD(F,q,F.path,X))});return h.mergeArray(E,$)}get element(){return this._def.type}min(D,F){return new qD({...this._def,minLength:{value:D,message:A.toString(F)}})}max(D,F){return new qD({...this._def,maxLength:{value:D,message:A.toString(F)}})}length(D,F){return new qD({...this._def,exactLength:{value:D,message:A.toString(F)}})}nonempty(D){return this.min(1,D)}};qD.create=(D,F)=>{return new qD({type:D,minLength:null,maxLength:null,exactLength:null,typeName:u.ZodArray,...V(F)})};Z=class Z extends O{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let D=this._def.shape(),F=I.objectKeys(D);return this._cached={shape:D,keys:F},this._cached}_parse(D){if(this._getType(D)!==W.object){let C=this._getOrReturnCtx(D);return H(C,{code:Y.invalid_type,expected:W.object,received:C.parsedType}),R}let{status:E,ctx:B}=this._processInputParams(D),{shape:$,keys:q}=this._getCached(),X=[];if(!(this._def.catchall instanceof WD&&this._def.unknownKeys==="strip")){for(let C in B.data)if(!q.includes(C))X.push(C)}let Q=[];for(let C of q){let J=$[C],_=B.data[C];Q.push({key:{status:"valid",value:C},value:J._parse(new QD(B,_,B.path,C)),alwaysSet:C in B.data})}if(this._def.catchall instanceof WD){let C=this._def.unknownKeys;if(C==="passthrough")for(let J of X)Q.push({key:{status:"valid",value:J},value:{status:"valid",value:B.data[J]}});else if(C==="strict"){if(X.length>0)H(B,{code:Y.unrecognized_keys,keys:X}),E.dirty()}else if(C==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let C=this._def.catchall;for(let J of X){let _=B.data[J];Q.push({key:{status:"valid",value:J},value:C._parse(new QD(B,_,B.path,J)),alwaysSet:J in B.data})}}if(B.common.async)return Promise.resolve().then(async()=>{let C=[];for(let J of Q){let _=await J.key,G=await J.value;C.push({key:_,value:G,alwaysSet:J.alwaysSet})}return C}).then((C)=>{return h.mergeObjectSync(E,C)});else return h.mergeObjectSync(E,Q)}get shape(){return this._def.shape()}strict(D){return A.errToObj,new Z({...this._def,unknownKeys:"strict",...D!==void 0?{errorMap:(F,E)=>{let B=this._def.errorMap?.(F,E).message??E.defaultError;if(F.code==="unrecognized_keys")return{message:A.errToObj(D).message??B};return{message:B}}}:{}})}strip(){return new Z({...this._def,unknownKeys:"strip"})}passthrough(){return new Z({...this._def,unknownKeys:"passthrough"})}extend(D){return new Z({...this._def,shape:()=>({...this._def.shape(),...D})})}merge(D){return new Z({unknownKeys:D._def.unknownKeys,catchall:D._def.catchall,shape:()=>({...this._def.shape(),...D._def.shape()}),typeName:u.ZodObject})}setKey(D,F){return this.augment({[D]:F})}catchall(D){return new Z({...this._def,catchall:D})}pick(D){let F={};for(let E of I.objectKeys(D))if(D[E]&&this.shape[E])F[E]=this.shape[E];return new Z({...this._def,shape:()=>F})}omit(D){let F={};for(let E of I.objectKeys(this.shape))if(!D[E])F[E]=this.shape[E];return new Z({...this._def,shape:()=>F})}deepPartial(){return oD(this)}partial(D){let F={};for(let E of I.objectKeys(this.shape)){let B=this.shape[E];if(D&&!D[E])F[E]=B;else F[E]=B.optional()}return new Z({...this._def,shape:()=>F})}required(D){let F={};for(let E of I.objectKeys(this.shape))if(D&&!D[E])F[E]=this.shape[E];else{let $=this.shape[E];while($ instanceof XD)$=$._def.innerType;F[E]=$}return new Z({...this._def,shape:()=>F})}keyof(){return H8(I.objectKeys(this.shape))}};Z.create=(D,F)=>{return new Z({shape:()=>D,unknownKeys:"strip",catchall:WD.create(),typeName:u.ZodObject,...V(F)})};Z.strictCreate=(D,F)=>{return new Z({shape:()=>D,unknownKeys:"strict",catchall:WD.create(),typeName:u.ZodObject,...V(F)})};Z.lazycreate=(D,F)=>{return new Z({shape:D,unknownKeys:"strip",catchall:WD.create(),typeName:u.ZodObject,...V(F)})};F2=class F2 extends O{_parse(D){let{ctx:F}=this._processInputParams(D),E=this._def.options;function B($){for(let X of $)if(X.result.status==="valid")return X.result;for(let X of $)if(X.result.status==="dirty")return F.common.issues.push(...X.ctx.common.issues),X.result;let q=$.map((X)=>new p(X.ctx.common.issues));return H(F,{code:Y.invalid_union,unionErrors:q}),R}if(F.common.async)return Promise.all(E.map(async($)=>{let q={...F,common:{...F.common,issues:[]},parent:null};return{result:await $._parseAsync({data:F.data,path:F.path,parent:q}),ctx:q}})).then(B);else{let $=void 0,q=[];for(let Q of E){let C={...F,common:{...F.common,issues:[]},parent:null},J=Q._parseSync({data:F.data,path:F.path,parent:C});if(J.status==="valid")return J;else if(J.status==="dirty"&&!$)$={result:J,ctx:C};if(C.common.issues.length)q.push(C.common.issues)}if($)return F.common.issues.push(...$.ctx.common.issues),$.result;let X=q.map((Q)=>new p(Q));return H(F,{code:Y.invalid_union,unionErrors:X}),R}}get options(){return this._def.options}};F2.create=(D,F)=>{return new F2({options:D,typeName:u.ZodUnion,...V(F)})};h2=class h2 extends O{_parse(D){let{ctx:F}=this._processInputParams(D);if(F.parsedType!==W.object)return H(F,{code:Y.invalid_type,expected:W.object,received:F.parsedType}),R;let E=this.discriminator,B=F.data[E],$=this.optionsMap.get(B);if(!$)return H(F,{code:Y.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[E]}),R;if(F.common.async)return $._parseAsync({data:F.data,path:F.path,parent:F});else return $._parseSync({data:F.data,path:F.path,parent:F})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(D,F,E){let B=new Map;for(let $ of F){let q=zD($.shape[D]);if(!q.length)throw Error(`A discriminator value for key \`${D}\` could not be extracted from all schema options`);for(let X of q){if(B.has(X))throw Error(`Discriminator property ${String(D)} has duplicate value ${String(X)}`);B.set(X,$)}}return new h2({typeName:u.ZodDiscriminatedUnion,discriminator:D,options:F,optionsMap:B,...V(E)})}};E2=class E2 extends O{_parse(D){let{status:F,ctx:E}=this._processInputParams(D),B=($,q)=>{if(x2($)||x2(q))return R;let X=v0($.value,q.value);if(!X.valid)return H(E,{code:Y.invalid_intersection_types}),R;if(y2($)||y2(q))F.dirty();return{status:F.value,value:X.data}};if(E.common.async)return Promise.all([this._def.left._parseAsync({data:E.data,path:E.path,parent:E}),this._def.right._parseAsync({data:E.data,path:E.path,parent:E})]).then(([$,q])=>B($,q));else return B(this._def.left._parseSync({data:E.data,path:E.path,parent:E}),this._def.right._parseSync({data:E.data,path:E.path,parent:E}))}};E2.create=(D,F,E)=>{return new E2({left:D,right:F,typeName:u.ZodIntersection,...V(E)})};GD=class GD extends O{_parse(D){let{status:F,ctx:E}=this._processInputParams(D);if(E.parsedType!==W.array)return H(E,{code:Y.invalid_type,expected:W.array,received:E.parsedType}),R;if(E.data.length<this._def.items.length)return H(E,{code:Y.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),R;if(!this._def.rest&&E.data.length>this._def.items.length)H(E,{code:Y.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),F.dirty();let $=[...E.data].map((q,X)=>{let Q=this._def.items[X]||this._def.rest;if(!Q)return null;return Q._parse(new QD(E,q,E.path,X))}).filter((q)=>!!q);if(E.common.async)return Promise.all($).then((q)=>{return h.mergeArray(F,q)});else return h.mergeArray(F,$)}get items(){return this._def.items}rest(D){return new GD({...this._def,rest:D})}};GD.create=(D,F)=>{if(!Array.isArray(D))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new GD({items:D,typeName:u.ZodTuple,rest:null,...V(F)})};L2=class L2 extends O{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(D){let{status:F,ctx:E}=this._processInputParams(D);if(E.parsedType!==W.object)return H(E,{code:Y.invalid_type,expected:W.object,received:E.parsedType}),R;let B=[],$=this._def.keyType,q=this._def.valueType;for(let X in E.data)B.push({key:$._parse(new QD(E,X,E.path,X)),value:q._parse(new QD(E,E.data[X],E.path,X)),alwaysSet:X in E.data});if(E.common.async)return h.mergeObjectAsync(F,B);else return h.mergeObjectSync(F,B)}get element(){return this._def.valueType}static create(D,F,E){if(F instanceof O)return new L2({keyType:D,valueType:F,typeName:u.ZodRecord,...V(E)});return new L2({keyType:$D.create(),valueType:D,typeName:u.ZodRecord,...V(F)})}};V2=class V2 extends O{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(D){let{status:F,ctx:E}=this._processInputParams(D);if(E.parsedType!==W.map)return H(E,{code:Y.invalid_type,expected:W.map,received:E.parsedType}),R;let B=this._def.keyType,$=this._def.valueType,q=[...E.data.entries()].map(([X,Q],C)=>{return{key:B._parse(new QD(E,X,E.path,[C,"key"])),value:$._parse(new QD(E,Q,E.path,[C,"value"]))}});if(E.common.async){let X=new Map;return Promise.resolve().then(async()=>{for(let Q of q){let C=await Q.key,J=await Q.value;if(C.status==="aborted"||J.status==="aborted")return R;if(C.status==="dirty"||J.status==="dirty")F.dirty();X.set(C.value,J.value)}return{status:F.value,value:X}})}else{let X=new Map;for(let Q of q){let{key:C,value:J}=Q;if(C.status==="aborted"||J.status==="aborted")return R;if(C.status==="dirty"||J.status==="dirty")F.dirty();X.set(C.value,J.value)}return{status:F.value,value:X}}}};V2.create=(D,F,E)=>{return new V2({valueType:F,keyType:D,typeName:u.ZodMap,...V(E)})};gD=class gD extends O{_parse(D){let{status:F,ctx:E}=this._processInputParams(D);if(E.parsedType!==W.set)return H(E,{code:Y.invalid_type,expected:W.set,received:E.parsedType}),R;let B=this._def;if(B.minSize!==null){if(E.data.size<B.minSize.value)H(E,{code:Y.too_small,minimum:B.minSize.value,type:"set",inclusive:!0,exact:!1,message:B.minSize.message}),F.dirty()}if(B.maxSize!==null){if(E.data.size>B.maxSize.value)H(E,{code:Y.too_big,maximum:B.maxSize.value,type:"set",inclusive:!0,exact:!1,message:B.maxSize.message}),F.dirty()}let $=this._def.valueType;function q(Q){let C=new Set;for(let J of Q){if(J.status==="aborted")return R;if(J.status==="dirty")F.dirty();C.add(J.value)}return{status:F.value,value:C}}let X=[...E.data.values()].map((Q,C)=>$._parse(new QD(E,Q,E.path,C)));if(E.common.async)return Promise.all(X).then((Q)=>q(Q));else return q(X)}min(D,F){return new gD({...this._def,minSize:{value:D,message:A.toString(F)}})}max(D,F){return new gD({...this._def,maxSize:{value:D,message:A.toString(F)}})}size(D,F){return this.min(D,F).max(D,F)}nonempty(D){return this.min(1,D)}};gD.create=(D,F)=>{return new gD({valueType:D,minSize:null,maxSize:null,typeName:u.ZodSet,...V(F)})};sD=class sD extends O{constructor(){super(...arguments);this.validate=this.implement}_parse(D){let{ctx:F}=this._processInputParams(D);if(F.parsedType!==W.function)return H(F,{code:Y.invalid_type,expected:W.function,received:F.parsedType}),R;function E(X,Q){return u2({data:X,path:F.path,errorMaps:[F.common.contextualErrorMap,F.schemaErrorMap,rD(),RD].filter((C)=>!!C),issueData:{code:Y.invalid_arguments,argumentsError:Q}})}function B(X,Q){return u2({data:X,path:F.path,errorMaps:[F.common.contextualErrorMap,F.schemaErrorMap,rD(),RD].filter((C)=>!!C),issueData:{code:Y.invalid_return_type,returnTypeError:Q}})}let $={errorMap:F.common.contextualErrorMap},q=F.data;if(this._def.returns instanceof mD){let X=this;return l(async function(...Q){let C=new p([]),J=await X._def.args.parseAsync(Q,$).catch((j)=>{throw C.addIssue(E(Q,j)),C}),_=await Reflect.apply(q,this,J);return await X._def.returns._def.type.parseAsync(_,$).catch((j)=>{throw C.addIssue(B(_,j)),C})})}else{let X=this;return l(function(...Q){let C=X._def.args.safeParse(Q,$);if(!C.success)throw new p([E(Q,C.error)]);let J=Reflect.apply(q,this,C.data),_=X._def.returns.safeParse(J,$);if(!_.success)throw new p([B(J,_.error)]);return _.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...D){return new sD({...this._def,args:GD.create(D).rest(ND.create())})}returns(D){return new sD({...this._def,returns:D})}implement(D){return this.parse(D)}strictImplement(D){return this.parse(D)}static create(D,F,E){return new sD({args:D?D:GD.create([]).rest(ND.create()),returns:F||ND.create(),typeName:u.ZodFunction,...V(E)})}};B2=class B2 extends O{get schema(){return this._def.getter()}_parse(D){let{ctx:F}=this._processInputParams(D);return this._def.getter()._parse({data:F.data,path:F.path,parent:F})}};B2.create=(D,F)=>{return new B2({getter:D,typeName:u.ZodLazy,...V(F)})};$2=class $2 extends O{_parse(D){if(D.data!==this._def.value){let F=this._getOrReturnCtx(D);return H(F,{received:F.data,code:Y.invalid_literal,expected:this._def.value}),R}return{status:"valid",value:D.data}}get value(){return this._def.value}};$2.create=(D,F)=>{return new $2({value:D,typeName:u.ZodLiteral,...V(F)})};wD=class wD extends O{_parse(D){if(typeof D.data!=="string"){let F=this._getOrReturnCtx(D),E=this._def.values;return H(F,{expected:I.joinValues(E),received:F.parsedType,code:Y.invalid_type}),R}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(D.data)){let F=this._getOrReturnCtx(D),E=this._def.values;return H(F,{received:F.data,code:Y.invalid_enum_value,options:E}),R}return l(D.data)}get options(){return this._def.values}get enum(){let D={};for(let F of this._def.values)D[F]=F;return D}get Values(){let D={};for(let F of this._def.values)D[F]=F;return D}get Enum(){let D={};for(let F of this._def.values)D[F]=F;return D}extract(D,F=this._def){return wD.create(D,{...this._def,...F})}exclude(D,F=this._def){return wD.create(this.options.filter((E)=>!D.includes(E)),{...this._def,...F})}};wD.create=H8;q2=class q2 extends O{_parse(D){let F=I.getValidEnumValues(this._def.values),E=this._getOrReturnCtx(D);if(E.parsedType!==W.string&&E.parsedType!==W.number){let B=I.objectValues(F);return H(E,{expected:I.joinValues(B),received:E.parsedType,code:Y.invalid_type}),R}if(!this._cache)this._cache=new Set(I.getValidEnumValues(this._def.values));if(!this._cache.has(D.data)){let B=I.objectValues(F);return H(E,{received:E.data,code:Y.invalid_enum_value,options:B}),R}return l(D.data)}get enum(){return this._def.values}};q2.create=(D,F)=>{return new q2({values:D,typeName:u.ZodNativeEnum,...V(F)})};mD=class mD extends O{unwrap(){return this._def.type}_parse(D){let{ctx:F}=this._processInputParams(D);if(F.parsedType!==W.promise&&F.common.async===!1)return H(F,{code:Y.invalid_type,expected:W.promise,received:F.parsedType}),R;let E=F.parsedType===W.promise?F.data:Promise.resolve(F.data);return l(E.then((B)=>{return this._def.type.parseAsync(B,{path:F.path,errorMap:F.common.contextualErrorMap})}))}};mD.create=(D,F)=>{return new mD({type:D,typeName:u.ZodPromise,...V(F)})};CD=class CD extends O{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===u.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(D){let{status:F,ctx:E}=this._processInputParams(D),B=this._def.effect||null,$={addIssue:(q)=>{if(H(E,q),q.fatal)F.abort();else F.dirty()},get path(){return E.path}};if($.addIssue=$.addIssue.bind($),B.type==="preprocess"){let q=B.transform(E.data,$);if(E.common.async)return Promise.resolve(q).then(async(X)=>{if(F.value==="aborted")return R;let Q=await this._def.schema._parseAsync({data:X,path:E.path,parent:E});if(Q.status==="aborted")return R;if(Q.status==="dirty")return xD(Q.value);if(F.value==="dirty")return xD(Q.value);return Q});else{if(F.value==="aborted")return R;let X=this._def.schema._parseSync({data:q,path:E.path,parent:E});if(X.status==="aborted")return R;if(X.status==="dirty")return xD(X.value);if(F.value==="dirty")return xD(X.value);return X}}if(B.type==="refinement"){let q=(X)=>{let Q=B.refinement(X,$);if(E.common.async)return Promise.resolve(Q);if(Q instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return X};if(E.common.async===!1){let X=this._def.schema._parseSync({data:E.data,path:E.path,parent:E});if(X.status==="aborted")return R;if(X.status==="dirty")F.dirty();return q(X.value),{status:F.value,value:X.value}}else return this._def.schema._parseAsync({data:E.data,path:E.path,parent:E}).then((X)=>{if(X.status==="aborted")return R;if(X.status==="dirty")F.dirty();return q(X.value).then(()=>{return{status:F.value,value:X.value}})})}if(B.type==="transform")if(E.common.async===!1){let q=this._def.schema._parseSync({data:E.data,path:E.path,parent:E});if(!VD(q))return R;let X=B.transform(q.value,$);if(X instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:F.value,value:X}}else return this._def.schema._parseAsync({data:E.data,path:E.path,parent:E}).then((q)=>{if(!VD(q))return R;return Promise.resolve(B.transform(q.value,$)).then((X)=>({status:F.value,value:X}))});I.assertNever(B)}};CD.create=(D,F,E)=>{return new CD({schema:D,typeName:u.ZodEffects,effect:F,...V(E)})};CD.createWithPreprocess=(D,F,E)=>{return new CD({schema:F,effect:{type:"preprocess",transform:D},typeName:u.ZodEffects,...V(E)})};XD=class XD extends O{_parse(D){if(this._getType(D)===W.undefined)return l(void 0);return this._def.innerType._parse(D)}unwrap(){return this._def.innerType}};XD.create=(D,F)=>{return new XD({innerType:D,typeName:u.ZodOptional,...V(F)})};uD=class uD extends O{_parse(D){if(this._getType(D)===W.null)return l(null);return this._def.innerType._parse(D)}unwrap(){return this._def.innerType}};uD.create=(D,F)=>{return new uD({innerType:D,typeName:u.ZodNullable,...V(F)})};X2=class X2 extends O{_parse(D){let{ctx:F}=this._processInputParams(D),E=F.data;if(F.parsedType===W.undefined)E=this._def.defaultValue();return this._def.innerType._parse({data:E,path:F.path,parent:F})}removeDefault(){return this._def.innerType}};X2.create=(D,F)=>{return new X2({innerType:D,typeName:u.ZodDefault,defaultValue:typeof F.default==="function"?F.default:()=>F.default,...V(F)})};Q2=class Q2 extends O{_parse(D){let{ctx:F}=this._processInputParams(D),E={...F,common:{...F.common,issues:[]}},B=this._def.innerType._parse({data:E.data,path:E.path,parent:{...E}});if(aD(B))return B.then(($)=>{return{status:"valid",value:$.status==="valid"?$.value:this._def.catchValue({get error(){return new p(E.common.issues)},input:E.data})}});else return{status:"valid",value:B.status==="valid"?B.value:this._def.catchValue({get error(){return new p(E.common.issues)},input:E.data})}}removeCatch(){return this._def.innerType}};Q2.create=(D,F)=>{return new Q2({innerType:D,typeName:u.ZodCatch,catchValue:typeof F.catch==="function"?F.catch:()=>F.catch,...V(F)})};N2=class N2 extends O{_parse(D){if(this._getType(D)!==W.nan){let E=this._getOrReturnCtx(D);return H(E,{code:Y.invalid_type,expected:W.nan,received:E.parsedType}),R}return{status:"valid",value:D.data}}};N2.create=(D)=>{return new N2({typeName:u.ZodNaN,...V(D)})};E1=Symbol("zod_brand");g2=class g2 extends O{_parse(D){let{ctx:F}=this._processInputParams(D),E=F.data;return this._def.type._parse({data:E,path:F.path,parent:F})}unwrap(){return this._def.type}};K2=class K2 extends O{_parse(D){let{status:F,ctx:E}=this._processInputParams(D);if(E.common.async)return(async()=>{let $=await this._def.in._parseAsync({data:E.data,path:E.path,parent:E});if($.status==="aborted")return R;if($.status==="dirty")return F.dirty(),xD($.value);else return this._def.out._parseAsync({data:$.value,path:E.path,parent:E})})();else{let B=this._def.in._parseSync({data:E.data,path:E.path,parent:E});if(B.status==="aborted")return R;if(B.status==="dirty")return F.dirty(),{status:"dirty",value:B.value};else return this._def.out._parseSync({data:B.value,path:E.path,parent:E})}}static create(D,F){return new K2({in:D,out:F,typeName:u.ZodPipeline})}};C2=class C2 extends O{_parse(D){let F=this._def.innerType._parse(D),E=(B)=>{if(VD(B))B.value=Object.freeze(B.value);return B};return aD(F)?F.then((B)=>E(B)):E(F)}unwrap(){return this._def.innerType}};C2.create=(D,F)=>{return new C2({innerType:D,typeName:u.ZodReadonly,...V(F)})};B1={object:Z.lazycreate};(function(D){D.ZodString="ZodString",D.ZodNumber="ZodNumber",D.ZodNaN="ZodNaN",D.ZodBigInt="ZodBigInt",D.ZodBoolean="ZodBoolean",D.ZodDate="ZodDate",D.ZodSymbol="ZodSymbol",D.ZodUndefined="ZodUndefined",D.ZodNull="ZodNull",D.ZodAny="ZodAny",D.ZodUnknown="ZodUnknown",D.ZodNever="ZodNever",D.ZodVoid="ZodVoid",D.ZodArray="ZodArray",D.ZodObject="ZodObject",D.ZodUnion="ZodUnion",D.ZodDiscriminatedUnion="ZodDiscriminatedUnion",D.ZodIntersection="ZodIntersection",D.ZodTuple="ZodTuple",D.ZodRecord="ZodRecord",D.ZodMap="ZodMap",D.ZodSet="ZodSet",D.ZodFunction="ZodFunction",D.ZodLazy="ZodLazy",D.ZodLiteral="ZodLiteral",D.ZodEnum="ZodEnum",D.ZodEffects="ZodEffects",D.ZodNativeEnum="ZodNativeEnum",D.ZodOptional="ZodOptional",D.ZodNullable="ZodNullable",D.ZodDefault="ZodDefault",D.ZodCatch="ZodCatch",D.ZodPromise="ZodPromise",D.ZodBranded="ZodBranded",D.ZodPipeline="ZodPipeline",D.ZodReadonly="ZodReadonly"})(u||(u={}));A8=$D.create,R8=KD.create,q1=N2.create,X1=OD.create,z8=tD.create,Q1=yD.create,C1=j2.create,J1=eD.create,_1=D2.create,Y1=hD.create,W1=ND.create,G1=WD.create,H1=U2.create,M1=qD.create,A1=Z.create,R1=Z.strictCreate,z1=F2.create,u1=h2.create,j1=E2.create,U1=GD.create,L1=L2.create,V1=V2.create,N1=gD.create,K1=sD.create,O1=B2.create,w1=$2.create,S1=wD.create,I1=q2.create,P1=mD.create,T1=CD.create,b1=XD.create,k1=uD.create,f1=CD.createWithPreprocess,v1=K2.create,h1={string:(D)=>$D.create({...D,coerce:!0}),number:(D)=>KD.create({...D,coerce:!0}),boolean:(D)=>tD.create({...D,coerce:!0}),bigint:(D)=>OD.create({...D,coerce:!0}),date:(D)=>yD.create({...D,coerce:!0})},g1=R});var o={};r8(o,{void:()=>H1,util:()=>I,unknown:()=>W1,union:()=>z1,undefined:()=>J1,tuple:()=>U1,transformer:()=>T1,symbol:()=>C1,string:()=>A8,strictObject:()=>R1,setErrorMap:()=>k6,set:()=>N1,record:()=>L1,quotelessJson:()=>T6,promise:()=>P1,preprocess:()=>f1,pipeline:()=>v1,ostring:()=>Z1,optional:()=>b1,onumber:()=>x1,oboolean:()=>y1,objectUtil:()=>T0,object:()=>A1,number:()=>R8,nullable:()=>k1,null:()=>_1,never:()=>G1,nativeEnum:()=>I1,nan:()=>q1,map:()=>V1,makeIssue:()=>u2,literal:()=>w1,lazy:()=>O1,late:()=>B1,isValid:()=>VD,isDirty:()=>y2,isAsync:()=>aD,isAborted:()=>x2,intersection:()=>j1,instanceof:()=>$1,getParsedType:()=>YD,getErrorMap:()=>rD,function:()=>K1,enum:()=>S1,effect:()=>T1,discriminatedUnion:()=>u1,defaultErrorMap:()=>RD,datetimeRegex:()=>G8,date:()=>Q1,custom:()=>M8,coerce:()=>h1,boolean:()=>z8,bigint:()=>X1,array:()=>M1,any:()=>Y1,addIssueToContext:()=>H,ZodVoid:()=>U2,ZodUnknown:()=>ND,ZodUnion:()=>F2,ZodUndefined:()=>eD,ZodType:()=>O,ZodTuple:()=>GD,ZodTransformer:()=>CD,ZodSymbol:()=>j2,ZodString:()=>$D,ZodSet:()=>gD,ZodSchema:()=>O,ZodRecord:()=>L2,ZodReadonly:()=>C2,ZodPromise:()=>mD,ZodPipeline:()=>K2,ZodParsedType:()=>W,ZodOptional:()=>XD,ZodObject:()=>Z,ZodNumber:()=>KD,ZodNullable:()=>uD,ZodNull:()=>D2,ZodNever:()=>WD,ZodNativeEnum:()=>q2,ZodNaN:()=>N2,ZodMap:()=>V2,ZodLiteral:()=>$2,ZodLazy:()=>B2,ZodIssueCode:()=>Y,ZodIntersection:()=>E2,ZodFunction:()=>sD,ZodFirstPartyTypeKind:()=>u,ZodError:()=>p,ZodEnum:()=>wD,ZodEffects:()=>CD,ZodDiscriminatedUnion:()=>h2,ZodDefault:()=>X2,ZodDate:()=>yD,ZodCatch:()=>Q2,ZodBranded:()=>g2,ZodBoolean:()=>tD,ZodBigInt:()=>OD,ZodArray:()=>qD,ZodAny:()=>hD,Schema:()=>O,ParseStatus:()=>h,OK:()=>l,NEVER:()=>g1,INVALID:()=>R,EMPTY_PATH:()=>f6,DIRTY:()=>xD,BRAND:()=>E1});var Z0=JD(()=>{Z2();k0();Q8();z2();u8();v2()});var j8=JD(()=>{Z0();Z0()});var B3=jD(E3(),1),{program:X5,createCommand:Q5,createArgument:C5,createOption:J5,CommanderError:_5,InvalidArgumentError:Y5,InvalidOptionArgumentError:W5,Command:$3,Argument:G5,Option:H5,Help:M5}=B3.default;var q3="3.260227.2";var AD=(D,F=[])=>D.name==="up"||F.includes("vim")&&D.name==="k"||F.includes("emacs")&&D.ctrl&&D.name==="p",ID=(D,F=[])=>D.name==="down"||F.includes("vim")&&D.name==="j"||F.includes("emacs")&&D.ctrl&&D.name==="n";var _2=(D)=>D.name==="backspace",PD=(D)=>D.name==="tab",B0=(D)=>"1234567890".includes(D.name),e=(D)=>D.name==="enter"||D.name==="return";class $0 extends Error{name="AbortPromptError";message="Prompt was aborted";constructor(D){super();this.cause=D?.cause}}class q0 extends Error{name="CancelPromptError";message="Prompt was canceled"}class S2 extends Error{name="ExitPromptError"}class X0 extends Error{name="HookError"}class Y2 extends Error{name="ValidationError"}import{AsyncResource as gF}from"async_hooks";import{AsyncLocalStorage as xF,AsyncResource as yF}from"async_hooks";var X3=new xF;function hF(D){return{rl:D,hooks:[],hooksCleanup:[],hooksEffect:[],index:0,handleChange(){}}}function Q3(D,F){let E=hF(D);return X3.run(E,()=>{function B($){E.handleChange=()=>{E.index=0,$()},E.handleChange()}return F(B)})}function TD(){let D=X3.getStore();if(!D)throw new X0("[Inquirer] Hook functions can only be called from within a prompt");return D}function Q0(){return TD().rl}function C0(D){let F=(...E)=>{let B=TD(),$=!1,q=B.handleChange;B.handleChange=()=>{$=!0};let X=D(...E);if($)q();return B.handleChange=q,X};return yF.bind(F)}function lD(D){let F=TD(),{index:E}=F,B={get(){return F.hooks[E]},set(q){F.hooks[E]=q},initialized:E in F.hooks},$=D(B);return F.index++,$}function C3(){TD().handleChange()}var bD={queue(D){let F=TD(),{index:E}=F;F.hooksEffect.push(()=>{F.hooksCleanup[E]?.();let B=D(Q0());if(B!=null&&typeof B!=="function")throw new Y2("useEffect return value must be a cleanup function or nothing.");F.hooksCleanup[E]=B})},run(){let D=TD();C0(()=>{D.hooksEffect.forEach((F)=>{F()}),D.hooksEffect.length=0})()},clearAll(){let D=TD();D.hooksCleanup.forEach((F)=>{F?.()}),D.hooksEffect.length=0,D.hooksCleanup.length=0}};function k(D){return lD((F)=>{let E=gF.bind(function(q){if(F.get()!==q)F.set(q),C3()});if(F.initialized)return[F.get(),E];let B=typeof D==="function"?D():D;return F.set(B),[B,E]})}function DD(D,F){lD((E)=>{let B=E.get();if(!Array.isArray(B)||F.some((q,X)=>!Object.is(q,B[X])))bD.queue(D);E.set(F)})}var r=jD(W2(),1);import _D from"process";function pF(){if(_D.platform!=="win32")return _D.env.TERM!=="linux";return Boolean(_D.env.WT_SESSION)||Boolean(_D.env.TERMINUS_SUBLIME)||_D.env.ConEmuTask==="{cmd::Cmder}"||_D.env.TERM_PROGRAM==="Terminus-Sublime"||_D.env.TERM_PROGRAM==="vscode"||_D.env.TERM==="xterm-256color"||_D.env.TERM==="alacritty"||_D.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var _3={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"\u2588",squareDarkShade:"\u2593",squareMediumShade:"\u2592",squareLightShade:"\u2591",squareTop:"\u2580",squareBottom:"\u2584",squareLeft:"\u258C",squareRight:"\u2590",squareCenter:"\u25A0",bullet:"\u25CF",dot:"\u2024",ellipsis:"\u2026",pointerSmall:"\u203A",triangleUp:"\u25B2",triangleUpSmall:"\u25B4",triangleDown:"\u25BC",triangleDownSmall:"\u25BE",triangleLeftSmall:"\u25C2",triangleRightSmall:"\u25B8",home:"\u2302",heart:"\u2665",musicNote:"\u266A",musicNoteBeamed:"\u266B",arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",arrowLeftRight:"\u2194",arrowUpDown:"\u2195",almostEqual:"\u2248",notEqual:"\u2260",lessOrEqual:"\u2264",greaterOrEqual:"\u2265",identical:"\u2261",infinity:"\u221E",subscriptZero:"\u2080",subscriptOne:"\u2081",subscriptTwo:"\u2082",subscriptThree:"\u2083",subscriptFour:"\u2084",subscriptFive:"\u2085",subscriptSix:"\u2086",subscriptSeven:"\u2087",subscriptEight:"\u2088",subscriptNine:"\u2089",oneHalf:"\xBD",oneThird:"\u2153",oneQuarter:"\xBC",oneFifth:"\u2155",oneSixth:"\u2159",oneEighth:"\u215B",twoThirds:"\u2154",twoFifths:"\u2156",threeQuarters:"\xBE",threeFifths:"\u2157",threeEighths:"\u215C",fourFifths:"\u2158",fiveSixths:"\u215A",fiveEighths:"\u215D",sevenEighths:"\u215E",line:"\u2500",lineBold:"\u2501",lineDouble:"\u2550",lineDashed0:"\u2504",lineDashed1:"\u2505",lineDashed2:"\u2508",lineDashed3:"\u2509",lineDashed4:"\u254C",lineDashed5:"\u254D",lineDashed6:"\u2574",lineDashed7:"\u2576",lineDashed8:"\u2578",lineDashed9:"\u257A",lineDashed10:"\u257C",lineDashed11:"\u257E",lineDashed12:"\u2212",lineDashed13:"\u2013",lineDashed14:"\u2010",lineDashed15:"\u2043",lineVertical:"\u2502",lineVerticalBold:"\u2503",lineVerticalDouble:"\u2551",lineVerticalDashed0:"\u2506",lineVerticalDashed1:"\u2507",lineVerticalDashed2:"\u250A",lineVerticalDashed3:"\u250B",lineVerticalDashed4:"\u254E",lineVerticalDashed5:"\u254F",lineVerticalDashed6:"\u2575",lineVerticalDashed7:"\u2577",lineVerticalDashed8:"\u2579",lineVerticalDashed9:"\u257B",lineVerticalDashed10:"\u257D",lineVerticalDashed11:"\u257F",lineDownLeft:"\u2510",lineDownLeftArc:"\u256E",lineDownBoldLeftBold:"\u2513",lineDownBoldLeft:"\u2512",lineDownLeftBold:"\u2511",lineDownDoubleLeftDouble:"\u2557",lineDownDoubleLeft:"\u2556",lineDownLeftDouble:"\u2555",lineDownRight:"\u250C",lineDownRightArc:"\u256D",lineDownBoldRightBold:"\u250F",lineDownBoldRight:"\u250E",lineDownRightBold:"\u250D",lineDownDoubleRightDouble:"\u2554",lineDownDoubleRight:"\u2553",lineDownRightDouble:"\u2552",lineUpLeft:"\u2518",lineUpLeftArc:"\u256F",lineUpBoldLeftBold:"\u251B",lineUpBoldLeft:"\u251A",lineUpLeftBold:"\u2519",lineUpDoubleLeftDouble:"\u255D",lineUpDoubleLeft:"\u255C",lineUpLeftDouble:"\u255B",lineUpRight:"\u2514",lineUpRightArc:"\u2570",lineUpBoldRightBold:"\u2517",lineUpBoldRight:"\u2516",lineUpRightBold:"\u2515",lineUpDoubleRightDouble:"\u255A",lineUpDoubleRight:"\u2559",lineUpRightDouble:"\u2558",lineUpDownLeft:"\u2524",lineUpBoldDownBoldLeftBold:"\u252B",lineUpBoldDownBoldLeft:"\u2528",lineUpDownLeftBold:"\u2525",lineUpBoldDownLeftBold:"\u2529",lineUpDownBoldLeftBold:"\u252A",lineUpDownBoldLeft:"\u2527",lineUpBoldDownLeft:"\u2526",lineUpDoubleDownDoubleLeftDouble:"\u2563",lineUpDoubleDownDoubleLeft:"\u2562",lineUpDownLeftDouble:"\u2561",lineUpDownRight:"\u251C",lineUpBoldDownBoldRightBold:"\u2523",lineUpBoldDownBoldRight:"\u2520",lineUpDownRightBold:"\u251D",lineUpBoldDownRightBold:"\u2521",lineUpDownBoldRightBold:"\u2522",lineUpDownBoldRight:"\u251F",lineUpBoldDownRight:"\u251E",lineUpDoubleDownDoubleRightDouble:"\u2560",lineUpDoubleDownDoubleRight:"\u255F",lineUpDownRightDouble:"\u255E",lineDownLeftRight:"\u252C",lineDownBoldLeftBoldRightBold:"\u2533",lineDownLeftBoldRightBold:"\u252F",lineDownBoldLeftRight:"\u2530",lineDownBoldLeftBoldRight:"\u2531",lineDownBoldLeftRightBold:"\u2532",lineDownLeftRightBold:"\u252E",lineDownLeftBoldRight:"\u252D",lineDownDoubleLeftDoubleRightDouble:"\u2566",lineDownDoubleLeftRight:"\u2565",lineDownLeftDoubleRightDouble:"\u2564",lineUpLeftRight:"\u2534",lineUpBoldLeftBoldRightBold:"\u253B",lineUpLeftBoldRightBold:"\u2537",lineUpBoldLeftRight:"\u2538",lineUpBoldLeftBoldRight:"\u2539",lineUpBoldLeftRightBold:"\u253A",lineUpLeftRightBold:"\u2536",lineUpLeftBoldRight:"\u2535",lineUpDoubleLeftDoubleRightDouble:"\u2569",lineUpDoubleLeftRight:"\u2568",lineUpLeftDoubleRightDouble:"\u2567",lineUpDownLeftRight:"\u253C",lineUpBoldDownBoldLeftBoldRightBold:"\u254B",lineUpDownBoldLeftBoldRightBold:"\u2548",lineUpBoldDownLeftBoldRightBold:"\u2547",lineUpBoldDownBoldLeftRightBold:"\u254A",lineUpBoldDownBoldLeftBoldRight:"\u2549",lineUpBoldDownLeftRight:"\u2540",lineUpDownBoldLeftRight:"\u2541",lineUpDownLeftBoldRight:"\u253D",lineUpDownLeftRightBold:"\u253E",lineUpBoldDownBoldLeftRight:"\u2542",lineUpDownLeftBoldRightBold:"\u253F",lineUpBoldDownLeftBoldRight:"\u2543",lineUpBoldDownLeftRightBold:"\u2544",lineUpDownBoldLeftBoldRight:"\u2545",lineUpDownBoldLeftRightBold:"\u2546",lineUpDoubleDownDoubleLeftDoubleRightDouble:"\u256C",lineUpDoubleDownDoubleLeftRight:"\u256B",lineUpDownLeftDoubleRightDouble:"\u256A",lineCross:"\u2573",lineBackslash:"\u2572",lineSlash:"\u2571"},Y3={tick:"\u2714",info:"\u2139",warning:"\u26A0",cross:"\u2718",squareSmall:"\u25FB",squareSmallFilled:"\u25FC",circle:"\u25EF",circleFilled:"\u25C9",circleDotted:"\u25CC",circleDouble:"\u25CE",circleCircle:"\u24DE",circleCross:"\u24E7",circlePipe:"\u24BE",radioOn:"\u25C9",radioOff:"\u25EF",checkboxOn:"\u2612",checkboxOff:"\u2610",checkboxCircleOn:"\u24E7",checkboxCircleOff:"\u24BE",pointer:"\u276F",triangleUpOutline:"\u25B3",triangleLeft:"\u25C0",triangleRight:"\u25B6",lozenge:"\u25C6",lozengeOutline:"\u25C7",hamburger:"\u2630",smiley:"\u32E1",mustache:"\u0DF4",star:"\u2605",play:"\u25B6",nodejs:"\u2B22",oneSeventh:"\u2150",oneNinth:"\u2151",oneTenth:"\u2152"},dF={tick:"\u221A",info:"i",warning:"\u203C",cross:"\xD7",squareSmall:"\u25A1",squareSmallFilled:"\u25A0",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(\u25CB)",circleCross:"(\xD7)",circlePipe:"(\u2502)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[\xD7]",checkboxOff:"[ ]",checkboxCircleOn:"(\xD7)",checkboxCircleOff:"( )",pointer:">",triangleUpOutline:"\u2206",triangleLeft:"\u25C4",triangleRight:"\u25BA",lozenge:"\u2666",lozengeOutline:"\u25CA",hamburger:"\u2261",smiley:"\u263A",mustache:"\u250C\u2500\u2510",star:"\u2736",play:"\u25BA",nodejs:"\u2666",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"},cF={..._3,...Y3},nF={..._3,...dF},iF=pF(),rF=iF?cF:nF,LD=rF,P5=Object.entries(Y3);var W3={prefix:{idle:r.default.blue("?"),done:r.default.green(LD.tick)},spinner:{interval:80,frames:["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"].map((D)=>r.default.yellow(D))},style:{answer:r.default.cyan,message:r.default.bold,error:(D)=>r.default.red(`> ${D}`),defaultAnswer:(D)=>r.default.dim(`(${D})`),help:r.default.dim,highlight:r.default.cyan,key:(D)=>r.default.cyan(r.default.bold(`<${D}>`))}};function G3(D){if(typeof D!=="object"||D===null)return!1;let F=D;while(Object.getPrototypeOf(F)!==null)F=Object.getPrototypeOf(F);return Object.getPrototypeOf(D)===F}function H3(...D){let F={};for(let E of D)for(let[B,$]of Object.entries(E)){let q=F[B];F[B]=G3(q)&&G3($)?H3(q,$):$}return F}function c(...D){let F=[W3,...D.filter((E)=>E!=null)];return H3(...F)}function FD({status:D="idle",theme:F}){let[E,B]=k(!1),[$,q]=k(0),{prefix:X,spinner:Q}=c(F);if(DD(()=>{if(D==="loading"){let J,_=-1,G=setTimeout(()=>{B(!0),J=setInterval(()=>{_=_+1,q(_%Q.frames.length)},Q.interval)},300);return()=>{clearTimeout(G),clearInterval(J)}}else B(!1)},[D]),E)return Q.frames[$];return typeof X==="string"?X:X[D==="loading"?"idle":D]??X.idle}function kD(D,F){return lD((E)=>{let B=E.get();if(!B||B.dependencies.length!==F.length||B.dependencies.some(($,q)=>$!==F[q])){let $=D();return E.set({value:$,dependencies:F}),$}return B.value})}function fD(D){return k({current:D})[0]}function ED(D){let F=fD(D);F.current=D,DD((E)=>{let B=!1,$=C0((q,X)=>{if(B)return;F.current(X,E)});return E.input.on("keypress",$),()=>{B=!0,E.input.removeListener("keypress",$)}},[])}var p3=jD(A3(),1),d3=jD(l3(),1);function M2(D,F){return D.split(`
31
31
  `).flatMap((E)=>d3.default(E,F,{trim:!1,hard:!0}).split(`
32
32
  `).map((B)=>B.trimEnd())).join(`
33
33
  `)}function T2(){return p3.default({defaultWidth:80,output:Q0().output})}function A6({active:D,renderedItems:F,pageSize:E,loop:B}){let $=fD({lastPointer:D,lastActive:void 0}),{lastPointer:q,lastActive:X}=$.current,Q=Math.floor(E/2),C=F.reduce((G,j)=>G+j.length,0),J=F.slice(0,D).reduce((G,j)=>G+j.length,0),_=J;if(C>E)if(B){if(_=q,X!=null&&X<D&&D-X<E)_=Math.min(Q,Math.abs(D-X)===1?Math.min(q+(F[X]?.length??0),Math.max(J,q)):q+D-X)}else{let G=F.slice(D).reduce((j,z)=>j+z.length,0);_=G<E-Q?E-G:Math.min(J,Q)}return $.current.lastPointer=_,$.current.lastActive=D,_}function A2({items:D,active:F,renderItem:E,pageSize:B,loop:$=!0}){let q=T2(),X=(U)=>(U%D.length+D.length)%D.length,Q=D.map((U,K)=>{if(U==null)return[];return M2(E({item:U,index:K,isActive:K===F}),q).split(`
package/dist/genie.js CHANGED
@@ -50,7 +50,7 @@ Expecting one of '${$.join("', '")}'`);let B=`${D}Help`;return this.on(B,(X)=>{l
50
50
  `;await OY(B,X,"utf-8")}async function uV(D,F){let $=l3(D,F),B=[];try{let J=(await Q9($,"utf-8")).trim().split(`
51
51
  `);for(let Q of J)if(Q.trim())try{B.push(JSON.parse(Q))}catch{}}catch(X){if(X.code!=="ENOENT")throw X}return B}async function ZY(D){let F=m3(D),$=[];try{let B=await Y9(F);for(let X of B)if(X.endsWith(".jsonl")){let J=g3(F,X);try{let Y=(await Q9(J,"utf-8")).trim().split(`
52
52
  `);for(let E of Y)if(E.trim())try{$.push(JSON.parse(E))}catch{}}catch{}}}catch(B){if(B.code!=="ENOENT")throw B}return $.sort((B,X)=>{let J=new Date(B.timestamp).getTime(),Q=new Date(X.timestamp).getTime();return J-Q}),$}async function p3(D,F){let $=l3(D,F);try{await CY($)}catch(B){if(B.code!=="ENOENT")throw B}}async function fV(D){let F=m3(D),$=[];try{let B=await Y9(F);for(let X of B)if(X.endsWith(".jsonl"))$.push(X.replace(".jsonl",""))}catch(B){if(B.code!=="ENOENT")throw B}return $}function J9(D,F){let $={timestamp:D.timestamp,sessionId:D.sessionId,cwd:D.cwd,gitBranch:D.gitBranch,paneId:F?.paneId,wishId:F?.wishSlug,taskId:F?.taskId};if(D.type==="user"&&!D.parentUuid)return{...$,type:"session_start"};if(D.type==="assistant"&&D.toolCalls&&D.toolCalls.length>0){let B=D.toolCalls[0];return{...$,type:"tool_call",toolName:B.name,toolInput:B.input,toolCallId:B.id}}if(D.type==="progress"&&D.data){let B=D.data;if(B.type==="permission_request"||B.waitingForPermission)return{...$,type:"permission_request",toolName:B.toolName||void 0}}if(D.type==="progress"&&D.data){let B=D.data;if(B.type==="session_end"||B.type==="conversation_end")return{...$,type:"session_end",exitReason:B.reason||"completed"}}return null}async function wY(D){try{let F=D.startsWith("%")?D:`%${D}`;return(await u(`display-message -p -t '${F}' '#{pane_current_path}'`)).trim()||void 0}catch{return}}async function kV(D,F={}){try{if(F.all){await IY(F);return}if(!D)console.error("Error: pane-id is required (or use --all for all workers)"),process.exit(1);let $=D.startsWith("%")?D:`%${D}`,B=await M6($),X=B?{paneId:B.paneId,wishSlug:B.wishSlug,taskId:B.taskId}:void 0,J=B?.repoPath;if(!J)J=await wY($);if(!J)console.error(`Could not determine working directory for pane ${$}`),process.exit(1);let Q=await B9(J);if(!Q)console.error(`No Claude Code logs found for pane ${$}`),console.error(`Working directory: ${J}`),process.exit(1);if(F.follow||F.emit){if(F.emit){let E=l3($);console.error(`Writing events to ${E}...`)}console.error(`Tailing events from ${Q.logPath}...`),console.error(`Press Ctrl+C to stop.
53
- `);let Y=await $9(Q.logPath,async(E)=>{let H=J9(E,X);if(H){if(!F.emit||F.json||F.follow)m6(H,F);if(F.emit)await bY(H,$)}});process.on("SIGINT",()=>{Y(),process.exit(0)}),await new Promise(()=>{})}else{let Y=await F9(Q.logPath),E=[];for(let W of Y){let V=J9(W,X);if(V)E.push(V)}let H=F.lines||20,q=E.slice(-H);if(F.json)console.log(JSON.stringify(q,null,2));else if(q.length===0)console.log("No events found.");else for(let W of q)m6(W,F)}}catch($){console.error(`Error: ${$.message}`),process.exit(1)}}async function IY(D){let F=await m();if(F.length===0){if(D.json)console.log("[]");else console.log("No active workers found.");return}let $=await ZY(),B=new Set(F.map((Y)=>Y.paneId)),X=$.filter((Y)=>Y.paneId&&B.has(Y.paneId)),J=D.lines||50,Q=X.slice(-J);if(D.json)console.log(JSON.stringify(Q,null,2));else if(Q.length===0)console.log("No events found from active workers."),console.log("Hint: Use --emit flag when tailing to write events to files.");else for(let Y of Q)m6(Y,D)}function m6(D,F){if(F.json)console.log(JSON.stringify(D));else{let $=new Date(D.timestamp).toLocaleTimeString(),B=D.wishId?`[${D.wishId}] `:"";switch(D.type){case"session_start":console.log(`${$} ${B}SESSION_START - ${D.cwd}`);break;case"tool_call":let X=D.toolInput?Object.entries(D.toolInput).slice(0,2).map(([J,Q])=>`${J}=${JSON.stringify(Q).slice(0,30)}`).join(", "):"";console.log(`${$} ${B}TOOL_CALL - ${D.toolName}(${X})`);break;case"permission_request":console.log(`${$} ${B}PERMISSION_REQUEST - ${D.toolName||"unknown"}`);break;case"session_end":console.log(`${$} ${B}SESSION_END - ${D.exitReason||"completed"}`);break}}}var l6=P(()=>{X9();D0();sD()});var Q1=gD(J1(),1),{program:AE,createCommand:KE,createArgument:zE,createOption:RE,CommanderError:ME,InvalidArgumentError:LE,InvalidOptionArgumentError:jE,Command:Y1,Argument:OE,Option:CE,Help:NE}=Q1.default;var E1="3.260227.1";var ID=(D,F=[])=>D.name==="up"||F.includes("vim")&&D.name==="k"||F.includes("emacs")&&D.ctrl&&D.name==="p",D2=(D,F=[])=>D.name==="down"||F.includes("vim")&&D.name==="j"||F.includes("emacs")&&D.ctrl&&D.name==="n";var _0=(D)=>D.name==="backspace",F2=(D)=>D.name==="tab",X8=(D)=>"1234567890".includes(D.name),qD=(D)=>D.name==="enter"||D.name==="return";class J8 extends Error{name="AbortPromptError";message="Prompt was aborted";constructor(D){super();this.cause=D?.cause}}class Q8 extends Error{name="CancelPromptError";message="Prompt was canceled"}class e0 extends Error{name="ExitPromptError"}class Y8 extends Error{name="HookError"}class U0 extends Error{name="ValidationError"}import{AsyncResource as L4}from"async_hooks";import{AsyncLocalStorage as z4,AsyncResource as R4}from"async_hooks";var H1=new z4;function M4(D){return{rl:D,hooks:[],hooksCleanup:[],hooksEffect:[],index:0,handleChange(){}}}function q1(D,F){let $=M4(D);return H1.run($,()=>{function B(X){$.handleChange=()=>{$.index=0,X()},$.handleChange()}return F(B)})}function $2(){let D=H1.getStore();if(!D)throw new Y8("[Inquirer] Hook functions can only be called from within a prompt");return D}function E8(){return $2().rl}function H8(D){let F=(...$)=>{let B=$2(),X=!1,J=B.handleChange;B.handleChange=()=>{X=!0};let Q=D(...$);if(X)J();return B.handleChange=J,Q};return R4.bind(F)}function S2(D){let F=$2(),{index:$}=F,B={get(){return F.hooks[$]},set(J){F.hooks[$]=J},initialized:$ in F.hooks},X=D(B);return F.index++,X}function W1(){$2().handleChange()}var B2={queue(D){let F=$2(),{index:$}=F;F.hooksEffect.push(()=>{F.hooksCleanup[$]?.();let B=D(E8());if(B!=null&&typeof B!=="function")throw new U0("useEffect return value must be a cleanup function or nothing.");F.hooksCleanup[$]=B})},run(){let D=$2();H8(()=>{D.hooksEffect.forEach((F)=>{F()}),D.hooksEffect.length=0})()},clearAll(){let D=$2();D.hooksCleanup.forEach((F)=>{F?.()}),D.hooksEffect.length=0,D.hooksCleanup.length=0}};function k(D){return S2((F)=>{let $=L4.bind(function(J){if(F.get()!==J)F.set(J),W1()});if(F.initialized)return[F.get(),$];let B=typeof D==="function"?D():D;return F.set(B),[B,$]})}function WD(D,F){S2(($)=>{let B=$.get();if(!Array.isArray(B)||F.some((J,Q)=>!Object.is(J,B[Q])))B2.queue(D);$.set(F)})}var QD=gD(G0(),1);import CD from"process";function C4(){if(CD.platform!=="win32")return CD.env.TERM!=="linux";return Boolean(CD.env.WT_SESSION)||Boolean(CD.env.TERMINUS_SUBLIME)||CD.env.ConEmuTask==="{cmd::Cmder}"||CD.env.TERM_PROGRAM==="Terminus-Sublime"||CD.env.TERM_PROGRAM==="vscode"||CD.env.TERM==="xterm-256color"||CD.env.TERM==="alacritty"||CD.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var U1={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"\u2588",squareDarkShade:"\u2593",squareMediumShade:"\u2592",squareLightShade:"\u2591",squareTop:"\u2580",squareBottom:"\u2584",squareLeft:"\u258C",squareRight:"\u2590",squareCenter:"\u25A0",bullet:"\u25CF",dot:"\u2024",ellipsis:"\u2026",pointerSmall:"\u203A",triangleUp:"\u25B2",triangleUpSmall:"\u25B4",triangleDown:"\u25BC",triangleDownSmall:"\u25BE",triangleLeftSmall:"\u25C2",triangleRightSmall:"\u25B8",home:"\u2302",heart:"\u2665",musicNote:"\u266A",musicNoteBeamed:"\u266B",arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",arrowLeftRight:"\u2194",arrowUpDown:"\u2195",almostEqual:"\u2248",notEqual:"\u2260",lessOrEqual:"\u2264",greaterOrEqual:"\u2265",identical:"\u2261",infinity:"\u221E",subscriptZero:"\u2080",subscriptOne:"\u2081",subscriptTwo:"\u2082",subscriptThree:"\u2083",subscriptFour:"\u2084",subscriptFive:"\u2085",subscriptSix:"\u2086",subscriptSeven:"\u2087",subscriptEight:"\u2088",subscriptNine:"\u2089",oneHalf:"\xBD",oneThird:"\u2153",oneQuarter:"\xBC",oneFifth:"\u2155",oneSixth:"\u2159",oneEighth:"\u215B",twoThirds:"\u2154",twoFifths:"\u2156",threeQuarters:"\xBE",threeFifths:"\u2157",threeEighths:"\u215C",fourFifths:"\u2158",fiveSixths:"\u215A",fiveEighths:"\u215D",sevenEighths:"\u215E",line:"\u2500",lineBold:"\u2501",lineDouble:"\u2550",lineDashed0:"\u2504",lineDashed1:"\u2505",lineDashed2:"\u2508",lineDashed3:"\u2509",lineDashed4:"\u254C",lineDashed5:"\u254D",lineDashed6:"\u2574",lineDashed7:"\u2576",lineDashed8:"\u2578",lineDashed9:"\u257A",lineDashed10:"\u257C",lineDashed11:"\u257E",lineDashed12:"\u2212",lineDashed13:"\u2013",lineDashed14:"\u2010",lineDashed15:"\u2043",lineVertical:"\u2502",lineVerticalBold:"\u2503",lineVerticalDouble:"\u2551",lineVerticalDashed0:"\u2506",lineVerticalDashed1:"\u2507",lineVerticalDashed2:"\u250A",lineVerticalDashed3:"\u250B",lineVerticalDashed4:"\u254E",lineVerticalDashed5:"\u254F",lineVerticalDashed6:"\u2575",lineVerticalDashed7:"\u2577",lineVerticalDashed8:"\u2579",lineVerticalDashed9:"\u257B",lineVerticalDashed10:"\u257D",lineVerticalDashed11:"\u257F",lineDownLeft:"\u2510",lineDownLeftArc:"\u256E",lineDownBoldLeftBold:"\u2513",lineDownBoldLeft:"\u2512",lineDownLeftBold:"\u2511",lineDownDoubleLeftDouble:"\u2557",lineDownDoubleLeft:"\u2556",lineDownLeftDouble:"\u2555",lineDownRight:"\u250C",lineDownRightArc:"\u256D",lineDownBoldRightBold:"\u250F",lineDownBoldRight:"\u250E",lineDownRightBold:"\u250D",lineDownDoubleRightDouble:"\u2554",lineDownDoubleRight:"\u2553",lineDownRightDouble:"\u2552",lineUpLeft:"\u2518",lineUpLeftArc:"\u256F",lineUpBoldLeftBold:"\u251B",lineUpBoldLeft:"\u251A",lineUpLeftBold:"\u2519",lineUpDoubleLeftDouble:"\u255D",lineUpDoubleLeft:"\u255C",lineUpLeftDouble:"\u255B",lineUpRight:"\u2514",lineUpRightArc:"\u2570",lineUpBoldRightBold:"\u2517",lineUpBoldRight:"\u2516",lineUpRightBold:"\u2515",lineUpDoubleRightDouble:"\u255A",lineUpDoubleRight:"\u2559",lineUpRightDouble:"\u2558",lineUpDownLeft:"\u2524",lineUpBoldDownBoldLeftBold:"\u252B",lineUpBoldDownBoldLeft:"\u2528",lineUpDownLeftBold:"\u2525",lineUpBoldDownLeftBold:"\u2529",lineUpDownBoldLeftBold:"\u252A",lineUpDownBoldLeft:"\u2527",lineUpBoldDownLeft:"\u2526",lineUpDoubleDownDoubleLeftDouble:"\u2563",lineUpDoubleDownDoubleLeft:"\u2562",lineUpDownLeftDouble:"\u2561",lineUpDownRight:"\u251C",lineUpBoldDownBoldRightBold:"\u2523",lineUpBoldDownBoldRight:"\u2520",lineUpDownRightBold:"\u251D",lineUpBoldDownRightBold:"\u2521",lineUpDownBoldRightBold:"\u2522",lineUpDownBoldRight:"\u251F",lineUpBoldDownRight:"\u251E",lineUpDoubleDownDoubleRightDouble:"\u2560",lineUpDoubleDownDoubleRight:"\u255F",lineUpDownRightDouble:"\u255E",lineDownLeftRight:"\u252C",lineDownBoldLeftBoldRightBold:"\u2533",lineDownLeftBoldRightBold:"\u252F",lineDownBoldLeftRight:"\u2530",lineDownBoldLeftBoldRight:"\u2531",lineDownBoldLeftRightBold:"\u2532",lineDownLeftRightBold:"\u252E",lineDownLeftBoldRight:"\u252D",lineDownDoubleLeftDoubleRightDouble:"\u2566",lineDownDoubleLeftRight:"\u2565",lineDownLeftDoubleRightDouble:"\u2564",lineUpLeftRight:"\u2534",lineUpBoldLeftBoldRightBold:"\u253B",lineUpLeftBoldRightBold:"\u2537",lineUpBoldLeftRight:"\u2538",lineUpBoldLeftBoldRight:"\u2539",lineUpBoldLeftRightBold:"\u253A",lineUpLeftRightBold:"\u2536",lineUpLeftBoldRight:"\u2535",lineUpDoubleLeftDoubleRightDouble:"\u2569",lineUpDoubleLeftRight:"\u2568",lineUpLeftDoubleRightDouble:"\u2567",lineUpDownLeftRight:"\u253C",lineUpBoldDownBoldLeftBoldRightBold:"\u254B",lineUpDownBoldLeftBoldRightBold:"\u2548",lineUpBoldDownLeftBoldRightBold:"\u2547",lineUpBoldDownBoldLeftRightBold:"\u254A",lineUpBoldDownBoldLeftBoldRight:"\u2549",lineUpBoldDownLeftRight:"\u2540",lineUpDownBoldLeftRight:"\u2541",lineUpDownLeftBoldRight:"\u253D",lineUpDownLeftRightBold:"\u253E",lineUpBoldDownBoldLeftRight:"\u2542",lineUpDownLeftBoldRightBold:"\u253F",lineUpBoldDownLeftBoldRight:"\u2543",lineUpBoldDownLeftRightBold:"\u2544",lineUpDownBoldLeftBoldRight:"\u2545",lineUpDownBoldLeftRightBold:"\u2546",lineUpDoubleDownDoubleLeftDoubleRightDouble:"\u256C",lineUpDoubleDownDoubleLeftRight:"\u256B",lineUpDownLeftDoubleRightDouble:"\u256A",lineCross:"\u2573",lineBackslash:"\u2572",lineSlash:"\u2571"},G1={tick:"\u2714",info:"\u2139",warning:"\u26A0",cross:"\u2718",squareSmall:"\u25FB",squareSmallFilled:"\u25FC",circle:"\u25EF",circleFilled:"\u25C9",circleDotted:"\u25CC",circleDouble:"\u25CE",circleCircle:"\u24DE",circleCross:"\u24E7",circlePipe:"\u24BE",radioOn:"\u25C9",radioOff:"\u25EF",checkboxOn:"\u2612",checkboxOff:"\u2610",checkboxCircleOn:"\u24E7",checkboxCircleOff:"\u24BE",pointer:"\u276F",triangleUpOutline:"\u25B3",triangleLeft:"\u25C0",triangleRight:"\u25B6",lozenge:"\u25C6",lozengeOutline:"\u25C7",hamburger:"\u2630",smiley:"\u32E1",mustache:"\u0DF4",star:"\u2605",play:"\u25B6",nodejs:"\u2B22",oneSeventh:"\u2150",oneNinth:"\u2151",oneTenth:"\u2152"},N4={tick:"\u221A",info:"i",warning:"\u203C",cross:"\xD7",squareSmall:"\u25A1",squareSmallFilled:"\u25A0",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(\u25CB)",circleCross:"(\xD7)",circlePipe:"(\u2502)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[\xD7]",checkboxOff:"[ ]",checkboxCircleOn:"(\xD7)",checkboxCircleOff:"( )",pointer:">",triangleUpOutline:"\u2206",triangleLeft:"\u25C4",triangleRight:"\u25BA",lozenge:"\u2666",lozengeOutline:"\u25CA",hamburger:"\u2261",smiley:"\u263A",mustache:"\u250C\u2500\u2510",star:"\u2736",play:"\u25BA",nodejs:"\u2666",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"},T4={...U1,...G1},S4={...U1,...N4},b4=C4(),Z4=b4?T4:S4,mD=Z4,gE=Object.entries(G1);var V1={prefix:{idle:QD.default.blue("?"),done:QD.default.green(mD.tick)},spinner:{interval:80,frames:["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"].map((D)=>QD.default.yellow(D))},style:{answer:QD.default.cyan,message:QD.default.bold,error:(D)=>QD.default.red(`> ${D}`),defaultAnswer:(D)=>QD.default.dim(`(${D})`),help:QD.default.dim,highlight:QD.default.cyan,key:(D)=>QD.default.cyan(QD.default.bold(`<${D}>`))}};function A1(D){if(typeof D!=="object"||D===null)return!1;let F=D;while(Object.getPrototypeOf(F)!==null)F=Object.getPrototypeOf(F);return Object.getPrototypeOf(D)===F}function K1(...D){let F={};for(let $ of D)for(let[B,X]of Object.entries($)){let J=F[B];F[B]=A1(J)&&A1(X)?K1(J,X):X}return F}function XD(...D){let F=[V1,...D.filter(($)=>$!=null)];return K1(...F)}function _D({status:D="idle",theme:F}){let[$,B]=k(!1),[X,J]=k(0),{prefix:Q,spinner:Y}=XD(F);if(WD(()=>{if(D==="loading"){let H,q=-1,W=setTimeout(()=>{B(!0),H=setInterval(()=>{q=q+1,J(q%Y.frames.length)},Y.interval)},300);return()=>{clearTimeout(W),clearInterval(H)}}else B(!1)},[D]),$)return Y.frames[X];return typeof Q==="string"?Q:Q[D==="loading"?"idle":D]??Q.idle}function X2(D,F){return S2(($)=>{let B=$.get();if(!B||B.dependencies.length!==F.length||B.dependencies.some((X,J)=>X!==F[J])){let X=D();return $.set({value:X,dependencies:F}),X}return B.value})}function J2(D){return k({current:D})[0]}function UD(D){let F=J2(D);F.current=D,WD(($)=>{let B=!1,X=H8((J,Q)=>{if(B)return;F.current(Q,$)});return $.input.on("keypress",X),()=>{B=!0,$.input.removeListener("keypress",X)}},[])}var n1=gD(R1(),1),i1=gD(d1(),1);function K0(D,F){return D.split(`
53
+ `);let Y=await $9(Q.logPath,async(E)=>{let H=J9(E,X);if(H){if(!F.emit||F.json||F.follow)m6(H,F);if(F.emit)await bY(H,$)}});process.on("SIGINT",()=>{Y(),process.exit(0)}),await new Promise(()=>{})}else{let Y=await F9(Q.logPath),E=[];for(let W of Y){let V=J9(W,X);if(V)E.push(V)}let H=F.lines||20,q=E.slice(-H);if(F.json)console.log(JSON.stringify(q,null,2));else if(q.length===0)console.log("No events found.");else for(let W of q)m6(W,F)}}catch($){console.error(`Error: ${$.message}`),process.exit(1)}}async function IY(D){let F=await m();if(F.length===0){if(D.json)console.log("[]");else console.log("No active workers found.");return}let $=await ZY(),B=new Set(F.map((Y)=>Y.paneId)),X=$.filter((Y)=>Y.paneId&&B.has(Y.paneId)),J=D.lines||50,Q=X.slice(-J);if(D.json)console.log(JSON.stringify(Q,null,2));else if(Q.length===0)console.log("No events found from active workers."),console.log("Hint: Use --emit flag when tailing to write events to files.");else for(let Y of Q)m6(Y,D)}function m6(D,F){if(F.json)console.log(JSON.stringify(D));else{let $=new Date(D.timestamp).toLocaleTimeString(),B=D.wishId?`[${D.wishId}] `:"";switch(D.type){case"session_start":console.log(`${$} ${B}SESSION_START - ${D.cwd}`);break;case"tool_call":let X=D.toolInput?Object.entries(D.toolInput).slice(0,2).map(([J,Q])=>`${J}=${JSON.stringify(Q).slice(0,30)}`).join(", "):"";console.log(`${$} ${B}TOOL_CALL - ${D.toolName}(${X})`);break;case"permission_request":console.log(`${$} ${B}PERMISSION_REQUEST - ${D.toolName||"unknown"}`);break;case"session_end":console.log(`${$} ${B}SESSION_END - ${D.exitReason||"completed"}`);break}}}var l6=P(()=>{X9();D0();sD()});var Q1=gD(J1(),1),{program:AE,createCommand:KE,createArgument:zE,createOption:RE,CommanderError:ME,InvalidArgumentError:LE,InvalidOptionArgumentError:jE,Command:Y1,Argument:OE,Option:CE,Help:NE}=Q1.default;var E1="3.260227.2";var ID=(D,F=[])=>D.name==="up"||F.includes("vim")&&D.name==="k"||F.includes("emacs")&&D.ctrl&&D.name==="p",D2=(D,F=[])=>D.name==="down"||F.includes("vim")&&D.name==="j"||F.includes("emacs")&&D.ctrl&&D.name==="n";var _0=(D)=>D.name==="backspace",F2=(D)=>D.name==="tab",X8=(D)=>"1234567890".includes(D.name),qD=(D)=>D.name==="enter"||D.name==="return";class J8 extends Error{name="AbortPromptError";message="Prompt was aborted";constructor(D){super();this.cause=D?.cause}}class Q8 extends Error{name="CancelPromptError";message="Prompt was canceled"}class e0 extends Error{name="ExitPromptError"}class Y8 extends Error{name="HookError"}class U0 extends Error{name="ValidationError"}import{AsyncResource as L4}from"async_hooks";import{AsyncLocalStorage as z4,AsyncResource as R4}from"async_hooks";var H1=new z4;function M4(D){return{rl:D,hooks:[],hooksCleanup:[],hooksEffect:[],index:0,handleChange(){}}}function q1(D,F){let $=M4(D);return H1.run($,()=>{function B(X){$.handleChange=()=>{$.index=0,X()},$.handleChange()}return F(B)})}function $2(){let D=H1.getStore();if(!D)throw new Y8("[Inquirer] Hook functions can only be called from within a prompt");return D}function E8(){return $2().rl}function H8(D){let F=(...$)=>{let B=$2(),X=!1,J=B.handleChange;B.handleChange=()=>{X=!0};let Q=D(...$);if(X)J();return B.handleChange=J,Q};return R4.bind(F)}function S2(D){let F=$2(),{index:$}=F,B={get(){return F.hooks[$]},set(J){F.hooks[$]=J},initialized:$ in F.hooks},X=D(B);return F.index++,X}function W1(){$2().handleChange()}var B2={queue(D){let F=$2(),{index:$}=F;F.hooksEffect.push(()=>{F.hooksCleanup[$]?.();let B=D(E8());if(B!=null&&typeof B!=="function")throw new U0("useEffect return value must be a cleanup function or nothing.");F.hooksCleanup[$]=B})},run(){let D=$2();H8(()=>{D.hooksEffect.forEach((F)=>{F()}),D.hooksEffect.length=0})()},clearAll(){let D=$2();D.hooksCleanup.forEach((F)=>{F?.()}),D.hooksEffect.length=0,D.hooksCleanup.length=0}};function k(D){return S2((F)=>{let $=L4.bind(function(J){if(F.get()!==J)F.set(J),W1()});if(F.initialized)return[F.get(),$];let B=typeof D==="function"?D():D;return F.set(B),[B,$]})}function WD(D,F){S2(($)=>{let B=$.get();if(!Array.isArray(B)||F.some((J,Q)=>!Object.is(J,B[Q])))B2.queue(D);$.set(F)})}var QD=gD(G0(),1);import CD from"process";function C4(){if(CD.platform!=="win32")return CD.env.TERM!=="linux";return Boolean(CD.env.WT_SESSION)||Boolean(CD.env.TERMINUS_SUBLIME)||CD.env.ConEmuTask==="{cmd::Cmder}"||CD.env.TERM_PROGRAM==="Terminus-Sublime"||CD.env.TERM_PROGRAM==="vscode"||CD.env.TERM==="xterm-256color"||CD.env.TERM==="alacritty"||CD.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var U1={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"\u2588",squareDarkShade:"\u2593",squareMediumShade:"\u2592",squareLightShade:"\u2591",squareTop:"\u2580",squareBottom:"\u2584",squareLeft:"\u258C",squareRight:"\u2590",squareCenter:"\u25A0",bullet:"\u25CF",dot:"\u2024",ellipsis:"\u2026",pointerSmall:"\u203A",triangleUp:"\u25B2",triangleUpSmall:"\u25B4",triangleDown:"\u25BC",triangleDownSmall:"\u25BE",triangleLeftSmall:"\u25C2",triangleRightSmall:"\u25B8",home:"\u2302",heart:"\u2665",musicNote:"\u266A",musicNoteBeamed:"\u266B",arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",arrowLeftRight:"\u2194",arrowUpDown:"\u2195",almostEqual:"\u2248",notEqual:"\u2260",lessOrEqual:"\u2264",greaterOrEqual:"\u2265",identical:"\u2261",infinity:"\u221E",subscriptZero:"\u2080",subscriptOne:"\u2081",subscriptTwo:"\u2082",subscriptThree:"\u2083",subscriptFour:"\u2084",subscriptFive:"\u2085",subscriptSix:"\u2086",subscriptSeven:"\u2087",subscriptEight:"\u2088",subscriptNine:"\u2089",oneHalf:"\xBD",oneThird:"\u2153",oneQuarter:"\xBC",oneFifth:"\u2155",oneSixth:"\u2159",oneEighth:"\u215B",twoThirds:"\u2154",twoFifths:"\u2156",threeQuarters:"\xBE",threeFifths:"\u2157",threeEighths:"\u215C",fourFifths:"\u2158",fiveSixths:"\u215A",fiveEighths:"\u215D",sevenEighths:"\u215E",line:"\u2500",lineBold:"\u2501",lineDouble:"\u2550",lineDashed0:"\u2504",lineDashed1:"\u2505",lineDashed2:"\u2508",lineDashed3:"\u2509",lineDashed4:"\u254C",lineDashed5:"\u254D",lineDashed6:"\u2574",lineDashed7:"\u2576",lineDashed8:"\u2578",lineDashed9:"\u257A",lineDashed10:"\u257C",lineDashed11:"\u257E",lineDashed12:"\u2212",lineDashed13:"\u2013",lineDashed14:"\u2010",lineDashed15:"\u2043",lineVertical:"\u2502",lineVerticalBold:"\u2503",lineVerticalDouble:"\u2551",lineVerticalDashed0:"\u2506",lineVerticalDashed1:"\u2507",lineVerticalDashed2:"\u250A",lineVerticalDashed3:"\u250B",lineVerticalDashed4:"\u254E",lineVerticalDashed5:"\u254F",lineVerticalDashed6:"\u2575",lineVerticalDashed7:"\u2577",lineVerticalDashed8:"\u2579",lineVerticalDashed9:"\u257B",lineVerticalDashed10:"\u257D",lineVerticalDashed11:"\u257F",lineDownLeft:"\u2510",lineDownLeftArc:"\u256E",lineDownBoldLeftBold:"\u2513",lineDownBoldLeft:"\u2512",lineDownLeftBold:"\u2511",lineDownDoubleLeftDouble:"\u2557",lineDownDoubleLeft:"\u2556",lineDownLeftDouble:"\u2555",lineDownRight:"\u250C",lineDownRightArc:"\u256D",lineDownBoldRightBold:"\u250F",lineDownBoldRight:"\u250E",lineDownRightBold:"\u250D",lineDownDoubleRightDouble:"\u2554",lineDownDoubleRight:"\u2553",lineDownRightDouble:"\u2552",lineUpLeft:"\u2518",lineUpLeftArc:"\u256F",lineUpBoldLeftBold:"\u251B",lineUpBoldLeft:"\u251A",lineUpLeftBold:"\u2519",lineUpDoubleLeftDouble:"\u255D",lineUpDoubleLeft:"\u255C",lineUpLeftDouble:"\u255B",lineUpRight:"\u2514",lineUpRightArc:"\u2570",lineUpBoldRightBold:"\u2517",lineUpBoldRight:"\u2516",lineUpRightBold:"\u2515",lineUpDoubleRightDouble:"\u255A",lineUpDoubleRight:"\u2559",lineUpRightDouble:"\u2558",lineUpDownLeft:"\u2524",lineUpBoldDownBoldLeftBold:"\u252B",lineUpBoldDownBoldLeft:"\u2528",lineUpDownLeftBold:"\u2525",lineUpBoldDownLeftBold:"\u2529",lineUpDownBoldLeftBold:"\u252A",lineUpDownBoldLeft:"\u2527",lineUpBoldDownLeft:"\u2526",lineUpDoubleDownDoubleLeftDouble:"\u2563",lineUpDoubleDownDoubleLeft:"\u2562",lineUpDownLeftDouble:"\u2561",lineUpDownRight:"\u251C",lineUpBoldDownBoldRightBold:"\u2523",lineUpBoldDownBoldRight:"\u2520",lineUpDownRightBold:"\u251D",lineUpBoldDownRightBold:"\u2521",lineUpDownBoldRightBold:"\u2522",lineUpDownBoldRight:"\u251F",lineUpBoldDownRight:"\u251E",lineUpDoubleDownDoubleRightDouble:"\u2560",lineUpDoubleDownDoubleRight:"\u255F",lineUpDownRightDouble:"\u255E",lineDownLeftRight:"\u252C",lineDownBoldLeftBoldRightBold:"\u2533",lineDownLeftBoldRightBold:"\u252F",lineDownBoldLeftRight:"\u2530",lineDownBoldLeftBoldRight:"\u2531",lineDownBoldLeftRightBold:"\u2532",lineDownLeftRightBold:"\u252E",lineDownLeftBoldRight:"\u252D",lineDownDoubleLeftDoubleRightDouble:"\u2566",lineDownDoubleLeftRight:"\u2565",lineDownLeftDoubleRightDouble:"\u2564",lineUpLeftRight:"\u2534",lineUpBoldLeftBoldRightBold:"\u253B",lineUpLeftBoldRightBold:"\u2537",lineUpBoldLeftRight:"\u2538",lineUpBoldLeftBoldRight:"\u2539",lineUpBoldLeftRightBold:"\u253A",lineUpLeftRightBold:"\u2536",lineUpLeftBoldRight:"\u2535",lineUpDoubleLeftDoubleRightDouble:"\u2569",lineUpDoubleLeftRight:"\u2568",lineUpLeftDoubleRightDouble:"\u2567",lineUpDownLeftRight:"\u253C",lineUpBoldDownBoldLeftBoldRightBold:"\u254B",lineUpDownBoldLeftBoldRightBold:"\u2548",lineUpBoldDownLeftBoldRightBold:"\u2547",lineUpBoldDownBoldLeftRightBold:"\u254A",lineUpBoldDownBoldLeftBoldRight:"\u2549",lineUpBoldDownLeftRight:"\u2540",lineUpDownBoldLeftRight:"\u2541",lineUpDownLeftBoldRight:"\u253D",lineUpDownLeftRightBold:"\u253E",lineUpBoldDownBoldLeftRight:"\u2542",lineUpDownLeftBoldRightBold:"\u253F",lineUpBoldDownLeftBoldRight:"\u2543",lineUpBoldDownLeftRightBold:"\u2544",lineUpDownBoldLeftBoldRight:"\u2545",lineUpDownBoldLeftRightBold:"\u2546",lineUpDoubleDownDoubleLeftDoubleRightDouble:"\u256C",lineUpDoubleDownDoubleLeftRight:"\u256B",lineUpDownLeftDoubleRightDouble:"\u256A",lineCross:"\u2573",lineBackslash:"\u2572",lineSlash:"\u2571"},G1={tick:"\u2714",info:"\u2139",warning:"\u26A0",cross:"\u2718",squareSmall:"\u25FB",squareSmallFilled:"\u25FC",circle:"\u25EF",circleFilled:"\u25C9",circleDotted:"\u25CC",circleDouble:"\u25CE",circleCircle:"\u24DE",circleCross:"\u24E7",circlePipe:"\u24BE",radioOn:"\u25C9",radioOff:"\u25EF",checkboxOn:"\u2612",checkboxOff:"\u2610",checkboxCircleOn:"\u24E7",checkboxCircleOff:"\u24BE",pointer:"\u276F",triangleUpOutline:"\u25B3",triangleLeft:"\u25C0",triangleRight:"\u25B6",lozenge:"\u25C6",lozengeOutline:"\u25C7",hamburger:"\u2630",smiley:"\u32E1",mustache:"\u0DF4",star:"\u2605",play:"\u25B6",nodejs:"\u2B22",oneSeventh:"\u2150",oneNinth:"\u2151",oneTenth:"\u2152"},N4={tick:"\u221A",info:"i",warning:"\u203C",cross:"\xD7",squareSmall:"\u25A1",squareSmallFilled:"\u25A0",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(\u25CB)",circleCross:"(\xD7)",circlePipe:"(\u2502)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[\xD7]",checkboxOff:"[ ]",checkboxCircleOn:"(\xD7)",checkboxCircleOff:"( )",pointer:">",triangleUpOutline:"\u2206",triangleLeft:"\u25C4",triangleRight:"\u25BA",lozenge:"\u2666",lozengeOutline:"\u25CA",hamburger:"\u2261",smiley:"\u263A",mustache:"\u250C\u2500\u2510",star:"\u2736",play:"\u25BA",nodejs:"\u2666",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"},T4={...U1,...G1},S4={...U1,...N4},b4=C4(),Z4=b4?T4:S4,mD=Z4,gE=Object.entries(G1);var V1={prefix:{idle:QD.default.blue("?"),done:QD.default.green(mD.tick)},spinner:{interval:80,frames:["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"].map((D)=>QD.default.yellow(D))},style:{answer:QD.default.cyan,message:QD.default.bold,error:(D)=>QD.default.red(`> ${D}`),defaultAnswer:(D)=>QD.default.dim(`(${D})`),help:QD.default.dim,highlight:QD.default.cyan,key:(D)=>QD.default.cyan(QD.default.bold(`<${D}>`))}};function A1(D){if(typeof D!=="object"||D===null)return!1;let F=D;while(Object.getPrototypeOf(F)!==null)F=Object.getPrototypeOf(F);return Object.getPrototypeOf(D)===F}function K1(...D){let F={};for(let $ of D)for(let[B,X]of Object.entries($)){let J=F[B];F[B]=A1(J)&&A1(X)?K1(J,X):X}return F}function XD(...D){let F=[V1,...D.filter(($)=>$!=null)];return K1(...F)}function _D({status:D="idle",theme:F}){let[$,B]=k(!1),[X,J]=k(0),{prefix:Q,spinner:Y}=XD(F);if(WD(()=>{if(D==="loading"){let H,q=-1,W=setTimeout(()=>{B(!0),H=setInterval(()=>{q=q+1,J(q%Y.frames.length)},Y.interval)},300);return()=>{clearTimeout(W),clearInterval(H)}}else B(!1)},[D]),$)return Y.frames[X];return typeof Q==="string"?Q:Q[D==="loading"?"idle":D]??Q.idle}function X2(D,F){return S2(($)=>{let B=$.get();if(!B||B.dependencies.length!==F.length||B.dependencies.some((X,J)=>X!==F[J])){let X=D();return $.set({value:X,dependencies:F}),X}return B.value})}function J2(D){return k({current:D})[0]}function UD(D){let F=J2(D);F.current=D,WD(($)=>{let B=!1,X=H8((J,Q)=>{if(B)return;F.current(Q,$)});return $.input.on("keypress",X),()=>{B=!0,$.input.removeListener("keypress",X)}},[])}var n1=gD(R1(),1),i1=gD(d1(),1);function K0(D,F){return D.split(`
54
54
  `).flatMap(($)=>i1.default($,F,{trim:!1,hard:!0}).split(`
55
55
  `).map((B)=>B.trimEnd())).join(`
56
56
  `)}function $3(){return n1.default({defaultWidth:80,output:E8().output})}function s4({active:D,renderedItems:F,pageSize:$,loop:B}){let X=J2({lastPointer:D,lastActive:void 0}),{lastPointer:J,lastActive:Q}=X.current,Y=Math.floor($/2),E=F.reduce((W,V)=>W+V.length,0),H=F.slice(0,D).reduce((W,V)=>W+V.length,0),q=H;if(E>$)if(B){if(q=J,Q!=null&&Q<D&&D-Q<$)q=Math.min(Y,Math.abs(D-Q)===1?Math.min(J+(F[Q]?.length??0),Math.max(H,J)):J+D-Q)}else{let W=F.slice(D).reduce((V,K)=>V+K.length,0);q=W<$-Y?$-W:Math.min(H,Y)}return X.current.lastPointer=q,X.current.lastActive=D,q}function z0({items:D,active:F,renderItem:$,pageSize:B,loop:X=!0}){let J=$3(),Q=(C)=>(C%D.length+D.length)%D.length,Y=D.map((C,N)=>{if(C==null)return[];return K0($({item:C,index:N,isActive:N===F}),J).split(`
package/dist/term.js CHANGED
@@ -106,7 +106,7 @@ Commands:`),console.log(" term workers - Check worker status"),console.
106
106
  `).split(`
107
107
  `).map((J)=>Oz(J,F,$)).join(`
108
108
  `)}});var XJ=$D((gC,JJ)=>{var Ez=i("stream");class $J extends Ez{#$=null;constructor(D={}){super(D);this.writable=this.readable=!0,this.muted=!1,this.on("pipe",this._onpipe),this.replace=D.replace,this._prompt=D.prompt||null,this._hadControl=!1}#F(D,F){if(this._dest)return this._dest[D];if(this._src)return this._src[D];return F}#D(D,...F){if(typeof this._dest?.[D]==="function")this._dest[D](...F);if(typeof this._src?.[D]==="function")this._src[D](...F)}get isTTY(){if(this.#$!==null)return this.#$;return this.#F("isTTY",!1)}set isTTY(D){this.#$=D}get rows(){return this.#F("rows")}get columns(){return this.#F("columns")}mute(){this.muted=!0}unmute(){this.muted=!1}_onpipe(D){this._src=D}pipe(D,F){return this._dest=D,super.pipe(D,F)}pause(){if(this._src)return this._src.pause()}resume(){if(this._src)return this._src.resume()}write(D){if(this.muted){if(!this.replace)return!0;if(D.match(/^\u001b/)){if(D.indexOf(this._prompt)===0)D=D.slice(this._prompt.length),D=D.replace(/./g,this.replace),D=this._prompt+D;return this._hadControl=!0,this.emit("data",D)}else{if(this._prompt&&this._hadControl&&D.indexOf(this._prompt)===0)this._hadControl=!1,this.emit("data",this._prompt),D=D.slice(this._prompt.length);D=D.toString().replace(/./g,this.replace)}}this.emit("data",D)}end(D){if(this.muted)if(D&&this.replace)D=D.toString().replace(/./g,this.replace);else D=null;if(D)this.emit("data",D);this.emit("end")}destroy(...D){return this.#D("destroy",...D)}destroySoon(...D){return this.#D("destroySoon",...D)}close(...D){return this.#D("close",...D)}}JJ.exports=$J});var G7={};Z0(G7,{wishExists:()=>B7,updateTaskStatus:()=>MK,unlinkTask:()=>WK,linkTask:()=>V7,getWishTasksPath:()=>H7,getWishTasks:()=>Q8,getWishStatus:()=>m1,findWishForTask:()=>OK});import{join as h1}from"path";import{readFile as GK,writeFile as UK,mkdir as zK,access as KK}from"fs/promises";function H7(D,F){return h1(D,".genie","wishes",F,"tasks.json")}async function B7(D,F){let $=h1(D,".genie","wishes",F,"wish.md");try{return await KK($),!0}catch{return!1}}async function g1(D,F){let $=H7(D,F);try{let J=await GK($,"utf-8");return JSON.parse(J)}catch{return{wishId:F,tasks:[],updatedAt:new Date().toISOString()}}}async function q7(D,F,$){let J=H7(D,F),X=h1(D,".genie","wishes",F);await zK(X,{recursive:!0}),$.updatedAt=new Date().toISOString(),await UK(J,JSON.stringify($,null,2))}async function V7(D,F,$,J,X="open"){let Q=await g1(D,F),Y=Q.tasks.find((H)=>H.id===$);if(Y)Y.title=J,Y.status=X;else Q.tasks.push({id:$,title:J,status:X,linkedAt:new Date().toISOString()});await q7(D,F,Q)}async function WK(D,F,$){let J=await g1(D,F),X=J.tasks.findIndex((Q)=>Q.id===$);if(X===-1)return!1;return J.tasks.splice(X,1),await q7(D,F,J),!0}async function MK(D,F,$,J){let X=await g1(D,F),Q=X.tasks.find((Y)=>Y.id===$);if(!Q)return!1;return Q.status=J,await q7(D,F,X),!0}async function Q8(D,F){return(await g1(D,F)).tasks}async function m1(D,F){let $=await Q8(D,F);return{total:$.length,done:$.filter((J)=>J.status==="done").length,inProgress:$.filter((J)=>J.status==="in_progress").length,blocked:$.filter((J)=>J.status==="blocked").length,open:$.filter((J)=>J.status==="open").length}}async function OK(D,F){let $=h1(D,".genie","wishes");try{let{readdir:J}=await import("fs/promises"),X=await J($,{withFileTypes:!0});for(let Q of X)if(Q.isDirectory()){if((await Q8(D,Q.name)).some((H)=>H.id===F))return Q.name}}catch{}return null}var Y8=()=>{};var cX={};Z0(cX,{beadsValidateCommand:()=>bM});import{readFile as TM}from"fs/promises";import{join as SM,resolve as fM}from"path";async function bM(D={}){let F=fM(D.repo||process.cwd()),$=SM(F,".beads","issues.jsonl"),J;try{J=await TM($,"utf-8")}catch{let q=`\u274C Missing: ${$}`;if(D.json)console.log(JSON.stringify({ok:!1,error:q,issuesPath:$},null,2)),process.exit(1);console.error(q),process.exit(1)}let X=[],Q=0,Y=new Set,H=J.split(`
109
- `);for(let q=0;q<H.length;q++){let G=H[q];if(!G.trim())continue;try{let V=JSON.parse(G);if(Q++,V?.id){if(Y.has(V.id))X.push({line:q+1,error:`duplicate id: ${V.id}`});Y.add(V.id)}else X.push({line:q+1,error:"missing id"})}catch(V){X.push({line:q+1,error:V?.message||"invalid json"})}}let B=X.length===0;if(D.json)console.log(JSON.stringify({ok:B,issuesPath:$,count:Q,errors:X},null,2));else if(B)console.log(`\u2705 Beads issues.jsonl valid (${Q} records) at ${$}`);else{console.error(`\u274C Beads issues.jsonl invalid at ${$}`);for(let q of X.slice(0,20))console.error(` line ${q.line}: ${q.error}`);if(X.length>20)console.error(` ...and ${X.length-20} more`)}if(!B)process.exit(1)}var pX=()=>{};var o7=f2(r7(),1),{program:hM,createCommand:gM,createArgument:mM,createOption:lM,CommanderError:cM,InvalidArgumentError:pM,InvalidOptionArgumentError:dM,Command:a7,Argument:nM,Option:iM,Help:rM}=o7.default;var s7="3.260227.1";l();import{join as ZY}from"path";var{$:W2}=globalThis.Bun;import{mkdir as Y9,rm as H9,access as K6,readFile as WY,writeFile as MY}from"fs/promises";import{join as T0,basename as OY}from"path";function E8(D){return D.replace(/\//g,"-").replace(/\\/g,"-").replace(/[^a-zA-Z0-9-_.]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}function RY(D){let F=D.match(/^(\d+)([hdwm])$/i);if(!F)throw Error(`Invalid timeframe format: ${D}. Use format like 7d, 2w, 1m, 24h`);let $=parseInt(F[1],10),J=F[2].toLowerCase();return $*{h:3600000,d:86400000,w:604800000,m:2592000000}[J]}class S0{baseDir;repoPath;metadataPath;constructor(D){this.baseDir=D.baseDir,this.repoPath=D.repoPath,this.metadataPath=T0(this.baseDir,".metadata.json")}async loadMetadata(){try{let D=await WY(this.metadataPath,"utf-8");return JSON.parse(D)}catch{return{worktrees:{}}}}async saveMetadata(D){await Y9(this.baseDir,{recursive:!0}),await MY(this.metadataPath,JSON.stringify(D,null,2))}async createWorktree(D,F=!1,$){let J=E8(D),X=T0(this.baseDir,J);await Y9(this.baseDir,{recursive:!0});try{throw await K6(X),Error(`Worktree already exists at ${X}`)}catch(H){if(H.code!=="ENOENT")throw H}if(F)if($)await W2`git -C ${this.repoPath} worktree add -b ${D} ${X} ${$}`.quiet();else await W2`git -C ${this.repoPath} worktree add -b ${D} ${X}`.quiet();else{if(!await this.branchExists(D))throw Error(`Branch '${D}' does not exist. Use -b to create a new branch.`);await W2`git -C ${this.repoPath} worktree add ${X} ${D}`.quiet()}let Q=await this.loadMetadata();Q.worktrees[J]={branch:D,createdAt:new Date().toISOString()},await this.saveMetadata(Q);let Y=await this.getCommitHash(X);return{path:X,branch:D,commitHash:Y,createdAt:new Date}}async removeWorktree(D){let F=E8(D),$=T0(this.baseDir,F);try{await W2`git -C ${this.repoPath} worktree remove ${$} --force`.quiet()}catch{try{await H9($,{recursive:!0,force:!0})}catch{}}try{await K6($),await H9($,{recursive:!0,force:!0})}catch{}let J=await this.loadMetadata();delete J.worktrees[F],await this.saveMetadata(J)}async listWorktrees(){let F=(await W2`git -C ${this.repoPath} worktree list --porcelain`.quiet()).stdout.toString(),$=[],J={};for(let Y of F.split(`
109
+ `);for(let q=0;q<H.length;q++){let G=H[q];if(!G.trim())continue;try{let V=JSON.parse(G);if(Q++,V?.id){if(Y.has(V.id))X.push({line:q+1,error:`duplicate id: ${V.id}`});Y.add(V.id)}else X.push({line:q+1,error:"missing id"})}catch(V){X.push({line:q+1,error:V?.message||"invalid json"})}}let B=X.length===0;if(D.json)console.log(JSON.stringify({ok:B,issuesPath:$,count:Q,errors:X},null,2));else if(B)console.log(`\u2705 Beads issues.jsonl valid (${Q} records) at ${$}`);else{console.error(`\u274C Beads issues.jsonl invalid at ${$}`);for(let q of X.slice(0,20))console.error(` line ${q.line}: ${q.error}`);if(X.length>20)console.error(` ...and ${X.length-20} more`)}if(!B)process.exit(1)}var pX=()=>{};var o7=f2(r7(),1),{program:hM,createCommand:gM,createArgument:mM,createOption:lM,CommanderError:cM,InvalidArgumentError:pM,InvalidOptionArgumentError:dM,Command:a7,Argument:nM,Option:iM,Help:rM}=o7.default;var s7="3.260227.2";l();import{join as ZY}from"path";var{$:W2}=globalThis.Bun;import{mkdir as Y9,rm as H9,access as K6,readFile as WY,writeFile as MY}from"fs/promises";import{join as T0,basename as OY}from"path";function E8(D){return D.replace(/\//g,"-").replace(/\\/g,"-").replace(/[^a-zA-Z0-9-_.]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}function RY(D){let F=D.match(/^(\d+)([hdwm])$/i);if(!F)throw Error(`Invalid timeframe format: ${D}. Use format like 7d, 2w, 1m, 24h`);let $=parseInt(F[1],10),J=F[2].toLowerCase();return $*{h:3600000,d:86400000,w:604800000,m:2592000000}[J]}class S0{baseDir;repoPath;metadataPath;constructor(D){this.baseDir=D.baseDir,this.repoPath=D.repoPath,this.metadataPath=T0(this.baseDir,".metadata.json")}async loadMetadata(){try{let D=await WY(this.metadataPath,"utf-8");return JSON.parse(D)}catch{return{worktrees:{}}}}async saveMetadata(D){await Y9(this.baseDir,{recursive:!0}),await MY(this.metadataPath,JSON.stringify(D,null,2))}async createWorktree(D,F=!1,$){let J=E8(D),X=T0(this.baseDir,J);await Y9(this.baseDir,{recursive:!0});try{throw await K6(X),Error(`Worktree already exists at ${X}`)}catch(H){if(H.code!=="ENOENT")throw H}if(F)if($)await W2`git -C ${this.repoPath} worktree add -b ${D} ${X} ${$}`.quiet();else await W2`git -C ${this.repoPath} worktree add -b ${D} ${X}`.quiet();else{if(!await this.branchExists(D))throw Error(`Branch '${D}' does not exist. Use -b to create a new branch.`);await W2`git -C ${this.repoPath} worktree add ${X} ${D}`.quiet()}let Q=await this.loadMetadata();Q.worktrees[J]={branch:D,createdAt:new Date().toISOString()},await this.saveMetadata(Q);let Y=await this.getCommitHash(X);return{path:X,branch:D,commitHash:Y,createdAt:new Date}}async removeWorktree(D){let F=E8(D),$=T0(this.baseDir,F);try{await W2`git -C ${this.repoPath} worktree remove ${$} --force`.quiet()}catch{try{await H9($,{recursive:!0,force:!0})}catch{}}try{await K6($),await H9($,{recursive:!0,force:!0})}catch{}let J=await this.loadMetadata();delete J.worktrees[F],await this.saveMetadata(J)}async listWorktrees(){let F=(await W2`git -C ${this.repoPath} worktree list --porcelain`.quiet()).stdout.toString(),$=[],J={};for(let Y of F.split(`
110
110
  `))if(Y.startsWith("worktree ")){if(J.path)$.push(J);J={path:Y.slice(9)}}else if(Y.startsWith("HEAD "))J.commitHash=Y.slice(5);else if(Y.startsWith("branch "))J.branch=Y.slice(7).replace("refs/heads/","");if(J.path)$.push(J);let X=$.filter((Y)=>Y.path.startsWith(this.baseDir)),Q=await this.loadMetadata();for(let Y of X){let H=OY(Y.path),B=Q.worktrees[H];if(B)Y.createdAt=new Date(B.createdAt);Y.size=await this.getDiskUsage(Y.path)}return X}async cleanup(D,F=!1){let $=RY(D),J=Date.now(),X=await this.listWorktrees(),Q=[];for(let Y of X)if(Y.createdAt){if(J-Y.createdAt.getTime()>$)Q.push(Y)}if(!F)for(let Y of Q)await this.removeWorktree(Y.branch);return Q}async prune(){await W2`git -C ${this.repoPath} worktree prune`.quiet()}async getDiskUsage(D){try{let $=(await W2`du -sb ${D}`.quiet()).stdout.toString().trim(),J=parseInt($.split("\t")[0],10);return isNaN(J)?0:J}catch{return 0}}getWorktreePath(D){let F=E8(D);return T0(this.baseDir,F)}async worktreeExists(D){let F=E8(D),$=T0(this.baseDir,F);try{return await K6($),!0}catch{return!1}}async branchExists(D){try{return await W2`git -C ${this.repoPath} rev-parse --verify ${D}`.quiet(),!0}catch{return!1}}async getCommitHash(D){return(await W2`git -C ${D} rev-parse HEAD`.quiet()).stdout.toString().trim()}}function f0(D){let F=D?.baseDir||T0(process.cwd(),".worktrees"),$=D?.repoPath||process.cwd();return new S0({baseDir:F,repoPath:$})}import{mkdir as EY,readFile as AY,writeFile as CY,access as _Y}from"fs/promises";import{join as B9}from"path";import{homedir as jY}from"os";var q9=B9(jY(),".config","term"),W6=B9(q9,"sessions.json");async function LY(){await EY(q9,{recursive:!0})}async function M6(){try{await _Y(W6);let D=await AY(W6,"utf-8");return JSON.parse(D)}catch{return{sessions:{}}}}async function V9(D){await LY(),await CY(W6,JSON.stringify(D,null,2))}async function G9(D,F){let $=await M6();$.sessions[D]={...F,createdAt:new Date().toISOString()},await V9($)}async function U9(D){return(await M6()).sessions[D]||null}async function z9(D){let F=await M6();delete F.sessions[D],await V9(F)}async function A8(D,F={}){try{if(await u(D))console.error(`\u274C Session "${D}" already exists`),process.exit(1);let J=F.workspace||process.cwd(),X;if(F.worktree){if(!F.workspace)console.error("\u274C --worktree requires --workspace"),process.exit(1);let Y=f0({baseDir:ZY(F.workspace,".worktrees"),repoPath:F.workspace});if(await Y.worktreeExists(D))console.error(`\u274C Worktree for "${D}" already exists`),process.exit(1);let B=await Y.createWorktree(D,!0);X=B.path,J=B.path,console.log(`\u2705 Worktree created at ${X}`)}if(!await b2(D))console.error(`\u274C Failed to create session "${D}"`),process.exit(1);if(await j(`send-keys -t '${D}' 'cd ${J}' Enter`),X)await G9(D,{worktreePath:X,workspace:F.workspace});if(console.log(`\u2705 Session "${D}" created`),J!==process.cwd())console.log(` Working directory: ${J}`);console.log(`
111
111
  To attach: term attach ${D}`)}catch($){console.error(`\u274C Error creating session: ${$.message}`),process.exit(1)}}l();import{exec as NY}from"child_process";import{promisify as TY}from"util";var SY=TY(NY);async function C8(D){try{if(!await u(D))console.error(`\u274C Session "${D}" not found`),process.exit(1);console.log(`\uD83D\uDCCE Attaching to session "${D}"...`),await SY(`tmux attach -t "${D}"`)}catch(F){console.error(`\u274C Error attaching to session: ${F.message}`),process.exit(1)}}l();import{join as fY}from"path";async function _8(D,F={}){try{let $=await u(D);if(!$)console.error(`\u274C Session "${D}" not found`),process.exit(1);let J=await U9(D);if(await R3($.id),J?.worktreePath&&J?.workspace&&!F.keepWorktree)await f0({baseDir:fY(J.workspace,".worktrees"),repoPath:J.workspace}).removeWorktree(D),console.log(`\u2705 Session "${D}" and worktree removed`);else if(J?.worktreePath&&F.keepWorktree)console.log(`\u2705 Session "${D}" removed (worktree kept at ${J.worktreePath})`);else console.log(`\u2705 Session "${D}" removed`);if(J)await z9(D)}catch($){console.error(`\u274C Error removing session: ${$.message}`),process.exit(1)}}l();function C3(D){let $=D.split(`
112
112
  `).filter((J)=>{let X=J.trim();if(X.match(/^TMUX_MCP_START$/))return!1;if(X.match(/^TMUX_MCP_DONE_\d+$/))return!1;if(X.includes("TMUX_MCP_START"))return!1;if(X.includes("TMUX_MCP_DONE_"))return!1;if(J.includes('echo "TMUX_MCP_START"'))return!1;if(J.includes('echo "TMUX_MCP_DONE_'))return!1;if(J.includes("-bash:"))return!1;if(J.includes("warning: setlocale:"))return!1;if(J.includes("cannot change locale"))return!1;if(X==="or directory")return!1;return!0});while($.length>0&&$[0].trim()==="")$.shift();while($.length>0&&$[$.length-1].trim()==="")$.pop();return $.join(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automagik/genie",
3
- "version": "3.260227.1",
3
+ "version": "3.260227.2",
4
4
  "description": "Collaborative terminal toolkit for human + AI workflows",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "automagik-genie",
3
- "version": "3.260227.1",
3
+ "version": "3.260227.2",
4
4
  "description": "Human-AI partnership for Claude Code. Share a terminal, orchestrate workers, evolve together. Brainstorm ideas, turn them into wishes, execute with /work, validate with /review, and ship as one team.",
5
5
  "author": {
6
6
  "name": "Namastex Labs"
@@ -2,7 +2,7 @@
2
2
  "id": "automagik-genie",
3
3
  "name": "Automagik Genie",
4
4
  "description": "Skills, agents, and hooks for the Genie CLI terminal orchestration toolkit",
5
- "version": "3.260227.1",
5
+ "version": "3.260227.2",
6
6
  "configSchema": {
7
7
  "type": "object",
8
8
  "additionalProperties": false,
@@ -6,13 +6,13 @@
6
6
  * - Bun runtime (auto-installs if missing)
7
7
  * - tmux (guides user if missing - can't auto-install)
8
8
  * - beads (auto-installs if missing via npm)
9
+ * - genie CLI (installed globally via bun)
9
10
  *
10
11
  * Also handles:
11
12
  * - Dependency installation when version changes
12
- * - CLI symlink creation for agent access
13
13
  * - Version marker management
14
14
  */
15
- import { existsSync, readFileSync, writeFileSync, mkdirSync, symlinkSync, unlinkSync } from 'fs';
15
+ import { existsSync, readFileSync, writeFileSync, mkdirSync } from 'fs';
16
16
  import { execSync, spawnSync } from 'child_process';
17
17
  import { join } from 'path';
18
18
  import { homedir } from 'os';
@@ -20,7 +20,6 @@ import { homedir } from 'os';
20
20
  const ROOT = process.env.CLAUDE_PLUGIN_ROOT || join(homedir(), '.claude', 'plugins', 'automagik-genie');
21
21
  const GENIE_DIR = join(homedir(), '.genie');
22
22
  const MARKER = join(GENIE_DIR, '.install-version');
23
- const BIN_DIR = join(homedir(), '.local', 'bin');
24
23
  const IS_WINDOWS = process.platform === 'win32';
25
24
 
26
25
  // Common installation paths (handles fresh installs before PATH reload)
@@ -32,6 +31,10 @@ const BEADS_COMMON_PATHS = IS_WINDOWS
32
31
  ? [join(homedir(), 'AppData', 'Roaming', 'npm', 'bd.cmd')]
33
32
  : [join(homedir(), '.local', 'bin', 'bd'), '/usr/local/bin/bd', '/opt/homebrew/bin/bd'];
34
33
 
34
+ const GENIE_COMMON_PATHS = IS_WINDOWS
35
+ ? [join(homedir(), '.bun', 'bin', 'genie.exe')]
36
+ : [join(homedir(), '.bun', 'bin', 'genie'), '/usr/local/bin/genie', '/opt/homebrew/bin/genie'];
37
+
35
38
  /**
36
39
  * Get the Bun executable path
37
40
  */
@@ -76,9 +79,9 @@ function installBun() {
76
79
  console.error('Installing Bun runtime...');
77
80
  try {
78
81
  if (IS_WINDOWS) {
79
- execSync('powershell -c "irm bun.sh/install.ps1 | iex"', { stdio: 'inherit', shell: true });
82
+ execSync('powershell -c "irm bun.com/install.ps1 | iex"', { stdio: 'inherit', shell: true });
80
83
  } else {
81
- execSync('curl -fsSL https://bun.sh/install | bash', { stdio: 'inherit', shell: true });
84
+ execSync('curl -fsSL https://bun.com/install | bash', { stdio: 'inherit', shell: true });
82
85
  }
83
86
  if (!isBunInstalled()) {
84
87
  throw new Error('Bun installation completed but binary not found. Please restart your terminal.');
@@ -89,7 +92,7 @@ function installBun() {
89
92
  if (IS_WINDOWS) {
90
93
  console.error(' winget install Oven-sh.Bun');
91
94
  } else {
92
- console.error(' curl -fsSL https://bun.sh/install | bash');
95
+ console.error(' curl -fsSL https://bun.com/install | bash');
93
96
  }
94
97
  throw error;
95
98
  }
@@ -220,67 +223,97 @@ function installDeps() {
220
223
  }
221
224
 
222
225
  /**
223
- * Check if CLI symlinks already exist and point to correct targets
226
+ * Get the genie executable path
224
227
  */
225
- function symlinksExist() {
226
- const links = [
227
- { name: 'genie', target: join(ROOT, 'scripts', 'genie.cjs') },
228
- { name: 'term', target: join(ROOT, 'scripts', 'term.cjs') }
229
- ];
230
-
231
- for (const { name, target } of links) {
232
- const linkPath = join(BIN_DIR, name);
233
- if (!existsSync(target)) continue; // Target doesn't exist, skip check
234
- if (!existsSync(linkPath)) return false;
228
+ function getGeniePath() {
229
+ // Try PATH first
230
+ try {
231
+ const result = spawnSync('genie', ['--version'], {
232
+ encoding: 'utf-8',
233
+ stdio: ['pipe', 'pipe', 'pipe'],
234
+ shell: IS_WINDOWS
235
+ });
236
+ if (result.status === 0) return 'genie';
237
+ } catch {
238
+ // Not in PATH
235
239
  }
236
- return true;
240
+ return GENIE_COMMON_PATHS.find(existsSync) || null;
237
241
  }
238
242
 
239
243
  /**
240
- * Create CLI symlinks for agent access
244
+ * Get installed genie CLI version (via bun global)
241
245
  */
242
- function createCliSymlinks() {
243
- // Ensure bin directory exists
244
- if (!existsSync(BIN_DIR)) {
245
- mkdirSync(BIN_DIR, { recursive: true });
246
+ function getGenieVersion() {
247
+ const geniePath = getGeniePath();
248
+ if (!geniePath) return null;
249
+ try {
250
+ const result = spawnSync(geniePath, ['--version'], {
251
+ encoding: 'utf-8',
252
+ stdio: ['pipe', 'pipe', 'pipe'],
253
+ shell: IS_WINDOWS
254
+ });
255
+ return result.status === 0 ? result.stdout.trim() : null;
256
+ } catch {
257
+ return null;
246
258
  }
259
+ }
247
260
 
248
- const links = [
249
- { name: 'genie', target: join(ROOT, 'scripts', 'genie.cjs') },
250
- { name: 'term', target: join(ROOT, 'scripts', 'term.cjs') }
251
- ];
261
+ /**
262
+ * Get the plugin's package version
263
+ */
264
+ function getPluginVersion() {
265
+ try {
266
+ const pkg = JSON.parse(readFileSync(join(ROOT, 'package.json'), 'utf-8'));
267
+ return pkg.version || null;
268
+ } catch {
269
+ return null;
270
+ }
271
+ }
252
272
 
253
- for (const { name, target } of links) {
254
- const linkPath = join(BIN_DIR, name);
273
+ /**
274
+ * Check if genie CLI needs install or upgrade via bun global
275
+ */
276
+ function genieCliNeedsInstall() {
277
+ const installed = getGenieVersion();
278
+ if (!installed) return true;
279
+ const pluginVersion = getPluginVersion();
280
+ if (!pluginVersion) return false;
281
+ return installed !== pluginVersion;
282
+ }
255
283
 
256
- // Skip if target doesn't exist
257
- if (!existsSync(target)) {
258
- continue;
259
- }
284
+ /**
285
+ * Install or upgrade genie CLI globally via bun
286
+ */
287
+ function installGenieCli() {
288
+ const bunPath = getBunPath();
289
+ if (!bunPath) {
290
+ throw new Error('Bun executable not found — cannot install genie CLI');
291
+ }
260
292
 
261
- // Remove existing symlink if it exists
262
- try {
263
- if (existsSync(linkPath)) {
264
- unlinkSync(linkPath);
265
- }
266
- } catch {
267
- // Ignore errors
268
- }
293
+ const pluginVersion = getPluginVersion();
294
+ const installed = getGenieVersion();
269
295
 
270
- // Create symlink
271
- try {
272
- symlinkSync(target, linkPath);
273
- console.error(`Created symlink: ${linkPath} -> ${target}`);
274
- } catch (error) {
275
- console.error(`Warning: Could not create symlink for ${name}: ${error.message}`);
276
- }
296
+ if (installed) {
297
+ console.error(`Upgrading genie CLI: ${installed} → ${pluginVersion}...`);
298
+ } else {
299
+ console.error('Installing genie CLI globally via bun...');
300
+ }
301
+
302
+ const bunCmd = IS_WINDOWS && bunPath.includes(' ') ? `"${bunPath}"` : bunPath;
303
+ const versionSuffix = pluginVersion ? `@${pluginVersion}` : '';
304
+ execSync(`${bunCmd} install -g @automagik/genie${versionSuffix}`, { stdio: 'inherit', shell: IS_WINDOWS });
305
+
306
+ const newVersion = getGenieVersion();
307
+ if (!newVersion) {
308
+ throw new Error('genie CLI installation completed but binary not found. Restart your terminal.');
277
309
  }
310
+ console.error(`genie CLI ${newVersion} installed`);
278
311
  }
279
312
 
280
313
  // Main execution
281
314
  try {
282
315
  // Quick check: if everything is already installed, exit silently
283
- if (isBunInstalled() && isTmuxInstalled() && isBeadsInstalled() && !needsInstall() && symlinksExist()) {
316
+ if (isBunInstalled() && isTmuxInstalled() && isBeadsInstalled() && !needsInstall() && !genieCliNeedsInstall()) {
284
317
  process.exit(0);
285
318
  }
286
319
 
@@ -315,15 +348,15 @@ try {
315
348
  installBeads();
316
349
  }
317
350
 
318
- // 4. Install dependencies if needed
351
+ // 4. Install plugin dependencies if needed
319
352
  if (needsInstall()) {
320
353
  installDeps();
321
354
  console.error('Dependencies installed');
322
355
  }
323
356
 
324
- // 5. Create CLI symlinks if needed
325
- if (!symlinksExist()) {
326
- createCliSymlinks();
357
+ // 5. Install or upgrade genie CLI via bun global
358
+ if (genieCliNeedsInstall()) {
359
+ installGenieCli();
327
360
  }
328
361
 
329
362
  } catch (e) {
@@ -6,13 +6,13 @@
6
6
  * - Bun runtime (auto-installs if missing)
7
7
  * - tmux (guides user if missing - can't auto-install)
8
8
  * - beads (auto-installs if missing via npm)
9
+ * - genie CLI (installed globally via bun)
9
10
  *
10
11
  * Also handles:
11
12
  * - Dependency installation when version changes
12
- * - CLI symlink creation for agent access
13
13
  * - Version marker management
14
14
  */
15
- import { existsSync, readFileSync, writeFileSync, mkdirSync, symlinkSync, unlinkSync } from 'fs';
15
+ import { existsSync, readFileSync, writeFileSync, mkdirSync } from 'fs';
16
16
  import { execSync, spawnSync } from 'child_process';
17
17
  import { join } from 'path';
18
18
  import { homedir } from 'os';
@@ -20,7 +20,6 @@ import { homedir } from 'os';
20
20
  const ROOT = process.env.CLAUDE_PLUGIN_ROOT || join(homedir(), '.claude', 'plugins', 'automagik-genie');
21
21
  const GENIE_DIR = join(homedir(), '.genie');
22
22
  const MARKER = join(GENIE_DIR, '.install-version');
23
- const BIN_DIR = join(homedir(), '.local', 'bin');
24
23
  const IS_WINDOWS = process.platform === 'win32';
25
24
 
26
25
  // Common installation paths (handles fresh installs before PATH reload)
@@ -32,6 +31,10 @@ const BEADS_COMMON_PATHS = IS_WINDOWS
32
31
  ? [join(homedir(), 'AppData', 'Roaming', 'npm', 'bd.cmd')]
33
32
  : [join(homedir(), '.local', 'bin', 'bd'), '/usr/local/bin/bd', '/opt/homebrew/bin/bd'];
34
33
 
34
+ const GENIE_COMMON_PATHS = IS_WINDOWS
35
+ ? [join(homedir(), '.bun', 'bin', 'genie.exe')]
36
+ : [join(homedir(), '.bun', 'bin', 'genie'), '/usr/local/bin/genie', '/opt/homebrew/bin/genie'];
37
+
35
38
  /**
36
39
  * Get the Bun executable path
37
40
  */
@@ -76,9 +79,9 @@ function installBun() {
76
79
  console.error('Installing Bun runtime...');
77
80
  try {
78
81
  if (IS_WINDOWS) {
79
- execSync('powershell -c "irm bun.sh/install.ps1 | iex"', { stdio: 'inherit', shell: true });
82
+ execSync('powershell -c "irm bun.com/install.ps1 | iex"', { stdio: 'inherit', shell: true });
80
83
  } else {
81
- execSync('curl -fsSL https://bun.sh/install | bash', { stdio: 'inherit', shell: true });
84
+ execSync('curl -fsSL https://bun.com/install | bash', { stdio: 'inherit', shell: true });
82
85
  }
83
86
  if (!isBunInstalled()) {
84
87
  throw new Error('Bun installation completed but binary not found. Please restart your terminal.');
@@ -89,7 +92,7 @@ function installBun() {
89
92
  if (IS_WINDOWS) {
90
93
  console.error(' winget install Oven-sh.Bun');
91
94
  } else {
92
- console.error(' curl -fsSL https://bun.sh/install | bash');
95
+ console.error(' curl -fsSL https://bun.com/install | bash');
93
96
  }
94
97
  throw error;
95
98
  }
@@ -220,67 +223,97 @@ function installDeps() {
220
223
  }
221
224
 
222
225
  /**
223
- * Check if CLI symlinks already exist and point to correct targets
226
+ * Get the genie executable path
224
227
  */
225
- function symlinksExist() {
226
- const links = [
227
- { name: 'genie', target: join(ROOT, 'scripts', 'genie.cjs') },
228
- { name: 'term', target: join(ROOT, 'scripts', 'term.cjs') }
229
- ];
230
-
231
- for (const { name, target } of links) {
232
- const linkPath = join(BIN_DIR, name);
233
- if (!existsSync(target)) continue; // Target doesn't exist, skip check
234
- if (!existsSync(linkPath)) return false;
228
+ function getGeniePath() {
229
+ // Try PATH first
230
+ try {
231
+ const result = spawnSync('genie', ['--version'], {
232
+ encoding: 'utf-8',
233
+ stdio: ['pipe', 'pipe', 'pipe'],
234
+ shell: IS_WINDOWS
235
+ });
236
+ if (result.status === 0) return 'genie';
237
+ } catch {
238
+ // Not in PATH
235
239
  }
236
- return true;
240
+ return GENIE_COMMON_PATHS.find(existsSync) || null;
237
241
  }
238
242
 
239
243
  /**
240
- * Create CLI symlinks for agent access
244
+ * Get installed genie CLI version (via bun global)
241
245
  */
242
- function createCliSymlinks() {
243
- // Ensure bin directory exists
244
- if (!existsSync(BIN_DIR)) {
245
- mkdirSync(BIN_DIR, { recursive: true });
246
+ function getGenieVersion() {
247
+ const geniePath = getGeniePath();
248
+ if (!geniePath) return null;
249
+ try {
250
+ const result = spawnSync(geniePath, ['--version'], {
251
+ encoding: 'utf-8',
252
+ stdio: ['pipe', 'pipe', 'pipe'],
253
+ shell: IS_WINDOWS
254
+ });
255
+ return result.status === 0 ? result.stdout.trim() : null;
256
+ } catch {
257
+ return null;
246
258
  }
259
+ }
247
260
 
248
- const links = [
249
- { name: 'genie', target: join(ROOT, 'scripts', 'genie.cjs') },
250
- { name: 'term', target: join(ROOT, 'scripts', 'term.cjs') }
251
- ];
261
+ /**
262
+ * Get the plugin's package version
263
+ */
264
+ function getPluginVersion() {
265
+ try {
266
+ const pkg = JSON.parse(readFileSync(join(ROOT, 'package.json'), 'utf-8'));
267
+ return pkg.version || null;
268
+ } catch {
269
+ return null;
270
+ }
271
+ }
252
272
 
253
- for (const { name, target } of links) {
254
- const linkPath = join(BIN_DIR, name);
273
+ /**
274
+ * Check if genie CLI needs install or upgrade via bun global
275
+ */
276
+ function genieCliNeedsInstall() {
277
+ const installed = getGenieVersion();
278
+ if (!installed) return true;
279
+ const pluginVersion = getPluginVersion();
280
+ if (!pluginVersion) return false;
281
+ return installed !== pluginVersion;
282
+ }
255
283
 
256
- // Skip if target doesn't exist
257
- if (!existsSync(target)) {
258
- continue;
259
- }
284
+ /**
285
+ * Install or upgrade genie CLI globally via bun
286
+ */
287
+ function installGenieCli() {
288
+ const bunPath = getBunPath();
289
+ if (!bunPath) {
290
+ throw new Error('Bun executable not found — cannot install genie CLI');
291
+ }
260
292
 
261
- // Remove existing symlink if it exists
262
- try {
263
- if (existsSync(linkPath)) {
264
- unlinkSync(linkPath);
265
- }
266
- } catch {
267
- // Ignore errors
268
- }
293
+ const pluginVersion = getPluginVersion();
294
+ const installed = getGenieVersion();
269
295
 
270
- // Create symlink
271
- try {
272
- symlinkSync(target, linkPath);
273
- console.error(`Created symlink: ${linkPath} -> ${target}`);
274
- } catch (error) {
275
- console.error(`Warning: Could not create symlink for ${name}: ${error.message}`);
276
- }
296
+ if (installed) {
297
+ console.error(`Upgrading genie CLI: ${installed} → ${pluginVersion}...`);
298
+ } else {
299
+ console.error('Installing genie CLI globally via bun...');
300
+ }
301
+
302
+ const bunCmd = IS_WINDOWS && bunPath.includes(' ') ? `"${bunPath}"` : bunPath;
303
+ const versionSuffix = pluginVersion ? `@${pluginVersion}` : '';
304
+ execSync(`${bunCmd} install -g @automagik/genie${versionSuffix}`, { stdio: 'inherit', shell: IS_WINDOWS });
305
+
306
+ const newVersion = getGenieVersion();
307
+ if (!newVersion) {
308
+ throw new Error('genie CLI installation completed but binary not found. Restart your terminal.');
277
309
  }
310
+ console.error(`genie CLI ${newVersion} installed`);
278
311
  }
279
312
 
280
313
  // Main execution
281
314
  try {
282
315
  // Quick check: if everything is already installed, exit silently
283
- if (isBunInstalled() && isTmuxInstalled() && isBeadsInstalled() && !needsInstall() && symlinksExist()) {
316
+ if (isBunInstalled() && isTmuxInstalled() && isBeadsInstalled() && !needsInstall() && !genieCliNeedsInstall()) {
284
317
  process.exit(0);
285
318
  }
286
319
 
@@ -315,15 +348,15 @@ try {
315
348
  installBeads();
316
349
  }
317
350
 
318
- // 4. Install dependencies if needed
351
+ // 4. Install plugin dependencies if needed
319
352
  if (needsInstall()) {
320
353
  installDeps();
321
354
  console.error('Dependencies installed');
322
355
  }
323
356
 
324
- // 5. Create CLI symlinks if needed
325
- if (!symlinksExist()) {
326
- createCliSymlinks();
357
+ // 5. Install or upgrade genie CLI via bun global
358
+ if (genieCliNeedsInstall()) {
359
+ installGenieCli();
327
360
  }
328
361
 
329
362
  } catch (e) {
@@ -1,5 +1,5 @@
1
1
  // Runtime version (baked in at build time)
2
- export const VERSION = '3.260227.1';
2
+ export const VERSION = '3.260227.2';
3
3
 
4
4
  // Runtime fallback version (no npm registry access — N=0 signals local/dev build)
5
5
  // Canonical versions are generated by scripts/version.ts at build time: 3.YYMMDD.N