@automagik/genie 3.260317.12 → 3.260317.13

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/genie.js CHANGED
@@ -21,7 +21,7 @@ Expecting one of '${$.join("', '")}'`);if(this._lifeCycleHooks[D])this._lifeCycl
21
21
  `),this.outputHelp({error:!0});let $=F||{},J=$.exitCode||1,B=$.code||"commander.error";this._exit(J,B,D)}_parseOptionsEnv(){this.options.forEach((D)=>{if(D.envVar&&D.envVar in m.env){let F=D.attributeName();if(this.getOptionValue(F)===void 0||["default","config","env"].includes(this.getOptionValueSource(F)))if(D.required||D.optional)this.emit(`optionEnv:${D.name()}`,m.env[D.envVar]);else this.emit(`optionEnv:${D.name()}`)}})}_parseOptionsImplied(){let D=new FB(this.options),F=($)=>{return this.getOptionValue($)!==void 0&&!["default","implied"].includes(this.getOptionValueSource($))};this.options.filter(($)=>$.implied!==void 0&&F($.attributeName())&&D.valueFromOption(this.getOptionValue($.attributeName()),$)).forEach(($)=>{Object.keys($.implied).filter((J)=>!F(J)).forEach((J)=>{this.setOptionValueWithSource(J,$.implied[J],"implied")})})}missingArgument(D){let F=`error: missing required argument '${D}'`;this.error(F,{code:"commander.missingArgument"})}optionMissingArgument(D){let F=`error: option '${D.flags}' argument missing`;this.error(F,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(D){let F=`error: required option '${D.flags}' not specified`;this.error(F,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(D,F){let $=(X)=>{let Q=X.attributeName(),Y=this.getOptionValue(Q),q=this.options.find((H)=>H.negate&&Q===H.attributeName()),G=this.options.find((H)=>!H.negate&&Q===H.attributeName());if(q&&(q.presetArg===void 0&&Y===!1||q.presetArg!==void 0&&Y===q.presetArg))return q;return G||X},J=(X)=>{let Q=$(X),Y=Q.attributeName();if(this.getOptionValueSource(Y)==="env")return`environment variable '${Q.envVar}'`;return`option '${Q.flags}'`},B=`error: ${J(D)} cannot be used with ${J(F)}`;this.error(B,{code:"commander.conflictingOption"})}unknownOption(D){if(this._allowUnknownOption)return;let F="";if(D.startsWith("--")&&this._showSuggestionAfterError){let J=[],B=this;do{let X=B.createHelp().visibleOptions(B).filter((Q)=>Q.long).map((Q)=>Q.long);J=J.concat(X),B=B.parent}while(B&&!B._enablePositionalOptions);F=f5(D,J)}let $=`error: unknown option '${D}'${F}`;this.error($,{code:"commander.unknownOption"})}_excessArguments(D){if(this._allowExcessArguments)return;let F=this.registeredArguments.length,$=F===1?"":"s",B=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${F} argument${$} but got ${D.length}.`;this.error(B,{code:"commander.excessArguments"})}unknownCommand(){let D=this.args[0],F="";if(this._showSuggestionAfterError){let J=[];this.createHelp().visibleCommands(this).forEach((B)=>{if(J.push(B.name()),B.alias())J.push(B.alias())}),F=f5(D,J)}let $=`error: unknown command '${D}'${F}`;this.error($,{code:"commander.unknownCommand"})}version(D,F,$){if(D===void 0)return this._version;this._version=D,F=F||"-V, --version",$=$||"output the version number";let J=this.createOption(F,$);return this._versionOptionName=J.attributeName(),this._registerOption(J),this.on("option:"+J.name(),()=>{this._outputConfiguration.writeOut(`${D}
22
22
  `),this._exit(0,"commander.version",D)}),this}description(D,F){if(D===void 0&&F===void 0)return this._description;if(this._description=D,F)this._argsDescription=F;return this}summary(D){if(D===void 0)return this._summary;return this._summary=D,this}alias(D){if(D===void 0)return this._aliases[0];let F=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler)F=this.commands[this.commands.length-1];if(D===F._name)throw Error("Command alias can't be the same as its name");let $=this.parent?._findCommand(D);if($){let J=[$.name()].concat($.aliases()).join("|");throw Error(`cannot add alias '${D}' to command '${this.name()}' as already have command '${J}'`)}return F._aliases.push(D),this}aliases(D){if(D===void 0)return this._aliases;return D.forEach((F)=>this.alias(F)),this}usage(D){if(D===void 0){if(this._usage)return this._usage;let F=this.registeredArguments.map(($)=>{return eJ($)});return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?F:[]).join(" ")}return this._usage=D,this}name(D){if(D===void 0)return this._name;return this._name=D,this}nameFromFilename(D){return this._name=yD.basename(D,yD.extname(D)),this}executableDir(D){if(D===void 0)return this._executableDir;return this._executableDir=D,this}helpInformation(D){let F=this.createHelp();if(F.helpWidth===void 0)F.helpWidth=D&&D.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth();return F.formatHelp(this,F)}_getHelpContext(D){D=D||{};let F={error:!!D.error},$;if(F.error)$=(J)=>this._outputConfiguration.writeErr(J);else $=(J)=>this._outputConfiguration.writeOut(J);return F.write=D.write||$,F.command=this,F}outputHelp(D){let F;if(typeof D==="function")F=D,D=void 0;let $=this._getHelpContext(D);this._getCommandAndAncestors().reverse().forEach((B)=>B.emit("beforeAllHelp",$)),this.emit("beforeHelp",$);let J=this.helpInformation($);if(F){if(J=F(J),typeof J!=="string"&&!Buffer.isBuffer(J))throw Error("outputHelp callback must return a string or a Buffer")}if($.write(J),this._getHelpOption()?.long)this.emit(this._getHelpOption().long);this.emit("afterHelp",$),this._getCommandAndAncestors().forEach((B)=>B.emit("afterAllHelp",$))}helpOption(D,F){if(typeof D==="boolean"){if(D)this._helpOption=this._helpOption??void 0;else this._helpOption=null;return this}return D=D??"-h, --help",F=F??"display help for command",this._helpOption=this.createOption(D,F),this}_getHelpOption(){if(this._helpOption===void 0)this.helpOption(void 0,void 0);return this._helpOption}addHelpOption(D){return this._helpOption=D,this}help(D){this.outputHelp(D);let F=m.exitCode||0;if(F===0&&D&&typeof D!=="function"&&D.error)F=1;this._exit(F,"commander.help","(outputHelp)")}addHelpText(D,F){let $=["beforeAll","before","after","afterAll"];if(!$.includes(D))throw Error(`Unexpected value for position to addHelpText.
23
23
  Expecting one of '${$.join("', '")}'`);let J=`${D}Help`;return this.on(J,(B)=>{let X;if(typeof F==="function")X=F({error:B.error,command:B.command});else X=F;if(X)B.write(`${X}
24
- `)}),this}_outputHelpIfRequested(D){let F=this._getHelpOption();if(F&&D.find((J)=>F.is(J)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function u5(D){return D.map((F)=>{if(!F.startsWith("--inspect"))return F;let $,J="127.0.0.1",B="9229",X;if((X=F.match(/^(--inspect(-brk)?)$/))!==null)$=X[1];else if((X=F.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if($=X[1],/^\d+$/.test(X[3]))B=X[3];else J=X[3];else if((X=F.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)$=X[1],J=X[3],B=X[4];if($&&B!=="0")return`${$}=${J}:${parseInt(B)+1}`;return F})}$B.Command=K6});var m5=l((QB)=>{var{Argument:y5}=d3(),{Command:M6}=x5(),{CommanderError:BB,InvalidArgumentError:h5}=w0(),{Help:XB}=H6(),{Option:g5}=V6();QB.program=new M6;QB.createCommand=(D)=>new M6(D);QB.createOption=(D,F)=>new g5(D,F);QB.createArgument=(D,F)=>new y5(D,F);QB.Command=M6;QB.Option=g5;QB.Argument=y5;QB.Help=XB;QB.CommanderError=BB;QB.InvalidArgumentError=h5;QB.InvalidOptionArgumentError=h5});var w,A6,M,ID=(D)=>{switch(typeof D){case"undefined":return M.undefined;case"string":return M.string;case"number":return Number.isNaN(D)?M.nan:M.number;case"boolean":return M.boolean;case"function":return M.function;case"bigint":return M.bigint;case"symbol":return M.symbol;case"object":if(Array.isArray(D))return M.array;if(D===null)return M.null;if(D.then&&typeof D.then==="function"&&D.catch&&typeof D.catch==="function")return M.promise;if(typeof Map<"u"&&D instanceof Map)return M.map;if(typeof Set<"u"&&D instanceof Set)return M.set;if(typeof Date<"u"&&D instanceof Date)return M.date;return M.object;default:return M.unknown}};var f0=I(()=>{(function(D){D.assertEqual=(B)=>{};function F(B){}D.assertIs=F;function $(B){throw Error()}D.assertNever=$,D.arrayToEnum=(B)=>{let X={};for(let Q of B)X[Q]=Q;return X},D.getValidEnumValues=(B)=>{let X=D.objectKeys(B).filter((Y)=>typeof B[B[Y]]!=="number"),Q={};for(let Y of X)Q[Y]=B[Y];return D.objectValues(Q)},D.objectValues=(B)=>{return D.objectKeys(B).map(function(X){return B[X]})},D.objectKeys=typeof Object.keys==="function"?(B)=>Object.keys(B):(B)=>{let X=[];for(let Q in B)if(Object.prototype.hasOwnProperty.call(B,Q))X.push(Q);return X},D.find=(B,X)=>{for(let Q of B)if(X(Q))return Q;return},D.isInteger=typeof Number.isInteger==="function"?(B)=>Number.isInteger(B):(B)=>typeof B==="number"&&Number.isFinite(B)&&Math.floor(B)===B;function J(B,X=" | "){return B.map((Q)=>typeof Q==="string"?`'${Q}'`:Q).join(X)}D.joinValues=J,D.jsonStringifyReplacer=(B,X)=>{if(typeof X==="bigint")return X.toString();return X}})(w||(w={}));(function(D){D.mergeShapes=(F,$)=>{return{...F,...$}}})(A6||(A6={}));M=w.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"])});var K,jB=(D)=>{return JSON.stringify(D,null,2).replace(/"([^"]+)":/g,"$1:")},XD;var i3=I(()=>{f0();K=w.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"]);XD=class XD extends Error{get errors(){return this.issues}constructor(D){super();this.issues=[],this.addIssue=($)=>{this.issues=[...this.issues,$]},this.addIssues=($=[])=>{this.issues=[...this.issues,...$]};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(B){return B.message},$={_errors:[]},J=(B)=>{for(let X of B.issues)if(X.code==="invalid_union")X.unionErrors.map(J);else if(X.code==="invalid_return_type")J(X.returnTypeError);else if(X.code==="invalid_arguments")J(X.argumentsError);else if(X.path.length===0)$._errors.push(F(X));else{let Q=$,Y=0;while(Y<X.path.length){let q=X.path[Y];if(Y!==X.path.length-1)Q[q]=Q[q]||{_errors:[]};else Q[q]=Q[q]||{_errors:[]},Q[q]._errors.push(F(X));Q=Q[q],Y++}}};return J(this),$}static assert(D){if(!(D instanceof XD))throw Error(`Not a ZodError: ${D}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,w.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(D=(F)=>F.message){let F={},$=[];for(let J of this.issues)if(J.path.length>0){let B=J.path[0];F[B]=F[B]||[],F[B].push(D(J))}else $.push(D(J));return{formErrors:$,fieldErrors:F}}get formErrors(){return this.flatten()}};XD.create=(D)=>{return new XD(D)}});var _B=(D,F)=>{let $;switch(D.code){case K.invalid_type:if(D.received===M.undefined)$="Required";else $=`Expected ${D.expected}, received ${D.received}`;break;case K.invalid_literal:$=`Invalid literal value, expected ${JSON.stringify(D.expected,w.jsonStringifyReplacer)}`;break;case K.unrecognized_keys:$=`Unrecognized key(s) in object: ${w.joinValues(D.keys,", ")}`;break;case K.invalid_union:$="Invalid input";break;case K.invalid_union_discriminator:$=`Invalid discriminator value. Expected ${w.joinValues(D.options)}`;break;case K.invalid_enum_value:$=`Invalid enum value. Expected ${w.joinValues(D.options)}, received '${D.received}'`;break;case K.invalid_arguments:$="Invalid function arguments";break;case K.invalid_return_type:$="Invalid function return type";break;case K.invalid_date:$="Invalid date";break;case K.invalid_string:if(typeof D.validation==="object")if("includes"in D.validation){if($=`Invalid input: must include "${D.validation.includes}"`,typeof D.validation.position==="number")$=`${$} at one or more positions greater than or equal to ${D.validation.position}`}else if("startsWith"in D.validation)$=`Invalid input: must start with "${D.validation.startsWith}"`;else if("endsWith"in D.validation)$=`Invalid input: must end with "${D.validation.endsWith}"`;else w.assertNever(D.validation);else if(D.validation!=="regex")$=`Invalid ${D.validation}`;else $="Invalid";break;case K.too_small:if(D.type==="array")$=`Array must contain ${D.exact?"exactly":D.inclusive?"at least":"more than"} ${D.minimum} element(s)`;else if(D.type==="string")$=`String must contain ${D.exact?"exactly":D.inclusive?"at least":"over"} ${D.minimum} character(s)`;else if(D.type==="number")$=`Number must be ${D.exact?"exactly equal to ":D.inclusive?"greater than or equal to ":"greater than "}${D.minimum}`;else if(D.type==="bigint")$=`Number must be ${D.exact?"exactly equal to ":D.inclusive?"greater than or equal to ":"greater than "}${D.minimum}`;else if(D.type==="date")$=`Date must be ${D.exact?"exactly equal to ":D.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(D.minimum))}`;else $="Invalid input";break;case K.too_big:if(D.type==="array")$=`Array must contain ${D.exact?"exactly":D.inclusive?"at most":"less than"} ${D.maximum} element(s)`;else if(D.type==="string")$=`String must contain ${D.exact?"exactly":D.inclusive?"at most":"under"} ${D.maximum} character(s)`;else if(D.type==="number")$=`Number must be ${D.exact?"exactly":D.inclusive?"less than or equal to":"less than"} ${D.maximum}`;else if(D.type==="bigint")$=`BigInt must be ${D.exact?"exactly":D.inclusive?"less than or equal to":"less than"} ${D.maximum}`;else if(D.type==="date")$=`Date must be ${D.exact?"exactly":D.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(D.maximum))}`;else $="Invalid input";break;case K.custom:$="Invalid input";break;case K.invalid_intersection_types:$="Intersection results could not be merged";break;case K.not_multiple_of:$=`Number must be a multiple of ${D.multipleOf}`;break;case K.not_finite:$="Number must be finite";break;default:$=F.defaultError,w.assertNever(D)}return{message:$}},hD;var R6=I(()=>{i3();f0();hD=_B});function LB(D){a5=D}function s2(){return a5}var a5;var r3=I(()=>{R6();a5=hD});function O(D,F){let $=s2(),J=u0({issueData:F,data:D.data,path:D.path,errorMaps:[D.common.contextualErrorMap,D.schemaErrorMap,$,$===hD?void 0:hD].filter((B)=>!!B)});D.common.issues.push(J)}class n{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 $=[];for(let J of F){if(J.status==="aborted")return T;if(J.status==="dirty")D.dirty();$.push(J.value)}return{status:D.value,value:$}}static async mergeObjectAsync(D,F){let $=[];for(let J of F){let B=await J.key,X=await J.value;$.push({key:B,value:X})}return n.mergeObjectSync(D,$)}static mergeObjectSync(D,F){let $={};for(let J of F){let{key:B,value:X}=J;if(B.status==="aborted")return T;if(X.status==="aborted")return T;if(B.status==="dirty")D.dirty();if(X.status==="dirty")D.dirty();if(B.value!=="__proto__"&&(typeof X.value<"u"||J.alwaysSet))$[B.value]=X.value}return{status:D.value,value:$}}}var u0=(D)=>{let{data:F,path:$,errorMaps:J,issueData:B}=D,X=[...$,...B.path||[]],Q={...B,path:X};if(B.message!==void 0)return{...B,path:X,message:B.message};let Y="",q=J.filter((G)=>!!G).slice().reverse();for(let G of q)Y=G(Q,{data:F,defaultError:Y}).message;return{...B,path:X,message:Y}},ZB,T,z2=(D)=>({status:"dirty",value:D}),e=(D)=>({status:"valid",value:D}),n3=(D)=>D.status==="aborted",o3=(D)=>D.status==="dirty",eD=(D)=>D.status==="valid",a2=(D)=>typeof Promise<"u"&&D instanceof Promise;var O6=I(()=>{r3();R6();ZB=[];T=Object.freeze({status:"aborted"})});var t5=()=>{};var j;var e5=I(()=>{(function(D){D.errToObj=(F)=>typeof F==="string"?{message:F}:F||{},D.toString=(F)=>typeof F==="string"?F:F?.message})(j||(j={}))});class _D{constructor(D,F,$,J){this._cachedPath=[],this.parent=D,this.data=F,this._path=$,this._key=J}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 S(D){if(!D)return{};let{errorMap:F,invalid_type_error:$,required_error:J,description:B}=D;if(F&&($||J))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(F)return{errorMap:F,description:B};return{errorMap:(Q,Y)=>{let{message:q}=D;if(Q.code==="invalid_enum_value")return{message:q??Y.defaultError};if(typeof Y.data>"u")return{message:q??J??Y.defaultError};if(Q.code!=="invalid_type")return{message:Y.defaultError};return{message:q??$??Y.defaultError}},description:B}}class k{get description(){return this._def.description}_getType(D){return ID(D.data)}_getOrReturnCtx(D,F){return F||{common:D.parent.common,data:D.data,parsedType:ID(D.data),schemaErrorMap:this._def.errorMap,path:D.path,parent:D.parent}}_processInputParams(D){return{status:new n,ctx:{common:D.parent.common,data:D.data,parsedType:ID(D.data),schemaErrorMap:this._def.errorMap,path:D.path,parent:D.parent}}}_parseSync(D){let F=this._parse(D);if(a2(F))throw Error("Synchronous parse encountered promise.");return F}_parseAsync(D){let F=this._parse(D);return Promise.resolve(F)}parse(D,F){let $=this.safeParse(D,F);if($.success)return $.data;throw $.error}safeParse(D,F){let $={common:{issues:[],async:F?.async??!1,contextualErrorMap:F?.errorMap},path:F?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:D,parsedType:ID(D)},J=this._parseSync({data:D,path:$.path,parent:$});return D7($,J)}"~validate"(D){let F={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:D,parsedType:ID(D)};if(!this["~standard"].async)try{let $=this._parseSync({data:D,path:[],parent:F});return eD($)?{value:$.value}:{issues:F.common.issues}}catch($){if($?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;F.common={issues:[],async:!0}}return this._parseAsync({data:D,path:[],parent:F}).then(($)=>eD($)?{value:$.value}:{issues:F.common.issues})}async parseAsync(D,F){let $=await this.safeParseAsync(D,F);if($.success)return $.data;throw $.error}async safeParseAsync(D,F){let $={common:{issues:[],contextualErrorMap:F?.errorMap,async:!0},path:F?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:D,parsedType:ID(D)},J=this._parse({data:D,path:$.path,parent:$}),B=await(a2(J)?J:Promise.resolve(J));return D7($,B)}refine(D,F){let $=(J)=>{if(typeof F==="string"||typeof F>"u")return{message:F};else if(typeof F==="function")return F(J);else return F};return this._refinement((J,B)=>{let X=D(J),Q=()=>B.addIssue({code:K.custom,...$(J)});if(typeof Promise<"u"&&X instanceof Promise)return X.then((Y)=>{if(!Y)return Q(),!1;else return!0});if(!X)return Q(),!1;else return!0})}refinement(D,F){return this._refinement(($,J)=>{if(!D($))return J.addIssue(typeof F==="function"?F($,J):F),!1;else return!0})}_refinement(D){return new LD({schema:this,typeName:N.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 jD.create(this,this._def)}nullable(){return mD.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return CD.create(this)}promise(){return A2.create(this,this._def)}or(D){return J0.create([this,D],this._def)}and(D){return B0.create(this,D,this._def)}transform(D){return new LD({...S(this._def),schema:this,typeName:N.ZodEffects,effect:{type:"transform",transform:D}})}default(D){let F=typeof D==="function"?D:()=>D;return new q0({...S(this._def),innerType:this,defaultValue:F,typeName:N.ZodDefault})}brand(){return new a3({typeName:N.ZodBranded,type:this,...S(this._def)})}catch(D){let F=typeof D==="function"?D:()=>D;return new G0({...S(this._def),innerType:this,catchValue:F,typeName:N.ZodCatch})}describe(D){return new this.constructor({...this._def,description:D})}pipe(D){return l0.create(this,D)}readonly(){return H0.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}function J7(D){let F="[0-5]\\d";if(D.precision)F=`${F}\\.\\d{${D.precision}}`;else if(D.precision==null)F=`${F}(\\.\\d+)?`;let $=D.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${F})${$}`}function lB(D){return new RegExp(`^${J7(D)}$`)}function B7(D){let F=`${$7}T${J7(D)}`,$=[];if($.push(D.local?"Z?":"Z"),D.offset)$.push("([+-]\\d{2}:?\\d{2})");return F=`${F}(${$.join("|")})`,new RegExp(`^${F}$`)}function pB(D,F){if((F==="v4"||!F)&&fB.test(D))return!0;if((F==="v6"||!F)&&xB.test(D))return!0;return!1}function dB(D,F){if(!PB.test(D))return!1;try{let[$]=D.split(".");if(!$)return!1;let J=$.replace(/-/g,"+").replace(/_/g,"/").padEnd($.length+(4-$.length%4)%4,"="),B=JSON.parse(atob(J));if(typeof B!=="object"||B===null)return!1;if("typ"in B&&B?.typ!=="JWT")return!1;if(!B.alg)return!1;if(F&&B.alg!==F)return!1;return!0}catch{return!1}}function cB(D,F){if((F==="v4"||!F)&&uB.test(D))return!0;if((F==="v6"||!F)&&yB.test(D))return!0;return!1}function iB(D,F){let $=(D.toString().split(".")[1]||"").length,J=(F.toString().split(".")[1]||"").length,B=$>J?$:J,X=Number.parseInt(D.toFixed(B).replace(".","")),Q=Number.parseInt(F.toFixed(B).replace(".",""));return X%Q/10**B}function t2(D){if(D instanceof g){let F={};for(let $ in D.shape){let J=D.shape[$];F[$]=jD.create(t2(J))}return new g({...D._def,shape:()=>F})}else if(D instanceof CD)return new CD({...D._def,type:t2(D.element)});else if(D instanceof jD)return jD.create(t2(D.unwrap()));else if(D instanceof mD)return mD.create(t2(D.unwrap()));else if(D instanceof bD)return bD.create(D.items.map((F)=>t2(F)));else return D}function j6(D,F){let $=ID(D),J=ID(F);if(D===F)return{valid:!0,data:D};else if($===M.object&&J===M.object){let B=w.objectKeys(F),X=w.objectKeys(D).filter((Y)=>B.indexOf(Y)!==-1),Q={...D,...F};for(let Y of X){let q=j6(D[Y],F[Y]);if(!q.valid)return{valid:!1};Q[Y]=q.data}return{valid:!0,data:Q}}else if($===M.array&&J===M.array){if(D.length!==F.length)return{valid:!1};let B=[];for(let X=0;X<D.length;X++){let Q=D[X],Y=F[X],q=j6(Q,Y);if(!q.valid)return{valid:!1};B.push(q.data)}return{valid:!0,data:B}}else if($===M.date&&J===M.date&&+D===+F)return{valid:!0,data:D};else return{valid:!1}}function X7(D,F){return new J2({values:D,typeName:N.ZodEnum,...S(F)})}function F7(D,F){let $=typeof D==="function"?D(F):typeof D==="string"?{message:D}:D;return typeof $==="string"?{message:$}:$}function Q7(D,F={},$){if(D)return M2.create().superRefine((J,B)=>{let X=D(J);if(X instanceof Promise)return X.then((Q)=>{if(!Q){let Y=F7(F,J),q=Y.fatal??$??!0;B.addIssue({code:"custom",...Y,fatal:q})}});if(!X){let Q=F7(F,J),Y=Q.fatal??$??!0;B.addIssue({code:"custom",...Q,fatal:Y})}return});return M2.create()}var D7=(D,F)=>{if(eD(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 $=new XD(D.common.issues);return this._error=$,this._error}}}},TB,NB,IB,SB,bB,PB,vB,kB,wB="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",C6,fB,uB,xB,yB,hB,gB,$7="((\\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])))",mB,OD,F2,$2,D0,K2,x0,F0,$0,M2,D2,SD,y0,CD,g,J0,gD=(D)=>{if(D instanceof X0)return gD(D.schema);else if(D instanceof LD)return gD(D.innerType());else if(D instanceof Q0)return[D.value];else if(D instanceof J2)return D.options;else if(D instanceof Y0)return w.objectValues(D.enum);else if(D instanceof q0)return gD(D._def.innerType);else if(D instanceof F0)return[void 0];else if(D instanceof $0)return[null];else if(D instanceof jD)return[void 0,...gD(D.unwrap())];else if(D instanceof mD)return[null,...gD(D.unwrap())];else if(D instanceof a3)return gD(D.unwrap());else if(D instanceof H0)return gD(D.unwrap());else if(D instanceof G0)return gD(D._def.innerType);else return[]},s3,B0,bD,h0,g0,E2,e2,X0,Q0,J2,Y0,A2,LD,jD,mD,q0,G0,m0,rB,a3,l0,H0,nB,N,oB=(D,F={message:`Input not instance of ${D.name}`})=>Q7(($)=>$ instanceof D,F),Y7,q7,sB,aB,G7,tB,eB,DX,FX,$X,JX,BX,XX,QX,YX,qX,GX,HX,VX,WX,UX,zX,KX,MX,EX,AX,RX,OX,CX,jX,_X,LX,ZX,TX,NX=()=>Y7().optional(),IX=()=>q7().optional(),SX=()=>G7().optional(),bX,PX;var H7=I(()=>{i3();r3();e5();O6();f0();TB=/^c[^\s-]{8,}$/i,NB=/^[0-9a-z]+$/,IB=/^[0-9A-HJKMNP-TV-Z]{26}$/i,SB=/^[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,bB=/^[a-z0-9_-]{21}$/i,PB=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,vB=/^[-+]?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)?)??$/,kB=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,fB=/^(?:(?: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])$/,uB=/^(?:(?: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])$/,xB=/^(([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]))$/,yB=/^(([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])$/,hB=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,gB=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,mB=new RegExp(`^${$7}$`);OD=class OD extends k{_parse(D){if(this._def.coerce)D.data=String(D.data);if(this._getType(D)!==M.string){let B=this._getOrReturnCtx(D);return O(B,{code:K.invalid_type,expected:M.string,received:B.parsedType}),T}let $=new n,J=void 0;for(let B of this._def.checks)if(B.kind==="min"){if(D.data.length<B.value)J=this._getOrReturnCtx(D,J),O(J,{code:K.too_small,minimum:B.value,type:"string",inclusive:!0,exact:!1,message:B.message}),$.dirty()}else if(B.kind==="max"){if(D.data.length>B.value)J=this._getOrReturnCtx(D,J),O(J,{code:K.too_big,maximum:B.value,type:"string",inclusive:!0,exact:!1,message:B.message}),$.dirty()}else if(B.kind==="length"){let X=D.data.length>B.value,Q=D.data.length<B.value;if(X||Q){if(J=this._getOrReturnCtx(D,J),X)O(J,{code:K.too_big,maximum:B.value,type:"string",inclusive:!0,exact:!0,message:B.message});else if(Q)O(J,{code:K.too_small,minimum:B.value,type:"string",inclusive:!0,exact:!0,message:B.message});$.dirty()}}else if(B.kind==="email"){if(!kB.test(D.data))J=this._getOrReturnCtx(D,J),O(J,{validation:"email",code:K.invalid_string,message:B.message}),$.dirty()}else if(B.kind==="emoji"){if(!C6)C6=new RegExp(wB,"u");if(!C6.test(D.data))J=this._getOrReturnCtx(D,J),O(J,{validation:"emoji",code:K.invalid_string,message:B.message}),$.dirty()}else if(B.kind==="uuid"){if(!SB.test(D.data))J=this._getOrReturnCtx(D,J),O(J,{validation:"uuid",code:K.invalid_string,message:B.message}),$.dirty()}else if(B.kind==="nanoid"){if(!bB.test(D.data))J=this._getOrReturnCtx(D,J),O(J,{validation:"nanoid",code:K.invalid_string,message:B.message}),$.dirty()}else if(B.kind==="cuid"){if(!TB.test(D.data))J=this._getOrReturnCtx(D,J),O(J,{validation:"cuid",code:K.invalid_string,message:B.message}),$.dirty()}else if(B.kind==="cuid2"){if(!NB.test(D.data))J=this._getOrReturnCtx(D,J),O(J,{validation:"cuid2",code:K.invalid_string,message:B.message}),$.dirty()}else if(B.kind==="ulid"){if(!IB.test(D.data))J=this._getOrReturnCtx(D,J),O(J,{validation:"ulid",code:K.invalid_string,message:B.message}),$.dirty()}else if(B.kind==="url")try{new URL(D.data)}catch{J=this._getOrReturnCtx(D,J),O(J,{validation:"url",code:K.invalid_string,message:B.message}),$.dirty()}else if(B.kind==="regex"){if(B.regex.lastIndex=0,!B.regex.test(D.data))J=this._getOrReturnCtx(D,J),O(J,{validation:"regex",code:K.invalid_string,message:B.message}),$.dirty()}else if(B.kind==="trim")D.data=D.data.trim();else if(B.kind==="includes"){if(!D.data.includes(B.value,B.position))J=this._getOrReturnCtx(D,J),O(J,{code:K.invalid_string,validation:{includes:B.value,position:B.position},message:B.message}),$.dirty()}else if(B.kind==="toLowerCase")D.data=D.data.toLowerCase();else if(B.kind==="toUpperCase")D.data=D.data.toUpperCase();else if(B.kind==="startsWith"){if(!D.data.startsWith(B.value))J=this._getOrReturnCtx(D,J),O(J,{code:K.invalid_string,validation:{startsWith:B.value},message:B.message}),$.dirty()}else if(B.kind==="endsWith"){if(!D.data.endsWith(B.value))J=this._getOrReturnCtx(D,J),O(J,{code:K.invalid_string,validation:{endsWith:B.value},message:B.message}),$.dirty()}else if(B.kind==="datetime"){if(!B7(B).test(D.data))J=this._getOrReturnCtx(D,J),O(J,{code:K.invalid_string,validation:"datetime",message:B.message}),$.dirty()}else if(B.kind==="date"){if(!mB.test(D.data))J=this._getOrReturnCtx(D,J),O(J,{code:K.invalid_string,validation:"date",message:B.message}),$.dirty()}else if(B.kind==="time"){if(!lB(B).test(D.data))J=this._getOrReturnCtx(D,J),O(J,{code:K.invalid_string,validation:"time",message:B.message}),$.dirty()}else if(B.kind==="duration"){if(!vB.test(D.data))J=this._getOrReturnCtx(D,J),O(J,{validation:"duration",code:K.invalid_string,message:B.message}),$.dirty()}else if(B.kind==="ip"){if(!pB(D.data,B.version))J=this._getOrReturnCtx(D,J),O(J,{validation:"ip",code:K.invalid_string,message:B.message}),$.dirty()}else if(B.kind==="jwt"){if(!dB(D.data,B.alg))J=this._getOrReturnCtx(D,J),O(J,{validation:"jwt",code:K.invalid_string,message:B.message}),$.dirty()}else if(B.kind==="cidr"){if(!cB(D.data,B.version))J=this._getOrReturnCtx(D,J),O(J,{validation:"cidr",code:K.invalid_string,message:B.message}),$.dirty()}else if(B.kind==="base64"){if(!hB.test(D.data))J=this._getOrReturnCtx(D,J),O(J,{validation:"base64",code:K.invalid_string,message:B.message}),$.dirty()}else if(B.kind==="base64url"){if(!gB.test(D.data))J=this._getOrReturnCtx(D,J),O(J,{validation:"base64url",code:K.invalid_string,message:B.message}),$.dirty()}else w.assertNever(B);return{status:$.value,value:D.data}}_regex(D,F,$){return this.refinement((J)=>D.test(J),{validation:F,code:K.invalid_string,...j.errToObj($)})}_addCheck(D){return new OD({...this._def,checks:[...this._def.checks,D]})}email(D){return this._addCheck({kind:"email",...j.errToObj(D)})}url(D){return this._addCheck({kind:"url",...j.errToObj(D)})}emoji(D){return this._addCheck({kind:"emoji",...j.errToObj(D)})}uuid(D){return this._addCheck({kind:"uuid",...j.errToObj(D)})}nanoid(D){return this._addCheck({kind:"nanoid",...j.errToObj(D)})}cuid(D){return this._addCheck({kind:"cuid",...j.errToObj(D)})}cuid2(D){return this._addCheck({kind:"cuid2",...j.errToObj(D)})}ulid(D){return this._addCheck({kind:"ulid",...j.errToObj(D)})}base64(D){return this._addCheck({kind:"base64",...j.errToObj(D)})}base64url(D){return this._addCheck({kind:"base64url",...j.errToObj(D)})}jwt(D){return this._addCheck({kind:"jwt",...j.errToObj(D)})}ip(D){return this._addCheck({kind:"ip",...j.errToObj(D)})}cidr(D){return this._addCheck({kind:"cidr",...j.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,...j.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,...j.errToObj(D?.message)})}duration(D){return this._addCheck({kind:"duration",...j.errToObj(D)})}regex(D,F){return this._addCheck({kind:"regex",regex:D,...j.errToObj(F)})}includes(D,F){return this._addCheck({kind:"includes",value:D,position:F?.position,...j.errToObj(F?.message)})}startsWith(D,F){return this._addCheck({kind:"startsWith",value:D,...j.errToObj(F)})}endsWith(D,F){return this._addCheck({kind:"endsWith",value:D,...j.errToObj(F)})}min(D,F){return this._addCheck({kind:"min",value:D,...j.errToObj(F)})}max(D,F){return this._addCheck({kind:"max",value:D,...j.errToObj(F)})}length(D,F){return this._addCheck({kind:"length",value:D,...j.errToObj(F)})}nonempty(D){return this.min(1,j.errToObj(D))}trim(){return new OD({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new OD({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new OD({...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}};OD.create=(D)=>{return new OD({checks:[],typeName:N.ZodString,coerce:D?.coerce??!1,...S(D)})};F2=class F2 extends k{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)!==M.number){let B=this._getOrReturnCtx(D);return O(B,{code:K.invalid_type,expected:M.number,received:B.parsedType}),T}let $=void 0,J=new n;for(let B of this._def.checks)if(B.kind==="int"){if(!w.isInteger(D.data))$=this._getOrReturnCtx(D,$),O($,{code:K.invalid_type,expected:"integer",received:"float",message:B.message}),J.dirty()}else if(B.kind==="min"){if(B.inclusive?D.data<B.value:D.data<=B.value)$=this._getOrReturnCtx(D,$),O($,{code:K.too_small,minimum:B.value,type:"number",inclusive:B.inclusive,exact:!1,message:B.message}),J.dirty()}else if(B.kind==="max"){if(B.inclusive?D.data>B.value:D.data>=B.value)$=this._getOrReturnCtx(D,$),O($,{code:K.too_big,maximum:B.value,type:"number",inclusive:B.inclusive,exact:!1,message:B.message}),J.dirty()}else if(B.kind==="multipleOf"){if(iB(D.data,B.value)!==0)$=this._getOrReturnCtx(D,$),O($,{code:K.not_multiple_of,multipleOf:B.value,message:B.message}),J.dirty()}else if(B.kind==="finite"){if(!Number.isFinite(D.data))$=this._getOrReturnCtx(D,$),O($,{code:K.not_finite,message:B.message}),J.dirty()}else w.assertNever(B);return{status:J.value,value:D.data}}gte(D,F){return this.setLimit("min",D,!0,j.toString(F))}gt(D,F){return this.setLimit("min",D,!1,j.toString(F))}lte(D,F){return this.setLimit("max",D,!0,j.toString(F))}lt(D,F){return this.setLimit("max",D,!1,j.toString(F))}setLimit(D,F,$,J){return new F2({...this._def,checks:[...this._def.checks,{kind:D,value:F,inclusive:$,message:j.toString(J)}]})}_addCheck(D){return new F2({...this._def,checks:[...this._def.checks,D]})}int(D){return this._addCheck({kind:"int",message:j.toString(D)})}positive(D){return this._addCheck({kind:"min",value:0,inclusive:!1,message:j.toString(D)})}negative(D){return this._addCheck({kind:"max",value:0,inclusive:!1,message:j.toString(D)})}nonpositive(D){return this._addCheck({kind:"max",value:0,inclusive:!0,message:j.toString(D)})}nonnegative(D){return this._addCheck({kind:"min",value:0,inclusive:!0,message:j.toString(D)})}multipleOf(D,F){return this._addCheck({kind:"multipleOf",value:D,message:j.toString(F)})}finite(D){return this._addCheck({kind:"finite",message:j.toString(D)})}safe(D){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:j.toString(D)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:j.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"&&w.isInteger(D.value))}get isFinite(){let D=null,F=null;for(let $ of this._def.checks)if($.kind==="finite"||$.kind==="int"||$.kind==="multipleOf")return!0;else if($.kind==="min"){if(F===null||$.value>F)F=$.value}else if($.kind==="max"){if(D===null||$.value<D)D=$.value}return Number.isFinite(F)&&Number.isFinite(D)}};F2.create=(D)=>{return new F2({checks:[],typeName:N.ZodNumber,coerce:D?.coerce||!1,...S(D)})};$2=class $2 extends k{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)!==M.bigint)return this._getInvalidInput(D);let $=void 0,J=new n;for(let B of this._def.checks)if(B.kind==="min"){if(B.inclusive?D.data<B.value:D.data<=B.value)$=this._getOrReturnCtx(D,$),O($,{code:K.too_small,type:"bigint",minimum:B.value,inclusive:B.inclusive,message:B.message}),J.dirty()}else if(B.kind==="max"){if(B.inclusive?D.data>B.value:D.data>=B.value)$=this._getOrReturnCtx(D,$),O($,{code:K.too_big,type:"bigint",maximum:B.value,inclusive:B.inclusive,message:B.message}),J.dirty()}else if(B.kind==="multipleOf"){if(D.data%B.value!==BigInt(0))$=this._getOrReturnCtx(D,$),O($,{code:K.not_multiple_of,multipleOf:B.value,message:B.message}),J.dirty()}else w.assertNever(B);return{status:J.value,value:D.data}}_getInvalidInput(D){let F=this._getOrReturnCtx(D);return O(F,{code:K.invalid_type,expected:M.bigint,received:F.parsedType}),T}gte(D,F){return this.setLimit("min",D,!0,j.toString(F))}gt(D,F){return this.setLimit("min",D,!1,j.toString(F))}lte(D,F){return this.setLimit("max",D,!0,j.toString(F))}lt(D,F){return this.setLimit("max",D,!1,j.toString(F))}setLimit(D,F,$,J){return new $2({...this._def,checks:[...this._def.checks,{kind:D,value:F,inclusive:$,message:j.toString(J)}]})}_addCheck(D){return new $2({...this._def,checks:[...this._def.checks,D]})}positive(D){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:j.toString(D)})}negative(D){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:j.toString(D)})}nonpositive(D){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:j.toString(D)})}nonnegative(D){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:j.toString(D)})}multipleOf(D,F){return this._addCheck({kind:"multipleOf",value:D,message:j.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}};$2.create=(D)=>{return new $2({checks:[],typeName:N.ZodBigInt,coerce:D?.coerce??!1,...S(D)})};D0=class D0 extends k{_parse(D){if(this._def.coerce)D.data=Boolean(D.data);if(this._getType(D)!==M.boolean){let $=this._getOrReturnCtx(D);return O($,{code:K.invalid_type,expected:M.boolean,received:$.parsedType}),T}return e(D.data)}};D0.create=(D)=>{return new D0({typeName:N.ZodBoolean,coerce:D?.coerce||!1,...S(D)})};K2=class K2 extends k{_parse(D){if(this._def.coerce)D.data=new Date(D.data);if(this._getType(D)!==M.date){let B=this._getOrReturnCtx(D);return O(B,{code:K.invalid_type,expected:M.date,received:B.parsedType}),T}if(Number.isNaN(D.data.getTime())){let B=this._getOrReturnCtx(D);return O(B,{code:K.invalid_date}),T}let $=new n,J=void 0;for(let B of this._def.checks)if(B.kind==="min"){if(D.data.getTime()<B.value)J=this._getOrReturnCtx(D,J),O(J,{code:K.too_small,message:B.message,inclusive:!0,exact:!1,minimum:B.value,type:"date"}),$.dirty()}else if(B.kind==="max"){if(D.data.getTime()>B.value)J=this._getOrReturnCtx(D,J),O(J,{code:K.too_big,message:B.message,inclusive:!0,exact:!1,maximum:B.value,type:"date"}),$.dirty()}else w.assertNever(B);return{status:$.value,value:new Date(D.data.getTime())}}_addCheck(D){return new K2({...this._def,checks:[...this._def.checks,D]})}min(D,F){return this._addCheck({kind:"min",value:D.getTime(),message:j.toString(F)})}max(D,F){return this._addCheck({kind:"max",value:D.getTime(),message:j.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}};K2.create=(D)=>{return new K2({checks:[],coerce:D?.coerce||!1,typeName:N.ZodDate,...S(D)})};x0=class x0 extends k{_parse(D){if(this._getType(D)!==M.symbol){let $=this._getOrReturnCtx(D);return O($,{code:K.invalid_type,expected:M.symbol,received:$.parsedType}),T}return e(D.data)}};x0.create=(D)=>{return new x0({typeName:N.ZodSymbol,...S(D)})};F0=class F0 extends k{_parse(D){if(this._getType(D)!==M.undefined){let $=this._getOrReturnCtx(D);return O($,{code:K.invalid_type,expected:M.undefined,received:$.parsedType}),T}return e(D.data)}};F0.create=(D)=>{return new F0({typeName:N.ZodUndefined,...S(D)})};$0=class $0 extends k{_parse(D){if(this._getType(D)!==M.null){let $=this._getOrReturnCtx(D);return O($,{code:K.invalid_type,expected:M.null,received:$.parsedType}),T}return e(D.data)}};$0.create=(D)=>{return new $0({typeName:N.ZodNull,...S(D)})};M2=class M2 extends k{constructor(){super(...arguments);this._any=!0}_parse(D){return e(D.data)}};M2.create=(D)=>{return new M2({typeName:N.ZodAny,...S(D)})};D2=class D2 extends k{constructor(){super(...arguments);this._unknown=!0}_parse(D){return e(D.data)}};D2.create=(D)=>{return new D2({typeName:N.ZodUnknown,...S(D)})};SD=class SD extends k{_parse(D){let F=this._getOrReturnCtx(D);return O(F,{code:K.invalid_type,expected:M.never,received:F.parsedType}),T}};SD.create=(D)=>{return new SD({typeName:N.ZodNever,...S(D)})};y0=class y0 extends k{_parse(D){if(this._getType(D)!==M.undefined){let $=this._getOrReturnCtx(D);return O($,{code:K.invalid_type,expected:M.void,received:$.parsedType}),T}return e(D.data)}};y0.create=(D)=>{return new y0({typeName:N.ZodVoid,...S(D)})};CD=class CD extends k{_parse(D){let{ctx:F,status:$}=this._processInputParams(D),J=this._def;if(F.parsedType!==M.array)return O(F,{code:K.invalid_type,expected:M.array,received:F.parsedType}),T;if(J.exactLength!==null){let X=F.data.length>J.exactLength.value,Q=F.data.length<J.exactLength.value;if(X||Q)O(F,{code:X?K.too_big:K.too_small,minimum:Q?J.exactLength.value:void 0,maximum:X?J.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:J.exactLength.message}),$.dirty()}if(J.minLength!==null){if(F.data.length<J.minLength.value)O(F,{code:K.too_small,minimum:J.minLength.value,type:"array",inclusive:!0,exact:!1,message:J.minLength.message}),$.dirty()}if(J.maxLength!==null){if(F.data.length>J.maxLength.value)O(F,{code:K.too_big,maximum:J.maxLength.value,type:"array",inclusive:!0,exact:!1,message:J.maxLength.message}),$.dirty()}if(F.common.async)return Promise.all([...F.data].map((X,Q)=>{return J.type._parseAsync(new _D(F,X,F.path,Q))})).then((X)=>{return n.mergeArray($,X)});let B=[...F.data].map((X,Q)=>{return J.type._parseSync(new _D(F,X,F.path,Q))});return n.mergeArray($,B)}get element(){return this._def.type}min(D,F){return new CD({...this._def,minLength:{value:D,message:j.toString(F)}})}max(D,F){return new CD({...this._def,maxLength:{value:D,message:j.toString(F)}})}length(D,F){return new CD({...this._def,exactLength:{value:D,message:j.toString(F)}})}nonempty(D){return this.min(1,D)}};CD.create=(D,F)=>{return new CD({type:D,minLength:null,maxLength:null,exactLength:null,typeName:N.ZodArray,...S(F)})};g=class g extends k{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=w.objectKeys(D);return this._cached={shape:D,keys:F},this._cached}_parse(D){if(this._getType(D)!==M.object){let q=this._getOrReturnCtx(D);return O(q,{code:K.invalid_type,expected:M.object,received:q.parsedType}),T}let{status:$,ctx:J}=this._processInputParams(D),{shape:B,keys:X}=this._getCached(),Q=[];if(!(this._def.catchall instanceof SD&&this._def.unknownKeys==="strip")){for(let q in J.data)if(!X.includes(q))Q.push(q)}let Y=[];for(let q of X){let G=B[q],H=J.data[q];Y.push({key:{status:"valid",value:q},value:G._parse(new _D(J,H,J.path,q)),alwaysSet:q in J.data})}if(this._def.catchall instanceof SD){let q=this._def.unknownKeys;if(q==="passthrough")for(let G of Q)Y.push({key:{status:"valid",value:G},value:{status:"valid",value:J.data[G]}});else if(q==="strict"){if(Q.length>0)O(J,{code:K.unrecognized_keys,keys:Q}),$.dirty()}else if(q==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let q=this._def.catchall;for(let G of Q){let H=J.data[G];Y.push({key:{status:"valid",value:G},value:q._parse(new _D(J,H,J.path,G)),alwaysSet:G in J.data})}}if(J.common.async)return Promise.resolve().then(async()=>{let q=[];for(let G of Y){let H=await G.key,V=await G.value;q.push({key:H,value:V,alwaysSet:G.alwaysSet})}return q}).then((q)=>{return n.mergeObjectSync($,q)});else return n.mergeObjectSync($,Y)}get shape(){return this._def.shape()}strict(D){return j.errToObj,new g({...this._def,unknownKeys:"strict",...D!==void 0?{errorMap:(F,$)=>{let J=this._def.errorMap?.(F,$).message??$.defaultError;if(F.code==="unrecognized_keys")return{message:j.errToObj(D).message??J};return{message:J}}}:{}})}strip(){return new g({...this._def,unknownKeys:"strip"})}passthrough(){return new g({...this._def,unknownKeys:"passthrough"})}extend(D){return new g({...this._def,shape:()=>({...this._def.shape(),...D})})}merge(D){return new g({unknownKeys:D._def.unknownKeys,catchall:D._def.catchall,shape:()=>({...this._def.shape(),...D._def.shape()}),typeName:N.ZodObject})}setKey(D,F){return this.augment({[D]:F})}catchall(D){return new g({...this._def,catchall:D})}pick(D){let F={};for(let $ of w.objectKeys(D))if(D[$]&&this.shape[$])F[$]=this.shape[$];return new g({...this._def,shape:()=>F})}omit(D){let F={};for(let $ of w.objectKeys(this.shape))if(!D[$])F[$]=this.shape[$];return new g({...this._def,shape:()=>F})}deepPartial(){return t2(this)}partial(D){let F={};for(let $ of w.objectKeys(this.shape)){let J=this.shape[$];if(D&&!D[$])F[$]=J;else F[$]=J.optional()}return new g({...this._def,shape:()=>F})}required(D){let F={};for(let $ of w.objectKeys(this.shape))if(D&&!D[$])F[$]=this.shape[$];else{let B=this.shape[$];while(B instanceof jD)B=B._def.innerType;F[$]=B}return new g({...this._def,shape:()=>F})}keyof(){return X7(w.objectKeys(this.shape))}};g.create=(D,F)=>{return new g({shape:()=>D,unknownKeys:"strip",catchall:SD.create(),typeName:N.ZodObject,...S(F)})};g.strictCreate=(D,F)=>{return new g({shape:()=>D,unknownKeys:"strict",catchall:SD.create(),typeName:N.ZodObject,...S(F)})};g.lazycreate=(D,F)=>{return new g({shape:D,unknownKeys:"strip",catchall:SD.create(),typeName:N.ZodObject,...S(F)})};J0=class J0 extends k{_parse(D){let{ctx:F}=this._processInputParams(D),$=this._def.options;function J(B){for(let Q of B)if(Q.result.status==="valid")return Q.result;for(let Q of B)if(Q.result.status==="dirty")return F.common.issues.push(...Q.ctx.common.issues),Q.result;let X=B.map((Q)=>new XD(Q.ctx.common.issues));return O(F,{code:K.invalid_union,unionErrors:X}),T}if(F.common.async)return Promise.all($.map(async(B)=>{let X={...F,common:{...F.common,issues:[]},parent:null};return{result:await B._parseAsync({data:F.data,path:F.path,parent:X}),ctx:X}})).then(J);else{let B=void 0,X=[];for(let Y of $){let q={...F,common:{...F.common,issues:[]},parent:null},G=Y._parseSync({data:F.data,path:F.path,parent:q});if(G.status==="valid")return G;else if(G.status==="dirty"&&!B)B={result:G,ctx:q};if(q.common.issues.length)X.push(q.common.issues)}if(B)return F.common.issues.push(...B.ctx.common.issues),B.result;let Q=X.map((Y)=>new XD(Y));return O(F,{code:K.invalid_union,unionErrors:Q}),T}}get options(){return this._def.options}};J0.create=(D,F)=>{return new J0({options:D,typeName:N.ZodUnion,...S(F)})};s3=class s3 extends k{_parse(D){let{ctx:F}=this._processInputParams(D);if(F.parsedType!==M.object)return O(F,{code:K.invalid_type,expected:M.object,received:F.parsedType}),T;let $=this.discriminator,J=F.data[$],B=this.optionsMap.get(J);if(!B)return O(F,{code:K.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[$]}),T;if(F.common.async)return B._parseAsync({data:F.data,path:F.path,parent:F});else return B._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,$){let J=new Map;for(let B of F){let X=gD(B.shape[D]);if(!X.length)throw Error(`A discriminator value for key \`${D}\` could not be extracted from all schema options`);for(let Q of X){if(J.has(Q))throw Error(`Discriminator property ${String(D)} has duplicate value ${String(Q)}`);J.set(Q,B)}}return new s3({typeName:N.ZodDiscriminatedUnion,discriminator:D,options:F,optionsMap:J,...S($)})}};B0=class B0 extends k{_parse(D){let{status:F,ctx:$}=this._processInputParams(D),J=(B,X)=>{if(n3(B)||n3(X))return T;let Q=j6(B.value,X.value);if(!Q.valid)return O($,{code:K.invalid_intersection_types}),T;if(o3(B)||o3(X))F.dirty();return{status:F.value,value:Q.data}};if($.common.async)return Promise.all([this._def.left._parseAsync({data:$.data,path:$.path,parent:$}),this._def.right._parseAsync({data:$.data,path:$.path,parent:$})]).then(([B,X])=>J(B,X));else return J(this._def.left._parseSync({data:$.data,path:$.path,parent:$}),this._def.right._parseSync({data:$.data,path:$.path,parent:$}))}};B0.create=(D,F,$)=>{return new B0({left:D,right:F,typeName:N.ZodIntersection,...S($)})};bD=class bD extends k{_parse(D){let{status:F,ctx:$}=this._processInputParams(D);if($.parsedType!==M.array)return O($,{code:K.invalid_type,expected:M.array,received:$.parsedType}),T;if($.data.length<this._def.items.length)return O($,{code:K.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),T;if(!this._def.rest&&$.data.length>this._def.items.length)O($,{code:K.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),F.dirty();let B=[...$.data].map((X,Q)=>{let Y=this._def.items[Q]||this._def.rest;if(!Y)return null;return Y._parse(new _D($,X,$.path,Q))}).filter((X)=>!!X);if($.common.async)return Promise.all(B).then((X)=>{return n.mergeArray(F,X)});else return n.mergeArray(F,B)}get items(){return this._def.items}rest(D){return new bD({...this._def,rest:D})}};bD.create=(D,F)=>{if(!Array.isArray(D))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new bD({items:D,typeName:N.ZodTuple,rest:null,...S(F)})};h0=class h0 extends k{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(D){let{status:F,ctx:$}=this._processInputParams(D);if($.parsedType!==M.object)return O($,{code:K.invalid_type,expected:M.object,received:$.parsedType}),T;let J=[],B=this._def.keyType,X=this._def.valueType;for(let Q in $.data)J.push({key:B._parse(new _D($,Q,$.path,Q)),value:X._parse(new _D($,$.data[Q],$.path,Q)),alwaysSet:Q in $.data});if($.common.async)return n.mergeObjectAsync(F,J);else return n.mergeObjectSync(F,J)}get element(){return this._def.valueType}static create(D,F,$){if(F instanceof k)return new h0({keyType:D,valueType:F,typeName:N.ZodRecord,...S($)});return new h0({keyType:OD.create(),valueType:D,typeName:N.ZodRecord,...S(F)})}};g0=class g0 extends k{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(D){let{status:F,ctx:$}=this._processInputParams(D);if($.parsedType!==M.map)return O($,{code:K.invalid_type,expected:M.map,received:$.parsedType}),T;let J=this._def.keyType,B=this._def.valueType,X=[...$.data.entries()].map(([Q,Y],q)=>{return{key:J._parse(new _D($,Q,$.path,[q,"key"])),value:B._parse(new _D($,Y,$.path,[q,"value"]))}});if($.common.async){let Q=new Map;return Promise.resolve().then(async()=>{for(let Y of X){let q=await Y.key,G=await Y.value;if(q.status==="aborted"||G.status==="aborted")return T;if(q.status==="dirty"||G.status==="dirty")F.dirty();Q.set(q.value,G.value)}return{status:F.value,value:Q}})}else{let Q=new Map;for(let Y of X){let{key:q,value:G}=Y;if(q.status==="aborted"||G.status==="aborted")return T;if(q.status==="dirty"||G.status==="dirty")F.dirty();Q.set(q.value,G.value)}return{status:F.value,value:Q}}}};g0.create=(D,F,$)=>{return new g0({valueType:F,keyType:D,typeName:N.ZodMap,...S($)})};E2=class E2 extends k{_parse(D){let{status:F,ctx:$}=this._processInputParams(D);if($.parsedType!==M.set)return O($,{code:K.invalid_type,expected:M.set,received:$.parsedType}),T;let J=this._def;if(J.minSize!==null){if($.data.size<J.minSize.value)O($,{code:K.too_small,minimum:J.minSize.value,type:"set",inclusive:!0,exact:!1,message:J.minSize.message}),F.dirty()}if(J.maxSize!==null){if($.data.size>J.maxSize.value)O($,{code:K.too_big,maximum:J.maxSize.value,type:"set",inclusive:!0,exact:!1,message:J.maxSize.message}),F.dirty()}let B=this._def.valueType;function X(Y){let q=new Set;for(let G of Y){if(G.status==="aborted")return T;if(G.status==="dirty")F.dirty();q.add(G.value)}return{status:F.value,value:q}}let Q=[...$.data.values()].map((Y,q)=>B._parse(new _D($,Y,$.path,q)));if($.common.async)return Promise.all(Q).then((Y)=>X(Y));else return X(Q)}min(D,F){return new E2({...this._def,minSize:{value:D,message:j.toString(F)}})}max(D,F){return new E2({...this._def,maxSize:{value:D,message:j.toString(F)}})}size(D,F){return this.min(D,F).max(D,F)}nonempty(D){return this.min(1,D)}};E2.create=(D,F)=>{return new E2({valueType:D,minSize:null,maxSize:null,typeName:N.ZodSet,...S(F)})};e2=class e2 extends k{constructor(){super(...arguments);this.validate=this.implement}_parse(D){let{ctx:F}=this._processInputParams(D);if(F.parsedType!==M.function)return O(F,{code:K.invalid_type,expected:M.function,received:F.parsedType}),T;function $(Q,Y){return u0({data:Q,path:F.path,errorMaps:[F.common.contextualErrorMap,F.schemaErrorMap,s2(),hD].filter((q)=>!!q),issueData:{code:K.invalid_arguments,argumentsError:Y}})}function J(Q,Y){return u0({data:Q,path:F.path,errorMaps:[F.common.contextualErrorMap,F.schemaErrorMap,s2(),hD].filter((q)=>!!q),issueData:{code:K.invalid_return_type,returnTypeError:Y}})}let B={errorMap:F.common.contextualErrorMap},X=F.data;if(this._def.returns instanceof A2){let Q=this;return e(async function(...Y){let q=new XD([]),G=await Q._def.args.parseAsync(Y,B).catch((W)=>{throw q.addIssue($(Y,W)),q}),H=await Reflect.apply(X,this,G);return await Q._def.returns._def.type.parseAsync(H,B).catch((W)=>{throw q.addIssue(J(H,W)),q})})}else{let Q=this;return e(function(...Y){let q=Q._def.args.safeParse(Y,B);if(!q.success)throw new XD([$(Y,q.error)]);let G=Reflect.apply(X,this,q.data),H=Q._def.returns.safeParse(G,B);if(!H.success)throw new XD([J(G,H.error)]);return H.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...D){return new e2({...this._def,args:bD.create(D).rest(D2.create())})}returns(D){return new e2({...this._def,returns:D})}implement(D){return this.parse(D)}strictImplement(D){return this.parse(D)}static create(D,F,$){return new e2({args:D?D:bD.create([]).rest(D2.create()),returns:F||D2.create(),typeName:N.ZodFunction,...S($)})}};X0=class X0 extends k{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})}};X0.create=(D,F)=>{return new X0({getter:D,typeName:N.ZodLazy,...S(F)})};Q0=class Q0 extends k{_parse(D){if(D.data!==this._def.value){let F=this._getOrReturnCtx(D);return O(F,{received:F.data,code:K.invalid_literal,expected:this._def.value}),T}return{status:"valid",value:D.data}}get value(){return this._def.value}};Q0.create=(D,F)=>{return new Q0({value:D,typeName:N.ZodLiteral,...S(F)})};J2=class J2 extends k{_parse(D){if(typeof D.data!=="string"){let F=this._getOrReturnCtx(D),$=this._def.values;return O(F,{expected:w.joinValues($),received:F.parsedType,code:K.invalid_type}),T}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(D.data)){let F=this._getOrReturnCtx(D),$=this._def.values;return O(F,{received:F.data,code:K.invalid_enum_value,options:$}),T}return e(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 J2.create(D,{...this._def,...F})}exclude(D,F=this._def){return J2.create(this.options.filter(($)=>!D.includes($)),{...this._def,...F})}};J2.create=X7;Y0=class Y0 extends k{_parse(D){let F=w.getValidEnumValues(this._def.values),$=this._getOrReturnCtx(D);if($.parsedType!==M.string&&$.parsedType!==M.number){let J=w.objectValues(F);return O($,{expected:w.joinValues(J),received:$.parsedType,code:K.invalid_type}),T}if(!this._cache)this._cache=new Set(w.getValidEnumValues(this._def.values));if(!this._cache.has(D.data)){let J=w.objectValues(F);return O($,{received:$.data,code:K.invalid_enum_value,options:J}),T}return e(D.data)}get enum(){return this._def.values}};Y0.create=(D,F)=>{return new Y0({values:D,typeName:N.ZodNativeEnum,...S(F)})};A2=class A2 extends k{unwrap(){return this._def.type}_parse(D){let{ctx:F}=this._processInputParams(D);if(F.parsedType!==M.promise&&F.common.async===!1)return O(F,{code:K.invalid_type,expected:M.promise,received:F.parsedType}),T;let $=F.parsedType===M.promise?F.data:Promise.resolve(F.data);return e($.then((J)=>{return this._def.type.parseAsync(J,{path:F.path,errorMap:F.common.contextualErrorMap})}))}};A2.create=(D,F)=>{return new A2({type:D,typeName:N.ZodPromise,...S(F)})};LD=class LD extends k{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===N.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(D){let{status:F,ctx:$}=this._processInputParams(D),J=this._def.effect||null,B={addIssue:(X)=>{if(O($,X),X.fatal)F.abort();else F.dirty()},get path(){return $.path}};if(B.addIssue=B.addIssue.bind(B),J.type==="preprocess"){let X=J.transform($.data,B);if($.common.async)return Promise.resolve(X).then(async(Q)=>{if(F.value==="aborted")return T;let Y=await this._def.schema._parseAsync({data:Q,path:$.path,parent:$});if(Y.status==="aborted")return T;if(Y.status==="dirty")return z2(Y.value);if(F.value==="dirty")return z2(Y.value);return Y});else{if(F.value==="aborted")return T;let Q=this._def.schema._parseSync({data:X,path:$.path,parent:$});if(Q.status==="aborted")return T;if(Q.status==="dirty")return z2(Q.value);if(F.value==="dirty")return z2(Q.value);return Q}}if(J.type==="refinement"){let X=(Q)=>{let Y=J.refinement(Q,B);if($.common.async)return Promise.resolve(Y);if(Y instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return Q};if($.common.async===!1){let Q=this._def.schema._parseSync({data:$.data,path:$.path,parent:$});if(Q.status==="aborted")return T;if(Q.status==="dirty")F.dirty();return X(Q.value),{status:F.value,value:Q.value}}else return this._def.schema._parseAsync({data:$.data,path:$.path,parent:$}).then((Q)=>{if(Q.status==="aborted")return T;if(Q.status==="dirty")F.dirty();return X(Q.value).then(()=>{return{status:F.value,value:Q.value}})})}if(J.type==="transform")if($.common.async===!1){let X=this._def.schema._parseSync({data:$.data,path:$.path,parent:$});if(!eD(X))return T;let Q=J.transform(X.value,B);if(Q instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:F.value,value:Q}}else return this._def.schema._parseAsync({data:$.data,path:$.path,parent:$}).then((X)=>{if(!eD(X))return T;return Promise.resolve(J.transform(X.value,B)).then((Q)=>({status:F.value,value:Q}))});w.assertNever(J)}};LD.create=(D,F,$)=>{return new LD({schema:D,typeName:N.ZodEffects,effect:F,...S($)})};LD.createWithPreprocess=(D,F,$)=>{return new LD({schema:F,effect:{type:"preprocess",transform:D},typeName:N.ZodEffects,...S($)})};jD=class jD extends k{_parse(D){if(this._getType(D)===M.undefined)return e(void 0);return this._def.innerType._parse(D)}unwrap(){return this._def.innerType}};jD.create=(D,F)=>{return new jD({innerType:D,typeName:N.ZodOptional,...S(F)})};mD=class mD extends k{_parse(D){if(this._getType(D)===M.null)return e(null);return this._def.innerType._parse(D)}unwrap(){return this._def.innerType}};mD.create=(D,F)=>{return new mD({innerType:D,typeName:N.ZodNullable,...S(F)})};q0=class q0 extends k{_parse(D){let{ctx:F}=this._processInputParams(D),$=F.data;if(F.parsedType===M.undefined)$=this._def.defaultValue();return this._def.innerType._parse({data:$,path:F.path,parent:F})}removeDefault(){return this._def.innerType}};q0.create=(D,F)=>{return new q0({innerType:D,typeName:N.ZodDefault,defaultValue:typeof F.default==="function"?F.default:()=>F.default,...S(F)})};G0=class G0 extends k{_parse(D){let{ctx:F}=this._processInputParams(D),$={...F,common:{...F.common,issues:[]}},J=this._def.innerType._parse({data:$.data,path:$.path,parent:{...$}});if(a2(J))return J.then((B)=>{return{status:"valid",value:B.status==="valid"?B.value:this._def.catchValue({get error(){return new XD($.common.issues)},input:$.data})}});else return{status:"valid",value:J.status==="valid"?J.value:this._def.catchValue({get error(){return new XD($.common.issues)},input:$.data})}}removeCatch(){return this._def.innerType}};G0.create=(D,F)=>{return new G0({innerType:D,typeName:N.ZodCatch,catchValue:typeof F.catch==="function"?F.catch:()=>F.catch,...S(F)})};m0=class m0 extends k{_parse(D){if(this._getType(D)!==M.nan){let $=this._getOrReturnCtx(D);return O($,{code:K.invalid_type,expected:M.nan,received:$.parsedType}),T}return{status:"valid",value:D.data}}};m0.create=(D)=>{return new m0({typeName:N.ZodNaN,...S(D)})};rB=Symbol("zod_brand");a3=class a3 extends k{_parse(D){let{ctx:F}=this._processInputParams(D),$=F.data;return this._def.type._parse({data:$,path:F.path,parent:F})}unwrap(){return this._def.type}};l0=class l0 extends k{_parse(D){let{status:F,ctx:$}=this._processInputParams(D);if($.common.async)return(async()=>{let B=await this._def.in._parseAsync({data:$.data,path:$.path,parent:$});if(B.status==="aborted")return T;if(B.status==="dirty")return F.dirty(),z2(B.value);else return this._def.out._parseAsync({data:B.value,path:$.path,parent:$})})();else{let J=this._def.in._parseSync({data:$.data,path:$.path,parent:$});if(J.status==="aborted")return T;if(J.status==="dirty")return F.dirty(),{status:"dirty",value:J.value};else return this._def.out._parseSync({data:J.value,path:$.path,parent:$})}}static create(D,F){return new l0({in:D,out:F,typeName:N.ZodPipeline})}};H0=class H0 extends k{_parse(D){let F=this._def.innerType._parse(D),$=(J)=>{if(eD(J))J.value=Object.freeze(J.value);return J};return a2(F)?F.then((J)=>$(J)):$(F)}unwrap(){return this._def.innerType}};H0.create=(D,F)=>{return new H0({innerType:D,typeName:N.ZodReadonly,...S(F)})};nB={object:g.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"})(N||(N={}));Y7=OD.create,q7=F2.create,sB=m0.create,aB=$2.create,G7=D0.create,tB=K2.create,eB=x0.create,DX=F0.create,FX=$0.create,$X=M2.create,JX=D2.create,BX=SD.create,XX=y0.create,QX=CD.create,YX=g.create,qX=g.strictCreate,GX=J0.create,HX=s3.create,VX=B0.create,WX=bD.create,UX=h0.create,zX=g0.create,KX=E2.create,MX=e2.create,EX=X0.create,AX=Q0.create,RX=J2.create,OX=Y0.create,CX=A2.create,jX=LD.create,_X=jD.create,LX=mD.create,ZX=LD.createWithPreprocess,TX=l0.create,bX={string:(D)=>OD.create({...D,coerce:!0}),number:(D)=>F2.create({...D,coerce:!0}),boolean:(D)=>D0.create({...D,coerce:!0}),bigint:(D)=>$2.create({...D,coerce:!0}),date:(D)=>K2.create({...D,coerce:!0})},PX=T});var A={};BD(A,{void:()=>XX,util:()=>w,unknown:()=>JX,union:()=>GX,undefined:()=>DX,tuple:()=>WX,transformer:()=>jX,symbol:()=>eB,string:()=>Y7,strictObject:()=>qX,setErrorMap:()=>LB,set:()=>KX,record:()=>UX,quotelessJson:()=>jB,promise:()=>CX,preprocess:()=>ZX,pipeline:()=>TX,ostring:()=>NX,optional:()=>_X,onumber:()=>IX,oboolean:()=>SX,objectUtil:()=>A6,object:()=>YX,number:()=>q7,nullable:()=>LX,null:()=>FX,never:()=>BX,nativeEnum:()=>OX,nan:()=>sB,map:()=>zX,makeIssue:()=>u0,literal:()=>AX,lazy:()=>EX,late:()=>nB,isValid:()=>eD,isDirty:()=>o3,isAsync:()=>a2,isAborted:()=>n3,intersection:()=>VX,instanceof:()=>oB,getParsedType:()=>ID,getErrorMap:()=>s2,function:()=>MX,enum:()=>RX,effect:()=>jX,discriminatedUnion:()=>HX,defaultErrorMap:()=>hD,datetimeRegex:()=>B7,date:()=>tB,custom:()=>Q7,coerce:()=>bX,boolean:()=>G7,bigint:()=>aB,array:()=>QX,any:()=>$X,addIssueToContext:()=>O,ZodVoid:()=>y0,ZodUnknown:()=>D2,ZodUnion:()=>J0,ZodUndefined:()=>F0,ZodType:()=>k,ZodTuple:()=>bD,ZodTransformer:()=>LD,ZodSymbol:()=>x0,ZodString:()=>OD,ZodSet:()=>E2,ZodSchema:()=>k,ZodRecord:()=>h0,ZodReadonly:()=>H0,ZodPromise:()=>A2,ZodPipeline:()=>l0,ZodParsedType:()=>M,ZodOptional:()=>jD,ZodObject:()=>g,ZodNumber:()=>F2,ZodNullable:()=>mD,ZodNull:()=>$0,ZodNever:()=>SD,ZodNativeEnum:()=>Y0,ZodNaN:()=>m0,ZodMap:()=>g0,ZodLiteral:()=>Q0,ZodLazy:()=>X0,ZodIssueCode:()=>K,ZodIntersection:()=>B0,ZodFunction:()=>e2,ZodFirstPartyTypeKind:()=>N,ZodError:()=>XD,ZodEnum:()=>J2,ZodEffects:()=>LD,ZodDiscriminatedUnion:()=>s3,ZodDefault:()=>q0,ZodDate:()=>K2,ZodCatch:()=>G0,ZodBranded:()=>a3,ZodBoolean:()=>D0,ZodBigInt:()=>$2,ZodArray:()=>CD,ZodAny:()=>M2,Schema:()=>k,ParseStatus:()=>n,OK:()=>e,NEVER:()=>PX,INVALID:()=>T,EMPTY_PATH:()=>ZB,DIRTY:()=>z2,BRAND:()=>rB});var _6=I(()=>{r3();O6();t5();f0();H7();i3()});var t3=I(()=>{_6();_6()});var vX,kX,wX,fX,uX,xX,yX,hX,lD;var V7=I(()=>{t3();vX=A.object({name:A.string().default("genie"),defaultWindow:A.string().default("shell"),autoCreate:A.boolean().default(!0)}),kX=A.object({execTimeout:A.number().default(120000),readLines:A.number().default(100),worktreeBase:A.string().optional()}),wX=A.object({tmuxDebug:A.boolean().default(!1),verbose:A.boolean().default(!1)}),fX=A.object({preference:A.enum(["auto","zsh","bash","fish"]).default("auto")}),uX=A.object({tmuxInstalled:A.boolean().default(!1),shellInstalled:A.boolean().default(!1)}),xX=A.object({configured:A.boolean().default(!1)}),yX=A.object({launcher:A.preprocess((D)=>D==="claudio"?"claude":D,A.literal("claude")),claudeArgs:A.array(A.string())}).passthrough(),hX=A.object({left:A.string(),right:A.string(),skill:A.string().default("council")}),lD=A.object({version:A.number().default(2),session:vX.default({}),terminal:kX.default({}),logging:wX.default({}),shell:fX.default({}),shortcuts:uX.default({}),codex:xX.optional(),installMethod:A.enum(["source","npm","bun"]).optional(),updateChannel:A.enum(["latest","next"]).default("latest"),setupComplete:A.boolean().default(!1),lastSetupAt:A.string().optional(),sourcePath:A.string().optional(),workerProfiles:A.record(A.string(),yX).optional(),defaultWorkerProfile:A.string().optional(),councilPresets:A.record(A.string(),hX).optional(),defaultCouncilPreset:A.string().optional(),promptMode:A.enum(["append","system"]).default("append"),autoMergeDev:A.boolean().default(!1)})});import{existsSync as D8,mkdirSync as gX,readFileSync as W7,writeFileSync as mX}from"fs";import{homedir as U7}from"os";import{join as z7}from"path";function K7(){return e3}function p0(){return R2}function O2(){return D8(R2)}function lX(){if(!D8(e3))gX(e3,{recursive:!0})}async function VD(){if(!D8(R2))return lD.parse({});try{let D=W7(R2,"utf-8"),F=JSON.parse(D);return lD.parse(F)}catch(D){let F=D instanceof Error?D.message:String(D);return console.warn(`Warning: Invalid genie config, using defaults: ${F}`),lD.parse({})}}async function PD(D){lX();try{let F=lD.parse(D),$=JSON.stringify(F,null,2);mX(R2,$,"utf-8")}catch(F){let $=F instanceof Error?F.message:String(F);throw Error(`Failed to save genie config: ${$}`)}}function pX(){return lD.parse({})}function V0(){if(!D8(R2))return lD.parse({});try{let D=W7(R2,"utf-8"),F=JSON.parse(D);return lD.parse(F)}catch{return lD.parse({})}}function WD(D){let F=U7();if(D.startsWith(`${F}/`))return`~${D.slice(F.length)}`;if(D===F)return"~";return D}function M7(){return V0().terminal}function E7(){if(!O2())return!1;return V0().setupComplete??!1}async function A7(){let D=await VD();D.setupComplete=!0,D.lastSetupAt=new Date().toISOString(),await PD(D)}async function R7(){let D=pX();await PD(D)}async function O7(D){let F=await VD();F.shortcuts={...F.shortcuts,...D},await PD(F)}var e3,R2;var pD=I(()=>{V7();e3=z7(U7(),".genie"),R2=z7(e3,"config.json")});var B8=l((GM,T7)=>{var FQ=v("tty"),$Q=FQ?.WriteStream?.prototype?.hasColors?.()??!1,P=(D,F)=>{if(!$Q)return(B)=>B;let $=`\x1B[${D}m`,J=`\x1B[${F}m`;return(B)=>{let X=B+"",Q=X.indexOf(J);if(Q===-1)return $+X+J;let Y=$,q=0,H=(F===22?J:"")+$;while(Q!==-1)Y+=X.slice(q,Q)+H,q=Q+J.length,Q=X.indexOf(J,q);return Y+=X.slice(q)+J,Y}},b={};b.reset=P(0,0);b.bold=P(1,22);b.dim=P(2,22);b.italic=P(3,23);b.underline=P(4,24);b.overline=P(53,55);b.inverse=P(7,27);b.hidden=P(8,28);b.strikethrough=P(9,29);b.black=P(30,39);b.red=P(31,39);b.green=P(32,39);b.yellow=P(33,39);b.blue=P(34,39);b.magenta=P(35,39);b.cyan=P(36,39);b.white=P(37,39);b.gray=P(90,39);b.bgBlack=P(40,49);b.bgRed=P(41,49);b.bgGreen=P(42,49);b.bgYellow=P(43,49);b.bgBlue=P(44,49);b.bgMagenta=P(45,49);b.bgCyan=P(46,49);b.bgWhite=P(47,49);b.bgGray=P(100,49);b.redBright=P(91,39);b.greenBright=P(92,39);b.yellowBright=P(93,39);b.blueBright=P(94,39);b.magentaBright=P(95,39);b.cyanBright=P(96,39);b.whiteBright=P(97,39);b.bgRedBright=P(101,49);b.bgGreenBright=P(102,49);b.bgYellowBright=P(103,49);b.bgBlueBright=P(104,49);b.bgMagentaBright=P(105,49);b.bgCyanBright=P(106,49);b.bgWhiteBright=P(107,49);T7.exports=b});var k7=l((SM,v7)=>{v7.exports=HQ;function GQ(D){let F={defaultWidth:0,output:process.stdout,tty:v("tty")};if(!D)return F;return Object.keys(F).forEach(function($){if(!D[$])D[$]=F[$]}),D}function HQ(D){let F=GQ(D);if(F.output.getWindowSize)return F.output.getWindowSize()[0]||F.defaultWidth;if(F.tty.getWindowSize)return F.tty.getWindowSize()[1]||F.defaultWidth;if(F.output.columns)return F.output.columns;if(process.env.CLI_WIDTH){let $=parseInt(process.env.CLI_WIDTH,10);if(!isNaN($)&&$!==0)return $}return F.defaultWidth}});var f7=l((bM,w7)=>{w7.exports=({onlyFirst:D=!1}={})=>{let F=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(F,D?void 0:"g")}});var P6=l((PM,u7)=>{var VQ=f7();u7.exports=(D)=>typeof D==="string"?D.replace(VQ(),""):D});var y7=l((vM,v6)=>{var x7=(D)=>{if(Number.isNaN(D))return!1;if(D>=4352&&(D<=4447||D===9001||D===9002||11904<=D&&D<=12871&&D!==12351||12880<=D&&D<=19903||19968<=D&&D<=42182||43360<=D&&D<=43388||44032<=D&&D<=55203||63744<=D&&D<=64255||65040<=D&&D<=65049||65072<=D&&D<=65131||65281<=D&&D<=65376||65504<=D&&D<=65510||110592<=D&&D<=110593||127488<=D&&D<=127569||131072<=D&&D<=262141))return!0;return!1};v6.exports=x7;v6.exports.default=x7});var g7=l((kM,h7)=>{h7.exports=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g}});var l7=l((wM,k6)=>{var WQ=P6(),UQ=y7(),zQ=g7(),m7=(D)=>{if(typeof D!=="string"||D.length===0)return 0;if(D=WQ(D),D.length===0)return 0;D=D.replace(zQ()," ");let F=0;for(let $=0;$<D.length;$++){let J=D.codePointAt($);if(J<=31||J>=127&&J<=159)continue;if(J>=768&&J<=879)continue;if(J>65535)$++;F+=UQ(J)?2:1}return F};k6.exports=m7;k6.exports.default=m7});var d7=l((fM,p7)=>{p7.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}});var w6=l((uM,i7)=>{var o0=d7(),c7={};for(let D of Object.keys(o0))c7[o0[D]]=D;var _={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};i7.exports=_;for(let D of Object.keys(_)){if(!("channels"in _[D]))throw Error("missing channels property: "+D);if(!("labels"in _[D]))throw Error("missing channel labels property: "+D);if(_[D].labels.length!==_[D].channels)throw Error("channel and label counts mismatch: "+D);let{channels:F,labels:$}=_[D];delete _[D].channels,delete _[D].labels,Object.defineProperty(_[D],"channels",{value:F}),Object.defineProperty(_[D],"labels",{value:$})}_.rgb.hsl=function(D){let F=D[0]/255,$=D[1]/255,J=D[2]/255,B=Math.min(F,$,J),X=Math.max(F,$,J),Q=X-B,Y,q;if(X===B)Y=0;else if(F===X)Y=($-J)/Q;else if($===X)Y=2+(J-F)/Q;else if(J===X)Y=4+(F-$)/Q;if(Y=Math.min(Y*60,360),Y<0)Y+=360;let G=(B+X)/2;if(X===B)q=0;else if(G<=0.5)q=Q/(X+B);else q=Q/(2-X-B);return[Y,q*100,G*100]};_.rgb.hsv=function(D){let F,$,J,B,X,Q=D[0]/255,Y=D[1]/255,q=D[2]/255,G=Math.max(Q,Y,q),H=G-Math.min(Q,Y,q),V=function(W){return(G-W)/6/H+0.5};if(H===0)B=0,X=0;else{if(X=H/G,F=V(Q),$=V(Y),J=V(q),Q===G)B=J-$;else if(Y===G)B=0.3333333333333333+F-J;else if(q===G)B=0.6666666666666666+$-F;if(B<0)B+=1;else if(B>1)B-=1}return[B*360,X*100,G*100]};_.rgb.hwb=function(D){let F=D[0],$=D[1],J=D[2],B=_.rgb.hsl(D)[0],X=0.00392156862745098*Math.min(F,Math.min($,J));return J=1-0.00392156862745098*Math.max(F,Math.max($,J)),[B,X*100,J*100]};_.rgb.cmyk=function(D){let F=D[0]/255,$=D[1]/255,J=D[2]/255,B=Math.min(1-F,1-$,1-J),X=(1-F-B)/(1-B)||0,Q=(1-$-B)/(1-B)||0,Y=(1-J-B)/(1-B)||0;return[X*100,Q*100,Y*100,B*100]};function KQ(D,F){return(D[0]-F[0])**2+(D[1]-F[1])**2+(D[2]-F[2])**2}_.rgb.keyword=function(D){let F=c7[D];if(F)return F;let $=1/0,J;for(let B of Object.keys(o0)){let X=o0[B],Q=KQ(D,X);if(Q<$)$=Q,J=B}return J};_.keyword.rgb=function(D){return o0[D]};_.rgb.xyz=function(D){let F=D[0]/255,$=D[1]/255,J=D[2]/255;F=F>0.04045?((F+0.055)/1.055)**2.4:F/12.92,$=$>0.04045?(($+0.055)/1.055)**2.4:$/12.92,J=J>0.04045?((J+0.055)/1.055)**2.4:J/12.92;let B=F*0.4124+$*0.3576+J*0.1805,X=F*0.2126+$*0.7152+J*0.0722,Q=F*0.0193+$*0.1192+J*0.9505;return[B*100,X*100,Q*100]};_.rgb.lab=function(D){let F=_.rgb.xyz(D),$=F[0],J=F[1],B=F[2];$/=95.047,J/=100,B/=108.883,$=$>0.008856?$**0.3333333333333333:7.787*$+0.13793103448275862,J=J>0.008856?J**0.3333333333333333:7.787*J+0.13793103448275862,B=B>0.008856?B**0.3333333333333333:7.787*B+0.13793103448275862;let X=116*J-16,Q=500*($-J),Y=200*(J-B);return[X,Q,Y]};_.hsl.rgb=function(D){let F=D[0]/360,$=D[1]/100,J=D[2]/100,B,X,Q;if($===0)return Q=J*255,[Q,Q,Q];if(J<0.5)B=J*(1+$);else B=J+$-J*$;let Y=2*J-B,q=[0,0,0];for(let G=0;G<3;G++){if(X=F+0.3333333333333333*-(G-1),X<0)X++;if(X>1)X--;if(6*X<1)Q=Y+(B-Y)*6*X;else if(2*X<1)Q=B;else if(3*X<2)Q=Y+(B-Y)*(0.6666666666666666-X)*6;else Q=Y;q[G]=Q*255}return q};_.hsl.hsv=function(D){let F=D[0],$=D[1]/100,J=D[2]/100,B=$,X=Math.max(J,0.01);J*=2,$*=J<=1?J:2-J,B*=X<=1?X:2-X;let Q=(J+$)/2,Y=J===0?2*B/(X+B):2*$/(J+$);return[F,Y*100,Q*100]};_.hsv.rgb=function(D){let F=D[0]/60,$=D[1]/100,J=D[2]/100,B=Math.floor(F)%6,X=F-Math.floor(F),Q=255*J*(1-$),Y=255*J*(1-$*X),q=255*J*(1-$*(1-X));switch(J*=255,B){case 0:return[J,q,Q];case 1:return[Y,J,Q];case 2:return[Q,J,q];case 3:return[Q,Y,J];case 4:return[q,Q,J];case 5:return[J,Q,Y]}};_.hsv.hsl=function(D){let F=D[0],$=D[1]/100,J=D[2]/100,B=Math.max(J,0.01),X,Q;Q=(2-$)*J;let Y=(2-$)*B;return X=$*B,X/=Y<=1?Y:2-Y,X=X||0,Q/=2,[F,X*100,Q*100]};_.hwb.rgb=function(D){let F=D[0]/360,$=D[1]/100,J=D[2]/100,B=$+J,X;if(B>1)$/=B,J/=B;let Q=Math.floor(6*F),Y=1-J;if(X=6*F-Q,(Q&1)!==0)X=1-X;let q=$+X*(Y-$),G,H,V;switch(Q){default:case 6:case 0:G=Y,H=q,V=$;break;case 1:G=q,H=Y,V=$;break;case 2:G=$,H=Y,V=q;break;case 3:G=$,H=q,V=Y;break;case 4:G=q,H=$,V=Y;break;case 5:G=Y,H=$,V=q;break}return[G*255,H*255,V*255]};_.cmyk.rgb=function(D){let F=D[0]/100,$=D[1]/100,J=D[2]/100,B=D[3]/100,X=1-Math.min(1,F*(1-B)+B),Q=1-Math.min(1,$*(1-B)+B),Y=1-Math.min(1,J*(1-B)+B);return[X*255,Q*255,Y*255]};_.xyz.rgb=function(D){let F=D[0]/100,$=D[1]/100,J=D[2]/100,B,X,Q;return B=F*3.2406+$*-1.5372+J*-0.4986,X=F*-0.9689+$*1.8758+J*0.0415,Q=F*0.0557+$*-0.204+J*1.057,B=B>0.0031308?1.055*B**0.4166666666666667-0.055:B*12.92,X=X>0.0031308?1.055*X**0.4166666666666667-0.055:X*12.92,Q=Q>0.0031308?1.055*Q**0.4166666666666667-0.055:Q*12.92,B=Math.min(Math.max(0,B),1),X=Math.min(Math.max(0,X),1),Q=Math.min(Math.max(0,Q),1),[B*255,X*255,Q*255]};_.xyz.lab=function(D){let F=D[0],$=D[1],J=D[2];F/=95.047,$/=100,J/=108.883,F=F>0.008856?F**0.3333333333333333:7.787*F+0.13793103448275862,$=$>0.008856?$**0.3333333333333333:7.787*$+0.13793103448275862,J=J>0.008856?J**0.3333333333333333:7.787*J+0.13793103448275862;let B=116*$-16,X=500*(F-$),Q=200*($-J);return[B,X,Q]};_.lab.xyz=function(D){let F=D[0],$=D[1],J=D[2],B,X,Q;X=(F+16)/116,B=$/500+X,Q=X-J/200;let Y=X**3,q=B**3,G=Q**3;return X=Y>0.008856?Y:(X-0.13793103448275862)/7.787,B=q>0.008856?q:(B-0.13793103448275862)/7.787,Q=G>0.008856?G:(Q-0.13793103448275862)/7.787,B*=95.047,X*=100,Q*=108.883,[B,X,Q]};_.lab.lch=function(D){let F=D[0],$=D[1],J=D[2],B;if(B=Math.atan2(J,$)*360/2/Math.PI,B<0)B+=360;let Q=Math.sqrt($*$+J*J);return[F,Q,B]};_.lch.lab=function(D){let F=D[0],$=D[1],B=D[2]/360*2*Math.PI,X=$*Math.cos(B),Q=$*Math.sin(B);return[F,X,Q]};_.rgb.ansi16=function(D,F=null){let[$,J,B]=D,X=F===null?_.rgb.hsv(D)[2]:F;if(X=Math.round(X/50),X===0)return 30;let Q=30+(Math.round(B/255)<<2|Math.round(J/255)<<1|Math.round($/255));if(X===2)Q+=60;return Q};_.hsv.ansi16=function(D){return _.rgb.ansi16(_.hsv.rgb(D),D[2])};_.rgb.ansi256=function(D){let F=D[0],$=D[1],J=D[2];if(F===$&&$===J){if(F<8)return 16;if(F>248)return 231;return Math.round((F-8)/247*24)+232}return 16+36*Math.round(F/255*5)+6*Math.round($/255*5)+Math.round(J/255*5)};_.ansi16.rgb=function(D){let F=D%10;if(F===0||F===7){if(D>50)F+=3.5;return F=F/10.5*255,[F,F,F]}let $=(~~(D>50)+1)*0.5,J=(F&1)*$*255,B=(F>>1&1)*$*255,X=(F>>2&1)*$*255;return[J,B,X]};_.ansi256.rgb=function(D){if(D>=232){let X=(D-232)*10+8;return[X,X,X]}D-=16;let F,$=Math.floor(D/36)/5*255,J=Math.floor((F=D%36)/6)/5*255,B=F%6/5*255;return[$,J,B]};_.rgb.hex=function(D){let $=(((Math.round(D[0])&255)<<16)+((Math.round(D[1])&255)<<8)+(Math.round(D[2])&255)).toString(16).toUpperCase();return"000000".substring($.length)+$};_.hex.rgb=function(D){let F=D.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!F)return[0,0,0];let $=F[0];if(F[0].length===3)$=$.split("").map((Y)=>{return Y+Y}).join("");let J=parseInt($,16),B=J>>16&255,X=J>>8&255,Q=J&255;return[B,X,Q]};_.rgb.hcg=function(D){let F=D[0]/255,$=D[1]/255,J=D[2]/255,B=Math.max(Math.max(F,$),J),X=Math.min(Math.min(F,$),J),Q=B-X,Y,q;if(Q<1)Y=X/(1-Q);else Y=0;if(Q<=0)q=0;else if(B===F)q=($-J)/Q%6;else if(B===$)q=2+(J-F)/Q;else q=4+(F-$)/Q;return q/=6,q%=1,[q*360,Q*100,Y*100]};_.hsl.hcg=function(D){let F=D[1]/100,$=D[2]/100,J=$<0.5?2*F*$:2*F*(1-$),B=0;if(J<1)B=($-0.5*J)/(1-J);return[D[0],J*100,B*100]};_.hsv.hcg=function(D){let F=D[1]/100,$=D[2]/100,J=F*$,B=0;if(J<1)B=($-J)/(1-J);return[D[0],J*100,B*100]};_.hcg.rgb=function(D){let F=D[0]/360,$=D[1]/100,J=D[2]/100;if($===0)return[J*255,J*255,J*255];let B=[0,0,0],X=F%1*6,Q=X%1,Y=1-Q,q=0;switch(Math.floor(X)){case 0:B[0]=1,B[1]=Q,B[2]=0;break;case 1:B[0]=Y,B[1]=1,B[2]=0;break;case 2:B[0]=0,B[1]=1,B[2]=Q;break;case 3:B[0]=0,B[1]=Y,B[2]=1;break;case 4:B[0]=Q,B[1]=0,B[2]=1;break;default:B[0]=1,B[1]=0,B[2]=Y}return q=(1-$)*J,[($*B[0]+q)*255,($*B[1]+q)*255,($*B[2]+q)*255]};_.hcg.hsv=function(D){let F=D[1]/100,$=D[2]/100,J=F+$*(1-F),B=0;if(J>0)B=F/J;return[D[0],B*100,J*100]};_.hcg.hsl=function(D){let F=D[1]/100,J=D[2]/100*(1-F)+0.5*F,B=0;if(J>0&&J<0.5)B=F/(2*J);else if(J>=0.5&&J<1)B=F/(2*(1-J));return[D[0],B*100,J*100]};_.hcg.hwb=function(D){let F=D[1]/100,$=D[2]/100,J=F+$*(1-F);return[D[0],(J-F)*100,(1-J)*100]};_.hwb.hcg=function(D){let F=D[1]/100,J=1-D[2]/100,B=J-F,X=0;if(B<1)X=(J-B)/(1-B);return[D[0],B*100,X*100]};_.apple.rgb=function(D){return[D[0]/65535*255,D[1]/65535*255,D[2]/65535*255]};_.rgb.apple=function(D){return[D[0]/255*65535,D[1]/255*65535,D[2]/255*65535]};_.gray.rgb=function(D){return[D[0]/100*255,D[0]/100*255,D[0]/100*255]};_.gray.hsl=function(D){return[0,0,D[0]]};_.gray.hsv=_.gray.hsl;_.gray.hwb=function(D){return[0,100,D[0]]};_.gray.cmyk=function(D){return[0,0,0,D[0]]};_.gray.lab=function(D){return[D[0],0,0]};_.gray.hex=function(D){let F=Math.round(D[0]/100*255)&255,J=((F<<16)+(F<<8)+F).toString(16).toUpperCase();return"000000".substring(J.length)+J};_.rgb.gray=function(D){return[(D[0]+D[1]+D[2])/3/255*100]}});var n7=l((xM,r7)=>{var X8=w6();function MQ(){let D={},F=Object.keys(X8);for(let $=F.length,J=0;J<$;J++)D[F[J]]={distance:-1,parent:null};return D}function EQ(D){let F=MQ(),$=[D];F[D].distance=0;while($.length){let J=$.pop(),B=Object.keys(X8[J]);for(let X=B.length,Q=0;Q<X;Q++){let Y=B[Q],q=F[Y];if(q.distance===-1)q.distance=F[J].distance+1,q.parent=J,$.unshift(Y)}}return F}function AQ(D,F){return function($){return F(D($))}}function RQ(D,F){let $=[F[D].parent,D],J=X8[F[D].parent][D],B=F[D].parent;while(F[B].parent)$.unshift(F[B].parent),J=AQ(X8[F[B].parent][B],J),B=F[B].parent;return J.conversion=$,J}r7.exports=function(D){let F=EQ(D),$={},J=Object.keys(F);for(let B=J.length,X=0;X<B;X++){let Q=J[X];if(F[Q].parent===null)continue;$[Q]=RQ(Q,F)}return $}});var s7=l((yM,o7)=>{var f6=w6(),OQ=n7(),z0={},CQ=Object.keys(f6);function jQ(D){let F=function(...$){let J=$[0];if(J===void 0||J===null)return J;if(J.length>1)$=J;return D($)};if("conversion"in D)F.conversion=D.conversion;return F}function _Q(D){let F=function(...$){let J=$[0];if(J===void 0||J===null)return J;if(J.length>1)$=J;let B=D($);if(typeof B==="object")for(let X=B.length,Q=0;Q<X;Q++)B[Q]=Math.round(B[Q]);return B};if("conversion"in D)F.conversion=D.conversion;return F}CQ.forEach((D)=>{z0[D]={},Object.defineProperty(z0[D],"channels",{value:f6[D].channels}),Object.defineProperty(z0[D],"labels",{value:f6[D].labels});let F=OQ(D);Object.keys(F).forEach((J)=>{let B=F[J];z0[D][J]=_Q(B),z0[D][J].raw=jQ(B)})});o7.exports=z0});var $9=l((hM,F9)=>{var a7=(D,F)=>(...$)=>{return`\x1B[${D(...$)+F}m`},t7=(D,F)=>(...$)=>{let J=D(...$);return`\x1B[${38+F};5;${J}m`},e7=(D,F)=>(...$)=>{let J=D(...$);return`\x1B[${38+F};2;${J[0]};${J[1]};${J[2]}m`},Q8=(D)=>D,D9=(D,F,$)=>[D,F,$],K0=(D,F,$)=>{Object.defineProperty(D,F,{get:()=>{let J=$();return Object.defineProperty(D,F,{value:J,enumerable:!0,configurable:!0}),J},enumerable:!0,configurable:!0})},u6,M0=(D,F,$,J)=>{if(u6===void 0)u6=s7();let B=J?10:0,X={};for(let[Q,Y]of Object.entries(u6)){let q=Q==="ansi16"?"ansi":Q;if(Q===F)X[q]=D($,B);else if(typeof Y==="object")X[q]=D(Y[F],B)}return X};function LQ(){let D=new Map,F={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};F.color.gray=F.color.blackBright,F.bgColor.bgGray=F.bgColor.bgBlackBright,F.color.grey=F.color.blackBright,F.bgColor.bgGrey=F.bgColor.bgBlackBright;for(let[$,J]of Object.entries(F)){for(let[B,X]of Object.entries(J))F[B]={open:`\x1B[${X[0]}m`,close:`\x1B[${X[1]}m`},J[B]=F[B],D.set(X[0],X[1]);Object.defineProperty(F,$,{value:J,enumerable:!1})}return Object.defineProperty(F,"codes",{value:D,enumerable:!1}),F.color.close="\x1B[39m",F.bgColor.close="\x1B[49m",K0(F.color,"ansi",()=>M0(a7,"ansi16",Q8,!1)),K0(F.color,"ansi256",()=>M0(t7,"ansi256",Q8,!1)),K0(F.color,"ansi16m",()=>M0(e7,"rgb",D9,!1)),K0(F.bgColor,"ansi",()=>M0(a7,"ansi16",Q8,!0)),K0(F.bgColor,"ansi256",()=>M0(t7,"ansi256",Q8,!0)),K0(F.bgColor,"ansi16m",()=>M0(e7,"rgb",D9,!0)),F}Object.defineProperty(F9,"exports",{enumerable:!0,get:LQ})});var X9=l((gM,B9)=>{var s0=l7(),ZQ=P6(),TQ=$9(),y6=new Set(["\x1B","\x9B"]),J9=(D)=>`${y6.values().next().value}[${D}m`,NQ=(D)=>D.split(" ").map((F)=>s0(F)),x6=(D,F,$)=>{let J=[...F],B=!1,X=s0(ZQ(D[D.length-1]));for(let[Q,Y]of J.entries()){let q=s0(Y);if(X+q<=$)D[D.length-1]+=Y;else D.push(Y),X=0;if(y6.has(Y))B=!0;else if(B&&Y==="m"){B=!1;continue}if(B)continue;if(X+=q,X===$&&Q<J.length-1)D.push(""),X=0}if(!X&&D[D.length-1].length>0&&D.length>1)D[D.length-2]+=D.pop()},IQ=(D)=>{let F=D.split(" "),$=F.length;while($>0){if(s0(F[$-1])>0)break;$--}if($===F.length)return D;return F.slice(0,$).join(" ")+F.slice($).join("")},SQ=(D,F,$={})=>{if($.trim!==!1&&D.trim()==="")return"";let J="",B="",X,Q=NQ(D),Y=[""];for(let[q,G]of D.split(" ").entries()){if($.trim!==!1)Y[Y.length-1]=Y[Y.length-1].trimLeft();let H=s0(Y[Y.length-1]);if(q!==0){if(H>=F&&($.wordWrap===!1||$.trim===!1))Y.push(""),H=0;if(H>0||$.trim===!1)Y[Y.length-1]+=" ",H++}if($.hard&&Q[q]>F){let V=F-H,W=1+Math.floor((Q[q]-V-1)/F);if(Math.floor((Q[q]-1)/F)<W)Y.push("");x6(Y,G,F);continue}if(H+Q[q]>F&&H>0&&Q[q]>0){if($.wordWrap===!1&&H<F){x6(Y,G,F);continue}Y.push("")}if(H+Q[q]>F&&$.wordWrap===!1){x6(Y,G,F);continue}Y[Y.length-1]+=G}if($.trim!==!1)Y=Y.map(IQ);J=Y.join(`
24
+ `)}),this}_outputHelpIfRequested(D){let F=this._getHelpOption();if(F&&D.find((J)=>F.is(J)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function u5(D){return D.map((F)=>{if(!F.startsWith("--inspect"))return F;let $,J="127.0.0.1",B="9229",X;if((X=F.match(/^(--inspect(-brk)?)$/))!==null)$=X[1];else if((X=F.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if($=X[1],/^\d+$/.test(X[3]))B=X[3];else J=X[3];else if((X=F.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)$=X[1],J=X[3],B=X[4];if($&&B!=="0")return`${$}=${J}:${parseInt(B)+1}`;return F})}$B.Command=K6});var m5=l((QB)=>{var{Argument:y5}=d3(),{Command:M6}=x5(),{CommanderError:BB,InvalidArgumentError:h5}=w0(),{Help:XB}=H6(),{Option:g5}=V6();QB.program=new M6;QB.createCommand=(D)=>new M6(D);QB.createOption=(D,F)=>new g5(D,F);QB.createArgument=(D,F)=>new y5(D,F);QB.Command=M6;QB.Option=g5;QB.Argument=y5;QB.Help=XB;QB.CommanderError=BB;QB.InvalidArgumentError=h5;QB.InvalidOptionArgumentError=h5});var w,A6,M,SD=(D)=>{switch(typeof D){case"undefined":return M.undefined;case"string":return M.string;case"number":return Number.isNaN(D)?M.nan:M.number;case"boolean":return M.boolean;case"function":return M.function;case"bigint":return M.bigint;case"symbol":return M.symbol;case"object":if(Array.isArray(D))return M.array;if(D===null)return M.null;if(D.then&&typeof D.then==="function"&&D.catch&&typeof D.catch==="function")return M.promise;if(typeof Map<"u"&&D instanceof Map)return M.map;if(typeof Set<"u"&&D instanceof Set)return M.set;if(typeof Date<"u"&&D instanceof Date)return M.date;return M.object;default:return M.unknown}};var f0=I(()=>{(function(D){D.assertEqual=(B)=>{};function F(B){}D.assertIs=F;function $(B){throw Error()}D.assertNever=$,D.arrayToEnum=(B)=>{let X={};for(let Q of B)X[Q]=Q;return X},D.getValidEnumValues=(B)=>{let X=D.objectKeys(B).filter((Y)=>typeof B[B[Y]]!=="number"),Q={};for(let Y of X)Q[Y]=B[Y];return D.objectValues(Q)},D.objectValues=(B)=>{return D.objectKeys(B).map(function(X){return B[X]})},D.objectKeys=typeof Object.keys==="function"?(B)=>Object.keys(B):(B)=>{let X=[];for(let Q in B)if(Object.prototype.hasOwnProperty.call(B,Q))X.push(Q);return X},D.find=(B,X)=>{for(let Q of B)if(X(Q))return Q;return},D.isInteger=typeof Number.isInteger==="function"?(B)=>Number.isInteger(B):(B)=>typeof B==="number"&&Number.isFinite(B)&&Math.floor(B)===B;function J(B,X=" | "){return B.map((Q)=>typeof Q==="string"?`'${Q}'`:Q).join(X)}D.joinValues=J,D.jsonStringifyReplacer=(B,X)=>{if(typeof X==="bigint")return X.toString();return X}})(w||(w={}));(function(D){D.mergeShapes=(F,$)=>{return{...F,...$}}})(A6||(A6={}));M=w.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"])});var K,jB=(D)=>{return JSON.stringify(D,null,2).replace(/"([^"]+)":/g,"$1:")},XD;var i3=I(()=>{f0();K=w.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"]);XD=class XD extends Error{get errors(){return this.issues}constructor(D){super();this.issues=[],this.addIssue=($)=>{this.issues=[...this.issues,$]},this.addIssues=($=[])=>{this.issues=[...this.issues,...$]};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(B){return B.message},$={_errors:[]},J=(B)=>{for(let X of B.issues)if(X.code==="invalid_union")X.unionErrors.map(J);else if(X.code==="invalid_return_type")J(X.returnTypeError);else if(X.code==="invalid_arguments")J(X.argumentsError);else if(X.path.length===0)$._errors.push(F(X));else{let Q=$,Y=0;while(Y<X.path.length){let q=X.path[Y];if(Y!==X.path.length-1)Q[q]=Q[q]||{_errors:[]};else Q[q]=Q[q]||{_errors:[]},Q[q]._errors.push(F(X));Q=Q[q],Y++}}};return J(this),$}static assert(D){if(!(D instanceof XD))throw Error(`Not a ZodError: ${D}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,w.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(D=(F)=>F.message){let F={},$=[];for(let J of this.issues)if(J.path.length>0){let B=J.path[0];F[B]=F[B]||[],F[B].push(D(J))}else $.push(D(J));return{formErrors:$,fieldErrors:F}}get formErrors(){return this.flatten()}};XD.create=(D)=>{return new XD(D)}});var _B=(D,F)=>{let $;switch(D.code){case K.invalid_type:if(D.received===M.undefined)$="Required";else $=`Expected ${D.expected}, received ${D.received}`;break;case K.invalid_literal:$=`Invalid literal value, expected ${JSON.stringify(D.expected,w.jsonStringifyReplacer)}`;break;case K.unrecognized_keys:$=`Unrecognized key(s) in object: ${w.joinValues(D.keys,", ")}`;break;case K.invalid_union:$="Invalid input";break;case K.invalid_union_discriminator:$=`Invalid discriminator value. Expected ${w.joinValues(D.options)}`;break;case K.invalid_enum_value:$=`Invalid enum value. Expected ${w.joinValues(D.options)}, received '${D.received}'`;break;case K.invalid_arguments:$="Invalid function arguments";break;case K.invalid_return_type:$="Invalid function return type";break;case K.invalid_date:$="Invalid date";break;case K.invalid_string:if(typeof D.validation==="object")if("includes"in D.validation){if($=`Invalid input: must include "${D.validation.includes}"`,typeof D.validation.position==="number")$=`${$} at one or more positions greater than or equal to ${D.validation.position}`}else if("startsWith"in D.validation)$=`Invalid input: must start with "${D.validation.startsWith}"`;else if("endsWith"in D.validation)$=`Invalid input: must end with "${D.validation.endsWith}"`;else w.assertNever(D.validation);else if(D.validation!=="regex")$=`Invalid ${D.validation}`;else $="Invalid";break;case K.too_small:if(D.type==="array")$=`Array must contain ${D.exact?"exactly":D.inclusive?"at least":"more than"} ${D.minimum} element(s)`;else if(D.type==="string")$=`String must contain ${D.exact?"exactly":D.inclusive?"at least":"over"} ${D.minimum} character(s)`;else if(D.type==="number")$=`Number must be ${D.exact?"exactly equal to ":D.inclusive?"greater than or equal to ":"greater than "}${D.minimum}`;else if(D.type==="bigint")$=`Number must be ${D.exact?"exactly equal to ":D.inclusive?"greater than or equal to ":"greater than "}${D.minimum}`;else if(D.type==="date")$=`Date must be ${D.exact?"exactly equal to ":D.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(D.minimum))}`;else $="Invalid input";break;case K.too_big:if(D.type==="array")$=`Array must contain ${D.exact?"exactly":D.inclusive?"at most":"less than"} ${D.maximum} element(s)`;else if(D.type==="string")$=`String must contain ${D.exact?"exactly":D.inclusive?"at most":"under"} ${D.maximum} character(s)`;else if(D.type==="number")$=`Number must be ${D.exact?"exactly":D.inclusive?"less than or equal to":"less than"} ${D.maximum}`;else if(D.type==="bigint")$=`BigInt must be ${D.exact?"exactly":D.inclusive?"less than or equal to":"less than"} ${D.maximum}`;else if(D.type==="date")$=`Date must be ${D.exact?"exactly":D.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(D.maximum))}`;else $="Invalid input";break;case K.custom:$="Invalid input";break;case K.invalid_intersection_types:$="Intersection results could not be merged";break;case K.not_multiple_of:$=`Number must be a multiple of ${D.multipleOf}`;break;case K.not_finite:$="Number must be finite";break;default:$=F.defaultError,w.assertNever(D)}return{message:$}},hD;var R6=I(()=>{i3();f0();hD=_B});function LB(D){a5=D}function s2(){return a5}var a5;var r3=I(()=>{R6();a5=hD});function O(D,F){let $=s2(),J=u0({issueData:F,data:D.data,path:D.path,errorMaps:[D.common.contextualErrorMap,D.schemaErrorMap,$,$===hD?void 0:hD].filter((B)=>!!B)});D.common.issues.push(J)}class n{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 $=[];for(let J of F){if(J.status==="aborted")return T;if(J.status==="dirty")D.dirty();$.push(J.value)}return{status:D.value,value:$}}static async mergeObjectAsync(D,F){let $=[];for(let J of F){let B=await J.key,X=await J.value;$.push({key:B,value:X})}return n.mergeObjectSync(D,$)}static mergeObjectSync(D,F){let $={};for(let J of F){let{key:B,value:X}=J;if(B.status==="aborted")return T;if(X.status==="aborted")return T;if(B.status==="dirty")D.dirty();if(X.status==="dirty")D.dirty();if(B.value!=="__proto__"&&(typeof X.value<"u"||J.alwaysSet))$[B.value]=X.value}return{status:D.value,value:$}}}var u0=(D)=>{let{data:F,path:$,errorMaps:J,issueData:B}=D,X=[...$,...B.path||[]],Q={...B,path:X};if(B.message!==void 0)return{...B,path:X,message:B.message};let Y="",q=J.filter((G)=>!!G).slice().reverse();for(let G of q)Y=G(Q,{data:F,defaultError:Y}).message;return{...B,path:X,message:Y}},ZB,T,z2=(D)=>({status:"dirty",value:D}),e=(D)=>({status:"valid",value:D}),n3=(D)=>D.status==="aborted",o3=(D)=>D.status==="dirty",eD=(D)=>D.status==="valid",a2=(D)=>typeof Promise<"u"&&D instanceof Promise;var O6=I(()=>{r3();R6();ZB=[];T=Object.freeze({status:"aborted"})});var t5=()=>{};var j;var e5=I(()=>{(function(D){D.errToObj=(F)=>typeof F==="string"?{message:F}:F||{},D.toString=(F)=>typeof F==="string"?F:F?.message})(j||(j={}))});class _D{constructor(D,F,$,J){this._cachedPath=[],this.parent=D,this.data=F,this._path=$,this._key=J}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 S(D){if(!D)return{};let{errorMap:F,invalid_type_error:$,required_error:J,description:B}=D;if(F&&($||J))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(F)return{errorMap:F,description:B};return{errorMap:(Q,Y)=>{let{message:q}=D;if(Q.code==="invalid_enum_value")return{message:q??Y.defaultError};if(typeof Y.data>"u")return{message:q??J??Y.defaultError};if(Q.code!=="invalid_type")return{message:Y.defaultError};return{message:q??$??Y.defaultError}},description:B}}class k{get description(){return this._def.description}_getType(D){return SD(D.data)}_getOrReturnCtx(D,F){return F||{common:D.parent.common,data:D.data,parsedType:SD(D.data),schemaErrorMap:this._def.errorMap,path:D.path,parent:D.parent}}_processInputParams(D){return{status:new n,ctx:{common:D.parent.common,data:D.data,parsedType:SD(D.data),schemaErrorMap:this._def.errorMap,path:D.path,parent:D.parent}}}_parseSync(D){let F=this._parse(D);if(a2(F))throw Error("Synchronous parse encountered promise.");return F}_parseAsync(D){let F=this._parse(D);return Promise.resolve(F)}parse(D,F){let $=this.safeParse(D,F);if($.success)return $.data;throw $.error}safeParse(D,F){let $={common:{issues:[],async:F?.async??!1,contextualErrorMap:F?.errorMap},path:F?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:D,parsedType:SD(D)},J=this._parseSync({data:D,path:$.path,parent:$});return D7($,J)}"~validate"(D){let F={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:D,parsedType:SD(D)};if(!this["~standard"].async)try{let $=this._parseSync({data:D,path:[],parent:F});return eD($)?{value:$.value}:{issues:F.common.issues}}catch($){if($?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;F.common={issues:[],async:!0}}return this._parseAsync({data:D,path:[],parent:F}).then(($)=>eD($)?{value:$.value}:{issues:F.common.issues})}async parseAsync(D,F){let $=await this.safeParseAsync(D,F);if($.success)return $.data;throw $.error}async safeParseAsync(D,F){let $={common:{issues:[],contextualErrorMap:F?.errorMap,async:!0},path:F?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:D,parsedType:SD(D)},J=this._parse({data:D,path:$.path,parent:$}),B=await(a2(J)?J:Promise.resolve(J));return D7($,B)}refine(D,F){let $=(J)=>{if(typeof F==="string"||typeof F>"u")return{message:F};else if(typeof F==="function")return F(J);else return F};return this._refinement((J,B)=>{let X=D(J),Q=()=>B.addIssue({code:K.custom,...$(J)});if(typeof Promise<"u"&&X instanceof Promise)return X.then((Y)=>{if(!Y)return Q(),!1;else return!0});if(!X)return Q(),!1;else return!0})}refinement(D,F){return this._refinement(($,J)=>{if(!D($))return J.addIssue(typeof F==="function"?F($,J):F),!1;else return!0})}_refinement(D){return new LD({schema:this,typeName:N.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 jD.create(this,this._def)}nullable(){return mD.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return CD.create(this)}promise(){return A2.create(this,this._def)}or(D){return J0.create([this,D],this._def)}and(D){return B0.create(this,D,this._def)}transform(D){return new LD({...S(this._def),schema:this,typeName:N.ZodEffects,effect:{type:"transform",transform:D}})}default(D){let F=typeof D==="function"?D:()=>D;return new q0({...S(this._def),innerType:this,defaultValue:F,typeName:N.ZodDefault})}brand(){return new a3({typeName:N.ZodBranded,type:this,...S(this._def)})}catch(D){let F=typeof D==="function"?D:()=>D;return new G0({...S(this._def),innerType:this,catchValue:F,typeName:N.ZodCatch})}describe(D){return new this.constructor({...this._def,description:D})}pipe(D){return l0.create(this,D)}readonly(){return H0.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}function J7(D){let F="[0-5]\\d";if(D.precision)F=`${F}\\.\\d{${D.precision}}`;else if(D.precision==null)F=`${F}(\\.\\d+)?`;let $=D.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${F})${$}`}function lB(D){return new RegExp(`^${J7(D)}$`)}function B7(D){let F=`${$7}T${J7(D)}`,$=[];if($.push(D.local?"Z?":"Z"),D.offset)$.push("([+-]\\d{2}:?\\d{2})");return F=`${F}(${$.join("|")})`,new RegExp(`^${F}$`)}function pB(D,F){if((F==="v4"||!F)&&fB.test(D))return!0;if((F==="v6"||!F)&&xB.test(D))return!0;return!1}function dB(D,F){if(!PB.test(D))return!1;try{let[$]=D.split(".");if(!$)return!1;let J=$.replace(/-/g,"+").replace(/_/g,"/").padEnd($.length+(4-$.length%4)%4,"="),B=JSON.parse(atob(J));if(typeof B!=="object"||B===null)return!1;if("typ"in B&&B?.typ!=="JWT")return!1;if(!B.alg)return!1;if(F&&B.alg!==F)return!1;return!0}catch{return!1}}function cB(D,F){if((F==="v4"||!F)&&uB.test(D))return!0;if((F==="v6"||!F)&&yB.test(D))return!0;return!1}function iB(D,F){let $=(D.toString().split(".")[1]||"").length,J=(F.toString().split(".")[1]||"").length,B=$>J?$:J,X=Number.parseInt(D.toFixed(B).replace(".","")),Q=Number.parseInt(F.toFixed(B).replace(".",""));return X%Q/10**B}function t2(D){if(D instanceof g){let F={};for(let $ in D.shape){let J=D.shape[$];F[$]=jD.create(t2(J))}return new g({...D._def,shape:()=>F})}else if(D instanceof CD)return new CD({...D._def,type:t2(D.element)});else if(D instanceof jD)return jD.create(t2(D.unwrap()));else if(D instanceof mD)return mD.create(t2(D.unwrap()));else if(D instanceof PD)return PD.create(D.items.map((F)=>t2(F)));else return D}function j6(D,F){let $=SD(D),J=SD(F);if(D===F)return{valid:!0,data:D};else if($===M.object&&J===M.object){let B=w.objectKeys(F),X=w.objectKeys(D).filter((Y)=>B.indexOf(Y)!==-1),Q={...D,...F};for(let Y of X){let q=j6(D[Y],F[Y]);if(!q.valid)return{valid:!1};Q[Y]=q.data}return{valid:!0,data:Q}}else if($===M.array&&J===M.array){if(D.length!==F.length)return{valid:!1};let B=[];for(let X=0;X<D.length;X++){let Q=D[X],Y=F[X],q=j6(Q,Y);if(!q.valid)return{valid:!1};B.push(q.data)}return{valid:!0,data:B}}else if($===M.date&&J===M.date&&+D===+F)return{valid:!0,data:D};else return{valid:!1}}function X7(D,F){return new J2({values:D,typeName:N.ZodEnum,...S(F)})}function F7(D,F){let $=typeof D==="function"?D(F):typeof D==="string"?{message:D}:D;return typeof $==="string"?{message:$}:$}function Q7(D,F={},$){if(D)return M2.create().superRefine((J,B)=>{let X=D(J);if(X instanceof Promise)return X.then((Q)=>{if(!Q){let Y=F7(F,J),q=Y.fatal??$??!0;B.addIssue({code:"custom",...Y,fatal:q})}});if(!X){let Q=F7(F,J),Y=Q.fatal??$??!0;B.addIssue({code:"custom",...Q,fatal:Y})}return});return M2.create()}var D7=(D,F)=>{if(eD(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 $=new XD(D.common.issues);return this._error=$,this._error}}}},TB,NB,IB,SB,bB,PB,vB,kB,wB="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",C6,fB,uB,xB,yB,hB,gB,$7="((\\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])))",mB,OD,F2,$2,D0,K2,x0,F0,$0,M2,D2,bD,y0,CD,g,J0,gD=(D)=>{if(D instanceof X0)return gD(D.schema);else if(D instanceof LD)return gD(D.innerType());else if(D instanceof Q0)return[D.value];else if(D instanceof J2)return D.options;else if(D instanceof Y0)return w.objectValues(D.enum);else if(D instanceof q0)return gD(D._def.innerType);else if(D instanceof F0)return[void 0];else if(D instanceof $0)return[null];else if(D instanceof jD)return[void 0,...gD(D.unwrap())];else if(D instanceof mD)return[null,...gD(D.unwrap())];else if(D instanceof a3)return gD(D.unwrap());else if(D instanceof H0)return gD(D.unwrap());else if(D instanceof G0)return gD(D._def.innerType);else return[]},s3,B0,PD,h0,g0,E2,e2,X0,Q0,J2,Y0,A2,LD,jD,mD,q0,G0,m0,rB,a3,l0,H0,nB,N,oB=(D,F={message:`Input not instance of ${D.name}`})=>Q7(($)=>$ instanceof D,F),Y7,q7,sB,aB,G7,tB,eB,DX,FX,$X,JX,BX,XX,QX,YX,qX,GX,HX,VX,WX,UX,zX,KX,MX,EX,AX,RX,OX,CX,jX,_X,LX,ZX,TX,NX=()=>Y7().optional(),IX=()=>q7().optional(),SX=()=>G7().optional(),bX,PX;var H7=I(()=>{i3();r3();e5();O6();f0();TB=/^c[^\s-]{8,}$/i,NB=/^[0-9a-z]+$/,IB=/^[0-9A-HJKMNP-TV-Z]{26}$/i,SB=/^[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,bB=/^[a-z0-9_-]{21}$/i,PB=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,vB=/^[-+]?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)?)??$/,kB=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,fB=/^(?:(?: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])$/,uB=/^(?:(?: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])$/,xB=/^(([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]))$/,yB=/^(([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])$/,hB=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,gB=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,mB=new RegExp(`^${$7}$`);OD=class OD extends k{_parse(D){if(this._def.coerce)D.data=String(D.data);if(this._getType(D)!==M.string){let B=this._getOrReturnCtx(D);return O(B,{code:K.invalid_type,expected:M.string,received:B.parsedType}),T}let $=new n,J=void 0;for(let B of this._def.checks)if(B.kind==="min"){if(D.data.length<B.value)J=this._getOrReturnCtx(D,J),O(J,{code:K.too_small,minimum:B.value,type:"string",inclusive:!0,exact:!1,message:B.message}),$.dirty()}else if(B.kind==="max"){if(D.data.length>B.value)J=this._getOrReturnCtx(D,J),O(J,{code:K.too_big,maximum:B.value,type:"string",inclusive:!0,exact:!1,message:B.message}),$.dirty()}else if(B.kind==="length"){let X=D.data.length>B.value,Q=D.data.length<B.value;if(X||Q){if(J=this._getOrReturnCtx(D,J),X)O(J,{code:K.too_big,maximum:B.value,type:"string",inclusive:!0,exact:!0,message:B.message});else if(Q)O(J,{code:K.too_small,minimum:B.value,type:"string",inclusive:!0,exact:!0,message:B.message});$.dirty()}}else if(B.kind==="email"){if(!kB.test(D.data))J=this._getOrReturnCtx(D,J),O(J,{validation:"email",code:K.invalid_string,message:B.message}),$.dirty()}else if(B.kind==="emoji"){if(!C6)C6=new RegExp(wB,"u");if(!C6.test(D.data))J=this._getOrReturnCtx(D,J),O(J,{validation:"emoji",code:K.invalid_string,message:B.message}),$.dirty()}else if(B.kind==="uuid"){if(!SB.test(D.data))J=this._getOrReturnCtx(D,J),O(J,{validation:"uuid",code:K.invalid_string,message:B.message}),$.dirty()}else if(B.kind==="nanoid"){if(!bB.test(D.data))J=this._getOrReturnCtx(D,J),O(J,{validation:"nanoid",code:K.invalid_string,message:B.message}),$.dirty()}else if(B.kind==="cuid"){if(!TB.test(D.data))J=this._getOrReturnCtx(D,J),O(J,{validation:"cuid",code:K.invalid_string,message:B.message}),$.dirty()}else if(B.kind==="cuid2"){if(!NB.test(D.data))J=this._getOrReturnCtx(D,J),O(J,{validation:"cuid2",code:K.invalid_string,message:B.message}),$.dirty()}else if(B.kind==="ulid"){if(!IB.test(D.data))J=this._getOrReturnCtx(D,J),O(J,{validation:"ulid",code:K.invalid_string,message:B.message}),$.dirty()}else if(B.kind==="url")try{new URL(D.data)}catch{J=this._getOrReturnCtx(D,J),O(J,{validation:"url",code:K.invalid_string,message:B.message}),$.dirty()}else if(B.kind==="regex"){if(B.regex.lastIndex=0,!B.regex.test(D.data))J=this._getOrReturnCtx(D,J),O(J,{validation:"regex",code:K.invalid_string,message:B.message}),$.dirty()}else if(B.kind==="trim")D.data=D.data.trim();else if(B.kind==="includes"){if(!D.data.includes(B.value,B.position))J=this._getOrReturnCtx(D,J),O(J,{code:K.invalid_string,validation:{includes:B.value,position:B.position},message:B.message}),$.dirty()}else if(B.kind==="toLowerCase")D.data=D.data.toLowerCase();else if(B.kind==="toUpperCase")D.data=D.data.toUpperCase();else if(B.kind==="startsWith"){if(!D.data.startsWith(B.value))J=this._getOrReturnCtx(D,J),O(J,{code:K.invalid_string,validation:{startsWith:B.value},message:B.message}),$.dirty()}else if(B.kind==="endsWith"){if(!D.data.endsWith(B.value))J=this._getOrReturnCtx(D,J),O(J,{code:K.invalid_string,validation:{endsWith:B.value},message:B.message}),$.dirty()}else if(B.kind==="datetime"){if(!B7(B).test(D.data))J=this._getOrReturnCtx(D,J),O(J,{code:K.invalid_string,validation:"datetime",message:B.message}),$.dirty()}else if(B.kind==="date"){if(!mB.test(D.data))J=this._getOrReturnCtx(D,J),O(J,{code:K.invalid_string,validation:"date",message:B.message}),$.dirty()}else if(B.kind==="time"){if(!lB(B).test(D.data))J=this._getOrReturnCtx(D,J),O(J,{code:K.invalid_string,validation:"time",message:B.message}),$.dirty()}else if(B.kind==="duration"){if(!vB.test(D.data))J=this._getOrReturnCtx(D,J),O(J,{validation:"duration",code:K.invalid_string,message:B.message}),$.dirty()}else if(B.kind==="ip"){if(!pB(D.data,B.version))J=this._getOrReturnCtx(D,J),O(J,{validation:"ip",code:K.invalid_string,message:B.message}),$.dirty()}else if(B.kind==="jwt"){if(!dB(D.data,B.alg))J=this._getOrReturnCtx(D,J),O(J,{validation:"jwt",code:K.invalid_string,message:B.message}),$.dirty()}else if(B.kind==="cidr"){if(!cB(D.data,B.version))J=this._getOrReturnCtx(D,J),O(J,{validation:"cidr",code:K.invalid_string,message:B.message}),$.dirty()}else if(B.kind==="base64"){if(!hB.test(D.data))J=this._getOrReturnCtx(D,J),O(J,{validation:"base64",code:K.invalid_string,message:B.message}),$.dirty()}else if(B.kind==="base64url"){if(!gB.test(D.data))J=this._getOrReturnCtx(D,J),O(J,{validation:"base64url",code:K.invalid_string,message:B.message}),$.dirty()}else w.assertNever(B);return{status:$.value,value:D.data}}_regex(D,F,$){return this.refinement((J)=>D.test(J),{validation:F,code:K.invalid_string,...j.errToObj($)})}_addCheck(D){return new OD({...this._def,checks:[...this._def.checks,D]})}email(D){return this._addCheck({kind:"email",...j.errToObj(D)})}url(D){return this._addCheck({kind:"url",...j.errToObj(D)})}emoji(D){return this._addCheck({kind:"emoji",...j.errToObj(D)})}uuid(D){return this._addCheck({kind:"uuid",...j.errToObj(D)})}nanoid(D){return this._addCheck({kind:"nanoid",...j.errToObj(D)})}cuid(D){return this._addCheck({kind:"cuid",...j.errToObj(D)})}cuid2(D){return this._addCheck({kind:"cuid2",...j.errToObj(D)})}ulid(D){return this._addCheck({kind:"ulid",...j.errToObj(D)})}base64(D){return this._addCheck({kind:"base64",...j.errToObj(D)})}base64url(D){return this._addCheck({kind:"base64url",...j.errToObj(D)})}jwt(D){return this._addCheck({kind:"jwt",...j.errToObj(D)})}ip(D){return this._addCheck({kind:"ip",...j.errToObj(D)})}cidr(D){return this._addCheck({kind:"cidr",...j.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,...j.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,...j.errToObj(D?.message)})}duration(D){return this._addCheck({kind:"duration",...j.errToObj(D)})}regex(D,F){return this._addCheck({kind:"regex",regex:D,...j.errToObj(F)})}includes(D,F){return this._addCheck({kind:"includes",value:D,position:F?.position,...j.errToObj(F?.message)})}startsWith(D,F){return this._addCheck({kind:"startsWith",value:D,...j.errToObj(F)})}endsWith(D,F){return this._addCheck({kind:"endsWith",value:D,...j.errToObj(F)})}min(D,F){return this._addCheck({kind:"min",value:D,...j.errToObj(F)})}max(D,F){return this._addCheck({kind:"max",value:D,...j.errToObj(F)})}length(D,F){return this._addCheck({kind:"length",value:D,...j.errToObj(F)})}nonempty(D){return this.min(1,j.errToObj(D))}trim(){return new OD({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new OD({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new OD({...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}};OD.create=(D)=>{return new OD({checks:[],typeName:N.ZodString,coerce:D?.coerce??!1,...S(D)})};F2=class F2 extends k{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)!==M.number){let B=this._getOrReturnCtx(D);return O(B,{code:K.invalid_type,expected:M.number,received:B.parsedType}),T}let $=void 0,J=new n;for(let B of this._def.checks)if(B.kind==="int"){if(!w.isInteger(D.data))$=this._getOrReturnCtx(D,$),O($,{code:K.invalid_type,expected:"integer",received:"float",message:B.message}),J.dirty()}else if(B.kind==="min"){if(B.inclusive?D.data<B.value:D.data<=B.value)$=this._getOrReturnCtx(D,$),O($,{code:K.too_small,minimum:B.value,type:"number",inclusive:B.inclusive,exact:!1,message:B.message}),J.dirty()}else if(B.kind==="max"){if(B.inclusive?D.data>B.value:D.data>=B.value)$=this._getOrReturnCtx(D,$),O($,{code:K.too_big,maximum:B.value,type:"number",inclusive:B.inclusive,exact:!1,message:B.message}),J.dirty()}else if(B.kind==="multipleOf"){if(iB(D.data,B.value)!==0)$=this._getOrReturnCtx(D,$),O($,{code:K.not_multiple_of,multipleOf:B.value,message:B.message}),J.dirty()}else if(B.kind==="finite"){if(!Number.isFinite(D.data))$=this._getOrReturnCtx(D,$),O($,{code:K.not_finite,message:B.message}),J.dirty()}else w.assertNever(B);return{status:J.value,value:D.data}}gte(D,F){return this.setLimit("min",D,!0,j.toString(F))}gt(D,F){return this.setLimit("min",D,!1,j.toString(F))}lte(D,F){return this.setLimit("max",D,!0,j.toString(F))}lt(D,F){return this.setLimit("max",D,!1,j.toString(F))}setLimit(D,F,$,J){return new F2({...this._def,checks:[...this._def.checks,{kind:D,value:F,inclusive:$,message:j.toString(J)}]})}_addCheck(D){return new F2({...this._def,checks:[...this._def.checks,D]})}int(D){return this._addCheck({kind:"int",message:j.toString(D)})}positive(D){return this._addCheck({kind:"min",value:0,inclusive:!1,message:j.toString(D)})}negative(D){return this._addCheck({kind:"max",value:0,inclusive:!1,message:j.toString(D)})}nonpositive(D){return this._addCheck({kind:"max",value:0,inclusive:!0,message:j.toString(D)})}nonnegative(D){return this._addCheck({kind:"min",value:0,inclusive:!0,message:j.toString(D)})}multipleOf(D,F){return this._addCheck({kind:"multipleOf",value:D,message:j.toString(F)})}finite(D){return this._addCheck({kind:"finite",message:j.toString(D)})}safe(D){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:j.toString(D)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:j.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"&&w.isInteger(D.value))}get isFinite(){let D=null,F=null;for(let $ of this._def.checks)if($.kind==="finite"||$.kind==="int"||$.kind==="multipleOf")return!0;else if($.kind==="min"){if(F===null||$.value>F)F=$.value}else if($.kind==="max"){if(D===null||$.value<D)D=$.value}return Number.isFinite(F)&&Number.isFinite(D)}};F2.create=(D)=>{return new F2({checks:[],typeName:N.ZodNumber,coerce:D?.coerce||!1,...S(D)})};$2=class $2 extends k{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)!==M.bigint)return this._getInvalidInput(D);let $=void 0,J=new n;for(let B of this._def.checks)if(B.kind==="min"){if(B.inclusive?D.data<B.value:D.data<=B.value)$=this._getOrReturnCtx(D,$),O($,{code:K.too_small,type:"bigint",minimum:B.value,inclusive:B.inclusive,message:B.message}),J.dirty()}else if(B.kind==="max"){if(B.inclusive?D.data>B.value:D.data>=B.value)$=this._getOrReturnCtx(D,$),O($,{code:K.too_big,type:"bigint",maximum:B.value,inclusive:B.inclusive,message:B.message}),J.dirty()}else if(B.kind==="multipleOf"){if(D.data%B.value!==BigInt(0))$=this._getOrReturnCtx(D,$),O($,{code:K.not_multiple_of,multipleOf:B.value,message:B.message}),J.dirty()}else w.assertNever(B);return{status:J.value,value:D.data}}_getInvalidInput(D){let F=this._getOrReturnCtx(D);return O(F,{code:K.invalid_type,expected:M.bigint,received:F.parsedType}),T}gte(D,F){return this.setLimit("min",D,!0,j.toString(F))}gt(D,F){return this.setLimit("min",D,!1,j.toString(F))}lte(D,F){return this.setLimit("max",D,!0,j.toString(F))}lt(D,F){return this.setLimit("max",D,!1,j.toString(F))}setLimit(D,F,$,J){return new $2({...this._def,checks:[...this._def.checks,{kind:D,value:F,inclusive:$,message:j.toString(J)}]})}_addCheck(D){return new $2({...this._def,checks:[...this._def.checks,D]})}positive(D){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:j.toString(D)})}negative(D){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:j.toString(D)})}nonpositive(D){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:j.toString(D)})}nonnegative(D){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:j.toString(D)})}multipleOf(D,F){return this._addCheck({kind:"multipleOf",value:D,message:j.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}};$2.create=(D)=>{return new $2({checks:[],typeName:N.ZodBigInt,coerce:D?.coerce??!1,...S(D)})};D0=class D0 extends k{_parse(D){if(this._def.coerce)D.data=Boolean(D.data);if(this._getType(D)!==M.boolean){let $=this._getOrReturnCtx(D);return O($,{code:K.invalid_type,expected:M.boolean,received:$.parsedType}),T}return e(D.data)}};D0.create=(D)=>{return new D0({typeName:N.ZodBoolean,coerce:D?.coerce||!1,...S(D)})};K2=class K2 extends k{_parse(D){if(this._def.coerce)D.data=new Date(D.data);if(this._getType(D)!==M.date){let B=this._getOrReturnCtx(D);return O(B,{code:K.invalid_type,expected:M.date,received:B.parsedType}),T}if(Number.isNaN(D.data.getTime())){let B=this._getOrReturnCtx(D);return O(B,{code:K.invalid_date}),T}let $=new n,J=void 0;for(let B of this._def.checks)if(B.kind==="min"){if(D.data.getTime()<B.value)J=this._getOrReturnCtx(D,J),O(J,{code:K.too_small,message:B.message,inclusive:!0,exact:!1,minimum:B.value,type:"date"}),$.dirty()}else if(B.kind==="max"){if(D.data.getTime()>B.value)J=this._getOrReturnCtx(D,J),O(J,{code:K.too_big,message:B.message,inclusive:!0,exact:!1,maximum:B.value,type:"date"}),$.dirty()}else w.assertNever(B);return{status:$.value,value:new Date(D.data.getTime())}}_addCheck(D){return new K2({...this._def,checks:[...this._def.checks,D]})}min(D,F){return this._addCheck({kind:"min",value:D.getTime(),message:j.toString(F)})}max(D,F){return this._addCheck({kind:"max",value:D.getTime(),message:j.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}};K2.create=(D)=>{return new K2({checks:[],coerce:D?.coerce||!1,typeName:N.ZodDate,...S(D)})};x0=class x0 extends k{_parse(D){if(this._getType(D)!==M.symbol){let $=this._getOrReturnCtx(D);return O($,{code:K.invalid_type,expected:M.symbol,received:$.parsedType}),T}return e(D.data)}};x0.create=(D)=>{return new x0({typeName:N.ZodSymbol,...S(D)})};F0=class F0 extends k{_parse(D){if(this._getType(D)!==M.undefined){let $=this._getOrReturnCtx(D);return O($,{code:K.invalid_type,expected:M.undefined,received:$.parsedType}),T}return e(D.data)}};F0.create=(D)=>{return new F0({typeName:N.ZodUndefined,...S(D)})};$0=class $0 extends k{_parse(D){if(this._getType(D)!==M.null){let $=this._getOrReturnCtx(D);return O($,{code:K.invalid_type,expected:M.null,received:$.parsedType}),T}return e(D.data)}};$0.create=(D)=>{return new $0({typeName:N.ZodNull,...S(D)})};M2=class M2 extends k{constructor(){super(...arguments);this._any=!0}_parse(D){return e(D.data)}};M2.create=(D)=>{return new M2({typeName:N.ZodAny,...S(D)})};D2=class D2 extends k{constructor(){super(...arguments);this._unknown=!0}_parse(D){return e(D.data)}};D2.create=(D)=>{return new D2({typeName:N.ZodUnknown,...S(D)})};bD=class bD extends k{_parse(D){let F=this._getOrReturnCtx(D);return O(F,{code:K.invalid_type,expected:M.never,received:F.parsedType}),T}};bD.create=(D)=>{return new bD({typeName:N.ZodNever,...S(D)})};y0=class y0 extends k{_parse(D){if(this._getType(D)!==M.undefined){let $=this._getOrReturnCtx(D);return O($,{code:K.invalid_type,expected:M.void,received:$.parsedType}),T}return e(D.data)}};y0.create=(D)=>{return new y0({typeName:N.ZodVoid,...S(D)})};CD=class CD extends k{_parse(D){let{ctx:F,status:$}=this._processInputParams(D),J=this._def;if(F.parsedType!==M.array)return O(F,{code:K.invalid_type,expected:M.array,received:F.parsedType}),T;if(J.exactLength!==null){let X=F.data.length>J.exactLength.value,Q=F.data.length<J.exactLength.value;if(X||Q)O(F,{code:X?K.too_big:K.too_small,minimum:Q?J.exactLength.value:void 0,maximum:X?J.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:J.exactLength.message}),$.dirty()}if(J.minLength!==null){if(F.data.length<J.minLength.value)O(F,{code:K.too_small,minimum:J.minLength.value,type:"array",inclusive:!0,exact:!1,message:J.minLength.message}),$.dirty()}if(J.maxLength!==null){if(F.data.length>J.maxLength.value)O(F,{code:K.too_big,maximum:J.maxLength.value,type:"array",inclusive:!0,exact:!1,message:J.maxLength.message}),$.dirty()}if(F.common.async)return Promise.all([...F.data].map((X,Q)=>{return J.type._parseAsync(new _D(F,X,F.path,Q))})).then((X)=>{return n.mergeArray($,X)});let B=[...F.data].map((X,Q)=>{return J.type._parseSync(new _D(F,X,F.path,Q))});return n.mergeArray($,B)}get element(){return this._def.type}min(D,F){return new CD({...this._def,minLength:{value:D,message:j.toString(F)}})}max(D,F){return new CD({...this._def,maxLength:{value:D,message:j.toString(F)}})}length(D,F){return new CD({...this._def,exactLength:{value:D,message:j.toString(F)}})}nonempty(D){return this.min(1,D)}};CD.create=(D,F)=>{return new CD({type:D,minLength:null,maxLength:null,exactLength:null,typeName:N.ZodArray,...S(F)})};g=class g extends k{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=w.objectKeys(D);return this._cached={shape:D,keys:F},this._cached}_parse(D){if(this._getType(D)!==M.object){let q=this._getOrReturnCtx(D);return O(q,{code:K.invalid_type,expected:M.object,received:q.parsedType}),T}let{status:$,ctx:J}=this._processInputParams(D),{shape:B,keys:X}=this._getCached(),Q=[];if(!(this._def.catchall instanceof bD&&this._def.unknownKeys==="strip")){for(let q in J.data)if(!X.includes(q))Q.push(q)}let Y=[];for(let q of X){let G=B[q],H=J.data[q];Y.push({key:{status:"valid",value:q},value:G._parse(new _D(J,H,J.path,q)),alwaysSet:q in J.data})}if(this._def.catchall instanceof bD){let q=this._def.unknownKeys;if(q==="passthrough")for(let G of Q)Y.push({key:{status:"valid",value:G},value:{status:"valid",value:J.data[G]}});else if(q==="strict"){if(Q.length>0)O(J,{code:K.unrecognized_keys,keys:Q}),$.dirty()}else if(q==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let q=this._def.catchall;for(let G of Q){let H=J.data[G];Y.push({key:{status:"valid",value:G},value:q._parse(new _D(J,H,J.path,G)),alwaysSet:G in J.data})}}if(J.common.async)return Promise.resolve().then(async()=>{let q=[];for(let G of Y){let H=await G.key,V=await G.value;q.push({key:H,value:V,alwaysSet:G.alwaysSet})}return q}).then((q)=>{return n.mergeObjectSync($,q)});else return n.mergeObjectSync($,Y)}get shape(){return this._def.shape()}strict(D){return j.errToObj,new g({...this._def,unknownKeys:"strict",...D!==void 0?{errorMap:(F,$)=>{let J=this._def.errorMap?.(F,$).message??$.defaultError;if(F.code==="unrecognized_keys")return{message:j.errToObj(D).message??J};return{message:J}}}:{}})}strip(){return new g({...this._def,unknownKeys:"strip"})}passthrough(){return new g({...this._def,unknownKeys:"passthrough"})}extend(D){return new g({...this._def,shape:()=>({...this._def.shape(),...D})})}merge(D){return new g({unknownKeys:D._def.unknownKeys,catchall:D._def.catchall,shape:()=>({...this._def.shape(),...D._def.shape()}),typeName:N.ZodObject})}setKey(D,F){return this.augment({[D]:F})}catchall(D){return new g({...this._def,catchall:D})}pick(D){let F={};for(let $ of w.objectKeys(D))if(D[$]&&this.shape[$])F[$]=this.shape[$];return new g({...this._def,shape:()=>F})}omit(D){let F={};for(let $ of w.objectKeys(this.shape))if(!D[$])F[$]=this.shape[$];return new g({...this._def,shape:()=>F})}deepPartial(){return t2(this)}partial(D){let F={};for(let $ of w.objectKeys(this.shape)){let J=this.shape[$];if(D&&!D[$])F[$]=J;else F[$]=J.optional()}return new g({...this._def,shape:()=>F})}required(D){let F={};for(let $ of w.objectKeys(this.shape))if(D&&!D[$])F[$]=this.shape[$];else{let B=this.shape[$];while(B instanceof jD)B=B._def.innerType;F[$]=B}return new g({...this._def,shape:()=>F})}keyof(){return X7(w.objectKeys(this.shape))}};g.create=(D,F)=>{return new g({shape:()=>D,unknownKeys:"strip",catchall:bD.create(),typeName:N.ZodObject,...S(F)})};g.strictCreate=(D,F)=>{return new g({shape:()=>D,unknownKeys:"strict",catchall:bD.create(),typeName:N.ZodObject,...S(F)})};g.lazycreate=(D,F)=>{return new g({shape:D,unknownKeys:"strip",catchall:bD.create(),typeName:N.ZodObject,...S(F)})};J0=class J0 extends k{_parse(D){let{ctx:F}=this._processInputParams(D),$=this._def.options;function J(B){for(let Q of B)if(Q.result.status==="valid")return Q.result;for(let Q of B)if(Q.result.status==="dirty")return F.common.issues.push(...Q.ctx.common.issues),Q.result;let X=B.map((Q)=>new XD(Q.ctx.common.issues));return O(F,{code:K.invalid_union,unionErrors:X}),T}if(F.common.async)return Promise.all($.map(async(B)=>{let X={...F,common:{...F.common,issues:[]},parent:null};return{result:await B._parseAsync({data:F.data,path:F.path,parent:X}),ctx:X}})).then(J);else{let B=void 0,X=[];for(let Y of $){let q={...F,common:{...F.common,issues:[]},parent:null},G=Y._parseSync({data:F.data,path:F.path,parent:q});if(G.status==="valid")return G;else if(G.status==="dirty"&&!B)B={result:G,ctx:q};if(q.common.issues.length)X.push(q.common.issues)}if(B)return F.common.issues.push(...B.ctx.common.issues),B.result;let Q=X.map((Y)=>new XD(Y));return O(F,{code:K.invalid_union,unionErrors:Q}),T}}get options(){return this._def.options}};J0.create=(D,F)=>{return new J0({options:D,typeName:N.ZodUnion,...S(F)})};s3=class s3 extends k{_parse(D){let{ctx:F}=this._processInputParams(D);if(F.parsedType!==M.object)return O(F,{code:K.invalid_type,expected:M.object,received:F.parsedType}),T;let $=this.discriminator,J=F.data[$],B=this.optionsMap.get(J);if(!B)return O(F,{code:K.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[$]}),T;if(F.common.async)return B._parseAsync({data:F.data,path:F.path,parent:F});else return B._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,$){let J=new Map;for(let B of F){let X=gD(B.shape[D]);if(!X.length)throw Error(`A discriminator value for key \`${D}\` could not be extracted from all schema options`);for(let Q of X){if(J.has(Q))throw Error(`Discriminator property ${String(D)} has duplicate value ${String(Q)}`);J.set(Q,B)}}return new s3({typeName:N.ZodDiscriminatedUnion,discriminator:D,options:F,optionsMap:J,...S($)})}};B0=class B0 extends k{_parse(D){let{status:F,ctx:$}=this._processInputParams(D),J=(B,X)=>{if(n3(B)||n3(X))return T;let Q=j6(B.value,X.value);if(!Q.valid)return O($,{code:K.invalid_intersection_types}),T;if(o3(B)||o3(X))F.dirty();return{status:F.value,value:Q.data}};if($.common.async)return Promise.all([this._def.left._parseAsync({data:$.data,path:$.path,parent:$}),this._def.right._parseAsync({data:$.data,path:$.path,parent:$})]).then(([B,X])=>J(B,X));else return J(this._def.left._parseSync({data:$.data,path:$.path,parent:$}),this._def.right._parseSync({data:$.data,path:$.path,parent:$}))}};B0.create=(D,F,$)=>{return new B0({left:D,right:F,typeName:N.ZodIntersection,...S($)})};PD=class PD extends k{_parse(D){let{status:F,ctx:$}=this._processInputParams(D);if($.parsedType!==M.array)return O($,{code:K.invalid_type,expected:M.array,received:$.parsedType}),T;if($.data.length<this._def.items.length)return O($,{code:K.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),T;if(!this._def.rest&&$.data.length>this._def.items.length)O($,{code:K.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),F.dirty();let B=[...$.data].map((X,Q)=>{let Y=this._def.items[Q]||this._def.rest;if(!Y)return null;return Y._parse(new _D($,X,$.path,Q))}).filter((X)=>!!X);if($.common.async)return Promise.all(B).then((X)=>{return n.mergeArray(F,X)});else return n.mergeArray(F,B)}get items(){return this._def.items}rest(D){return new PD({...this._def,rest:D})}};PD.create=(D,F)=>{if(!Array.isArray(D))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new PD({items:D,typeName:N.ZodTuple,rest:null,...S(F)})};h0=class h0 extends k{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(D){let{status:F,ctx:$}=this._processInputParams(D);if($.parsedType!==M.object)return O($,{code:K.invalid_type,expected:M.object,received:$.parsedType}),T;let J=[],B=this._def.keyType,X=this._def.valueType;for(let Q in $.data)J.push({key:B._parse(new _D($,Q,$.path,Q)),value:X._parse(new _D($,$.data[Q],$.path,Q)),alwaysSet:Q in $.data});if($.common.async)return n.mergeObjectAsync(F,J);else return n.mergeObjectSync(F,J)}get element(){return this._def.valueType}static create(D,F,$){if(F instanceof k)return new h0({keyType:D,valueType:F,typeName:N.ZodRecord,...S($)});return new h0({keyType:OD.create(),valueType:D,typeName:N.ZodRecord,...S(F)})}};g0=class g0 extends k{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(D){let{status:F,ctx:$}=this._processInputParams(D);if($.parsedType!==M.map)return O($,{code:K.invalid_type,expected:M.map,received:$.parsedType}),T;let J=this._def.keyType,B=this._def.valueType,X=[...$.data.entries()].map(([Q,Y],q)=>{return{key:J._parse(new _D($,Q,$.path,[q,"key"])),value:B._parse(new _D($,Y,$.path,[q,"value"]))}});if($.common.async){let Q=new Map;return Promise.resolve().then(async()=>{for(let Y of X){let q=await Y.key,G=await Y.value;if(q.status==="aborted"||G.status==="aborted")return T;if(q.status==="dirty"||G.status==="dirty")F.dirty();Q.set(q.value,G.value)}return{status:F.value,value:Q}})}else{let Q=new Map;for(let Y of X){let{key:q,value:G}=Y;if(q.status==="aborted"||G.status==="aborted")return T;if(q.status==="dirty"||G.status==="dirty")F.dirty();Q.set(q.value,G.value)}return{status:F.value,value:Q}}}};g0.create=(D,F,$)=>{return new g0({valueType:F,keyType:D,typeName:N.ZodMap,...S($)})};E2=class E2 extends k{_parse(D){let{status:F,ctx:$}=this._processInputParams(D);if($.parsedType!==M.set)return O($,{code:K.invalid_type,expected:M.set,received:$.parsedType}),T;let J=this._def;if(J.minSize!==null){if($.data.size<J.minSize.value)O($,{code:K.too_small,minimum:J.minSize.value,type:"set",inclusive:!0,exact:!1,message:J.minSize.message}),F.dirty()}if(J.maxSize!==null){if($.data.size>J.maxSize.value)O($,{code:K.too_big,maximum:J.maxSize.value,type:"set",inclusive:!0,exact:!1,message:J.maxSize.message}),F.dirty()}let B=this._def.valueType;function X(Y){let q=new Set;for(let G of Y){if(G.status==="aborted")return T;if(G.status==="dirty")F.dirty();q.add(G.value)}return{status:F.value,value:q}}let Q=[...$.data.values()].map((Y,q)=>B._parse(new _D($,Y,$.path,q)));if($.common.async)return Promise.all(Q).then((Y)=>X(Y));else return X(Q)}min(D,F){return new E2({...this._def,minSize:{value:D,message:j.toString(F)}})}max(D,F){return new E2({...this._def,maxSize:{value:D,message:j.toString(F)}})}size(D,F){return this.min(D,F).max(D,F)}nonempty(D){return this.min(1,D)}};E2.create=(D,F)=>{return new E2({valueType:D,minSize:null,maxSize:null,typeName:N.ZodSet,...S(F)})};e2=class e2 extends k{constructor(){super(...arguments);this.validate=this.implement}_parse(D){let{ctx:F}=this._processInputParams(D);if(F.parsedType!==M.function)return O(F,{code:K.invalid_type,expected:M.function,received:F.parsedType}),T;function $(Q,Y){return u0({data:Q,path:F.path,errorMaps:[F.common.contextualErrorMap,F.schemaErrorMap,s2(),hD].filter((q)=>!!q),issueData:{code:K.invalid_arguments,argumentsError:Y}})}function J(Q,Y){return u0({data:Q,path:F.path,errorMaps:[F.common.contextualErrorMap,F.schemaErrorMap,s2(),hD].filter((q)=>!!q),issueData:{code:K.invalid_return_type,returnTypeError:Y}})}let B={errorMap:F.common.contextualErrorMap},X=F.data;if(this._def.returns instanceof A2){let Q=this;return e(async function(...Y){let q=new XD([]),G=await Q._def.args.parseAsync(Y,B).catch((W)=>{throw q.addIssue($(Y,W)),q}),H=await Reflect.apply(X,this,G);return await Q._def.returns._def.type.parseAsync(H,B).catch((W)=>{throw q.addIssue(J(H,W)),q})})}else{let Q=this;return e(function(...Y){let q=Q._def.args.safeParse(Y,B);if(!q.success)throw new XD([$(Y,q.error)]);let G=Reflect.apply(X,this,q.data),H=Q._def.returns.safeParse(G,B);if(!H.success)throw new XD([J(G,H.error)]);return H.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...D){return new e2({...this._def,args:PD.create(D).rest(D2.create())})}returns(D){return new e2({...this._def,returns:D})}implement(D){return this.parse(D)}strictImplement(D){return this.parse(D)}static create(D,F,$){return new e2({args:D?D:PD.create([]).rest(D2.create()),returns:F||D2.create(),typeName:N.ZodFunction,...S($)})}};X0=class X0 extends k{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})}};X0.create=(D,F)=>{return new X0({getter:D,typeName:N.ZodLazy,...S(F)})};Q0=class Q0 extends k{_parse(D){if(D.data!==this._def.value){let F=this._getOrReturnCtx(D);return O(F,{received:F.data,code:K.invalid_literal,expected:this._def.value}),T}return{status:"valid",value:D.data}}get value(){return this._def.value}};Q0.create=(D,F)=>{return new Q0({value:D,typeName:N.ZodLiteral,...S(F)})};J2=class J2 extends k{_parse(D){if(typeof D.data!=="string"){let F=this._getOrReturnCtx(D),$=this._def.values;return O(F,{expected:w.joinValues($),received:F.parsedType,code:K.invalid_type}),T}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(D.data)){let F=this._getOrReturnCtx(D),$=this._def.values;return O(F,{received:F.data,code:K.invalid_enum_value,options:$}),T}return e(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 J2.create(D,{...this._def,...F})}exclude(D,F=this._def){return J2.create(this.options.filter(($)=>!D.includes($)),{...this._def,...F})}};J2.create=X7;Y0=class Y0 extends k{_parse(D){let F=w.getValidEnumValues(this._def.values),$=this._getOrReturnCtx(D);if($.parsedType!==M.string&&$.parsedType!==M.number){let J=w.objectValues(F);return O($,{expected:w.joinValues(J),received:$.parsedType,code:K.invalid_type}),T}if(!this._cache)this._cache=new Set(w.getValidEnumValues(this._def.values));if(!this._cache.has(D.data)){let J=w.objectValues(F);return O($,{received:$.data,code:K.invalid_enum_value,options:J}),T}return e(D.data)}get enum(){return this._def.values}};Y0.create=(D,F)=>{return new Y0({values:D,typeName:N.ZodNativeEnum,...S(F)})};A2=class A2 extends k{unwrap(){return this._def.type}_parse(D){let{ctx:F}=this._processInputParams(D);if(F.parsedType!==M.promise&&F.common.async===!1)return O(F,{code:K.invalid_type,expected:M.promise,received:F.parsedType}),T;let $=F.parsedType===M.promise?F.data:Promise.resolve(F.data);return e($.then((J)=>{return this._def.type.parseAsync(J,{path:F.path,errorMap:F.common.contextualErrorMap})}))}};A2.create=(D,F)=>{return new A2({type:D,typeName:N.ZodPromise,...S(F)})};LD=class LD extends k{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===N.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(D){let{status:F,ctx:$}=this._processInputParams(D),J=this._def.effect||null,B={addIssue:(X)=>{if(O($,X),X.fatal)F.abort();else F.dirty()},get path(){return $.path}};if(B.addIssue=B.addIssue.bind(B),J.type==="preprocess"){let X=J.transform($.data,B);if($.common.async)return Promise.resolve(X).then(async(Q)=>{if(F.value==="aborted")return T;let Y=await this._def.schema._parseAsync({data:Q,path:$.path,parent:$});if(Y.status==="aborted")return T;if(Y.status==="dirty")return z2(Y.value);if(F.value==="dirty")return z2(Y.value);return Y});else{if(F.value==="aborted")return T;let Q=this._def.schema._parseSync({data:X,path:$.path,parent:$});if(Q.status==="aborted")return T;if(Q.status==="dirty")return z2(Q.value);if(F.value==="dirty")return z2(Q.value);return Q}}if(J.type==="refinement"){let X=(Q)=>{let Y=J.refinement(Q,B);if($.common.async)return Promise.resolve(Y);if(Y instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return Q};if($.common.async===!1){let Q=this._def.schema._parseSync({data:$.data,path:$.path,parent:$});if(Q.status==="aborted")return T;if(Q.status==="dirty")F.dirty();return X(Q.value),{status:F.value,value:Q.value}}else return this._def.schema._parseAsync({data:$.data,path:$.path,parent:$}).then((Q)=>{if(Q.status==="aborted")return T;if(Q.status==="dirty")F.dirty();return X(Q.value).then(()=>{return{status:F.value,value:Q.value}})})}if(J.type==="transform")if($.common.async===!1){let X=this._def.schema._parseSync({data:$.data,path:$.path,parent:$});if(!eD(X))return T;let Q=J.transform(X.value,B);if(Q instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:F.value,value:Q}}else return this._def.schema._parseAsync({data:$.data,path:$.path,parent:$}).then((X)=>{if(!eD(X))return T;return Promise.resolve(J.transform(X.value,B)).then((Q)=>({status:F.value,value:Q}))});w.assertNever(J)}};LD.create=(D,F,$)=>{return new LD({schema:D,typeName:N.ZodEffects,effect:F,...S($)})};LD.createWithPreprocess=(D,F,$)=>{return new LD({schema:F,effect:{type:"preprocess",transform:D},typeName:N.ZodEffects,...S($)})};jD=class jD extends k{_parse(D){if(this._getType(D)===M.undefined)return e(void 0);return this._def.innerType._parse(D)}unwrap(){return this._def.innerType}};jD.create=(D,F)=>{return new jD({innerType:D,typeName:N.ZodOptional,...S(F)})};mD=class mD extends k{_parse(D){if(this._getType(D)===M.null)return e(null);return this._def.innerType._parse(D)}unwrap(){return this._def.innerType}};mD.create=(D,F)=>{return new mD({innerType:D,typeName:N.ZodNullable,...S(F)})};q0=class q0 extends k{_parse(D){let{ctx:F}=this._processInputParams(D),$=F.data;if(F.parsedType===M.undefined)$=this._def.defaultValue();return this._def.innerType._parse({data:$,path:F.path,parent:F})}removeDefault(){return this._def.innerType}};q0.create=(D,F)=>{return new q0({innerType:D,typeName:N.ZodDefault,defaultValue:typeof F.default==="function"?F.default:()=>F.default,...S(F)})};G0=class G0 extends k{_parse(D){let{ctx:F}=this._processInputParams(D),$={...F,common:{...F.common,issues:[]}},J=this._def.innerType._parse({data:$.data,path:$.path,parent:{...$}});if(a2(J))return J.then((B)=>{return{status:"valid",value:B.status==="valid"?B.value:this._def.catchValue({get error(){return new XD($.common.issues)},input:$.data})}});else return{status:"valid",value:J.status==="valid"?J.value:this._def.catchValue({get error(){return new XD($.common.issues)},input:$.data})}}removeCatch(){return this._def.innerType}};G0.create=(D,F)=>{return new G0({innerType:D,typeName:N.ZodCatch,catchValue:typeof F.catch==="function"?F.catch:()=>F.catch,...S(F)})};m0=class m0 extends k{_parse(D){if(this._getType(D)!==M.nan){let $=this._getOrReturnCtx(D);return O($,{code:K.invalid_type,expected:M.nan,received:$.parsedType}),T}return{status:"valid",value:D.data}}};m0.create=(D)=>{return new m0({typeName:N.ZodNaN,...S(D)})};rB=Symbol("zod_brand");a3=class a3 extends k{_parse(D){let{ctx:F}=this._processInputParams(D),$=F.data;return this._def.type._parse({data:$,path:F.path,parent:F})}unwrap(){return this._def.type}};l0=class l0 extends k{_parse(D){let{status:F,ctx:$}=this._processInputParams(D);if($.common.async)return(async()=>{let B=await this._def.in._parseAsync({data:$.data,path:$.path,parent:$});if(B.status==="aborted")return T;if(B.status==="dirty")return F.dirty(),z2(B.value);else return this._def.out._parseAsync({data:B.value,path:$.path,parent:$})})();else{let J=this._def.in._parseSync({data:$.data,path:$.path,parent:$});if(J.status==="aborted")return T;if(J.status==="dirty")return F.dirty(),{status:"dirty",value:J.value};else return this._def.out._parseSync({data:J.value,path:$.path,parent:$})}}static create(D,F){return new l0({in:D,out:F,typeName:N.ZodPipeline})}};H0=class H0 extends k{_parse(D){let F=this._def.innerType._parse(D),$=(J)=>{if(eD(J))J.value=Object.freeze(J.value);return J};return a2(F)?F.then((J)=>$(J)):$(F)}unwrap(){return this._def.innerType}};H0.create=(D,F)=>{return new H0({innerType:D,typeName:N.ZodReadonly,...S(F)})};nB={object:g.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"})(N||(N={}));Y7=OD.create,q7=F2.create,sB=m0.create,aB=$2.create,G7=D0.create,tB=K2.create,eB=x0.create,DX=F0.create,FX=$0.create,$X=M2.create,JX=D2.create,BX=bD.create,XX=y0.create,QX=CD.create,YX=g.create,qX=g.strictCreate,GX=J0.create,HX=s3.create,VX=B0.create,WX=PD.create,UX=h0.create,zX=g0.create,KX=E2.create,MX=e2.create,EX=X0.create,AX=Q0.create,RX=J2.create,OX=Y0.create,CX=A2.create,jX=LD.create,_X=jD.create,LX=mD.create,ZX=LD.createWithPreprocess,TX=l0.create,bX={string:(D)=>OD.create({...D,coerce:!0}),number:(D)=>F2.create({...D,coerce:!0}),boolean:(D)=>D0.create({...D,coerce:!0}),bigint:(D)=>$2.create({...D,coerce:!0}),date:(D)=>K2.create({...D,coerce:!0})},PX=T});var A={};BD(A,{void:()=>XX,util:()=>w,unknown:()=>JX,union:()=>GX,undefined:()=>DX,tuple:()=>WX,transformer:()=>jX,symbol:()=>eB,string:()=>Y7,strictObject:()=>qX,setErrorMap:()=>LB,set:()=>KX,record:()=>UX,quotelessJson:()=>jB,promise:()=>CX,preprocess:()=>ZX,pipeline:()=>TX,ostring:()=>NX,optional:()=>_X,onumber:()=>IX,oboolean:()=>SX,objectUtil:()=>A6,object:()=>YX,number:()=>q7,nullable:()=>LX,null:()=>FX,never:()=>BX,nativeEnum:()=>OX,nan:()=>sB,map:()=>zX,makeIssue:()=>u0,literal:()=>AX,lazy:()=>EX,late:()=>nB,isValid:()=>eD,isDirty:()=>o3,isAsync:()=>a2,isAborted:()=>n3,intersection:()=>VX,instanceof:()=>oB,getParsedType:()=>SD,getErrorMap:()=>s2,function:()=>MX,enum:()=>RX,effect:()=>jX,discriminatedUnion:()=>HX,defaultErrorMap:()=>hD,datetimeRegex:()=>B7,date:()=>tB,custom:()=>Q7,coerce:()=>bX,boolean:()=>G7,bigint:()=>aB,array:()=>QX,any:()=>$X,addIssueToContext:()=>O,ZodVoid:()=>y0,ZodUnknown:()=>D2,ZodUnion:()=>J0,ZodUndefined:()=>F0,ZodType:()=>k,ZodTuple:()=>PD,ZodTransformer:()=>LD,ZodSymbol:()=>x0,ZodString:()=>OD,ZodSet:()=>E2,ZodSchema:()=>k,ZodRecord:()=>h0,ZodReadonly:()=>H0,ZodPromise:()=>A2,ZodPipeline:()=>l0,ZodParsedType:()=>M,ZodOptional:()=>jD,ZodObject:()=>g,ZodNumber:()=>F2,ZodNullable:()=>mD,ZodNull:()=>$0,ZodNever:()=>bD,ZodNativeEnum:()=>Y0,ZodNaN:()=>m0,ZodMap:()=>g0,ZodLiteral:()=>Q0,ZodLazy:()=>X0,ZodIssueCode:()=>K,ZodIntersection:()=>B0,ZodFunction:()=>e2,ZodFirstPartyTypeKind:()=>N,ZodError:()=>XD,ZodEnum:()=>J2,ZodEffects:()=>LD,ZodDiscriminatedUnion:()=>s3,ZodDefault:()=>q0,ZodDate:()=>K2,ZodCatch:()=>G0,ZodBranded:()=>a3,ZodBoolean:()=>D0,ZodBigInt:()=>$2,ZodArray:()=>CD,ZodAny:()=>M2,Schema:()=>k,ParseStatus:()=>n,OK:()=>e,NEVER:()=>PX,INVALID:()=>T,EMPTY_PATH:()=>ZB,DIRTY:()=>z2,BRAND:()=>rB});var _6=I(()=>{r3();O6();t5();f0();H7();i3()});var t3=I(()=>{_6();_6()});var vX,kX,wX,fX,uX,xX,yX,hX,lD;var V7=I(()=>{t3();vX=A.object({name:A.string().default("genie"),defaultWindow:A.string().default("shell"),autoCreate:A.boolean().default(!0)}),kX=A.object({execTimeout:A.number().default(120000),readLines:A.number().default(100),worktreeBase:A.string().optional()}),wX=A.object({tmuxDebug:A.boolean().default(!1),verbose:A.boolean().default(!1)}),fX=A.object({preference:A.enum(["auto","zsh","bash","fish"]).default("auto")}),uX=A.object({tmuxInstalled:A.boolean().default(!1),shellInstalled:A.boolean().default(!1)}),xX=A.object({configured:A.boolean().default(!1)}),yX=A.object({launcher:A.preprocess((D)=>D==="claudio"?"claude":D,A.literal("claude")),claudeArgs:A.array(A.string())}).passthrough(),hX=A.object({left:A.string(),right:A.string(),skill:A.string().default("council")}),lD=A.object({version:A.number().default(2),session:vX.default({}),terminal:kX.default({}),logging:wX.default({}),shell:fX.default({}),shortcuts:uX.default({}),codex:xX.optional(),installMethod:A.enum(["source","npm","bun"]).optional(),updateChannel:A.enum(["latest","next"]).default("latest"),setupComplete:A.boolean().default(!1),lastSetupAt:A.string().optional(),sourcePath:A.string().optional(),workerProfiles:A.record(A.string(),yX).optional(),defaultWorkerProfile:A.string().optional(),councilPresets:A.record(A.string(),hX).optional(),defaultCouncilPreset:A.string().optional(),promptMode:A.enum(["append","system"]).default("append"),autoMergeDev:A.boolean().default(!1)})});import{existsSync as D8,mkdirSync as gX,readFileSync as W7,writeFileSync as mX}from"fs";import{homedir as U7}from"os";import{join as z7}from"path";function K7(){return e3}function p0(){return R2}function O2(){return D8(R2)}function lX(){if(!D8(e3))gX(e3,{recursive:!0})}async function VD(){if(!D8(R2))return lD.parse({});try{let D=W7(R2,"utf-8"),F=JSON.parse(D);return lD.parse(F)}catch(D){let F=D instanceof Error?D.message:String(D);return console.warn(`Warning: Invalid genie config, using defaults: ${F}`),lD.parse({})}}async function vD(D){lX();try{let F=lD.parse(D),$=JSON.stringify(F,null,2);mX(R2,$,"utf-8")}catch(F){let $=F instanceof Error?F.message:String(F);throw Error(`Failed to save genie config: ${$}`)}}function pX(){return lD.parse({})}function V0(){if(!D8(R2))return lD.parse({});try{let D=W7(R2,"utf-8"),F=JSON.parse(D);return lD.parse(F)}catch{return lD.parse({})}}function WD(D){let F=U7();if(D.startsWith(`${F}/`))return`~${D.slice(F.length)}`;if(D===F)return"~";return D}function M7(){return V0().terminal}function E7(){if(!O2())return!1;return V0().setupComplete??!1}async function A7(){let D=await VD();D.setupComplete=!0,D.lastSetupAt=new Date().toISOString(),await vD(D)}async function R7(){let D=pX();await vD(D)}async function O7(D){let F=await VD();F.shortcuts={...F.shortcuts,...D},await vD(F)}var e3,R2;var pD=I(()=>{V7();e3=z7(U7(),".genie"),R2=z7(e3,"config.json")});var B8=l((GM,T7)=>{var FQ=v("tty"),$Q=FQ?.WriteStream?.prototype?.hasColors?.()??!1,P=(D,F)=>{if(!$Q)return(B)=>B;let $=`\x1B[${D}m`,J=`\x1B[${F}m`;return(B)=>{let X=B+"",Q=X.indexOf(J);if(Q===-1)return $+X+J;let Y=$,q=0,H=(F===22?J:"")+$;while(Q!==-1)Y+=X.slice(q,Q)+H,q=Q+J.length,Q=X.indexOf(J,q);return Y+=X.slice(q)+J,Y}},b={};b.reset=P(0,0);b.bold=P(1,22);b.dim=P(2,22);b.italic=P(3,23);b.underline=P(4,24);b.overline=P(53,55);b.inverse=P(7,27);b.hidden=P(8,28);b.strikethrough=P(9,29);b.black=P(30,39);b.red=P(31,39);b.green=P(32,39);b.yellow=P(33,39);b.blue=P(34,39);b.magenta=P(35,39);b.cyan=P(36,39);b.white=P(37,39);b.gray=P(90,39);b.bgBlack=P(40,49);b.bgRed=P(41,49);b.bgGreen=P(42,49);b.bgYellow=P(43,49);b.bgBlue=P(44,49);b.bgMagenta=P(45,49);b.bgCyan=P(46,49);b.bgWhite=P(47,49);b.bgGray=P(100,49);b.redBright=P(91,39);b.greenBright=P(92,39);b.yellowBright=P(93,39);b.blueBright=P(94,39);b.magentaBright=P(95,39);b.cyanBright=P(96,39);b.whiteBright=P(97,39);b.bgRedBright=P(101,49);b.bgGreenBright=P(102,49);b.bgYellowBright=P(103,49);b.bgBlueBright=P(104,49);b.bgMagentaBright=P(105,49);b.bgCyanBright=P(106,49);b.bgWhiteBright=P(107,49);T7.exports=b});var k7=l((SM,v7)=>{v7.exports=HQ;function GQ(D){let F={defaultWidth:0,output:process.stdout,tty:v("tty")};if(!D)return F;return Object.keys(F).forEach(function($){if(!D[$])D[$]=F[$]}),D}function HQ(D){let F=GQ(D);if(F.output.getWindowSize)return F.output.getWindowSize()[0]||F.defaultWidth;if(F.tty.getWindowSize)return F.tty.getWindowSize()[1]||F.defaultWidth;if(F.output.columns)return F.output.columns;if(process.env.CLI_WIDTH){let $=parseInt(process.env.CLI_WIDTH,10);if(!isNaN($)&&$!==0)return $}return F.defaultWidth}});var f7=l((bM,w7)=>{w7.exports=({onlyFirst:D=!1}={})=>{let F=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(F,D?void 0:"g")}});var P6=l((PM,u7)=>{var VQ=f7();u7.exports=(D)=>typeof D==="string"?D.replace(VQ(),""):D});var y7=l((vM,v6)=>{var x7=(D)=>{if(Number.isNaN(D))return!1;if(D>=4352&&(D<=4447||D===9001||D===9002||11904<=D&&D<=12871&&D!==12351||12880<=D&&D<=19903||19968<=D&&D<=42182||43360<=D&&D<=43388||44032<=D&&D<=55203||63744<=D&&D<=64255||65040<=D&&D<=65049||65072<=D&&D<=65131||65281<=D&&D<=65376||65504<=D&&D<=65510||110592<=D&&D<=110593||127488<=D&&D<=127569||131072<=D&&D<=262141))return!0;return!1};v6.exports=x7;v6.exports.default=x7});var g7=l((kM,h7)=>{h7.exports=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g}});var l7=l((wM,k6)=>{var WQ=P6(),UQ=y7(),zQ=g7(),m7=(D)=>{if(typeof D!=="string"||D.length===0)return 0;if(D=WQ(D),D.length===0)return 0;D=D.replace(zQ()," ");let F=0;for(let $=0;$<D.length;$++){let J=D.codePointAt($);if(J<=31||J>=127&&J<=159)continue;if(J>=768&&J<=879)continue;if(J>65535)$++;F+=UQ(J)?2:1}return F};k6.exports=m7;k6.exports.default=m7});var d7=l((fM,p7)=>{p7.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}});var w6=l((uM,i7)=>{var o0=d7(),c7={};for(let D of Object.keys(o0))c7[o0[D]]=D;var _={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};i7.exports=_;for(let D of Object.keys(_)){if(!("channels"in _[D]))throw Error("missing channels property: "+D);if(!("labels"in _[D]))throw Error("missing channel labels property: "+D);if(_[D].labels.length!==_[D].channels)throw Error("channel and label counts mismatch: "+D);let{channels:F,labels:$}=_[D];delete _[D].channels,delete _[D].labels,Object.defineProperty(_[D],"channels",{value:F}),Object.defineProperty(_[D],"labels",{value:$})}_.rgb.hsl=function(D){let F=D[0]/255,$=D[1]/255,J=D[2]/255,B=Math.min(F,$,J),X=Math.max(F,$,J),Q=X-B,Y,q;if(X===B)Y=0;else if(F===X)Y=($-J)/Q;else if($===X)Y=2+(J-F)/Q;else if(J===X)Y=4+(F-$)/Q;if(Y=Math.min(Y*60,360),Y<0)Y+=360;let G=(B+X)/2;if(X===B)q=0;else if(G<=0.5)q=Q/(X+B);else q=Q/(2-X-B);return[Y,q*100,G*100]};_.rgb.hsv=function(D){let F,$,J,B,X,Q=D[0]/255,Y=D[1]/255,q=D[2]/255,G=Math.max(Q,Y,q),H=G-Math.min(Q,Y,q),V=function(W){return(G-W)/6/H+0.5};if(H===0)B=0,X=0;else{if(X=H/G,F=V(Q),$=V(Y),J=V(q),Q===G)B=J-$;else if(Y===G)B=0.3333333333333333+F-J;else if(q===G)B=0.6666666666666666+$-F;if(B<0)B+=1;else if(B>1)B-=1}return[B*360,X*100,G*100]};_.rgb.hwb=function(D){let F=D[0],$=D[1],J=D[2],B=_.rgb.hsl(D)[0],X=0.00392156862745098*Math.min(F,Math.min($,J));return J=1-0.00392156862745098*Math.max(F,Math.max($,J)),[B,X*100,J*100]};_.rgb.cmyk=function(D){let F=D[0]/255,$=D[1]/255,J=D[2]/255,B=Math.min(1-F,1-$,1-J),X=(1-F-B)/(1-B)||0,Q=(1-$-B)/(1-B)||0,Y=(1-J-B)/(1-B)||0;return[X*100,Q*100,Y*100,B*100]};function KQ(D,F){return(D[0]-F[0])**2+(D[1]-F[1])**2+(D[2]-F[2])**2}_.rgb.keyword=function(D){let F=c7[D];if(F)return F;let $=1/0,J;for(let B of Object.keys(o0)){let X=o0[B],Q=KQ(D,X);if(Q<$)$=Q,J=B}return J};_.keyword.rgb=function(D){return o0[D]};_.rgb.xyz=function(D){let F=D[0]/255,$=D[1]/255,J=D[2]/255;F=F>0.04045?((F+0.055)/1.055)**2.4:F/12.92,$=$>0.04045?(($+0.055)/1.055)**2.4:$/12.92,J=J>0.04045?((J+0.055)/1.055)**2.4:J/12.92;let B=F*0.4124+$*0.3576+J*0.1805,X=F*0.2126+$*0.7152+J*0.0722,Q=F*0.0193+$*0.1192+J*0.9505;return[B*100,X*100,Q*100]};_.rgb.lab=function(D){let F=_.rgb.xyz(D),$=F[0],J=F[1],B=F[2];$/=95.047,J/=100,B/=108.883,$=$>0.008856?$**0.3333333333333333:7.787*$+0.13793103448275862,J=J>0.008856?J**0.3333333333333333:7.787*J+0.13793103448275862,B=B>0.008856?B**0.3333333333333333:7.787*B+0.13793103448275862;let X=116*J-16,Q=500*($-J),Y=200*(J-B);return[X,Q,Y]};_.hsl.rgb=function(D){let F=D[0]/360,$=D[1]/100,J=D[2]/100,B,X,Q;if($===0)return Q=J*255,[Q,Q,Q];if(J<0.5)B=J*(1+$);else B=J+$-J*$;let Y=2*J-B,q=[0,0,0];for(let G=0;G<3;G++){if(X=F+0.3333333333333333*-(G-1),X<0)X++;if(X>1)X--;if(6*X<1)Q=Y+(B-Y)*6*X;else if(2*X<1)Q=B;else if(3*X<2)Q=Y+(B-Y)*(0.6666666666666666-X)*6;else Q=Y;q[G]=Q*255}return q};_.hsl.hsv=function(D){let F=D[0],$=D[1]/100,J=D[2]/100,B=$,X=Math.max(J,0.01);J*=2,$*=J<=1?J:2-J,B*=X<=1?X:2-X;let Q=(J+$)/2,Y=J===0?2*B/(X+B):2*$/(J+$);return[F,Y*100,Q*100]};_.hsv.rgb=function(D){let F=D[0]/60,$=D[1]/100,J=D[2]/100,B=Math.floor(F)%6,X=F-Math.floor(F),Q=255*J*(1-$),Y=255*J*(1-$*X),q=255*J*(1-$*(1-X));switch(J*=255,B){case 0:return[J,q,Q];case 1:return[Y,J,Q];case 2:return[Q,J,q];case 3:return[Q,Y,J];case 4:return[q,Q,J];case 5:return[J,Q,Y]}};_.hsv.hsl=function(D){let F=D[0],$=D[1]/100,J=D[2]/100,B=Math.max(J,0.01),X,Q;Q=(2-$)*J;let Y=(2-$)*B;return X=$*B,X/=Y<=1?Y:2-Y,X=X||0,Q/=2,[F,X*100,Q*100]};_.hwb.rgb=function(D){let F=D[0]/360,$=D[1]/100,J=D[2]/100,B=$+J,X;if(B>1)$/=B,J/=B;let Q=Math.floor(6*F),Y=1-J;if(X=6*F-Q,(Q&1)!==0)X=1-X;let q=$+X*(Y-$),G,H,V;switch(Q){default:case 6:case 0:G=Y,H=q,V=$;break;case 1:G=q,H=Y,V=$;break;case 2:G=$,H=Y,V=q;break;case 3:G=$,H=q,V=Y;break;case 4:G=q,H=$,V=Y;break;case 5:G=Y,H=$,V=q;break}return[G*255,H*255,V*255]};_.cmyk.rgb=function(D){let F=D[0]/100,$=D[1]/100,J=D[2]/100,B=D[3]/100,X=1-Math.min(1,F*(1-B)+B),Q=1-Math.min(1,$*(1-B)+B),Y=1-Math.min(1,J*(1-B)+B);return[X*255,Q*255,Y*255]};_.xyz.rgb=function(D){let F=D[0]/100,$=D[1]/100,J=D[2]/100,B,X,Q;return B=F*3.2406+$*-1.5372+J*-0.4986,X=F*-0.9689+$*1.8758+J*0.0415,Q=F*0.0557+$*-0.204+J*1.057,B=B>0.0031308?1.055*B**0.4166666666666667-0.055:B*12.92,X=X>0.0031308?1.055*X**0.4166666666666667-0.055:X*12.92,Q=Q>0.0031308?1.055*Q**0.4166666666666667-0.055:Q*12.92,B=Math.min(Math.max(0,B),1),X=Math.min(Math.max(0,X),1),Q=Math.min(Math.max(0,Q),1),[B*255,X*255,Q*255]};_.xyz.lab=function(D){let F=D[0],$=D[1],J=D[2];F/=95.047,$/=100,J/=108.883,F=F>0.008856?F**0.3333333333333333:7.787*F+0.13793103448275862,$=$>0.008856?$**0.3333333333333333:7.787*$+0.13793103448275862,J=J>0.008856?J**0.3333333333333333:7.787*J+0.13793103448275862;let B=116*$-16,X=500*(F-$),Q=200*($-J);return[B,X,Q]};_.lab.xyz=function(D){let F=D[0],$=D[1],J=D[2],B,X,Q;X=(F+16)/116,B=$/500+X,Q=X-J/200;let Y=X**3,q=B**3,G=Q**3;return X=Y>0.008856?Y:(X-0.13793103448275862)/7.787,B=q>0.008856?q:(B-0.13793103448275862)/7.787,Q=G>0.008856?G:(Q-0.13793103448275862)/7.787,B*=95.047,X*=100,Q*=108.883,[B,X,Q]};_.lab.lch=function(D){let F=D[0],$=D[1],J=D[2],B;if(B=Math.atan2(J,$)*360/2/Math.PI,B<0)B+=360;let Q=Math.sqrt($*$+J*J);return[F,Q,B]};_.lch.lab=function(D){let F=D[0],$=D[1],B=D[2]/360*2*Math.PI,X=$*Math.cos(B),Q=$*Math.sin(B);return[F,X,Q]};_.rgb.ansi16=function(D,F=null){let[$,J,B]=D,X=F===null?_.rgb.hsv(D)[2]:F;if(X=Math.round(X/50),X===0)return 30;let Q=30+(Math.round(B/255)<<2|Math.round(J/255)<<1|Math.round($/255));if(X===2)Q+=60;return Q};_.hsv.ansi16=function(D){return _.rgb.ansi16(_.hsv.rgb(D),D[2])};_.rgb.ansi256=function(D){let F=D[0],$=D[1],J=D[2];if(F===$&&$===J){if(F<8)return 16;if(F>248)return 231;return Math.round((F-8)/247*24)+232}return 16+36*Math.round(F/255*5)+6*Math.round($/255*5)+Math.round(J/255*5)};_.ansi16.rgb=function(D){let F=D%10;if(F===0||F===7){if(D>50)F+=3.5;return F=F/10.5*255,[F,F,F]}let $=(~~(D>50)+1)*0.5,J=(F&1)*$*255,B=(F>>1&1)*$*255,X=(F>>2&1)*$*255;return[J,B,X]};_.ansi256.rgb=function(D){if(D>=232){let X=(D-232)*10+8;return[X,X,X]}D-=16;let F,$=Math.floor(D/36)/5*255,J=Math.floor((F=D%36)/6)/5*255,B=F%6/5*255;return[$,J,B]};_.rgb.hex=function(D){let $=(((Math.round(D[0])&255)<<16)+((Math.round(D[1])&255)<<8)+(Math.round(D[2])&255)).toString(16).toUpperCase();return"000000".substring($.length)+$};_.hex.rgb=function(D){let F=D.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!F)return[0,0,0];let $=F[0];if(F[0].length===3)$=$.split("").map((Y)=>{return Y+Y}).join("");let J=parseInt($,16),B=J>>16&255,X=J>>8&255,Q=J&255;return[B,X,Q]};_.rgb.hcg=function(D){let F=D[0]/255,$=D[1]/255,J=D[2]/255,B=Math.max(Math.max(F,$),J),X=Math.min(Math.min(F,$),J),Q=B-X,Y,q;if(Q<1)Y=X/(1-Q);else Y=0;if(Q<=0)q=0;else if(B===F)q=($-J)/Q%6;else if(B===$)q=2+(J-F)/Q;else q=4+(F-$)/Q;return q/=6,q%=1,[q*360,Q*100,Y*100]};_.hsl.hcg=function(D){let F=D[1]/100,$=D[2]/100,J=$<0.5?2*F*$:2*F*(1-$),B=0;if(J<1)B=($-0.5*J)/(1-J);return[D[0],J*100,B*100]};_.hsv.hcg=function(D){let F=D[1]/100,$=D[2]/100,J=F*$,B=0;if(J<1)B=($-J)/(1-J);return[D[0],J*100,B*100]};_.hcg.rgb=function(D){let F=D[0]/360,$=D[1]/100,J=D[2]/100;if($===0)return[J*255,J*255,J*255];let B=[0,0,0],X=F%1*6,Q=X%1,Y=1-Q,q=0;switch(Math.floor(X)){case 0:B[0]=1,B[1]=Q,B[2]=0;break;case 1:B[0]=Y,B[1]=1,B[2]=0;break;case 2:B[0]=0,B[1]=1,B[2]=Q;break;case 3:B[0]=0,B[1]=Y,B[2]=1;break;case 4:B[0]=Q,B[1]=0,B[2]=1;break;default:B[0]=1,B[1]=0,B[2]=Y}return q=(1-$)*J,[($*B[0]+q)*255,($*B[1]+q)*255,($*B[2]+q)*255]};_.hcg.hsv=function(D){let F=D[1]/100,$=D[2]/100,J=F+$*(1-F),B=0;if(J>0)B=F/J;return[D[0],B*100,J*100]};_.hcg.hsl=function(D){let F=D[1]/100,J=D[2]/100*(1-F)+0.5*F,B=0;if(J>0&&J<0.5)B=F/(2*J);else if(J>=0.5&&J<1)B=F/(2*(1-J));return[D[0],B*100,J*100]};_.hcg.hwb=function(D){let F=D[1]/100,$=D[2]/100,J=F+$*(1-F);return[D[0],(J-F)*100,(1-J)*100]};_.hwb.hcg=function(D){let F=D[1]/100,J=1-D[2]/100,B=J-F,X=0;if(B<1)X=(J-B)/(1-B);return[D[0],B*100,X*100]};_.apple.rgb=function(D){return[D[0]/65535*255,D[1]/65535*255,D[2]/65535*255]};_.rgb.apple=function(D){return[D[0]/255*65535,D[1]/255*65535,D[2]/255*65535]};_.gray.rgb=function(D){return[D[0]/100*255,D[0]/100*255,D[0]/100*255]};_.gray.hsl=function(D){return[0,0,D[0]]};_.gray.hsv=_.gray.hsl;_.gray.hwb=function(D){return[0,100,D[0]]};_.gray.cmyk=function(D){return[0,0,0,D[0]]};_.gray.lab=function(D){return[D[0],0,0]};_.gray.hex=function(D){let F=Math.round(D[0]/100*255)&255,J=((F<<16)+(F<<8)+F).toString(16).toUpperCase();return"000000".substring(J.length)+J};_.rgb.gray=function(D){return[(D[0]+D[1]+D[2])/3/255*100]}});var n7=l((xM,r7)=>{var X8=w6();function MQ(){let D={},F=Object.keys(X8);for(let $=F.length,J=0;J<$;J++)D[F[J]]={distance:-1,parent:null};return D}function EQ(D){let F=MQ(),$=[D];F[D].distance=0;while($.length){let J=$.pop(),B=Object.keys(X8[J]);for(let X=B.length,Q=0;Q<X;Q++){let Y=B[Q],q=F[Y];if(q.distance===-1)q.distance=F[J].distance+1,q.parent=J,$.unshift(Y)}}return F}function AQ(D,F){return function($){return F(D($))}}function RQ(D,F){let $=[F[D].parent,D],J=X8[F[D].parent][D],B=F[D].parent;while(F[B].parent)$.unshift(F[B].parent),J=AQ(X8[F[B].parent][B],J),B=F[B].parent;return J.conversion=$,J}r7.exports=function(D){let F=EQ(D),$={},J=Object.keys(F);for(let B=J.length,X=0;X<B;X++){let Q=J[X];if(F[Q].parent===null)continue;$[Q]=RQ(Q,F)}return $}});var s7=l((yM,o7)=>{var f6=w6(),OQ=n7(),z0={},CQ=Object.keys(f6);function jQ(D){let F=function(...$){let J=$[0];if(J===void 0||J===null)return J;if(J.length>1)$=J;return D($)};if("conversion"in D)F.conversion=D.conversion;return F}function _Q(D){let F=function(...$){let J=$[0];if(J===void 0||J===null)return J;if(J.length>1)$=J;let B=D($);if(typeof B==="object")for(let X=B.length,Q=0;Q<X;Q++)B[Q]=Math.round(B[Q]);return B};if("conversion"in D)F.conversion=D.conversion;return F}CQ.forEach((D)=>{z0[D]={},Object.defineProperty(z0[D],"channels",{value:f6[D].channels}),Object.defineProperty(z0[D],"labels",{value:f6[D].labels});let F=OQ(D);Object.keys(F).forEach((J)=>{let B=F[J];z0[D][J]=_Q(B),z0[D][J].raw=jQ(B)})});o7.exports=z0});var $9=l((hM,F9)=>{var a7=(D,F)=>(...$)=>{return`\x1B[${D(...$)+F}m`},t7=(D,F)=>(...$)=>{let J=D(...$);return`\x1B[${38+F};5;${J}m`},e7=(D,F)=>(...$)=>{let J=D(...$);return`\x1B[${38+F};2;${J[0]};${J[1]};${J[2]}m`},Q8=(D)=>D,D9=(D,F,$)=>[D,F,$],K0=(D,F,$)=>{Object.defineProperty(D,F,{get:()=>{let J=$();return Object.defineProperty(D,F,{value:J,enumerable:!0,configurable:!0}),J},enumerable:!0,configurable:!0})},u6,M0=(D,F,$,J)=>{if(u6===void 0)u6=s7();let B=J?10:0,X={};for(let[Q,Y]of Object.entries(u6)){let q=Q==="ansi16"?"ansi":Q;if(Q===F)X[q]=D($,B);else if(typeof Y==="object")X[q]=D(Y[F],B)}return X};function LQ(){let D=new Map,F={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};F.color.gray=F.color.blackBright,F.bgColor.bgGray=F.bgColor.bgBlackBright,F.color.grey=F.color.blackBright,F.bgColor.bgGrey=F.bgColor.bgBlackBright;for(let[$,J]of Object.entries(F)){for(let[B,X]of Object.entries(J))F[B]={open:`\x1B[${X[0]}m`,close:`\x1B[${X[1]}m`},J[B]=F[B],D.set(X[0],X[1]);Object.defineProperty(F,$,{value:J,enumerable:!1})}return Object.defineProperty(F,"codes",{value:D,enumerable:!1}),F.color.close="\x1B[39m",F.bgColor.close="\x1B[49m",K0(F.color,"ansi",()=>M0(a7,"ansi16",Q8,!1)),K0(F.color,"ansi256",()=>M0(t7,"ansi256",Q8,!1)),K0(F.color,"ansi16m",()=>M0(e7,"rgb",D9,!1)),K0(F.bgColor,"ansi",()=>M0(a7,"ansi16",Q8,!0)),K0(F.bgColor,"ansi256",()=>M0(t7,"ansi256",Q8,!0)),K0(F.bgColor,"ansi16m",()=>M0(e7,"rgb",D9,!0)),F}Object.defineProperty(F9,"exports",{enumerable:!0,get:LQ})});var X9=l((gM,B9)=>{var s0=l7(),ZQ=P6(),TQ=$9(),y6=new Set(["\x1B","\x9B"]),J9=(D)=>`${y6.values().next().value}[${D}m`,NQ=(D)=>D.split(" ").map((F)=>s0(F)),x6=(D,F,$)=>{let J=[...F],B=!1,X=s0(ZQ(D[D.length-1]));for(let[Q,Y]of J.entries()){let q=s0(Y);if(X+q<=$)D[D.length-1]+=Y;else D.push(Y),X=0;if(y6.has(Y))B=!0;else if(B&&Y==="m"){B=!1;continue}if(B)continue;if(X+=q,X===$&&Q<J.length-1)D.push(""),X=0}if(!X&&D[D.length-1].length>0&&D.length>1)D[D.length-2]+=D.pop()},IQ=(D)=>{let F=D.split(" "),$=F.length;while($>0){if(s0(F[$-1])>0)break;$--}if($===F.length)return D;return F.slice(0,$).join(" ")+F.slice($).join("")},SQ=(D,F,$={})=>{if($.trim!==!1&&D.trim()==="")return"";let J="",B="",X,Q=NQ(D),Y=[""];for(let[q,G]of D.split(" ").entries()){if($.trim!==!1)Y[Y.length-1]=Y[Y.length-1].trimLeft();let H=s0(Y[Y.length-1]);if(q!==0){if(H>=F&&($.wordWrap===!1||$.trim===!1))Y.push(""),H=0;if(H>0||$.trim===!1)Y[Y.length-1]+=" ",H++}if($.hard&&Q[q]>F){let V=F-H,W=1+Math.floor((Q[q]-V-1)/F);if(Math.floor((Q[q]-1)/F)<W)Y.push("");x6(Y,G,F);continue}if(H+Q[q]>F&&H>0&&Q[q]>0){if($.wordWrap===!1&&H<F){x6(Y,G,F);continue}Y.push("")}if(H+Q[q]>F&&$.wordWrap===!1){x6(Y,G,F);continue}Y[Y.length-1]+=G}if($.trim!==!1)Y=Y.map(IQ);J=Y.join(`
25
25
  `);for(let[q,G]of[...J].entries()){if(B+=G,y6.has(G)){let V=parseFloat(/\d[^m]*/.exec(J.slice(q,q+4)));X=V===39?null:V}let H=TQ.codes.get(Number(X));if(X&&H){if(J[q+1]===`
26
26
  `)B+=J9(H);else if(G===`
27
27
  `)B+=J9(X)}}return B};B9.exports=(D,F,$)=>{return String(D).normalize().replace(/\r\n/g,`
@@ -37,7 +37,7 @@ ${F}`),changed:!0}}function iQ(D){if(D.includes("disable_paste_burst"))return{co
37
37
  ${D.slice(F)}`,changed:!0};if(F===0)return{content:`disable_paste_burst = true
38
38
  ${D}`,changed:!0};return{content:`${D}
39
39
  disable_paste_burst = true
40
- `,changed:!0}}function t0(){try{lQ(N9,{recursive:!0});let D=L9(R0)?Z9(R0,"utf-8"):"",F=!1,$=cQ(D);D=$.content,F=F||$.changed;let J=iQ(D);if(D=J.content,F=F||J.changed,F)pQ(R0,D);return F?"changed":"unchanged"}catch{return"error"}}function S9(){return R0}var O0=14318,N9,R0;var s6=I(()=>{N9=T9(dQ(),".codex"),R0=T9(N9,"config.toml")});import{open as xY,stat as yY,unlink as Y1}from"fs/promises";async function lY(D){try{let F=await yY(D);if(Date.now()-F.mtimeMs>mY){try{await Y1(D)}catch{}return!0}}catch{return!0}return!1}async function pY(D){try{let F=await xY(D,"wx");return await F.writeFile(String(process.pid)),await F.close(),async()=>{try{await Y1(D)}catch{}}}catch(F){if((F instanceof Error&&"code"in F?F.code:void 0)!=="EEXIST")throw F;return null}}async function HD(D){let F=`${D}.lock`,$=Date.now()+hY;while(!0){let J=await pY(F);if(J)return J;if(await lY(F))continue;if(Date.now()>$){try{await Y1(F)}catch{throw Error(`Lock timeout: could not remove stale lock at ${F}`)}continue}await new Promise((X)=>setTimeout(X,gY))}}var hY=5000,gY=50,mY=1e4;var f2=()=>{};var KD={};BD(KD,{update:()=>G1,unregister:()=>wD,saveTemplate:()=>L0,removeSubPane:()=>Fq,register:()=>u2,listTemplates:()=>J3,list:()=>p,getPane:()=>Dq,getElapsedTime:()=>V1,get:()=>rD,findByWindow:()=>tY,findByTask:()=>H1,findByPane:()=>aY,addSubPane:()=>eY});import{mkdir as dY,readFile as cY,writeFile as iY}from"fs/promises";import{homedir as rY}from"os";import{dirname as nY,join as G4}from"path";function oY(){return process.env.GENIE_HOME??G4(rY(),".genie")}function q1(){return G4(oY(),"workers.json")}async function $3(D){try{let F=D??q1(),$=await cY(F,"utf-8"),J=JSON.parse($);if(!J.templates)J.templates={};return J}catch{return{workers:{},templates:{},lastUpdated:new Date().toISOString()}}}async function sY(D,F){let $=F??q1();await dY(nY($),{recursive:!0}),D.lastUpdated=new Date().toISOString(),await iY($,JSON.stringify(D,null,2))}async function _0(D,F){let $=F??q1(),J=await HD($);try{let B=await $3(F),X=await D(B);return await sY(B,F),X}finally{await J()}}async function u2(D){await _0((F)=>{F.workers[D.id]=D})}async function wD(D){await _0((F)=>{delete F.workers[D]})}async function rD(D){return(await $3()).workers[D]??null}async function p(){let D=await $3();return Object.values(D.workers)}async function G1(D,F){await _0(($)=>{let J=$.workers[D];if(J){if(Object.assign(J,F),F.state)J.lastStateChange=new Date().toISOString()}})}async function aY(D){let F=await p(),$=D.startsWith("%")?D:`%${D}`;return F.find((J)=>J.paneId===$)??null}async function tY(D){let F=await p(),$=D.startsWith("@")?D:`@${D}`;return F.find((J)=>J.windowId===$)??null}async function H1(D){return(await p()).find(($)=>$.taskId===D)??null}function V1(D){let F=new Date(D.startedAt).getTime(),$=Date.now()-F,J=Math.floor($/60000),B=Math.floor(J/60),X;if(B>0)X=`${B}h ${J%60}m`;else if(J>0)X=`${J}m`;else X="<1m";return{ms:$,formatted:X}}async function eY(D,F,$){await _0((J)=>{let B=J.workers[D];if(!B)return;if(!B.subPanes)B.subPanes=[];B.subPanes.push(F)},$)}async function Dq(D,F,$){let B=(await $3($)).workers[D];if(!B)return null;if(F===0)return B.paneId;let X=F-1;if(!B.subPanes||X>=B.subPanes.length||X<0)return null;return B.subPanes[X]}async function Fq(D,F,$){await _0((J)=>{let B=J.workers[D];if(!B||!B.subPanes)return;B.subPanes=B.subPanes.filter((X)=>X!==F)},$)}async function L0(D){await _0((F)=>{F.templates[D.id]=D})}async function J3(){let D=await $3();return Object.values(D.templates??{})}var MD=I(()=>{f2()});function X3(D){return $q.parse(D)}function s(D){return`'${D.replace(/'/g,"'\\''")}'`}function Jq(D){try{let F=Bun;if(typeof F.which==="function")return Boolean(F.which(D));let{execSync:$}=v("child_process");return $(`which ${D}`,{stdio:"ignore"}),!0}catch{return!1}}function H4(D){if(!Jq(D))throw Error(`Provider binary "${D}" not found on PATH. Install ${D} or check your environment.`)}function Bq(D,F,$,J){F.CLAUDECODE="1",F.CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS="1";let B=$.agentName??J.role??"worker";if(F.GENIE_AGENT_NAME=B,D.push("--agent-id",s(`${B}@${J.team}`)),D.push("--agent-name",s(B)),D.push("--team-name",s(J.team)),$.color)D.push("--agent-color",s($.color));if($.parentSessionId)D.push("--parent-session-id",s($.parentSessionId));if($.agentType)D.push("--agent-type",s($.agentType));if($.planModeRequired)D.push("--plan-mode-required");if($.permissionMode)D.push("--permission-mode",s($.permissionMode))}function Xq(D,F){if(F.systemPrompt){let{mkdirSync:$,writeFileSync:J,readFileSync:B}=v("fs"),{join:X}=v("path"),Q="/tmp/genie-prompts";$("/tmp/genie-prompts",{recursive:!0});let Y=Date.now().toString(36),q=X("/tmp/genie-prompts",`${F.role||"agent"}-${Y}.md`),G=F.systemPrompt;if(F.systemPromptFile)G=`${B(F.systemPromptFile,"utf-8")}
40
+ `,changed:!0}}function t0(){try{lQ(N9,{recursive:!0});let D=L9(R0)?Z9(R0,"utf-8"):"",F=!1,$=cQ(D);D=$.content,F=F||$.changed;let J=iQ(D);if(D=J.content,F=F||J.changed,F)pQ(R0,D);return F?"changed":"unchanged"}catch{return"error"}}function S9(){return R0}var O0=14318,N9,R0;var s6=I(()=>{N9=T9(dQ(),".codex"),R0=T9(N9,"config.toml")});import{open as xY,stat as yY,unlink as Y1}from"fs/promises";async function lY(D){try{let F=await yY(D);if(Date.now()-F.mtimeMs>mY){try{await Y1(D)}catch{}return!0}}catch{return!0}return!1}async function pY(D){try{let F=await xY(D,"wx");return await F.writeFile(String(process.pid)),await F.close(),async()=>{try{await Y1(D)}catch{}}}catch(F){if((F instanceof Error&&"code"in F?F.code:void 0)!=="EEXIST")throw F;return null}}async function HD(D){let F=`${D}.lock`,$=Date.now()+hY;while(!0){let J=await pY(F);if(J)return J;if(await lY(F))continue;if(Date.now()>$){try{await Y1(F)}catch{throw Error(`Lock timeout: could not remove stale lock at ${F}`)}continue}await new Promise((X)=>setTimeout(X,gY))}}var hY=5000,gY=50,mY=1e4;var f2=()=>{};var KD={};BD(KD,{update:()=>G1,unregister:()=>fD,saveTemplate:()=>L0,removeSubPane:()=>Fq,register:()=>u2,listTemplates:()=>J3,list:()=>p,getPane:()=>Dq,getElapsedTime:()=>V1,get:()=>rD,findByWindow:()=>tY,findByTask:()=>H1,findByPane:()=>aY,addSubPane:()=>eY});import{mkdir as dY,readFile as cY,writeFile as iY}from"fs/promises";import{homedir as rY}from"os";import{dirname as nY,join as G4}from"path";function oY(){return process.env.GENIE_HOME??G4(rY(),".genie")}function q1(){return G4(oY(),"workers.json")}async function $3(D){try{let F=D??q1(),$=await cY(F,"utf-8"),J=JSON.parse($);if(!J.templates)J.templates={};return J}catch{return{workers:{},templates:{},lastUpdated:new Date().toISOString()}}}async function sY(D,F){let $=F??q1();await dY(nY($),{recursive:!0}),D.lastUpdated=new Date().toISOString(),await iY($,JSON.stringify(D,null,2))}async function _0(D,F){let $=F??q1(),J=await HD($);try{let B=await $3(F),X=await D(B);return await sY(B,F),X}finally{await J()}}async function u2(D){await _0((F)=>{F.workers[D.id]=D})}async function fD(D){await _0((F)=>{delete F.workers[D]})}async function rD(D){return(await $3()).workers[D]??null}async function p(){let D=await $3();return Object.values(D.workers)}async function G1(D,F){await _0(($)=>{let J=$.workers[D];if(J){if(Object.assign(J,F),F.state)J.lastStateChange=new Date().toISOString()}})}async function aY(D){let F=await p(),$=D.startsWith("%")?D:`%${D}`;return F.find((J)=>J.paneId===$)??null}async function tY(D){let F=await p(),$=D.startsWith("@")?D:`@${D}`;return F.find((J)=>J.windowId===$)??null}async function H1(D){return(await p()).find(($)=>$.taskId===D)??null}function V1(D){let F=new Date(D.startedAt).getTime(),$=Date.now()-F,J=Math.floor($/60000),B=Math.floor(J/60),X;if(B>0)X=`${B}h ${J%60}m`;else if(J>0)X=`${J}m`;else X="<1m";return{ms:$,formatted:X}}async function eY(D,F,$){await _0((J)=>{let B=J.workers[D];if(!B)return;if(!B.subPanes)B.subPanes=[];B.subPanes.push(F)},$)}async function Dq(D,F,$){let B=(await $3($)).workers[D];if(!B)return null;if(F===0)return B.paneId;let X=F-1;if(!B.subPanes||X>=B.subPanes.length||X<0)return null;return B.subPanes[X]}async function Fq(D,F,$){await _0((J)=>{let B=J.workers[D];if(!B||!B.subPanes)return;B.subPanes=B.subPanes.filter((X)=>X!==F)},$)}async function L0(D){await _0((F)=>{F.templates[D.id]=D})}async function J3(){let D=await $3();return Object.values(D.templates??{})}var MD=I(()=>{f2()});function X3(D){return $q.parse(D)}function s(D){return`'${D.replace(/'/g,"'\\''")}'`}function Jq(D){try{let F=Bun;if(typeof F.which==="function")return Boolean(F.which(D));let{execSync:$}=v("child_process");return $(`which ${D}`,{stdio:"ignore"}),!0}catch{return!1}}function H4(D){if(!Jq(D))throw Error(`Provider binary "${D}" not found on PATH. Install ${D} or check your environment.`)}function Bq(D,F,$,J){F.CLAUDECODE="1",F.CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS="1";let B=$.agentName??J.role??"worker";if(F.GENIE_AGENT_NAME=B,D.push("--agent-id",s(`${B}@${J.team}`)),D.push("--agent-name",s(B)),D.push("--team-name",s(J.team)),$.color)D.push("--agent-color",s($.color));if($.parentSessionId)D.push("--parent-session-id",s($.parentSessionId));if($.agentType)D.push("--agent-type",s($.agentType));if($.planModeRequired)D.push("--plan-mode-required");if($.permissionMode)D.push("--permission-mode",s($.permissionMode))}function Xq(D,F){if(F.systemPrompt){let{mkdirSync:$,writeFileSync:J,readFileSync:B}=v("fs"),{join:X}=v("path"),Q="/tmp/genie-prompts";$("/tmp/genie-prompts",{recursive:!0});let Y=Date.now().toString(36),q=X("/tmp/genie-prompts",`${F.role||"agent"}-${Y}.md`),G=F.systemPrompt;if(F.systemPromptFile)G=`${B(F.systemPromptFile,"utf-8")}
41
41
 
42
42
  ${G}`;if(F.extraArgs){let V=F.extraArgs.indexOf("--append-system-prompt-file");if(V!==-1&&F.extraArgs[V+1])G=`${G}
43
43
 
@@ -58,15 +58,15 @@ tmux set-option -w pane-active-border-style "fg=$COLOR"
58
58
  `+Y}G=j1(D.buffer,J[Q],B[Q],D.position,V),Y+=i.repeat(" ",F.indent)+_1((D.line+1).toString(),H)+" | "+G.str+`
59
59
  `,Y+=i.repeat("-",F.indent+H+3+G.pos)+`^
60
60
  `;for(q=1;q<=F.linesAfter;q++){if(Q+q>=B.length)break;G=j1(D.buffer,J[Q+q],B[Q+q],D.position-(J[Q]-J[Q+q]),V),Y+=i.repeat(" ",F.indent)+_1((D.line+q+1).toString(),H)+" | "+G.str+`
61
- `}return Y.replace(/\n$/,"")}function gq(D){var F={};if(D!==null)Object.keys(D).forEach(function($){D[$].forEach(function(J){F[String(J)]=$})});return F}function mq(D,F){if(F=F||{},Object.keys(F).forEach(function($){if(yq.indexOf($)===-1)throw new YD('Unknown option "'+$+'" is met in definition of "'+D+'" YAML type.')}),this.options=F,this.tag=D,this.kind=F.kind||null,this.resolve=F.resolve||function(){return!0},this.construct=F.construct||function($){return $},this.instanceOf=F.instanceOf||null,this.predicate=F.predicate||null,this.represent=F.represent||null,this.representName=F.representName||null,this.defaultStyle=F.defaultStyle||null,this.multi=F.multi||!1,this.styleAliases=gq(F.styleAliases||null),hq.indexOf(this.kind)===-1)throw new YD('Unknown kind "'+this.kind+'" is specified for "'+D+'" YAML type.')}function S4(D,F){var $=[];return D[F].forEach(function(J){var B=$.length;$.forEach(function(X,Q){if(X.tag===J.tag&&X.kind===J.kind&&X.multi===J.multi)B=Q}),$[B]=J}),$}function lq(){var D={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},F,$;function J(B){if(B.multi)D.multi[B.kind].push(B),D.multi.fallback.push(B);else D[B.kind][B.tag]=D.fallback[B.tag]=B}for(F=0,$=arguments.length;F<$;F+=1)arguments[F].forEach(J);return D}function Z1(D){return this.extend(D)}function nq(D){if(D===null)return!0;var F=D.length;return F===1&&D==="~"||F===4&&(D==="null"||D==="Null"||D==="NULL")}function oq(){return null}function sq(D){return D===null}function tq(D){if(D===null)return!1;var F=D.length;return F===4&&(D==="true"||D==="True"||D==="TRUE")||F===5&&(D==="false"||D==="False"||D==="FALSE")}function eq(D){return D==="true"||D==="True"||D==="TRUE"}function DG(D){return Object.prototype.toString.call(D)==="[object Boolean]"}function $G(D){return 48<=D&&D<=57||65<=D&&D<=70||97<=D&&D<=102}function JG(D){return 48<=D&&D<=55}function BG(D){return 48<=D&&D<=57}function XG(D){if(D===null)return!1;var F=D.length,$=0,J=!1,B;if(!F)return!1;if(B=D[$],B==="-"||B==="+")B=D[++$];if(B==="0"){if($+1===F)return!0;if(B=D[++$],B==="b"){$++;for(;$<F;$++){if(B=D[$],B==="_")continue;if(B!=="0"&&B!=="1")return!1;J=!0}return J&&B!=="_"}if(B==="x"){$++;for(;$<F;$++){if(B=D[$],B==="_")continue;if(!$G(D.charCodeAt($)))return!1;J=!0}return J&&B!=="_"}if(B==="o"){$++;for(;$<F;$++){if(B=D[$],B==="_")continue;if(!JG(D.charCodeAt($)))return!1;J=!0}return J&&B!=="_"}}if(B==="_")return!1;for(;$<F;$++){if(B=D[$],B==="_")continue;if(!BG(D.charCodeAt($)))return!1;J=!0}if(!J||B==="_")return!1;return!0}function QG(D){var F=D,$=1,J;if(F.indexOf("_")!==-1)F=F.replace(/_/g,"");if(J=F[0],J==="-"||J==="+"){if(J==="-")$=-1;F=F.slice(1),J=F[0]}if(F==="0")return 0;if(J==="0"){if(F[1]==="b")return $*parseInt(F.slice(2),2);if(F[1]==="x")return $*parseInt(F.slice(2),16);if(F[1]==="o")return $*parseInt(F.slice(2),8)}return $*parseInt(F,10)}function YG(D){return Object.prototype.toString.call(D)==="[object Number]"&&(D%1===0&&!i.isNegativeZero(D))}function HG(D){if(D===null)return!1;if(!GG.test(D)||D[D.length-1]==="_")return!1;return!0}function VG(D){var F,$;if(F=D.replace(/_/g,"").toLowerCase(),$=F[0]==="-"?-1:1,"+-".indexOf(F[0])>=0)F=F.slice(1);if(F===".inf")return $===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY;else if(F===".nan")return NaN;return $*parseFloat(F,10)}function UG(D,F){var $;if(isNaN(D))switch(F){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===D)switch(F){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===D)switch(F){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(i.isNegativeZero(D))return"-0.0";return $=D.toString(10),WG.test($)?$.replace("e",".e"):$}function zG(D){return Object.prototype.toString.call(D)==="[object Number]"&&(D%1!==0||i.isNegativeZero(D))}function AG(D){if(D===null)return!1;if(i4.exec(D)!==null)return!0;if(r4.exec(D)!==null)return!0;return!1}function RG(D){var F,$,J,B,X,Q,Y,q=0,G=null,H,V,W;if(F=i4.exec(D),F===null)F=r4.exec(D);if(F===null)throw Error("Date resolve error");if($=+F[1],J=+F[2]-1,B=+F[3],!F[4])return new Date(Date.UTC($,J,B));if(X=+F[4],Q=+F[5],Y=+F[6],F[7]){q=F[7].slice(0,3);while(q.length<3)q+="0";q=+q}if(F[9]){if(H=+F[10],V=+(F[11]||0),G=(H*60+V)*60000,F[9]==="-")G=-G}if(W=new Date(Date.UTC($,J,B,X,Q,Y,q)),G)W.setTime(W.getTime()-G);return W}function OG(D){return D.toISOString()}function jG(D){return D==="<<"||D===null}function LG(D){if(D===null)return!1;var F,$,J=0,B=D.length,X=b1;for($=0;$<B;$++){if(F=X.indexOf(D.charAt($)),F>64)continue;if(F<0)return!1;J+=6}return J%8===0}function ZG(D){var F,$,J=D.replace(/[\r\n=]/g,""),B=J.length,X=b1,Q=0,Y=[];for(F=0;F<B;F++){if(F%4===0&&F)Y.push(Q>>16&255),Y.push(Q>>8&255),Y.push(Q&255);Q=Q<<6|X.indexOf(J.charAt(F))}if($=B%4*6,$===0)Y.push(Q>>16&255),Y.push(Q>>8&255),Y.push(Q&255);else if($===18)Y.push(Q>>10&255),Y.push(Q>>2&255);else if($===12)Y.push(Q>>4&255);return new Uint8Array(Y)}function TG(D){var F="",$=0,J,B,X=D.length,Q=b1;for(J=0;J<X;J++){if(J%3===0&&J)F+=Q[$>>18&63],F+=Q[$>>12&63],F+=Q[$>>6&63],F+=Q[$&63];$=($<<8)+D[J]}if(B=X%3,B===0)F+=Q[$>>18&63],F+=Q[$>>12&63],F+=Q[$>>6&63],F+=Q[$&63];else if(B===2)F+=Q[$>>10&63],F+=Q[$>>4&63],F+=Q[$<<2&63],F+=Q[64];else if(B===1)F+=Q[$>>2&63],F+=Q[$<<4&63],F+=Q[64],F+=Q[64];return F}function NG(D){return Object.prototype.toString.call(D)==="[object Uint8Array]"}function PG(D){if(D===null)return!0;var F=[],$,J,B,X,Q,Y=D;for($=0,J=Y.length;$<J;$+=1){if(B=Y[$],Q=!1,bG.call(B)!=="[object Object]")return!1;for(X in B)if(SG.call(B,X))if(!Q)Q=!0;else return!1;if(!Q)return!1;if(F.indexOf(X)===-1)F.push(X);else return!1}return!0}function vG(D){return D!==null?D:[]}function fG(D){if(D===null)return!0;var F,$,J,B,X,Q=D;X=Array(Q.length);for(F=0,$=Q.length;F<$;F+=1){if(J=Q[F],wG.call(J)!=="[object Object]")return!1;if(B=Object.keys(J),B.length!==1)return!1;X[F]=[B[0],J[B[0]]]}return!0}function uG(D){if(D===null)return[];var F,$,J,B,X,Q=D;X=Array(Q.length);for(F=0,$=Q.length;F<$;F+=1)J=Q[F],B=Object.keys(J),X[F]=[B[0],J[B[0]]];return X}function hG(D){if(D===null)return!0;var F,$=D;for(F in $)if(yG.call($,F)){if($[F]!==null)return!1}return!0}function gG(D){return D!==null?D:{}}function P4(D){return Object.prototype.toString.call(D)}function fD(D){return D===10||D===13}function c2(D){return D===9||D===32}function qD(D){return D===9||D===32||D===10||D===13}function I0(D){return D===44||D===91||D===93||D===123||D===125}function iG(D){var F;if(48<=D&&D<=57)return D-48;if(F=D|32,97<=F&&F<=102)return F-97+10;return-1}function rG(D){if(D===120)return 2;if(D===117)return 4;if(D===85)return 8;return 0}function nG(D){if(48<=D&&D<=57)return D-48;return-1}function v4(D){return D===48?"\x00":D===97?"\x07":D===98?"\b":D===116?"\t":D===9?"\t":D===110?`
62
- `:D===118?"\v":D===102?"\f":D===114?"\r":D===101?"\x1B":D===32?" ":D===34?'"':D===47?"/":D===92?"\\":D===78?"\x85":D===95?"\xA0":D===76?"\u2028":D===80?"\u2029":""}function oG(D){if(D<=65535)return String.fromCharCode(D);return String.fromCharCode((D-65536>>10)+55296,(D-65536&1023)+56320)}function e4(D,F,$){if(F==="__proto__")Object.defineProperty(D,F,{configurable:!0,enumerable:!0,writable:!0,value:$});else D[F]=$}function sG(D,F){this.input=D,this.filename=F.filename||null,this.schema=F.schema||n4,this.onWarning=F.onWarning||null,this.legacy=F.legacy||!1,this.json=F.json||!1,this.listener=F.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=D.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function $F(D,F){var $={name:D.filename,buffer:D.input.slice(0,-1),position:D.position,line:D.line,column:D.position-D.lineStart};return $.snippet=xq($),new YD(F,$)}function Z(D,F){throw $F(D,F)}function N8(D,F){if(D.onWarning)D.onWarning.call(null,$F(D,F))}function Y2(D,F,$,J){var B,X,Q,Y;if(F<$){if(Y=D.input.slice(F,$),J){for(B=0,X=Y.length;B<X;B+=1)if(Q=Y.charCodeAt(B),!(Q===9||32<=Q&&Q<=1114111))Z(D,"expected valid JSON character")}else if(pG.test(Y))Z(D,"the stream contains non-printable characters");D.result+=Y}}function w4(D,F,$,J){var B,X,Q,Y;if(!i.isObject($))Z(D,"cannot merge mappings; the provided source object is unacceptable");B=Object.keys($);for(Q=0,Y=B.length;Q<Y;Q+=1)if(X=B[Q],!q2.call(F,X))e4(F,X,$[X]),J[X]=!0}function S0(D,F,$,J,B,X,Q,Y,q){var G,H;if(Array.isArray(B)){B=Array.prototype.slice.call(B);for(G=0,H=B.length;G<H;G+=1){if(Array.isArray(B[G]))Z(D,"nested arrays are not supported inside keys");if(typeof B==="object"&&P4(B[G])==="[object Object]")B[G]="[object Object]"}}if(typeof B==="object"&&P4(B)==="[object Object]")B="[object Object]";if(B=String(B),F===null)F={};if(J==="tag:yaml.org,2002:merge")if(Array.isArray(X))for(G=0,H=X.length;G<H;G+=1)w4(D,F,X[G],$);else w4(D,F,X,$);else{if(!D.json&&!q2.call($,B)&&q2.call(F,B))D.line=Q||D.line,D.lineStart=Y||D.lineStart,D.position=q||D.position,Z(D,"duplicated mapping key");e4(F,B,X),delete $[B]}return F}function P1(D){var F=D.input.charCodeAt(D.position);if(F===10)D.position++;else if(F===13){if(D.position++,D.input.charCodeAt(D.position)===10)D.position++}else Z(D,"a line break is expected");D.line+=1,D.lineStart=D.position,D.firstTabInLine=-1}function c(D,F,$){var J=0,B=D.input.charCodeAt(D.position);while(B!==0){while(c2(B)){if(B===9&&D.firstTabInLine===-1)D.firstTabInLine=D.position;B=D.input.charCodeAt(++D.position)}if(F&&B===35)do B=D.input.charCodeAt(++D.position);while(B!==10&&B!==13&&B!==0);if(fD(B)){P1(D),B=D.input.charCodeAt(D.position),J++,D.lineIndent=0;while(B===32)D.lineIndent++,B=D.input.charCodeAt(++D.position)}else break}if($!==-1&&J!==0&&D.lineIndent<$)N8(D,"deficient indentation");return J}function b8(D){var F=D.position,$;if($=D.input.charCodeAt(F),($===45||$===46)&&$===D.input.charCodeAt(F+1)&&$===D.input.charCodeAt(F+2)){if(F+=3,$=D.input.charCodeAt(F),$===0||qD($))return!0}return!1}function v1(D,F){if(F===1)D.result+=" ";else if(F>1)D.result+=i.repeat(`
63
- `,F-1)}function aG(D,F,$){var J,B,X,Q,Y,q,G,H,V=D.kind,W=D.result,U;if(U=D.input.charCodeAt(D.position),qD(U)||I0(U)||U===35||U===38||U===42||U===33||U===124||U===62||U===39||U===34||U===37||U===64||U===96)return!1;if(U===63||U===45){if(B=D.input.charCodeAt(D.position+1),qD(B)||$&&I0(B))return!1}D.kind="scalar",D.result="",X=Q=D.position,Y=!1;while(U!==0){if(U===58){if(B=D.input.charCodeAt(D.position+1),qD(B)||$&&I0(B))break}else if(U===35){if(J=D.input.charCodeAt(D.position-1),qD(J))break}else if(D.position===D.lineStart&&b8(D)||$&&I0(U))break;else if(fD(U))if(q=D.line,G=D.lineStart,H=D.lineIndent,c(D,!1,-1),D.lineIndent>=F){Y=!0,U=D.input.charCodeAt(D.position);continue}else{D.position=Q,D.line=q,D.lineStart=G,D.lineIndent=H;break}if(Y)Y2(D,X,Q,!1),v1(D,D.line-q),X=Q=D.position,Y=!1;if(!c2(U))Q=D.position+1;U=D.input.charCodeAt(++D.position)}if(Y2(D,X,Q,!1),D.result)return!0;return D.kind=V,D.result=W,!1}function tG(D,F){var $,J,B;if($=D.input.charCodeAt(D.position),$!==39)return!1;D.kind="scalar",D.result="",D.position++,J=B=D.position;while(($=D.input.charCodeAt(D.position))!==0)if($===39)if(Y2(D,J,D.position,!0),$=D.input.charCodeAt(++D.position),$===39)J=D.position,D.position++,B=D.position;else return!0;else if(fD($))Y2(D,J,B,!0),v1(D,c(D,!1,F)),J=B=D.position;else if(D.position===D.lineStart&&b8(D))Z(D,"unexpected end of the document within a single quoted scalar");else D.position++,B=D.position;Z(D,"unexpected end of the stream within a single quoted scalar")}function eG(D,F){var $,J,B,X,Q,Y;if(Y=D.input.charCodeAt(D.position),Y!==34)return!1;D.kind="scalar",D.result="",D.position++,$=J=D.position;while((Y=D.input.charCodeAt(D.position))!==0)if(Y===34)return Y2(D,$,D.position,!0),D.position++,!0;else if(Y===92){if(Y2(D,$,D.position,!0),Y=D.input.charCodeAt(++D.position),fD(Y))c(D,!1,F);else if(Y<256&&DF[Y])D.result+=FF[Y],D.position++;else if((Q=rG(Y))>0){B=Q,X=0;for(;B>0;B--)if(Y=D.input.charCodeAt(++D.position),(Q=iG(Y))>=0)X=(X<<4)+Q;else Z(D,"expected hexadecimal character");D.result+=oG(X),D.position++}else Z(D,"unknown escape sequence");$=J=D.position}else if(fD(Y))Y2(D,$,J,!0),v1(D,c(D,!1,F)),$=J=D.position;else if(D.position===D.lineStart&&b8(D))Z(D,"unexpected end of the document within a double quoted scalar");else D.position++,J=D.position;Z(D,"unexpected end of the stream within a double quoted scalar")}function DH(D,F){var $=!0,J,B,X,Q=D.tag,Y,q=D.anchor,G,H,V,W,U,z=Object.create(null),E,C,L,R;if(R=D.input.charCodeAt(D.position),R===91)H=93,U=!1,Y=[];else if(R===123)H=125,U=!0,Y={};else return!1;if(D.anchor!==null)D.anchorMap[D.anchor]=Y;R=D.input.charCodeAt(++D.position);while(R!==0){if(c(D,!0,F),R=D.input.charCodeAt(D.position),R===H)return D.position++,D.tag=Q,D.anchor=q,D.kind=U?"mapping":"sequence",D.result=Y,!0;else if(!$)Z(D,"missed comma between flow collection entries");else if(R===44)Z(D,"expected the node content, but found ','");if(C=E=L=null,V=W=!1,R===63){if(G=D.input.charCodeAt(D.position+1),qD(G))V=W=!0,D.position++,c(D,!0,F)}if(J=D.line,B=D.lineStart,X=D.position,b0(D,F,Z8,!1,!0),C=D.tag,E=D.result,c(D,!0,F),R=D.input.charCodeAt(D.position),(W||D.line===J)&&R===58)V=!0,R=D.input.charCodeAt(++D.position),c(D,!0,F),b0(D,F,Z8,!1,!0),L=D.result;if(U)S0(D,Y,z,C,E,L,J,B,X);else if(V)Y.push(S0(D,null,z,C,E,L,J,B,X));else Y.push(E);if(c(D,!0,F),R=D.input.charCodeAt(D.position),R===44)$=!0,R=D.input.charCodeAt(++D.position);else $=!1}Z(D,"unexpected end of the stream within a flow collection")}function FH(D,F){var $,J,B=L1,X=!1,Q=!1,Y=F,q=0,G=!1,H,V;if(V=D.input.charCodeAt(D.position),V===124)J=!1;else if(V===62)J=!0;else return!1;D.kind="scalar",D.result="";while(V!==0)if(V=D.input.charCodeAt(++D.position),V===43||V===45)if(L1===B)B=V===43?b4:lG;else Z(D,"repeat of a chomping mode identifier");else if((H=nG(V))>=0)if(H===0)Z(D,"bad explicit indentation width of a block scalar; it cannot be less than one");else if(!Q)Y=F+H-1,Q=!0;else Z(D,"repeat of an indentation width identifier");else break;if(c2(V)){do V=D.input.charCodeAt(++D.position);while(c2(V));if(V===35)do V=D.input.charCodeAt(++D.position);while(!fD(V)&&V!==0)}while(V!==0){P1(D),D.lineIndent=0,V=D.input.charCodeAt(D.position);while((!Q||D.lineIndent<Y)&&V===32)D.lineIndent++,V=D.input.charCodeAt(++D.position);if(!Q&&D.lineIndent>Y)Y=D.lineIndent;if(fD(V)){q++;continue}if(D.lineIndent<Y){if(B===b4)D.result+=i.repeat(`
61
+ `}return Y.replace(/\n$/,"")}function gq(D){var F={};if(D!==null)Object.keys(D).forEach(function($){D[$].forEach(function(J){F[String(J)]=$})});return F}function mq(D,F){if(F=F||{},Object.keys(F).forEach(function($){if(yq.indexOf($)===-1)throw new YD('Unknown option "'+$+'" is met in definition of "'+D+'" YAML type.')}),this.options=F,this.tag=D,this.kind=F.kind||null,this.resolve=F.resolve||function(){return!0},this.construct=F.construct||function($){return $},this.instanceOf=F.instanceOf||null,this.predicate=F.predicate||null,this.represent=F.represent||null,this.representName=F.representName||null,this.defaultStyle=F.defaultStyle||null,this.multi=F.multi||!1,this.styleAliases=gq(F.styleAliases||null),hq.indexOf(this.kind)===-1)throw new YD('Unknown kind "'+this.kind+'" is specified for "'+D+'" YAML type.')}function S4(D,F){var $=[];return D[F].forEach(function(J){var B=$.length;$.forEach(function(X,Q){if(X.tag===J.tag&&X.kind===J.kind&&X.multi===J.multi)B=Q}),$[B]=J}),$}function lq(){var D={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},F,$;function J(B){if(B.multi)D.multi[B.kind].push(B),D.multi.fallback.push(B);else D[B.kind][B.tag]=D.fallback[B.tag]=B}for(F=0,$=arguments.length;F<$;F+=1)arguments[F].forEach(J);return D}function Z1(D){return this.extend(D)}function nq(D){if(D===null)return!0;var F=D.length;return F===1&&D==="~"||F===4&&(D==="null"||D==="Null"||D==="NULL")}function oq(){return null}function sq(D){return D===null}function tq(D){if(D===null)return!1;var F=D.length;return F===4&&(D==="true"||D==="True"||D==="TRUE")||F===5&&(D==="false"||D==="False"||D==="FALSE")}function eq(D){return D==="true"||D==="True"||D==="TRUE"}function DG(D){return Object.prototype.toString.call(D)==="[object Boolean]"}function $G(D){return 48<=D&&D<=57||65<=D&&D<=70||97<=D&&D<=102}function JG(D){return 48<=D&&D<=55}function BG(D){return 48<=D&&D<=57}function XG(D){if(D===null)return!1;var F=D.length,$=0,J=!1,B;if(!F)return!1;if(B=D[$],B==="-"||B==="+")B=D[++$];if(B==="0"){if($+1===F)return!0;if(B=D[++$],B==="b"){$++;for(;$<F;$++){if(B=D[$],B==="_")continue;if(B!=="0"&&B!=="1")return!1;J=!0}return J&&B!=="_"}if(B==="x"){$++;for(;$<F;$++){if(B=D[$],B==="_")continue;if(!$G(D.charCodeAt($)))return!1;J=!0}return J&&B!=="_"}if(B==="o"){$++;for(;$<F;$++){if(B=D[$],B==="_")continue;if(!JG(D.charCodeAt($)))return!1;J=!0}return J&&B!=="_"}}if(B==="_")return!1;for(;$<F;$++){if(B=D[$],B==="_")continue;if(!BG(D.charCodeAt($)))return!1;J=!0}if(!J||B==="_")return!1;return!0}function QG(D){var F=D,$=1,J;if(F.indexOf("_")!==-1)F=F.replace(/_/g,"");if(J=F[0],J==="-"||J==="+"){if(J==="-")$=-1;F=F.slice(1),J=F[0]}if(F==="0")return 0;if(J==="0"){if(F[1]==="b")return $*parseInt(F.slice(2),2);if(F[1]==="x")return $*parseInt(F.slice(2),16);if(F[1]==="o")return $*parseInt(F.slice(2),8)}return $*parseInt(F,10)}function YG(D){return Object.prototype.toString.call(D)==="[object Number]"&&(D%1===0&&!i.isNegativeZero(D))}function HG(D){if(D===null)return!1;if(!GG.test(D)||D[D.length-1]==="_")return!1;return!0}function VG(D){var F,$;if(F=D.replace(/_/g,"").toLowerCase(),$=F[0]==="-"?-1:1,"+-".indexOf(F[0])>=0)F=F.slice(1);if(F===".inf")return $===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY;else if(F===".nan")return NaN;return $*parseFloat(F,10)}function UG(D,F){var $;if(isNaN(D))switch(F){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===D)switch(F){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===D)switch(F){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(i.isNegativeZero(D))return"-0.0";return $=D.toString(10),WG.test($)?$.replace("e",".e"):$}function zG(D){return Object.prototype.toString.call(D)==="[object Number]"&&(D%1!==0||i.isNegativeZero(D))}function AG(D){if(D===null)return!1;if(i4.exec(D)!==null)return!0;if(r4.exec(D)!==null)return!0;return!1}function RG(D){var F,$,J,B,X,Q,Y,q=0,G=null,H,V,W;if(F=i4.exec(D),F===null)F=r4.exec(D);if(F===null)throw Error("Date resolve error");if($=+F[1],J=+F[2]-1,B=+F[3],!F[4])return new Date(Date.UTC($,J,B));if(X=+F[4],Q=+F[5],Y=+F[6],F[7]){q=F[7].slice(0,3);while(q.length<3)q+="0";q=+q}if(F[9]){if(H=+F[10],V=+(F[11]||0),G=(H*60+V)*60000,F[9]==="-")G=-G}if(W=new Date(Date.UTC($,J,B,X,Q,Y,q)),G)W.setTime(W.getTime()-G);return W}function OG(D){return D.toISOString()}function jG(D){return D==="<<"||D===null}function LG(D){if(D===null)return!1;var F,$,J=0,B=D.length,X=b1;for($=0;$<B;$++){if(F=X.indexOf(D.charAt($)),F>64)continue;if(F<0)return!1;J+=6}return J%8===0}function ZG(D){var F,$,J=D.replace(/[\r\n=]/g,""),B=J.length,X=b1,Q=0,Y=[];for(F=0;F<B;F++){if(F%4===0&&F)Y.push(Q>>16&255),Y.push(Q>>8&255),Y.push(Q&255);Q=Q<<6|X.indexOf(J.charAt(F))}if($=B%4*6,$===0)Y.push(Q>>16&255),Y.push(Q>>8&255),Y.push(Q&255);else if($===18)Y.push(Q>>10&255),Y.push(Q>>2&255);else if($===12)Y.push(Q>>4&255);return new Uint8Array(Y)}function TG(D){var F="",$=0,J,B,X=D.length,Q=b1;for(J=0;J<X;J++){if(J%3===0&&J)F+=Q[$>>18&63],F+=Q[$>>12&63],F+=Q[$>>6&63],F+=Q[$&63];$=($<<8)+D[J]}if(B=X%3,B===0)F+=Q[$>>18&63],F+=Q[$>>12&63],F+=Q[$>>6&63],F+=Q[$&63];else if(B===2)F+=Q[$>>10&63],F+=Q[$>>4&63],F+=Q[$<<2&63],F+=Q[64];else if(B===1)F+=Q[$>>2&63],F+=Q[$<<4&63],F+=Q[64],F+=Q[64];return F}function NG(D){return Object.prototype.toString.call(D)==="[object Uint8Array]"}function PG(D){if(D===null)return!0;var F=[],$,J,B,X,Q,Y=D;for($=0,J=Y.length;$<J;$+=1){if(B=Y[$],Q=!1,bG.call(B)!=="[object Object]")return!1;for(X in B)if(SG.call(B,X))if(!Q)Q=!0;else return!1;if(!Q)return!1;if(F.indexOf(X)===-1)F.push(X);else return!1}return!0}function vG(D){return D!==null?D:[]}function fG(D){if(D===null)return!0;var F,$,J,B,X,Q=D;X=Array(Q.length);for(F=0,$=Q.length;F<$;F+=1){if(J=Q[F],wG.call(J)!=="[object Object]")return!1;if(B=Object.keys(J),B.length!==1)return!1;X[F]=[B[0],J[B[0]]]}return!0}function uG(D){if(D===null)return[];var F,$,J,B,X,Q=D;X=Array(Q.length);for(F=0,$=Q.length;F<$;F+=1)J=Q[F],B=Object.keys(J),X[F]=[B[0],J[B[0]]];return X}function hG(D){if(D===null)return!0;var F,$=D;for(F in $)if(yG.call($,F)){if($[F]!==null)return!1}return!0}function gG(D){return D!==null?D:{}}function P4(D){return Object.prototype.toString.call(D)}function uD(D){return D===10||D===13}function c2(D){return D===9||D===32}function qD(D){return D===9||D===32||D===10||D===13}function I0(D){return D===44||D===91||D===93||D===123||D===125}function iG(D){var F;if(48<=D&&D<=57)return D-48;if(F=D|32,97<=F&&F<=102)return F-97+10;return-1}function rG(D){if(D===120)return 2;if(D===117)return 4;if(D===85)return 8;return 0}function nG(D){if(48<=D&&D<=57)return D-48;return-1}function v4(D){return D===48?"\x00":D===97?"\x07":D===98?"\b":D===116?"\t":D===9?"\t":D===110?`
62
+ `:D===118?"\v":D===102?"\f":D===114?"\r":D===101?"\x1B":D===32?" ":D===34?'"':D===47?"/":D===92?"\\":D===78?"\x85":D===95?"\xA0":D===76?"\u2028":D===80?"\u2029":""}function oG(D){if(D<=65535)return String.fromCharCode(D);return String.fromCharCode((D-65536>>10)+55296,(D-65536&1023)+56320)}function e4(D,F,$){if(F==="__proto__")Object.defineProperty(D,F,{configurable:!0,enumerable:!0,writable:!0,value:$});else D[F]=$}function sG(D,F){this.input=D,this.filename=F.filename||null,this.schema=F.schema||n4,this.onWarning=F.onWarning||null,this.legacy=F.legacy||!1,this.json=F.json||!1,this.listener=F.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=D.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function $F(D,F){var $={name:D.filename,buffer:D.input.slice(0,-1),position:D.position,line:D.line,column:D.position-D.lineStart};return $.snippet=xq($),new YD(F,$)}function Z(D,F){throw $F(D,F)}function N8(D,F){if(D.onWarning)D.onWarning.call(null,$F(D,F))}function Y2(D,F,$,J){var B,X,Q,Y;if(F<$){if(Y=D.input.slice(F,$),J){for(B=0,X=Y.length;B<X;B+=1)if(Q=Y.charCodeAt(B),!(Q===9||32<=Q&&Q<=1114111))Z(D,"expected valid JSON character")}else if(pG.test(Y))Z(D,"the stream contains non-printable characters");D.result+=Y}}function w4(D,F,$,J){var B,X,Q,Y;if(!i.isObject($))Z(D,"cannot merge mappings; the provided source object is unacceptable");B=Object.keys($);for(Q=0,Y=B.length;Q<Y;Q+=1)if(X=B[Q],!q2.call(F,X))e4(F,X,$[X]),J[X]=!0}function S0(D,F,$,J,B,X,Q,Y,q){var G,H;if(Array.isArray(B)){B=Array.prototype.slice.call(B);for(G=0,H=B.length;G<H;G+=1){if(Array.isArray(B[G]))Z(D,"nested arrays are not supported inside keys");if(typeof B==="object"&&P4(B[G])==="[object Object]")B[G]="[object Object]"}}if(typeof B==="object"&&P4(B)==="[object Object]")B="[object Object]";if(B=String(B),F===null)F={};if(J==="tag:yaml.org,2002:merge")if(Array.isArray(X))for(G=0,H=X.length;G<H;G+=1)w4(D,F,X[G],$);else w4(D,F,X,$);else{if(!D.json&&!q2.call($,B)&&q2.call(F,B))D.line=Q||D.line,D.lineStart=Y||D.lineStart,D.position=q||D.position,Z(D,"duplicated mapping key");e4(F,B,X),delete $[B]}return F}function P1(D){var F=D.input.charCodeAt(D.position);if(F===10)D.position++;else if(F===13){if(D.position++,D.input.charCodeAt(D.position)===10)D.position++}else Z(D,"a line break is expected");D.line+=1,D.lineStart=D.position,D.firstTabInLine=-1}function c(D,F,$){var J=0,B=D.input.charCodeAt(D.position);while(B!==0){while(c2(B)){if(B===9&&D.firstTabInLine===-1)D.firstTabInLine=D.position;B=D.input.charCodeAt(++D.position)}if(F&&B===35)do B=D.input.charCodeAt(++D.position);while(B!==10&&B!==13&&B!==0);if(uD(B)){P1(D),B=D.input.charCodeAt(D.position),J++,D.lineIndent=0;while(B===32)D.lineIndent++,B=D.input.charCodeAt(++D.position)}else break}if($!==-1&&J!==0&&D.lineIndent<$)N8(D,"deficient indentation");return J}function b8(D){var F=D.position,$;if($=D.input.charCodeAt(F),($===45||$===46)&&$===D.input.charCodeAt(F+1)&&$===D.input.charCodeAt(F+2)){if(F+=3,$=D.input.charCodeAt(F),$===0||qD($))return!0}return!1}function v1(D,F){if(F===1)D.result+=" ";else if(F>1)D.result+=i.repeat(`
63
+ `,F-1)}function aG(D,F,$){var J,B,X,Q,Y,q,G,H,V=D.kind,W=D.result,U;if(U=D.input.charCodeAt(D.position),qD(U)||I0(U)||U===35||U===38||U===42||U===33||U===124||U===62||U===39||U===34||U===37||U===64||U===96)return!1;if(U===63||U===45){if(B=D.input.charCodeAt(D.position+1),qD(B)||$&&I0(B))return!1}D.kind="scalar",D.result="",X=Q=D.position,Y=!1;while(U!==0){if(U===58){if(B=D.input.charCodeAt(D.position+1),qD(B)||$&&I0(B))break}else if(U===35){if(J=D.input.charCodeAt(D.position-1),qD(J))break}else if(D.position===D.lineStart&&b8(D)||$&&I0(U))break;else if(uD(U))if(q=D.line,G=D.lineStart,H=D.lineIndent,c(D,!1,-1),D.lineIndent>=F){Y=!0,U=D.input.charCodeAt(D.position);continue}else{D.position=Q,D.line=q,D.lineStart=G,D.lineIndent=H;break}if(Y)Y2(D,X,Q,!1),v1(D,D.line-q),X=Q=D.position,Y=!1;if(!c2(U))Q=D.position+1;U=D.input.charCodeAt(++D.position)}if(Y2(D,X,Q,!1),D.result)return!0;return D.kind=V,D.result=W,!1}function tG(D,F){var $,J,B;if($=D.input.charCodeAt(D.position),$!==39)return!1;D.kind="scalar",D.result="",D.position++,J=B=D.position;while(($=D.input.charCodeAt(D.position))!==0)if($===39)if(Y2(D,J,D.position,!0),$=D.input.charCodeAt(++D.position),$===39)J=D.position,D.position++,B=D.position;else return!0;else if(uD($))Y2(D,J,B,!0),v1(D,c(D,!1,F)),J=B=D.position;else if(D.position===D.lineStart&&b8(D))Z(D,"unexpected end of the document within a single quoted scalar");else D.position++,B=D.position;Z(D,"unexpected end of the stream within a single quoted scalar")}function eG(D,F){var $,J,B,X,Q,Y;if(Y=D.input.charCodeAt(D.position),Y!==34)return!1;D.kind="scalar",D.result="",D.position++,$=J=D.position;while((Y=D.input.charCodeAt(D.position))!==0)if(Y===34)return Y2(D,$,D.position,!0),D.position++,!0;else if(Y===92){if(Y2(D,$,D.position,!0),Y=D.input.charCodeAt(++D.position),uD(Y))c(D,!1,F);else if(Y<256&&DF[Y])D.result+=FF[Y],D.position++;else if((Q=rG(Y))>0){B=Q,X=0;for(;B>0;B--)if(Y=D.input.charCodeAt(++D.position),(Q=iG(Y))>=0)X=(X<<4)+Q;else Z(D,"expected hexadecimal character");D.result+=oG(X),D.position++}else Z(D,"unknown escape sequence");$=J=D.position}else if(uD(Y))Y2(D,$,J,!0),v1(D,c(D,!1,F)),$=J=D.position;else if(D.position===D.lineStart&&b8(D))Z(D,"unexpected end of the document within a double quoted scalar");else D.position++,J=D.position;Z(D,"unexpected end of the stream within a double quoted scalar")}function DH(D,F){var $=!0,J,B,X,Q=D.tag,Y,q=D.anchor,G,H,V,W,U,z=Object.create(null),E,C,L,R;if(R=D.input.charCodeAt(D.position),R===91)H=93,U=!1,Y=[];else if(R===123)H=125,U=!0,Y={};else return!1;if(D.anchor!==null)D.anchorMap[D.anchor]=Y;R=D.input.charCodeAt(++D.position);while(R!==0){if(c(D,!0,F),R=D.input.charCodeAt(D.position),R===H)return D.position++,D.tag=Q,D.anchor=q,D.kind=U?"mapping":"sequence",D.result=Y,!0;else if(!$)Z(D,"missed comma between flow collection entries");else if(R===44)Z(D,"expected the node content, but found ','");if(C=E=L=null,V=W=!1,R===63){if(G=D.input.charCodeAt(D.position+1),qD(G))V=W=!0,D.position++,c(D,!0,F)}if(J=D.line,B=D.lineStart,X=D.position,b0(D,F,Z8,!1,!0),C=D.tag,E=D.result,c(D,!0,F),R=D.input.charCodeAt(D.position),(W||D.line===J)&&R===58)V=!0,R=D.input.charCodeAt(++D.position),c(D,!0,F),b0(D,F,Z8,!1,!0),L=D.result;if(U)S0(D,Y,z,C,E,L,J,B,X);else if(V)Y.push(S0(D,null,z,C,E,L,J,B,X));else Y.push(E);if(c(D,!0,F),R=D.input.charCodeAt(D.position),R===44)$=!0,R=D.input.charCodeAt(++D.position);else $=!1}Z(D,"unexpected end of the stream within a flow collection")}function FH(D,F){var $,J,B=L1,X=!1,Q=!1,Y=F,q=0,G=!1,H,V;if(V=D.input.charCodeAt(D.position),V===124)J=!1;else if(V===62)J=!0;else return!1;D.kind="scalar",D.result="";while(V!==0)if(V=D.input.charCodeAt(++D.position),V===43||V===45)if(L1===B)B=V===43?b4:lG;else Z(D,"repeat of a chomping mode identifier");else if((H=nG(V))>=0)if(H===0)Z(D,"bad explicit indentation width of a block scalar; it cannot be less than one");else if(!Q)Y=F+H-1,Q=!0;else Z(D,"repeat of an indentation width identifier");else break;if(c2(V)){do V=D.input.charCodeAt(++D.position);while(c2(V));if(V===35)do V=D.input.charCodeAt(++D.position);while(!uD(V)&&V!==0)}while(V!==0){P1(D),D.lineIndent=0,V=D.input.charCodeAt(D.position);while((!Q||D.lineIndent<Y)&&V===32)D.lineIndent++,V=D.input.charCodeAt(++D.position);if(!Q&&D.lineIndent>Y)Y=D.lineIndent;if(uD(V)){q++;continue}if(D.lineIndent<Y){if(B===b4)D.result+=i.repeat(`
64
64
  `,X?1+q:q);else if(B===L1){if(X)D.result+=`
65
65
  `}break}if(J)if(c2(V))G=!0,D.result+=i.repeat(`
66
66
  `,X?1+q:q);else if(G)G=!1,D.result+=i.repeat(`
67
67
  `,q+1);else if(q===0){if(X)D.result+=" "}else D.result+=i.repeat(`
68
68
  `,q);else D.result+=i.repeat(`
69
- `,X?1+q:q);X=!0,Q=!0,q=0,$=D.position;while(!fD(V)&&V!==0)V=D.input.charCodeAt(++D.position);Y2(D,$,D.position,!1)}return!0}function f4(D,F){var $,J=D.tag,B=D.anchor,X=[],Q,Y=!1,q;if(D.firstTabInLine!==-1)return!1;if(D.anchor!==null)D.anchorMap[D.anchor]=X;q=D.input.charCodeAt(D.position);while(q!==0){if(D.firstTabInLine!==-1)D.position=D.firstTabInLine,Z(D,"tab characters must not be used in indentation");if(q!==45)break;if(Q=D.input.charCodeAt(D.position+1),!qD(Q))break;if(Y=!0,D.position++,c(D,!0,-1)){if(D.lineIndent<=F){X.push(null),q=D.input.charCodeAt(D.position);continue}}if($=D.line,b0(D,F,s4,!1,!0),X.push(D.result),c(D,!0,-1),q=D.input.charCodeAt(D.position),(D.line===$||D.lineIndent>F)&&q!==0)Z(D,"bad indentation of a sequence entry");else if(D.lineIndent<F)break}if(Y)return D.tag=J,D.anchor=B,D.kind="sequence",D.result=X,!0;return!1}function $H(D,F,$){var J,B,X,Q,Y,q,G=D.tag,H=D.anchor,V={},W=Object.create(null),U=null,z=null,E=null,C=!1,L=!1,R;if(D.firstTabInLine!==-1)return!1;if(D.anchor!==null)D.anchorMap[D.anchor]=V;R=D.input.charCodeAt(D.position);while(R!==0){if(!C&&D.firstTabInLine!==-1)D.position=D.firstTabInLine,Z(D,"tab characters must not be used in indentation");if(J=D.input.charCodeAt(D.position+1),X=D.line,(R===63||R===58)&&qD(J)){if(R===63){if(C)S0(D,V,W,U,z,null,Q,Y,q),U=z=E=null;L=!0,C=!0,B=!0}else if(C)C=!1,B=!0;else Z(D,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line");D.position+=1,R=J}else{if(Q=D.line,Y=D.lineStart,q=D.position,!b0(D,$,o4,!1,!0))break;if(D.line===X){R=D.input.charCodeAt(D.position);while(c2(R))R=D.input.charCodeAt(++D.position);if(R===58){if(R=D.input.charCodeAt(++D.position),!qD(R))Z(D,"a whitespace character is expected after the key-value separator within a block mapping");if(C)S0(D,V,W,U,z,null,Q,Y,q),U=z=E=null;L=!0,C=!1,B=!1,U=D.tag,z=D.result}else if(L)Z(D,"can not read an implicit mapping pair; a colon is missed");else return D.tag=G,D.anchor=H,!0}else if(L)Z(D,"can not read a block mapping entry; a multiline key may not be an implicit key");else return D.tag=G,D.anchor=H,!0}if(D.line===X||D.lineIndent>F){if(C)Q=D.line,Y=D.lineStart,q=D.position;if(b0(D,F,T8,!0,B))if(C)z=D.result;else E=D.result;if(!C)S0(D,V,W,U,z,E,Q,Y,q),U=z=E=null;c(D,!0,-1),R=D.input.charCodeAt(D.position)}if((D.line===X||D.lineIndent>F)&&R!==0)Z(D,"bad indentation of a mapping entry");else if(D.lineIndent<F)break}if(C)S0(D,V,W,U,z,null,Q,Y,q);if(L)D.tag=G,D.anchor=H,D.kind="mapping",D.result=V;return L}function JH(D){var F,$=!1,J=!1,B,X,Q;if(Q=D.input.charCodeAt(D.position),Q!==33)return!1;if(D.tag!==null)Z(D,"duplication of a tag property");if(Q=D.input.charCodeAt(++D.position),Q===60)$=!0,Q=D.input.charCodeAt(++D.position);else if(Q===33)J=!0,B="!!",Q=D.input.charCodeAt(++D.position);else B="!";if(F=D.position,$){do Q=D.input.charCodeAt(++D.position);while(Q!==0&&Q!==62);if(D.position<D.length)X=D.input.slice(F,D.position),Q=D.input.charCodeAt(++D.position);else Z(D,"unexpected end of the stream within a verbatim tag")}else{while(Q!==0&&!qD(Q)){if(Q===33)if(!J){if(B=D.input.slice(F-1,D.position+1),!a4.test(B))Z(D,"named tag handle cannot contain such characters");J=!0,F=D.position+1}else Z(D,"tag suffix cannot contain exclamation marks");Q=D.input.charCodeAt(++D.position)}if(X=D.input.slice(F,D.position),cG.test(X))Z(D,"tag suffix cannot contain flow indicator characters")}if(X&&!t4.test(X))Z(D,"tag name cannot contain such characters: "+X);try{X=decodeURIComponent(X)}catch(Y){Z(D,"tag name is malformed: "+X)}if($)D.tag=X;else if(q2.call(D.tagMap,B))D.tag=D.tagMap[B]+X;else if(B==="!")D.tag="!"+X;else if(B==="!!")D.tag="tag:yaml.org,2002:"+X;else Z(D,'undeclared tag handle "'+B+'"');return!0}function BH(D){var F,$;if($=D.input.charCodeAt(D.position),$!==38)return!1;if(D.anchor!==null)Z(D,"duplication of an anchor property");$=D.input.charCodeAt(++D.position),F=D.position;while($!==0&&!qD($)&&!I0($))$=D.input.charCodeAt(++D.position);if(D.position===F)Z(D,"name of an anchor node must contain at least one character");return D.anchor=D.input.slice(F,D.position),!0}function XH(D){var F,$,J;if(J=D.input.charCodeAt(D.position),J!==42)return!1;J=D.input.charCodeAt(++D.position),F=D.position;while(J!==0&&!qD(J)&&!I0(J))J=D.input.charCodeAt(++D.position);if(D.position===F)Z(D,"name of an alias node must contain at least one character");if($=D.input.slice(F,D.position),!q2.call(D.anchorMap,$))Z(D,'unidentified alias "'+$+'"');return D.result=D.anchorMap[$],c(D,!0,-1),!0}function b0(D,F,$,J,B){var X,Q,Y,q=1,G=!1,H=!1,V,W,U,z,E,C;if(D.listener!==null)D.listener("open",D);if(D.tag=null,D.anchor=null,D.kind=null,D.result=null,X=Q=Y=T8===$||s4===$,J){if(c(D,!0,-1)){if(G=!0,D.lineIndent>F)q=1;else if(D.lineIndent===F)q=0;else if(D.lineIndent<F)q=-1}}if(q===1)while(JH(D)||BH(D))if(c(D,!0,-1)){if(G=!0,Y=X,D.lineIndent>F)q=1;else if(D.lineIndent===F)q=0;else if(D.lineIndent<F)q=-1}else Y=!1;if(Y)Y=G||B;if(q===1||T8===$){if(Z8===$||o4===$)E=F;else E=F+1;if(C=D.position-D.lineStart,q===1)if(Y&&(f4(D,C)||$H(D,C,E))||DH(D,E))H=!0;else{if(Q&&FH(D,E)||tG(D,E)||eG(D,E))H=!0;else if(XH(D)){if(H=!0,D.tag!==null||D.anchor!==null)Z(D,"alias node should not have any properties")}else if(aG(D,E,Z8===$)){if(H=!0,D.tag===null)D.tag="?"}if(D.anchor!==null)D.anchorMap[D.anchor]=D.result}else if(q===0)H=Y&&f4(D,C)}if(D.tag===null){if(D.anchor!==null)D.anchorMap[D.anchor]=D.result}else if(D.tag==="?"){if(D.result!==null&&D.kind!=="scalar")Z(D,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+D.kind+'"');for(V=0,W=D.implicitTypes.length;V<W;V+=1)if(z=D.implicitTypes[V],z.resolve(D.result)){if(D.result=z.construct(D.result),D.tag=z.tag,D.anchor!==null)D.anchorMap[D.anchor]=D.result;break}}else if(D.tag!=="!"){if(q2.call(D.typeMap[D.kind||"fallback"],D.tag))z=D.typeMap[D.kind||"fallback"][D.tag];else{z=null,U=D.typeMap.multi[D.kind||"fallback"];for(V=0,W=U.length;V<W;V+=1)if(D.tag.slice(0,U[V].tag.length)===U[V].tag){z=U[V];break}}if(!z)Z(D,"unknown tag !<"+D.tag+">");if(D.result!==null&&z.kind!==D.kind)Z(D,"unacceptable node kind for !<"+D.tag+'> tag; it should be "'+z.kind+'", not "'+D.kind+'"');if(!z.resolve(D.result,D.tag))Z(D,"cannot resolve a node with !<"+D.tag+"> explicit tag");else if(D.result=z.construct(D.result,D.tag),D.anchor!==null)D.anchorMap[D.anchor]=D.result}if(D.listener!==null)D.listener("close",D);return D.tag!==null||D.anchor!==null||H}function QH(D){var F=D.position,$,J,B,X=!1,Q;D.version=null,D.checkLineBreaks=D.legacy,D.tagMap=Object.create(null),D.anchorMap=Object.create(null);while((Q=D.input.charCodeAt(D.position))!==0){if(c(D,!0,-1),Q=D.input.charCodeAt(D.position),D.lineIndent>0||Q!==37)break;X=!0,Q=D.input.charCodeAt(++D.position),$=D.position;while(Q!==0&&!qD(Q))Q=D.input.charCodeAt(++D.position);if(J=D.input.slice($,D.position),B=[],J.length<1)Z(D,"directive name must not be less than one character in length");while(Q!==0){while(c2(Q))Q=D.input.charCodeAt(++D.position);if(Q===35){do Q=D.input.charCodeAt(++D.position);while(Q!==0&&!fD(Q));break}if(fD(Q))break;$=D.position;while(Q!==0&&!qD(Q))Q=D.input.charCodeAt(++D.position);B.push(D.input.slice($,D.position))}if(Q!==0)P1(D);if(q2.call(k4,J))k4[J](D,J,B);else N8(D,'unknown document directive "'+J+'"')}if(c(D,!0,-1),D.lineIndent===0&&D.input.charCodeAt(D.position)===45&&D.input.charCodeAt(D.position+1)===45&&D.input.charCodeAt(D.position+2)===45)D.position+=3,c(D,!0,-1);else if(X)Z(D,"directives end mark is expected");if(b0(D,D.lineIndent-1,T8,!1,!0),c(D,!0,-1),D.checkLineBreaks&&dG.test(D.input.slice(F,D.position)))N8(D,"non-ASCII line breaks are interpreted as content");if(D.documents.push(D.result),D.position===D.lineStart&&b8(D)){if(D.input.charCodeAt(D.position)===46)D.position+=3,c(D,!0,-1);return}if(D.position<D.length-1)Z(D,"end of the stream or a document separator is expected");else return}function JF(D,F){if(D=String(D),F=F||{},D.length!==0){if(D.charCodeAt(D.length-1)!==10&&D.charCodeAt(D.length-1)!==13)D+=`
69
+ `,X?1+q:q);X=!0,Q=!0,q=0,$=D.position;while(!uD(V)&&V!==0)V=D.input.charCodeAt(++D.position);Y2(D,$,D.position,!1)}return!0}function f4(D,F){var $,J=D.tag,B=D.anchor,X=[],Q,Y=!1,q;if(D.firstTabInLine!==-1)return!1;if(D.anchor!==null)D.anchorMap[D.anchor]=X;q=D.input.charCodeAt(D.position);while(q!==0){if(D.firstTabInLine!==-1)D.position=D.firstTabInLine,Z(D,"tab characters must not be used in indentation");if(q!==45)break;if(Q=D.input.charCodeAt(D.position+1),!qD(Q))break;if(Y=!0,D.position++,c(D,!0,-1)){if(D.lineIndent<=F){X.push(null),q=D.input.charCodeAt(D.position);continue}}if($=D.line,b0(D,F,s4,!1,!0),X.push(D.result),c(D,!0,-1),q=D.input.charCodeAt(D.position),(D.line===$||D.lineIndent>F)&&q!==0)Z(D,"bad indentation of a sequence entry");else if(D.lineIndent<F)break}if(Y)return D.tag=J,D.anchor=B,D.kind="sequence",D.result=X,!0;return!1}function $H(D,F,$){var J,B,X,Q,Y,q,G=D.tag,H=D.anchor,V={},W=Object.create(null),U=null,z=null,E=null,C=!1,L=!1,R;if(D.firstTabInLine!==-1)return!1;if(D.anchor!==null)D.anchorMap[D.anchor]=V;R=D.input.charCodeAt(D.position);while(R!==0){if(!C&&D.firstTabInLine!==-1)D.position=D.firstTabInLine,Z(D,"tab characters must not be used in indentation");if(J=D.input.charCodeAt(D.position+1),X=D.line,(R===63||R===58)&&qD(J)){if(R===63){if(C)S0(D,V,W,U,z,null,Q,Y,q),U=z=E=null;L=!0,C=!0,B=!0}else if(C)C=!1,B=!0;else Z(D,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line");D.position+=1,R=J}else{if(Q=D.line,Y=D.lineStart,q=D.position,!b0(D,$,o4,!1,!0))break;if(D.line===X){R=D.input.charCodeAt(D.position);while(c2(R))R=D.input.charCodeAt(++D.position);if(R===58){if(R=D.input.charCodeAt(++D.position),!qD(R))Z(D,"a whitespace character is expected after the key-value separator within a block mapping");if(C)S0(D,V,W,U,z,null,Q,Y,q),U=z=E=null;L=!0,C=!1,B=!1,U=D.tag,z=D.result}else if(L)Z(D,"can not read an implicit mapping pair; a colon is missed");else return D.tag=G,D.anchor=H,!0}else if(L)Z(D,"can not read a block mapping entry; a multiline key may not be an implicit key");else return D.tag=G,D.anchor=H,!0}if(D.line===X||D.lineIndent>F){if(C)Q=D.line,Y=D.lineStart,q=D.position;if(b0(D,F,T8,!0,B))if(C)z=D.result;else E=D.result;if(!C)S0(D,V,W,U,z,E,Q,Y,q),U=z=E=null;c(D,!0,-1),R=D.input.charCodeAt(D.position)}if((D.line===X||D.lineIndent>F)&&R!==0)Z(D,"bad indentation of a mapping entry");else if(D.lineIndent<F)break}if(C)S0(D,V,W,U,z,null,Q,Y,q);if(L)D.tag=G,D.anchor=H,D.kind="mapping",D.result=V;return L}function JH(D){var F,$=!1,J=!1,B,X,Q;if(Q=D.input.charCodeAt(D.position),Q!==33)return!1;if(D.tag!==null)Z(D,"duplication of a tag property");if(Q=D.input.charCodeAt(++D.position),Q===60)$=!0,Q=D.input.charCodeAt(++D.position);else if(Q===33)J=!0,B="!!",Q=D.input.charCodeAt(++D.position);else B="!";if(F=D.position,$){do Q=D.input.charCodeAt(++D.position);while(Q!==0&&Q!==62);if(D.position<D.length)X=D.input.slice(F,D.position),Q=D.input.charCodeAt(++D.position);else Z(D,"unexpected end of the stream within a verbatim tag")}else{while(Q!==0&&!qD(Q)){if(Q===33)if(!J){if(B=D.input.slice(F-1,D.position+1),!a4.test(B))Z(D,"named tag handle cannot contain such characters");J=!0,F=D.position+1}else Z(D,"tag suffix cannot contain exclamation marks");Q=D.input.charCodeAt(++D.position)}if(X=D.input.slice(F,D.position),cG.test(X))Z(D,"tag suffix cannot contain flow indicator characters")}if(X&&!t4.test(X))Z(D,"tag name cannot contain such characters: "+X);try{X=decodeURIComponent(X)}catch(Y){Z(D,"tag name is malformed: "+X)}if($)D.tag=X;else if(q2.call(D.tagMap,B))D.tag=D.tagMap[B]+X;else if(B==="!")D.tag="!"+X;else if(B==="!!")D.tag="tag:yaml.org,2002:"+X;else Z(D,'undeclared tag handle "'+B+'"');return!0}function BH(D){var F,$;if($=D.input.charCodeAt(D.position),$!==38)return!1;if(D.anchor!==null)Z(D,"duplication of an anchor property");$=D.input.charCodeAt(++D.position),F=D.position;while($!==0&&!qD($)&&!I0($))$=D.input.charCodeAt(++D.position);if(D.position===F)Z(D,"name of an anchor node must contain at least one character");return D.anchor=D.input.slice(F,D.position),!0}function XH(D){var F,$,J;if(J=D.input.charCodeAt(D.position),J!==42)return!1;J=D.input.charCodeAt(++D.position),F=D.position;while(J!==0&&!qD(J)&&!I0(J))J=D.input.charCodeAt(++D.position);if(D.position===F)Z(D,"name of an alias node must contain at least one character");if($=D.input.slice(F,D.position),!q2.call(D.anchorMap,$))Z(D,'unidentified alias "'+$+'"');return D.result=D.anchorMap[$],c(D,!0,-1),!0}function b0(D,F,$,J,B){var X,Q,Y,q=1,G=!1,H=!1,V,W,U,z,E,C;if(D.listener!==null)D.listener("open",D);if(D.tag=null,D.anchor=null,D.kind=null,D.result=null,X=Q=Y=T8===$||s4===$,J){if(c(D,!0,-1)){if(G=!0,D.lineIndent>F)q=1;else if(D.lineIndent===F)q=0;else if(D.lineIndent<F)q=-1}}if(q===1)while(JH(D)||BH(D))if(c(D,!0,-1)){if(G=!0,Y=X,D.lineIndent>F)q=1;else if(D.lineIndent===F)q=0;else if(D.lineIndent<F)q=-1}else Y=!1;if(Y)Y=G||B;if(q===1||T8===$){if(Z8===$||o4===$)E=F;else E=F+1;if(C=D.position-D.lineStart,q===1)if(Y&&(f4(D,C)||$H(D,C,E))||DH(D,E))H=!0;else{if(Q&&FH(D,E)||tG(D,E)||eG(D,E))H=!0;else if(XH(D)){if(H=!0,D.tag!==null||D.anchor!==null)Z(D,"alias node should not have any properties")}else if(aG(D,E,Z8===$)){if(H=!0,D.tag===null)D.tag="?"}if(D.anchor!==null)D.anchorMap[D.anchor]=D.result}else if(q===0)H=Y&&f4(D,C)}if(D.tag===null){if(D.anchor!==null)D.anchorMap[D.anchor]=D.result}else if(D.tag==="?"){if(D.result!==null&&D.kind!=="scalar")Z(D,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+D.kind+'"');for(V=0,W=D.implicitTypes.length;V<W;V+=1)if(z=D.implicitTypes[V],z.resolve(D.result)){if(D.result=z.construct(D.result),D.tag=z.tag,D.anchor!==null)D.anchorMap[D.anchor]=D.result;break}}else if(D.tag!=="!"){if(q2.call(D.typeMap[D.kind||"fallback"],D.tag))z=D.typeMap[D.kind||"fallback"][D.tag];else{z=null,U=D.typeMap.multi[D.kind||"fallback"];for(V=0,W=U.length;V<W;V+=1)if(D.tag.slice(0,U[V].tag.length)===U[V].tag){z=U[V];break}}if(!z)Z(D,"unknown tag !<"+D.tag+">");if(D.result!==null&&z.kind!==D.kind)Z(D,"unacceptable node kind for !<"+D.tag+'> tag; it should be "'+z.kind+'", not "'+D.kind+'"');if(!z.resolve(D.result,D.tag))Z(D,"cannot resolve a node with !<"+D.tag+"> explicit tag");else if(D.result=z.construct(D.result,D.tag),D.anchor!==null)D.anchorMap[D.anchor]=D.result}if(D.listener!==null)D.listener("close",D);return D.tag!==null||D.anchor!==null||H}function QH(D){var F=D.position,$,J,B,X=!1,Q;D.version=null,D.checkLineBreaks=D.legacy,D.tagMap=Object.create(null),D.anchorMap=Object.create(null);while((Q=D.input.charCodeAt(D.position))!==0){if(c(D,!0,-1),Q=D.input.charCodeAt(D.position),D.lineIndent>0||Q!==37)break;X=!0,Q=D.input.charCodeAt(++D.position),$=D.position;while(Q!==0&&!qD(Q))Q=D.input.charCodeAt(++D.position);if(J=D.input.slice($,D.position),B=[],J.length<1)Z(D,"directive name must not be less than one character in length");while(Q!==0){while(c2(Q))Q=D.input.charCodeAt(++D.position);if(Q===35){do Q=D.input.charCodeAt(++D.position);while(Q!==0&&!uD(Q));break}if(uD(Q))break;$=D.position;while(Q!==0&&!qD(Q))Q=D.input.charCodeAt(++D.position);B.push(D.input.slice($,D.position))}if(Q!==0)P1(D);if(q2.call(k4,J))k4[J](D,J,B);else N8(D,'unknown document directive "'+J+'"')}if(c(D,!0,-1),D.lineIndent===0&&D.input.charCodeAt(D.position)===45&&D.input.charCodeAt(D.position+1)===45&&D.input.charCodeAt(D.position+2)===45)D.position+=3,c(D,!0,-1);else if(X)Z(D,"directives end mark is expected");if(b0(D,D.lineIndent-1,T8,!1,!0),c(D,!0,-1),D.checkLineBreaks&&dG.test(D.input.slice(F,D.position)))N8(D,"non-ASCII line breaks are interpreted as content");if(D.documents.push(D.result),D.position===D.lineStart&&b8(D)){if(D.input.charCodeAt(D.position)===46)D.position+=3,c(D,!0,-1);return}if(D.position<D.length-1)Z(D,"end of the stream or a document separator is expected");else return}function JF(D,F){if(D=String(D),F=F||{},D.length!==0){if(D.charCodeAt(D.length-1)!==10&&D.charCodeAt(D.length-1)!==13)D+=`
70
70
  `;if(D.charCodeAt(0)===65279)D=D.slice(1)}var $=new sG(D,F),J=D.indexOf("\x00");if(J!==-1)$.position=J,Z($,"null byte is not allowed in input");$.input+="\x00";while($.input.charCodeAt($.position)===32)$.lineIndent+=1,$.position+=1;while($.position<$.length-1)QH($);return $.documents}function YH(D,F,$){if(F!==null&&typeof F==="object"&&typeof $>"u")$=F,F=null;var J=JF(D,$);if(typeof F!=="function")return J;for(var B=0,X=J.length;B<X;B+=1)F(J[B])}function qH(D,F){var $=JF(D,F);if($.length===0)return;else if($.length===1)return $[0];throw new YD("expected a single document in the stream, but found more")}function SH(D,F){var $,J,B,X,Q,Y,q;if(F===null)return{};$={},J=Object.keys(F);for(B=0,X=J.length;B<X;B+=1){if(Q=J[B],Y=String(F[Q]),Q.slice(0,2)==="!!")Q="tag:yaml.org,2002:"+Q.slice(2);if(q=D.compiledTypeMap.fallback[Q],q&&QF.call(q.styleAliases,Y))Y=q.styleAliases[Y];$[Q]=Y}return $}function bH(D){var F,$,J;if(F=D.toString(16).toUpperCase(),D<=255)$="x",J=2;else if(D<=65535)$="u",J=4;else if(D<=4294967295)$="U",J=8;else throw new YD("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+$+i.repeat("0",J-F.length)+F}function vH(D){this.schema=D.schema||n4,this.indent=Math.max(1,D.indent||2),this.noArrayIndent=D.noArrayIndent||!1,this.skipInvalid=D.skipInvalid||!1,this.flowLevel=i.isNothing(D.flowLevel)?-1:D.flowLevel,this.styleMap=SH(this.schema,D.styles||null),this.sortKeys=D.sortKeys||!1,this.lineWidth=D.lineWidth||80,this.noRefs=D.noRefs||!1,this.noCompatMode=D.noCompatMode||!1,this.condenseFlow=D.condenseFlow||!1,this.quotingType=D.quotingType==='"'?U3:PH,this.forceQuotes=D.forceQuotes||!1,this.replacer=typeof D.replacer==="function"?D.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function u4(D,F){var $=i.repeat(" ",F),J=0,B=-1,X="",Q,Y=D.length;while(J<Y){if(B=D.indexOf(`
71
71
  `,J),B===-1)Q=D.slice(J),J=Y;else Q=D.slice(J,B+1),J=B+1;if(Q.length&&Q!==`
72
72
  `)X+=$;X+=Q}return X}function N1(D,F){return`
@@ -83,7 +83,7 @@ tmux set-option -w pane-active-border-style "fg=$COLOR"
83
83
  `,D.length-B>F&&Q>B)q+=D.slice(B,Q)+`
84
84
  `+D.slice(Q+1);else q+=D.slice(B);return q.slice(1)}function hH(D){var F="",$=0,J;for(var B=0;B<D.length;$>=65536?B+=2:B++)if($=H3(D,B),J=FD[$],!J&&z3($)){if(F+=D[B],$>=65536)F+=D[B+1]}else F+=J||bH($);return F}function gH(D,F,$){var J="",B=D.tag,X,Q,Y;for(X=0,Q=$.length;X<Q;X+=1){if(Y=$[X],D.replacer)Y=D.replacer.call($,String(X),Y);if(sD(D,F,Y,!1,!1)||typeof Y>"u"&&sD(D,F,null,!1,!1)){if(J!=="")J+=","+(!D.condenseFlow?" ":"");J+=D.dump}}D.tag=B,D.dump="["+J+"]"}function l4(D,F,$,J){var B="",X=D.tag,Q,Y,q;for(Q=0,Y=$.length;Q<Y;Q+=1){if(q=$[Q],D.replacer)q=D.replacer.call($,String(Q),q);if(sD(D,F+1,q,!0,!0,!1,!0)||typeof q>"u"&&sD(D,F+1,null,!0,!0,!1,!0)){if(!J||B!=="")B+=N1(D,F);if(D.dump&&W3===D.dump.charCodeAt(0))B+="-";else B+="- ";B+=D.dump}}D.tag=X,D.dump=B||"[]"}function mH(D,F,$){var J="",B=D.tag,X=Object.keys($),Q,Y,q,G,H;for(Q=0,Y=X.length;Q<Y;Q+=1){if(H="",J!=="")H+=", ";if(D.condenseFlow)H+='"';if(q=X[Q],G=$[q],D.replacer)G=D.replacer.call($,q,G);if(!sD(D,F,q,!1,!1))continue;if(D.dump.length>1024)H+="? ";if(H+=D.dump+(D.condenseFlow?'"':"")+":"+(D.condenseFlow?"":" "),!sD(D,F,G,!1,!1))continue;H+=D.dump,J+=H}D.tag=B,D.dump="{"+J+"}"}function lH(D,F,$,J){var B="",X=D.tag,Q=Object.keys($),Y,q,G,H,V,W;if(D.sortKeys===!0)Q.sort();else if(typeof D.sortKeys==="function")Q.sort(D.sortKeys);else if(D.sortKeys)throw new YD("sortKeys must be a boolean or a function");for(Y=0,q=Q.length;Y<q;Y+=1){if(W="",!J||B!=="")W+=N1(D,F);if(G=Q[Y],H=$[G],D.replacer)H=D.replacer.call($,G,H);if(!sD(D,F+1,G,!0,!0,!0))continue;if(V=D.tag!==null&&D.tag!=="?"||D.dump&&D.dump.length>1024,V)if(D.dump&&W3===D.dump.charCodeAt(0))W+="?";else W+="? ";if(W+=D.dump,V)W+=N1(D,F);if(!sD(D,F+1,H,!0,V))continue;if(D.dump&&W3===D.dump.charCodeAt(0))W+=":";else W+=": ";W+=D.dump,B+=W}D.tag=X,D.dump=B||"{}"}function p4(D,F,$){var J,B,X,Q,Y,q;B=$?D.explicitTypes:D.implicitTypes;for(X=0,Q=B.length;X<Q;X+=1)if(Y=B[X],(Y.instanceOf||Y.predicate)&&(!Y.instanceOf||typeof F==="object"&&F instanceof Y.instanceOf)&&(!Y.predicate||Y.predicate(F))){if($)if(Y.multi&&Y.representName)D.tag=Y.representName(F);else D.tag=Y.tag;else D.tag="?";if(Y.represent){if(q=D.styleMap[Y.tag]||Y.defaultStyle,XF.call(Y.represent)==="[object Function]")J=Y.represent(F,q);else if(QF.call(Y.represent,q))J=Y.represent[q](F,q);else throw new YD("!<"+Y.tag+'> tag resolver accepts not "'+q+'" style');D.dump=J}return!0}return!1}function sD(D,F,$,J,B,X,Q){if(D.tag=null,D.dump=$,!p4(D,$,!1))p4(D,$,!0);var Y=XF.call(D.dump),q=J,G;if(J)J=D.flowLevel<0||D.flowLevel>F;var H=Y==="[object Object]"||Y==="[object Array]",V,W;if(H)V=D.duplicates.indexOf($),W=V!==-1;if(D.tag!==null&&D.tag!=="?"||W||D.indent!==2&&F>0)B=!1;if(W&&D.usedDuplicates[V])D.dump="*ref_"+V;else{if(H&&W&&!D.usedDuplicates[V])D.usedDuplicates[V]=!0;if(Y==="[object Object]"){if(J&&Object.keys(D.dump).length!==0){if(lH(D,F,D.dump,B),W)D.dump="&ref_"+V+D.dump}else if(mH(D,F,D.dump),W)D.dump="&ref_"+V+" "+D.dump}else if(Y==="[object Array]"){if(J&&D.dump.length!==0){if(D.noArrayIndent&&!Q&&F>0)l4(D,F-1,D.dump,B);else l4(D,F,D.dump,B);if(W)D.dump="&ref_"+V+D.dump}else if(gH(D,F,D.dump),W)D.dump="&ref_"+V+" "+D.dump}else if(Y==="[object String]"){if(D.tag!=="?")xH(D,D.dump,F,X,q)}else if(Y==="[object Undefined]")return!1;else{if(D.skipInvalid)return!1;throw new YD("unacceptable kind of an object to dump "+Y)}if(D.tag!==null&&D.tag!=="?"){if(G=encodeURI(D.tag[0]==="!"?D.tag.slice(1):D.tag).replace(/!/g,"%21"),D.tag[0]==="!")G="!"+G;else if(G.slice(0,18)==="tag:yaml.org,2002:")G="!!"+G.slice(18);else G="!<"+G+">";D.dump=G+" "+D.dump}}return!0}function pH(D,F){var $=[],J=[],B,X;S1(D,$,J);for(B=0,X=J.length;B<X;B+=1)F.duplicates.push($[J[B]]);F.usedDuplicates=Array(X)}function S1(D,F,$){var J,B,X;if(D!==null&&typeof D==="object")if(B=F.indexOf(D),B!==-1){if($.indexOf(B)===-1)$.push(B)}else if(F.push(D),Array.isArray(D))for(B=0,X=D.length;B<X;B+=1)S1(D[B],F,$);else{J=Object.keys(D);for(B=0,X=J.length;B<X;B+=1)S1(D[J[B]],F,$)}}function dH(D,F){F=F||{};var $=new vH(F);if(!$.noRefs)pH(D,$);var J=D;if($.replacer)J=$.replacer.call({"":J},"",J);if(sD($,0,J,!0,!0))return $.dump+`
85
85
  `;return""}function w1(D,F){return function(){throw Error("Function yaml."+D+" is removed in js-yaml 4. Use yaml."+F+" instead, which is now safe by default.")}}var bq,Pq,vq,kq,wq,fq,i,YD,xq,yq,hq,DD,pq,dq,cq,iq,rq,aq,FG,qG,GG,WG,KG,MG,EG,i4,r4,CG,_G,b1=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
86
- \r`,IG,SG,bG,kG,wG,xG,yG,mG,n4,q2,Z8=1,o4=2,s4=3,T8=4,L1=1,lG=2,b4=3,pG,dG,cG,a4,t4,DF,FF,Q2,k4,GH,HH,BF,XF,QF,k1=65279,VH=9,W3=10,WH=13,UH=32,zH=33,KH=34,T1=35,MH=37,EH=38,AH=39,RH=42,YF=44,OH=45,I8=58,CH=61,jH=62,_H=63,LH=64,qF=91,GF=93,ZH=96,HF=123,TH=124,VF=125,FD,NH,IH,PH=1,U3=2,UF=1,I1=2,zF=3,KF=4,N0=5,cH,iH,MF,qR,GR,HR,VR,WR;var EF=I(()=>{/*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT */bq=d4,Pq=Zq,vq=Tq,kq=Iq,wq=Sq,fq=Nq,i={isNothing:bq,isObject:Pq,toArray:vq,repeat:kq,isNegativeZero:wq,extend:fq};V3.prototype=Object.create(Error.prototype);V3.prototype.constructor=V3;V3.prototype.toString=function(F){return this.name+": "+c4(this,F)};YD=V3;xq=uq,yq=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],hq=["scalar","sequence","mapping"];DD=mq;Z1.prototype.extend=function(F){var $=[],J=[];if(F instanceof DD)J.push(F);else if(Array.isArray(F))J=J.concat(F);else if(F&&(Array.isArray(F.implicit)||Array.isArray(F.explicit))){if(F.implicit)$=$.concat(F.implicit);if(F.explicit)J=J.concat(F.explicit)}else throw new YD("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");$.forEach(function(X){if(!(X instanceof DD))throw new YD("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(X.loadKind&&X.loadKind!=="scalar")throw new YD("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(X.multi)throw new YD("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),J.forEach(function(X){if(!(X instanceof DD))throw new YD("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var B=Object.create(Z1.prototype);return B.implicit=(this.implicit||[]).concat($),B.explicit=(this.explicit||[]).concat(J),B.compiledImplicit=S4(B,"implicit"),B.compiledExplicit=S4(B,"explicit"),B.compiledTypeMap=lq(B.compiledImplicit,B.compiledExplicit),B};pq=Z1,dq=new DD("tag:yaml.org,2002:str",{kind:"scalar",construct:function(D){return D!==null?D:""}}),cq=new DD("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(D){return D!==null?D:[]}}),iq=new DD("tag:yaml.org,2002:map",{kind:"mapping",construct:function(D){return D!==null?D:{}}}),rq=new pq({explicit:[dq,cq,iq]});aq=new DD("tag:yaml.org,2002:null",{kind:"scalar",resolve:nq,construct:oq,predicate:sq,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});FG=new DD("tag:yaml.org,2002:bool",{kind:"scalar",resolve:tq,construct:eq,predicate:DG,represent:{lowercase:function(D){return D?"true":"false"},uppercase:function(D){return D?"TRUE":"FALSE"},camelcase:function(D){return D?"True":"False"}},defaultStyle:"lowercase"});qG=new DD("tag:yaml.org,2002:int",{kind:"scalar",resolve:XG,construct:QG,predicate:YG,represent:{binary:function(D){return D>=0?"0b"+D.toString(2):"-0b"+D.toString(2).slice(1)},octal:function(D){return D>=0?"0o"+D.toString(8):"-0o"+D.toString(8).slice(1)},decimal:function(D){return D.toString(10)},hexadecimal:function(D){return D>=0?"0x"+D.toString(16).toUpperCase():"-0x"+D.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),GG=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");WG=/^[-+]?[0-9]+e/;KG=new DD("tag:yaml.org,2002:float",{kind:"scalar",resolve:HG,construct:VG,predicate:zG,represent:UG,defaultStyle:"lowercase"}),MG=rq.extend({implicit:[aq,FG,qG,KG]}),EG=MG,i4=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),r4=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");CG=new DD("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:AG,construct:RG,instanceOf:Date,represent:OG});_G=new DD("tag:yaml.org,2002:merge",{kind:"scalar",resolve:jG});IG=new DD("tag:yaml.org,2002:binary",{kind:"scalar",resolve:LG,construct:ZG,predicate:NG,represent:TG}),SG=Object.prototype.hasOwnProperty,bG=Object.prototype.toString;kG=new DD("tag:yaml.org,2002:omap",{kind:"sequence",resolve:PG,construct:vG}),wG=Object.prototype.toString;xG=new DD("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:fG,construct:uG}),yG=Object.prototype.hasOwnProperty;mG=new DD("tag:yaml.org,2002:set",{kind:"mapping",resolve:hG,construct:gG}),n4=EG.extend({implicit:[CG,_G],explicit:[IG,kG,xG,mG]}),q2=Object.prototype.hasOwnProperty,pG=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,dG=/[\x85\u2028\u2029]/,cG=/[,\[\]\{\}]/,a4=/^(?:!|!!|![a-z\-]+!)$/i,t4=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;DF=Array(256),FF=Array(256);for(Q2=0;Q2<256;Q2++)DF[Q2]=v4(Q2)?1:0,FF[Q2]=v4(Q2);k4={YAML:function(F,$,J){var B,X,Q;if(F.version!==null)Z(F,"duplication of %YAML directive");if(J.length!==1)Z(F,"YAML directive accepts exactly one argument");if(B=/^([0-9]+)\.([0-9]+)$/.exec(J[0]),B===null)Z(F,"ill-formed argument of the YAML directive");if(X=parseInt(B[1],10),Q=parseInt(B[2],10),X!==1)Z(F,"unacceptable YAML version of the document");if(F.version=J[0],F.checkLineBreaks=Q<2,Q!==1&&Q!==2)N8(F,"unsupported YAML version of the document")},TAG:function(F,$,J){var B,X;if(J.length!==2)Z(F,"TAG directive accepts exactly two arguments");if(B=J[0],X=J[1],!a4.test(B))Z(F,"ill-formed tag handle (first argument) of the TAG directive");if(q2.call(F.tagMap,B))Z(F,'there is a previously declared suffix for "'+B+'" tag handle');if(!t4.test(X))Z(F,"ill-formed tag prefix (second argument) of the TAG directive");try{X=decodeURIComponent(X)}catch(Q){Z(F,"tag prefix is malformed: "+X)}F.tagMap[B]=X}};GH=YH,HH=qH,BF={loadAll:GH,load:HH},XF=Object.prototype.toString,QF=Object.prototype.hasOwnProperty,FD={};FD[0]="\\0";FD[7]="\\a";FD[8]="\\b";FD[9]="\\t";FD[10]="\\n";FD[11]="\\v";FD[12]="\\f";FD[13]="\\r";FD[27]="\\e";FD[34]="\\\"";FD[92]="\\\\";FD[133]="\\N";FD[160]="\\_";FD[8232]="\\L";FD[8233]="\\P";NH=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],IH=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;cH=dH,iH={dump:cH};MF=BF.load,qR=BF.loadAll,GR=iH.dump,HR=w1("safeLoad","load"),VR=w1("safeLoadAll","loadAll"),WR=w1("safeDump","dump")});import{existsSync as f1,readFileSync as nH,readdirSync as oH,realpathSync as sH}from"fs";import{dirname as P8,join as u1,resolve as v8}from"path";function aH(){let D=sH(process.argv[1]||""),F=[v8(P8(D),".."),v8(P8(D),"..",".."),v8(P8(import.meta.dir??__dirname),"..",".."),v8(P8(import.meta.dir??__dirname),"..")];for(let $ of F)if(f1(u1($,"plugins","genie","agents")))return $;return F[0]}function tH(D){let F=D.match(/^---\n([\s\S]*?)\n---/);if(!F)return{};try{return MF(F[1])??{}}catch{return{}}}function eH(D){if(!f1(D))return[];let F=[],$;try{$=oH(D,{withFileTypes:!0})}catch{return[]}for(let J of $){if(!J.isDirectory())continue;let B=u1(D,J.name,"AGENTS.md");if(!f1(B))continue;let X=nH(B,"utf-8"),Q=tH(X),Y=Q.name||J.name,q=Y.startsWith("council");F.push({name:Y,description:Q.description||"",agentPath:B,model:Q.model==="inherit"?void 0:Q.model,promptMode:Q.promptMode||void 0,category:q?"council":"role",color:Q.color})}return F}function FV(D){return k8.find((F)=>F.name===D)??null}function RF(D){return FV(D)?.agentPath??null}var __dirname="/home/runner/_work/genie/genie/src/lib",DV,x1,AF,K3,k8;var M3=I(()=>{EF();DV=u1(aH(),"plugins","genie","agents"),x1=eH(DV),AF=x1.filter((D)=>D.category==="role"),K3=x1.filter((D)=>D.category==="council"),k8=x1});var O3={};BD(O3,{rm:()=>d1,resolve:()=>A3,ls:()=>R3,loadIdentity:()=>i1,getProjectRoot:()=>jF,get:()=>YV,edit:()=>c1,add:()=>p1});import{execSync as y1}from"child_process";import{existsSync as E3}from"fs";import{mkdir as CF,readFile as $V,writeFile as JV}from"fs/promises";import{homedir as BV}from"os";import{dirname as h1,join as H2}from"path";function XV(){return process.env.GENIE_HOME??H2(BV(),".genie")}function g1(){return H2(XV(),"agent-directory.json")}function jF(){if(process.env.GENIE_PROJECT_ROOT)return process.env.GENIE_PROJECT_ROOT;try{return y1("git rev-parse --show-toplevel",{encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim()}catch{return process.cwd()}}function _F(){try{let D=y1("git rev-parse --git-common-dir",{encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim(),F=y1("git rev-parse --show-toplevel",{encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim(),{resolve:$}=v("path"),J=$(D),B=h1(J);if(B===F)return null;return B}catch{return null}}function m1(){return H2(jF(),".genie","agents.json")}function w8(D){return D?g1():m1()}async function G2(D){try{let F=await $V(D,"utf-8");return JSON.parse(F)}catch{return{entries:{},lastUpdated:new Date().toISOString()}}}async function QV(D,F){await CF(h1(F),{recursive:!0}),D.lastUpdated=new Date().toISOString(),await JV(F,JSON.stringify(D,null,2))}async function l1(D,F){await CF(h1(D),{recursive:!0});let $=await HD(D);try{let J=await G2(D),B=await F(J);return await QV(J,D),B}finally{await $()}}async function p1(D,F){if(!D.name||D.name.trim()==="")throw Error("Agent name is required.");if(!D.dir||D.dir.trim()==="")throw Error("Agent directory (--dir) is required.");if(!E3(D.dir))throw Error(`Directory does not exist: ${D.dir}`);let $=H2(D.dir,"AGENTS.md");if(!E3($))throw Error(`AGENTS.md not found in ${D.dir}. Each agent directory must contain an AGENTS.md file.`);let J={...D,promptMode:D.promptMode??"append",registeredAt:new Date().toISOString()},B=w8(F?.global);return await l1(B,(X)=>{if(X.entries[D.name])throw Error(`Agent "${D.name}" already exists. Use "genie dir edit" to update or "genie dir rm" first.`);X.entries[D.name]=J}),J}async function d1(D,F){let $=!1,J=w8(F?.global);return await l1(J,(B)=>{if(B.entries[D])delete B.entries[D],$=!0}),$}async function A3(D){let $=(await G2(m1())).entries[D];if($)return{entry:$,builtin:!1};let J=_F();if(J){let q=H2(J,".genie","agents.json"),H=(await G2(q)).entries[D];if(H)return{entry:H,builtin:!1}}let X=(await G2(g1())).entries[D];if(X)return{entry:X,builtin:!1};let Q=AF.find((q)=>q.name===D);if(Q)return{entry:OF(Q),builtin:!0};let Y=K3.find((q)=>q.name===D);if(Y)return{entry:OF(Y),builtin:!0};return null}async function R3(){let D=[],F=new Set,$=await G2(m1());for(let X of Object.values($.entries))D.push({...X,scope:"project"}),F.add(X.name);let J=_F();if(J){let X=H2(J,".genie","agents.json"),Q=await G2(X);for(let Y of Object.values(Q.entries))if(!F.has(Y.name))D.push({...Y,scope:"project"}),F.add(Y.name)}let B=await G2(g1());for(let X of Object.values(B.entries))if(!F.has(X.name))D.push({...X,scope:"global"}),F.add(X.name);return D}async function YV(D,F){let $=w8(F?.global);return(await G2($)).entries[D]??null}async function c1(D,F,$){let J=null,B=w8($?.global);if(await l1(B,(X)=>{let Q=X.entries[D];if(!Q)throw Error(`Agent "${D}" not found in directory.`);if(F.dir){if(!E3(F.dir))throw Error(`Directory does not exist: ${F.dir}`);let Y=H2(F.dir,"AGENTS.md");if(!E3(Y))throw Error(`AGENTS.md not found in ${F.dir}.`)}Object.assign(Q,F),J=Q}),!J)throw Error(`Agent "${D}" not found in directory.`);return J}function i1(D){let F=H2(D.dir,"AGENTS.md");if(E3(F))return F;return null}function OF(D){return{name:D.name,dir:"",promptMode:D.promptMode??"append",model:D.model,roles:[],registeredAt:"(built-in)"}}var C3=I(()=>{M3();f2()});function TF(D){return HV.has(D)}var j3,HV;var r1=I(()=>{j3=["PreToolUse","PostToolUse","SessionStart","SessionEnd","TeammateIdle","TaskCompleted"],HV=new Set(["PreToolUse","UserPromptSubmit","TeammateIdle","TaskCompleted","PermissionRequest"])});function f8(D,F="mosaic"){return`select-layout -t '${D}' ${F==="vertical"?"even-horizontal":"tiled"}`}function u8(D){if(D==="vertical")return"vertical";return"mosaic"}var L3={};BD(L3,{validateBranchName:()=>kF,setTeamStatus:()=>d8,pruneStaleWorktrees:()=>wF,listTeams:()=>l8,listMembers:()=>t1,killTeamMembers:()=>p8,hireAgent:()=>m8,getTeam:()=>RD,fireAgent:()=>s1,disbandTeam:()=>a1,createTeam:()=>o1});import{existsSync as x8}from"fs";import{mkdir as SF,readFile as y8,readdir as bF,rm as RV,unlink as PF,writeFile as h8}from"fs/promises";import{homedir as OV}from"os";import _3,{join as aD}from"path";var{$:uD}=globalThis.Bun;function vF(){return process.env.GENIE_HOME??aD(OV(),".genie")}function g8(){return aD(vF(),"teams")}function CV(D){return D.replace(/\//g,"--")}function P0(D){let F=CV(_3.basename(D)===D?D:D);return aD(g8(),`${F}.json`)}function jV(D){let $=V0().terminal?.worktreeBase;if($&&$!==".worktrees"){if(_3.isAbsolute($))return $;return aD(D,$)}let J=_3.basename(D);return aD(vF(),"worktrees",J)}function kF(D){let F=[];if(/\s/.test(D))F.push("contains spaces");if(D.includes(".."))F.push('contains ".."');if(D.includes("~"))F.push('contains "~"');if(D.includes("^"))F.push('contains "^"');if(D.includes(":"))F.push('contains ":"');if(D.includes("?"))F.push('contains "?"');if(D.includes("*"))F.push('contains "*"');if(D.includes("["))F.push('contains "["');if(D.includes("\\"))F.push('contains "\\"');if(/[\x00-\x1f\x7f]/.test(D))F.push("contains control characters");if(D.endsWith(".lock"))F.push('ends with ".lock"');if(D.endsWith("/"))F.push('ends with "/"');if(D.endsWith("."))F.push('ends with "."');if(D.startsWith("-"))F.push('starts with "-"');if(F.length>0)throw Error(`Invalid team name '${D}': must be a valid git branch name (${F.join(", ")})`)}async function n1(D,F){let J=(await p()).filter((B)=>(B.role===D||B.id===D)&&(!F||B.team===F));for(let B of J){try{if(B.paneId&&B.paneId!=="inline"){let{execSync:X}=v("child_process");X(`tmux kill-pane -t ${B.paneId}`,{stdio:"ignore"})}}catch{}await wD(B.id)}}async function _V(D,F,$,J){try{await uD`git -C ${D} fetch origin ${J}`.quiet()}catch{}if(await SF(_3.dirname($),{recursive:!0}),x8($))return;let B=!1;try{await uD`git -C ${D} rev-parse --verify ${F}`.quiet(),B=!0}catch{}if(B){await uD`git -C ${D} worktree add ${$} ${F}`.quiet();return}try{await uD`git -C ${D} worktree add -b ${F} ${$} origin/${J}`.quiet()}catch{try{await uD`git -C ${D} worktree add -b ${F} ${$} ${J}`.quiet()}catch{await uD`git -C ${D} worktree add -b ${F} ${$}`.quiet()}}}async function o1(D,F,$="dev"){kF(D);let J=_3.resolve(F),B=g8();await SF(B,{recursive:!0});let X=P0(D);if(x8(X)){let H=await y8(X,"utf-8");return JSON.parse(H)}let Q=jV(J),Y=aD(Q,D);await _V(J,D,Y,$);let q=new Date().toISOString(),G={name:D,repo:J,baseBranch:$,worktreePath:Y,members:[],status:"in_progress",createdAt:q};if(R4()){G.nativeTeamsEnabled=!0;try{let H=await O4(D);G.nativeTeamParentSessionId=H.sessionId}catch{}}return await h8(X,JSON.stringify(G,null,2)),G}async function m8(D,F){let $=await RD(D);if(!$)throw Error(`Team "${D}" not found.`);let J;if(F==="council")J=K3.map((Q)=>Q.name).filter((Q)=>!$.members.includes(Q)),$.members.push(...J);else{if($.members.includes(F))return[];$.members.push(F),J=[F]}let B=P0(D);return await h8(B,JSON.stringify($,null,2)),J}async function s1(D,F){let $=await RD(D);if(!$)throw Error(`Team "${D}" not found.`);let J=$.members.indexOf(F);if(J===-1)return!1;$.members.splice(J,1);let B=P0(D);await h8(B,JSON.stringify($,null,2));try{await n1(F)}catch{}return!0}async function a1(D){let F=await RD(D);if(!F)return!1;if(F.nativeTeamsEnabled)try{await Y3(D)}catch{}for(let B of F.members)try{await n1(B,D)}catch{}let $=F.repo;if(F.worktreePath&&x8(F.worktreePath)){try{await uD`git -C ${$} worktree remove ${F.worktreePath} --force`.quiet()}catch{try{await RV(F.worktreePath,{recursive:!0,force:!0}),await uD`git -C ${$} worktree prune`.quiet()}catch{}}try{await uD`git -C ${$} config core.bare false`.quiet()}catch{}}let J=P0(D);try{await PF(J)}catch{return!1}return await wF($),!0}async function wF(D){let F=g8(),$;try{$=await bF(F)}catch{return}for(let J of $){if(!J.endsWith(".json"))continue;try{let B=await y8(aD(F,J),"utf-8"),X=JSON.parse(B);if(X.worktreePath&&!x8(X.worktreePath))await PF(aD(F,J))}catch{}}try{await uD`git -C ${D} worktree prune`.quiet()}catch{}}async function RD(D){try{let F=await y8(P0(D),"utf-8");return JSON.parse(F)}catch{return null}}async function l8(){let D=g8();try{let F=await bF(D),$=[];for(let J of F){if(!J.endsWith(".json"))continue;try{let B=await y8(aD(D,J),"utf-8");$.push(JSON.parse(B))}catch{}}return $}catch{return[]}}async function t1(D){let F=await RD(D);if(!F)return null;return F.members}async function p8(D){let F=await RD(D);if(!F)return;for(let $ of F.members)try{await n1($,D)}catch{}}async function d8(D,F){let $=P0(D),J=await HD($);try{let B=await RD(D);if(!B)throw Error(`Team "${D}" not found.`);B.status=F,await h8($,JSON.stringify(B,null,2))}finally{await J()}}var Z3=I(()=>{MD();M3();l2();f2();pD()});var yF={};BD(yF,{isTeamHooked:()=>vV,injectTeamHooks:()=>PV});import{existsSync as fF}from"fs";import{mkdir as LV,readFile as uF,writeFile as ZV}from"fs/promises";import{homedir as TV}from"os";import{join as e1}from"path";function IV(){return process.env.CLAUDE_CONFIG_DIR??e1(TV(),".claude")}function xF(D){let F=D.replace(/[^a-zA-Z0-9]/g,"-").toLowerCase();return e1(IV(),"teams",F,"settings.json")}function SV(){let D={};for(let F of j3)D[F]=[{hooks:[{type:"command",command:c8,timeout:NV}]}];return D}async function bV(D){let F={};if(fF(D))try{let Q=await uF(D,"utf-8");F=JSON.parse(Q)}catch{}let $=SV(),J=F.hooks;if(J){if(j3.every((Y)=>{return J[Y]?.some((G)=>G.hooks?.some((H)=>H.command===c8))}))return!1}let B=J?{...J}:{};for(let Q of j3){let Y=$[Q][0],q=B[Q]??[];if(!q.some((H)=>H.hooks?.some((V)=>V.command===c8)))B[Q]=[...q,Y]}F.hooks=B;let X=e1(D,"..");return await LV(X,{recursive:!0}),await ZV(D,JSON.stringify(F,null,2)),!0}async function PV(D){let F=xF(D);return bV(F)}async function vV(D){let F=xF(D);if(!fF(F))return!1;try{let $=await uF(F,"utf-8"),B=JSON.parse($).hooks;if(!B)return!1;return j3.every((X)=>{return B[X]?.some((Y)=>Y.hooks?.some((q)=>q.command===c8))})}catch{return!1}}var c8="genie hook dispatch",NV=15;var hF=I(()=>{r1()});var dF={};BD(dF,{suspendWorker:()=>pF,getIdleTimeoutMs:()=>lF,checkIdleWorkers:()=>wV,WATCHDOG_POLL_INTERVAL_MS:()=>kV});function lF(){let D=process.env.GENIE_IDLE_TIMEOUT_MS;if(D!==void 0){if(D==="")return gF;let F=Number(D);if(!Number.isNaN(F)&&F>=0)return F}return gF}async function pF(D,F=mF){let $=await F.registryGet(D);if(!$)return!1;if($.state==="suspended")return!0;if($.paneId&&$.paneId!=="inline")try{await F.executeTmux(`kill-pane -t '${$.paneId}'`)}catch{}return await F.registryUpdate(D,{state:"suspended",suspendedAt:new Date().toISOString()}),!0}async function wV(D=mF){let F=lF();if(F===0)return[];let $=await D.registryList(),J=[];for(let B of $){if(B.state!=="idle")continue;if(Date.now()-new Date(B.lastStateChange).getTime()<F)continue;if(!await D.isPaneAlive(B.paneId)){await D.registryUpdate(B.id,{state:"suspended",suspendedAt:new Date().toISOString()}),J.push(B.id);continue}if(await pF(B.id,D))J.push(B.id)}return J}var mF,gF=1800000,kV=60000;var cF=I(()=>{MD();$D();mF={registryGet:rD,registryList:p,registryUpdate:G1,executeTmux:f,isPaneAlive:TD}});var aF={};BD(aF,{handleWorkerStop:()=>F5,handleWorkerSpawn:()=>V2,handleWorkerKill:()=>D5,handleLsCommand:()=>$5});function iF(D){let{readFileSync:F,existsSync:$}=v("fs");if(!$(D))return!1;try{let J=Number.parseInt(F(D,"utf-8").trim());if(J>0)return process.kill(J,0),!0}catch{}return!1}async function fV(D){let{writeFileSync:F,mkdirSync:$}=v("fs"),{join:J}=v("path"),{homedir:B}=v("os"),X=J(B(),".genie","relay");$(X,{recursive:!0});let Q=J(X,"otel-relay.pid"),Y=J(X,"otel-relay.mjs");if(iF(Q))return!0;let q=J(process.env.CLAUDE_CONFIG_DIR??J(B(),".claude"),"teams",D,"inboxes"),G=X.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),H=q.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),V=Q.replace(/\\/g,"\\\\").replace(/'/g,"\\'");try{F(Y,`import { createServer } from 'http';
86
+ \r`,IG,SG,bG,kG,wG,xG,yG,mG,n4,q2,Z8=1,o4=2,s4=3,T8=4,L1=1,lG=2,b4=3,pG,dG,cG,a4,t4,DF,FF,Q2,k4,GH,HH,BF,XF,QF,k1=65279,VH=9,W3=10,WH=13,UH=32,zH=33,KH=34,T1=35,MH=37,EH=38,AH=39,RH=42,YF=44,OH=45,I8=58,CH=61,jH=62,_H=63,LH=64,qF=91,GF=93,ZH=96,HF=123,TH=124,VF=125,FD,NH,IH,PH=1,U3=2,UF=1,I1=2,zF=3,KF=4,N0=5,cH,iH,MF,qR,GR,HR,VR,WR;var EF=I(()=>{/*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT */bq=d4,Pq=Zq,vq=Tq,kq=Iq,wq=Sq,fq=Nq,i={isNothing:bq,isObject:Pq,toArray:vq,repeat:kq,isNegativeZero:wq,extend:fq};V3.prototype=Object.create(Error.prototype);V3.prototype.constructor=V3;V3.prototype.toString=function(F){return this.name+": "+c4(this,F)};YD=V3;xq=uq,yq=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],hq=["scalar","sequence","mapping"];DD=mq;Z1.prototype.extend=function(F){var $=[],J=[];if(F instanceof DD)J.push(F);else if(Array.isArray(F))J=J.concat(F);else if(F&&(Array.isArray(F.implicit)||Array.isArray(F.explicit))){if(F.implicit)$=$.concat(F.implicit);if(F.explicit)J=J.concat(F.explicit)}else throw new YD("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");$.forEach(function(X){if(!(X instanceof DD))throw new YD("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(X.loadKind&&X.loadKind!=="scalar")throw new YD("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(X.multi)throw new YD("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),J.forEach(function(X){if(!(X instanceof DD))throw new YD("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var B=Object.create(Z1.prototype);return B.implicit=(this.implicit||[]).concat($),B.explicit=(this.explicit||[]).concat(J),B.compiledImplicit=S4(B,"implicit"),B.compiledExplicit=S4(B,"explicit"),B.compiledTypeMap=lq(B.compiledImplicit,B.compiledExplicit),B};pq=Z1,dq=new DD("tag:yaml.org,2002:str",{kind:"scalar",construct:function(D){return D!==null?D:""}}),cq=new DD("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(D){return D!==null?D:[]}}),iq=new DD("tag:yaml.org,2002:map",{kind:"mapping",construct:function(D){return D!==null?D:{}}}),rq=new pq({explicit:[dq,cq,iq]});aq=new DD("tag:yaml.org,2002:null",{kind:"scalar",resolve:nq,construct:oq,predicate:sq,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});FG=new DD("tag:yaml.org,2002:bool",{kind:"scalar",resolve:tq,construct:eq,predicate:DG,represent:{lowercase:function(D){return D?"true":"false"},uppercase:function(D){return D?"TRUE":"FALSE"},camelcase:function(D){return D?"True":"False"}},defaultStyle:"lowercase"});qG=new DD("tag:yaml.org,2002:int",{kind:"scalar",resolve:XG,construct:QG,predicate:YG,represent:{binary:function(D){return D>=0?"0b"+D.toString(2):"-0b"+D.toString(2).slice(1)},octal:function(D){return D>=0?"0o"+D.toString(8):"-0o"+D.toString(8).slice(1)},decimal:function(D){return D.toString(10)},hexadecimal:function(D){return D>=0?"0x"+D.toString(16).toUpperCase():"-0x"+D.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),GG=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");WG=/^[-+]?[0-9]+e/;KG=new DD("tag:yaml.org,2002:float",{kind:"scalar",resolve:HG,construct:VG,predicate:zG,represent:UG,defaultStyle:"lowercase"}),MG=rq.extend({implicit:[aq,FG,qG,KG]}),EG=MG,i4=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),r4=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");CG=new DD("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:AG,construct:RG,instanceOf:Date,represent:OG});_G=new DD("tag:yaml.org,2002:merge",{kind:"scalar",resolve:jG});IG=new DD("tag:yaml.org,2002:binary",{kind:"scalar",resolve:LG,construct:ZG,predicate:NG,represent:TG}),SG=Object.prototype.hasOwnProperty,bG=Object.prototype.toString;kG=new DD("tag:yaml.org,2002:omap",{kind:"sequence",resolve:PG,construct:vG}),wG=Object.prototype.toString;xG=new DD("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:fG,construct:uG}),yG=Object.prototype.hasOwnProperty;mG=new DD("tag:yaml.org,2002:set",{kind:"mapping",resolve:hG,construct:gG}),n4=EG.extend({implicit:[CG,_G],explicit:[IG,kG,xG,mG]}),q2=Object.prototype.hasOwnProperty,pG=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,dG=/[\x85\u2028\u2029]/,cG=/[,\[\]\{\}]/,a4=/^(?:!|!!|![a-z\-]+!)$/i,t4=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;DF=Array(256),FF=Array(256);for(Q2=0;Q2<256;Q2++)DF[Q2]=v4(Q2)?1:0,FF[Q2]=v4(Q2);k4={YAML:function(F,$,J){var B,X,Q;if(F.version!==null)Z(F,"duplication of %YAML directive");if(J.length!==1)Z(F,"YAML directive accepts exactly one argument");if(B=/^([0-9]+)\.([0-9]+)$/.exec(J[0]),B===null)Z(F,"ill-formed argument of the YAML directive");if(X=parseInt(B[1],10),Q=parseInt(B[2],10),X!==1)Z(F,"unacceptable YAML version of the document");if(F.version=J[0],F.checkLineBreaks=Q<2,Q!==1&&Q!==2)N8(F,"unsupported YAML version of the document")},TAG:function(F,$,J){var B,X;if(J.length!==2)Z(F,"TAG directive accepts exactly two arguments");if(B=J[0],X=J[1],!a4.test(B))Z(F,"ill-formed tag handle (first argument) of the TAG directive");if(q2.call(F.tagMap,B))Z(F,'there is a previously declared suffix for "'+B+'" tag handle');if(!t4.test(X))Z(F,"ill-formed tag prefix (second argument) of the TAG directive");try{X=decodeURIComponent(X)}catch(Q){Z(F,"tag prefix is malformed: "+X)}F.tagMap[B]=X}};GH=YH,HH=qH,BF={loadAll:GH,load:HH},XF=Object.prototype.toString,QF=Object.prototype.hasOwnProperty,FD={};FD[0]="\\0";FD[7]="\\a";FD[8]="\\b";FD[9]="\\t";FD[10]="\\n";FD[11]="\\v";FD[12]="\\f";FD[13]="\\r";FD[27]="\\e";FD[34]="\\\"";FD[92]="\\\\";FD[133]="\\N";FD[160]="\\_";FD[8232]="\\L";FD[8233]="\\P";NH=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],IH=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;cH=dH,iH={dump:cH};MF=BF.load,qR=BF.loadAll,GR=iH.dump,HR=w1("safeLoad","load"),VR=w1("safeLoadAll","loadAll"),WR=w1("safeDump","dump")});import{existsSync as f1,readFileSync as nH,readdirSync as oH,realpathSync as sH}from"fs";import{dirname as P8,join as u1,resolve as v8}from"path";function aH(){let D=sH(process.argv[1]||""),F=[v8(P8(D),".."),v8(P8(D),"..",".."),v8(P8(import.meta.dir??__dirname),"..",".."),v8(P8(import.meta.dir??__dirname),"..")];for(let $ of F)if(f1(u1($,"plugins","genie","agents")))return $;return F[0]}function tH(D){let F=D.match(/^---\n([\s\S]*?)\n---/);if(!F)return{};try{return MF(F[1])??{}}catch{return{}}}function eH(D){if(!f1(D))return[];let F=[],$;try{$=oH(D,{withFileTypes:!0})}catch{return[]}for(let J of $){if(!J.isDirectory())continue;let B=u1(D,J.name,"AGENTS.md");if(!f1(B))continue;let X=nH(B,"utf-8"),Q=tH(X),Y=Q.name||J.name,q=Y.startsWith("council");F.push({name:Y,description:Q.description||"",agentPath:B,model:Q.model==="inherit"?void 0:Q.model,promptMode:Q.promptMode||void 0,category:q?"council":"role",color:Q.color})}return F}function FV(D){return k8.find((F)=>F.name===D)??null}function RF(D){return FV(D)?.agentPath??null}var __dirname="/home/runner/_work/genie/genie/src/lib",DV,x1,AF,K3,k8;var M3=I(()=>{EF();DV=u1(aH(),"plugins","genie","agents"),x1=eH(DV),AF=x1.filter((D)=>D.category==="role"),K3=x1.filter((D)=>D.category==="council"),k8=x1});var O3={};BD(O3,{rm:()=>d1,resolve:()=>A3,ls:()=>R3,loadIdentity:()=>i1,getProjectRoot:()=>jF,get:()=>YV,edit:()=>c1,add:()=>p1});import{execSync as y1}from"child_process";import{existsSync as E3}from"fs";import{mkdir as CF,readFile as $V,writeFile as JV}from"fs/promises";import{homedir as BV}from"os";import{dirname as h1,join as H2}from"path";function XV(){return process.env.GENIE_HOME??H2(BV(),".genie")}function g1(){return H2(XV(),"agent-directory.json")}function jF(){if(process.env.GENIE_PROJECT_ROOT)return process.env.GENIE_PROJECT_ROOT;try{return y1("git rev-parse --show-toplevel",{encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim()}catch{return process.cwd()}}function _F(){try{let D=y1("git rev-parse --git-common-dir",{encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim(),F=y1("git rev-parse --show-toplevel",{encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim(),{resolve:$}=v("path"),J=$(D),B=h1(J);if(B===F)return null;return B}catch{return null}}function m1(){return H2(jF(),".genie","agents.json")}function w8(D){return D?g1():m1()}async function G2(D){try{let F=await $V(D,"utf-8");return JSON.parse(F)}catch{return{entries:{},lastUpdated:new Date().toISOString()}}}async function QV(D,F){await CF(h1(F),{recursive:!0}),D.lastUpdated=new Date().toISOString(),await JV(F,JSON.stringify(D,null,2))}async function l1(D,F){await CF(h1(D),{recursive:!0});let $=await HD(D);try{let J=await G2(D),B=await F(J);return await QV(J,D),B}finally{await $()}}async function p1(D,F){if(!D.name||D.name.trim()==="")throw Error("Agent name is required.");if(!D.dir||D.dir.trim()==="")throw Error("Agent directory (--dir) is required.");if(!E3(D.dir))throw Error(`Directory does not exist: ${D.dir}`);let $=H2(D.dir,"AGENTS.md");if(!E3($))throw Error(`AGENTS.md not found in ${D.dir}. Each agent directory must contain an AGENTS.md file.`);let J={...D,promptMode:D.promptMode??"append",registeredAt:new Date().toISOString()},B=w8(F?.global);return await l1(B,(X)=>{if(X.entries[D.name])throw Error(`Agent "${D.name}" already exists. Use "genie dir edit" to update or "genie dir rm" first.`);X.entries[D.name]=J}),J}async function d1(D,F){let $=!1,J=w8(F?.global);return await l1(J,(B)=>{if(B.entries[D])delete B.entries[D],$=!0}),$}async function A3(D){let $=(await G2(m1())).entries[D];if($)return{entry:$,builtin:!1};let J=_F();if(J){let q=H2(J,".genie","agents.json"),H=(await G2(q)).entries[D];if(H)return{entry:H,builtin:!1}}let X=(await G2(g1())).entries[D];if(X)return{entry:X,builtin:!1};let Q=AF.find((q)=>q.name===D);if(Q)return{entry:OF(Q),builtin:!0};let Y=K3.find((q)=>q.name===D);if(Y)return{entry:OF(Y),builtin:!0};return null}async function R3(){let D=[],F=new Set,$=await G2(m1());for(let X of Object.values($.entries))D.push({...X,scope:"project"}),F.add(X.name);let J=_F();if(J){let X=H2(J,".genie","agents.json"),Q=await G2(X);for(let Y of Object.values(Q.entries))if(!F.has(Y.name))D.push({...Y,scope:"project"}),F.add(Y.name)}let B=await G2(g1());for(let X of Object.values(B.entries))if(!F.has(X.name))D.push({...X,scope:"global"}),F.add(X.name);return D}async function YV(D,F){let $=w8(F?.global);return(await G2($)).entries[D]??null}async function c1(D,F,$){let J=null,B=w8($?.global);if(await l1(B,(X)=>{let Q=X.entries[D];if(!Q)throw Error(`Agent "${D}" not found in directory.`);if(F.dir){if(!E3(F.dir))throw Error(`Directory does not exist: ${F.dir}`);let Y=H2(F.dir,"AGENTS.md");if(!E3(Y))throw Error(`AGENTS.md not found in ${F.dir}.`)}Object.assign(Q,F),J=Q}),!J)throw Error(`Agent "${D}" not found in directory.`);return J}function i1(D){let F=H2(D.dir,"AGENTS.md");if(E3(F))return F;return null}function OF(D){return{name:D.name,dir:"",promptMode:D.promptMode??"append",model:D.model,roles:[],registeredAt:"(built-in)"}}var C3=I(()=>{M3();f2()});function TF(D){return HV.has(D)}var j3,HV;var r1=I(()=>{j3=["PreToolUse","PostToolUse","SessionStart","SessionEnd","TeammateIdle","TaskCompleted"],HV=new Set(["PreToolUse","UserPromptSubmit","TeammateIdle","TaskCompleted","PermissionRequest"])});function f8(D,F="mosaic"){return`select-layout -t '${D}' ${F==="vertical"?"even-horizontal":"tiled"}`}function u8(D){if(D==="vertical")return"vertical";return"mosaic"}var L3={};BD(L3,{validateBranchName:()=>kF,setTeamStatus:()=>d8,pruneStaleWorktrees:()=>wF,listTeams:()=>l8,listMembers:()=>t1,killTeamMembers:()=>p8,hireAgent:()=>m8,getTeam:()=>RD,fireAgent:()=>s1,disbandTeam:()=>a1,createTeam:()=>o1});import{existsSync as x8}from"fs";import{mkdir as SF,readFile as y8,readdir as bF,rm as RV,unlink as PF,writeFile as h8}from"fs/promises";import{homedir as OV}from"os";import _3,{join as aD}from"path";var{$:ID}=globalThis.Bun;function vF(){return process.env.GENIE_HOME??aD(OV(),".genie")}function g8(){return aD(vF(),"teams")}function CV(D){return D.replace(/\//g,"--")}function P0(D){let F=CV(_3.basename(D)===D?D:D);return aD(g8(),`${F}.json`)}function jV(D){let $=V0().terminal?.worktreeBase;if($&&$!==".worktrees"){if(_3.isAbsolute($))return $;return aD(D,$)}let J=_3.basename(D);return aD(vF(),"worktrees",J)}function kF(D){let F=[];if(/\s/.test(D))F.push("contains spaces");if(D.includes(".."))F.push('contains ".."');if(D.includes("~"))F.push('contains "~"');if(D.includes("^"))F.push('contains "^"');if(D.includes(":"))F.push('contains ":"');if(D.includes("?"))F.push('contains "?"');if(D.includes("*"))F.push('contains "*"');if(D.includes("["))F.push('contains "["');if(D.includes("\\"))F.push('contains "\\"');if(/[\x00-\x1f\x7f]/.test(D))F.push("contains control characters");if(D.endsWith(".lock"))F.push('ends with ".lock"');if(D.endsWith("/"))F.push('ends with "/"');if(D.endsWith("."))F.push('ends with "."');if(D.startsWith("-"))F.push('starts with "-"');if(F.length>0)throw Error(`Invalid team name '${D}': must be a valid git branch name (${F.join(", ")})`)}async function n1(D,F){let J=(await p()).filter((B)=>(B.role===D||B.id===D)&&(!F||B.team===F));for(let B of J){try{if(B.paneId&&B.paneId!=="inline"){let{execSync:X}=v("child_process");X(`tmux kill-pane -t ${B.paneId}`,{stdio:"ignore"})}}catch{}await fD(B.id)}}async function _V(D,F,$,J){try{await ID`git -C ${D} fetch origin ${J}`.quiet()}catch{}if(await SF(_3.dirname($),{recursive:!0}),x8($))return;let B=!1;try{await ID`git -C ${D} rev-parse --verify ${F}`.quiet(),B=!0}catch{}if(B){await ID`git -C ${D} worktree add ${$} ${F}`.quiet();return}try{await ID`git -C ${D} worktree add -b ${F} ${$} origin/${J}`.quiet()}catch{try{await ID`git -C ${D} worktree add -b ${F} ${$} ${J}`.quiet()}catch{await ID`git -C ${D} worktree add -b ${F} ${$}`.quiet()}}}async function o1(D,F,$="dev"){kF(D);let J=_3.resolve(F),B=g8();await SF(B,{recursive:!0});let X=P0(D);if(x8(X)){let H=await y8(X,"utf-8");return JSON.parse(H)}let Q=jV(J),Y=aD(Q,D);await _V(J,D,Y,$);let q=new Date().toISOString(),G={name:D,repo:J,baseBranch:$,worktreePath:Y,members:[],status:"in_progress",createdAt:q};if(R4()){G.nativeTeamsEnabled=!0;try{let H=await O4(D);G.nativeTeamParentSessionId=H.sessionId}catch{}}return await h8(X,JSON.stringify(G,null,2)),G}async function m8(D,F){let $=await RD(D);if(!$)throw Error(`Team "${D}" not found.`);let J;if(F==="council")J=K3.map((Q)=>Q.name).filter((Q)=>!$.members.includes(Q)),$.members.push(...J);else{if($.members.includes(F))return[];$.members.push(F),J=[F]}let B=P0(D);return await h8(B,JSON.stringify($,null,2)),J}async function s1(D,F){let $=await RD(D);if(!$)throw Error(`Team "${D}" not found.`);let J=$.members.indexOf(F);if(J===-1)return!1;$.members.splice(J,1);let B=P0(D);await h8(B,JSON.stringify($,null,2));try{await n1(F)}catch{}return!0}async function a1(D){let F=await RD(D);if(!F)return!1;if(F.nativeTeamsEnabled)try{await Y3(D)}catch{}for(let B of F.members)try{await n1(B,D)}catch{}let $=F.repo;if(F.worktreePath&&x8(F.worktreePath)){try{await ID`git -C ${$} worktree remove ${F.worktreePath} --force`.quiet()}catch{try{await RV(F.worktreePath,{recursive:!0,force:!0}),await ID`git -C ${$} worktree prune`.quiet()}catch{}}try{await ID`git -C ${$} config core.bare false`.quiet()}catch{}}let J=P0(D);try{await PF(J)}catch{return!1}return await wF($),!0}async function wF(D){let F=g8(),$;try{$=await bF(F)}catch{return}for(let J of $){if(!J.endsWith(".json"))continue;try{let B=await y8(aD(F,J),"utf-8"),X=JSON.parse(B);if(X.worktreePath&&!x8(X.worktreePath))await PF(aD(F,J))}catch{}}try{await ID`git -C ${D} worktree prune`.quiet(),await ID`git -C ${D} config core.bare false`.quiet()}catch{}}async function RD(D){try{let F=await y8(P0(D),"utf-8");return JSON.parse(F)}catch{return null}}async function l8(){let D=g8();try{let F=await bF(D),$=[];for(let J of F){if(!J.endsWith(".json"))continue;try{let B=await y8(aD(D,J),"utf-8");$.push(JSON.parse(B))}catch{}}return $}catch{return[]}}async function t1(D){let F=await RD(D);if(!F)return null;return F.members}async function p8(D){let F=await RD(D);if(!F)return;for(let $ of F.members)try{await n1($,D)}catch{}}async function d8(D,F){let $=P0(D),J=await HD($);try{let B=await RD(D);if(!B)throw Error(`Team "${D}" not found.`);B.status=F,await h8($,JSON.stringify(B,null,2))}finally{await J()}}var Z3=I(()=>{MD();M3();l2();f2();pD()});var yF={};BD(yF,{isTeamHooked:()=>vV,injectTeamHooks:()=>PV});import{existsSync as fF}from"fs";import{mkdir as LV,readFile as uF,writeFile as ZV}from"fs/promises";import{homedir as TV}from"os";import{join as e1}from"path";function IV(){return process.env.CLAUDE_CONFIG_DIR??e1(TV(),".claude")}function xF(D){let F=D.replace(/[^a-zA-Z0-9]/g,"-").toLowerCase();return e1(IV(),"teams",F,"settings.json")}function SV(){let D={};for(let F of j3)D[F]=[{hooks:[{type:"command",command:c8,timeout:NV}]}];return D}async function bV(D){let F={};if(fF(D))try{let Q=await uF(D,"utf-8");F=JSON.parse(Q)}catch{}let $=SV(),J=F.hooks;if(J){if(j3.every((Y)=>{return J[Y]?.some((G)=>G.hooks?.some((H)=>H.command===c8))}))return!1}let B=J?{...J}:{};for(let Q of j3){let Y=$[Q][0],q=B[Q]??[];if(!q.some((H)=>H.hooks?.some((V)=>V.command===c8)))B[Q]=[...q,Y]}F.hooks=B;let X=e1(D,"..");return await LV(X,{recursive:!0}),await ZV(D,JSON.stringify(F,null,2)),!0}async function PV(D){let F=xF(D);return bV(F)}async function vV(D){let F=xF(D);if(!fF(F))return!1;try{let $=await uF(F,"utf-8"),B=JSON.parse($).hooks;if(!B)return!1;return j3.every((X)=>{return B[X]?.some((Y)=>Y.hooks?.some((q)=>q.command===c8))})}catch{return!1}}var c8="genie hook dispatch",NV=15;var hF=I(()=>{r1()});var dF={};BD(dF,{suspendWorker:()=>pF,getIdleTimeoutMs:()=>lF,checkIdleWorkers:()=>wV,WATCHDOG_POLL_INTERVAL_MS:()=>kV});function lF(){let D=process.env.GENIE_IDLE_TIMEOUT_MS;if(D!==void 0){if(D==="")return gF;let F=Number(D);if(!Number.isNaN(F)&&F>=0)return F}return gF}async function pF(D,F=mF){let $=await F.registryGet(D);if(!$)return!1;if($.state==="suspended")return!0;if($.paneId&&$.paneId!=="inline")try{await F.executeTmux(`kill-pane -t '${$.paneId}'`)}catch{}return await F.registryUpdate(D,{state:"suspended",suspendedAt:new Date().toISOString()}),!0}async function wV(D=mF){let F=lF();if(F===0)return[];let $=await D.registryList(),J=[];for(let B of $){if(B.state!=="idle")continue;if(Date.now()-new Date(B.lastStateChange).getTime()<F)continue;if(!await D.isPaneAlive(B.paneId)){await D.registryUpdate(B.id,{state:"suspended",suspendedAt:new Date().toISOString()}),J.push(B.id);continue}if(await pF(B.id,D))J.push(B.id)}return J}var mF,gF=1800000,kV=60000;var cF=I(()=>{MD();$D();mF={registryGet:rD,registryList:p,registryUpdate:G1,executeTmux:f,isPaneAlive:TD}});var aF={};BD(aF,{handleWorkerStop:()=>F5,handleWorkerSpawn:()=>V2,handleWorkerKill:()=>D5,handleLsCommand:()=>$5});function iF(D){let{readFileSync:F,existsSync:$}=v("fs");if(!$(D))return!1;try{let J=Number.parseInt(F(D,"utf-8").trim());if(J>0)return process.kill(J,0),!0}catch{}return!1}async function fV(D){let{writeFileSync:F,mkdirSync:$}=v("fs"),{join:J}=v("path"),{homedir:B}=v("os"),X=J(B(),".genie","relay");$(X,{recursive:!0});let Q=J(X,"otel-relay.pid"),Y=J(X,"otel-relay.mjs");if(iF(Q))return!0;let q=J(process.env.CLAUDE_CONFIG_DIR??J(B(),".claude"),"teams",D,"inboxes"),G=X.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),H=q.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),V=Q.replace(/\\/g,"\\\\").replace(/'/g,"\\'");try{F(Y,`import { createServer } from 'http';
87
87
  import { execSync } from 'child_process';
88
88
  import { readFileSync, writeFileSync, mkdirSync, readdirSync, unlinkSync, statSync } from 'fs';
89
89
  import { createHash } from 'crypto';
@@ -332,18 +332,18 @@ server.listen(PORT, '127.0.0.1', () => {
332
332
  process.on('SIGTERM', () => { server.close(); process.exit(0); });
333
333
  process.on('SIGINT', () => { server.close(); process.exit(0); });
334
334
  `,{mode:420});let{spawn:W}=v("child_process");W("node",[Y],{detached:!0,stdio:"ignore"}).unref();for(let z=0;z<30;z++)if(await new Promise((E)=>setTimeout(E,100)),iF(Q))return!0;return!1}catch{return!1}}async function uV(D,F){let $=F?`${D}-${F}`:D;if(!(await p()).some((X)=>X.id===$))return $;let B=crypto.randomUUID().slice(0,8);return`${$}-${B}`}async function nF(D,F,$){let J=D.validated.nativeTeam,B={id:D.workerId,paneId:F,session:"genie",provider:D.validated.provider,transport:D.transport,role:D.validated.role,skill:D.validated.skill,team:D.validated.team,worktree:null,startedAt:D.now,state:"spawning",lastStateChange:D.now,repoPath:D.cwd,claudeSessionId:D.claudeSessionId,nativeTeamEnabled:J?.enabled??!1,nativeAgentId:`${D.agentName}@${D.validated.team}`,nativeColor:J?.color??D.spawnColor,parentSessionId:J?.parentSessionId??D.parentSessionId,window:$?.windowName,windowName:$?.windowName,windowId:$?.windowId};return await u2(B),B}async function oF(D,F){let $=D.validated.nativeTeam;await g2(D.validated.team,{agentName:D.agentName,agentType:$?.agentType??D.validated.role??"general-purpose",color:$?.color??D.spawnColor??"blue",tmuxPaneId:F,cwd:D.cwd,planModeRequired:$?.planModeRequired}),await m2(D.validated.team,"team-lead",{from:D.agentName,text:`Worker ${D.agentName} (${D.validated.provider}) joined team ${D.validated.team}. cwd: ${D.cwd}. Ready for tasks.`,summary:`${D.agentName} (${D.validated.provider}) joined`,timestamp:new Date().toISOString(),color:$?.color??D.spawnColor??"blue",read:!1})}function xV(D,F,$,J){let{writeFileSync:B}=v("fs"),{join:X}=v("path"),{homedir:Q}=v("os"),Y=X(Q(),".genie","relay");B(X(Y,`${D}-pane`),F),B(X(Y,`${D}-meta`),JSON.stringify({agent:$,color:J}))}function yV(D,F,$){let J=D.validated.nativeTeam;if(console.log(`Agent "${D.workerId}" spawned.`),console.log(` Provider: ${D.launch.provider}`),console.log(` Command: ${D.fullCommand}`),console.log(` Team: ${D.validated.team}`),console.log(` Pane: ${F}`),D.validated.role)console.log(` Role: ${D.validated.role}`);if(D.validated.skill)console.log(` Skill: ${D.validated.skill}`);if($.claudeSessionId)console.log(` Session: ${$.claudeSessionId}`);if(console.log(` Layout: ${D.layoutMode}`),J?.enabled)console.log(" Native: enabled"),console.log(` AgentID: ${$.nativeAgentId}`),console.log(` Color: ${J.color}`);if(D.otelRelayActive)console.log(` OTel: relay on port ${O0}`)}async function hV(D,F){if(!D)return null;try{return await d2("genie",D,F)}catch($){return console.warn(`Warning: could not ensure team window for "${D}": ${$ instanceof Error?$.message:$}`),null}}function gV(D,F){let{execSync:$}=v("child_process");if(F?.created){let Q=$(`tmux list-panes -t '${F.windowId}' -F '#{pane_id}'`,{encoding:"utf-8"}).trim().split(`
335
- `)[0];if(D.cwd)$(`tmux send-keys -t '${Q}' 'cd ${D.cwd.replace(/'/g,"'\\''")}' Enter`,{encoding:"utf-8"});return $(`tmux send-keys -t '${Q}' '${D.fullCommand.replace(/'/g,"'\\''")}' Enter`,{encoding:"utf-8"}),Q}let J=F?`-t '${F.windowId}'`:"",B=D.cwd?`-c '${D.cwd}'`:"",X=`tmux split-window -d ${J} ${B} -P -F '#{pane_id}' ${D.fullCommand}`;return $(X,{encoding:"utf-8"}).trim()}async function mV(D,F){let{execSync:$}=v("child_process"),J="genie",B=`genie:${F?.windowName??""}`;if(!F){let X=await ED("genie");B=X[0]?X[0].id:"genie:"}try{$(`tmux ${f8(B,D.layoutMode)}`,{stdio:"ignore"})}catch{}}async function lV(D){let F=D.spawnIntoCurrentWindow?null:await hV(D.validated.team,D.cwd),$;try{$=gV(D,F)}catch(B){console.error(`Failed to create tmux pane: ${B instanceof Error?B.message:"unknown error"}`),process.exit(1)}await mV(D,F);let J=await nF(D,$,F);if(await oF(D,$),D.spawnColor&&$!=="inline")await G3($,D.spawnColor,F?.windowId);if(await L0({id:D.validated.role??D.workerId,provider:D.validated.provider,team:D.validated.team,role:D.validated.role,skill:D.validated.skill,cwd:D.cwd,extraArgs:D.extraArgs,nativeTeamEnabled:J.nativeTeamEnabled,lastSpawnedAt:new Date().toISOString(),lastSessionId:J.claudeSessionId}),D.otelRelayActive&&$!=="%0")xV(D.workerId,$,D.agentName,D.spawnColor);if(F)console.log(` Window: ${F.windowName} (${F.windowId})`);yV(D,$,J)}async function pV(D){let F=D.validated.nativeTeam,$="inline",J=await nF(D,"inline");if(await oF(D,"inline"),console.log(`Agent "${D.workerId}" starting inline...`),console.log(` Provider: ${D.launch.provider} | Team: ${D.validated.team} | Role: ${D.validated.role??"-"}`),F?.enabled)console.log(` Native: enabled | AgentID: ${J.nativeAgentId}`);console.log("");let{spawnSync:B}=v("child_process"),X={...process.env,...D.launch.env??{}},Q=B("sh",["-c",D.launch.command],{env:X,stdio:"inherit"});if(await wD(D.workerId),F?.enabled&&D.agentName)await E1(D.validated.team,D.agentName).catch(()=>{}),await M1(D.validated.team,D.agentName).catch(()=>{});console.log(`
335
+ `)[0];if(D.cwd)$(`tmux send-keys -t '${Q}' 'cd ${D.cwd.replace(/'/g,"'\\''")}' Enter`,{encoding:"utf-8"});return $(`tmux send-keys -t '${Q}' '${D.fullCommand.replace(/'/g,"'\\''")}' Enter`,{encoding:"utf-8"}),Q}let J=F?`-t '${F.windowId}'`:"",B=D.cwd?`-c '${D.cwd}'`:"",X=`tmux split-window -d ${J} ${B} -P -F '#{pane_id}' ${D.fullCommand}`;return $(X,{encoding:"utf-8"}).trim()}async function mV(D,F){let{execSync:$}=v("child_process"),J="genie",B=`genie:${F?.windowName??""}`;if(!F){let X=await ED("genie");B=X[0]?X[0].id:"genie:"}try{$(`tmux ${f8(B,D.layoutMode)}`,{stdio:"ignore"})}catch{}}async function lV(D){let F=D.spawnIntoCurrentWindow?null:await hV(D.validated.team,D.cwd),$;try{$=gV(D,F)}catch(B){console.error(`Failed to create tmux pane: ${B instanceof Error?B.message:"unknown error"}`),process.exit(1)}await mV(D,F);let J=await nF(D,$,F);if(await oF(D,$),D.spawnColor&&$!=="inline")await G3($,D.spawnColor,F?.windowId);if(await L0({id:D.validated.role??D.workerId,provider:D.validated.provider,team:D.validated.team,role:D.validated.role,skill:D.validated.skill,cwd:D.cwd,extraArgs:D.extraArgs,nativeTeamEnabled:J.nativeTeamEnabled,lastSpawnedAt:new Date().toISOString(),lastSessionId:J.claudeSessionId}),D.otelRelayActive&&$!=="%0")xV(D.workerId,$,D.agentName,D.spawnColor);if(F)console.log(` Window: ${F.windowName} (${F.windowId})`);yV(D,$,J)}async function pV(D){let F=D.validated.nativeTeam,$="inline",J=await nF(D,"inline");if(await oF(D,"inline"),console.log(`Agent "${D.workerId}" starting inline...`),console.log(` Provider: ${D.launch.provider} | Team: ${D.validated.team} | Role: ${D.validated.role??"-"}`),F?.enabled)console.log(` Native: enabled | AgentID: ${J.nativeAgentId}`);console.log("");let{spawnSync:B}=v("child_process"),X={...process.env,...D.launch.env??{}},Q=B("sh",["-c",D.launch.command],{env:X,stdio:"inherit"});if(await fD(D.workerId),F?.enabled&&D.agentName)await E1(D.validated.team,D.agentName).catch(()=>{}),await M1(D.validated.team,D.agentName).catch(()=>{});console.log(`
336
336
  Agent "${D.workerId}" session ended.`),process.exit(Q.status??0)}function dV(D,F){if(!F||Object.keys(F).length===0)return D;return`env ${Object.entries(F).map(([J,B])=>`${J}=${B}`).join(" ")} ${D}`}async function cV(D,F){let $=await p();for(let J of $)if(J.role===F&&J.team===D&&await TD(J.paneId))console.error(`Error: Worker with role "${F}" already exists in team "${D}" (state: ${J.state}, pane: ${J.paneId})
337
- Use a different --role name for a second worker, e.g.: --role ${F}-2`),process.exit(1)}async function iV(D,F,$){let B=(await RD(D))?.nativeTeamParentSessionId;if(!B)B=await Z0()??crypto.randomUUID();await h2(D,`Genie team: ${D}`,B);let X=$.color??await R8(D),Q;if($.provider==="claude")Q={enabled:!0,parentSessionId:B,color:X,agentType:$.role??"general-purpose",planModeRequired:$.planMode,permissionMode:$.permissionMode,agentName:$.role};return{parentSessionId:B,spawnColor:X,nativeTeam:Q}}async function rV(D,F){let $=await A3(D);if(!$)console.error(`Error: Agent "${D}" not found in directory or built-ins.`),console.error(` Register with: genie dir add ${D} --dir <path>`),console.error(" Or use a built-in: engineer, reviewer, qa, fix, ..."),process.exit(1);let J=$.entry,B=null;if($.builtin)B=RF(D);else if(J.dir)B=i1(J);return{entry:J,repoPath:F.cwd??(J.dir||void 0)??process.cwd(),identityPath:B,model:F.model??J.model}}async function nV(D,F,$,J){let B={provider:$.provider,team:F,role:D,skill:$.skill,extraArgs:$.extraArgs,model:J.model,systemPromptFile:J.identityPath??void 0,promptMode:J.entry.promptMode,initialPrompt:$.initialPrompt},{parentSessionId:X,spawnColor:Q,nativeTeam:Y}=await iV(F,J.repoPath,{...$,role:D});if(Y)B.nativeTeam=Y;try{let{injectTeamHooks:G}=await Promise.resolve().then(() => (hF(),yF));if(await G(F))console.log(` Hooks: injected genie hook dispatch into team "${F}"`)}catch(G){console.warn(`Warning: could not inject hooks for team "${F}": ${G instanceof Error?G.message:G}`)}let q=B.provider==="claude"?crypto.randomUUID():void 0;if(q)B.sessionId=q;return{params:B,parentSessionId:X,spawnColor:Q}}async function V2(D,F){let $=F.role??D,J=await rV(D,F),B=Boolean(F.team),X=F.team||await O8();if(!X)console.error("Error: --team is required (or set GENIE_TEAM, or run inside a genie session)"),process.exit(1);await cV(X,$);let Q=await RD(X);if(Q?.worktreePath)J={...J,repoPath:Q.worktreePath};let{params:Y,parentSessionId:q,spawnColor:G}=await nV($,X,F,J),H=X3(Y),V=K8(H),W=u8(F.layout),U=await uV(H.team,$),z=Boolean(process.env.TMUX),E=H.nativeTeam,C=new Date().toISOString(),L=E?.agentName??$,R=!1;if(!E?.enabled&&H.provider==="codex"&&z)t0(),R=await fV(H.team);let y=dV(V.command,V.env),t={workerId:U,validated:H,launch:V,layoutMode:W,fullCommand:y,agentName:L,spawnColor:G,parentSessionId:q,claudeSessionId:Y.sessionId,otelRelayActive:R,now:C,transport:z?"tmux":"inline",extraArgs:F.extraArgs,cwd:J.repoPath,spawnIntoCurrentWindow:!B&&z};if(z)await lV(t);else await pV(t)}async function oV(D){if(!D.team||!D.nativeAgentId)return;let F=D.nativeAgentId.split("@")[0];await E1(D.team,F).catch(()=>{}),await M1(D.team,F).catch(()=>{})}function sV(D){try{let{execSync:F}=v("child_process"),$=F("tmux display-message -p '#{pane_id}'",{encoding:"utf-8"}).trim();if(D.paneId&&/^(%\d+|inline)$/.test(D.paneId)&&D.paneId!==$)F(`tmux kill-pane -t ${D.paneId}`,{stdio:"ignore"});else if(D.paneId===$)console.log(" (skipped pane kill \u2014 would kill current session)")}catch{}}function aV(D){try{let{join:F}=v("path"),{homedir:$}=v("os"),{unlinkSync:J}=v("fs"),B=F($(),".genie","relay");for(let X of["-pane","-meta"])try{J(F(B,`${D}${X}`))}catch{}}catch{}}async function sF(D){let F=await rD(D);if(F)return F;let $=await p(),J=$.filter((X)=>X.role===D);if(J.length===1)return J[0];if(J.length>1){console.error(`Multiple agents with role "${D}". Specify full ID:`);for(let X of J)console.error(` ${X.id} (team: ${X.team})`);process.exit(1)}let B=$.filter((X)=>X.id.endsWith(`-${D}`));if(B.length===1)return B[0];if(B.length>1){console.error(`Multiple agents matching "${D}". Specify full ID:`);for(let X of B)console.error(` ${X.id}`);process.exit(1)}console.error(`Agent "${D}" not found.`),console.error(" Run `genie ls` to see agents."),process.exit(1)}async function D5(D){let F=await sF(D);if(sV(F),aV(F.id),await oV(F),F.claudeSessionId){let J=(await J3()).find((B)=>B.id===F.id||B.id===F.role||B.role===F.role);if(J)await L0({...J,lastSessionId:F.claudeSessionId})}await wD(F.id),console.log(`Agent "${F.id}" killed and unregistered (template preserved).`)}async function F5(D){let F=await sF(D);if(F.state==="suspended"){console.log(`Agent "${F.id}" is already stopped.`);return}let{suspendWorker:$}=await Promise.resolve().then(() => (cF(),dF));if(await $(F.id)){if(console.log(`Agent "${F.id}" stopped.`),F.claudeSessionId)console.log(` Session preserved: ${F.claudeSessionId}`);console.log(` Send a message to auto-resume: genie send '...' --to ${F.id}`)}else console.error(`Failed to stop agent "${F.id}".`),process.exit(1)}async function $5(D){let F=await R3(),$=await p(),J=new Map;for(let X of $){let Q=X.role||X.id;if(await TD(X.paneId))J.set(Q,{state:X.state,team:X.team||"-"})}let B=[];for(let X of F){let Q=J.get(X.name);B.push({name:X.name,dir:X.dir||"-",status:Q?Q.state:"offline",team:Q?.team||"-",model:X.model||"-"}),J.delete(X.name)}for(let[X,Q]of J)B.push({name:X,dir:"(built-in)",status:Q.state,team:Q.team,model:"-"});if(D.json){console.log(JSON.stringify(B,null,2));return}if(B.length===0){console.log("No agents registered. Use `genie dir add <name> --dir <path>` to register one.");return}console.log(""),console.log(rF("NAME","DIR","STATUS","TEAM","MODEL")),console.log("-".repeat(94));for(let X of B)console.log(rF(X.name,X.dir,X.status,X.team,X.model));console.log("")}function rF(D,F,$,J,B){return`${D.padEnd(20).substring(0,20)}${F.padEnd(40).substring(0,40)}${$.padEnd(12).substring(0,12)}${J.padEnd(12).substring(0,12)}${B}`}var i8=I(()=>{C3();MD();M3();l2();s6();M8();Z3();$D();$D()});import{randomUUID as XU}from"crypto";var Y5;var _$=I(()=>{Y5={randomUUID:XU}});import{randomFillSync as QU}from"crypto";function q5(){if(a8>t8.length-16)QU(t8),a8=0;return t8.slice(a8,a8+=16)}var t8,a8;var L$=I(()=>{t8=new Uint8Array(256),a8=t8.length});function Z$(D,F=0){return(a[D[F+0]]+a[D[F+1]]+a[D[F+2]]+a[D[F+3]]+"-"+a[D[F+4]]+a[D[F+5]]+"-"+a[D[F+6]]+a[D[F+7]]+"-"+a[D[F+8]]+a[D[F+9]]+"-"+a[D[F+10]]+a[D[F+11]]+a[D[F+12]]+a[D[F+13]]+a[D[F+14]]+a[D[F+15]]).toLowerCase()}var a;var T$=I(()=>{a=[];for(let D=0;D<256;++D)a.push((D+256).toString(16).slice(1))});function YU(D,F,$){if(Y5.randomUUID&&!F&&!D)return Y5.randomUUID();D=D||{};let J=D.random??D.rng?.()??q5();if(J.length<16)throw Error("Random bytes length must be >= 16");if(J[6]=J[6]&15|64,J[8]=J[8]&63|128,F){if($=$||0,$<0||$+16>F.length)throw RangeError(`UUID byte range ${$}:${$+15} is out of buffer bounds`);for(let B=0;B<16;++B)F[$+B]=J[B];return F}return Z$(J)}var w3;var N$=I(()=>{_$();L$();T$();w3=YU});var G5=I(()=>{N$()});import{mkdir as H5,readFile as qU,writeFile as GU}from"fs/promises";import HU,{join as I$}from"path";function e8(D){return I$(D,".genie","mailbox")}function D6(D,F){let $=HU.basename(F);return I$(e8(D),`${$}.json`)}async function V5(D,F){try{let $=await qU(D6(D,F),"utf-8");return JSON.parse($)}catch{return{workerId:F,messages:[],lastUpdated:new Date().toISOString()}}}async function S$(D,F){let $=e8(D);await H5($,{recursive:!0}),F.lastUpdated=new Date().toISOString(),await GU(D6(D,F.workerId),JSON.stringify(F,null,2))}function VU(){return`msg-${w3()}`}async function W5(D,F,$,J){await H5(e8(D),{recursive:!0});let B=await HD(D6(D,$));try{let X=await V5(D,$),Q={id:VU(),from:F,to:$,body:J,createdAt:new Date().toISOString(),read:!1,deliveredAt:null};return X.messages.push(Q),await S$(D,X),Q}finally{await B()}}async function b$(D,F){return(await V5(D,F)).messages}async function U5(D,F,$){await H5(e8(D),{recursive:!0});let J=await HD(D6(D,F));try{let B=await V5(D,F),X=B.messages.find((Q)=>Q.id===$);if(!X)return!1;return X.deliveredAt=new Date().toISOString(),await S$(D,B),!0}finally{await J()}}function P$(D,F="blue"){let $=D.body.split(/\s+/),J=$.slice(0,8).join(" ")+($.length>8?"...":"");return{from:D.from,text:D.body,summary:J,timestamp:D.createdAt,color:F,read:!1}}var v$=I(()=>{G5();f2()});function n2(D){return D.replace(/\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])/g,"")}function F6(D,F){let $=n2(D),J=[];for(let B of F){let X=new RegExp(B.pattern.source,B.pattern.flags||"g"),Q=X.exec($);while(Q!==null){if(J.push({type:B.type,match:Q,extracted:B.extract?B.extract(Q):void 0}),!B.pattern.flags?.includes("g"))break;Q=X.exec($)}}return J}function f3(D,F){return F6(D,F).length>0}function $6(D,F){let $=F6(D,F);return $.length>0?$[0]:null}var k$,z5,w$,f$,u$,x$,y$;var K5=I(()=>{k$=[{type:"bash_permission",pattern:/Allow (?:Bash|bash|command|shell).*\?\s*(?:\[([YyNn])\/([YyNn])\])?/i,extract:(D)=>({default:D[1]||"y"})},{type:"file_permission",pattern:/Allow (?:Edit|Write|Read|file|reading|writing|editing).*\?\s*(?:\[([YyNn])\/([YyNn])\])?/i,extract:(D)=>({default:D[1]||"y"})},{type:"mcp_permission",pattern:/Allow (?:MCP|mcp|tool).*\?\s*(?:\[([YyNn])\/([YyNn])\])?/i,extract:(D)=>({default:D[1]||"y"})},{type:"generic_permission",pattern:/^(?:Allow|Confirm|Approve)\s+(?:this|the|once|always)?\s*(?:\w+)?\s*\?\s*(?:\[([YyNn])\/([YyNn])\])?/im,extract:(D)=>({default:D[1]||"y"})},{type:"claude_code_yes_no",pattern:/(?:Yes|No)\s*$/m},{type:"claude_code_permission_block",pattern:/(?:Allow|Run|Execute)\s+(?:once|always)/i}],z5=[{type:"numbered_options",pattern:/\[(\d+)\]\s+(.+?)(?=\[(\d+)\]|$)/g,extract:(D)=>({number:D[1],option:D[2].trim()})},{type:"lettered_options",pattern:/\(([a-z])\)\s+(.+?)(?=\([a-z]\)|$)/gi,extract:(D)=>({letter:D[1],option:D[2].trim()})},{type:"yes_no_question",pattern:/\?\s*\[([YyNn])\/([YyNn])\]\s*$/,extract:(D)=>({default:D[1]})},{type:"claude_code_numbered_options",pattern:/(?:\u276F|>)?\s*(\d+)\.\s+(.+?)(?:\n|$)/g,extract:(D)=>({number:D[1],option:D[2].trim()})},{type:"claude_code_plan_approval",pattern:/Would you like to proceed\?/i}],w$=[{type:"error",pattern:/(?:^|\n)\s*(?:Error|ERROR|error):\s*(.+)/,extract:(D)=>({message:D[1]})},{type:"failed",pattern:/(?:^|\n)\s*(?:Failed|FAILED|failed):\s*(.+)/,extract:(D)=>({message:D[1]})},{type:"exception",pattern:/(?:^|\n)\s*(?:Exception|EXCEPTION|Uncaught|Unhandled):\s*(.+)/,extract:(D)=>({message:D[1]})},{type:"api_error",pattern:/(?:API|api)\s+(?:error|Error|ERROR):\s*(.+)/,extract:(D)=>({message:D[1]})}],f$=[{type:"checkmark",pattern:/(?:\u2713|\u2714|\u2611\uFE0E)/},{type:"success_message",pattern:/(?:Successfully|Completed|Done|Finished|Created|Updated|Saved)/i},{type:"task_complete",pattern:/(?:task|operation|process)\s+(?:complete|completed|finished|done)/i}],u$=[{type:"thinking",pattern:/(?:Thinking|thinking|Processing|processing)\.\.\./},{type:"spinner",pattern:/[\u280B\u2819\u2839\u2838\u283C\u2834\u2826\u2827\u2807\u280F\u28FE\u28FD\u28FB\u28BF\u287F\u28DF\u28EF\u28F7]/},{type:"loading",pattern:/(?:Loading|loading|Working|working)\.\.\./},{type:"claude_code_working",pattern:/(?:\uD83D\uDEE0\uFE0F|\uD83D\uDD27|\u2699\uFE0F)\s*(?:Read|Edit|Write|Bash|Glob|Grep|Task)/u},{type:"claude_code_streaming",pattern:/\u258C$/},{type:"claude_code_propagating",pattern:/Propagating\u2026/}],x$=[{type:"claude_prompt",pattern:/(?:^|\n)\s*>\s*$/},{type:"claude_code_prompt",pattern:/\u276F\s*(?!\d\.)/},{type:"claude_code_input_line",pattern:/\u276F\s*.+\n\u2500+\n/},{type:"idle_indicator",pattern:/\|\s*idle\s*$/i},{type:"input_prompt",pattern:/(?:^|\n)(?:Enter|Input|Type|Provide).*:\s*$/i}],y$=[{type:"run_command",pattern:/(?:Run|Running|Executing)\s+(?:command|bash):\s*(.+)/i,extract:(D)=>({command:D[1]})},{type:"read_file",pattern:/(?:Read|Reading)\s+(?:file):\s*(.+)/i,extract:(D)=>({file:D[1]})},{type:"write_file",pattern:/(?:Write|Writing|Edit|Editing)\s+(?:file|to):\s*(.+)/i,extract:(D)=>({file:D[1]})},{type:"search",pattern:/(?:Search|Searching|Grep|Glob)(?:ing)?:\s*(.+)/i,extract:(D)=>({query:D[1]})}]});function UU(D,F,$){if(D.length===0&&!F)return null;let J=D.filter((X)=>X.type==="claude_code_numbered_options"&&X.extracted?.option).map((X)=>X.extracted?.option).filter((X)=>X!==void 0);if(J.length>=2||F)return{...$,type:"question",options:J.length>0?J:void 0,detail:F?"plan_approval":void 0,confidence:0.85};let B=D.filter((X)=>X.extracted?.option&&X.type!=="claude_code_numbered_options").map((X)=>X.extracted?.option).filter((X)=>X!==void 0);if(B.length>=2)return{...$,type:"question",options:B,confidence:0.85};return null}function J6(D,F={}){let{linesToAnalyze:$=50,minConfidence:J=0.3}=F,B=D.split(`
337
+ Use a different --role name for a second worker, e.g.: --role ${F}-2`),process.exit(1)}async function iV(D,F,$){let B=(await RD(D))?.nativeTeamParentSessionId;if(!B)B=await Z0()??crypto.randomUUID();await h2(D,`Genie team: ${D}`,B);let X=$.color??await R8(D),Q;if($.provider==="claude")Q={enabled:!0,parentSessionId:B,color:X,agentType:$.role??"general-purpose",planModeRequired:$.planMode,permissionMode:$.permissionMode,agentName:$.role};return{parentSessionId:B,spawnColor:X,nativeTeam:Q}}async function rV(D,F){let $=await A3(D);if(!$)console.error(`Error: Agent "${D}" not found in directory or built-ins.`),console.error(` Register with: genie dir add ${D} --dir <path>`),console.error(" Or use a built-in: engineer, reviewer, qa, fix, ..."),process.exit(1);let J=$.entry,B=null;if($.builtin)B=RF(D);else if(J.dir)B=i1(J);return{entry:J,repoPath:F.cwd??(J.dir||void 0)??process.cwd(),identityPath:B,model:F.model??J.model}}async function nV(D,F,$,J){let B={provider:$.provider,team:F,role:D,skill:$.skill,extraArgs:$.extraArgs,model:J.model,systemPromptFile:J.identityPath??void 0,promptMode:J.entry.promptMode,initialPrompt:$.initialPrompt},{parentSessionId:X,spawnColor:Q,nativeTeam:Y}=await iV(F,J.repoPath,{...$,role:D});if(Y)B.nativeTeam=Y;try{let{injectTeamHooks:G}=await Promise.resolve().then(() => (hF(),yF));if(await G(F))console.log(` Hooks: injected genie hook dispatch into team "${F}"`)}catch(G){console.warn(`Warning: could not inject hooks for team "${F}": ${G instanceof Error?G.message:G}`)}let q=B.provider==="claude"?crypto.randomUUID():void 0;if(q)B.sessionId=q;return{params:B,parentSessionId:X,spawnColor:Q}}async function V2(D,F){let $=F.role??D,J=await rV(D,F),B=Boolean(F.team),X=F.team||await O8();if(!X)console.error("Error: --team is required (or set GENIE_TEAM, or run inside a genie session)"),process.exit(1);await cV(X,$);let Q=await RD(X);if(Q?.worktreePath)J={...J,repoPath:Q.worktreePath};let{params:Y,parentSessionId:q,spawnColor:G}=await nV($,X,F,J),H=X3(Y),V=K8(H),W=u8(F.layout),U=await uV(H.team,$),z=Boolean(process.env.TMUX),E=H.nativeTeam,C=new Date().toISOString(),L=E?.agentName??$,R=!1;if(!E?.enabled&&H.provider==="codex"&&z)t0(),R=await fV(H.team);let y=dV(V.command,V.env),t={workerId:U,validated:H,launch:V,layoutMode:W,fullCommand:y,agentName:L,spawnColor:G,parentSessionId:q,claudeSessionId:Y.sessionId,otelRelayActive:R,now:C,transport:z?"tmux":"inline",extraArgs:F.extraArgs,cwd:J.repoPath,spawnIntoCurrentWindow:!B&&z};if(z)await lV(t);else await pV(t)}async function oV(D){if(!D.team||!D.nativeAgentId)return;let F=D.nativeAgentId.split("@")[0];await E1(D.team,F).catch(()=>{}),await M1(D.team,F).catch(()=>{})}function sV(D){try{let{execSync:F}=v("child_process"),$=F("tmux display-message -p '#{pane_id}'",{encoding:"utf-8"}).trim();if(D.paneId&&/^(%\d+|inline)$/.test(D.paneId)&&D.paneId!==$)F(`tmux kill-pane -t ${D.paneId}`,{stdio:"ignore"});else if(D.paneId===$)console.log(" (skipped pane kill \u2014 would kill current session)")}catch{}}function aV(D){try{let{join:F}=v("path"),{homedir:$}=v("os"),{unlinkSync:J}=v("fs"),B=F($(),".genie","relay");for(let X of["-pane","-meta"])try{J(F(B,`${D}${X}`))}catch{}}catch{}}async function sF(D){let F=await rD(D);if(F)return F;let $=await p(),J=$.filter((X)=>X.role===D);if(J.length===1)return J[0];if(J.length>1){console.error(`Multiple agents with role "${D}". Specify full ID:`);for(let X of J)console.error(` ${X.id} (team: ${X.team})`);process.exit(1)}let B=$.filter((X)=>X.id.endsWith(`-${D}`));if(B.length===1)return B[0];if(B.length>1){console.error(`Multiple agents matching "${D}". Specify full ID:`);for(let X of B)console.error(` ${X.id}`);process.exit(1)}console.error(`Agent "${D}" not found.`),console.error(" Run `genie ls` to see agents."),process.exit(1)}async function D5(D){let F=await sF(D);if(sV(F),aV(F.id),await oV(F),F.claudeSessionId){let J=(await J3()).find((B)=>B.id===F.id||B.id===F.role||B.role===F.role);if(J)await L0({...J,lastSessionId:F.claudeSessionId})}await fD(F.id),console.log(`Agent "${F.id}" killed and unregistered (template preserved).`)}async function F5(D){let F=await sF(D);if(F.state==="suspended"){console.log(`Agent "${F.id}" is already stopped.`);return}let{suspendWorker:$}=await Promise.resolve().then(() => (cF(),dF));if(await $(F.id)){if(console.log(`Agent "${F.id}" stopped.`),F.claudeSessionId)console.log(` Session preserved: ${F.claudeSessionId}`);console.log(` Send a message to auto-resume: genie send '...' --to ${F.id}`)}else console.error(`Failed to stop agent "${F.id}".`),process.exit(1)}async function $5(D){let F=await R3(),$=await p(),J=new Map;for(let X of $){let Q=X.role||X.id;if(await TD(X.paneId))J.set(Q,{state:X.state,team:X.team||"-"})}let B=[];for(let X of F){let Q=J.get(X.name);B.push({name:X.name,dir:X.dir||"-",status:Q?Q.state:"offline",team:Q?.team||"-",model:X.model||"-"}),J.delete(X.name)}for(let[X,Q]of J)B.push({name:X,dir:"(built-in)",status:Q.state,team:Q.team,model:"-"});if(D.json){console.log(JSON.stringify(B,null,2));return}if(B.length===0){console.log("No agents registered. Use `genie dir add <name> --dir <path>` to register one.");return}console.log(""),console.log(rF("NAME","DIR","STATUS","TEAM","MODEL")),console.log("-".repeat(94));for(let X of B)console.log(rF(X.name,X.dir,X.status,X.team,X.model));console.log("")}function rF(D,F,$,J,B){return`${D.padEnd(20).substring(0,20)}${F.padEnd(40).substring(0,40)}${$.padEnd(12).substring(0,12)}${J.padEnd(12).substring(0,12)}${B}`}var i8=I(()=>{C3();MD();M3();l2();s6();M8();Z3();$D();$D()});import{randomUUID as XU}from"crypto";var Y5;var _$=I(()=>{Y5={randomUUID:XU}});import{randomFillSync as QU}from"crypto";function q5(){if(a8>t8.length-16)QU(t8),a8=0;return t8.slice(a8,a8+=16)}var t8,a8;var L$=I(()=>{t8=new Uint8Array(256),a8=t8.length});function Z$(D,F=0){return(a[D[F+0]]+a[D[F+1]]+a[D[F+2]]+a[D[F+3]]+"-"+a[D[F+4]]+a[D[F+5]]+"-"+a[D[F+6]]+a[D[F+7]]+"-"+a[D[F+8]]+a[D[F+9]]+"-"+a[D[F+10]]+a[D[F+11]]+a[D[F+12]]+a[D[F+13]]+a[D[F+14]]+a[D[F+15]]).toLowerCase()}var a;var T$=I(()=>{a=[];for(let D=0;D<256;++D)a.push((D+256).toString(16).slice(1))});function YU(D,F,$){if(Y5.randomUUID&&!F&&!D)return Y5.randomUUID();D=D||{};let J=D.random??D.rng?.()??q5();if(J.length<16)throw Error("Random bytes length must be >= 16");if(J[6]=J[6]&15|64,J[8]=J[8]&63|128,F){if($=$||0,$<0||$+16>F.length)throw RangeError(`UUID byte range ${$}:${$+15} is out of buffer bounds`);for(let B=0;B<16;++B)F[$+B]=J[B];return F}return Z$(J)}var w3;var N$=I(()=>{_$();L$();T$();w3=YU});var G5=I(()=>{N$()});import{mkdir as H5,readFile as qU,writeFile as GU}from"fs/promises";import HU,{join as I$}from"path";function e8(D){return I$(D,".genie","mailbox")}function D6(D,F){let $=HU.basename(F);return I$(e8(D),`${$}.json`)}async function V5(D,F){try{let $=await qU(D6(D,F),"utf-8");return JSON.parse($)}catch{return{workerId:F,messages:[],lastUpdated:new Date().toISOString()}}}async function S$(D,F){let $=e8(D);await H5($,{recursive:!0}),F.lastUpdated=new Date().toISOString(),await GU(D6(D,F.workerId),JSON.stringify(F,null,2))}function VU(){return`msg-${w3()}`}async function W5(D,F,$,J){await H5(e8(D),{recursive:!0});let B=await HD(D6(D,$));try{let X=await V5(D,$),Q={id:VU(),from:F,to:$,body:J,createdAt:new Date().toISOString(),read:!1,deliveredAt:null};return X.messages.push(Q),await S$(D,X),Q}finally{await B()}}async function b$(D,F){return(await V5(D,F)).messages}async function U5(D,F,$){await H5(e8(D),{recursive:!0});let J=await HD(D6(D,F));try{let B=await V5(D,F),X=B.messages.find((Q)=>Q.id===$);if(!X)return!1;return X.deliveredAt=new Date().toISOString(),await S$(D,B),!0}finally{await J()}}function P$(D,F="blue"){let $=D.body.split(/\s+/),J=$.slice(0,8).join(" ")+($.length>8?"...":"");return{from:D.from,text:D.body,summary:J,timestamp:D.createdAt,color:F,read:!1}}var v$=I(()=>{G5();f2()});function n2(D){return D.replace(/\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])/g,"")}function F6(D,F){let $=n2(D),J=[];for(let B of F){let X=new RegExp(B.pattern.source,B.pattern.flags||"g"),Q=X.exec($);while(Q!==null){if(J.push({type:B.type,match:Q,extracted:B.extract?B.extract(Q):void 0}),!B.pattern.flags?.includes("g"))break;Q=X.exec($)}}return J}function f3(D,F){return F6(D,F).length>0}function $6(D,F){let $=F6(D,F);return $.length>0?$[0]:null}var k$,z5,w$,f$,u$,x$,y$;var K5=I(()=>{k$=[{type:"bash_permission",pattern:/Allow (?:Bash|bash|command|shell).*\?\s*(?:\[([YyNn])\/([YyNn])\])?/i,extract:(D)=>({default:D[1]||"y"})},{type:"file_permission",pattern:/Allow (?:Edit|Write|Read|file|reading|writing|editing).*\?\s*(?:\[([YyNn])\/([YyNn])\])?/i,extract:(D)=>({default:D[1]||"y"})},{type:"mcp_permission",pattern:/Allow (?:MCP|mcp|tool).*\?\s*(?:\[([YyNn])\/([YyNn])\])?/i,extract:(D)=>({default:D[1]||"y"})},{type:"generic_permission",pattern:/^(?:Allow|Confirm|Approve)\s+(?:this|the|once|always)?\s*(?:\w+)?\s*\?\s*(?:\[([YyNn])\/([YyNn])\])?/im,extract:(D)=>({default:D[1]||"y"})},{type:"claude_code_yes_no",pattern:/(?:Yes|No)\s*$/m},{type:"claude_code_permission_block",pattern:/(?:Allow|Run|Execute)\s+(?:once|always)/i}],z5=[{type:"numbered_options",pattern:/\[(\d+)\]\s+(.+?)(?=\[(\d+)\]|$)/g,extract:(D)=>({number:D[1],option:D[2].trim()})},{type:"lettered_options",pattern:/\(([a-z])\)\s+(.+?)(?=\([a-z]\)|$)/gi,extract:(D)=>({letter:D[1],option:D[2].trim()})},{type:"yes_no_question",pattern:/\?\s*\[([YyNn])\/([YyNn])\]\s*$/,extract:(D)=>({default:D[1]})},{type:"claude_code_numbered_options",pattern:/(?:\u276F|>)?\s*(\d+)\.\s+(.+?)(?:\n|$)/g,extract:(D)=>({number:D[1],option:D[2].trim()})},{type:"claude_code_plan_approval",pattern:/Would you like to proceed\?/i}],w$=[{type:"error",pattern:/(?:^|\n)\s*(?:Error|ERROR|error):\s*(.+)/,extract:(D)=>({message:D[1]})},{type:"failed",pattern:/(?:^|\n)\s*(?:Failed|FAILED|failed):\s*(.+)/,extract:(D)=>({message:D[1]})},{type:"exception",pattern:/(?:^|\n)\s*(?:Exception|EXCEPTION|Uncaught|Unhandled):\s*(.+)/,extract:(D)=>({message:D[1]})},{type:"api_error",pattern:/(?:API|api)\s+(?:error|Error|ERROR):\s*(.+)/,extract:(D)=>({message:D[1]})}],f$=[{type:"checkmark",pattern:/(?:\u2713|\u2714|\u2611\uFE0E)/},{type:"success_message",pattern:/(?:Successfully|Completed|Done|Finished|Created|Updated|Saved)/i},{type:"task_complete",pattern:/(?:task|operation|process)\s+(?:complete|completed|finished|done)/i}],u$=[{type:"thinking",pattern:/(?:Thinking|thinking|Processing|processing)\.\.\./},{type:"spinner",pattern:/[\u280B\u2819\u2839\u2838\u283C\u2834\u2826\u2827\u2807\u280F\u28FE\u28FD\u28FB\u28BF\u287F\u28DF\u28EF\u28F7]/},{type:"loading",pattern:/(?:Loading|loading|Working|working)\.\.\./},{type:"claude_code_working",pattern:/(?:\uD83D\uDEE0\uFE0F|\uD83D\uDD27|\u2699\uFE0F)\s*(?:Read|Edit|Write|Bash|Glob|Grep|Task)/u},{type:"claude_code_streaming",pattern:/\u258C$/},{type:"claude_code_propagating",pattern:/Propagating\u2026/}],x$=[{type:"claude_prompt",pattern:/(?:^|\n)\s*>\s*$/},{type:"claude_code_prompt",pattern:/\u276F\s*(?!\d\.)/},{type:"claude_code_input_line",pattern:/\u276F\s*.+\n\u2500+\n/},{type:"idle_indicator",pattern:/\|\s*idle\s*$/i},{type:"input_prompt",pattern:/(?:^|\n)(?:Enter|Input|Type|Provide).*:\s*$/i}],y$=[{type:"run_command",pattern:/(?:Run|Running|Executing)\s+(?:command|bash):\s*(.+)/i,extract:(D)=>({command:D[1]})},{type:"read_file",pattern:/(?:Read|Reading)\s+(?:file):\s*(.+)/i,extract:(D)=>({file:D[1]})},{type:"write_file",pattern:/(?:Write|Writing|Edit|Editing)\s+(?:file|to):\s*(.+)/i,extract:(D)=>({file:D[1]})},{type:"search",pattern:/(?:Search|Searching|Grep|Glob)(?:ing)?:\s*(.+)/i,extract:(D)=>({query:D[1]})}]});function UU(D,F,$){if(D.length===0&&!F)return null;let J=D.filter((X)=>X.type==="claude_code_numbered_options"&&X.extracted?.option).map((X)=>X.extracted?.option).filter((X)=>X!==void 0);if(J.length>=2||F)return{...$,type:"question",options:J.length>0?J:void 0,detail:F?"plan_approval":void 0,confidence:0.85};let B=D.filter((X)=>X.extracted?.option&&X.type!=="claude_code_numbered_options").map((X)=>X.extracted?.option).filter((X)=>X!==void 0);if(B.length>=2)return{...$,type:"question",options:B,confidence:0.85};return null}function J6(D,F={}){let{linesToAnalyze:$=50,minConfidence:J=0.3}=F,B=D.split(`
338
338
  `),X=B.slice(-$).join(`
339
339
  `),Q=n2(X),Y={timestamp:Date.now(),rawOutput:X},q=$6(Q,k$);if(q)return{...Y,type:"permission",detail:q.type.replace("_permission",""),confidence:0.9};let G=f3(Q,z5.filter((R)=>R.type==="claude_code_plan_approval")),H=n2(B.slice(-15).join(`
340
340
  `)),V=F6(H,z5),W=UU(V,G,Y);if(W)return W;let U=V.find((R)=>R.type==="yes_no_question");if(U)return{...Y,type:"question",options:["Yes","No"],detail:`default: ${U.extracted?.default||"y"}`,confidence:0.85};let z=$6(Q,w$);if(z)return{...Y,type:"error",detail:z.extracted?.message||z.match[0],confidence:0.8};let E=$6(Q,y$);if(E)return{...Y,type:"tool_use",detail:`${E.type}: ${E.extracted?.command||E.extracted?.file||E.extracted?.query||""}`,confidence:0.75};if(f3(Q,u$))return{...Y,type:"working",confidence:0.7};if(f3(Q,f$))return{...Y,type:"complete",confidence:0.6};let C=n2(B.slice(-5).join(`
341
- `));if(f3(C,x$))return{...Y,type:"idle",confidence:0.7};let L=C.trim();if(L.endsWith(">")||L.match(/>\s*$/))return{...Y,type:"idle",detail:"prompt detected",confidence:0.65};return{...Y,type:"unknown",confidence:J}}var h$=I(()=>{K5()});var M5=I(()=>{K5();h$()});var m$={};BD(m$,{spawnWorkerFromTemplate:()=>OU});import{exec as zU}from"child_process";import{promisify as KU}from"util";async function MU(D,F){let $=await RD(F);if($?.nativeTeamParentSessionId)return $.nativeTeamParentSessionId;return await Z0()??crypto.randomUUID()}function EU(D,F,$,J){let B=D.provider==="claude",X={provider:D.provider,team:D.team,role:D.role,skill:D.skill,extraArgs:D.extraArgs,sessionId:B&&!J?crypto.randomUUID():void 0,resume:B?J:void 0};if(B)X.nativeTeam={enabled:!0,parentSessionId:F,color:$,agentType:D.role??"general-purpose",agentName:D.role};return X}function AU(D){if(D.env&&Object.keys(D.env).length>0)return`env ${Object.entries(D.env).map(([$,J])=>`${$}=${J}`).join(" ")} ${D.command}`;return D.command}async function RU(D,F){let $=F?`${D}-${F}`:D;return(await p()).some((B)=>B.id===$)?`${$}-${crypto.randomUUID().slice(0,8)}`:$}async function OU(D,F){let $=D.cwd??process.cwd(),J=D.team,B=await MU($,J);await h2(J,`Genie team: ${J}`,B);let X=await R8(J),Q=EU(D,B,X,F),Y=K8(X3(Q)),q=AU(Y),G=await RU(J,D.role),H="genie",V=null;try{V=await d2(H,J,$)}catch{}let W=V?`-t '${V.windowId}'`:"",{stdout:U}=await g$(`tmux split-window -d ${W} -P -F '#{pane_id}' ${q}`),z=U.trim(),E=`${H}:${V?.windowName??""}`;if(!V){let t=await ED(H);E=t[0]?t[0].id:`${H}:`}try{await g$(`tmux ${f8(E,u8())}`)}catch{}let C=new Date().toISOString(),L=D.role??"worker",R=D.provider==="claude",y={id:G,paneId:z,session:H,provider:D.provider,transport:"tmux",role:D.role,skill:D.skill,team:J,worktree:null,startedAt:C,state:"spawning",lastStateChange:C,repoPath:$,claudeSessionId:F??Q.sessionId,nativeTeamEnabled:R,nativeAgentId:`${L}@${J}`,nativeColor:X,parentSessionId:B,window:V?.windowName,windowName:V?.windowName,windowId:V?.windowId};if(await u2(y),await g2(J,{agentName:L,agentType:D.role??"general-purpose",color:X??"blue",tmuxPaneId:z,cwd:$}),await m2(J,"team-lead",{from:L,text:`Worker ${L} (${D.provider}) auto-spawned${F?" with --resume":""}. Ready for tasks.`,summary:`${L} auto-spawned`,timestamp:C,color:X??"blue",read:!1}),X)await G3(z,X,V?.windowId);return{worker:y,paneId:z,workerId:G}}var g$;var l$=I(()=>{MD();l2();M8();Z3();$D();g$=KU(zU)});var c$={};BD(c$,{sendMessage:()=>IU,getInbox:()=>PU});async function _U(D,F=CU){let $=Date.now();while(Date.now()-$<F){try{let J=await AD(D,30);if(J6(J).type==="idle")return!0}catch{}await new Promise((J)=>setTimeout(J,jU))}return!1}async function d$(D){let F=await p(),$=[],J=[],B=[];for(let X of F){if(X.state==="suspended")continue;if(!await TD(X.paneId))continue;if(X.id===D)$.push(X);else if(X.role===D)J.push(X);else if(`${X.team}:${X.role}`===D)B.push(X)}if($.length>0)return $;if(J.length>0)return J;return B}async function LU(D){let F=await d$(D);return F.length===1?F[0]:null}async function ZU(D,F){if(D&&D.state!=="suspended"&&await TD(D.paneId))return{worker:D,respawned:!1};let $=await LU(F);if($)return{worker:$,respawned:!1};if(!process.env.TMUX)return null;let J=await J3(),B=[D?.role,D?.id,F].filter((G)=>Boolean(G)),X=[...new Set(B)],Q=D?.team,Y=J.find((G)=>{if(Q&&G.team!==Q)return!1;return X.some((H)=>G.id===H||G.role===H||`${G.team}:${G.role}`===H)});if(!Y)return null;let q=Y.provider==="claude"?D?.claudeSessionId??Y.lastSessionId:void 0;try{if(await TU(F,Q),D)await wD(D.id);let{spawnWorkerFromTemplate:G}=await Promise.resolve().then(() => (l$(),m$)),H=await G(Y,q);if(await L0({...Y,lastSpawnedAt:new Date().toISOString(),lastSessionId:H.worker.claudeSessionId}),await _U(H.paneId),!await TD(H.paneId))return await wD(H.worker.id),null;return{worker:H.worker,respawned:!0}}catch{return null}}async function TU(D,F){let $=await p();for(let J of $){if(F&&J.team!==F)continue;if(!(J.role===D||J.id===D))continue;if(await TD(J.paneId))continue;await wD(J.id)}}async function p$(D,F,$,J){let B=await W5(D,F,$.id,J),X=$.nativeTeamEnabled&&$.team&&$.role?await SU($,B):await bU($,B);if(X)await U5(D,$.id,B.id);return{messageId:B.id,workerId:$.id,delivered:X}}async function NU(D,F,$,J,B){let X=B??await O8();if(!X)return null;let Q=await y2(X).catch(()=>null);if(!Q)return null;if(!Q.members?.some((q)=>q.name===$||q.agentId===`${$}@${X}`))return null;try{let q=await W5(D,F,$,J),G={from:F,text:J,summary:J.length>50?`${J.substring(0,50)}...`:J,timestamp:new Date().toISOString(),color:"blue",read:!1};return await m2(X,$,G),await U5(D,$,q.id),{messageId:q.id,workerId:$,delivered:!0}}catch{return null}}async function IU(D,F,$,J,B){let X=await d$($);if(X.length===1)return p$(D,F,X[0],J);if(X.length>1)return{messageId:"",workerId:$,delivered:!1,reason:`Worker "${$}" is ambiguous. Found ${X.length} live matches: ${X.map((H)=>H.id).join(", ")}. Use exact worker ID.`};let{resolve:Q}=await Promise.resolve().then(() => (C3(),O3)),Y=await Q($),q=await rD($);if(!q){let H=await p();q=H.find((V)=>V.role===$&&V.state==="suspended")??H.find((V)=>V.role===$)??null}if(Y||q){let H=await ZU(q,$);if(H)return p$(D,F,H.worker,J)}let G=await NU(D,F,$,J,B);if(G)return G;return{messageId:"",workerId:$,delivered:!1,reason:`Worker "${$}" not found or not alive`}}async function SU(D,F){try{let $=P$(F,D.nativeColor??"blue"),J=D.role??D.id;return await m2(D.team??"",J,$),!0}catch{return!1}}async function bU(D,F){if(!D.paneId)return!1;if(!/^%\d+$/.test(D.paneId))return!1;try{let $=F.body.replace(/'/g,"'\\''");return await f(`send-keys -t '${D.paneId}' '${$}'`),await new Promise((J)=>setTimeout(J,200)),await f(`send-keys -t '${D.paneId}' Enter`),!0}catch{return!1}}async function PU(D,F){return b$(D,F)}var CU=15000,jU=1000;var i$=I(()=>{MD();l2();v$();M5();$D()});var o$={};BD(o$,{readMessages:()=>uU,postMessage:()=>fU});import{appendFile as vU,mkdir as kU,readFile as wU}from"fs/promises";import{join as r$}from"path";function n$(D){return r$(D,".genie","chat")}function E5(D,F){let $=F.replace(/\//g,"--");return r$(n$(D),`${$}.jsonl`)}async function fU(D,F,$,J){let B=n$(D);await kU(B,{recursive:!0});let X=await HD(E5(D,F));try{let Q={id:`chat-${w3()}`,sender:$,body:J,timestamp:new Date().toISOString()},Y=E5(D,F);return await vU(Y,`${JSON.stringify(Q)}
341
+ `));if(f3(C,x$))return{...Y,type:"idle",confidence:0.7};let L=C.trim();if(L.endsWith(">")||L.match(/>\s*$/))return{...Y,type:"idle",detail:"prompt detected",confidence:0.65};return{...Y,type:"unknown",confidence:J}}var h$=I(()=>{K5()});var M5=I(()=>{K5();h$()});var m$={};BD(m$,{spawnWorkerFromTemplate:()=>OU});import{exec as zU}from"child_process";import{promisify as KU}from"util";async function MU(D,F){let $=await RD(F);if($?.nativeTeamParentSessionId)return $.nativeTeamParentSessionId;return await Z0()??crypto.randomUUID()}function EU(D,F,$,J){let B=D.provider==="claude",X={provider:D.provider,team:D.team,role:D.role,skill:D.skill,extraArgs:D.extraArgs,sessionId:B&&!J?crypto.randomUUID():void 0,resume:B?J:void 0};if(B)X.nativeTeam={enabled:!0,parentSessionId:F,color:$,agentType:D.role??"general-purpose",agentName:D.role};return X}function AU(D){if(D.env&&Object.keys(D.env).length>0)return`env ${Object.entries(D.env).map(([$,J])=>`${$}=${J}`).join(" ")} ${D.command}`;return D.command}async function RU(D,F){let $=F?`${D}-${F}`:D;return(await p()).some((B)=>B.id===$)?`${$}-${crypto.randomUUID().slice(0,8)}`:$}async function OU(D,F){let $=D.cwd??process.cwd(),J=D.team,B=await MU($,J);await h2(J,`Genie team: ${J}`,B);let X=await R8(J),Q=EU(D,B,X,F),Y=K8(X3(Q)),q=AU(Y),G=await RU(J,D.role),H="genie",V=null;try{V=await d2(H,J,$)}catch{}let W=V?`-t '${V.windowId}'`:"",{stdout:U}=await g$(`tmux split-window -d ${W} -P -F '#{pane_id}' ${q}`),z=U.trim(),E=`${H}:${V?.windowName??""}`;if(!V){let t=await ED(H);E=t[0]?t[0].id:`${H}:`}try{await g$(`tmux ${f8(E,u8())}`)}catch{}let C=new Date().toISOString(),L=D.role??"worker",R=D.provider==="claude",y={id:G,paneId:z,session:H,provider:D.provider,transport:"tmux",role:D.role,skill:D.skill,team:J,worktree:null,startedAt:C,state:"spawning",lastStateChange:C,repoPath:$,claudeSessionId:F??Q.sessionId,nativeTeamEnabled:R,nativeAgentId:`${L}@${J}`,nativeColor:X,parentSessionId:B,window:V?.windowName,windowName:V?.windowName,windowId:V?.windowId};if(await u2(y),await g2(J,{agentName:L,agentType:D.role??"general-purpose",color:X??"blue",tmuxPaneId:z,cwd:$}),await m2(J,"team-lead",{from:L,text:`Worker ${L} (${D.provider}) auto-spawned${F?" with --resume":""}. Ready for tasks.`,summary:`${L} auto-spawned`,timestamp:C,color:X??"blue",read:!1}),X)await G3(z,X,V?.windowId);return{worker:y,paneId:z,workerId:G}}var g$;var l$=I(()=>{MD();l2();M8();Z3();$D();g$=KU(zU)});var c$={};BD(c$,{sendMessage:()=>IU,getInbox:()=>PU});async function _U(D,F=CU){let $=Date.now();while(Date.now()-$<F){try{let J=await AD(D,30);if(J6(J).type==="idle")return!0}catch{}await new Promise((J)=>setTimeout(J,jU))}return!1}async function d$(D){let F=await p(),$=[],J=[],B=[];for(let X of F){if(X.state==="suspended")continue;if(!await TD(X.paneId))continue;if(X.id===D)$.push(X);else if(X.role===D)J.push(X);else if(`${X.team}:${X.role}`===D)B.push(X)}if($.length>0)return $;if(J.length>0)return J;return B}async function LU(D){let F=await d$(D);return F.length===1?F[0]:null}async function ZU(D,F){if(D&&D.state!=="suspended"&&await TD(D.paneId))return{worker:D,respawned:!1};let $=await LU(F);if($)return{worker:$,respawned:!1};if(!process.env.TMUX)return null;let J=await J3(),B=[D?.role,D?.id,F].filter((G)=>Boolean(G)),X=[...new Set(B)],Q=D?.team,Y=J.find((G)=>{if(Q&&G.team!==Q)return!1;return X.some((H)=>G.id===H||G.role===H||`${G.team}:${G.role}`===H)});if(!Y)return null;let q=Y.provider==="claude"?D?.claudeSessionId??Y.lastSessionId:void 0;try{if(await TU(F,Q),D)await fD(D.id);let{spawnWorkerFromTemplate:G}=await Promise.resolve().then(() => (l$(),m$)),H=await G(Y,q);if(await L0({...Y,lastSpawnedAt:new Date().toISOString(),lastSessionId:H.worker.claudeSessionId}),await _U(H.paneId),!await TD(H.paneId))return await fD(H.worker.id),null;return{worker:H.worker,respawned:!0}}catch{return null}}async function TU(D,F){let $=await p();for(let J of $){if(F&&J.team!==F)continue;if(!(J.role===D||J.id===D))continue;if(await TD(J.paneId))continue;await fD(J.id)}}async function p$(D,F,$,J){let B=await W5(D,F,$.id,J),X=$.nativeTeamEnabled&&$.team&&$.role?await SU($,B):await bU($,B);if(X)await U5(D,$.id,B.id);return{messageId:B.id,workerId:$.id,delivered:X}}async function NU(D,F,$,J,B){let X=B??await O8();if(!X)return null;let Q=await y2(X).catch(()=>null);if(!Q)return null;if(!Q.members?.some((q)=>q.name===$||q.agentId===`${$}@${X}`))return null;try{let q=await W5(D,F,$,J),G={from:F,text:J,summary:J.length>50?`${J.substring(0,50)}...`:J,timestamp:new Date().toISOString(),color:"blue",read:!1};return await m2(X,$,G),await U5(D,$,q.id),{messageId:q.id,workerId:$,delivered:!0}}catch{return null}}async function IU(D,F,$,J,B){let X=await d$($);if(X.length===1)return p$(D,F,X[0],J);if(X.length>1)return{messageId:"",workerId:$,delivered:!1,reason:`Worker "${$}" is ambiguous. Found ${X.length} live matches: ${X.map((H)=>H.id).join(", ")}. Use exact worker ID.`};let{resolve:Q}=await Promise.resolve().then(() => (C3(),O3)),Y=await Q($),q=await rD($);if(!q){let H=await p();q=H.find((V)=>V.role===$&&V.state==="suspended")??H.find((V)=>V.role===$)??null}if(Y||q){let H=await ZU(q,$);if(H)return p$(D,F,H.worker,J)}let G=await NU(D,F,$,J,B);if(G)return G;return{messageId:"",workerId:$,delivered:!1,reason:`Worker "${$}" not found or not alive`}}async function SU(D,F){try{let $=P$(F,D.nativeColor??"blue"),J=D.role??D.id;return await m2(D.team??"",J,$),!0}catch{return!1}}async function bU(D,F){if(!D.paneId)return!1;if(!/^%\d+$/.test(D.paneId))return!1;try{let $=F.body.replace(/'/g,"'\\''");return await f(`send-keys -t '${D.paneId}' '${$}'`),await new Promise((J)=>setTimeout(J,200)),await f(`send-keys -t '${D.paneId}' Enter`),!0}catch{return!1}}async function PU(D,F){return b$(D,F)}var CU=15000,jU=1000;var i$=I(()=>{MD();l2();v$();M5();$D()});var o$={};BD(o$,{readMessages:()=>uU,postMessage:()=>fU});import{appendFile as vU,mkdir as kU,readFile as wU}from"fs/promises";import{join as r$}from"path";function n$(D){return r$(D,".genie","chat")}function E5(D,F){let $=F.replace(/\//g,"--");return r$(n$(D),`${$}.jsonl`)}async function fU(D,F,$,J){let B=n$(D);await kU(B,{recursive:!0});let X=await HD(E5(D,F));try{let Q={id:`chat-${w3()}`,sender:$,body:J,timestamp:new Date().toISOString()},Y=E5(D,F);return await vU(Y,`${JSON.stringify(Q)}
342
342
  `),Q}finally{await X()}}async function uU(D,F,$){let J=E5(D,F),B;try{B=await wU(J,"utf-8")}catch{return[]}let X=B.trim().split(`
343
343
  `).filter(Boolean),Q=[];for(let Y of X)try{Q.push(JSON.parse(Y))}catch{}if($){let Y=new Date($).getTime();Q=Q.filter((q)=>new Date(q.timestamp).getTime()>=Y)}return Q}var s$=I(()=>{G5();f2()});var zJ={};BD(zJ,{getOrCreateSession:()=>Zz});import{mkdir as Rz,readFile as Oz,writeFile as Cz}from"fs/promises";import{homedir as jz}from"os";import{dirname as _z,join as VJ}from"path";function UJ(){return VJ(process.env.GENIE_HOME??VJ(jz(),".genie"),"sessions.json")}async function Lz(){try{let D=await Oz(UJ(),"utf-8");return JSON.parse(D)}catch{return{sessions:{}}}}async function WJ(D){let F=UJ();await Rz(_z(F),{recursive:!0}),await Cz(F,JSON.stringify(D,null,2))}async function Zz(D){let F=await Lz(),$=F.sessions[D];if($)return $.lastUsedAt=new Date().toISOString(),await WJ(F),{uuid:$.uuid,isNew:!1};let J=crypto.randomUUID();return F.sessions[D]={uuid:J,createdAt:new Date().toISOString(),lastUsedAt:new Date().toISOString()},await WJ(F),{uuid:J,isNew:!0}}var KJ=()=>{};var T5={};BD(T5,{sessionCommand:()=>mz,sanitizeWindowName:()=>h3,getAgentsFilePath:()=>EJ,buildClaudeCommand:()=>Z5});import{spawnSync as Tz}from"child_process";import{createHash as Nz}from"crypto";import{existsSync as MJ,readFileSync as Iz,readdirSync as Sz,statSync as bz}from"fs";import{homedir as Pz}from"os";import{basename as g3,join as L5}from"path";function kz(D){return Nz("md5").update(D).digest("hex").slice(0,4)}function EJ(){let D=L5(process.cwd(),"AGENTS.md");if(MJ(D))return D;return null}function wz(D){return D.replace(/\//g,"-")}function AJ(D,F,$){let J=wz($),B=L5(Pz(),".claude","projects",J);if(!MJ(B))return null;let X;try{X=Sz(B).filter((Q)=>Q.endsWith(".jsonl")).map((Q)=>{let Y=L5(B,Q);return{path:Y,mtime:bz(Y).mtimeMs}}).sort((Q,Y)=>Y.mtime-Q.mtime)}catch{return null}for(let{path:Q}of X)try{let Y=Iz(Q,"utf-8").split(`
344
344
  `)[0];if(!Y)continue;let q=JSON.parse(Y);if(q.teamName===D&&q.agentName===F&&q.sessionId)return q.sessionId}catch{}return null}async function RJ(D,F){await h2(D,`Genie team: ${D}`,"pending"),await g2(D,{agentName:g3(F),agentType:"general-purpose",color:"blue",cwd:F})}function Z5(D,F,$){return A1(D,{systemPromptFile:F,resumeSessionId:$})}async function OJ(D,F,$){try{let J=`${D}:${F}`,B=(await f(`display -t ${x(J)} -p '#{pane_id}'`)).trim(),X=new Date().toISOString(),Q=r(F);await u2({id:`${Q}-team-lead`,paneId:B,session:D,team:F,role:"team-lead",worktree:null,startedAt:X,state:"working",lastStateChange:X,repoPath:$,provider:"claude",transport:"tmux",nativeTeamEnabled:!0,nativeAgentId:`team-lead@${Q}`})}catch{}}async function fz(D,F){let $=h3(g3(F));if(!await L8(D,$))return $;if(await R1(`${D}:${$}`,"GENIE_CWD")===F)return $;return`${$}-${kz(F)}`}async function uz(D,F,$,J){if(await RJ(F,$),console.log(`Native team "${F}" ready at ~/.claude/teams/${r(F)}/`),console.log(`Creating session "${D}"...`),!await C1(D))console.error(`Failed to create session "${D}"`),process.exit(1);let Q=(await ED(D))[0];if(!Q)console.error(`Failed to find initial window in session "${D}"`),process.exit(1);await f(`rename-window -t ${x(Q.id)} ${x(F)}`),await f(`set-window-option -t ${x(Q.id)} automatic-rename off`),await _8(`${D}:${F}`,"GENIE_CWD",$);let Y=`${D}:${F}`,q=`cd ${x($)}`;await f(`send-keys -t ${x(Y)} ${x(q)} Enter`);let G=g3($),H=AJ(r(F),G,$);if(H)console.log(`Resuming previous session: ${H}`);let V=Z5(F,J||void 0,H||void 0);await f(`send-keys -t ${x(Y)} ${x(V)} Enter`),console.log(`Started Claude Code as ${G}@${r(F)} in ${$}`),await OJ(D,F,$)}async function xz(D,F,$,J){if((await d2(D,F,$)).created){console.log(`Created team window "${F}"`),await _8(`${D}:${F}`,"GENIE_CWD",$),await RJ(F,$);let X=`${D}:${F}`,Q=`cd ${x($)}`;await f(`send-keys -t ${x(X)} ${x(Q)} Enter`);let Y=g3($),q=AJ(r(F),Y,$);if(q)console.log(`Resuming previous session: ${q}`);let G=Z5(F,J||void 0,q||void 0);await f(`send-keys -t ${x(X)} ${x(G)} Enter`),console.log(`Started Claude Code as ${Y}@${r(F)} in ${$}`),await OJ(D,F,$)}await f(`select-window -t ${x(`${D}:${F}`)}`),console.log(`Focused team window "${F}"`)}function h3(D){return D.replace(/\./g,"-")}async function yz(D,F,$){if($)return h3($);if(await oD(D))return h3(await fz(D,F));return h3(g3(F))}async function hz(D,F){let $=await oD(D);if($){let J=await ED($.id);console.log(`Resetting session "${D}"...`),await O1($.id),await Promise.all(J.map((B)=>Y3(B.name)))}else await Y3(F)}function gz(D,F){console.log("Attaching...");let $=`${D}:${F}`,J=process.env.TMUX?"switch-client":"attach";Tz("tmux",[J,"-t",$],{stdio:"inherit"})}async function mz(D={}){let F=D.name??vz,$=D.dir??process.cwd();try{let J=await yz(F,$,D.team);if(D.reset)await hz(F,J);let B=await oD(F),X=EJ();if(!X)console.warn("Info: No AGENTS.md found in current directory. Team-lead will use orchestration rules only.");if(!B)await uz(F,J,$,X);else console.log(`Session "${F}" already exists`),await xz(F,J,$,X);gz(F,J)}catch(J){let B=J instanceof Error?J.message:String(J);console.error(`Error: ${B}`),process.exit(1)}}var vz="genie";var N5=I(()=>{MD();l2();j8();$D()});var l5=U2(m5(),1),{program:az,createCommand:tz,createArgument:ez,createOption:DK,CommanderError:FK,InvalidArgumentError:$K,InvalidOptionArgumentError:JK,Command:p5,Argument:BK,Option:XK,Help:QK}=l5.default;import{existsSync as dX}from"fs";var{$:C7}=globalThis.Bun;import{existsSync as d5,unlinkSync as AB}from"fs";import{homedir as c5}from"os";import{join as c3}from"path";var i5=c3(c5(),".claude"),RB=c3(i5,"hooks"),OB=c3(i5,"settings.json"),CB="genie-bash-hook.sh";function r5(){return OB}function n5(){return c3(RB,CB)}function o5(){return d5(n5())}function s5(){let D=n5();if(d5(D))AB(D)}function E6(D){let F=c5();if(D.startsWith(`${F}/`))return`~${D.slice(F.length)}`;if(D===F)return"~";return D}pD();var{$:L6}=globalThis.Bun;async function C2(D){try{let $=(await L6`which ${D}`.quiet().text()).trim();if(!$)return{exists:!1};let J;try{let X=(await L6`${D} --version`.quiet().text()).split(`
345
345
  `)[0].trim(),Q=X.match(/(\d+\.[\d.]+[a-z0-9-]*)/i);J=Q?Q[1]:X.slice(0,50)}catch{try{let X=(await L6`${D} -v`.quiet().text()).split(`
346
- `)[0].trim(),Q=X.match(/(\d+\.[\d.]+[a-z0-9-]*)/i);J=Q?Q[1]:X.slice(0,50)}catch{}}return{exists:!0,version:J,path:$}}catch{return{exists:!1}}}function cX(D){console.log(),console.log(`\x1B[1m${D}:\x1B[0m`)}function iX(D){let $={pass:"\x1B[32m\u2713\x1B[0m",fail:"\x1B[31m\u2717\x1B[0m",warn:"\x1B[33m!\x1B[0m"}[D.status],J=D.message?` ${D.message}`:"";if(console.log(` ${$} ${D.name}${J}`),D.suggestion)console.log(` \x1B[2m${D.suggestion}\x1B[0m`)}async function rX(){let D=[],F=await C2("tmux");if(F.exists)D.push({name:"tmux",status:"pass",message:F.version||""});else D.push({name:"tmux",status:"fail",suggestion:"Install with: brew install tmux (or apt install tmux)"});let $=await C2("jq");if($.exists)D.push({name:"jq",status:"pass",message:$.version||""});else D.push({name:"jq",status:"fail",suggestion:"Install with: brew install jq (or apt install jq)"});let J=await C2("bun");if(J.exists)D.push({name:"bun",status:"pass",message:J.version||""});else D.push({name:"bun",status:"fail",suggestion:"Install with: curl -fsSL https://bun.sh/install | bash"});let B=await C2("claude");if(B.exists)D.push({name:"Claude Code",status:"pass",message:B.version||""});else D.push({name:"Claude Code",status:"warn",suggestion:"Install with: npm install -g @anthropic-ai/claude-code"});return D}async function nX(){let D=[];if(O2())D.push({name:"Genie config exists",status:"pass",message:E6(p0())});else D.push({name:"Genie config exists",status:"warn",message:"not found",suggestion:"Run: genie setup"});if(E7())D.push({name:"Setup complete",status:"pass"});else D.push({name:"Setup complete",status:"warn",message:"not completed",suggestion:"Run: genie setup"});let F=r5();if(dX(F))D.push({name:"Claude settings exists",status:"pass",message:E6(F)});else D.push({name:"Claude settings exists",status:"warn",message:"not found",suggestion:"Claude Code creates this on first run"});return D}async function oX(){let D=[];try{if((await C7`tmux list-sessions 2>/dev/null`.quiet()).exitCode===0)D.push({name:"Server running",status:"pass"});else return D.push({name:"Server running",status:"warn",message:"no sessions",suggestion:"Start with: tmux new-session -d -s genie"}),D}catch{return D.push({name:"Server running",status:"warn",message:"could not check"}),D}let $=(await VD()).session.name;try{if((await C7`tmux has-session -t ${$} 2>/dev/null`.quiet()).exitCode===0)D.push({name:`Session '${$}' exists`,status:"pass"});else D.push({name:`Session '${$}' exists`,status:"warn",suggestion:`Start with: tmux new-session -d -s ${$}`})}catch{D.push({name:`Session '${$}' exists`,status:"warn",message:"could not check"})}return D}async function sX(){let D=[];if(!O2())return D.push({name:"Worker profiles",status:"warn",message:"no genie config",suggestion:"Run: genie setup"}),D;let F=await VD(),$=F.workerProfiles;if(!$||Object.keys($).length===0)return D.push({name:"Worker profiles",status:"pass",message:"none configured (using defaults)"}),D;let J=Object.keys($).length;D.push({name:"Profiles configured",status:"pass",message:`${J} profile${J===1?"":"s"}`});for(let B of Object.keys($))D.push({name:`Profile '${B}'`,status:"pass",message:"claude (direct)"});if(F.defaultWorkerProfile)if($[F.defaultWorkerProfile])D.push({name:"Default profile",status:"pass",message:F.defaultWorkerProfile});else D.push({name:"Default profile",status:"warn",message:`'${F.defaultWorkerProfile}' not found`,suggestion:"Run: genie profiles default <profile>"});return D}function F8(D,F,$){cX(D);for(let J of F){if(iX(J),J.status==="fail")$.errors=!0;if(J.status==="warn")$.warnings=!0}}async function j7(){console.log(),console.log("\x1B[1mGenie Doctor\x1B[0m"),console.log(`\x1B[2m${"\u2500".repeat(40)}\x1B[0m`);let D={errors:!1,warnings:!1};if(F8("Prerequisites",await rX(),D),F8("Configuration",await nX(),D),F8("Tmux",await oX(),D),F8("Worker Profiles",await sX(),D),console.log(),console.log(`\x1B[2m${"\u2500".repeat(40)}\x1B[0m`),D.errors)console.log("\x1B[31mSome checks failed.\x1B[0m Run \x1B[36mgenie setup\x1B[0m to fix.");else if(D.warnings)console.log("\x1B[33mSome warnings detected.\x1B[0m Everything should still work.");else console.log("\x1B[32mAll checks passed!\x1B[0m");if(console.log(),D.errors)process.exit(1)}import{homedir as XY}from"os";import{join as QY}from"path";var d0=(D,F=[])=>D.name==="up"||F.includes("vim")&&D.name==="k"||F.includes("emacs")&&D.ctrl&&D.name==="p",$8=(D,F=[])=>D.name==="down"||F.includes("vim")&&D.name==="j"||F.includes("emacs")&&D.ctrl&&D.name==="n";var c0=(D)=>D.name==="backspace",i0=(D)=>D.name==="tab",Z6=(D)=>"1234567890".includes(D.name),j2=(D)=>D.name==="enter"||D.name==="return";class T6 extends Error{name="AbortPromptError";message="Prompt was aborted";constructor(D){super();this.cause=D?.cause}}class N6 extends Error{name="CancelPromptError";message="Prompt was canceled"}class J8 extends Error{name="ExitPromptError"}class I6 extends Error{name="HookError"}class r0 extends Error{name="ValidationError"}import{AsyncResource as DQ}from"async_hooks";import{AsyncLocalStorage as aX,AsyncResource as tX}from"async_hooks";var _7=new aX;function eX(D){return{rl:D,hooks:[],hooksCleanup:[],hooksEffect:[],index:0,handleChange(){}}}function L7(D,F){let $=eX(D);return _7.run($,()=>{function J(B){$.handleChange=()=>{$.index=0,B()},$.handleChange()}return F(J)})}function _2(){let D=_7.getStore();if(!D)throw new I6("[Inquirer] Hook functions can only be called from within a prompt");return D}function S6(){return _2().rl}function b6(D){let F=(...$)=>{let J=_2(),B=!1,X=J.handleChange;J.handleChange=()=>{B=!0};let Q=D(...$);if(B)X();return J.handleChange=X,Q};return tX.bind(F)}function W0(D){let F=_2(),{index:$}=F,J={get(){return F.hooks[$]},set(X){F.hooks[$]=X},initialized:$ in F.hooks},B=D(J);return F.index++,B}function Z7(){_2().handleChange()}var L2={queue(D){let F=_2(),{index:$}=F;F.hooksEffect.push(()=>{F.hooksCleanup[$]?.();let J=D(S6());if(J!=null&&typeof J!=="function")throw new r0("useEffect return value must be a cleanup function or nothing.");F.hooksCleanup[$]=J})},run(){let D=_2();b6(()=>{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 o(D){return W0((F)=>{let $=DQ.bind(function(X){if(F.get()!==X)F.set(X),Z7()});if(F.initialized)return[F.get(),$];let J=typeof D==="function"?D():D;return F.set(J),[J,$]})}function dD(D,F){W0(($)=>{let J=$.get();if(!Array.isArray(J)||F.some((X,Q)=>!Object.is(X,J[Q])))L2.queue(D);$.set(F)})}var UD=U2(B8(),1);import vD from"process";function JQ(){if(vD.platform!=="win32")return vD.env.TERM!=="linux";return Boolean(vD.env.WT_SESSION)||Boolean(vD.env.TERMINUS_SUBLIME)||vD.env.ConEmuTask==="{cmd::Cmder}"||vD.env.TERM_PROGRAM==="Terminus-Sublime"||vD.env.TERM_PROGRAM==="vscode"||vD.env.TERM==="xterm-256color"||vD.env.TERM==="alacritty"||vD.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var N7={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"},I7={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"},BQ={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"},XQ={...N7,...I7},QQ={...N7,...BQ},YQ=JQ(),qQ=YQ?XQ:QQ,U0=qQ,VM=Object.entries(I7);var S7={prefix:{idle:UD.default.blue("?"),done:UD.default.green(U0.tick)},spinner:{interval:80,frames:["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"].map((D)=>UD.default.yellow(D))},style:{answer:UD.default.cyan,message:UD.default.bold,error:(D)=>UD.default.red(`> ${D}`),defaultAnswer:(D)=>UD.default.dim(`(${D})`),help:UD.default.dim,highlight:UD.default.cyan,key:(D)=>UD.default.cyan(UD.default.bold(`<${D}>`))}};function b7(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 P7(...D){let F={};for(let $ of D)for(let[J,B]of Object.entries($)){let X=F[J];F[J]=b7(X)&&b7(B)?P7(X,B):B}return F}function cD(...D){let F=[S7,...D.filter(($)=>$!=null)];return P7(...F)}function Z2({status:D="idle",theme:F}){let[$,J]=o(!1),[B,X]=o(0),{prefix:Q,spinner:Y}=cD(F);if(dD(()=>{if(D==="loading"){let G,H=-1,V=setTimeout(()=>{J(!0),G=setInterval(()=>{H=H+1,X(H%Y.frames.length)},Y.interval)},300);return()=>{clearTimeout(V),clearInterval(G)}}else J(!1)},[D]),$)return Y.frames[B];return typeof Q==="string"?Q:Q[D==="loading"?"idle":D]??Q.idle}function n0(D,F){return W0(($)=>{let J=$.get();if(!J||J.dependencies.length!==F.length||J.dependencies.some((B,X)=>B!==F[X])){let B=D();return $.set({value:B,dependencies:F}),B}return J.value})}function T2(D){return o({current:D})[0]}function N2(D){let F=T2(D);F.current=D,dD(($)=>{let J=!1,B=b6((X,Q)=>{if(J)return;F.current(Q,$)});return $.input.on("keypress",B),()=>{J=!0,$.input.removeListener("keypress",B)}},[])}var Q9=U2(k7(),1),Y9=U2(X9(),1);function a0(D,F){return D.split(`
346
+ `)[0].trim(),Q=X.match(/(\d+\.[\d.]+[a-z0-9-]*)/i);J=Q?Q[1]:X.slice(0,50)}catch{}}return{exists:!0,version:J,path:$}}catch{return{exists:!1}}}function cX(D){console.log(),console.log(`\x1B[1m${D}:\x1B[0m`)}function iX(D){let $={pass:"\x1B[32m\u2713\x1B[0m",fail:"\x1B[31m\u2717\x1B[0m",warn:"\x1B[33m!\x1B[0m"}[D.status],J=D.message?` ${D.message}`:"";if(console.log(` ${$} ${D.name}${J}`),D.suggestion)console.log(` \x1B[2m${D.suggestion}\x1B[0m`)}async function rX(){let D=[],F=await C2("tmux");if(F.exists)D.push({name:"tmux",status:"pass",message:F.version||""});else D.push({name:"tmux",status:"fail",suggestion:"Install with: brew install tmux (or apt install tmux)"});let $=await C2("jq");if($.exists)D.push({name:"jq",status:"pass",message:$.version||""});else D.push({name:"jq",status:"fail",suggestion:"Install with: brew install jq (or apt install jq)"});let J=await C2("bun");if(J.exists)D.push({name:"bun",status:"pass",message:J.version||""});else D.push({name:"bun",status:"fail",suggestion:"Install with: curl -fsSL https://bun.sh/install | bash"});let B=await C2("claude");if(B.exists)D.push({name:"Claude Code",status:"pass",message:B.version||""});else D.push({name:"Claude Code",status:"warn",suggestion:"Install with: npm install -g @anthropic-ai/claude-code"});return D}async function nX(){let D=[];if(O2())D.push({name:"Genie config exists",status:"pass",message:E6(p0())});else D.push({name:"Genie config exists",status:"warn",message:"not found",suggestion:"Run: genie setup"});if(E7())D.push({name:"Setup complete",status:"pass"});else D.push({name:"Setup complete",status:"warn",message:"not completed",suggestion:"Run: genie setup"});let F=r5();if(dX(F))D.push({name:"Claude settings exists",status:"pass",message:E6(F)});else D.push({name:"Claude settings exists",status:"warn",message:"not found",suggestion:"Claude Code creates this on first run"});return D}async function oX(){let D=[];try{if((await C7`tmux list-sessions 2>/dev/null`.quiet()).exitCode===0)D.push({name:"Server running",status:"pass"});else return D.push({name:"Server running",status:"warn",message:"no sessions",suggestion:"Start with: tmux new-session -d -s genie"}),D}catch{return D.push({name:"Server running",status:"warn",message:"could not check"}),D}let $=(await VD()).session.name;try{if((await C7`tmux has-session -t ${$} 2>/dev/null`.quiet()).exitCode===0)D.push({name:`Session '${$}' exists`,status:"pass"});else D.push({name:`Session '${$}' exists`,status:"warn",suggestion:`Start with: tmux new-session -d -s ${$}`})}catch{D.push({name:`Session '${$}' exists`,status:"warn",message:"could not check"})}return D}async function sX(){let D=[];if(!O2())return D.push({name:"Worker profiles",status:"warn",message:"no genie config",suggestion:"Run: genie setup"}),D;let F=await VD(),$=F.workerProfiles;if(!$||Object.keys($).length===0)return D.push({name:"Worker profiles",status:"pass",message:"none configured (using defaults)"}),D;let J=Object.keys($).length;D.push({name:"Profiles configured",status:"pass",message:`${J} profile${J===1?"":"s"}`});for(let B of Object.keys($))D.push({name:`Profile '${B}'`,status:"pass",message:"claude (direct)"});if(F.defaultWorkerProfile)if($[F.defaultWorkerProfile])D.push({name:"Default profile",status:"pass",message:F.defaultWorkerProfile});else D.push({name:"Default profile",status:"warn",message:`'${F.defaultWorkerProfile}' not found`,suggestion:"Run: genie profiles default <profile>"});return D}function F8(D,F,$){cX(D);for(let J of F){if(iX(J),J.status==="fail")$.errors=!0;if(J.status==="warn")$.warnings=!0}}async function j7(){console.log(),console.log("\x1B[1mGenie Doctor\x1B[0m"),console.log(`\x1B[2m${"\u2500".repeat(40)}\x1B[0m`);let D={errors:!1,warnings:!1};if(F8("Prerequisites",await rX(),D),F8("Configuration",await nX(),D),F8("Tmux",await oX(),D),F8("Worker Profiles",await sX(),D),console.log(),console.log(`\x1B[2m${"\u2500".repeat(40)}\x1B[0m`),D.errors)console.log("\x1B[31mSome checks failed.\x1B[0m Run \x1B[36mgenie setup\x1B[0m to fix.");else if(D.warnings)console.log("\x1B[33mSome warnings detected.\x1B[0m Everything should still work.");else console.log("\x1B[32mAll checks passed!\x1B[0m");if(console.log(),D.errors)process.exit(1)}import{homedir as XY}from"os";import{join as QY}from"path";var d0=(D,F=[])=>D.name==="up"||F.includes("vim")&&D.name==="k"||F.includes("emacs")&&D.ctrl&&D.name==="p",$8=(D,F=[])=>D.name==="down"||F.includes("vim")&&D.name==="j"||F.includes("emacs")&&D.ctrl&&D.name==="n";var c0=(D)=>D.name==="backspace",i0=(D)=>D.name==="tab",Z6=(D)=>"1234567890".includes(D.name),j2=(D)=>D.name==="enter"||D.name==="return";class T6 extends Error{name="AbortPromptError";message="Prompt was aborted";constructor(D){super();this.cause=D?.cause}}class N6 extends Error{name="CancelPromptError";message="Prompt was canceled"}class J8 extends Error{name="ExitPromptError"}class I6 extends Error{name="HookError"}class r0 extends Error{name="ValidationError"}import{AsyncResource as DQ}from"async_hooks";import{AsyncLocalStorage as aX,AsyncResource as tX}from"async_hooks";var _7=new aX;function eX(D){return{rl:D,hooks:[],hooksCleanup:[],hooksEffect:[],index:0,handleChange(){}}}function L7(D,F){let $=eX(D);return _7.run($,()=>{function J(B){$.handleChange=()=>{$.index=0,B()},$.handleChange()}return F(J)})}function _2(){let D=_7.getStore();if(!D)throw new I6("[Inquirer] Hook functions can only be called from within a prompt");return D}function S6(){return _2().rl}function b6(D){let F=(...$)=>{let J=_2(),B=!1,X=J.handleChange;J.handleChange=()=>{B=!0};let Q=D(...$);if(B)X();return J.handleChange=X,Q};return tX.bind(F)}function W0(D){let F=_2(),{index:$}=F,J={get(){return F.hooks[$]},set(X){F.hooks[$]=X},initialized:$ in F.hooks},B=D(J);return F.index++,B}function Z7(){_2().handleChange()}var L2={queue(D){let F=_2(),{index:$}=F;F.hooksEffect.push(()=>{F.hooksCleanup[$]?.();let J=D(S6());if(J!=null&&typeof J!=="function")throw new r0("useEffect return value must be a cleanup function or nothing.");F.hooksCleanup[$]=J})},run(){let D=_2();b6(()=>{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 o(D){return W0((F)=>{let $=DQ.bind(function(X){if(F.get()!==X)F.set(X),Z7()});if(F.initialized)return[F.get(),$];let J=typeof D==="function"?D():D;return F.set(J),[J,$]})}function dD(D,F){W0(($)=>{let J=$.get();if(!Array.isArray(J)||F.some((X,Q)=>!Object.is(X,J[Q])))L2.queue(D);$.set(F)})}var UD=U2(B8(),1);import kD from"process";function JQ(){if(kD.platform!=="win32")return kD.env.TERM!=="linux";return Boolean(kD.env.WT_SESSION)||Boolean(kD.env.TERMINUS_SUBLIME)||kD.env.ConEmuTask==="{cmd::Cmder}"||kD.env.TERM_PROGRAM==="Terminus-Sublime"||kD.env.TERM_PROGRAM==="vscode"||kD.env.TERM==="xterm-256color"||kD.env.TERM==="alacritty"||kD.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var N7={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"},I7={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"},BQ={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"},XQ={...N7,...I7},QQ={...N7,...BQ},YQ=JQ(),qQ=YQ?XQ:QQ,U0=qQ,VM=Object.entries(I7);var S7={prefix:{idle:UD.default.blue("?"),done:UD.default.green(U0.tick)},spinner:{interval:80,frames:["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"].map((D)=>UD.default.yellow(D))},style:{answer:UD.default.cyan,message:UD.default.bold,error:(D)=>UD.default.red(`> ${D}`),defaultAnswer:(D)=>UD.default.dim(`(${D})`),help:UD.default.dim,highlight:UD.default.cyan,key:(D)=>UD.default.cyan(UD.default.bold(`<${D}>`))}};function b7(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 P7(...D){let F={};for(let $ of D)for(let[J,B]of Object.entries($)){let X=F[J];F[J]=b7(X)&&b7(B)?P7(X,B):B}return F}function cD(...D){let F=[S7,...D.filter(($)=>$!=null)];return P7(...F)}function Z2({status:D="idle",theme:F}){let[$,J]=o(!1),[B,X]=o(0),{prefix:Q,spinner:Y}=cD(F);if(dD(()=>{if(D==="loading"){let G,H=-1,V=setTimeout(()=>{J(!0),G=setInterval(()=>{H=H+1,X(H%Y.frames.length)},Y.interval)},300);return()=>{clearTimeout(V),clearInterval(G)}}else J(!1)},[D]),$)return Y.frames[B];return typeof Q==="string"?Q:Q[D==="loading"?"idle":D]??Q.idle}function n0(D,F){return W0(($)=>{let J=$.get();if(!J||J.dependencies.length!==F.length||J.dependencies.some((B,X)=>B!==F[X])){let B=D();return $.set({value:B,dependencies:F}),B}return J.value})}function T2(D){return o({current:D})[0]}function N2(D){let F=T2(D);F.current=D,dD(($)=>{let J=!1,B=b6((X,Q)=>{if(J)return;F.current(Q,$)});return $.input.on("keypress",B),()=>{J=!0,$.input.removeListener("keypress",B)}},[])}var Q9=U2(k7(),1),Y9=U2(X9(),1);function a0(D,F){return D.split(`
347
347
  `).flatMap(($)=>Y9.default($,F,{trim:!1,hard:!0}).split(`
348
348
  `).map((J)=>J.trimEnd())).join(`
349
349
  `)}function Y8(){return Q9.default({defaultWidth:80,output:S6().output})}function bQ({active:D,renderedItems:F,pageSize:$,loop:J}){let B=T2({lastPointer:D,lastActive:void 0}),{lastPointer:X,lastActive:Q}=B.current,Y=Math.floor($/2),q=F.reduce((V,W)=>V+W.length,0),G=F.slice(0,D).reduce((V,W)=>V+W.length,0),H=G;if(q>$)if(J){if(H=X,Q!=null&&Q<D&&D-Q<$)H=Math.min(Y,Math.abs(D-Q)===1?Math.min(X+(F[Q]?.length??0),Math.max(G,X)):X+D-Q)}else{let V=F.slice(D).reduce((W,U)=>W+U.length,0);H=V<$-Y?$-V:Math.min(G,Y)}return B.current.lastPointer=H,B.current.lastActive=D,H}function h6({items:D,active:F,renderItem:$,pageSize:J,loop:B=!0}){let X=Y8(),Q=(L)=>(L%D.length+D.length)%D.length,Y=D.map((L,R)=>{if(L==null)return[];return a0($({item:L,index:R,isActive:R===F}),X).split(`
@@ -438,7 +438,7 @@ Next steps:`),console.log(" 1. Reload tmux: tmux source ~/.tmux.conf"),console.
438
438
  `:"";return oQ(D,B),!0}async function t6(D,F,$){if(!P2(D))return;if(!e0(D,F)){console.log(`\u2713 ${$} has no genie shortcuts`);return}if(await f9(`Remove shortcuts from ${D}? [Y/n] `)==="n"){console.log(`\u23ED\uFE0F Skipped ${$}`);return}if(BY(D,F))console.log(`\u2705 Removed from ${D}`)}async function u9(){let D=v9(),F="generated by genie-cli";console.log(`Uninstalling Warp-like shortcuts...
439
439
  `),await t6(ZD(D,".tmux.conf"),"generated by genie-cli","tmux.conf");for(let B of[ZD(D,".zshrc"),ZD(D,".bashrc")])await t6(B,"generated by genie-cli",B);let $=ZD(D,".termux"),J=P2($)||process.env.TERMUX_VERSION;if(J){let B=ZD($,"termux.properties");if(await t6(B,"generated by genie-cli","termux.properties"),!e0(B,"generated by genie-cli"))console.log(" Run: termux-reload-settings")}if(console.log(`
440
440
  \u2705 Uninstallation complete!`),console.log(`
441
- Next steps:`),console.log(" 1. Reload tmux: tmux source ~/.tmux.conf"),console.log(" 2. Restart your shell or run: source ~/.bashrc"),J)console.log(" 3. Reload Termux: termux-reload-settings")}function F3(){console.log(),console.log(`\x1B[1m\x1B[36m${"=".repeat(64)}\x1B[0m`),console.log("\x1B[1m\x1B[36m Genie Setup Wizard\x1B[0m"),console.log(`\x1B[1m\x1B[36m${"=".repeat(64)}\x1B[0m`),console.log()}function v2(D,F){if(console.log(),console.log(`\x1B[1m${D}\x1B[0m`),F)console.log(`\x1B[2m${F}\x1B[0m`);console.log()}async function x9(D,F){if(v2("2. Session Configuration","Configure tmux session settings"),F)return console.log(` Using defaults: session="${D.session.name}", window="${D.session.defaultWindow}"`),D;let $=await b2({message:"Session name:",default:D.session.name}),J=await b2({message:"Default window name:",default:D.session.defaultWindow}),B=await iD({message:"Auto-create session on connect?",default:D.session.autoCreate});return D.session={name:$,defaultWindow:J,autoCreate:B},D}async function y9(D,F){if(v2("3. Terminal Defaults","Configure default values for term commands"),F)return console.log(` Using defaults: timeout=${D.terminal.execTimeout}ms, lines=${D.terminal.readLines}`),D;let $=await b2({message:"Exec timeout (milliseconds):",default:String(D.terminal.execTimeout),validate:(X)=>{let Q=Number.parseInt(X,10);return!Number.isNaN(Q)&&Q>0?!0:"Must be a positive number"}}),J=await b2({message:"Read lines (default for genie agent read):",default:String(D.terminal.readLines),validate:(X)=>{let Q=Number.parseInt(X,10);return!Number.isNaN(Q)&&Q>0?!0:"Must be a positive number"}}),B=await b2({message:"Worktree base directory (leave empty for ~/.genie/worktrees/<project>/):",default:D.terminal.worktreeBase??""});return D.terminal={execTimeout:Number.parseInt($,10),readLines:Number.parseInt(J,10),...B?{worktreeBase:B}:{}},D}async function h9(D,F){v2("4. Keyboard Shortcuts","Warp-like tmux shortcuts for quick navigation");let $=XY(),J=QY($,".tmux.conf");if(D3(J))return console.log(" \x1B[32m\u2713\x1B[0m Tmux shortcuts already installed"),D.shortcuts.tmuxInstalled=!0,D;if(console.log(" Available shortcuts:"),console.log(" \x1B[36mCtrl+T\x1B[0m \u2192 New tab (window)"),console.log(" \x1B[36mCtrl+S\x1B[0m \u2192 Vertical split"),console.log(" \x1B[36mCtrl+H\x1B[0m \u2192 Horizontal split"),console.log(),F)return console.log(" Skipped in quick mode. Run \x1B[36mgenie setup --shortcuts\x1B[0m to install."),D;if(await iD({message:"Install tmux keyboard shortcuts?",default:!1}))console.log(),await H8(),D.shortcuts.tmuxInstalled=!0,await O7({tmuxInstalled:!0});else console.log(" Skipped. Run \x1B[36mgenie shortcuts install\x1B[0m later.");return D}function g9(D){if(D==="changed")console.log(" \x1B[32m\u2713\x1B[0m Codex config updated");else if(D==="unchanged")console.log(" \x1B[32m\u2713\x1B[0m Codex config already up to date");else console.log(" \x1B[31m\u2717\x1B[0m Failed to update codex config")}async function m9(D,F){v2("5. Codex Integration","Configure OpenAI Codex for genie agents");let $=await C2("codex");if(!$.exists)return console.log(" \x1B[33m!\x1B[0m Codex CLI not found. Skipping codex integration."),D;if(console.log(` \x1B[32m\u2713\x1B[0m Codex CLI found (${$.version??"unknown version"})`),I9())return console.log(" \x1B[32m\u2713\x1B[0m Codex config already configured"),D.codex={configured:!0},D;if(console.log(),console.log(" Genie needs to configure codex for agent communication:"),console.log(" \x1B[36mdisable_paste_burst\x1B[0m \u2192 Reliable tmux command injection"),console.log(" \x1B[36mOTel exporter\x1B[0m \u2192 Telemetry relay for state detection"),console.log(` Config: \x1B[2m${WD(S9())}\x1B[0m`),console.log(),F){let B=t0();return g9(B),D.codex={configured:B!=="error"},D}if(await iD({message:"Configure Codex for genie agent integration?",default:!0})){let B=t0();g9(B),D.codex={configured:B!=="error"}}else console.log(" Skipped. Run \x1B[36mgenie setup --codex\x1B[0m later.");return D}async function YY(D,F){if(v2("6. Debug Options","Logging and debugging settings"),F)return console.log(" Using defaults: tmuxDebug=false, verbose=false"),D;let $=await iD({message:"Enable tmux debug logging?",default:D.logging.tmuxDebug}),J=await iD({message:"Enable verbose mode?",default:D.logging.verbose});return D.logging={tmuxDebug:$,verbose:J},D}async function qY(D,F){if(v2("7. Prompt Mode","Controls how genie injects system prompts into Claude Code"),F)return console.log(` Using default: promptMode="${D.promptMode}"`),D;console.log(" append \u2014 Uses --append-system-prompt-file (preserves Claude Code default system prompt)"),console.log(" system \u2014 Uses --system-prompt-file (replaces Claude Code default system prompt)"),console.log();let $=await o6({message:"Prompt mode:",choices:[{name:"append (recommended \u2014 preserves CC default)",value:"append"},{name:"system (replaces CC default)",value:"system"}],default:D.promptMode});return D.promptMode=$,D}async function GY(D){v2("Summary",`Configuration will be saved to ${WD(p0())}`),console.log(` Session: \x1B[36m${D.session.name}\x1B[0m (window: ${D.session.defaultWindow})`),console.log(` Terminal: timeout=${D.terminal.execTimeout}ms, lines=${D.terminal.readLines}`),console.log(` Shortcuts: ${D.shortcuts.tmuxInstalled?"\x1B[32minstalled\x1B[0m":"\x1B[2mnot installed\x1B[0m"}`),console.log(` Codex: ${D.codex?.configured?"\x1B[32mconfigured\x1B[0m":"\x1B[2mnot configured\x1B[0m"}`),console.log(` Debug: tmux=${D.logging.tmuxDebug}, verbose=${D.logging.verbose}`),console.log(` Prompt mode: \x1B[36m${D.promptMode}\x1B[0m`),console.log(),D.setupComplete=!0,D.lastSetupAt=new Date().toISOString(),await PD(D),console.log("\x1B[32m\u2713 Configuration saved!\x1B[0m")}async function HY(){let D=await VD();console.log(),console.log("\x1B[1mCurrent Genie Configuration\x1B[0m"),console.log(`\x1B[2m${WD(p0())}\x1B[0m`),console.log(),console.log(JSON.stringify(D,null,2)),console.log()}function VY(){console.log(),console.log("\x1B[1mNext Steps:\x1B[0m"),console.log(),console.log(" Start a session: \x1B[36mgenie\x1B[0m"),console.log(" Watch AI work: \x1B[36mtmux attach -t genie\x1B[0m"),console.log(" Check health: \x1B[36mgenie doctor\x1B[0m"),console.log()}async function l9(D={}){if(D.show){await HY();return}if(D.reset){await R7(),console.log("\x1B[32m\u2713 Configuration reset to defaults.\x1B[0m"),console.log();return}let F=await VD();if(D.shortcuts){F3(),await h9(F,!1),await A7();return}if(D.terminal){F3(),F=await y9(F,!1),await PD(F),console.log("\x1B[32m\u2713 Terminal configuration saved.\x1B[0m");return}if(D.session){F3(),F=await x9(F,!1),await PD(F),console.log("\x1B[32m\u2713 Session configuration saved.\x1B[0m");return}if(D.codex){if(F3(),F=await m9(F,!1),await PD(F),F.codex?.configured)console.log("\x1B[32m\u2713 Codex configuration saved.\x1B[0m");return}let $=D.quick??!1;if(F3(),$)console.log("\x1B[2mQuick mode: accepting all defaults\x1B[0m");F=await x9(F,$),F=await y9(F,$),F=await h9(F,$),F=await m9(F,$),F=await YY(F,$),F=await qY(F,$),await GY(F),VY()}import{existsSync as WY}from"fs";import{homedir as UY}from"os";import{join as e6}from"path";async function D1(){w9();let D=UY(),F=e6(D,".tmux.conf"),$=e6(D,".zshrc"),J=e6(D,".bashrc");if(console.log("Installation status:"),D3(F))console.log(" \x1B[32m\u2713\x1B[0m tmux.conf");else console.log(" \x1B[33m-\x1B[0m tmux.conf");let B=WY($)?$:J;if(D3(B))console.log(` \x1B[32m\u2713\x1B[0m ${B.replace(D,"~")}`);else console.log(` \x1B[33m-\x1B[0m ${B.replace(D,"~")}`);console.log(),console.log("Run \x1B[36mgenie shortcuts install\x1B[0m to install shortcuts."),console.log("Run \x1B[36mgenie shortcuts uninstall\x1B[0m to remove shortcuts."),console.log()}async function p9(){await H8()}async function d9(){await u9()}import{existsSync as V8,lstatSync as zY,rmSync as KY,unlinkSync as c9}from"fs";import{homedir as i9}from"os";import{join as W8}from"path";pD();var $1=W8(i9(),".claude","rules","genie-orchestration.md"),r9=W8(i9(),".local","bin"),n9=["genie","term"];function o9(D){try{if(!V8(D))return!1;if(!zY(D).isSymbolicLink())return!1;return!0}catch{return!1}}function MY(){let D=[];for(let F of n9){let $=W8(r9,F);if(o9($))try{c9($),D.push(F)}catch{}}return D}function F1(D,F,$){console.log(`\x1B[2m${D}\x1B[0m`);try{$(),console.log(` \x1B[32m+\x1B[0m ${F}`)}catch(J){let B=J instanceof Error?J.message:String(J);console.log(` \x1B[33m!\x1B[0m ${D.replace("...","")} failed: ${B}`)}}function EY(D,F,$,J){if(D)F1("Removing hook script...","Hook script removed",()=>s5());if(F.length>0){console.log("\x1B[2mRemoving symlinks...\x1B[0m");let B=MY();if(B.length>0)console.log(` \x1B[32m+\x1B[0m Removed: ${B.join(", ")}`)}if(V8($1))F1("Removing orchestration rules...","Orchestration rules removed (~/.claude/rules/genie-orchestration.md)",()=>c9($1));if(J)F1("Removing genie directory...","Directory removed",()=>KY($,{recursive:!0,force:!0}))}async function s9(){console.log(),console.log("\x1B[1m\x1B[33m Uninstall Genie CLI\x1B[0m"),console.log();let D=K7(),F=V8(D),$=o5(),J=V8($1),B=n9.filter((Q)=>o9(W8(r9,Q)));if(console.log("\x1B[2mThis will remove:\x1B[0m"),$)console.log(" \x1B[31m-\x1B[0m Hook script (~/.claude/hooks/genie-bash-hook.sh)");if(J)console.log(" \x1B[31m-\x1B[0m Orchestration rules (~/.claude/rules/genie-orchestration.md)");if(F)console.log(` \x1B[31m-\x1B[0m Genie directory (${WD(D)})`);if(B.length>0)console.log(` \x1B[31m-\x1B[0m Symlinks from ~/.local/bin: ${B.join(", ")}`);if(console.log(),!F&&!$&&!J&&B.length===0){console.log("\x1B[33mNothing to uninstall.\x1B[0m"),console.log();return}if(!await iD({message:"Are you sure you want to uninstall Genie CLI?",default:!1})){console.log(),console.log("\x1B[2mUninstall cancelled.\x1B[0m"),console.log();return}console.log(),EY($,B,D,F),console.log(),console.log("\x1B[32m+\x1B[0m Genie CLI uninstalled."),console.log(),console.log("\x1B[2mNote: If you installed via npm/bun, also run:\x1B[0m"),console.log(" \x1B[36mbun remove -g @automagik/genie\x1B[0m"),console.log(" \x1B[2mor\x1B[0m"),console.log(" \x1B[36mnpm uninstall -g @automagik/genie\x1B[0m"),console.log()}pD();import{spawn as F4}from"child_process";import{chmodSync as AY,copyFileSync as $4,existsSync as zD,mkdirSync as J4,readFileSync as B4,readdirSync as X4,rmSync as RY,writeFileSync as OY}from"fs";import{chmod as CY,copyFile as Q4,mkdir as a9,unlink as t9}from"fs/promises";import{homedir as j0}from"os";import{join as u}from"path";var B1=process.env.GENIE_HOME||u(j0(),".genie"),X2=u(B1,"src"),U8=u(B1,"bin"),z8=u(j0(),".local","bin");function QD(D){console.log(`\x1B[32m\u25B8\x1B[0m ${D}`)}function k2(D){console.log(`\x1B[32m\u2714\x1B[0m ${D}`)}function kD(D){console.log(`\x1B[31m\u2716\x1B[0m ${D}`)}async function C0(D,F,$){return new Promise((J)=>{let B=[],X=F4(D,F,{cwd:$,stdio:["inherit","pipe","pipe"],env:{...process.env,FORCE_COLOR:"1"}});X.stdout?.on("data",(Q)=>{let Y=Q.toString();B.push(Y),process.stdout.write(Y)}),X.stderr?.on("data",(Q)=>{let Y=Q.toString();B.push(Y),process.stderr.write(Y)}),X.on("close",(Q)=>{J({success:Q===0,output:B.join("")})}),X.on("error",(Q)=>{kD(Q.message),J({success:!1,output:Q.message})})})}async function e9(D){try{let F=await w2("git",["rev-parse","--abbrev-ref","HEAD"],D),$=await w2("git",["rev-parse","--short","HEAD"],D),J=await w2("git",["log","-1","--format=%ci"],D);if(F.success&&$.success&&J.success)return{branch:F.output.trim(),commit:$.output.trim(),commitDate:J.output.trim().split(" ")[0]}}catch{}return null}async function w2(D,F,$){return new Promise((J)=>{let B=[],X=F4(D,F,{cwd:$,stdio:["inherit","pipe","pipe"]});X.stdout?.on("data",(Q)=>{B.push(Q.toString())}),X.stderr?.on("data",(Q)=>{B.push(Q.toString())}),X.on("close",(Q)=>{J({success:Q===0,output:B.join("")})}),X.on("error",(Q)=>{J({success:!1,output:Q.message})})})}function jY(D){if(D.includes(".bun"))return"bun";if(D.includes("node_modules"))return"npm";if(D===u(z8,"genie")||D.startsWith(U8))return"source";return null}async function _Y(){if(O2())try{let J=await VD();if(J.installMethod)return J.installMethod}catch{}if(zD(u(X2,".git")))return"source";let D=await w2("which",["genie"]);if(!D.success)return"unknown";let F=jY(D.output.trim());if(F)return F;return(await w2("which",["bun"])).success?"bun":"npm"}async function LY(D){try{v("fs").unlinkSync(u(j0(),".bun","install","global","bun.lock"))}catch{}if(QD(`Updating via bun (channel: ${D})...`),!(await C0("bun",["add","-g","--force","--no-cache",`@automagik/genie@${D}`])).success)kD("Failed to update via bun"),process.exit(1);console.log(),k2(`Genie CLI updated (${D})!`)}async function ZY(D){if(QD(`Updating via npm (channel: ${D})...`),!(await C0("npm",["install","-g",`@automagik/genie@${D}`])).success)kD("Failed to update via npm"),process.exit(1);console.log(),k2(`Genie CLI updated (${D})!`)}async function TY(){let D=await e9(X2);if(D)console.log(`Current: \x1B[2m${D.branch}@${D.commit} (${D.commitDate})\x1B[0m`),console.log();if(QD("Fetching latest changes..."),!(await C0("git",["fetch","origin"],X2)).success)kD("Failed to fetch from origin"),process.exit(1);if(QD("Resetting to origin/main..."),!(await C0("git",["reset","--hard","origin/main"],X2)).success)kD("Failed to reset to origin/main"),process.exit(1);console.log();let J=await e9(X2);if(D&&J&&D.commit===J.commit){k2("Already up to date!"),console.log();return}if(QD("Installing dependencies..."),!(await C0("bun",["install"],X2)).success)kD("Failed to install dependencies"),process.exit(1);if(console.log(),QD("Building..."),!(await C0("bun",["run","build"],X2)).success)kD("Failed to build"),process.exit(1);console.log(),QD("Installing binaries...");try{await a9(U8,{recursive:!0}),await a9(z8,{recursive:!0});let Q=["genie.js","term.js"],Y=["genie","term"];for(let q=0;q<Q.length;q++){let G=u(X2,"dist",Q[q]),H=u(U8,Q[q]),V=u(z8,Y[q]);await Q4(G,H),await CY(H,493),await NY(H,V)}for(let q of["claudio.js","claudio"]){let G=u(U8,q),H=u(z8,q);try{await t9(G)}catch{}try{await t9(H)}catch{}}k2("Binaries installed")}catch(Q){kD(`Failed to install binaries: ${Q}`),process.exit(1)}if(console.log(),console.log("\x1B[2m\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\x1B[0m"),k2("Genie CLI updated successfully!"),console.log(),J)console.log(`Version: \x1B[36m${J.branch}@${J.commit}\x1B[0m (${J.commitDate})`),console.log()}async function NY(D,F){let{symlink:$,unlink:J}=await import("fs/promises");try{if(zD(F))await J(F);await $(D,F)}catch{await Q4(D,F)}}function J1(D,F){J4(F,{recursive:!0});for(let $ of X4(D,{withFileTypes:!0})){let J=u(D,$.name),B=u(F,$.name);if($.isDirectory())J1(J,B);else $4(J,B)}}async function IY(D){if(D==="bun"){let J=u(j0(),".bun","install","global","node_modules","@automagik","genie");if(zD(J))return J}if(D==="npm"){let J=await w2("npm",["root","-g"]);if(J.success){let B=u(J.output.trim(),"@automagik","genie");if(zD(B))return B}}let F=u(j0(),".bun","install","global","node_modules","@automagik","genie");if(zD(F))return F;let $=await w2("npm",["root","-g"]);if($.success){let J=u($.output.trim(),"@automagik","genie");if(zD(J))return J}return null}function SY(D,F,$){let J=u(D,"installed_plugins.json");try{if(!zD(J))return;let B=JSON.parse(B4(J,"utf-8")),X=B.plugins?.["genie@automagik"];if(!Array.isArray(X))return;for(let Q of X)if(Q.scope==="user")Q.installPath=F,Q.version=$,Q.lastUpdated=new Date().toISOString();OY(J,JSON.stringify(B,null,2))}catch(B){QD(`Registry update failed (non-fatal): ${B}`)}}function bY(D){let F=u(D,"scripts","tmux");if(!zD(F))return;let $=u(B1,"scripts");J4($,{recursive:!0});let J=0;for(let B of X4(F))if(B.endsWith(".sh")){let X=u(F,B),Q=u($,B);$4(X,Q);try{AY(Q,493)}catch{}J++}if(J>0)k2(`Refreshed ${J} tmux scripts at ${$}`)}async function D4(D){QD("Syncing Claude Code plugin...");let F=await IY(D);if(!F){QD("Could not find installed package \u2014 skipping plugin sync");return}let $=u(F,"plugins","genie");if(!zD($)){QD("Plugin source not found in package \u2014 skipping plugin sync");return}let J;try{J=JSON.parse(B4(u(F,"package.json"),"utf-8")).version}catch{QD("Could not read package version \u2014 skipping plugin sync");return}let B=u(j0(),".claude","plugins"),X=u(B,"cache","automagik","genie",J);try{if(zD(X))RY(X,{recursive:!0,force:!0});J1($,X);let Q=u(F,"skills");if(zD(Q)&&!zD(u(X,"skills")))J1(Q,u(X,"skills"))}catch(Q){kD(`Failed to copy plugin: ${Q}`);return}SY(B,X,J),bY(F),k2(`Plugin synced to v${J}`)}async function PY(D){if(D.next)return"next";if(D.stable)return"latest";if(O2())try{let F=await VD();if(F.updateChannel)return F.updateChannel}catch{}return"latest"}async function vY(D){try{let F=await VD();F.updateChannel=D,await PD(F)}catch{}}async function Y4(D={}){console.log(),console.log("\x1B[1m\uD83E\uDDDE Genie CLI Update\x1B[0m"),console.log("\x1B[2m\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\x1B[0m"),console.log();let F=await PY(D);if(D.next||D.stable)await vY(F);let $=await _Y();if(QD(`Detected installation: ${$}`),QD(`Channel: ${F}${F==="next"?" (dev builds)":" (stable)"}`),console.log(),$==="unknown")kD("No Genie CLI installation found"),console.log(),console.log("Install method not configured. Please reinstall genie:"),console.log("\x1B[36m curl -fsSL https://raw.githubusercontent.com/automagik-dev/genie/main/install.sh | bash\x1B[0m"),console.log(),process.exit(1);switch($){case"source":await TY();break;case"bun":await LY(F),await D4($);break;case"npm":await ZY(F),await D4($);break}}import{existsSync as kY,readFileSync as wY}from"fs";import{dirname as X1,resolve as Q1}from"path";var __dirname="/home/runner/_work/genie/genie/src/lib",fY="0.0.0-unknown";function uY(){let D=[Q1(X1(import.meta.dir??__dirname),"..","..","package.json"),Q1(X1(import.meta.dir??__dirname),"..","package.json"),Q1(X1(import.meta.dir??__dirname),"package.json")];for(let F of D)try{if(kY(F)){let $=JSON.parse(wY(F,"utf-8"));if($.version)return $.version}}catch{}return fY}var q4=uY();function qV(D,F){let $=new Set([D]);if(F){if($.add(F.entry.name),F.entry.roles)for(let J of F.entry.roles)$.add(J)}return $}function GV(D){let F=["spawn","--provider",D.provider,"--team",D.team];if(D.role)F.push("--role",D.role);if(D.skill)F.push("--skill",D.skill);if(D.cwd)F.push("--cwd",D.cwd);if(D.lastSessionId)F.push("--resume",D.lastSessionId);if(D.extraArgs)F.push(...D.extraArgs);return F}async function LF(D){let F=D.tool_input;if(!F||F.type!=="message")return;let $=F.recipient;if(!$||$==="team-lead")return;let J=process.env.GENIE_TEAM??D.team_name;if(!J)return;try{let B=await Promise.resolve().then(() => (MD(),KD)),X=await Promise.resolve().then(() => ($D(),ND)),Q=await Promise.resolve().then(() => (C3(),O3)),q=(await B.list()).find((z)=>(z.role===$||z.id===$)&&z.team===J);if(q&&await X.isPaneAlive(q.paneId))return;let G=await Q.resolve($),H=await B.listTemplates(),V=qV($,G),W=H.find((z)=>{if(z.team!==J)return!1;return[...V].some((E)=>z.id===E||z.role===E)});if(!W){if(G)console.error(`[genie-hook] Agent "${$}" is registered in directory but has no spawn template in team "${J}".`);return}let{spawnSync:U}=v("child_process");U("genie",GV(W),{timeout:1e4,stdio:"ignore",env:{...process.env,GENIE_TEAM:J}}),console.error(`[genie-hook] Auto-spawned "${$}" in team "${J}"`)}catch(B){let X=B instanceof Error?B.message:String(B);console.error(`[genie-hook] Auto-spawn failed for "${$}": ${X}`)}}async function ZF(D){let F=D.tool_input;if(!F)return;let $=F.type;if($!=="message"&&$!=="broadcast")return;let J=process.env.GENIE_AGENT_NAME;if(!J)return;let B=F.content;if(!B)return;if(B.startsWith(`[from:${J}]`))return;return{updatedInput:{...F,content:`[from:${J}] ${B}`}}}r1();var VV=[{name:"identity-inject",event:"PreToolUse",matcher:/^SendMessage$/,priority:10,fn:ZF},{name:"auto-spawn",event:"PreToolUse",matcher:/^SendMessage$/,priority:20,fn:LF}];function WV(D,F){return VV.filter(($)=>{if($.event!==D)return!1;if($.matcher&&F&&!$.matcher.test(F))return!1;if($.matcher&&!F)return!1;return!0}).sort(($,J)=>$.priority-J.priority)}async function UV(D,F,$){let J={...F};if($)J.tool_input=$;try{return await D.fn(J)}catch(B){let X=B instanceof Error?B.message:String(B);console.error(`[genie-hook] Handler "${D.name}" threw: ${X}`);return}}async function zV(D,F){let $=F.tool_input?{...F.tool_input}:void 0;for(let J of D){let B=await UV(J,F,$);if(!B)continue;if(B.decision==="deny")return{decision:"deny",reason:B.reason??`Denied by handler: ${J.name}`};if(B.updatedInput)$={...$,...B.updatedInput}}if($&&F.tool_input&&JSON.stringify($)!==JSON.stringify(F.tool_input))return{updatedInput:$};return{}}async function KV(D,F){await Promise.allSettled(D.map(($)=>$.fn(F).catch((J)=>{let B=J instanceof Error?J.message:String(J);console.error(`[genie-hook] Handler "${$.name}" threw: ${B}`)})))}async function NF(D){let F;try{F=JSON.parse(D)}catch{return console.error("[genie-hook] Invalid JSON on stdin"),""}let $=F.hook_event_name;if(!$)return console.error("[genie-hook] Missing hook_event_name in payload"),"";let J=F.tool_name,B=WV($,J);if(B.length===0)return"";if(TF($)){let X=await zV(B,F);if(X.decision||X.updatedInput)return JSON.stringify(X);return""}return await KV(B,F),""}async function MV(){let D=[];for await(let F of Bun.stdin.stream())D.push(Buffer.from(F));return Buffer.concat(D).toString("utf-8")}async function EV(){let D=await MV();if(!D.trim())process.exit(0);let F=await NF(D);if(F)process.stdout.write(F)}function IF(D){D.command("hook").description("Hook middleware for Claude Code integration").command("dispatch").description("Dispatch a CC hook event (reads JSON from stdin, writes decision to stdout)").action(EV)}i8();C3();M3();pD();import{resolve as r8}from"path";function tF(D){let F=D.command("dir").description("Agent directory management");F.command("add <name>").description("Register an agent in the directory").requiredOption("--dir <path>","Agent folder (CWD + AGENTS.md)").option("--repo <path>","Default git repo (overridden by team)").option("--prompt-mode <mode>","Prompt mode: append or system","append").option("--model <model>","Default model (sonnet, opus, codex)").option("--roles <roles...>","Built-in roles this agent can orchestrate").option("--global","Write to global directory instead of project").action(async($,J)=>{try{let B=eF(J.promptMode),X=await p1({name:$,dir:r8(J.dir),repo:J.repo?r8(J.repo):void 0,promptMode:B,model:J.model,roles:J.roles},{global:J.global}),Q=J.global?"global":"project";if(console.log(`Agent "${X.name}" registered (${Q}).`),console.log(` Dir: ${WD(X.dir)}`),X.repo)console.log(` Repo: ${WD(X.repo)}`);if(console.log(` Prompt mode: ${X.promptMode}`),X.model)console.log(` Model: ${X.model}`);if(X.roles?.length)console.log(` Roles: ${X.roles.join(", ")}`)}catch(B){let X=B instanceof Error?B.message:String(B);console.error(`Error: ${X}`),process.exit(1)}}),F.command("rm <name>").description("Remove an agent from the directory").option("--global","Remove from global directory instead of project").action(async($,J)=>{try{if(await d1($,{global:J.global})){let X=J.global?"global":"project";console.log(`Agent "${$}" removed from ${X} directory.`)}else console.error(`Agent "${$}" not found in directory.`),process.exit(1)}catch(B){let X=B instanceof Error?B.message:String(B);console.error(`Error: ${X}`),process.exit(1)}}),F.command("ls [name]").description("List all agents or show single entry details").option("--json","Output as JSON").option("--builtins","Include built-in roles and council members").action(async($,J)=>{try{if($)await eV($,J.json);else await DW(J.json,J.builtins)}catch(B){let X=B instanceof Error?B.message:String(B);console.error(`Error: ${X}`),process.exit(1)}}),F.command("edit <name>").description("Update an agent directory entry").option("--dir <path>","Agent folder (CWD + AGENTS.md)").option("--repo <path>","Default git repo").option("--prompt-mode <mode>","Prompt mode: append or system").option("--model <model>","Default model").option("--roles <roles...>","Built-in roles this agent can orchestrate").option("--global","Edit in global directory instead of project").action(async($,J)=>{try{await tV($,J)}catch(B){let X=B instanceof Error?B.message:String(B);console.error(`Error: ${X}`),process.exit(1)}})}async function tV(D,F){let $={};if(F.dir)$.dir=r8(F.dir);if(F.repo)$.repo=r8(F.repo);if(F.promptMode)$.promptMode=eF(F.promptMode);if(F.model)$.model=F.model;if(F.roles)$.roles=F.roles;if(Object.keys($).length===0)console.error("No fields to update. Provide at least one of: --dir, --repo, --prompt-mode, --model, --roles"),process.exit(1);let J=await c1(D,$,{global:F.global}),B=F.global?"global":"project";console.log(`Agent "${D}" updated (${B}).`),D$(J)}function eF(D){if(D!=="system"&&D!=="append")throw Error(`Invalid prompt mode "${D}". Must be "append" or "system".`);return D}function D$(D){if(console.log(` Name: ${D.name}`),console.log(` Dir: ${WD(D.dir)}`),D.repo)console.log(` Repo: ${WD(D.repo)}`);if(console.log(` Prompt mode: ${D.promptMode}`),D.model)console.log(` Model: ${D.model}`);if(D.roles?.length)console.log(` Roles: ${D.roles.join(", ")}`);console.log(` Registered: ${D.registeredAt}`)}async function eV(D,F){let $=await A3(D);if(!$)console.error(`Agent "${D}" not found in directory or built-ins.`),process.exit(1);if(F){console.log(JSON.stringify({...$.entry,builtin:$.builtin},null,2));return}if($.builtin)console.log(`
441
+ Next steps:`),console.log(" 1. Reload tmux: tmux source ~/.tmux.conf"),console.log(" 2. Restart your shell or run: source ~/.bashrc"),J)console.log(" 3. Reload Termux: termux-reload-settings")}function F3(){console.log(),console.log(`\x1B[1m\x1B[36m${"=".repeat(64)}\x1B[0m`),console.log("\x1B[1m\x1B[36m Genie Setup Wizard\x1B[0m"),console.log(`\x1B[1m\x1B[36m${"=".repeat(64)}\x1B[0m`),console.log()}function v2(D,F){if(console.log(),console.log(`\x1B[1m${D}\x1B[0m`),F)console.log(`\x1B[2m${F}\x1B[0m`);console.log()}async function x9(D,F){if(v2("2. Session Configuration","Configure tmux session settings"),F)return console.log(` Using defaults: session="${D.session.name}", window="${D.session.defaultWindow}"`),D;let $=await b2({message:"Session name:",default:D.session.name}),J=await b2({message:"Default window name:",default:D.session.defaultWindow}),B=await iD({message:"Auto-create session on connect?",default:D.session.autoCreate});return D.session={name:$,defaultWindow:J,autoCreate:B},D}async function y9(D,F){if(v2("3. Terminal Defaults","Configure default values for term commands"),F)return console.log(` Using defaults: timeout=${D.terminal.execTimeout}ms, lines=${D.terminal.readLines}`),D;let $=await b2({message:"Exec timeout (milliseconds):",default:String(D.terminal.execTimeout),validate:(X)=>{let Q=Number.parseInt(X,10);return!Number.isNaN(Q)&&Q>0?!0:"Must be a positive number"}}),J=await b2({message:"Read lines (default for genie agent read):",default:String(D.terminal.readLines),validate:(X)=>{let Q=Number.parseInt(X,10);return!Number.isNaN(Q)&&Q>0?!0:"Must be a positive number"}}),B=await b2({message:"Worktree base directory (leave empty for ~/.genie/worktrees/<project>/):",default:D.terminal.worktreeBase??""});return D.terminal={execTimeout:Number.parseInt($,10),readLines:Number.parseInt(J,10),...B?{worktreeBase:B}:{}},D}async function h9(D,F){v2("4. Keyboard Shortcuts","Warp-like tmux shortcuts for quick navigation");let $=XY(),J=QY($,".tmux.conf");if(D3(J))return console.log(" \x1B[32m\u2713\x1B[0m Tmux shortcuts already installed"),D.shortcuts.tmuxInstalled=!0,D;if(console.log(" Available shortcuts:"),console.log(" \x1B[36mCtrl+T\x1B[0m \u2192 New tab (window)"),console.log(" \x1B[36mCtrl+S\x1B[0m \u2192 Vertical split"),console.log(" \x1B[36mCtrl+H\x1B[0m \u2192 Horizontal split"),console.log(),F)return console.log(" Skipped in quick mode. Run \x1B[36mgenie setup --shortcuts\x1B[0m to install."),D;if(await iD({message:"Install tmux keyboard shortcuts?",default:!1}))console.log(),await H8(),D.shortcuts.tmuxInstalled=!0,await O7({tmuxInstalled:!0});else console.log(" Skipped. Run \x1B[36mgenie shortcuts install\x1B[0m later.");return D}function g9(D){if(D==="changed")console.log(" \x1B[32m\u2713\x1B[0m Codex config updated");else if(D==="unchanged")console.log(" \x1B[32m\u2713\x1B[0m Codex config already up to date");else console.log(" \x1B[31m\u2717\x1B[0m Failed to update codex config")}async function m9(D,F){v2("5. Codex Integration","Configure OpenAI Codex for genie agents");let $=await C2("codex");if(!$.exists)return console.log(" \x1B[33m!\x1B[0m Codex CLI not found. Skipping codex integration."),D;if(console.log(` \x1B[32m\u2713\x1B[0m Codex CLI found (${$.version??"unknown version"})`),I9())return console.log(" \x1B[32m\u2713\x1B[0m Codex config already configured"),D.codex={configured:!0},D;if(console.log(),console.log(" Genie needs to configure codex for agent communication:"),console.log(" \x1B[36mdisable_paste_burst\x1B[0m \u2192 Reliable tmux command injection"),console.log(" \x1B[36mOTel exporter\x1B[0m \u2192 Telemetry relay for state detection"),console.log(` Config: \x1B[2m${WD(S9())}\x1B[0m`),console.log(),F){let B=t0();return g9(B),D.codex={configured:B!=="error"},D}if(await iD({message:"Configure Codex for genie agent integration?",default:!0})){let B=t0();g9(B),D.codex={configured:B!=="error"}}else console.log(" Skipped. Run \x1B[36mgenie setup --codex\x1B[0m later.");return D}async function YY(D,F){if(v2("6. Debug Options","Logging and debugging settings"),F)return console.log(" Using defaults: tmuxDebug=false, verbose=false"),D;let $=await iD({message:"Enable tmux debug logging?",default:D.logging.tmuxDebug}),J=await iD({message:"Enable verbose mode?",default:D.logging.verbose});return D.logging={tmuxDebug:$,verbose:J},D}async function qY(D,F){if(v2("7. Prompt Mode","Controls how genie injects system prompts into Claude Code"),F)return console.log(` Using default: promptMode="${D.promptMode}"`),D;console.log(" append \u2014 Uses --append-system-prompt-file (preserves Claude Code default system prompt)"),console.log(" system \u2014 Uses --system-prompt-file (replaces Claude Code default system prompt)"),console.log();let $=await o6({message:"Prompt mode:",choices:[{name:"append (recommended \u2014 preserves CC default)",value:"append"},{name:"system (replaces CC default)",value:"system"}],default:D.promptMode});return D.promptMode=$,D}async function GY(D){v2("Summary",`Configuration will be saved to ${WD(p0())}`),console.log(` Session: \x1B[36m${D.session.name}\x1B[0m (window: ${D.session.defaultWindow})`),console.log(` Terminal: timeout=${D.terminal.execTimeout}ms, lines=${D.terminal.readLines}`),console.log(` Shortcuts: ${D.shortcuts.tmuxInstalled?"\x1B[32minstalled\x1B[0m":"\x1B[2mnot installed\x1B[0m"}`),console.log(` Codex: ${D.codex?.configured?"\x1B[32mconfigured\x1B[0m":"\x1B[2mnot configured\x1B[0m"}`),console.log(` Debug: tmux=${D.logging.tmuxDebug}, verbose=${D.logging.verbose}`),console.log(` Prompt mode: \x1B[36m${D.promptMode}\x1B[0m`),console.log(),D.setupComplete=!0,D.lastSetupAt=new Date().toISOString(),await vD(D),console.log("\x1B[32m\u2713 Configuration saved!\x1B[0m")}async function HY(){let D=await VD();console.log(),console.log("\x1B[1mCurrent Genie Configuration\x1B[0m"),console.log(`\x1B[2m${WD(p0())}\x1B[0m`),console.log(),console.log(JSON.stringify(D,null,2)),console.log()}function VY(){console.log(),console.log("\x1B[1mNext Steps:\x1B[0m"),console.log(),console.log(" Start a session: \x1B[36mgenie\x1B[0m"),console.log(" Watch AI work: \x1B[36mtmux attach -t genie\x1B[0m"),console.log(" Check health: \x1B[36mgenie doctor\x1B[0m"),console.log()}async function l9(D={}){if(D.show){await HY();return}if(D.reset){await R7(),console.log("\x1B[32m\u2713 Configuration reset to defaults.\x1B[0m"),console.log();return}let F=await VD();if(D.shortcuts){F3(),await h9(F,!1),await A7();return}if(D.terminal){F3(),F=await y9(F,!1),await vD(F),console.log("\x1B[32m\u2713 Terminal configuration saved.\x1B[0m");return}if(D.session){F3(),F=await x9(F,!1),await vD(F),console.log("\x1B[32m\u2713 Session configuration saved.\x1B[0m");return}if(D.codex){if(F3(),F=await m9(F,!1),await vD(F),F.codex?.configured)console.log("\x1B[32m\u2713 Codex configuration saved.\x1B[0m");return}let $=D.quick??!1;if(F3(),$)console.log("\x1B[2mQuick mode: accepting all defaults\x1B[0m");F=await x9(F,$),F=await y9(F,$),F=await h9(F,$),F=await m9(F,$),F=await YY(F,$),F=await qY(F,$),await GY(F),VY()}import{existsSync as WY}from"fs";import{homedir as UY}from"os";import{join as e6}from"path";async function D1(){w9();let D=UY(),F=e6(D,".tmux.conf"),$=e6(D,".zshrc"),J=e6(D,".bashrc");if(console.log("Installation status:"),D3(F))console.log(" \x1B[32m\u2713\x1B[0m tmux.conf");else console.log(" \x1B[33m-\x1B[0m tmux.conf");let B=WY($)?$:J;if(D3(B))console.log(` \x1B[32m\u2713\x1B[0m ${B.replace(D,"~")}`);else console.log(` \x1B[33m-\x1B[0m ${B.replace(D,"~")}`);console.log(),console.log("Run \x1B[36mgenie shortcuts install\x1B[0m to install shortcuts."),console.log("Run \x1B[36mgenie shortcuts uninstall\x1B[0m to remove shortcuts."),console.log()}async function p9(){await H8()}async function d9(){await u9()}import{existsSync as V8,lstatSync as zY,rmSync as KY,unlinkSync as c9}from"fs";import{homedir as i9}from"os";import{join as W8}from"path";pD();var $1=W8(i9(),".claude","rules","genie-orchestration.md"),r9=W8(i9(),".local","bin"),n9=["genie","term"];function o9(D){try{if(!V8(D))return!1;if(!zY(D).isSymbolicLink())return!1;return!0}catch{return!1}}function MY(){let D=[];for(let F of n9){let $=W8(r9,F);if(o9($))try{c9($),D.push(F)}catch{}}return D}function F1(D,F,$){console.log(`\x1B[2m${D}\x1B[0m`);try{$(),console.log(` \x1B[32m+\x1B[0m ${F}`)}catch(J){let B=J instanceof Error?J.message:String(J);console.log(` \x1B[33m!\x1B[0m ${D.replace("...","")} failed: ${B}`)}}function EY(D,F,$,J){if(D)F1("Removing hook script...","Hook script removed",()=>s5());if(F.length>0){console.log("\x1B[2mRemoving symlinks...\x1B[0m");let B=MY();if(B.length>0)console.log(` \x1B[32m+\x1B[0m Removed: ${B.join(", ")}`)}if(V8($1))F1("Removing orchestration rules...","Orchestration rules removed (~/.claude/rules/genie-orchestration.md)",()=>c9($1));if(J)F1("Removing genie directory...","Directory removed",()=>KY($,{recursive:!0,force:!0}))}async function s9(){console.log(),console.log("\x1B[1m\x1B[33m Uninstall Genie CLI\x1B[0m"),console.log();let D=K7(),F=V8(D),$=o5(),J=V8($1),B=n9.filter((Q)=>o9(W8(r9,Q)));if(console.log("\x1B[2mThis will remove:\x1B[0m"),$)console.log(" \x1B[31m-\x1B[0m Hook script (~/.claude/hooks/genie-bash-hook.sh)");if(J)console.log(" \x1B[31m-\x1B[0m Orchestration rules (~/.claude/rules/genie-orchestration.md)");if(F)console.log(` \x1B[31m-\x1B[0m Genie directory (${WD(D)})`);if(B.length>0)console.log(` \x1B[31m-\x1B[0m Symlinks from ~/.local/bin: ${B.join(", ")}`);if(console.log(),!F&&!$&&!J&&B.length===0){console.log("\x1B[33mNothing to uninstall.\x1B[0m"),console.log();return}if(!await iD({message:"Are you sure you want to uninstall Genie CLI?",default:!1})){console.log(),console.log("\x1B[2mUninstall cancelled.\x1B[0m"),console.log();return}console.log(),EY($,B,D,F),console.log(),console.log("\x1B[32m+\x1B[0m Genie CLI uninstalled."),console.log(),console.log("\x1B[2mNote: If you installed via npm/bun, also run:\x1B[0m"),console.log(" \x1B[36mbun remove -g @automagik/genie\x1B[0m"),console.log(" \x1B[2mor\x1B[0m"),console.log(" \x1B[36mnpm uninstall -g @automagik/genie\x1B[0m"),console.log()}pD();import{spawn as F4}from"child_process";import{chmodSync as AY,copyFileSync as $4,existsSync as zD,mkdirSync as J4,readFileSync as B4,readdirSync as X4,rmSync as RY,writeFileSync as OY}from"fs";import{chmod as CY,copyFile as Q4,mkdir as a9,unlink as t9}from"fs/promises";import{homedir as j0}from"os";import{join as u}from"path";var B1=process.env.GENIE_HOME||u(j0(),".genie"),X2=u(B1,"src"),U8=u(B1,"bin"),z8=u(j0(),".local","bin");function QD(D){console.log(`\x1B[32m\u25B8\x1B[0m ${D}`)}function k2(D){console.log(`\x1B[32m\u2714\x1B[0m ${D}`)}function wD(D){console.log(`\x1B[31m\u2716\x1B[0m ${D}`)}async function C0(D,F,$){return new Promise((J)=>{let B=[],X=F4(D,F,{cwd:$,stdio:["inherit","pipe","pipe"],env:{...process.env,FORCE_COLOR:"1"}});X.stdout?.on("data",(Q)=>{let Y=Q.toString();B.push(Y),process.stdout.write(Y)}),X.stderr?.on("data",(Q)=>{let Y=Q.toString();B.push(Y),process.stderr.write(Y)}),X.on("close",(Q)=>{J({success:Q===0,output:B.join("")})}),X.on("error",(Q)=>{wD(Q.message),J({success:!1,output:Q.message})})})}async function e9(D){try{let F=await w2("git",["rev-parse","--abbrev-ref","HEAD"],D),$=await w2("git",["rev-parse","--short","HEAD"],D),J=await w2("git",["log","-1","--format=%ci"],D);if(F.success&&$.success&&J.success)return{branch:F.output.trim(),commit:$.output.trim(),commitDate:J.output.trim().split(" ")[0]}}catch{}return null}async function w2(D,F,$){return new Promise((J)=>{let B=[],X=F4(D,F,{cwd:$,stdio:["inherit","pipe","pipe"]});X.stdout?.on("data",(Q)=>{B.push(Q.toString())}),X.stderr?.on("data",(Q)=>{B.push(Q.toString())}),X.on("close",(Q)=>{J({success:Q===0,output:B.join("")})}),X.on("error",(Q)=>{J({success:!1,output:Q.message})})})}function jY(D){if(D.includes(".bun"))return"bun";if(D.includes("node_modules"))return"npm";if(D===u(z8,"genie")||D.startsWith(U8))return"source";return null}async function _Y(){if(O2())try{let J=await VD();if(J.installMethod)return J.installMethod}catch{}if(zD(u(X2,".git")))return"source";let D=await w2("which",["genie"]);if(!D.success)return"unknown";let F=jY(D.output.trim());if(F)return F;return(await w2("which",["bun"])).success?"bun":"npm"}async function LY(D){try{v("fs").unlinkSync(u(j0(),".bun","install","global","bun.lock"))}catch{}if(QD(`Updating via bun (channel: ${D})...`),!(await C0("bun",["add","-g","--force","--no-cache",`@automagik/genie@${D}`])).success)wD("Failed to update via bun"),process.exit(1);console.log(),k2(`Genie CLI updated (${D})!`)}async function ZY(D){if(QD(`Updating via npm (channel: ${D})...`),!(await C0("npm",["install","-g",`@automagik/genie@${D}`])).success)wD("Failed to update via npm"),process.exit(1);console.log(),k2(`Genie CLI updated (${D})!`)}async function TY(){let D=await e9(X2);if(D)console.log(`Current: \x1B[2m${D.branch}@${D.commit} (${D.commitDate})\x1B[0m`),console.log();if(QD("Fetching latest changes..."),!(await C0("git",["fetch","origin"],X2)).success)wD("Failed to fetch from origin"),process.exit(1);if(QD("Resetting to origin/main..."),!(await C0("git",["reset","--hard","origin/main"],X2)).success)wD("Failed to reset to origin/main"),process.exit(1);console.log();let J=await e9(X2);if(D&&J&&D.commit===J.commit){k2("Already up to date!"),console.log();return}if(QD("Installing dependencies..."),!(await C0("bun",["install"],X2)).success)wD("Failed to install dependencies"),process.exit(1);if(console.log(),QD("Building..."),!(await C0("bun",["run","build"],X2)).success)wD("Failed to build"),process.exit(1);console.log(),QD("Installing binaries...");try{await a9(U8,{recursive:!0}),await a9(z8,{recursive:!0});let Q=["genie.js","term.js"],Y=["genie","term"];for(let q=0;q<Q.length;q++){let G=u(X2,"dist",Q[q]),H=u(U8,Q[q]),V=u(z8,Y[q]);await Q4(G,H),await CY(H,493),await NY(H,V)}for(let q of["claudio.js","claudio"]){let G=u(U8,q),H=u(z8,q);try{await t9(G)}catch{}try{await t9(H)}catch{}}k2("Binaries installed")}catch(Q){wD(`Failed to install binaries: ${Q}`),process.exit(1)}if(console.log(),console.log("\x1B[2m\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\x1B[0m"),k2("Genie CLI updated successfully!"),console.log(),J)console.log(`Version: \x1B[36m${J.branch}@${J.commit}\x1B[0m (${J.commitDate})`),console.log()}async function NY(D,F){let{symlink:$,unlink:J}=await import("fs/promises");try{if(zD(F))await J(F);await $(D,F)}catch{await Q4(D,F)}}function J1(D,F){J4(F,{recursive:!0});for(let $ of X4(D,{withFileTypes:!0})){let J=u(D,$.name),B=u(F,$.name);if($.isDirectory())J1(J,B);else $4(J,B)}}async function IY(D){if(D==="bun"){let J=u(j0(),".bun","install","global","node_modules","@automagik","genie");if(zD(J))return J}if(D==="npm"){let J=await w2("npm",["root","-g"]);if(J.success){let B=u(J.output.trim(),"@automagik","genie");if(zD(B))return B}}let F=u(j0(),".bun","install","global","node_modules","@automagik","genie");if(zD(F))return F;let $=await w2("npm",["root","-g"]);if($.success){let J=u($.output.trim(),"@automagik","genie");if(zD(J))return J}return null}function SY(D,F,$){let J=u(D,"installed_plugins.json");try{if(!zD(J))return;let B=JSON.parse(B4(J,"utf-8")),X=B.plugins?.["genie@automagik"];if(!Array.isArray(X))return;for(let Q of X)if(Q.scope==="user")Q.installPath=F,Q.version=$,Q.lastUpdated=new Date().toISOString();OY(J,JSON.stringify(B,null,2))}catch(B){QD(`Registry update failed (non-fatal): ${B}`)}}function bY(D){let F=u(D,"scripts","tmux");if(!zD(F))return;let $=u(B1,"scripts");J4($,{recursive:!0});let J=0;for(let B of X4(F))if(B.endsWith(".sh")){let X=u(F,B),Q=u($,B);$4(X,Q);try{AY(Q,493)}catch{}J++}if(J>0)k2(`Refreshed ${J} tmux scripts at ${$}`)}async function D4(D){QD("Syncing Claude Code plugin...");let F=await IY(D);if(!F){QD("Could not find installed package \u2014 skipping plugin sync");return}let $=u(F,"plugins","genie");if(!zD($)){QD("Plugin source not found in package \u2014 skipping plugin sync");return}let J;try{J=JSON.parse(B4(u(F,"package.json"),"utf-8")).version}catch{QD("Could not read package version \u2014 skipping plugin sync");return}let B=u(j0(),".claude","plugins"),X=u(B,"cache","automagik","genie",J);try{if(zD(X))RY(X,{recursive:!0,force:!0});J1($,X);let Q=u(F,"skills");if(zD(Q)&&!zD(u(X,"skills")))J1(Q,u(X,"skills"))}catch(Q){wD(`Failed to copy plugin: ${Q}`);return}SY(B,X,J),bY(F),k2(`Plugin synced to v${J}`)}async function PY(D){if(D.next)return"next";if(D.stable)return"latest";if(O2())try{let F=await VD();if(F.updateChannel)return F.updateChannel}catch{}return"latest"}async function vY(D){try{let F=await VD();F.updateChannel=D,await vD(F)}catch{}}async function Y4(D={}){console.log(),console.log("\x1B[1m\uD83E\uDDDE Genie CLI Update\x1B[0m"),console.log("\x1B[2m\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\x1B[0m"),console.log();let F=await PY(D);if(D.next||D.stable)await vY(F);let $=await _Y();if(QD(`Detected installation: ${$}`),QD(`Channel: ${F}${F==="next"?" (dev builds)":" (stable)"}`),console.log(),$==="unknown")wD("No Genie CLI installation found"),console.log(),console.log("Install method not configured. Please reinstall genie:"),console.log("\x1B[36m curl -fsSL https://raw.githubusercontent.com/automagik-dev/genie/main/install.sh | bash\x1B[0m"),console.log(),process.exit(1);switch($){case"source":await TY();break;case"bun":await LY(F),await D4($);break;case"npm":await ZY(F),await D4($);break}}import{existsSync as kY,readFileSync as wY}from"fs";import{dirname as X1,resolve as Q1}from"path";var __dirname="/home/runner/_work/genie/genie/src/lib",fY="0.0.0-unknown";function uY(){let D=[Q1(X1(import.meta.dir??__dirname),"..","..","package.json"),Q1(X1(import.meta.dir??__dirname),"..","package.json"),Q1(X1(import.meta.dir??__dirname),"package.json")];for(let F of D)try{if(kY(F)){let $=JSON.parse(wY(F,"utf-8"));if($.version)return $.version}}catch{}return fY}var q4=uY();function qV(D,F){let $=new Set([D]);if(F){if($.add(F.entry.name),F.entry.roles)for(let J of F.entry.roles)$.add(J)}return $}function GV(D){let F=["spawn","--provider",D.provider,"--team",D.team];if(D.role)F.push("--role",D.role);if(D.skill)F.push("--skill",D.skill);if(D.cwd)F.push("--cwd",D.cwd);if(D.lastSessionId)F.push("--resume",D.lastSessionId);if(D.extraArgs)F.push(...D.extraArgs);return F}async function LF(D){let F=D.tool_input;if(!F||F.type!=="message")return;let $=F.recipient;if(!$||$==="team-lead")return;let J=process.env.GENIE_TEAM??D.team_name;if(!J)return;try{let B=await Promise.resolve().then(() => (MD(),KD)),X=await Promise.resolve().then(() => ($D(),ND)),Q=await Promise.resolve().then(() => (C3(),O3)),q=(await B.list()).find((z)=>(z.role===$||z.id===$)&&z.team===J);if(q&&await X.isPaneAlive(q.paneId))return;let G=await Q.resolve($),H=await B.listTemplates(),V=qV($,G),W=H.find((z)=>{if(z.team!==J)return!1;return[...V].some((E)=>z.id===E||z.role===E)});if(!W){if(G)console.error(`[genie-hook] Agent "${$}" is registered in directory but has no spawn template in team "${J}".`);return}let{spawnSync:U}=v("child_process");U("genie",GV(W),{timeout:1e4,stdio:"ignore",env:{...process.env,GENIE_TEAM:J}}),console.error(`[genie-hook] Auto-spawned "${$}" in team "${J}"`)}catch(B){let X=B instanceof Error?B.message:String(B);console.error(`[genie-hook] Auto-spawn failed for "${$}": ${X}`)}}async function ZF(D){let F=D.tool_input;if(!F)return;let $=F.type;if($!=="message"&&$!=="broadcast")return;let J=process.env.GENIE_AGENT_NAME;if(!J)return;let B=F.content;if(!B)return;if(B.startsWith(`[from:${J}]`))return;return{updatedInput:{...F,content:`[from:${J}] ${B}`}}}r1();var VV=[{name:"identity-inject",event:"PreToolUse",matcher:/^SendMessage$/,priority:10,fn:ZF},{name:"auto-spawn",event:"PreToolUse",matcher:/^SendMessage$/,priority:20,fn:LF}];function WV(D,F){return VV.filter(($)=>{if($.event!==D)return!1;if($.matcher&&F&&!$.matcher.test(F))return!1;if($.matcher&&!F)return!1;return!0}).sort(($,J)=>$.priority-J.priority)}async function UV(D,F,$){let J={...F};if($)J.tool_input=$;try{return await D.fn(J)}catch(B){let X=B instanceof Error?B.message:String(B);console.error(`[genie-hook] Handler "${D.name}" threw: ${X}`);return}}async function zV(D,F){let $=F.tool_input?{...F.tool_input}:void 0;for(let J of D){let B=await UV(J,F,$);if(!B)continue;if(B.decision==="deny")return{decision:"deny",reason:B.reason??`Denied by handler: ${J.name}`};if(B.updatedInput)$={...$,...B.updatedInput}}if($&&F.tool_input&&JSON.stringify($)!==JSON.stringify(F.tool_input))return{updatedInput:$};return{}}async function KV(D,F){await Promise.allSettled(D.map(($)=>$.fn(F).catch((J)=>{let B=J instanceof Error?J.message:String(J);console.error(`[genie-hook] Handler "${$.name}" threw: ${B}`)})))}async function NF(D){let F;try{F=JSON.parse(D)}catch{return console.error("[genie-hook] Invalid JSON on stdin"),""}let $=F.hook_event_name;if(!$)return console.error("[genie-hook] Missing hook_event_name in payload"),"";let J=F.tool_name,B=WV($,J);if(B.length===0)return"";if(TF($)){let X=await zV(B,F);if(X.decision||X.updatedInput)return JSON.stringify(X);return""}return await KV(B,F),""}async function MV(){let D=[];for await(let F of Bun.stdin.stream())D.push(Buffer.from(F));return Buffer.concat(D).toString("utf-8")}async function EV(){let D=await MV();if(!D.trim())process.exit(0);let F=await NF(D);if(F)process.stdout.write(F)}function IF(D){D.command("hook").description("Hook middleware for Claude Code integration").command("dispatch").description("Dispatch a CC hook event (reads JSON from stdin, writes decision to stdout)").action(EV)}i8();C3();M3();pD();import{resolve as r8}from"path";function tF(D){let F=D.command("dir").description("Agent directory management");F.command("add <name>").description("Register an agent in the directory").requiredOption("--dir <path>","Agent folder (CWD + AGENTS.md)").option("--repo <path>","Default git repo (overridden by team)").option("--prompt-mode <mode>","Prompt mode: append or system","append").option("--model <model>","Default model (sonnet, opus, codex)").option("--roles <roles...>","Built-in roles this agent can orchestrate").option("--global","Write to global directory instead of project").action(async($,J)=>{try{let B=eF(J.promptMode),X=await p1({name:$,dir:r8(J.dir),repo:J.repo?r8(J.repo):void 0,promptMode:B,model:J.model,roles:J.roles},{global:J.global}),Q=J.global?"global":"project";if(console.log(`Agent "${X.name}" registered (${Q}).`),console.log(` Dir: ${WD(X.dir)}`),X.repo)console.log(` Repo: ${WD(X.repo)}`);if(console.log(` Prompt mode: ${X.promptMode}`),X.model)console.log(` Model: ${X.model}`);if(X.roles?.length)console.log(` Roles: ${X.roles.join(", ")}`)}catch(B){let X=B instanceof Error?B.message:String(B);console.error(`Error: ${X}`),process.exit(1)}}),F.command("rm <name>").description("Remove an agent from the directory").option("--global","Remove from global directory instead of project").action(async($,J)=>{try{if(await d1($,{global:J.global})){let X=J.global?"global":"project";console.log(`Agent "${$}" removed from ${X} directory.`)}else console.error(`Agent "${$}" not found in directory.`),process.exit(1)}catch(B){let X=B instanceof Error?B.message:String(B);console.error(`Error: ${X}`),process.exit(1)}}),F.command("ls [name]").description("List all agents or show single entry details").option("--json","Output as JSON").option("--builtins","Include built-in roles and council members").action(async($,J)=>{try{if($)await eV($,J.json);else await DW(J.json,J.builtins)}catch(B){let X=B instanceof Error?B.message:String(B);console.error(`Error: ${X}`),process.exit(1)}}),F.command("edit <name>").description("Update an agent directory entry").option("--dir <path>","Agent folder (CWD + AGENTS.md)").option("--repo <path>","Default git repo").option("--prompt-mode <mode>","Prompt mode: append or system").option("--model <model>","Default model").option("--roles <roles...>","Built-in roles this agent can orchestrate").option("--global","Edit in global directory instead of project").action(async($,J)=>{try{await tV($,J)}catch(B){let X=B instanceof Error?B.message:String(B);console.error(`Error: ${X}`),process.exit(1)}})}async function tV(D,F){let $={};if(F.dir)$.dir=r8(F.dir);if(F.repo)$.repo=r8(F.repo);if(F.promptMode)$.promptMode=eF(F.promptMode);if(F.model)$.model=F.model;if(F.roles)$.roles=F.roles;if(Object.keys($).length===0)console.error("No fields to update. Provide at least one of: --dir, --repo, --prompt-mode, --model, --roles"),process.exit(1);let J=await c1(D,$,{global:F.global}),B=F.global?"global":"project";console.log(`Agent "${D}" updated (${B}).`),D$(J)}function eF(D){if(D!=="system"&&D!=="append")throw Error(`Invalid prompt mode "${D}". Must be "append" or "system".`);return D}function D$(D){if(console.log(` Name: ${D.name}`),console.log(` Dir: ${WD(D.dir)}`),D.repo)console.log(` Repo: ${WD(D.repo)}`);if(console.log(` Prompt mode: ${D.promptMode}`),D.model)console.log(` Model: ${D.model}`);if(D.roles?.length)console.log(` Roles: ${D.roles.join(", ")}`);console.log(` Registered: ${D.registeredAt}`)}async function eV(D,F){let $=await A3(D);if(!$)console.error(`Agent "${D}" not found in directory or built-ins.`),process.exit(1);if(F){console.log(JSON.stringify({...$.entry,builtin:$.builtin},null,2));return}if($.builtin)console.log(`
442
442
  (built-in ${$.entry.registeredAt==="(built-in)"?"agent":"agent"})`);console.log(""),D$($.entry),console.log("")}async function DW(D,F){let $=await R3();if(D){FW($,F);return}if($.length===0&&!F){console.log(`
443
443
  No agents registered. Add one with: genie dir add <name> --dir <path>`),console.log(`Use --builtins to also see built-in roles and council members.
444
444
  `);return}if($.length>0)$W($);if(F)JW()}function FW(D,F){let $=D.map((J)=>({...J,builtin:!1}));if(F)for(let J of k8)$.push({name:J.name,description:J.description,model:J.model,category:J.category,scope:"built-in",builtin:!0});console.log(JSON.stringify($,null,2))}function $W(D){console.log(""),console.log("REGISTERED AGENTS"),console.log("-".repeat(85)),console.log(` ${"NAME".padEnd(22)}${"SCOPE".padEnd(10)}${"DIR".padEnd(30)}${"MODE".padEnd(8)}${"MODEL".padEnd(8)}ROLES`),console.log(` ${"-".repeat(20)} ${"-".repeat(8)} ${"-".repeat(28)} ${"-".repeat(6)} ${"-".repeat(6)} ${"-".repeat(15)}`);for(let Q of D){let Y=WD(Q.dir),q=Y.length>28?`${Y.slice(0,25)}...`:Y,G=Q.roles?.join(", ")||"-";console.log(` ${Q.name.padEnd(22)}${Q.scope.padEnd(10)}${q.padEnd(30)}${Q.promptMode.padEnd(8)}${(Q.model||"-").padEnd(8)}${G}`)}console.log("")}function JW(){console.log("BUILT-IN AGENTS"),console.log("-".repeat(80)),console.log(` ${"NAME".padEnd(22)}${"TYPE".padEnd(10)}${"MODEL".padEnd(8)}DESCRIPTION`),console.log(` ${"-".repeat(20)} ${"-".repeat(8)} ${"-".repeat(6)} ${"-".repeat(30)}`);for(let J of k8)console.log(` ${J.name.padEnd(22)}${J.category.padEnd(10)}${(J.model||"-").padEnd(8)}${J.description}`);console.log("")}import{execSync as H$}from"child_process";import{existsSync as S3}from"fs";import{mkdir as EW,readFile as b3,writeFile as AW}from"fs/promises";import{tmpdir as RW}from"os";import{join as r2}from"path";t3();f2();import{mkdir as F$,readFile as BW,writeFile as XW}from"fs/promises";import{dirname as $$,join as QW}from"path";var YW=A.enum(["blocked","ready","in_progress","done"]),qW=A.object({status:YW,assignee:A.string().optional(),dependsOn:A.array(A.string()).default([]),startedAt:A.string().optional(),completedAt:A.string().optional()}),GW=A.object({wish:A.string(),groups:A.record(A.string(),qW),createdAt:A.string(),updatedAt:A.string()});async function J5(D,F){let $=await HD(D);try{let J=await J$(D);if(!J)throw Error(`State file not found: ${D}`);let B=await F(J);return await B$(D,J),B}finally{await $()}}function T3(D,F){return QW(F??process.cwd(),".genie","state",`${D}.json`)}async function J$(D){try{let F=await BW(D,"utf-8");return GW.parse(JSON.parse(F))}catch{return null}}async function B$(D,F){await F$($$(D),{recursive:!0}),F.updatedAt=new Date().toISOString(),await XW(D,JSON.stringify(F,null,2))}function HW(D){for(let[,F]of Object.entries(D.groups)){if(F.status!=="blocked")continue;if(F.dependsOn.length===0)continue;if(F.dependsOn.every((J)=>{return D.groups[J]?.status==="done"}))F.status="ready"}}function VW(D){let F=new Set(D.map(($)=>$.name));for(let $ of D){if($.dependsOn?.includes($.name))throw Error(`Group "${$.name}" depends on itself`);for(let J of $.dependsOn??[])if(!F.has(J))throw Error(`Group "${$.name}" depends on non-existent group "${J}"`)}}function WW(D){let F={},$={};for(let X of D)F[X.name]=(X.dependsOn??[]).length,$[X.name]=[];for(let X of D)for(let Q of X.dependsOn??[])$[Q].push(X.name);let J=Object.entries(F).filter(([,X])=>X===0).map(([X])=>X),B=0;while(J.length>0){let X=J.shift();if(!X)break;B++;for(let Q of $[X])if(F[Q]--,F[Q]===0)J.push(Q)}if(B!==D.length){let X=Object.entries(F).filter(([,Q])=>Q>0).map(([Q])=>Q);throw Error(`Dependency cycle detected among groups: ${X.join(", ")}`)}}function UW(D){VW(D),WW(D)}async function B5(D,F,$){UW(F);let J=T3(D,$);await F$($$(J),{recursive:!0});let B=new Date().toISOString(),X={};for(let Y of F){let q=Y.dependsOn??[];X[Y.name]={status:q.length===0?"ready":"blocked",dependsOn:q}}let Q={wish:D,groups:X,createdAt:B,updatedAt:B};return await B$(J,Q),Q}async function X$(D,F,$,J){let B=T3(D,J);return J5(B,(X)=>{let Q=X.groups[F];if(!Q)throw Error(`Group "${F}" not found in wish "${D}"`);if(Q.status==="in_progress")throw Error(`Group "${F}" is already in progress (assigned to ${Q.assignee??"unknown"})`);if(Q.status==="done")throw Error(`Group "${F}" is already done`);for(let Y of Q.dependsOn){let q=X.groups[Y];if(!q)throw Error(`Dependency "${Y}" not found in wish "${D}"`);if(q.status!=="done")throw Error(`Cannot start group "${F}": dependency "${Y}" is ${q.status} (must be done)`)}return Q.status="in_progress",Q.assignee=$,Q.startedAt=new Date().toISOString(),{...Q}})}async function Q$(D,F,$){let J=T3(D,$);return J5(J,(B)=>{let X=B.groups[F];if(!X)throw Error(`Group "${F}" not found in wish "${D}"`);if(X.status!=="in_progress")throw Error(`Cannot complete group "${F}": must be in_progress (currently ${X.status})`);return X.status="done",X.completedAt=new Date().toISOString(),HW(B),{...X}})}async function Y$(D,F,$){let J=T3(D,$);return J5(J,(B)=>{let X=B.groups[F];if(!X)throw Error(`Group "${F}" not found`);if(X.status!=="in_progress")throw Error(`Cannot reset: must be in_progress (currently ${X.status})`);return X.status="ready",X.assignee=void 0,X.startedAt=void 0,{...X}})}async function i2(D,F){let $=T3(D,F);return J$($)}i8();function I3(D){let F=D.indexOf("#");if(F===-1)throw Error(`Invalid reference "${D}". Expected format: <slug>#<group>`);let $=D.slice(0,F),J=D.slice(F+1);if(!$||!J)throw Error(`Invalid reference "${D}". Both slug and group are required.`);return{slug:$,group:J}}var zW={blocked:"\uD83D\uDD12",ready:"\uD83D\uDFE2",in_progress:"\uD83D\uDD04",done:"\u2705"};function X5(D){if(!D)return"";return new Date(D).toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1})}function N3(D,F){return D.length>=F?D:D+" ".repeat(F-D.length)}async function KW(D){try{let{slug:F,group:$}=I3(D),J=await Q$(F,$);if(console.log(`\u2705 Group "${$}" marked as done in wish "${F}"`),J.completedAt)console.log(` Completed at: ${X5(J.completedAt)}`);let B=await i2(F);if(B){let X=Object.entries(B.groups).filter(([,Q])=>Q.status==="ready"&&Q.dependsOn.includes($)).map(([Q])=>Q);if(X.length>0)console.log(` Unblocked: ${X.join(", ")}`)}}catch(F){let $=F instanceof Error?F.message:String(F);console.error(`\u274C ${$}`),process.exit(1)}}async function MW(D){try{let F=await i2(D);if(!F)console.error(`\u274C No state found for wish "${D}"`),console.error(" State file expected at: .genie/state/<slug>.json"),process.exit(1);console.log(`