@automagik/genie 3.260315.2 → 3.260315.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +1 -1
- package/dist/genie.js +6 -6
- package/install.sh +43 -8
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
- package/plugins/genie/.claude-plugin/plugin.json +1 -1
- package/plugins/genie/package.json +1 -1
- package/plugins/genie/scripts/smart-install.js +43 -6
- package/src/lib/provider-adapters.ts +8 -0
- package/src/term-commands/agents.ts +3 -0
- package/src/term-commands/team.ts +3 -1
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"plugins": [
|
|
11
11
|
{
|
|
12
12
|
"name": "genie",
|
|
13
|
-
"version": "3.260315.
|
|
13
|
+
"version": "3.260315.3",
|
|
14
14
|
"source": "./plugins/genie",
|
|
15
15
|
"description": "Human-AI partnership for Claude Code. Share a terminal, orchestrate workers, evolve together. Brainstorm ideas, wish them into plans, make with parallel agents, ship as one team. A coding genie that grows with your project."
|
|
16
16
|
}
|
package/dist/genie.js
CHANGED
|
@@ -21,7 +21,7 @@ Expecting one of '${B.join("', '")}'`);if(this._lifeCycleHooks[D])this._lifeCycl
|
|
|
21
21
|
`),this.outputHelp({error:!0});let B=F||{},$=B.exitCode||1,E=B.code||"commander.error";this._exit($,E,D)}_parseOptionsEnv(){this.options.forEach((D)=>{if(D.envVar&&D.envVar in h.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()}`,h.env[D.envVar]);else this.emit(`optionEnv:${D.name()}`)}})}_parseOptionsImplied(){let D=new DB(this.options),F=(B)=>{return this.getOptionValue(B)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(B))};this.options.filter((B)=>B.implied!==void 0&&F(B.attributeName())&&D.valueFromOption(this.getOptionValue(B.attributeName()),B)).forEach((B)=>{Object.keys(B.implied).filter(($)=>!F($)).forEach(($)=>{this.setOptionValueWithSource($,B.implied[$],"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 B=(J)=>{let X=J.attributeName(),Y=this.getOptionValue(X),Q=this.options.find((H)=>H.negate&&X===H.attributeName()),q=this.options.find((H)=>!H.negate&&X===H.attributeName());if(Q&&(Q.presetArg===void 0&&Y===!1||Q.presetArg!==void 0&&Y===Q.presetArg))return Q;return q||J},$=(J)=>{let X=B(J),Y=X.attributeName();if(this.getOptionValueSource(Y)==="env")return`environment variable '${X.envVar}'`;return`option '${X.flags}'`},E=`error: ${$(D)} cannot be used with ${$(F)}`;this.error(E,{code:"commander.conflictingOption"})}unknownOption(D){if(this._allowUnknownOption)return;let F="";if(D.startsWith("--")&&this._showSuggestionAfterError){let $=[],E=this;do{let J=E.createHelp().visibleOptions(E).filter((X)=>X.long).map((X)=>X.long);$=$.concat(J),E=E.parent}while(E&&!E._enablePositionalOptions);F=I1(D,$)}let B=`error: unknown option '${D}'${F}`;this.error(B,{code:"commander.unknownOption"})}_excessArguments(D){if(this._allowExcessArguments)return;let F=this.registeredArguments.length,B=F===1?"":"s",E=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${F} argument${B} but got ${D.length}.`;this.error(E,{code:"commander.excessArguments"})}unknownCommand(){let D=this.args[0],F="";if(this._showSuggestionAfterError){let $=[];this.createHelp().visibleCommands(this).forEach((E)=>{if($.push(E.name()),E.alias())$.push(E.alias())}),F=I1(D,$)}let B=`error: unknown command '${D}'${F}`;this.error(B,{code:"commander.unknownCommand"})}version(D,F,B){if(D===void 0)return this._version;this._version=D,F=F||"-V, --version",B=B||"output the version number";let $=this.createOption(F,B);return this._versionOptionName=$.attributeName(),this._registerOption($),this.on("option:"+$.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 B=this.parent?._findCommand(D);if(B){let $=[B.name()].concat(B.aliases()).join("|");throw Error(`cannot add alias '${D}' to command '${this.name()}' as already have command '${$}'`)}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((B)=>{return tF(B)});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=ND.basename(D,ND.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},B;if(F.error)B=($)=>this._outputConfiguration.writeErr($);else B=($)=>this._outputConfiguration.writeOut($);return F.write=D.write||B,F.command=this,F}outputHelp(D){let F;if(typeof D==="function")F=D,D=void 0;let B=this._getHelpContext(D);this._getCommandAndAncestors().reverse().forEach((E)=>E.emit("beforeAllHelp",B)),this.emit("beforeHelp",B);let $=this.helpInformation(B);if(F){if($=F($),typeof $!=="string"&&!Buffer.isBuffer($))throw Error("outputHelp callback must return a string or a Buffer")}if(B.write($),this._getHelpOption()?.long)this.emit(this._getHelpOption().long);this.emit("afterHelp",B),this._getCommandAndAncestors().forEach((E)=>E.emit("afterAllHelp",B))}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=h.exitCode||0;if(F===0&&D&&typeof D!=="function"&&D.error)F=1;this._exit(F,"commander.help","(outputHelp)")}addHelpText(D,F){let B=["beforeAll","before","after","afterAll"];if(!B.includes(D))throw Error(`Unexpected value for position to addHelpText.
|
|
23
23
|
Expecting one of '${B.join("', '")}'`);let $=`${D}Help`;return this.on($,(E)=>{let J;if(typeof F==="function")J=F({error:E.error,command:E.command});else J=F;if(J)E.write(`${J}
|
|
24
|
-
`)}),this}_outputHelpIfRequested(D){let F=this._getHelpOption();if(F&&D.find(($)=>F.is($)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function v1(D){return D.map((F)=>{if(!F.startsWith("--inspect"))return F;let B,$="127.0.0.1",E="9229",J;if((J=F.match(/^(--inspect(-brk)?)$/))!==null)B=J[1];else if((J=F.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(B=J[1],/^\d+$/.test(J[3]))E=J[3];else $=J[3];else if((J=F.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)B=J[1],$=J[3],E=J[4];if(B&&E!=="0")return`${B}=${$}:${parseInt(E)+1}`;return F})}FB.Command=v8});var f1=l((JB)=>{var{Argument:P1}=A3(),{Command:k8}=k1(),{CommanderError:$B,InvalidArgumentError:w1}=V0(),{Help:EB}=T8(),{Option:u1}=Z8();JB.program=new k8;JB.createCommand=(D)=>new k8(D);JB.createOption=(D,F)=>new u1(D,F);JB.createArgument=(D,F)=>new P1(D,F);JB.Command=k8;JB.Option=u1;JB.Argument=P1;JB.Help=EB;JB.CommanderError=$B;JB.InvalidArgumentError=w1;JB.InvalidOptionArgumentError=w1});var k,w8,V,RD=(D)=>{switch(typeof D){case"undefined":return V.undefined;case"string":return V.string;case"number":return Number.isNaN(D)?V.nan:V.number;case"boolean":return V.boolean;case"function":return V.function;case"bigint":return V.bigint;case"symbol":return V.symbol;case"object":if(Array.isArray(D))return V.array;if(D===null)return V.null;if(D.then&&typeof D.then==="function"&&D.catch&&typeof D.catch==="function")return V.promise;if(typeof Map<"u"&&D instanceof Map)return V.map;if(typeof Set<"u"&&D instanceof Set)return V.set;if(typeof Date<"u"&&D instanceof Date)return V.date;return V.object;default:return V.unknown}};var _0=Z(()=>{(function(D){D.assertEqual=(E)=>{};function F(E){}D.assertIs=F;function B(E){throw Error()}D.assertNever=B,D.arrayToEnum=(E)=>{let J={};for(let X of E)J[X]=X;return J},D.getValidEnumValues=(E)=>{let J=D.objectKeys(E).filter((Y)=>typeof E[E[Y]]!=="number"),X={};for(let Y of J)X[Y]=E[Y];return D.objectValues(X)},D.objectValues=(E)=>{return D.objectKeys(E).map(function(J){return E[J]})},D.objectKeys=typeof Object.keys==="function"?(E)=>Object.keys(E):(E)=>{let J=[];for(let X in E)if(Object.prototype.hasOwnProperty.call(E,X))J.push(X);return J},D.find=(E,J)=>{for(let X of E)if(J(X))return X;return},D.isInteger=typeof Number.isInteger==="function"?(E)=>Number.isInteger(E):(E)=>typeof E==="number"&&Number.isFinite(E)&&Math.floor(E)===E;function $(E,J=" | "){return E.map((X)=>typeof X==="string"?`'${X}'`:X).join(J)}D.joinValues=$,D.jsonStringifyReplacer=(E,J)=>{if(typeof J==="bigint")return J.toString();return J}})(k||(k={}));(function(D){D.mergeShapes=(F,B)=>{return{...F,...B}}})(w8||(w8={}));V=k.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"])});var W,CB=(D)=>{return JSON.stringify(D,null,2).replace(/"([^"]+)":/g,"$1:")},e;var M3=Z(()=>{_0();W=k.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"]);e=class e extends Error{get errors(){return this.issues}constructor(D){super();this.issues=[],this.addIssue=(B)=>{this.issues=[...this.issues,B]},this.addIssues=(B=[])=>{this.issues=[...this.issues,...B]};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(E){return E.message},B={_errors:[]},$=(E)=>{for(let J of E.issues)if(J.code==="invalid_union")J.unionErrors.map($);else if(J.code==="invalid_return_type")$(J.returnTypeError);else if(J.code==="invalid_arguments")$(J.argumentsError);else if(J.path.length===0)B._errors.push(F(J));else{let X=B,Y=0;while(Y<J.path.length){let Q=J.path[Y];if(Y!==J.path.length-1)X[Q]=X[Q]||{_errors:[]};else X[Q]=X[Q]||{_errors:[]},X[Q]._errors.push(F(J));X=X[Q],Y++}}};return $(this),B}static assert(D){if(!(D instanceof e))throw Error(`Not a ZodError: ${D}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,k.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(D=(F)=>F.message){let F={},B=[];for(let $ of this.issues)if($.path.length>0){let E=$.path[0];F[E]=F[E]||[],F[E].push(D($))}else B.push(D($));return{formErrors:B,fieldErrors:F}}get formErrors(){return this.flatten()}};e.create=(D)=>{return new e(D)}});var OB=(D,F)=>{let B;switch(D.code){case W.invalid_type:if(D.received===V.undefined)B="Required";else B=`Expected ${D.expected}, received ${D.received}`;break;case W.invalid_literal:B=`Invalid literal value, expected ${JSON.stringify(D.expected,k.jsonStringifyReplacer)}`;break;case W.unrecognized_keys:B=`Unrecognized key(s) in object: ${k.joinValues(D.keys,", ")}`;break;case W.invalid_union:B="Invalid input";break;case W.invalid_union_discriminator:B=`Invalid discriminator value. Expected ${k.joinValues(D.options)}`;break;case W.invalid_enum_value:B=`Invalid enum value. Expected ${k.joinValues(D.options)}, received '${D.received}'`;break;case W.invalid_arguments:B="Invalid function arguments";break;case W.invalid_return_type:B="Invalid function return type";break;case W.invalid_date:B="Invalid date";break;case W.invalid_string:if(typeof D.validation==="object")if("includes"in D.validation){if(B=`Invalid input: must include "${D.validation.includes}"`,typeof D.validation.position==="number")B=`${B} at one or more positions greater than or equal to ${D.validation.position}`}else if("startsWith"in D.validation)B=`Invalid input: must start with "${D.validation.startsWith}"`;else if("endsWith"in D.validation)B=`Invalid input: must end with "${D.validation.endsWith}"`;else k.assertNever(D.validation);else if(D.validation!=="regex")B=`Invalid ${D.validation}`;else B="Invalid";break;case W.too_small:if(D.type==="array")B=`Array must contain ${D.exact?"exactly":D.inclusive?"at least":"more than"} ${D.minimum} element(s)`;else if(D.type==="string")B=`String must contain ${D.exact?"exactly":D.inclusive?"at least":"over"} ${D.minimum} character(s)`;else if(D.type==="number")B=`Number must be ${D.exact?"exactly equal to ":D.inclusive?"greater than or equal to ":"greater than "}${D.minimum}`;else if(D.type==="bigint")B=`Number must be ${D.exact?"exactly equal to ":D.inclusive?"greater than or equal to ":"greater than "}${D.minimum}`;else if(D.type==="date")B=`Date must be ${D.exact?"exactly equal to ":D.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(D.minimum))}`;else B="Invalid input";break;case W.too_big:if(D.type==="array")B=`Array must contain ${D.exact?"exactly":D.inclusive?"at most":"less than"} ${D.maximum} element(s)`;else if(D.type==="string")B=`String must contain ${D.exact?"exactly":D.inclusive?"at most":"under"} ${D.maximum} character(s)`;else if(D.type==="number")B=`Number must be ${D.exact?"exactly":D.inclusive?"less than or equal to":"less than"} ${D.maximum}`;else if(D.type==="bigint")B=`BigInt must be ${D.exact?"exactly":D.inclusive?"less than or equal to":"less than"} ${D.maximum}`;else if(D.type==="date")B=`Date must be ${D.exact?"exactly":D.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(D.maximum))}`;else B="Invalid input";break;case W.custom:B="Invalid input";break;case W.invalid_intersection_types:B="Intersection results could not be merged";break;case W.not_multiple_of:B=`Number must be a multiple of ${D.multipleOf}`;break;case W.not_finite:B="Number must be finite";break;default:B=F.defaultError,k.assertNever(D)}return{message:B}},bD;var u8=Z(()=>{M3();_0();bD=OB});function LB(D){i1=D}function I2(){return i1}var i1;var R3=Z(()=>{u8();i1=bD});function K(D,F){let B=I2(),$=K0({issueData:F,data:D.data,path:D.path,errorMaps:[D.common.contextualErrorMap,D.schemaErrorMap,B,B===bD?void 0:bD].filter((E)=>!!E)});D.common.issues.push($)}class d{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 B=[];for(let $ of F){if($.status==="aborted")return O;if($.status==="dirty")D.dirty();B.push($.value)}return{status:D.value,value:B}}static async mergeObjectAsync(D,F){let B=[];for(let $ of F){let E=await $.key,J=await $.value;B.push({key:E,value:J})}return d.mergeObjectSync(D,B)}static mergeObjectSync(D,F){let B={};for(let $ of F){let{key:E,value:J}=$;if(E.status==="aborted")return O;if(J.status==="aborted")return O;if(E.status==="dirty")D.dirty();if(J.status==="dirty")D.dirty();if(E.value!=="__proto__"&&(typeof J.value<"u"||$.alwaysSet))B[E.value]=J.value}return{status:D.value,value:B}}}var K0=(D)=>{let{data:F,path:B,errorMaps:$,issueData:E}=D,J=[...B,...E.path||[]],X={...E,path:J};if(E.message!==void 0)return{...E,path:J,message:E.message};let Y="",Q=$.filter((q)=>!!q).slice().reverse();for(let q of Q)Y=q(X,{data:F,defaultError:Y}).message;return{...E,path:J,message:Y}},jB,O,eD=(D)=>({status:"dirty",value:D}),r=(D)=>({status:"valid",value:D}),C3=(D)=>D.status==="aborted",O3=(D)=>D.status==="dirty",mD=(D)=>D.status==="valid",v2=(D)=>typeof Promise<"u"&&D instanceof Promise;var f8=Z(()=>{R3();u8();jB=[];O=Object.freeze({status:"aborted"})});var n1=()=>{};var M;var r1=Z(()=>{(function(D){D.errToObj=(F)=>typeof F==="string"?{message:F}:F||{},D.toString=(F)=>typeof F==="string"?F:F?.message})(M||(M={}))});class GD{constructor(D,F,B,$){this._cachedPath=[],this.parent=D,this.data=F,this._path=B,this._key=$}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:B,required_error:$,description:E}=D;if(F&&(B||$))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(F)return{errorMap:F,description:E};return{errorMap:(X,Y)=>{let{message:Q}=D;if(X.code==="invalid_enum_value")return{message:Q??Y.defaultError};if(typeof Y.data>"u")return{message:Q??$??Y.defaultError};if(X.code!=="invalid_type")return{message:Y.defaultError};return{message:Q??B??Y.defaultError}},description:E}}class v{get description(){return this._def.description}_getType(D){return RD(D.data)}_getOrReturnCtx(D,F){return F||{common:D.parent.common,data:D.data,parsedType:RD(D.data),schemaErrorMap:this._def.errorMap,path:D.path,parent:D.parent}}_processInputParams(D){return{status:new d,ctx:{common:D.parent.common,data:D.data,parsedType:RD(D.data),schemaErrorMap:this._def.errorMap,path:D.path,parent:D.parent}}}_parseSync(D){let F=this._parse(D);if(v2(F))throw Error("Synchronous parse encountered promise.");return F}_parseAsync(D){let F=this._parse(D);return Promise.resolve(F)}parse(D,F){let B=this.safeParse(D,F);if(B.success)return B.data;throw B.error}safeParse(D,F){let B={common:{issues:[],async:F?.async??!1,contextualErrorMap:F?.errorMap},path:F?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:D,parsedType:RD(D)},$=this._parseSync({data:D,path:B.path,parent:B});return o1(B,$)}"~validate"(D){let F={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:D,parsedType:RD(D)};if(!this["~standard"].async)try{let B=this._parseSync({data:D,path:[],parent:F});return mD(B)?{value:B.value}:{issues:F.common.issues}}catch(B){if(B?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;F.common={issues:[],async:!0}}return this._parseAsync({data:D,path:[],parent:F}).then((B)=>mD(B)?{value:B.value}:{issues:F.common.issues})}async parseAsync(D,F){let B=await this.safeParseAsync(D,F);if(B.success)return B.data;throw B.error}async safeParseAsync(D,F){let B={common:{issues:[],contextualErrorMap:F?.errorMap,async:!0},path:F?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:D,parsedType:RD(D)},$=this._parse({data:D,path:B.path,parent:B}),E=await(v2($)?$:Promise.resolve($));return o1(B,E)}refine(D,F){let B=($)=>{if(typeof F==="string"||typeof F>"u")return{message:F};else if(typeof F==="function")return F($);else return F};return this._refinement(($,E)=>{let J=D($),X=()=>E.addIssue({code:W.custom,...B($)});if(typeof Promise<"u"&&J instanceof Promise)return J.then((Y)=>{if(!Y)return X(),!1;else return!0});if(!J)return X(),!1;else return!0})}refinement(D,F){return this._refinement((B,$)=>{if(!D(B))return $.addIssue(typeof F==="function"?F(B,$):F),!1;else return!0})}_refinement(D){return new WD({schema:this,typeName:L.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 HD.create(this,this._def)}nullable(){return vD.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return qD.create(this)}promise(){return $2.create(this,this._def)}or(D){return x2.create([this,D],this._def)}and(D){return y2.create(this,D,this._def)}transform(D){return new WD({...S(this._def),schema:this,typeName:L.ZodEffects,effect:{type:"transform",transform:D}})}default(D){let F=typeof D==="function"?D:()=>D;return new m2({...S(this._def),innerType:this,defaultValue:F,typeName:L.ZodDefault})}brand(){return new j3({typeName:L.ZodBranded,type:this,...S(this._def)})}catch(D){let F=typeof D==="function"?D:()=>D;return new p2({...S(this._def),innerType:this,catchValue:F,typeName:L.ZodCatch})}describe(D){return new this.constructor({...this._def,description:D})}pipe(D){return O0.create(this,D)}readonly(){return d2.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}function t1(D){let F="[0-5]\\d";if(D.precision)F=`${F}\\.\\d{${D.precision}}`;else if(D.precision==null)F=`${F}(\\.\\d+)?`;let B=D.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${F})${B}`}function lB(D){return new RegExp(`^${t1(D)}$`)}function e1(D){let F=`${a1}T${t1(D)}`,B=[];if(B.push(D.local?"Z?":"Z"),D.offset)B.push("([+-]\\d{2}:?\\d{2})");return F=`${F}(${B.join("|")})`,new RegExp(`^${F}$`)}function mB(D,F){if((F==="v4"||!F)&&wB.test(D))return!0;if((F==="v6"||!F)&&fB.test(D))return!0;return!1}function pB(D,F){if(!IB.test(D))return!1;try{let[B]=D.split(".");if(!B)return!1;let $=B.replace(/-/g,"+").replace(/_/g,"/").padEnd(B.length+(4-B.length%4)%4,"="),E=JSON.parse(atob($));if(typeof E!=="object"||E===null)return!1;if("typ"in E&&E?.typ!=="JWT")return!1;if(!E.alg)return!1;if(F&&E.alg!==F)return!1;return!0}catch{return!1}}function dB(D,F){if((F==="v4"||!F)&&uB.test(D))return!0;if((F==="v6"||!F)&&xB.test(D))return!0;return!1}function cB(D,F){let B=(D.toString().split(".")[1]||"").length,$=(F.toString().split(".")[1]||"").length,E=B>$?B:$,J=Number.parseInt(D.toFixed(E).replace(".","")),X=Number.parseInt(F.toFixed(E).replace(".",""));return J%X/10**E}function k2(D){if(D instanceof y){let F={};for(let B in D.shape){let $=D.shape[B];F[B]=HD.create(k2($))}return new y({...D._def,shape:()=>F})}else if(D instanceof qD)return new qD({...D._def,type:k2(D.element)});else if(D instanceof HD)return HD.create(k2(D.unwrap()));else if(D instanceof vD)return vD.create(k2(D.unwrap()));else if(D instanceof OD)return OD.create(D.items.map((F)=>k2(F)));else return D}function y8(D,F){let B=RD(D),$=RD(F);if(D===F)return{valid:!0,data:D};else if(B===V.object&&$===V.object){let E=k.objectKeys(F),J=k.objectKeys(D).filter((Y)=>E.indexOf(Y)!==-1),X={...D,...F};for(let Y of J){let Q=y8(D[Y],F[Y]);if(!Q.valid)return{valid:!1};X[Y]=Q.data}return{valid:!0,data:X}}else if(B===V.array&&$===V.array){if(D.length!==F.length)return{valid:!1};let E=[];for(let J=0;J<D.length;J++){let X=D[J],Y=F[J],Q=y8(X,Y);if(!Q.valid)return{valid:!1};E.push(Q.data)}return{valid:!0,data:E}}else if(B===V.date&&$===V.date&&+D===+F)return{valid:!0,data:D};else return{valid:!1}}function D5(D,F){return new iD({values:D,typeName:L.ZodEnum,...S(F)})}function s1(D,F){let B=typeof D==="function"?D(F):typeof D==="string"?{message:D}:D;return typeof B==="string"?{message:B}:B}function F5(D,F={},B){if(D)return F2.create().superRefine(($,E)=>{let J=D($);if(J instanceof Promise)return J.then((X)=>{if(!X){let Y=s1(F,$),Q=Y.fatal??B??!0;E.addIssue({code:"custom",...Y,fatal:Q})}});if(!J){let X=s1(F,$),Y=X.fatal??B??!0;E.addIssue({code:"custom",...X,fatal:Y})}return});return F2.create()}var o1=(D,F)=>{if(mD(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 B=new e(D.common.issues);return this._error=B,this._error}}}},SB,TB,ZB,NB,bB,IB,vB,kB,PB="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",x8,wB,uB,fB,xB,yB,hB,a1="((\\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])))",gB,QD,dD,cD,w2,D2,A0,u2,f2,F2,pD,CD,z0,qD,y,x2,ID=(D)=>{if(D instanceof h2)return ID(D.schema);else if(D instanceof WD)return ID(D.innerType());else if(D instanceof g2)return[D.value];else if(D instanceof iD)return D.options;else if(D instanceof l2)return k.objectValues(D.enum);else if(D instanceof m2)return ID(D._def.innerType);else if(D instanceof u2)return[void 0];else if(D instanceof f2)return[null];else if(D instanceof HD)return[void 0,...ID(D.unwrap())];else if(D instanceof vD)return[null,...ID(D.unwrap())];else if(D instanceof j3)return ID(D.unwrap());else if(D instanceof d2)return ID(D.unwrap());else if(D instanceof p2)return ID(D._def.innerType);else return[]},L3,y2,OD,M0,R0,B2,P2,h2,g2,iD,l2,$2,WD,HD,vD,m2,p2,C0,iB,j3,O0,d2,nB,L,rB=(D,F={message:`Input not instance of ${D.name}`})=>F5((B)=>B instanceof D,F),B5,$5,oB,sB,E5,aB,tB,eB,D$,F$,B$,$$,E$,J$,X$,Y$,Q$,q$,H$,G$,W$,U$,V$,_$,K$,A$,z$,M$,R$,C$,O$,L$,j$,S$,T$=()=>B5().optional(),Z$=()=>$5().optional(),N$=()=>E5().optional(),b$,I$;var J5=Z(()=>{M3();R3();r1();f8();_0();SB=/^c[^\s-]{8,}$/i,TB=/^[0-9a-z]+$/,ZB=/^[0-9A-HJKMNP-TV-Z]{26}$/i,NB=/^[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,IB=/^[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,wB=/^(?:(?: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])$/,fB=/^(([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]))$/,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]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,yB=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,hB=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,gB=new RegExp(`^${a1}$`);QD=class QD extends v{_parse(D){if(this._def.coerce)D.data=String(D.data);if(this._getType(D)!==V.string){let E=this._getOrReturnCtx(D);return K(E,{code:W.invalid_type,expected:V.string,received:E.parsedType}),O}let B=new d,$=void 0;for(let E of this._def.checks)if(E.kind==="min"){if(D.data.length<E.value)$=this._getOrReturnCtx(D,$),K($,{code:W.too_small,minimum:E.value,type:"string",inclusive:!0,exact:!1,message:E.message}),B.dirty()}else if(E.kind==="max"){if(D.data.length>E.value)$=this._getOrReturnCtx(D,$),K($,{code:W.too_big,maximum:E.value,type:"string",inclusive:!0,exact:!1,message:E.message}),B.dirty()}else if(E.kind==="length"){let J=D.data.length>E.value,X=D.data.length<E.value;if(J||X){if($=this._getOrReturnCtx(D,$),J)K($,{code:W.too_big,maximum:E.value,type:"string",inclusive:!0,exact:!0,message:E.message});else if(X)K($,{code:W.too_small,minimum:E.value,type:"string",inclusive:!0,exact:!0,message:E.message});B.dirty()}}else if(E.kind==="email"){if(!kB.test(D.data))$=this._getOrReturnCtx(D,$),K($,{validation:"email",code:W.invalid_string,message:E.message}),B.dirty()}else if(E.kind==="emoji"){if(!x8)x8=new RegExp(PB,"u");if(!x8.test(D.data))$=this._getOrReturnCtx(D,$),K($,{validation:"emoji",code:W.invalid_string,message:E.message}),B.dirty()}else if(E.kind==="uuid"){if(!NB.test(D.data))$=this._getOrReturnCtx(D,$),K($,{validation:"uuid",code:W.invalid_string,message:E.message}),B.dirty()}else if(E.kind==="nanoid"){if(!bB.test(D.data))$=this._getOrReturnCtx(D,$),K($,{validation:"nanoid",code:W.invalid_string,message:E.message}),B.dirty()}else if(E.kind==="cuid"){if(!SB.test(D.data))$=this._getOrReturnCtx(D,$),K($,{validation:"cuid",code:W.invalid_string,message:E.message}),B.dirty()}else if(E.kind==="cuid2"){if(!TB.test(D.data))$=this._getOrReturnCtx(D,$),K($,{validation:"cuid2",code:W.invalid_string,message:E.message}),B.dirty()}else if(E.kind==="ulid"){if(!ZB.test(D.data))$=this._getOrReturnCtx(D,$),K($,{validation:"ulid",code:W.invalid_string,message:E.message}),B.dirty()}else if(E.kind==="url")try{new URL(D.data)}catch{$=this._getOrReturnCtx(D,$),K($,{validation:"url",code:W.invalid_string,message:E.message}),B.dirty()}else if(E.kind==="regex"){if(E.regex.lastIndex=0,!E.regex.test(D.data))$=this._getOrReturnCtx(D,$),K($,{validation:"regex",code:W.invalid_string,message:E.message}),B.dirty()}else if(E.kind==="trim")D.data=D.data.trim();else if(E.kind==="includes"){if(!D.data.includes(E.value,E.position))$=this._getOrReturnCtx(D,$),K($,{code:W.invalid_string,validation:{includes:E.value,position:E.position},message:E.message}),B.dirty()}else if(E.kind==="toLowerCase")D.data=D.data.toLowerCase();else if(E.kind==="toUpperCase")D.data=D.data.toUpperCase();else if(E.kind==="startsWith"){if(!D.data.startsWith(E.value))$=this._getOrReturnCtx(D,$),K($,{code:W.invalid_string,validation:{startsWith:E.value},message:E.message}),B.dirty()}else if(E.kind==="endsWith"){if(!D.data.endsWith(E.value))$=this._getOrReturnCtx(D,$),K($,{code:W.invalid_string,validation:{endsWith:E.value},message:E.message}),B.dirty()}else if(E.kind==="datetime"){if(!e1(E).test(D.data))$=this._getOrReturnCtx(D,$),K($,{code:W.invalid_string,validation:"datetime",message:E.message}),B.dirty()}else if(E.kind==="date"){if(!gB.test(D.data))$=this._getOrReturnCtx(D,$),K($,{code:W.invalid_string,validation:"date",message:E.message}),B.dirty()}else if(E.kind==="time"){if(!lB(E).test(D.data))$=this._getOrReturnCtx(D,$),K($,{code:W.invalid_string,validation:"time",message:E.message}),B.dirty()}else if(E.kind==="duration"){if(!vB.test(D.data))$=this._getOrReturnCtx(D,$),K($,{validation:"duration",code:W.invalid_string,message:E.message}),B.dirty()}else if(E.kind==="ip"){if(!mB(D.data,E.version))$=this._getOrReturnCtx(D,$),K($,{validation:"ip",code:W.invalid_string,message:E.message}),B.dirty()}else if(E.kind==="jwt"){if(!pB(D.data,E.alg))$=this._getOrReturnCtx(D,$),K($,{validation:"jwt",code:W.invalid_string,message:E.message}),B.dirty()}else if(E.kind==="cidr"){if(!dB(D.data,E.version))$=this._getOrReturnCtx(D,$),K($,{validation:"cidr",code:W.invalid_string,message:E.message}),B.dirty()}else if(E.kind==="base64"){if(!yB.test(D.data))$=this._getOrReturnCtx(D,$),K($,{validation:"base64",code:W.invalid_string,message:E.message}),B.dirty()}else if(E.kind==="base64url"){if(!hB.test(D.data))$=this._getOrReturnCtx(D,$),K($,{validation:"base64url",code:W.invalid_string,message:E.message}),B.dirty()}else k.assertNever(E);return{status:B.value,value:D.data}}_regex(D,F,B){return this.refinement(($)=>D.test($),{validation:F,code:W.invalid_string,...M.errToObj(B)})}_addCheck(D){return new QD({...this._def,checks:[...this._def.checks,D]})}email(D){return this._addCheck({kind:"email",...M.errToObj(D)})}url(D){return this._addCheck({kind:"url",...M.errToObj(D)})}emoji(D){return this._addCheck({kind:"emoji",...M.errToObj(D)})}uuid(D){return this._addCheck({kind:"uuid",...M.errToObj(D)})}nanoid(D){return this._addCheck({kind:"nanoid",...M.errToObj(D)})}cuid(D){return this._addCheck({kind:"cuid",...M.errToObj(D)})}cuid2(D){return this._addCheck({kind:"cuid2",...M.errToObj(D)})}ulid(D){return this._addCheck({kind:"ulid",...M.errToObj(D)})}base64(D){return this._addCheck({kind:"base64",...M.errToObj(D)})}base64url(D){return this._addCheck({kind:"base64url",...M.errToObj(D)})}jwt(D){return this._addCheck({kind:"jwt",...M.errToObj(D)})}ip(D){return this._addCheck({kind:"ip",...M.errToObj(D)})}cidr(D){return this._addCheck({kind:"cidr",...M.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,...M.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,...M.errToObj(D?.message)})}duration(D){return this._addCheck({kind:"duration",...M.errToObj(D)})}regex(D,F){return this._addCheck({kind:"regex",regex:D,...M.errToObj(F)})}includes(D,F){return this._addCheck({kind:"includes",value:D,position:F?.position,...M.errToObj(F?.message)})}startsWith(D,F){return this._addCheck({kind:"startsWith",value:D,...M.errToObj(F)})}endsWith(D,F){return this._addCheck({kind:"endsWith",value:D,...M.errToObj(F)})}min(D,F){return this._addCheck({kind:"min",value:D,...M.errToObj(F)})}max(D,F){return this._addCheck({kind:"max",value:D,...M.errToObj(F)})}length(D,F){return this._addCheck({kind:"length",value:D,...M.errToObj(F)})}nonempty(D){return this.min(1,M.errToObj(D))}trim(){return new QD({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new QD({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new QD({...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}};QD.create=(D)=>{return new QD({checks:[],typeName:L.ZodString,coerce:D?.coerce??!1,...S(D)})};dD=class dD extends v{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)!==V.number){let E=this._getOrReturnCtx(D);return K(E,{code:W.invalid_type,expected:V.number,received:E.parsedType}),O}let B=void 0,$=new d;for(let E of this._def.checks)if(E.kind==="int"){if(!k.isInteger(D.data))B=this._getOrReturnCtx(D,B),K(B,{code:W.invalid_type,expected:"integer",received:"float",message:E.message}),$.dirty()}else if(E.kind==="min"){if(E.inclusive?D.data<E.value:D.data<=E.value)B=this._getOrReturnCtx(D,B),K(B,{code:W.too_small,minimum:E.value,type:"number",inclusive:E.inclusive,exact:!1,message:E.message}),$.dirty()}else if(E.kind==="max"){if(E.inclusive?D.data>E.value:D.data>=E.value)B=this._getOrReturnCtx(D,B),K(B,{code:W.too_big,maximum:E.value,type:"number",inclusive:E.inclusive,exact:!1,message:E.message}),$.dirty()}else if(E.kind==="multipleOf"){if(cB(D.data,E.value)!==0)B=this._getOrReturnCtx(D,B),K(B,{code:W.not_multiple_of,multipleOf:E.value,message:E.message}),$.dirty()}else if(E.kind==="finite"){if(!Number.isFinite(D.data))B=this._getOrReturnCtx(D,B),K(B,{code:W.not_finite,message:E.message}),$.dirty()}else k.assertNever(E);return{status:$.value,value:D.data}}gte(D,F){return this.setLimit("min",D,!0,M.toString(F))}gt(D,F){return this.setLimit("min",D,!1,M.toString(F))}lte(D,F){return this.setLimit("max",D,!0,M.toString(F))}lt(D,F){return this.setLimit("max",D,!1,M.toString(F))}setLimit(D,F,B,$){return new dD({...this._def,checks:[...this._def.checks,{kind:D,value:F,inclusive:B,message:M.toString($)}]})}_addCheck(D){return new dD({...this._def,checks:[...this._def.checks,D]})}int(D){return this._addCheck({kind:"int",message:M.toString(D)})}positive(D){return this._addCheck({kind:"min",value:0,inclusive:!1,message:M.toString(D)})}negative(D){return this._addCheck({kind:"max",value:0,inclusive:!1,message:M.toString(D)})}nonpositive(D){return this._addCheck({kind:"max",value:0,inclusive:!0,message:M.toString(D)})}nonnegative(D){return this._addCheck({kind:"min",value:0,inclusive:!0,message:M.toString(D)})}multipleOf(D,F){return this._addCheck({kind:"multipleOf",value:D,message:M.toString(F)})}finite(D){return this._addCheck({kind:"finite",message:M.toString(D)})}safe(D){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:M.toString(D)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:M.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"&&k.isInteger(D.value))}get isFinite(){let D=null,F=null;for(let B of this._def.checks)if(B.kind==="finite"||B.kind==="int"||B.kind==="multipleOf")return!0;else if(B.kind==="min"){if(F===null||B.value>F)F=B.value}else if(B.kind==="max"){if(D===null||B.value<D)D=B.value}return Number.isFinite(F)&&Number.isFinite(D)}};dD.create=(D)=>{return new dD({checks:[],typeName:L.ZodNumber,coerce:D?.coerce||!1,...S(D)})};cD=class cD extends v{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)!==V.bigint)return this._getInvalidInput(D);let B=void 0,$=new d;for(let E of this._def.checks)if(E.kind==="min"){if(E.inclusive?D.data<E.value:D.data<=E.value)B=this._getOrReturnCtx(D,B),K(B,{code:W.too_small,type:"bigint",minimum:E.value,inclusive:E.inclusive,message:E.message}),$.dirty()}else if(E.kind==="max"){if(E.inclusive?D.data>E.value:D.data>=E.value)B=this._getOrReturnCtx(D,B),K(B,{code:W.too_big,type:"bigint",maximum:E.value,inclusive:E.inclusive,message:E.message}),$.dirty()}else if(E.kind==="multipleOf"){if(D.data%E.value!==BigInt(0))B=this._getOrReturnCtx(D,B),K(B,{code:W.not_multiple_of,multipleOf:E.value,message:E.message}),$.dirty()}else k.assertNever(E);return{status:$.value,value:D.data}}_getInvalidInput(D){let F=this._getOrReturnCtx(D);return K(F,{code:W.invalid_type,expected:V.bigint,received:F.parsedType}),O}gte(D,F){return this.setLimit("min",D,!0,M.toString(F))}gt(D,F){return this.setLimit("min",D,!1,M.toString(F))}lte(D,F){return this.setLimit("max",D,!0,M.toString(F))}lt(D,F){return this.setLimit("max",D,!1,M.toString(F))}setLimit(D,F,B,$){return new cD({...this._def,checks:[...this._def.checks,{kind:D,value:F,inclusive:B,message:M.toString($)}]})}_addCheck(D){return new cD({...this._def,checks:[...this._def.checks,D]})}positive(D){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:M.toString(D)})}negative(D){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:M.toString(D)})}nonpositive(D){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:M.toString(D)})}nonnegative(D){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:M.toString(D)})}multipleOf(D,F){return this._addCheck({kind:"multipleOf",value:D,message:M.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}};cD.create=(D)=>{return new cD({checks:[],typeName:L.ZodBigInt,coerce:D?.coerce??!1,...S(D)})};w2=class w2 extends v{_parse(D){if(this._def.coerce)D.data=Boolean(D.data);if(this._getType(D)!==V.boolean){let B=this._getOrReturnCtx(D);return K(B,{code:W.invalid_type,expected:V.boolean,received:B.parsedType}),O}return r(D.data)}};w2.create=(D)=>{return new w2({typeName:L.ZodBoolean,coerce:D?.coerce||!1,...S(D)})};D2=class D2 extends v{_parse(D){if(this._def.coerce)D.data=new Date(D.data);if(this._getType(D)!==V.date){let E=this._getOrReturnCtx(D);return K(E,{code:W.invalid_type,expected:V.date,received:E.parsedType}),O}if(Number.isNaN(D.data.getTime())){let E=this._getOrReturnCtx(D);return K(E,{code:W.invalid_date}),O}let B=new d,$=void 0;for(let E of this._def.checks)if(E.kind==="min"){if(D.data.getTime()<E.value)$=this._getOrReturnCtx(D,$),K($,{code:W.too_small,message:E.message,inclusive:!0,exact:!1,minimum:E.value,type:"date"}),B.dirty()}else if(E.kind==="max"){if(D.data.getTime()>E.value)$=this._getOrReturnCtx(D,$),K($,{code:W.too_big,message:E.message,inclusive:!0,exact:!1,maximum:E.value,type:"date"}),B.dirty()}else k.assertNever(E);return{status:B.value,value:new Date(D.data.getTime())}}_addCheck(D){return new D2({...this._def,checks:[...this._def.checks,D]})}min(D,F){return this._addCheck({kind:"min",value:D.getTime(),message:M.toString(F)})}max(D,F){return this._addCheck({kind:"max",value:D.getTime(),message:M.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}};D2.create=(D)=>{return new D2({checks:[],coerce:D?.coerce||!1,typeName:L.ZodDate,...S(D)})};A0=class A0 extends v{_parse(D){if(this._getType(D)!==V.symbol){let B=this._getOrReturnCtx(D);return K(B,{code:W.invalid_type,expected:V.symbol,received:B.parsedType}),O}return r(D.data)}};A0.create=(D)=>{return new A0({typeName:L.ZodSymbol,...S(D)})};u2=class u2 extends v{_parse(D){if(this._getType(D)!==V.undefined){let B=this._getOrReturnCtx(D);return K(B,{code:W.invalid_type,expected:V.undefined,received:B.parsedType}),O}return r(D.data)}};u2.create=(D)=>{return new u2({typeName:L.ZodUndefined,...S(D)})};f2=class f2 extends v{_parse(D){if(this._getType(D)!==V.null){let B=this._getOrReturnCtx(D);return K(B,{code:W.invalid_type,expected:V.null,received:B.parsedType}),O}return r(D.data)}};f2.create=(D)=>{return new f2({typeName:L.ZodNull,...S(D)})};F2=class F2 extends v{constructor(){super(...arguments);this._any=!0}_parse(D){return r(D.data)}};F2.create=(D)=>{return new F2({typeName:L.ZodAny,...S(D)})};pD=class pD extends v{constructor(){super(...arguments);this._unknown=!0}_parse(D){return r(D.data)}};pD.create=(D)=>{return new pD({typeName:L.ZodUnknown,...S(D)})};CD=class CD extends v{_parse(D){let F=this._getOrReturnCtx(D);return K(F,{code:W.invalid_type,expected:V.never,received:F.parsedType}),O}};CD.create=(D)=>{return new CD({typeName:L.ZodNever,...S(D)})};z0=class z0 extends v{_parse(D){if(this._getType(D)!==V.undefined){let B=this._getOrReturnCtx(D);return K(B,{code:W.invalid_type,expected:V.void,received:B.parsedType}),O}return r(D.data)}};z0.create=(D)=>{return new z0({typeName:L.ZodVoid,...S(D)})};qD=class qD extends v{_parse(D){let{ctx:F,status:B}=this._processInputParams(D),$=this._def;if(F.parsedType!==V.array)return K(F,{code:W.invalid_type,expected:V.array,received:F.parsedType}),O;if($.exactLength!==null){let J=F.data.length>$.exactLength.value,X=F.data.length<$.exactLength.value;if(J||X)K(F,{code:J?W.too_big:W.too_small,minimum:X?$.exactLength.value:void 0,maximum:J?$.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:$.exactLength.message}),B.dirty()}if($.minLength!==null){if(F.data.length<$.minLength.value)K(F,{code:W.too_small,minimum:$.minLength.value,type:"array",inclusive:!0,exact:!1,message:$.minLength.message}),B.dirty()}if($.maxLength!==null){if(F.data.length>$.maxLength.value)K(F,{code:W.too_big,maximum:$.maxLength.value,type:"array",inclusive:!0,exact:!1,message:$.maxLength.message}),B.dirty()}if(F.common.async)return Promise.all([...F.data].map((J,X)=>{return $.type._parseAsync(new GD(F,J,F.path,X))})).then((J)=>{return d.mergeArray(B,J)});let E=[...F.data].map((J,X)=>{return $.type._parseSync(new GD(F,J,F.path,X))});return d.mergeArray(B,E)}get element(){return this._def.type}min(D,F){return new qD({...this._def,minLength:{value:D,message:M.toString(F)}})}max(D,F){return new qD({...this._def,maxLength:{value:D,message:M.toString(F)}})}length(D,F){return new qD({...this._def,exactLength:{value:D,message:M.toString(F)}})}nonempty(D){return this.min(1,D)}};qD.create=(D,F)=>{return new qD({type:D,minLength:null,maxLength:null,exactLength:null,typeName:L.ZodArray,...S(F)})};y=class y extends v{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=k.objectKeys(D);return this._cached={shape:D,keys:F},this._cached}_parse(D){if(this._getType(D)!==V.object){let Q=this._getOrReturnCtx(D);return K(Q,{code:W.invalid_type,expected:V.object,received:Q.parsedType}),O}let{status:B,ctx:$}=this._processInputParams(D),{shape:E,keys:J}=this._getCached(),X=[];if(!(this._def.catchall instanceof CD&&this._def.unknownKeys==="strip")){for(let Q in $.data)if(!J.includes(Q))X.push(Q)}let Y=[];for(let Q of J){let q=E[Q],H=$.data[Q];Y.push({key:{status:"valid",value:Q},value:q._parse(new GD($,H,$.path,Q)),alwaysSet:Q in $.data})}if(this._def.catchall instanceof CD){let Q=this._def.unknownKeys;if(Q==="passthrough")for(let q of X)Y.push({key:{status:"valid",value:q},value:{status:"valid",value:$.data[q]}});else if(Q==="strict"){if(X.length>0)K($,{code:W.unrecognized_keys,keys:X}),B.dirty()}else if(Q==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let Q=this._def.catchall;for(let q of X){let H=$.data[q];Y.push({key:{status:"valid",value:q},value:Q._parse(new GD($,H,$.path,q)),alwaysSet:q in $.data})}}if($.common.async)return Promise.resolve().then(async()=>{let Q=[];for(let q of Y){let H=await q.key,G=await q.value;Q.push({key:H,value:G,alwaysSet:q.alwaysSet})}return Q}).then((Q)=>{return d.mergeObjectSync(B,Q)});else return d.mergeObjectSync(B,Y)}get shape(){return this._def.shape()}strict(D){return M.errToObj,new y({...this._def,unknownKeys:"strict",...D!==void 0?{errorMap:(F,B)=>{let $=this._def.errorMap?.(F,B).message??B.defaultError;if(F.code==="unrecognized_keys")return{message:M.errToObj(D).message??$};return{message:$}}}:{}})}strip(){return new y({...this._def,unknownKeys:"strip"})}passthrough(){return new y({...this._def,unknownKeys:"passthrough"})}extend(D){return new y({...this._def,shape:()=>({...this._def.shape(),...D})})}merge(D){return new y({unknownKeys:D._def.unknownKeys,catchall:D._def.catchall,shape:()=>({...this._def.shape(),...D._def.shape()}),typeName:L.ZodObject})}setKey(D,F){return this.augment({[D]:F})}catchall(D){return new y({...this._def,catchall:D})}pick(D){let F={};for(let B of k.objectKeys(D))if(D[B]&&this.shape[B])F[B]=this.shape[B];return new y({...this._def,shape:()=>F})}omit(D){let F={};for(let B of k.objectKeys(this.shape))if(!D[B])F[B]=this.shape[B];return new y({...this._def,shape:()=>F})}deepPartial(){return k2(this)}partial(D){let F={};for(let B of k.objectKeys(this.shape)){let $=this.shape[B];if(D&&!D[B])F[B]=$;else F[B]=$.optional()}return new y({...this._def,shape:()=>F})}required(D){let F={};for(let B of k.objectKeys(this.shape))if(D&&!D[B])F[B]=this.shape[B];else{let E=this.shape[B];while(E instanceof HD)E=E._def.innerType;F[B]=E}return new y({...this._def,shape:()=>F})}keyof(){return D5(k.objectKeys(this.shape))}};y.create=(D,F)=>{return new y({shape:()=>D,unknownKeys:"strip",catchall:CD.create(),typeName:L.ZodObject,...S(F)})};y.strictCreate=(D,F)=>{return new y({shape:()=>D,unknownKeys:"strict",catchall:CD.create(),typeName:L.ZodObject,...S(F)})};y.lazycreate=(D,F)=>{return new y({shape:D,unknownKeys:"strip",catchall:CD.create(),typeName:L.ZodObject,...S(F)})};x2=class x2 extends v{_parse(D){let{ctx:F}=this._processInputParams(D),B=this._def.options;function $(E){for(let X of E)if(X.result.status==="valid")return X.result;for(let X of E)if(X.result.status==="dirty")return F.common.issues.push(...X.ctx.common.issues),X.result;let J=E.map((X)=>new e(X.ctx.common.issues));return K(F,{code:W.invalid_union,unionErrors:J}),O}if(F.common.async)return Promise.all(B.map(async(E)=>{let J={...F,common:{...F.common,issues:[]},parent:null};return{result:await E._parseAsync({data:F.data,path:F.path,parent:J}),ctx:J}})).then($);else{let E=void 0,J=[];for(let Y of B){let Q={...F,common:{...F.common,issues:[]},parent:null},q=Y._parseSync({data:F.data,path:F.path,parent:Q});if(q.status==="valid")return q;else if(q.status==="dirty"&&!E)E={result:q,ctx:Q};if(Q.common.issues.length)J.push(Q.common.issues)}if(E)return F.common.issues.push(...E.ctx.common.issues),E.result;let X=J.map((Y)=>new e(Y));return K(F,{code:W.invalid_union,unionErrors:X}),O}}get options(){return this._def.options}};x2.create=(D,F)=>{return new x2({options:D,typeName:L.ZodUnion,...S(F)})};L3=class L3 extends v{_parse(D){let{ctx:F}=this._processInputParams(D);if(F.parsedType!==V.object)return K(F,{code:W.invalid_type,expected:V.object,received:F.parsedType}),O;let B=this.discriminator,$=F.data[B],E=this.optionsMap.get($);if(!E)return K(F,{code:W.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[B]}),O;if(F.common.async)return E._parseAsync({data:F.data,path:F.path,parent:F});else return E._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,B){let $=new Map;for(let E of F){let J=ID(E.shape[D]);if(!J.length)throw Error(`A discriminator value for key \`${D}\` could not be extracted from all schema options`);for(let X of J){if($.has(X))throw Error(`Discriminator property ${String(D)} has duplicate value ${String(X)}`);$.set(X,E)}}return new L3({typeName:L.ZodDiscriminatedUnion,discriminator:D,options:F,optionsMap:$,...S(B)})}};y2=class y2 extends v{_parse(D){let{status:F,ctx:B}=this._processInputParams(D),$=(E,J)=>{if(C3(E)||C3(J))return O;let X=y8(E.value,J.value);if(!X.valid)return K(B,{code:W.invalid_intersection_types}),O;if(O3(E)||O3(J))F.dirty();return{status:F.value,value:X.data}};if(B.common.async)return Promise.all([this._def.left._parseAsync({data:B.data,path:B.path,parent:B}),this._def.right._parseAsync({data:B.data,path:B.path,parent:B})]).then(([E,J])=>$(E,J));else return $(this._def.left._parseSync({data:B.data,path:B.path,parent:B}),this._def.right._parseSync({data:B.data,path:B.path,parent:B}))}};y2.create=(D,F,B)=>{return new y2({left:D,right:F,typeName:L.ZodIntersection,...S(B)})};OD=class OD extends v{_parse(D){let{status:F,ctx:B}=this._processInputParams(D);if(B.parsedType!==V.array)return K(B,{code:W.invalid_type,expected:V.array,received:B.parsedType}),O;if(B.data.length<this._def.items.length)return K(B,{code:W.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),O;if(!this._def.rest&&B.data.length>this._def.items.length)K(B,{code:W.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),F.dirty();let E=[...B.data].map((J,X)=>{let Y=this._def.items[X]||this._def.rest;if(!Y)return null;return Y._parse(new GD(B,J,B.path,X))}).filter((J)=>!!J);if(B.common.async)return Promise.all(E).then((J)=>{return d.mergeArray(F,J)});else return d.mergeArray(F,E)}get items(){return this._def.items}rest(D){return new OD({...this._def,rest:D})}};OD.create=(D,F)=>{if(!Array.isArray(D))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new OD({items:D,typeName:L.ZodTuple,rest:null,...S(F)})};M0=class M0 extends v{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(D){let{status:F,ctx:B}=this._processInputParams(D);if(B.parsedType!==V.object)return K(B,{code:W.invalid_type,expected:V.object,received:B.parsedType}),O;let $=[],E=this._def.keyType,J=this._def.valueType;for(let X in B.data)$.push({key:E._parse(new GD(B,X,B.path,X)),value:J._parse(new GD(B,B.data[X],B.path,X)),alwaysSet:X in B.data});if(B.common.async)return d.mergeObjectAsync(F,$);else return d.mergeObjectSync(F,$)}get element(){return this._def.valueType}static create(D,F,B){if(F instanceof v)return new M0({keyType:D,valueType:F,typeName:L.ZodRecord,...S(B)});return new M0({keyType:QD.create(),valueType:D,typeName:L.ZodRecord,...S(F)})}};R0=class R0 extends v{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(D){let{status:F,ctx:B}=this._processInputParams(D);if(B.parsedType!==V.map)return K(B,{code:W.invalid_type,expected:V.map,received:B.parsedType}),O;let $=this._def.keyType,E=this._def.valueType,J=[...B.data.entries()].map(([X,Y],Q)=>{return{key:$._parse(new GD(B,X,B.path,[Q,"key"])),value:E._parse(new GD(B,Y,B.path,[Q,"value"]))}});if(B.common.async){let X=new Map;return Promise.resolve().then(async()=>{for(let Y of J){let Q=await Y.key,q=await Y.value;if(Q.status==="aborted"||q.status==="aborted")return O;if(Q.status==="dirty"||q.status==="dirty")F.dirty();X.set(Q.value,q.value)}return{status:F.value,value:X}})}else{let X=new Map;for(let Y of J){let{key:Q,value:q}=Y;if(Q.status==="aborted"||q.status==="aborted")return O;if(Q.status==="dirty"||q.status==="dirty")F.dirty();X.set(Q.value,q.value)}return{status:F.value,value:X}}}};R0.create=(D,F,B)=>{return new R0({valueType:F,keyType:D,typeName:L.ZodMap,...S(B)})};B2=class B2 extends v{_parse(D){let{status:F,ctx:B}=this._processInputParams(D);if(B.parsedType!==V.set)return K(B,{code:W.invalid_type,expected:V.set,received:B.parsedType}),O;let $=this._def;if($.minSize!==null){if(B.data.size<$.minSize.value)K(B,{code:W.too_small,minimum:$.minSize.value,type:"set",inclusive:!0,exact:!1,message:$.minSize.message}),F.dirty()}if($.maxSize!==null){if(B.data.size>$.maxSize.value)K(B,{code:W.too_big,maximum:$.maxSize.value,type:"set",inclusive:!0,exact:!1,message:$.maxSize.message}),F.dirty()}let E=this._def.valueType;function J(Y){let Q=new Set;for(let q of Y){if(q.status==="aborted")return O;if(q.status==="dirty")F.dirty();Q.add(q.value)}return{status:F.value,value:Q}}let X=[...B.data.values()].map((Y,Q)=>E._parse(new GD(B,Y,B.path,Q)));if(B.common.async)return Promise.all(X).then((Y)=>J(Y));else return J(X)}min(D,F){return new B2({...this._def,minSize:{value:D,message:M.toString(F)}})}max(D,F){return new B2({...this._def,maxSize:{value:D,message:M.toString(F)}})}size(D,F){return this.min(D,F).max(D,F)}nonempty(D){return this.min(1,D)}};B2.create=(D,F)=>{return new B2({valueType:D,minSize:null,maxSize:null,typeName:L.ZodSet,...S(F)})};P2=class P2 extends v{constructor(){super(...arguments);this.validate=this.implement}_parse(D){let{ctx:F}=this._processInputParams(D);if(F.parsedType!==V.function)return K(F,{code:W.invalid_type,expected:V.function,received:F.parsedType}),O;function B(X,Y){return K0({data:X,path:F.path,errorMaps:[F.common.contextualErrorMap,F.schemaErrorMap,I2(),bD].filter((Q)=>!!Q),issueData:{code:W.invalid_arguments,argumentsError:Y}})}function $(X,Y){return K0({data:X,path:F.path,errorMaps:[F.common.contextualErrorMap,F.schemaErrorMap,I2(),bD].filter((Q)=>!!Q),issueData:{code:W.invalid_return_type,returnTypeError:Y}})}let E={errorMap:F.common.contextualErrorMap},J=F.data;if(this._def.returns instanceof $2){let X=this;return r(async function(...Y){let Q=new e([]),q=await X._def.args.parseAsync(Y,E).catch((U)=>{throw Q.addIssue(B(Y,U)),Q}),H=await Reflect.apply(J,this,q);return await X._def.returns._def.type.parseAsync(H,E).catch((U)=>{throw Q.addIssue($(H,U)),Q})})}else{let X=this;return r(function(...Y){let Q=X._def.args.safeParse(Y,E);if(!Q.success)throw new e([B(Y,Q.error)]);let q=Reflect.apply(J,this,Q.data),H=X._def.returns.safeParse(q,E);if(!H.success)throw new e([$(q,H.error)]);return H.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...D){return new P2({...this._def,args:OD.create(D).rest(pD.create())})}returns(D){return new P2({...this._def,returns:D})}implement(D){return this.parse(D)}strictImplement(D){return this.parse(D)}static create(D,F,B){return new P2({args:D?D:OD.create([]).rest(pD.create()),returns:F||pD.create(),typeName:L.ZodFunction,...S(B)})}};h2=class h2 extends v{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})}};h2.create=(D,F)=>{return new h2({getter:D,typeName:L.ZodLazy,...S(F)})};g2=class g2 extends v{_parse(D){if(D.data!==this._def.value){let F=this._getOrReturnCtx(D);return K(F,{received:F.data,code:W.invalid_literal,expected:this._def.value}),O}return{status:"valid",value:D.data}}get value(){return this._def.value}};g2.create=(D,F)=>{return new g2({value:D,typeName:L.ZodLiteral,...S(F)})};iD=class iD extends v{_parse(D){if(typeof D.data!=="string"){let F=this._getOrReturnCtx(D),B=this._def.values;return K(F,{expected:k.joinValues(B),received:F.parsedType,code:W.invalid_type}),O}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(D.data)){let F=this._getOrReturnCtx(D),B=this._def.values;return K(F,{received:F.data,code:W.invalid_enum_value,options:B}),O}return r(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 iD.create(D,{...this._def,...F})}exclude(D,F=this._def){return iD.create(this.options.filter((B)=>!D.includes(B)),{...this._def,...F})}};iD.create=D5;l2=class l2 extends v{_parse(D){let F=k.getValidEnumValues(this._def.values),B=this._getOrReturnCtx(D);if(B.parsedType!==V.string&&B.parsedType!==V.number){let $=k.objectValues(F);return K(B,{expected:k.joinValues($),received:B.parsedType,code:W.invalid_type}),O}if(!this._cache)this._cache=new Set(k.getValidEnumValues(this._def.values));if(!this._cache.has(D.data)){let $=k.objectValues(F);return K(B,{received:B.data,code:W.invalid_enum_value,options:$}),O}return r(D.data)}get enum(){return this._def.values}};l2.create=(D,F)=>{return new l2({values:D,typeName:L.ZodNativeEnum,...S(F)})};$2=class $2 extends v{unwrap(){return this._def.type}_parse(D){let{ctx:F}=this._processInputParams(D);if(F.parsedType!==V.promise&&F.common.async===!1)return K(F,{code:W.invalid_type,expected:V.promise,received:F.parsedType}),O;let B=F.parsedType===V.promise?F.data:Promise.resolve(F.data);return r(B.then(($)=>{return this._def.type.parseAsync($,{path:F.path,errorMap:F.common.contextualErrorMap})}))}};$2.create=(D,F)=>{return new $2({type:D,typeName:L.ZodPromise,...S(F)})};WD=class WD extends v{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===L.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(D){let{status:F,ctx:B}=this._processInputParams(D),$=this._def.effect||null,E={addIssue:(J)=>{if(K(B,J),J.fatal)F.abort();else F.dirty()},get path(){return B.path}};if(E.addIssue=E.addIssue.bind(E),$.type==="preprocess"){let J=$.transform(B.data,E);if(B.common.async)return Promise.resolve(J).then(async(X)=>{if(F.value==="aborted")return O;let Y=await this._def.schema._parseAsync({data:X,path:B.path,parent:B});if(Y.status==="aborted")return O;if(Y.status==="dirty")return eD(Y.value);if(F.value==="dirty")return eD(Y.value);return Y});else{if(F.value==="aborted")return O;let X=this._def.schema._parseSync({data:J,path:B.path,parent:B});if(X.status==="aborted")return O;if(X.status==="dirty")return eD(X.value);if(F.value==="dirty")return eD(X.value);return X}}if($.type==="refinement"){let J=(X)=>{let Y=$.refinement(X,E);if(B.common.async)return Promise.resolve(Y);if(Y instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return X};if(B.common.async===!1){let X=this._def.schema._parseSync({data:B.data,path:B.path,parent:B});if(X.status==="aborted")return O;if(X.status==="dirty")F.dirty();return J(X.value),{status:F.value,value:X.value}}else return this._def.schema._parseAsync({data:B.data,path:B.path,parent:B}).then((X)=>{if(X.status==="aborted")return O;if(X.status==="dirty")F.dirty();return J(X.value).then(()=>{return{status:F.value,value:X.value}})})}if($.type==="transform")if(B.common.async===!1){let J=this._def.schema._parseSync({data:B.data,path:B.path,parent:B});if(!mD(J))return O;let X=$.transform(J.value,E);if(X instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:F.value,value:X}}else return this._def.schema._parseAsync({data:B.data,path:B.path,parent:B}).then((J)=>{if(!mD(J))return O;return Promise.resolve($.transform(J.value,E)).then((X)=>({status:F.value,value:X}))});k.assertNever($)}};WD.create=(D,F,B)=>{return new WD({schema:D,typeName:L.ZodEffects,effect:F,...S(B)})};WD.createWithPreprocess=(D,F,B)=>{return new WD({schema:F,effect:{type:"preprocess",transform:D},typeName:L.ZodEffects,...S(B)})};HD=class HD extends v{_parse(D){if(this._getType(D)===V.undefined)return r(void 0);return this._def.innerType._parse(D)}unwrap(){return this._def.innerType}};HD.create=(D,F)=>{return new HD({innerType:D,typeName:L.ZodOptional,...S(F)})};vD=class vD extends v{_parse(D){if(this._getType(D)===V.null)return r(null);return this._def.innerType._parse(D)}unwrap(){return this._def.innerType}};vD.create=(D,F)=>{return new vD({innerType:D,typeName:L.ZodNullable,...S(F)})};m2=class m2 extends v{_parse(D){let{ctx:F}=this._processInputParams(D),B=F.data;if(F.parsedType===V.undefined)B=this._def.defaultValue();return this._def.innerType._parse({data:B,path:F.path,parent:F})}removeDefault(){return this._def.innerType}};m2.create=(D,F)=>{return new m2({innerType:D,typeName:L.ZodDefault,defaultValue:typeof F.default==="function"?F.default:()=>F.default,...S(F)})};p2=class p2 extends v{_parse(D){let{ctx:F}=this._processInputParams(D),B={...F,common:{...F.common,issues:[]}},$=this._def.innerType._parse({data:B.data,path:B.path,parent:{...B}});if(v2($))return $.then((E)=>{return{status:"valid",value:E.status==="valid"?E.value:this._def.catchValue({get error(){return new e(B.common.issues)},input:B.data})}});else return{status:"valid",value:$.status==="valid"?$.value:this._def.catchValue({get error(){return new e(B.common.issues)},input:B.data})}}removeCatch(){return this._def.innerType}};p2.create=(D,F)=>{return new p2({innerType:D,typeName:L.ZodCatch,catchValue:typeof F.catch==="function"?F.catch:()=>F.catch,...S(F)})};C0=class C0 extends v{_parse(D){if(this._getType(D)!==V.nan){let B=this._getOrReturnCtx(D);return K(B,{code:W.invalid_type,expected:V.nan,received:B.parsedType}),O}return{status:"valid",value:D.data}}};C0.create=(D)=>{return new C0({typeName:L.ZodNaN,...S(D)})};iB=Symbol("zod_brand");j3=class j3 extends v{_parse(D){let{ctx:F}=this._processInputParams(D),B=F.data;return this._def.type._parse({data:B,path:F.path,parent:F})}unwrap(){return this._def.type}};O0=class O0 extends v{_parse(D){let{status:F,ctx:B}=this._processInputParams(D);if(B.common.async)return(async()=>{let E=await this._def.in._parseAsync({data:B.data,path:B.path,parent:B});if(E.status==="aborted")return O;if(E.status==="dirty")return F.dirty(),eD(E.value);else return this._def.out._parseAsync({data:E.value,path:B.path,parent:B})})();else{let $=this._def.in._parseSync({data:B.data,path:B.path,parent:B});if($.status==="aborted")return O;if($.status==="dirty")return F.dirty(),{status:"dirty",value:$.value};else return this._def.out._parseSync({data:$.value,path:B.path,parent:B})}}static create(D,F){return new O0({in:D,out:F,typeName:L.ZodPipeline})}};d2=class d2 extends v{_parse(D){let F=this._def.innerType._parse(D),B=($)=>{if(mD($))$.value=Object.freeze($.value);return $};return v2(F)?F.then(($)=>B($)):B(F)}unwrap(){return this._def.innerType}};d2.create=(D,F)=>{return new d2({innerType:D,typeName:L.ZodReadonly,...S(F)})};nB={object:y.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"})(L||(L={}));B5=QD.create,$5=dD.create,oB=C0.create,sB=cD.create,E5=w2.create,aB=D2.create,tB=A0.create,eB=u2.create,D$=f2.create,F$=F2.create,B$=pD.create,$$=CD.create,E$=z0.create,J$=qD.create,X$=y.create,Y$=y.strictCreate,Q$=x2.create,q$=L3.create,H$=y2.create,G$=OD.create,W$=M0.create,U$=R0.create,V$=B2.create,_$=P2.create,K$=h2.create,A$=g2.create,z$=iD.create,M$=l2.create,R$=$2.create,C$=WD.create,O$=HD.create,L$=vD.create,j$=WD.createWithPreprocess,S$=O0.create,b$={string:(D)=>QD.create({...D,coerce:!0}),number:(D)=>dD.create({...D,coerce:!0}),boolean:(D)=>w2.create({...D,coerce:!0}),bigint:(D)=>cD.create({...D,coerce:!0}),date:(D)=>D2.create({...D,coerce:!0})},I$=O});var _={};t(_,{void:()=>E$,util:()=>k,unknown:()=>B$,union:()=>Q$,undefined:()=>eB,tuple:()=>G$,transformer:()=>C$,symbol:()=>tB,string:()=>B5,strictObject:()=>Y$,setErrorMap:()=>LB,set:()=>V$,record:()=>W$,quotelessJson:()=>CB,promise:()=>R$,preprocess:()=>j$,pipeline:()=>S$,ostring:()=>T$,optional:()=>O$,onumber:()=>Z$,oboolean:()=>N$,objectUtil:()=>w8,object:()=>X$,number:()=>$5,nullable:()=>L$,null:()=>D$,never:()=>$$,nativeEnum:()=>M$,nan:()=>oB,map:()=>U$,makeIssue:()=>K0,literal:()=>A$,lazy:()=>K$,late:()=>nB,isValid:()=>mD,isDirty:()=>O3,isAsync:()=>v2,isAborted:()=>C3,intersection:()=>H$,instanceof:()=>rB,getParsedType:()=>RD,getErrorMap:()=>I2,function:()=>_$,enum:()=>z$,effect:()=>C$,discriminatedUnion:()=>q$,defaultErrorMap:()=>bD,datetimeRegex:()=>e1,date:()=>aB,custom:()=>F5,coerce:()=>b$,boolean:()=>E5,bigint:()=>sB,array:()=>J$,any:()=>F$,addIssueToContext:()=>K,ZodVoid:()=>z0,ZodUnknown:()=>pD,ZodUnion:()=>x2,ZodUndefined:()=>u2,ZodType:()=>v,ZodTuple:()=>OD,ZodTransformer:()=>WD,ZodSymbol:()=>A0,ZodString:()=>QD,ZodSet:()=>B2,ZodSchema:()=>v,ZodRecord:()=>M0,ZodReadonly:()=>d2,ZodPromise:()=>$2,ZodPipeline:()=>O0,ZodParsedType:()=>V,ZodOptional:()=>HD,ZodObject:()=>y,ZodNumber:()=>dD,ZodNullable:()=>vD,ZodNull:()=>f2,ZodNever:()=>CD,ZodNativeEnum:()=>l2,ZodNaN:()=>C0,ZodMap:()=>R0,ZodLiteral:()=>g2,ZodLazy:()=>h2,ZodIssueCode:()=>W,ZodIntersection:()=>y2,ZodFunction:()=>P2,ZodFirstPartyTypeKind:()=>L,ZodError:()=>e,ZodEnum:()=>iD,ZodEffects:()=>WD,ZodDiscriminatedUnion:()=>L3,ZodDefault:()=>m2,ZodDate:()=>D2,ZodCatch:()=>p2,ZodBranded:()=>j3,ZodBoolean:()=>w2,ZodBigInt:()=>cD,ZodArray:()=>qD,ZodAny:()=>F2,Schema:()=>v,ParseStatus:()=>d,OK:()=>r,NEVER:()=>I$,INVALID:()=>O,EMPTY_PATH:()=>jB,DIRTY:()=>eD,BRAND:()=>iB});var h8=Z(()=>{R3();f8();n1();_0();J5();M3()});var S3=Z(()=>{h8();h8()});var v$,k$,P$,w$,u$,f$,x$,y$,kD;var X5=Z(()=>{S3();v$=_.object({name:_.string().default("genie"),defaultWindow:_.string().default("shell"),autoCreate:_.boolean().default(!0)}),k$=_.object({execTimeout:_.number().default(120000),readLines:_.number().default(100),worktreeBase:_.string().default(".worktrees")}),P$=_.object({tmuxDebug:_.boolean().default(!1),verbose:_.boolean().default(!1)}),w$=_.object({preference:_.enum(["auto","zsh","bash","fish"]).default("auto")}),u$=_.object({tmuxInstalled:_.boolean().default(!1),shellInstalled:_.boolean().default(!1)}),f$=_.object({configured:_.boolean().default(!1)}),x$=_.object({launcher:_.preprocess((D)=>D==="claudio"?"claude":D,_.literal("claude")),claudeArgs:_.array(_.string())}).passthrough(),y$=_.object({left:_.string(),right:_.string(),skill:_.string().default("council")}),kD=_.object({version:_.number().default(2),session:v$.default({}),terminal:k$.default({}),logging:P$.default({}),shell:w$.default({}),shortcuts:u$.default({}),codex:f$.optional(),installMethod:_.enum(["source","npm","bun"]).optional(),updateChannel:_.enum(["latest","next"]).default("latest"),setupComplete:_.boolean().default(!1),lastSetupAt:_.string().optional(),sourcePath:_.string().optional(),workerProfiles:_.record(_.string(),x$).optional(),defaultWorkerProfile:_.string().optional(),councilPresets:_.record(_.string(),y$).optional(),defaultCouncilPreset:_.string().optional(),promptMode:_.enum(["append","system"]).default("append"),autoMergeDev:_.boolean().default(!1)})});import{existsSync as Z3,mkdirSync as h$,readFileSync as Y5,writeFileSync as g$}from"fs";import{homedir as Q5}from"os";import{join as q5}from"path";function H5(){return T3}function L0(){return E2}function J2(){return Z3(E2)}function l$(){if(!Z3(T3))h$(T3,{recursive:!0})}async function ED(){if(!Z3(E2))return kD.parse({});try{let D=Y5(E2,"utf-8"),F=JSON.parse(D);return kD.parse(F)}catch(D){let F=D instanceof Error?D.message:String(D);return console.warn(`Warning: Invalid genie config, using defaults: ${F}`),kD.parse({})}}async function LD(D){l$();try{let F=kD.parse(D),B=JSON.stringify(F,null,2);g$(E2,B,"utf-8")}catch(F){let B=F instanceof Error?F.message:String(F);throw Error(`Failed to save genie config: ${B}`)}}function m$(){return kD.parse({})}function c2(){if(!Z3(E2))return kD.parse({});try{let D=Y5(E2,"utf-8"),F=JSON.parse(D);return kD.parse(F)}catch{return kD.parse({})}}function JD(D){let F=Q5();if(D.startsWith(`${F}/`))return`~${D.slice(F.length)}`;if(D===F)return"~";return D}function G5(){return c2().terminal}function W5(){if(!J2())return!1;return c2().setupComplete??!1}async function U5(){let D=await ED();D.setupComplete=!0,D.lastSetupAt=new Date().toISOString(),await LD(D)}async function V5(){let D=m$();await LD(D)}async function _5(D){let F=await ED();F.shortcuts={...F.shortcuts,...D},await LD(F)}var T3,E2;var PD=Z(()=>{X5();T3=q5(Q5(),".genie"),E2=q5(T3,"config.json")});var v3=l((IG,C5)=>{var DE=P("tty"),FE=DE?.WriteStream?.prototype?.hasColors?.()??!1,N=(D,F)=>{if(!FE)return(E)=>E;let B=`\x1B[${D}m`,$=`\x1B[${F}m`;return(E)=>{let J=E+"",X=J.indexOf($);if(X===-1)return B+J+$;let Y=B,Q=0,H=(F===22?$:"")+B;while(X!==-1)Y+=J.slice(Q,X)+H,Q=X+$.length,X=J.indexOf($,Q);return Y+=J.slice(Q)+$,Y}},T={};T.reset=N(0,0);T.bold=N(1,22);T.dim=N(2,22);T.italic=N(3,23);T.underline=N(4,24);T.overline=N(53,55);T.inverse=N(7,27);T.hidden=N(8,28);T.strikethrough=N(9,29);T.black=N(30,39);T.red=N(31,39);T.green=N(32,39);T.yellow=N(33,39);T.blue=N(34,39);T.magenta=N(35,39);T.cyan=N(36,39);T.white=N(37,39);T.gray=N(90,39);T.bgBlack=N(40,49);T.bgRed=N(41,49);T.bgGreen=N(42,49);T.bgYellow=N(43,49);T.bgBlue=N(44,49);T.bgMagenta=N(45,49);T.bgCyan=N(46,49);T.bgWhite=N(47,49);T.bgGray=N(100,49);T.redBright=N(91,39);T.greenBright=N(92,39);T.yellowBright=N(93,39);T.blueBright=N(94,39);T.magentaBright=N(95,39);T.cyanBright=N(96,39);T.whiteBright=N(97,39);T.bgRedBright=N(101,49);T.bgGreenBright=N(102,49);T.bgYellowBright=N(103,49);T.bgBlueBright=N(104,49);T.bgMagentaBright=N(105,49);T.bgCyanBright=N(106,49);T.bgWhiteBright=N(107,49);C5.exports=T});var N5=l((sG,Z5)=>{Z5.exports=qE;function QE(D){let F={defaultWidth:0,output:process.stdout,tty:P("tty")};if(!D)return F;return Object.keys(F).forEach(function(B){if(!D[B])D[B]=F[B]}),D}function qE(D){let F=QE(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 B=parseInt(process.env.CLI_WIDTH,10);if(!isNaN(B)&&B!==0)return B}return F.defaultWidth}});var I5=l((aG,b5)=>{b5.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 n8=l((tG,v5)=>{var HE=I5();v5.exports=(D)=>typeof D==="string"?D.replace(HE(),""):D});var P5=l((eG,r8)=>{var k5=(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};r8.exports=k5;r8.exports.default=k5});var u5=l((DW,w5)=>{w5.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 x5=l((FW,o8)=>{var GE=n8(),WE=P5(),UE=u5(),f5=(D)=>{if(typeof D!=="string"||D.length===0)return 0;if(D=GE(D),D.length===0)return 0;D=D.replace(UE()," ");let F=0;for(let B=0;B<D.length;B++){let $=D.codePointAt(B);if($<=31||$>=127&&$<=159)continue;if($>=768&&$<=879)continue;if($>65535)B++;F+=WE($)?2:1}return F};o8.exports=f5;o8.exports.default=f5});var h5=l((BW,y5)=>{y5.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 s8=l(($W,l5)=>{var b0=h5(),g5={};for(let D of Object.keys(b0))g5[b0[D]]=D;var R={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"]}};l5.exports=R;for(let D of Object.keys(R)){if(!("channels"in R[D]))throw Error("missing channels property: "+D);if(!("labels"in R[D]))throw Error("missing channel labels property: "+D);if(R[D].labels.length!==R[D].channels)throw Error("channel and label counts mismatch: "+D);let{channels:F,labels:B}=R[D];delete R[D].channels,delete R[D].labels,Object.defineProperty(R[D],"channels",{value:F}),Object.defineProperty(R[D],"labels",{value:B})}R.rgb.hsl=function(D){let F=D[0]/255,B=D[1]/255,$=D[2]/255,E=Math.min(F,B,$),J=Math.max(F,B,$),X=J-E,Y,Q;if(J===E)Y=0;else if(F===J)Y=(B-$)/X;else if(B===J)Y=2+($-F)/X;else if($===J)Y=4+(F-B)/X;if(Y=Math.min(Y*60,360),Y<0)Y+=360;let q=(E+J)/2;if(J===E)Q=0;else if(q<=0.5)Q=X/(J+E);else Q=X/(2-J-E);return[Y,Q*100,q*100]};R.rgb.hsv=function(D){let F,B,$,E,J,X=D[0]/255,Y=D[1]/255,Q=D[2]/255,q=Math.max(X,Y,Q),H=q-Math.min(X,Y,Q),G=function(U){return(q-U)/6/H+0.5};if(H===0)E=0,J=0;else{if(J=H/q,F=G(X),B=G(Y),$=G(Q),X===q)E=$-B;else if(Y===q)E=0.3333333333333333+F-$;else if(Q===q)E=0.6666666666666666+B-F;if(E<0)E+=1;else if(E>1)E-=1}return[E*360,J*100,q*100]};R.rgb.hwb=function(D){let F=D[0],B=D[1],$=D[2],E=R.rgb.hsl(D)[0],J=0.00392156862745098*Math.min(F,Math.min(B,$));return $=1-0.00392156862745098*Math.max(F,Math.max(B,$)),[E,J*100,$*100]};R.rgb.cmyk=function(D){let F=D[0]/255,B=D[1]/255,$=D[2]/255,E=Math.min(1-F,1-B,1-$),J=(1-F-E)/(1-E)||0,X=(1-B-E)/(1-E)||0,Y=(1-$-E)/(1-E)||0;return[J*100,X*100,Y*100,E*100]};function VE(D,F){return(D[0]-F[0])**2+(D[1]-F[1])**2+(D[2]-F[2])**2}R.rgb.keyword=function(D){let F=g5[D];if(F)return F;let B=1/0,$;for(let E of Object.keys(b0)){let J=b0[E],X=VE(D,J);if(X<B)B=X,$=E}return $};R.keyword.rgb=function(D){return b0[D]};R.rgb.xyz=function(D){let F=D[0]/255,B=D[1]/255,$=D[2]/255;F=F>0.04045?((F+0.055)/1.055)**2.4:F/12.92,B=B>0.04045?((B+0.055)/1.055)**2.4:B/12.92,$=$>0.04045?(($+0.055)/1.055)**2.4:$/12.92;let E=F*0.4124+B*0.3576+$*0.1805,J=F*0.2126+B*0.7152+$*0.0722,X=F*0.0193+B*0.1192+$*0.9505;return[E*100,J*100,X*100]};R.rgb.lab=function(D){let F=R.rgb.xyz(D),B=F[0],$=F[1],E=F[2];B/=95.047,$/=100,E/=108.883,B=B>0.008856?B**0.3333333333333333:7.787*B+0.13793103448275862,$=$>0.008856?$**0.3333333333333333:7.787*$+0.13793103448275862,E=E>0.008856?E**0.3333333333333333:7.787*E+0.13793103448275862;let J=116*$-16,X=500*(B-$),Y=200*($-E);return[J,X,Y]};R.hsl.rgb=function(D){let F=D[0]/360,B=D[1]/100,$=D[2]/100,E,J,X;if(B===0)return X=$*255,[X,X,X];if($<0.5)E=$*(1+B);else E=$+B-$*B;let Y=2*$-E,Q=[0,0,0];for(let q=0;q<3;q++){if(J=F+0.3333333333333333*-(q-1),J<0)J++;if(J>1)J--;if(6*J<1)X=Y+(E-Y)*6*J;else if(2*J<1)X=E;else if(3*J<2)X=Y+(E-Y)*(0.6666666666666666-J)*6;else X=Y;Q[q]=X*255}return Q};R.hsl.hsv=function(D){let F=D[0],B=D[1]/100,$=D[2]/100,E=B,J=Math.max($,0.01);$*=2,B*=$<=1?$:2-$,E*=J<=1?J:2-J;let X=($+B)/2,Y=$===0?2*E/(J+E):2*B/($+B);return[F,Y*100,X*100]};R.hsv.rgb=function(D){let F=D[0]/60,B=D[1]/100,$=D[2]/100,E=Math.floor(F)%6,J=F-Math.floor(F),X=255*$*(1-B),Y=255*$*(1-B*J),Q=255*$*(1-B*(1-J));switch($*=255,E){case 0:return[$,Q,X];case 1:return[Y,$,X];case 2:return[X,$,Q];case 3:return[X,Y,$];case 4:return[Q,X,$];case 5:return[$,X,Y]}};R.hsv.hsl=function(D){let F=D[0],B=D[1]/100,$=D[2]/100,E=Math.max($,0.01),J,X;X=(2-B)*$;let Y=(2-B)*E;return J=B*E,J/=Y<=1?Y:2-Y,J=J||0,X/=2,[F,J*100,X*100]};R.hwb.rgb=function(D){let F=D[0]/360,B=D[1]/100,$=D[2]/100,E=B+$,J;if(E>1)B/=E,$/=E;let X=Math.floor(6*F),Y=1-$;if(J=6*F-X,(X&1)!==0)J=1-J;let Q=B+J*(Y-B),q,H,G;switch(X){default:case 6:case 0:q=Y,H=Q,G=B;break;case 1:q=Q,H=Y,G=B;break;case 2:q=B,H=Y,G=Q;break;case 3:q=B,H=Q,G=Y;break;case 4:q=Q,H=B,G=Y;break;case 5:q=Y,H=B,G=Q;break}return[q*255,H*255,G*255]};R.cmyk.rgb=function(D){let F=D[0]/100,B=D[1]/100,$=D[2]/100,E=D[3]/100,J=1-Math.min(1,F*(1-E)+E),X=1-Math.min(1,B*(1-E)+E),Y=1-Math.min(1,$*(1-E)+E);return[J*255,X*255,Y*255]};R.xyz.rgb=function(D){let F=D[0]/100,B=D[1]/100,$=D[2]/100,E,J,X;return E=F*3.2406+B*-1.5372+$*-0.4986,J=F*-0.9689+B*1.8758+$*0.0415,X=F*0.0557+B*-0.204+$*1.057,E=E>0.0031308?1.055*E**0.4166666666666667-0.055:E*12.92,J=J>0.0031308?1.055*J**0.4166666666666667-0.055:J*12.92,X=X>0.0031308?1.055*X**0.4166666666666667-0.055:X*12.92,E=Math.min(Math.max(0,E),1),J=Math.min(Math.max(0,J),1),X=Math.min(Math.max(0,X),1),[E*255,J*255,X*255]};R.xyz.lab=function(D){let F=D[0],B=D[1],$=D[2];F/=95.047,B/=100,$/=108.883,F=F>0.008856?F**0.3333333333333333:7.787*F+0.13793103448275862,B=B>0.008856?B**0.3333333333333333:7.787*B+0.13793103448275862,$=$>0.008856?$**0.3333333333333333:7.787*$+0.13793103448275862;let E=116*B-16,J=500*(F-B),X=200*(B-$);return[E,J,X]};R.lab.xyz=function(D){let F=D[0],B=D[1],$=D[2],E,J,X;J=(F+16)/116,E=B/500+J,X=J-$/200;let Y=J**3,Q=E**3,q=X**3;return J=Y>0.008856?Y:(J-0.13793103448275862)/7.787,E=Q>0.008856?Q:(E-0.13793103448275862)/7.787,X=q>0.008856?q:(X-0.13793103448275862)/7.787,E*=95.047,J*=100,X*=108.883,[E,J,X]};R.lab.lch=function(D){let F=D[0],B=D[1],$=D[2],E;if(E=Math.atan2($,B)*360/2/Math.PI,E<0)E+=360;let X=Math.sqrt(B*B+$*$);return[F,X,E]};R.lch.lab=function(D){let F=D[0],B=D[1],E=D[2]/360*2*Math.PI,J=B*Math.cos(E),X=B*Math.sin(E);return[F,J,X]};R.rgb.ansi16=function(D,F=null){let[B,$,E]=D,J=F===null?R.rgb.hsv(D)[2]:F;if(J=Math.round(J/50),J===0)return 30;let X=30+(Math.round(E/255)<<2|Math.round($/255)<<1|Math.round(B/255));if(J===2)X+=60;return X};R.hsv.ansi16=function(D){return R.rgb.ansi16(R.hsv.rgb(D),D[2])};R.rgb.ansi256=function(D){let F=D[0],B=D[1],$=D[2];if(F===B&&B===$){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(B/255*5)+Math.round($/255*5)};R.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 B=(~~(D>50)+1)*0.5,$=(F&1)*B*255,E=(F>>1&1)*B*255,J=(F>>2&1)*B*255;return[$,E,J]};R.ansi256.rgb=function(D){if(D>=232){let J=(D-232)*10+8;return[J,J,J]}D-=16;let F,B=Math.floor(D/36)/5*255,$=Math.floor((F=D%36)/6)/5*255,E=F%6/5*255;return[B,$,E]};R.rgb.hex=function(D){let B=(((Math.round(D[0])&255)<<16)+((Math.round(D[1])&255)<<8)+(Math.round(D[2])&255)).toString(16).toUpperCase();return"000000".substring(B.length)+B};R.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 B=F[0];if(F[0].length===3)B=B.split("").map((Y)=>{return Y+Y}).join("");let $=parseInt(B,16),E=$>>16&255,J=$>>8&255,X=$&255;return[E,J,X]};R.rgb.hcg=function(D){let F=D[0]/255,B=D[1]/255,$=D[2]/255,E=Math.max(Math.max(F,B),$),J=Math.min(Math.min(F,B),$),X=E-J,Y,Q;if(X<1)Y=J/(1-X);else Y=0;if(X<=0)Q=0;else if(E===F)Q=(B-$)/X%6;else if(E===B)Q=2+($-F)/X;else Q=4+(F-B)/X;return Q/=6,Q%=1,[Q*360,X*100,Y*100]};R.hsl.hcg=function(D){let F=D[1]/100,B=D[2]/100,$=B<0.5?2*F*B:2*F*(1-B),E=0;if($<1)E=(B-0.5*$)/(1-$);return[D[0],$*100,E*100]};R.hsv.hcg=function(D){let F=D[1]/100,B=D[2]/100,$=F*B,E=0;if($<1)E=(B-$)/(1-$);return[D[0],$*100,E*100]};R.hcg.rgb=function(D){let F=D[0]/360,B=D[1]/100,$=D[2]/100;if(B===0)return[$*255,$*255,$*255];let E=[0,0,0],J=F%1*6,X=J%1,Y=1-X,Q=0;switch(Math.floor(J)){case 0:E[0]=1,E[1]=X,E[2]=0;break;case 1:E[0]=Y,E[1]=1,E[2]=0;break;case 2:E[0]=0,E[1]=1,E[2]=X;break;case 3:E[0]=0,E[1]=Y,E[2]=1;break;case 4:E[0]=X,E[1]=0,E[2]=1;break;default:E[0]=1,E[1]=0,E[2]=Y}return Q=(1-B)*$,[(B*E[0]+Q)*255,(B*E[1]+Q)*255,(B*E[2]+Q)*255]};R.hcg.hsv=function(D){let F=D[1]/100,B=D[2]/100,$=F+B*(1-F),E=0;if($>0)E=F/$;return[D[0],E*100,$*100]};R.hcg.hsl=function(D){let F=D[1]/100,$=D[2]/100*(1-F)+0.5*F,E=0;if($>0&&$<0.5)E=F/(2*$);else if($>=0.5&&$<1)E=F/(2*(1-$));return[D[0],E*100,$*100]};R.hcg.hwb=function(D){let F=D[1]/100,B=D[2]/100,$=F+B*(1-F);return[D[0],($-F)*100,(1-$)*100]};R.hwb.hcg=function(D){let F=D[1]/100,$=1-D[2]/100,E=$-F,J=0;if(E<1)J=($-E)/(1-E);return[D[0],E*100,J*100]};R.apple.rgb=function(D){return[D[0]/65535*255,D[1]/65535*255,D[2]/65535*255]};R.rgb.apple=function(D){return[D[0]/255*65535,D[1]/255*65535,D[2]/255*65535]};R.gray.rgb=function(D){return[D[0]/100*255,D[0]/100*255,D[0]/100*255]};R.gray.hsl=function(D){return[0,0,D[0]]};R.gray.hsv=R.gray.hsl;R.gray.hwb=function(D){return[0,100,D[0]]};R.gray.cmyk=function(D){return[0,0,0,D[0]]};R.gray.lab=function(D){return[D[0],0,0]};R.gray.hex=function(D){let F=Math.round(D[0]/100*255)&255,$=((F<<16)+(F<<8)+F).toString(16).toUpperCase();return"000000".substring($.length)+$};R.rgb.gray=function(D){return[(D[0]+D[1]+D[2])/3/255*100]}});var p5=l((EW,m5)=>{var k3=s8();function _E(){let D={},F=Object.keys(k3);for(let B=F.length,$=0;$<B;$++)D[F[$]]={distance:-1,parent:null};return D}function KE(D){let F=_E(),B=[D];F[D].distance=0;while(B.length){let $=B.pop(),E=Object.keys(k3[$]);for(let J=E.length,X=0;X<J;X++){let Y=E[X],Q=F[Y];if(Q.distance===-1)Q.distance=F[$].distance+1,Q.parent=$,B.unshift(Y)}}return F}function AE(D,F){return function(B){return F(D(B))}}function zE(D,F){let B=[F[D].parent,D],$=k3[F[D].parent][D],E=F[D].parent;while(F[E].parent)B.unshift(F[E].parent),$=AE(k3[F[E].parent][E],$),E=F[E].parent;return $.conversion=B,$}m5.exports=function(D){let F=KE(D),B={},$=Object.keys(F);for(let E=$.length,J=0;J<E;J++){let X=$[J];if(F[X].parent===null)continue;B[X]=zE(X,F)}return B}});var c5=l((JW,d5)=>{var a8=s8(),ME=p5(),r2={},RE=Object.keys(a8);function CE(D){let F=function(...B){let $=B[0];if($===void 0||$===null)return $;if($.length>1)B=$;return D(B)};if("conversion"in D)F.conversion=D.conversion;return F}function OE(D){let F=function(...B){let $=B[0];if($===void 0||$===null)return $;if($.length>1)B=$;let E=D(B);if(typeof E==="object")for(let J=E.length,X=0;X<J;X++)E[X]=Math.round(E[X]);return E};if("conversion"in D)F.conversion=D.conversion;return F}RE.forEach((D)=>{r2[D]={},Object.defineProperty(r2[D],"channels",{value:a8[D].channels}),Object.defineProperty(r2[D],"labels",{value:a8[D].labels});let F=ME(D);Object.keys(F).forEach(($)=>{let E=F[$];r2[D][$]=OE(E),r2[D][$].raw=CE(E)})});d5.exports=r2});var a5=l((XW,s5)=>{var i5=(D,F)=>(...B)=>{return`\x1B[${D(...B)+F}m`},n5=(D,F)=>(...B)=>{let $=D(...B);return`\x1B[${38+F};5;${$}m`},r5=(D,F)=>(...B)=>{let $=D(...B);return`\x1B[${38+F};2;${$[0]};${$[1]};${$[2]}m`},P3=(D)=>D,o5=(D,F,B)=>[D,F,B],o2=(D,F,B)=>{Object.defineProperty(D,F,{get:()=>{let $=B();return Object.defineProperty(D,F,{value:$,enumerable:!0,configurable:!0}),$},enumerable:!0,configurable:!0})},t8,s2=(D,F,B,$)=>{if(t8===void 0)t8=c5();let E=$?10:0,J={};for(let[X,Y]of Object.entries(t8)){let Q=X==="ansi16"?"ansi":X;if(X===F)J[Q]=D(B,E);else if(typeof Y==="object")J[Q]=D(Y[F],E)}return J};function LE(){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[B,$]of Object.entries(F)){for(let[E,J]of Object.entries($))F[E]={open:`\x1B[${J[0]}m`,close:`\x1B[${J[1]}m`},$[E]=F[E],D.set(J[0],J[1]);Object.defineProperty(F,B,{value:$,enumerable:!1})}return Object.defineProperty(F,"codes",{value:D,enumerable:!1}),F.color.close="\x1B[39m",F.bgColor.close="\x1B[49m",o2(F.color,"ansi",()=>s2(i5,"ansi16",P3,!1)),o2(F.color,"ansi256",()=>s2(n5,"ansi256",P3,!1)),o2(F.color,"ansi16m",()=>s2(r5,"rgb",o5,!1)),o2(F.bgColor,"ansi",()=>s2(i5,"ansi16",P3,!0)),o2(F.bgColor,"ansi256",()=>s2(n5,"ansi256",P3,!0)),o2(F.bgColor,"ansi16m",()=>s2(r5,"rgb",o5,!0)),F}Object.defineProperty(s5,"exports",{enumerable:!0,get:LE})});var D7=l((YW,e5)=>{var I0=x5(),jE=n8(),SE=a5(),D6=new Set(["\x1B","\x9B"]),t5=(D)=>`${D6.values().next().value}[${D}m`,TE=(D)=>D.split(" ").map((F)=>I0(F)),e8=(D,F,B)=>{let $=[...F],E=!1,J=I0(jE(D[D.length-1]));for(let[X,Y]of $.entries()){let Q=I0(Y);if(J+Q<=B)D[D.length-1]+=Y;else D.push(Y),J=0;if(D6.has(Y))E=!0;else if(E&&Y==="m"){E=!1;continue}if(E)continue;if(J+=Q,J===B&&X<$.length-1)D.push(""),J=0}if(!J&&D[D.length-1].length>0&&D.length>1)D[D.length-2]+=D.pop()},ZE=(D)=>{let F=D.split(" "),B=F.length;while(B>0){if(I0(F[B-1])>0)break;B--}if(B===F.length)return D;return F.slice(0,B).join(" ")+F.slice(B).join("")},NE=(D,F,B={})=>{if(B.trim!==!1&&D.trim()==="")return"";let $="",E="",J,X=TE(D),Y=[""];for(let[Q,q]of D.split(" ").entries()){if(B.trim!==!1)Y[Y.length-1]=Y[Y.length-1].trimLeft();let H=I0(Y[Y.length-1]);if(Q!==0){if(H>=F&&(B.wordWrap===!1||B.trim===!1))Y.push(""),H=0;if(H>0||B.trim===!1)Y[Y.length-1]+=" ",H++}if(B.hard&&X[Q]>F){let G=F-H,U=1+Math.floor((X[Q]-G-1)/F);if(Math.floor((X[Q]-1)/F)<U)Y.push("");e8(Y,q,F);continue}if(H+X[Q]>F&&H>0&&X[Q]>0){if(B.wordWrap===!1&&H<F){e8(Y,q,F);continue}Y.push("")}if(H+X[Q]>F&&B.wordWrap===!1){e8(Y,q,F);continue}Y[Y.length-1]+=q}if(B.trim!==!1)Y=Y.map(ZE);$=Y.join(`
|
|
24
|
+
`)}),this}_outputHelpIfRequested(D){let F=this._getHelpOption();if(F&&D.find(($)=>F.is($)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function v1(D){return D.map((F)=>{if(!F.startsWith("--inspect"))return F;let B,$="127.0.0.1",E="9229",J;if((J=F.match(/^(--inspect(-brk)?)$/))!==null)B=J[1];else if((J=F.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(B=J[1],/^\d+$/.test(J[3]))E=J[3];else $=J[3];else if((J=F.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)B=J[1],$=J[3],E=J[4];if(B&&E!=="0")return`${B}=${$}:${parseInt(E)+1}`;return F})}FB.Command=v8});var f1=l((JB)=>{var{Argument:P1}=A3(),{Command:k8}=k1(),{CommanderError:$B,InvalidArgumentError:w1}=V0(),{Help:EB}=T8(),{Option:u1}=Z8();JB.program=new k8;JB.createCommand=(D)=>new k8(D);JB.createOption=(D,F)=>new u1(D,F);JB.createArgument=(D,F)=>new P1(D,F);JB.Command=k8;JB.Option=u1;JB.Argument=P1;JB.Help=EB;JB.CommanderError=$B;JB.InvalidArgumentError=w1;JB.InvalidOptionArgumentError=w1});var k,w8,V,RD=(D)=>{switch(typeof D){case"undefined":return V.undefined;case"string":return V.string;case"number":return Number.isNaN(D)?V.nan:V.number;case"boolean":return V.boolean;case"function":return V.function;case"bigint":return V.bigint;case"symbol":return V.symbol;case"object":if(Array.isArray(D))return V.array;if(D===null)return V.null;if(D.then&&typeof D.then==="function"&&D.catch&&typeof D.catch==="function")return V.promise;if(typeof Map<"u"&&D instanceof Map)return V.map;if(typeof Set<"u"&&D instanceof Set)return V.set;if(typeof Date<"u"&&D instanceof Date)return V.date;return V.object;default:return V.unknown}};var _0=Z(()=>{(function(D){D.assertEqual=(E)=>{};function F(E){}D.assertIs=F;function B(E){throw Error()}D.assertNever=B,D.arrayToEnum=(E)=>{let J={};for(let X of E)J[X]=X;return J},D.getValidEnumValues=(E)=>{let J=D.objectKeys(E).filter((Y)=>typeof E[E[Y]]!=="number"),X={};for(let Y of J)X[Y]=E[Y];return D.objectValues(X)},D.objectValues=(E)=>{return D.objectKeys(E).map(function(J){return E[J]})},D.objectKeys=typeof Object.keys==="function"?(E)=>Object.keys(E):(E)=>{let J=[];for(let X in E)if(Object.prototype.hasOwnProperty.call(E,X))J.push(X);return J},D.find=(E,J)=>{for(let X of E)if(J(X))return X;return},D.isInteger=typeof Number.isInteger==="function"?(E)=>Number.isInteger(E):(E)=>typeof E==="number"&&Number.isFinite(E)&&Math.floor(E)===E;function $(E,J=" | "){return E.map((X)=>typeof X==="string"?`'${X}'`:X).join(J)}D.joinValues=$,D.jsonStringifyReplacer=(E,J)=>{if(typeof J==="bigint")return J.toString();return J}})(k||(k={}));(function(D){D.mergeShapes=(F,B)=>{return{...F,...B}}})(w8||(w8={}));V=k.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"])});var W,CB=(D)=>{return JSON.stringify(D,null,2).replace(/"([^"]+)":/g,"$1:")},e;var M3=Z(()=>{_0();W=k.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"]);e=class e extends Error{get errors(){return this.issues}constructor(D){super();this.issues=[],this.addIssue=(B)=>{this.issues=[...this.issues,B]},this.addIssues=(B=[])=>{this.issues=[...this.issues,...B]};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(E){return E.message},B={_errors:[]},$=(E)=>{for(let J of E.issues)if(J.code==="invalid_union")J.unionErrors.map($);else if(J.code==="invalid_return_type")$(J.returnTypeError);else if(J.code==="invalid_arguments")$(J.argumentsError);else if(J.path.length===0)B._errors.push(F(J));else{let X=B,Y=0;while(Y<J.path.length){let Q=J.path[Y];if(Y!==J.path.length-1)X[Q]=X[Q]||{_errors:[]};else X[Q]=X[Q]||{_errors:[]},X[Q]._errors.push(F(J));X=X[Q],Y++}}};return $(this),B}static assert(D){if(!(D instanceof e))throw Error(`Not a ZodError: ${D}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,k.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(D=(F)=>F.message){let F={},B=[];for(let $ of this.issues)if($.path.length>0){let E=$.path[0];F[E]=F[E]||[],F[E].push(D($))}else B.push(D($));return{formErrors:B,fieldErrors:F}}get formErrors(){return this.flatten()}};e.create=(D)=>{return new e(D)}});var OB=(D,F)=>{let B;switch(D.code){case W.invalid_type:if(D.received===V.undefined)B="Required";else B=`Expected ${D.expected}, received ${D.received}`;break;case W.invalid_literal:B=`Invalid literal value, expected ${JSON.stringify(D.expected,k.jsonStringifyReplacer)}`;break;case W.unrecognized_keys:B=`Unrecognized key(s) in object: ${k.joinValues(D.keys,", ")}`;break;case W.invalid_union:B="Invalid input";break;case W.invalid_union_discriminator:B=`Invalid discriminator value. Expected ${k.joinValues(D.options)}`;break;case W.invalid_enum_value:B=`Invalid enum value. Expected ${k.joinValues(D.options)}, received '${D.received}'`;break;case W.invalid_arguments:B="Invalid function arguments";break;case W.invalid_return_type:B="Invalid function return type";break;case W.invalid_date:B="Invalid date";break;case W.invalid_string:if(typeof D.validation==="object")if("includes"in D.validation){if(B=`Invalid input: must include "${D.validation.includes}"`,typeof D.validation.position==="number")B=`${B} at one or more positions greater than or equal to ${D.validation.position}`}else if("startsWith"in D.validation)B=`Invalid input: must start with "${D.validation.startsWith}"`;else if("endsWith"in D.validation)B=`Invalid input: must end with "${D.validation.endsWith}"`;else k.assertNever(D.validation);else if(D.validation!=="regex")B=`Invalid ${D.validation}`;else B="Invalid";break;case W.too_small:if(D.type==="array")B=`Array must contain ${D.exact?"exactly":D.inclusive?"at least":"more than"} ${D.minimum} element(s)`;else if(D.type==="string")B=`String must contain ${D.exact?"exactly":D.inclusive?"at least":"over"} ${D.minimum} character(s)`;else if(D.type==="number")B=`Number must be ${D.exact?"exactly equal to ":D.inclusive?"greater than or equal to ":"greater than "}${D.minimum}`;else if(D.type==="bigint")B=`Number must be ${D.exact?"exactly equal to ":D.inclusive?"greater than or equal to ":"greater than "}${D.minimum}`;else if(D.type==="date")B=`Date must be ${D.exact?"exactly equal to ":D.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(D.minimum))}`;else B="Invalid input";break;case W.too_big:if(D.type==="array")B=`Array must contain ${D.exact?"exactly":D.inclusive?"at most":"less than"} ${D.maximum} element(s)`;else if(D.type==="string")B=`String must contain ${D.exact?"exactly":D.inclusive?"at most":"under"} ${D.maximum} character(s)`;else if(D.type==="number")B=`Number must be ${D.exact?"exactly":D.inclusive?"less than or equal to":"less than"} ${D.maximum}`;else if(D.type==="bigint")B=`BigInt must be ${D.exact?"exactly":D.inclusive?"less than or equal to":"less than"} ${D.maximum}`;else if(D.type==="date")B=`Date must be ${D.exact?"exactly":D.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(D.maximum))}`;else B="Invalid input";break;case W.custom:B="Invalid input";break;case W.invalid_intersection_types:B="Intersection results could not be merged";break;case W.not_multiple_of:B=`Number must be a multiple of ${D.multipleOf}`;break;case W.not_finite:B="Number must be finite";break;default:B=F.defaultError,k.assertNever(D)}return{message:B}},bD;var u8=Z(()=>{M3();_0();bD=OB});function LB(D){i1=D}function I2(){return i1}var i1;var R3=Z(()=>{u8();i1=bD});function K(D,F){let B=I2(),$=K0({issueData:F,data:D.data,path:D.path,errorMaps:[D.common.contextualErrorMap,D.schemaErrorMap,B,B===bD?void 0:bD].filter((E)=>!!E)});D.common.issues.push($)}class d{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 B=[];for(let $ of F){if($.status==="aborted")return O;if($.status==="dirty")D.dirty();B.push($.value)}return{status:D.value,value:B}}static async mergeObjectAsync(D,F){let B=[];for(let $ of F){let E=await $.key,J=await $.value;B.push({key:E,value:J})}return d.mergeObjectSync(D,B)}static mergeObjectSync(D,F){let B={};for(let $ of F){let{key:E,value:J}=$;if(E.status==="aborted")return O;if(J.status==="aborted")return O;if(E.status==="dirty")D.dirty();if(J.status==="dirty")D.dirty();if(E.value!=="__proto__"&&(typeof J.value<"u"||$.alwaysSet))B[E.value]=J.value}return{status:D.value,value:B}}}var K0=(D)=>{let{data:F,path:B,errorMaps:$,issueData:E}=D,J=[...B,...E.path||[]],X={...E,path:J};if(E.message!==void 0)return{...E,path:J,message:E.message};let Y="",Q=$.filter((q)=>!!q).slice().reverse();for(let q of Q)Y=q(X,{data:F,defaultError:Y}).message;return{...E,path:J,message:Y}},jB,O,eD=(D)=>({status:"dirty",value:D}),o=(D)=>({status:"valid",value:D}),C3=(D)=>D.status==="aborted",O3=(D)=>D.status==="dirty",mD=(D)=>D.status==="valid",v2=(D)=>typeof Promise<"u"&&D instanceof Promise;var f8=Z(()=>{R3();u8();jB=[];O=Object.freeze({status:"aborted"})});var n1=()=>{};var M;var r1=Z(()=>{(function(D){D.errToObj=(F)=>typeof F==="string"?{message:F}:F||{},D.toString=(F)=>typeof F==="string"?F:F?.message})(M||(M={}))});class GD{constructor(D,F,B,$){this._cachedPath=[],this.parent=D,this.data=F,this._path=B,this._key=$}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:B,required_error:$,description:E}=D;if(F&&(B||$))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(F)return{errorMap:F,description:E};return{errorMap:(X,Y)=>{let{message:Q}=D;if(X.code==="invalid_enum_value")return{message:Q??Y.defaultError};if(typeof Y.data>"u")return{message:Q??$??Y.defaultError};if(X.code!=="invalid_type")return{message:Y.defaultError};return{message:Q??B??Y.defaultError}},description:E}}class v{get description(){return this._def.description}_getType(D){return RD(D.data)}_getOrReturnCtx(D,F){return F||{common:D.parent.common,data:D.data,parsedType:RD(D.data),schemaErrorMap:this._def.errorMap,path:D.path,parent:D.parent}}_processInputParams(D){return{status:new d,ctx:{common:D.parent.common,data:D.data,parsedType:RD(D.data),schemaErrorMap:this._def.errorMap,path:D.path,parent:D.parent}}}_parseSync(D){let F=this._parse(D);if(v2(F))throw Error("Synchronous parse encountered promise.");return F}_parseAsync(D){let F=this._parse(D);return Promise.resolve(F)}parse(D,F){let B=this.safeParse(D,F);if(B.success)return B.data;throw B.error}safeParse(D,F){let B={common:{issues:[],async:F?.async??!1,contextualErrorMap:F?.errorMap},path:F?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:D,parsedType:RD(D)},$=this._parseSync({data:D,path:B.path,parent:B});return o1(B,$)}"~validate"(D){let F={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:D,parsedType:RD(D)};if(!this["~standard"].async)try{let B=this._parseSync({data:D,path:[],parent:F});return mD(B)?{value:B.value}:{issues:F.common.issues}}catch(B){if(B?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;F.common={issues:[],async:!0}}return this._parseAsync({data:D,path:[],parent:F}).then((B)=>mD(B)?{value:B.value}:{issues:F.common.issues})}async parseAsync(D,F){let B=await this.safeParseAsync(D,F);if(B.success)return B.data;throw B.error}async safeParseAsync(D,F){let B={common:{issues:[],contextualErrorMap:F?.errorMap,async:!0},path:F?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:D,parsedType:RD(D)},$=this._parse({data:D,path:B.path,parent:B}),E=await(v2($)?$:Promise.resolve($));return o1(B,E)}refine(D,F){let B=($)=>{if(typeof F==="string"||typeof F>"u")return{message:F};else if(typeof F==="function")return F($);else return F};return this._refinement(($,E)=>{let J=D($),X=()=>E.addIssue({code:W.custom,...B($)});if(typeof Promise<"u"&&J instanceof Promise)return J.then((Y)=>{if(!Y)return X(),!1;else return!0});if(!J)return X(),!1;else return!0})}refinement(D,F){return this._refinement((B,$)=>{if(!D(B))return $.addIssue(typeof F==="function"?F(B,$):F),!1;else return!0})}_refinement(D){return new WD({schema:this,typeName:L.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 HD.create(this,this._def)}nullable(){return vD.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return qD.create(this)}promise(){return $2.create(this,this._def)}or(D){return x2.create([this,D],this._def)}and(D){return y2.create(this,D,this._def)}transform(D){return new WD({...S(this._def),schema:this,typeName:L.ZodEffects,effect:{type:"transform",transform:D}})}default(D){let F=typeof D==="function"?D:()=>D;return new m2({...S(this._def),innerType:this,defaultValue:F,typeName:L.ZodDefault})}brand(){return new j3({typeName:L.ZodBranded,type:this,...S(this._def)})}catch(D){let F=typeof D==="function"?D:()=>D;return new p2({...S(this._def),innerType:this,catchValue:F,typeName:L.ZodCatch})}describe(D){return new this.constructor({...this._def,description:D})}pipe(D){return O0.create(this,D)}readonly(){return d2.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}function t1(D){let F="[0-5]\\d";if(D.precision)F=`${F}\\.\\d{${D.precision}}`;else if(D.precision==null)F=`${F}(\\.\\d+)?`;let B=D.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${F})${B}`}function lB(D){return new RegExp(`^${t1(D)}$`)}function e1(D){let F=`${a1}T${t1(D)}`,B=[];if(B.push(D.local?"Z?":"Z"),D.offset)B.push("([+-]\\d{2}:?\\d{2})");return F=`${F}(${B.join("|")})`,new RegExp(`^${F}$`)}function mB(D,F){if((F==="v4"||!F)&&wB.test(D))return!0;if((F==="v6"||!F)&&fB.test(D))return!0;return!1}function pB(D,F){if(!IB.test(D))return!1;try{let[B]=D.split(".");if(!B)return!1;let $=B.replace(/-/g,"+").replace(/_/g,"/").padEnd(B.length+(4-B.length%4)%4,"="),E=JSON.parse(atob($));if(typeof E!=="object"||E===null)return!1;if("typ"in E&&E?.typ!=="JWT")return!1;if(!E.alg)return!1;if(F&&E.alg!==F)return!1;return!0}catch{return!1}}function dB(D,F){if((F==="v4"||!F)&&uB.test(D))return!0;if((F==="v6"||!F)&&xB.test(D))return!0;return!1}function cB(D,F){let B=(D.toString().split(".")[1]||"").length,$=(F.toString().split(".")[1]||"").length,E=B>$?B:$,J=Number.parseInt(D.toFixed(E).replace(".","")),X=Number.parseInt(F.toFixed(E).replace(".",""));return J%X/10**E}function k2(D){if(D instanceof y){let F={};for(let B in D.shape){let $=D.shape[B];F[B]=HD.create(k2($))}return new y({...D._def,shape:()=>F})}else if(D instanceof qD)return new qD({...D._def,type:k2(D.element)});else if(D instanceof HD)return HD.create(k2(D.unwrap()));else if(D instanceof vD)return vD.create(k2(D.unwrap()));else if(D instanceof OD)return OD.create(D.items.map((F)=>k2(F)));else return D}function y8(D,F){let B=RD(D),$=RD(F);if(D===F)return{valid:!0,data:D};else if(B===V.object&&$===V.object){let E=k.objectKeys(F),J=k.objectKeys(D).filter((Y)=>E.indexOf(Y)!==-1),X={...D,...F};for(let Y of J){let Q=y8(D[Y],F[Y]);if(!Q.valid)return{valid:!1};X[Y]=Q.data}return{valid:!0,data:X}}else if(B===V.array&&$===V.array){if(D.length!==F.length)return{valid:!1};let E=[];for(let J=0;J<D.length;J++){let X=D[J],Y=F[J],Q=y8(X,Y);if(!Q.valid)return{valid:!1};E.push(Q.data)}return{valid:!0,data:E}}else if(B===V.date&&$===V.date&&+D===+F)return{valid:!0,data:D};else return{valid:!1}}function D5(D,F){return new iD({values:D,typeName:L.ZodEnum,...S(F)})}function s1(D,F){let B=typeof D==="function"?D(F):typeof D==="string"?{message:D}:D;return typeof B==="string"?{message:B}:B}function F5(D,F={},B){if(D)return F2.create().superRefine(($,E)=>{let J=D($);if(J instanceof Promise)return J.then((X)=>{if(!X){let Y=s1(F,$),Q=Y.fatal??B??!0;E.addIssue({code:"custom",...Y,fatal:Q})}});if(!J){let X=s1(F,$),Y=X.fatal??B??!0;E.addIssue({code:"custom",...X,fatal:Y})}return});return F2.create()}var o1=(D,F)=>{if(mD(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 B=new e(D.common.issues);return this._error=B,this._error}}}},SB,TB,ZB,NB,bB,IB,vB,kB,PB="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",x8,wB,uB,fB,xB,yB,hB,a1="((\\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])))",gB,QD,dD,cD,w2,D2,A0,u2,f2,F2,pD,CD,z0,qD,y,x2,ID=(D)=>{if(D instanceof h2)return ID(D.schema);else if(D instanceof WD)return ID(D.innerType());else if(D instanceof g2)return[D.value];else if(D instanceof iD)return D.options;else if(D instanceof l2)return k.objectValues(D.enum);else if(D instanceof m2)return ID(D._def.innerType);else if(D instanceof u2)return[void 0];else if(D instanceof f2)return[null];else if(D instanceof HD)return[void 0,...ID(D.unwrap())];else if(D instanceof vD)return[null,...ID(D.unwrap())];else if(D instanceof j3)return ID(D.unwrap());else if(D instanceof d2)return ID(D.unwrap());else if(D instanceof p2)return ID(D._def.innerType);else return[]},L3,y2,OD,M0,R0,B2,P2,h2,g2,iD,l2,$2,WD,HD,vD,m2,p2,C0,iB,j3,O0,d2,nB,L,rB=(D,F={message:`Input not instance of ${D.name}`})=>F5((B)=>B instanceof D,F),B5,$5,oB,sB,E5,aB,tB,eB,D$,F$,B$,$$,E$,J$,X$,Y$,Q$,q$,H$,G$,W$,U$,V$,_$,K$,A$,z$,M$,R$,C$,O$,L$,j$,S$,T$=()=>B5().optional(),Z$=()=>$5().optional(),N$=()=>E5().optional(),b$,I$;var J5=Z(()=>{M3();R3();r1();f8();_0();SB=/^c[^\s-]{8,}$/i,TB=/^[0-9a-z]+$/,ZB=/^[0-9A-HJKMNP-TV-Z]{26}$/i,NB=/^[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,IB=/^[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,wB=/^(?:(?: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])$/,fB=/^(([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]))$/,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]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,yB=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,hB=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,gB=new RegExp(`^${a1}$`);QD=class QD extends v{_parse(D){if(this._def.coerce)D.data=String(D.data);if(this._getType(D)!==V.string){let E=this._getOrReturnCtx(D);return K(E,{code:W.invalid_type,expected:V.string,received:E.parsedType}),O}let B=new d,$=void 0;for(let E of this._def.checks)if(E.kind==="min"){if(D.data.length<E.value)$=this._getOrReturnCtx(D,$),K($,{code:W.too_small,minimum:E.value,type:"string",inclusive:!0,exact:!1,message:E.message}),B.dirty()}else if(E.kind==="max"){if(D.data.length>E.value)$=this._getOrReturnCtx(D,$),K($,{code:W.too_big,maximum:E.value,type:"string",inclusive:!0,exact:!1,message:E.message}),B.dirty()}else if(E.kind==="length"){let J=D.data.length>E.value,X=D.data.length<E.value;if(J||X){if($=this._getOrReturnCtx(D,$),J)K($,{code:W.too_big,maximum:E.value,type:"string",inclusive:!0,exact:!0,message:E.message});else if(X)K($,{code:W.too_small,minimum:E.value,type:"string",inclusive:!0,exact:!0,message:E.message});B.dirty()}}else if(E.kind==="email"){if(!kB.test(D.data))$=this._getOrReturnCtx(D,$),K($,{validation:"email",code:W.invalid_string,message:E.message}),B.dirty()}else if(E.kind==="emoji"){if(!x8)x8=new RegExp(PB,"u");if(!x8.test(D.data))$=this._getOrReturnCtx(D,$),K($,{validation:"emoji",code:W.invalid_string,message:E.message}),B.dirty()}else if(E.kind==="uuid"){if(!NB.test(D.data))$=this._getOrReturnCtx(D,$),K($,{validation:"uuid",code:W.invalid_string,message:E.message}),B.dirty()}else if(E.kind==="nanoid"){if(!bB.test(D.data))$=this._getOrReturnCtx(D,$),K($,{validation:"nanoid",code:W.invalid_string,message:E.message}),B.dirty()}else if(E.kind==="cuid"){if(!SB.test(D.data))$=this._getOrReturnCtx(D,$),K($,{validation:"cuid",code:W.invalid_string,message:E.message}),B.dirty()}else if(E.kind==="cuid2"){if(!TB.test(D.data))$=this._getOrReturnCtx(D,$),K($,{validation:"cuid2",code:W.invalid_string,message:E.message}),B.dirty()}else if(E.kind==="ulid"){if(!ZB.test(D.data))$=this._getOrReturnCtx(D,$),K($,{validation:"ulid",code:W.invalid_string,message:E.message}),B.dirty()}else if(E.kind==="url")try{new URL(D.data)}catch{$=this._getOrReturnCtx(D,$),K($,{validation:"url",code:W.invalid_string,message:E.message}),B.dirty()}else if(E.kind==="regex"){if(E.regex.lastIndex=0,!E.regex.test(D.data))$=this._getOrReturnCtx(D,$),K($,{validation:"regex",code:W.invalid_string,message:E.message}),B.dirty()}else if(E.kind==="trim")D.data=D.data.trim();else if(E.kind==="includes"){if(!D.data.includes(E.value,E.position))$=this._getOrReturnCtx(D,$),K($,{code:W.invalid_string,validation:{includes:E.value,position:E.position},message:E.message}),B.dirty()}else if(E.kind==="toLowerCase")D.data=D.data.toLowerCase();else if(E.kind==="toUpperCase")D.data=D.data.toUpperCase();else if(E.kind==="startsWith"){if(!D.data.startsWith(E.value))$=this._getOrReturnCtx(D,$),K($,{code:W.invalid_string,validation:{startsWith:E.value},message:E.message}),B.dirty()}else if(E.kind==="endsWith"){if(!D.data.endsWith(E.value))$=this._getOrReturnCtx(D,$),K($,{code:W.invalid_string,validation:{endsWith:E.value},message:E.message}),B.dirty()}else if(E.kind==="datetime"){if(!e1(E).test(D.data))$=this._getOrReturnCtx(D,$),K($,{code:W.invalid_string,validation:"datetime",message:E.message}),B.dirty()}else if(E.kind==="date"){if(!gB.test(D.data))$=this._getOrReturnCtx(D,$),K($,{code:W.invalid_string,validation:"date",message:E.message}),B.dirty()}else if(E.kind==="time"){if(!lB(E).test(D.data))$=this._getOrReturnCtx(D,$),K($,{code:W.invalid_string,validation:"time",message:E.message}),B.dirty()}else if(E.kind==="duration"){if(!vB.test(D.data))$=this._getOrReturnCtx(D,$),K($,{validation:"duration",code:W.invalid_string,message:E.message}),B.dirty()}else if(E.kind==="ip"){if(!mB(D.data,E.version))$=this._getOrReturnCtx(D,$),K($,{validation:"ip",code:W.invalid_string,message:E.message}),B.dirty()}else if(E.kind==="jwt"){if(!pB(D.data,E.alg))$=this._getOrReturnCtx(D,$),K($,{validation:"jwt",code:W.invalid_string,message:E.message}),B.dirty()}else if(E.kind==="cidr"){if(!dB(D.data,E.version))$=this._getOrReturnCtx(D,$),K($,{validation:"cidr",code:W.invalid_string,message:E.message}),B.dirty()}else if(E.kind==="base64"){if(!yB.test(D.data))$=this._getOrReturnCtx(D,$),K($,{validation:"base64",code:W.invalid_string,message:E.message}),B.dirty()}else if(E.kind==="base64url"){if(!hB.test(D.data))$=this._getOrReturnCtx(D,$),K($,{validation:"base64url",code:W.invalid_string,message:E.message}),B.dirty()}else k.assertNever(E);return{status:B.value,value:D.data}}_regex(D,F,B){return this.refinement(($)=>D.test($),{validation:F,code:W.invalid_string,...M.errToObj(B)})}_addCheck(D){return new QD({...this._def,checks:[...this._def.checks,D]})}email(D){return this._addCheck({kind:"email",...M.errToObj(D)})}url(D){return this._addCheck({kind:"url",...M.errToObj(D)})}emoji(D){return this._addCheck({kind:"emoji",...M.errToObj(D)})}uuid(D){return this._addCheck({kind:"uuid",...M.errToObj(D)})}nanoid(D){return this._addCheck({kind:"nanoid",...M.errToObj(D)})}cuid(D){return this._addCheck({kind:"cuid",...M.errToObj(D)})}cuid2(D){return this._addCheck({kind:"cuid2",...M.errToObj(D)})}ulid(D){return this._addCheck({kind:"ulid",...M.errToObj(D)})}base64(D){return this._addCheck({kind:"base64",...M.errToObj(D)})}base64url(D){return this._addCheck({kind:"base64url",...M.errToObj(D)})}jwt(D){return this._addCheck({kind:"jwt",...M.errToObj(D)})}ip(D){return this._addCheck({kind:"ip",...M.errToObj(D)})}cidr(D){return this._addCheck({kind:"cidr",...M.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,...M.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,...M.errToObj(D?.message)})}duration(D){return this._addCheck({kind:"duration",...M.errToObj(D)})}regex(D,F){return this._addCheck({kind:"regex",regex:D,...M.errToObj(F)})}includes(D,F){return this._addCheck({kind:"includes",value:D,position:F?.position,...M.errToObj(F?.message)})}startsWith(D,F){return this._addCheck({kind:"startsWith",value:D,...M.errToObj(F)})}endsWith(D,F){return this._addCheck({kind:"endsWith",value:D,...M.errToObj(F)})}min(D,F){return this._addCheck({kind:"min",value:D,...M.errToObj(F)})}max(D,F){return this._addCheck({kind:"max",value:D,...M.errToObj(F)})}length(D,F){return this._addCheck({kind:"length",value:D,...M.errToObj(F)})}nonempty(D){return this.min(1,M.errToObj(D))}trim(){return new QD({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new QD({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new QD({...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}};QD.create=(D)=>{return new QD({checks:[],typeName:L.ZodString,coerce:D?.coerce??!1,...S(D)})};dD=class dD extends v{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)!==V.number){let E=this._getOrReturnCtx(D);return K(E,{code:W.invalid_type,expected:V.number,received:E.parsedType}),O}let B=void 0,$=new d;for(let E of this._def.checks)if(E.kind==="int"){if(!k.isInteger(D.data))B=this._getOrReturnCtx(D,B),K(B,{code:W.invalid_type,expected:"integer",received:"float",message:E.message}),$.dirty()}else if(E.kind==="min"){if(E.inclusive?D.data<E.value:D.data<=E.value)B=this._getOrReturnCtx(D,B),K(B,{code:W.too_small,minimum:E.value,type:"number",inclusive:E.inclusive,exact:!1,message:E.message}),$.dirty()}else if(E.kind==="max"){if(E.inclusive?D.data>E.value:D.data>=E.value)B=this._getOrReturnCtx(D,B),K(B,{code:W.too_big,maximum:E.value,type:"number",inclusive:E.inclusive,exact:!1,message:E.message}),$.dirty()}else if(E.kind==="multipleOf"){if(cB(D.data,E.value)!==0)B=this._getOrReturnCtx(D,B),K(B,{code:W.not_multiple_of,multipleOf:E.value,message:E.message}),$.dirty()}else if(E.kind==="finite"){if(!Number.isFinite(D.data))B=this._getOrReturnCtx(D,B),K(B,{code:W.not_finite,message:E.message}),$.dirty()}else k.assertNever(E);return{status:$.value,value:D.data}}gte(D,F){return this.setLimit("min",D,!0,M.toString(F))}gt(D,F){return this.setLimit("min",D,!1,M.toString(F))}lte(D,F){return this.setLimit("max",D,!0,M.toString(F))}lt(D,F){return this.setLimit("max",D,!1,M.toString(F))}setLimit(D,F,B,$){return new dD({...this._def,checks:[...this._def.checks,{kind:D,value:F,inclusive:B,message:M.toString($)}]})}_addCheck(D){return new dD({...this._def,checks:[...this._def.checks,D]})}int(D){return this._addCheck({kind:"int",message:M.toString(D)})}positive(D){return this._addCheck({kind:"min",value:0,inclusive:!1,message:M.toString(D)})}negative(D){return this._addCheck({kind:"max",value:0,inclusive:!1,message:M.toString(D)})}nonpositive(D){return this._addCheck({kind:"max",value:0,inclusive:!0,message:M.toString(D)})}nonnegative(D){return this._addCheck({kind:"min",value:0,inclusive:!0,message:M.toString(D)})}multipleOf(D,F){return this._addCheck({kind:"multipleOf",value:D,message:M.toString(F)})}finite(D){return this._addCheck({kind:"finite",message:M.toString(D)})}safe(D){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:M.toString(D)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:M.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"&&k.isInteger(D.value))}get isFinite(){let D=null,F=null;for(let B of this._def.checks)if(B.kind==="finite"||B.kind==="int"||B.kind==="multipleOf")return!0;else if(B.kind==="min"){if(F===null||B.value>F)F=B.value}else if(B.kind==="max"){if(D===null||B.value<D)D=B.value}return Number.isFinite(F)&&Number.isFinite(D)}};dD.create=(D)=>{return new dD({checks:[],typeName:L.ZodNumber,coerce:D?.coerce||!1,...S(D)})};cD=class cD extends v{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)!==V.bigint)return this._getInvalidInput(D);let B=void 0,$=new d;for(let E of this._def.checks)if(E.kind==="min"){if(E.inclusive?D.data<E.value:D.data<=E.value)B=this._getOrReturnCtx(D,B),K(B,{code:W.too_small,type:"bigint",minimum:E.value,inclusive:E.inclusive,message:E.message}),$.dirty()}else if(E.kind==="max"){if(E.inclusive?D.data>E.value:D.data>=E.value)B=this._getOrReturnCtx(D,B),K(B,{code:W.too_big,type:"bigint",maximum:E.value,inclusive:E.inclusive,message:E.message}),$.dirty()}else if(E.kind==="multipleOf"){if(D.data%E.value!==BigInt(0))B=this._getOrReturnCtx(D,B),K(B,{code:W.not_multiple_of,multipleOf:E.value,message:E.message}),$.dirty()}else k.assertNever(E);return{status:$.value,value:D.data}}_getInvalidInput(D){let F=this._getOrReturnCtx(D);return K(F,{code:W.invalid_type,expected:V.bigint,received:F.parsedType}),O}gte(D,F){return this.setLimit("min",D,!0,M.toString(F))}gt(D,F){return this.setLimit("min",D,!1,M.toString(F))}lte(D,F){return this.setLimit("max",D,!0,M.toString(F))}lt(D,F){return this.setLimit("max",D,!1,M.toString(F))}setLimit(D,F,B,$){return new cD({...this._def,checks:[...this._def.checks,{kind:D,value:F,inclusive:B,message:M.toString($)}]})}_addCheck(D){return new cD({...this._def,checks:[...this._def.checks,D]})}positive(D){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:M.toString(D)})}negative(D){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:M.toString(D)})}nonpositive(D){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:M.toString(D)})}nonnegative(D){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:M.toString(D)})}multipleOf(D,F){return this._addCheck({kind:"multipleOf",value:D,message:M.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}};cD.create=(D)=>{return new cD({checks:[],typeName:L.ZodBigInt,coerce:D?.coerce??!1,...S(D)})};w2=class w2 extends v{_parse(D){if(this._def.coerce)D.data=Boolean(D.data);if(this._getType(D)!==V.boolean){let B=this._getOrReturnCtx(D);return K(B,{code:W.invalid_type,expected:V.boolean,received:B.parsedType}),O}return o(D.data)}};w2.create=(D)=>{return new w2({typeName:L.ZodBoolean,coerce:D?.coerce||!1,...S(D)})};D2=class D2 extends v{_parse(D){if(this._def.coerce)D.data=new Date(D.data);if(this._getType(D)!==V.date){let E=this._getOrReturnCtx(D);return K(E,{code:W.invalid_type,expected:V.date,received:E.parsedType}),O}if(Number.isNaN(D.data.getTime())){let E=this._getOrReturnCtx(D);return K(E,{code:W.invalid_date}),O}let B=new d,$=void 0;for(let E of this._def.checks)if(E.kind==="min"){if(D.data.getTime()<E.value)$=this._getOrReturnCtx(D,$),K($,{code:W.too_small,message:E.message,inclusive:!0,exact:!1,minimum:E.value,type:"date"}),B.dirty()}else if(E.kind==="max"){if(D.data.getTime()>E.value)$=this._getOrReturnCtx(D,$),K($,{code:W.too_big,message:E.message,inclusive:!0,exact:!1,maximum:E.value,type:"date"}),B.dirty()}else k.assertNever(E);return{status:B.value,value:new Date(D.data.getTime())}}_addCheck(D){return new D2({...this._def,checks:[...this._def.checks,D]})}min(D,F){return this._addCheck({kind:"min",value:D.getTime(),message:M.toString(F)})}max(D,F){return this._addCheck({kind:"max",value:D.getTime(),message:M.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}};D2.create=(D)=>{return new D2({checks:[],coerce:D?.coerce||!1,typeName:L.ZodDate,...S(D)})};A0=class A0 extends v{_parse(D){if(this._getType(D)!==V.symbol){let B=this._getOrReturnCtx(D);return K(B,{code:W.invalid_type,expected:V.symbol,received:B.parsedType}),O}return o(D.data)}};A0.create=(D)=>{return new A0({typeName:L.ZodSymbol,...S(D)})};u2=class u2 extends v{_parse(D){if(this._getType(D)!==V.undefined){let B=this._getOrReturnCtx(D);return K(B,{code:W.invalid_type,expected:V.undefined,received:B.parsedType}),O}return o(D.data)}};u2.create=(D)=>{return new u2({typeName:L.ZodUndefined,...S(D)})};f2=class f2 extends v{_parse(D){if(this._getType(D)!==V.null){let B=this._getOrReturnCtx(D);return K(B,{code:W.invalid_type,expected:V.null,received:B.parsedType}),O}return o(D.data)}};f2.create=(D)=>{return new f2({typeName:L.ZodNull,...S(D)})};F2=class F2 extends v{constructor(){super(...arguments);this._any=!0}_parse(D){return o(D.data)}};F2.create=(D)=>{return new F2({typeName:L.ZodAny,...S(D)})};pD=class pD extends v{constructor(){super(...arguments);this._unknown=!0}_parse(D){return o(D.data)}};pD.create=(D)=>{return new pD({typeName:L.ZodUnknown,...S(D)})};CD=class CD extends v{_parse(D){let F=this._getOrReturnCtx(D);return K(F,{code:W.invalid_type,expected:V.never,received:F.parsedType}),O}};CD.create=(D)=>{return new CD({typeName:L.ZodNever,...S(D)})};z0=class z0 extends v{_parse(D){if(this._getType(D)!==V.undefined){let B=this._getOrReturnCtx(D);return K(B,{code:W.invalid_type,expected:V.void,received:B.parsedType}),O}return o(D.data)}};z0.create=(D)=>{return new z0({typeName:L.ZodVoid,...S(D)})};qD=class qD extends v{_parse(D){let{ctx:F,status:B}=this._processInputParams(D),$=this._def;if(F.parsedType!==V.array)return K(F,{code:W.invalid_type,expected:V.array,received:F.parsedType}),O;if($.exactLength!==null){let J=F.data.length>$.exactLength.value,X=F.data.length<$.exactLength.value;if(J||X)K(F,{code:J?W.too_big:W.too_small,minimum:X?$.exactLength.value:void 0,maximum:J?$.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:$.exactLength.message}),B.dirty()}if($.minLength!==null){if(F.data.length<$.minLength.value)K(F,{code:W.too_small,minimum:$.minLength.value,type:"array",inclusive:!0,exact:!1,message:$.minLength.message}),B.dirty()}if($.maxLength!==null){if(F.data.length>$.maxLength.value)K(F,{code:W.too_big,maximum:$.maxLength.value,type:"array",inclusive:!0,exact:!1,message:$.maxLength.message}),B.dirty()}if(F.common.async)return Promise.all([...F.data].map((J,X)=>{return $.type._parseAsync(new GD(F,J,F.path,X))})).then((J)=>{return d.mergeArray(B,J)});let E=[...F.data].map((J,X)=>{return $.type._parseSync(new GD(F,J,F.path,X))});return d.mergeArray(B,E)}get element(){return this._def.type}min(D,F){return new qD({...this._def,minLength:{value:D,message:M.toString(F)}})}max(D,F){return new qD({...this._def,maxLength:{value:D,message:M.toString(F)}})}length(D,F){return new qD({...this._def,exactLength:{value:D,message:M.toString(F)}})}nonempty(D){return this.min(1,D)}};qD.create=(D,F)=>{return new qD({type:D,minLength:null,maxLength:null,exactLength:null,typeName:L.ZodArray,...S(F)})};y=class y extends v{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=k.objectKeys(D);return this._cached={shape:D,keys:F},this._cached}_parse(D){if(this._getType(D)!==V.object){let Q=this._getOrReturnCtx(D);return K(Q,{code:W.invalid_type,expected:V.object,received:Q.parsedType}),O}let{status:B,ctx:$}=this._processInputParams(D),{shape:E,keys:J}=this._getCached(),X=[];if(!(this._def.catchall instanceof CD&&this._def.unknownKeys==="strip")){for(let Q in $.data)if(!J.includes(Q))X.push(Q)}let Y=[];for(let Q of J){let q=E[Q],H=$.data[Q];Y.push({key:{status:"valid",value:Q},value:q._parse(new GD($,H,$.path,Q)),alwaysSet:Q in $.data})}if(this._def.catchall instanceof CD){let Q=this._def.unknownKeys;if(Q==="passthrough")for(let q of X)Y.push({key:{status:"valid",value:q},value:{status:"valid",value:$.data[q]}});else if(Q==="strict"){if(X.length>0)K($,{code:W.unrecognized_keys,keys:X}),B.dirty()}else if(Q==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let Q=this._def.catchall;for(let q of X){let H=$.data[q];Y.push({key:{status:"valid",value:q},value:Q._parse(new GD($,H,$.path,q)),alwaysSet:q in $.data})}}if($.common.async)return Promise.resolve().then(async()=>{let Q=[];for(let q of Y){let H=await q.key,G=await q.value;Q.push({key:H,value:G,alwaysSet:q.alwaysSet})}return Q}).then((Q)=>{return d.mergeObjectSync(B,Q)});else return d.mergeObjectSync(B,Y)}get shape(){return this._def.shape()}strict(D){return M.errToObj,new y({...this._def,unknownKeys:"strict",...D!==void 0?{errorMap:(F,B)=>{let $=this._def.errorMap?.(F,B).message??B.defaultError;if(F.code==="unrecognized_keys")return{message:M.errToObj(D).message??$};return{message:$}}}:{}})}strip(){return new y({...this._def,unknownKeys:"strip"})}passthrough(){return new y({...this._def,unknownKeys:"passthrough"})}extend(D){return new y({...this._def,shape:()=>({...this._def.shape(),...D})})}merge(D){return new y({unknownKeys:D._def.unknownKeys,catchall:D._def.catchall,shape:()=>({...this._def.shape(),...D._def.shape()}),typeName:L.ZodObject})}setKey(D,F){return this.augment({[D]:F})}catchall(D){return new y({...this._def,catchall:D})}pick(D){let F={};for(let B of k.objectKeys(D))if(D[B]&&this.shape[B])F[B]=this.shape[B];return new y({...this._def,shape:()=>F})}omit(D){let F={};for(let B of k.objectKeys(this.shape))if(!D[B])F[B]=this.shape[B];return new y({...this._def,shape:()=>F})}deepPartial(){return k2(this)}partial(D){let F={};for(let B of k.objectKeys(this.shape)){let $=this.shape[B];if(D&&!D[B])F[B]=$;else F[B]=$.optional()}return new y({...this._def,shape:()=>F})}required(D){let F={};for(let B of k.objectKeys(this.shape))if(D&&!D[B])F[B]=this.shape[B];else{let E=this.shape[B];while(E instanceof HD)E=E._def.innerType;F[B]=E}return new y({...this._def,shape:()=>F})}keyof(){return D5(k.objectKeys(this.shape))}};y.create=(D,F)=>{return new y({shape:()=>D,unknownKeys:"strip",catchall:CD.create(),typeName:L.ZodObject,...S(F)})};y.strictCreate=(D,F)=>{return new y({shape:()=>D,unknownKeys:"strict",catchall:CD.create(),typeName:L.ZodObject,...S(F)})};y.lazycreate=(D,F)=>{return new y({shape:D,unknownKeys:"strip",catchall:CD.create(),typeName:L.ZodObject,...S(F)})};x2=class x2 extends v{_parse(D){let{ctx:F}=this._processInputParams(D),B=this._def.options;function $(E){for(let X of E)if(X.result.status==="valid")return X.result;for(let X of E)if(X.result.status==="dirty")return F.common.issues.push(...X.ctx.common.issues),X.result;let J=E.map((X)=>new e(X.ctx.common.issues));return K(F,{code:W.invalid_union,unionErrors:J}),O}if(F.common.async)return Promise.all(B.map(async(E)=>{let J={...F,common:{...F.common,issues:[]},parent:null};return{result:await E._parseAsync({data:F.data,path:F.path,parent:J}),ctx:J}})).then($);else{let E=void 0,J=[];for(let Y of B){let Q={...F,common:{...F.common,issues:[]},parent:null},q=Y._parseSync({data:F.data,path:F.path,parent:Q});if(q.status==="valid")return q;else if(q.status==="dirty"&&!E)E={result:q,ctx:Q};if(Q.common.issues.length)J.push(Q.common.issues)}if(E)return F.common.issues.push(...E.ctx.common.issues),E.result;let X=J.map((Y)=>new e(Y));return K(F,{code:W.invalid_union,unionErrors:X}),O}}get options(){return this._def.options}};x2.create=(D,F)=>{return new x2({options:D,typeName:L.ZodUnion,...S(F)})};L3=class L3 extends v{_parse(D){let{ctx:F}=this._processInputParams(D);if(F.parsedType!==V.object)return K(F,{code:W.invalid_type,expected:V.object,received:F.parsedType}),O;let B=this.discriminator,$=F.data[B],E=this.optionsMap.get($);if(!E)return K(F,{code:W.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[B]}),O;if(F.common.async)return E._parseAsync({data:F.data,path:F.path,parent:F});else return E._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,B){let $=new Map;for(let E of F){let J=ID(E.shape[D]);if(!J.length)throw Error(`A discriminator value for key \`${D}\` could not be extracted from all schema options`);for(let X of J){if($.has(X))throw Error(`Discriminator property ${String(D)} has duplicate value ${String(X)}`);$.set(X,E)}}return new L3({typeName:L.ZodDiscriminatedUnion,discriminator:D,options:F,optionsMap:$,...S(B)})}};y2=class y2 extends v{_parse(D){let{status:F,ctx:B}=this._processInputParams(D),$=(E,J)=>{if(C3(E)||C3(J))return O;let X=y8(E.value,J.value);if(!X.valid)return K(B,{code:W.invalid_intersection_types}),O;if(O3(E)||O3(J))F.dirty();return{status:F.value,value:X.data}};if(B.common.async)return Promise.all([this._def.left._parseAsync({data:B.data,path:B.path,parent:B}),this._def.right._parseAsync({data:B.data,path:B.path,parent:B})]).then(([E,J])=>$(E,J));else return $(this._def.left._parseSync({data:B.data,path:B.path,parent:B}),this._def.right._parseSync({data:B.data,path:B.path,parent:B}))}};y2.create=(D,F,B)=>{return new y2({left:D,right:F,typeName:L.ZodIntersection,...S(B)})};OD=class OD extends v{_parse(D){let{status:F,ctx:B}=this._processInputParams(D);if(B.parsedType!==V.array)return K(B,{code:W.invalid_type,expected:V.array,received:B.parsedType}),O;if(B.data.length<this._def.items.length)return K(B,{code:W.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),O;if(!this._def.rest&&B.data.length>this._def.items.length)K(B,{code:W.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),F.dirty();let E=[...B.data].map((J,X)=>{let Y=this._def.items[X]||this._def.rest;if(!Y)return null;return Y._parse(new GD(B,J,B.path,X))}).filter((J)=>!!J);if(B.common.async)return Promise.all(E).then((J)=>{return d.mergeArray(F,J)});else return d.mergeArray(F,E)}get items(){return this._def.items}rest(D){return new OD({...this._def,rest:D})}};OD.create=(D,F)=>{if(!Array.isArray(D))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new OD({items:D,typeName:L.ZodTuple,rest:null,...S(F)})};M0=class M0 extends v{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(D){let{status:F,ctx:B}=this._processInputParams(D);if(B.parsedType!==V.object)return K(B,{code:W.invalid_type,expected:V.object,received:B.parsedType}),O;let $=[],E=this._def.keyType,J=this._def.valueType;for(let X in B.data)$.push({key:E._parse(new GD(B,X,B.path,X)),value:J._parse(new GD(B,B.data[X],B.path,X)),alwaysSet:X in B.data});if(B.common.async)return d.mergeObjectAsync(F,$);else return d.mergeObjectSync(F,$)}get element(){return this._def.valueType}static create(D,F,B){if(F instanceof v)return new M0({keyType:D,valueType:F,typeName:L.ZodRecord,...S(B)});return new M0({keyType:QD.create(),valueType:D,typeName:L.ZodRecord,...S(F)})}};R0=class R0 extends v{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(D){let{status:F,ctx:B}=this._processInputParams(D);if(B.parsedType!==V.map)return K(B,{code:W.invalid_type,expected:V.map,received:B.parsedType}),O;let $=this._def.keyType,E=this._def.valueType,J=[...B.data.entries()].map(([X,Y],Q)=>{return{key:$._parse(new GD(B,X,B.path,[Q,"key"])),value:E._parse(new GD(B,Y,B.path,[Q,"value"]))}});if(B.common.async){let X=new Map;return Promise.resolve().then(async()=>{for(let Y of J){let Q=await Y.key,q=await Y.value;if(Q.status==="aborted"||q.status==="aborted")return O;if(Q.status==="dirty"||q.status==="dirty")F.dirty();X.set(Q.value,q.value)}return{status:F.value,value:X}})}else{let X=new Map;for(let Y of J){let{key:Q,value:q}=Y;if(Q.status==="aborted"||q.status==="aborted")return O;if(Q.status==="dirty"||q.status==="dirty")F.dirty();X.set(Q.value,q.value)}return{status:F.value,value:X}}}};R0.create=(D,F,B)=>{return new R0({valueType:F,keyType:D,typeName:L.ZodMap,...S(B)})};B2=class B2 extends v{_parse(D){let{status:F,ctx:B}=this._processInputParams(D);if(B.parsedType!==V.set)return K(B,{code:W.invalid_type,expected:V.set,received:B.parsedType}),O;let $=this._def;if($.minSize!==null){if(B.data.size<$.minSize.value)K(B,{code:W.too_small,minimum:$.minSize.value,type:"set",inclusive:!0,exact:!1,message:$.minSize.message}),F.dirty()}if($.maxSize!==null){if(B.data.size>$.maxSize.value)K(B,{code:W.too_big,maximum:$.maxSize.value,type:"set",inclusive:!0,exact:!1,message:$.maxSize.message}),F.dirty()}let E=this._def.valueType;function J(Y){let Q=new Set;for(let q of Y){if(q.status==="aborted")return O;if(q.status==="dirty")F.dirty();Q.add(q.value)}return{status:F.value,value:Q}}let X=[...B.data.values()].map((Y,Q)=>E._parse(new GD(B,Y,B.path,Q)));if(B.common.async)return Promise.all(X).then((Y)=>J(Y));else return J(X)}min(D,F){return new B2({...this._def,minSize:{value:D,message:M.toString(F)}})}max(D,F){return new B2({...this._def,maxSize:{value:D,message:M.toString(F)}})}size(D,F){return this.min(D,F).max(D,F)}nonempty(D){return this.min(1,D)}};B2.create=(D,F)=>{return new B2({valueType:D,minSize:null,maxSize:null,typeName:L.ZodSet,...S(F)})};P2=class P2 extends v{constructor(){super(...arguments);this.validate=this.implement}_parse(D){let{ctx:F}=this._processInputParams(D);if(F.parsedType!==V.function)return K(F,{code:W.invalid_type,expected:V.function,received:F.parsedType}),O;function B(X,Y){return K0({data:X,path:F.path,errorMaps:[F.common.contextualErrorMap,F.schemaErrorMap,I2(),bD].filter((Q)=>!!Q),issueData:{code:W.invalid_arguments,argumentsError:Y}})}function $(X,Y){return K0({data:X,path:F.path,errorMaps:[F.common.contextualErrorMap,F.schemaErrorMap,I2(),bD].filter((Q)=>!!Q),issueData:{code:W.invalid_return_type,returnTypeError:Y}})}let E={errorMap:F.common.contextualErrorMap},J=F.data;if(this._def.returns instanceof $2){let X=this;return o(async function(...Y){let Q=new e([]),q=await X._def.args.parseAsync(Y,E).catch((U)=>{throw Q.addIssue(B(Y,U)),Q}),H=await Reflect.apply(J,this,q);return await X._def.returns._def.type.parseAsync(H,E).catch((U)=>{throw Q.addIssue($(H,U)),Q})})}else{let X=this;return o(function(...Y){let Q=X._def.args.safeParse(Y,E);if(!Q.success)throw new e([B(Y,Q.error)]);let q=Reflect.apply(J,this,Q.data),H=X._def.returns.safeParse(q,E);if(!H.success)throw new e([$(q,H.error)]);return H.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...D){return new P2({...this._def,args:OD.create(D).rest(pD.create())})}returns(D){return new P2({...this._def,returns:D})}implement(D){return this.parse(D)}strictImplement(D){return this.parse(D)}static create(D,F,B){return new P2({args:D?D:OD.create([]).rest(pD.create()),returns:F||pD.create(),typeName:L.ZodFunction,...S(B)})}};h2=class h2 extends v{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})}};h2.create=(D,F)=>{return new h2({getter:D,typeName:L.ZodLazy,...S(F)})};g2=class g2 extends v{_parse(D){if(D.data!==this._def.value){let F=this._getOrReturnCtx(D);return K(F,{received:F.data,code:W.invalid_literal,expected:this._def.value}),O}return{status:"valid",value:D.data}}get value(){return this._def.value}};g2.create=(D,F)=>{return new g2({value:D,typeName:L.ZodLiteral,...S(F)})};iD=class iD extends v{_parse(D){if(typeof D.data!=="string"){let F=this._getOrReturnCtx(D),B=this._def.values;return K(F,{expected:k.joinValues(B),received:F.parsedType,code:W.invalid_type}),O}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(D.data)){let F=this._getOrReturnCtx(D),B=this._def.values;return K(F,{received:F.data,code:W.invalid_enum_value,options:B}),O}return o(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 iD.create(D,{...this._def,...F})}exclude(D,F=this._def){return iD.create(this.options.filter((B)=>!D.includes(B)),{...this._def,...F})}};iD.create=D5;l2=class l2 extends v{_parse(D){let F=k.getValidEnumValues(this._def.values),B=this._getOrReturnCtx(D);if(B.parsedType!==V.string&&B.parsedType!==V.number){let $=k.objectValues(F);return K(B,{expected:k.joinValues($),received:B.parsedType,code:W.invalid_type}),O}if(!this._cache)this._cache=new Set(k.getValidEnumValues(this._def.values));if(!this._cache.has(D.data)){let $=k.objectValues(F);return K(B,{received:B.data,code:W.invalid_enum_value,options:$}),O}return o(D.data)}get enum(){return this._def.values}};l2.create=(D,F)=>{return new l2({values:D,typeName:L.ZodNativeEnum,...S(F)})};$2=class $2 extends v{unwrap(){return this._def.type}_parse(D){let{ctx:F}=this._processInputParams(D);if(F.parsedType!==V.promise&&F.common.async===!1)return K(F,{code:W.invalid_type,expected:V.promise,received:F.parsedType}),O;let B=F.parsedType===V.promise?F.data:Promise.resolve(F.data);return o(B.then(($)=>{return this._def.type.parseAsync($,{path:F.path,errorMap:F.common.contextualErrorMap})}))}};$2.create=(D,F)=>{return new $2({type:D,typeName:L.ZodPromise,...S(F)})};WD=class WD extends v{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===L.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(D){let{status:F,ctx:B}=this._processInputParams(D),$=this._def.effect||null,E={addIssue:(J)=>{if(K(B,J),J.fatal)F.abort();else F.dirty()},get path(){return B.path}};if(E.addIssue=E.addIssue.bind(E),$.type==="preprocess"){let J=$.transform(B.data,E);if(B.common.async)return Promise.resolve(J).then(async(X)=>{if(F.value==="aborted")return O;let Y=await this._def.schema._parseAsync({data:X,path:B.path,parent:B});if(Y.status==="aborted")return O;if(Y.status==="dirty")return eD(Y.value);if(F.value==="dirty")return eD(Y.value);return Y});else{if(F.value==="aborted")return O;let X=this._def.schema._parseSync({data:J,path:B.path,parent:B});if(X.status==="aborted")return O;if(X.status==="dirty")return eD(X.value);if(F.value==="dirty")return eD(X.value);return X}}if($.type==="refinement"){let J=(X)=>{let Y=$.refinement(X,E);if(B.common.async)return Promise.resolve(Y);if(Y instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return X};if(B.common.async===!1){let X=this._def.schema._parseSync({data:B.data,path:B.path,parent:B});if(X.status==="aborted")return O;if(X.status==="dirty")F.dirty();return J(X.value),{status:F.value,value:X.value}}else return this._def.schema._parseAsync({data:B.data,path:B.path,parent:B}).then((X)=>{if(X.status==="aborted")return O;if(X.status==="dirty")F.dirty();return J(X.value).then(()=>{return{status:F.value,value:X.value}})})}if($.type==="transform")if(B.common.async===!1){let J=this._def.schema._parseSync({data:B.data,path:B.path,parent:B});if(!mD(J))return O;let X=$.transform(J.value,E);if(X instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:F.value,value:X}}else return this._def.schema._parseAsync({data:B.data,path:B.path,parent:B}).then((J)=>{if(!mD(J))return O;return Promise.resolve($.transform(J.value,E)).then((X)=>({status:F.value,value:X}))});k.assertNever($)}};WD.create=(D,F,B)=>{return new WD({schema:D,typeName:L.ZodEffects,effect:F,...S(B)})};WD.createWithPreprocess=(D,F,B)=>{return new WD({schema:F,effect:{type:"preprocess",transform:D},typeName:L.ZodEffects,...S(B)})};HD=class HD extends v{_parse(D){if(this._getType(D)===V.undefined)return o(void 0);return this._def.innerType._parse(D)}unwrap(){return this._def.innerType}};HD.create=(D,F)=>{return new HD({innerType:D,typeName:L.ZodOptional,...S(F)})};vD=class vD extends v{_parse(D){if(this._getType(D)===V.null)return o(null);return this._def.innerType._parse(D)}unwrap(){return this._def.innerType}};vD.create=(D,F)=>{return new vD({innerType:D,typeName:L.ZodNullable,...S(F)})};m2=class m2 extends v{_parse(D){let{ctx:F}=this._processInputParams(D),B=F.data;if(F.parsedType===V.undefined)B=this._def.defaultValue();return this._def.innerType._parse({data:B,path:F.path,parent:F})}removeDefault(){return this._def.innerType}};m2.create=(D,F)=>{return new m2({innerType:D,typeName:L.ZodDefault,defaultValue:typeof F.default==="function"?F.default:()=>F.default,...S(F)})};p2=class p2 extends v{_parse(D){let{ctx:F}=this._processInputParams(D),B={...F,common:{...F.common,issues:[]}},$=this._def.innerType._parse({data:B.data,path:B.path,parent:{...B}});if(v2($))return $.then((E)=>{return{status:"valid",value:E.status==="valid"?E.value:this._def.catchValue({get error(){return new e(B.common.issues)},input:B.data})}});else return{status:"valid",value:$.status==="valid"?$.value:this._def.catchValue({get error(){return new e(B.common.issues)},input:B.data})}}removeCatch(){return this._def.innerType}};p2.create=(D,F)=>{return new p2({innerType:D,typeName:L.ZodCatch,catchValue:typeof F.catch==="function"?F.catch:()=>F.catch,...S(F)})};C0=class C0 extends v{_parse(D){if(this._getType(D)!==V.nan){let B=this._getOrReturnCtx(D);return K(B,{code:W.invalid_type,expected:V.nan,received:B.parsedType}),O}return{status:"valid",value:D.data}}};C0.create=(D)=>{return new C0({typeName:L.ZodNaN,...S(D)})};iB=Symbol("zod_brand");j3=class j3 extends v{_parse(D){let{ctx:F}=this._processInputParams(D),B=F.data;return this._def.type._parse({data:B,path:F.path,parent:F})}unwrap(){return this._def.type}};O0=class O0 extends v{_parse(D){let{status:F,ctx:B}=this._processInputParams(D);if(B.common.async)return(async()=>{let E=await this._def.in._parseAsync({data:B.data,path:B.path,parent:B});if(E.status==="aborted")return O;if(E.status==="dirty")return F.dirty(),eD(E.value);else return this._def.out._parseAsync({data:E.value,path:B.path,parent:B})})();else{let $=this._def.in._parseSync({data:B.data,path:B.path,parent:B});if($.status==="aborted")return O;if($.status==="dirty")return F.dirty(),{status:"dirty",value:$.value};else return this._def.out._parseSync({data:$.value,path:B.path,parent:B})}}static create(D,F){return new O0({in:D,out:F,typeName:L.ZodPipeline})}};d2=class d2 extends v{_parse(D){let F=this._def.innerType._parse(D),B=($)=>{if(mD($))$.value=Object.freeze($.value);return $};return v2(F)?F.then(($)=>B($)):B(F)}unwrap(){return this._def.innerType}};d2.create=(D,F)=>{return new d2({innerType:D,typeName:L.ZodReadonly,...S(F)})};nB={object:y.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"})(L||(L={}));B5=QD.create,$5=dD.create,oB=C0.create,sB=cD.create,E5=w2.create,aB=D2.create,tB=A0.create,eB=u2.create,D$=f2.create,F$=F2.create,B$=pD.create,$$=CD.create,E$=z0.create,J$=qD.create,X$=y.create,Y$=y.strictCreate,Q$=x2.create,q$=L3.create,H$=y2.create,G$=OD.create,W$=M0.create,U$=R0.create,V$=B2.create,_$=P2.create,K$=h2.create,A$=g2.create,z$=iD.create,M$=l2.create,R$=$2.create,C$=WD.create,O$=HD.create,L$=vD.create,j$=WD.createWithPreprocess,S$=O0.create,b$={string:(D)=>QD.create({...D,coerce:!0}),number:(D)=>dD.create({...D,coerce:!0}),boolean:(D)=>w2.create({...D,coerce:!0}),bigint:(D)=>cD.create({...D,coerce:!0}),date:(D)=>D2.create({...D,coerce:!0})},I$=O});var _={};t(_,{void:()=>E$,util:()=>k,unknown:()=>B$,union:()=>Q$,undefined:()=>eB,tuple:()=>G$,transformer:()=>C$,symbol:()=>tB,string:()=>B5,strictObject:()=>Y$,setErrorMap:()=>LB,set:()=>V$,record:()=>W$,quotelessJson:()=>CB,promise:()=>R$,preprocess:()=>j$,pipeline:()=>S$,ostring:()=>T$,optional:()=>O$,onumber:()=>Z$,oboolean:()=>N$,objectUtil:()=>w8,object:()=>X$,number:()=>$5,nullable:()=>L$,null:()=>D$,never:()=>$$,nativeEnum:()=>M$,nan:()=>oB,map:()=>U$,makeIssue:()=>K0,literal:()=>A$,lazy:()=>K$,late:()=>nB,isValid:()=>mD,isDirty:()=>O3,isAsync:()=>v2,isAborted:()=>C3,intersection:()=>H$,instanceof:()=>rB,getParsedType:()=>RD,getErrorMap:()=>I2,function:()=>_$,enum:()=>z$,effect:()=>C$,discriminatedUnion:()=>q$,defaultErrorMap:()=>bD,datetimeRegex:()=>e1,date:()=>aB,custom:()=>F5,coerce:()=>b$,boolean:()=>E5,bigint:()=>sB,array:()=>J$,any:()=>F$,addIssueToContext:()=>K,ZodVoid:()=>z0,ZodUnknown:()=>pD,ZodUnion:()=>x2,ZodUndefined:()=>u2,ZodType:()=>v,ZodTuple:()=>OD,ZodTransformer:()=>WD,ZodSymbol:()=>A0,ZodString:()=>QD,ZodSet:()=>B2,ZodSchema:()=>v,ZodRecord:()=>M0,ZodReadonly:()=>d2,ZodPromise:()=>$2,ZodPipeline:()=>O0,ZodParsedType:()=>V,ZodOptional:()=>HD,ZodObject:()=>y,ZodNumber:()=>dD,ZodNullable:()=>vD,ZodNull:()=>f2,ZodNever:()=>CD,ZodNativeEnum:()=>l2,ZodNaN:()=>C0,ZodMap:()=>R0,ZodLiteral:()=>g2,ZodLazy:()=>h2,ZodIssueCode:()=>W,ZodIntersection:()=>y2,ZodFunction:()=>P2,ZodFirstPartyTypeKind:()=>L,ZodError:()=>e,ZodEnum:()=>iD,ZodEffects:()=>WD,ZodDiscriminatedUnion:()=>L3,ZodDefault:()=>m2,ZodDate:()=>D2,ZodCatch:()=>p2,ZodBranded:()=>j3,ZodBoolean:()=>w2,ZodBigInt:()=>cD,ZodArray:()=>qD,ZodAny:()=>F2,Schema:()=>v,ParseStatus:()=>d,OK:()=>o,NEVER:()=>I$,INVALID:()=>O,EMPTY_PATH:()=>jB,DIRTY:()=>eD,BRAND:()=>iB});var h8=Z(()=>{R3();f8();n1();_0();J5();M3()});var S3=Z(()=>{h8();h8()});var v$,k$,P$,w$,u$,f$,x$,y$,kD;var X5=Z(()=>{S3();v$=_.object({name:_.string().default("genie"),defaultWindow:_.string().default("shell"),autoCreate:_.boolean().default(!0)}),k$=_.object({execTimeout:_.number().default(120000),readLines:_.number().default(100),worktreeBase:_.string().default(".worktrees")}),P$=_.object({tmuxDebug:_.boolean().default(!1),verbose:_.boolean().default(!1)}),w$=_.object({preference:_.enum(["auto","zsh","bash","fish"]).default("auto")}),u$=_.object({tmuxInstalled:_.boolean().default(!1),shellInstalled:_.boolean().default(!1)}),f$=_.object({configured:_.boolean().default(!1)}),x$=_.object({launcher:_.preprocess((D)=>D==="claudio"?"claude":D,_.literal("claude")),claudeArgs:_.array(_.string())}).passthrough(),y$=_.object({left:_.string(),right:_.string(),skill:_.string().default("council")}),kD=_.object({version:_.number().default(2),session:v$.default({}),terminal:k$.default({}),logging:P$.default({}),shell:w$.default({}),shortcuts:u$.default({}),codex:f$.optional(),installMethod:_.enum(["source","npm","bun"]).optional(),updateChannel:_.enum(["latest","next"]).default("latest"),setupComplete:_.boolean().default(!1),lastSetupAt:_.string().optional(),sourcePath:_.string().optional(),workerProfiles:_.record(_.string(),x$).optional(),defaultWorkerProfile:_.string().optional(),councilPresets:_.record(_.string(),y$).optional(),defaultCouncilPreset:_.string().optional(),promptMode:_.enum(["append","system"]).default("append"),autoMergeDev:_.boolean().default(!1)})});import{existsSync as Z3,mkdirSync as h$,readFileSync as Y5,writeFileSync as g$}from"fs";import{homedir as Q5}from"os";import{join as q5}from"path";function H5(){return T3}function L0(){return E2}function J2(){return Z3(E2)}function l$(){if(!Z3(T3))h$(T3,{recursive:!0})}async function ED(){if(!Z3(E2))return kD.parse({});try{let D=Y5(E2,"utf-8"),F=JSON.parse(D);return kD.parse(F)}catch(D){let F=D instanceof Error?D.message:String(D);return console.warn(`Warning: Invalid genie config, using defaults: ${F}`),kD.parse({})}}async function LD(D){l$();try{let F=kD.parse(D),B=JSON.stringify(F,null,2);g$(E2,B,"utf-8")}catch(F){let B=F instanceof Error?F.message:String(F);throw Error(`Failed to save genie config: ${B}`)}}function m$(){return kD.parse({})}function c2(){if(!Z3(E2))return kD.parse({});try{let D=Y5(E2,"utf-8"),F=JSON.parse(D);return kD.parse(F)}catch{return kD.parse({})}}function JD(D){let F=Q5();if(D.startsWith(`${F}/`))return`~${D.slice(F.length)}`;if(D===F)return"~";return D}function G5(){return c2().terminal}function W5(){if(!J2())return!1;return c2().setupComplete??!1}async function U5(){let D=await ED();D.setupComplete=!0,D.lastSetupAt=new Date().toISOString(),await LD(D)}async function V5(){let D=m$();await LD(D)}async function _5(D){let F=await ED();F.shortcuts={...F.shortcuts,...D},await LD(F)}var T3,E2;var PD=Z(()=>{X5();T3=q5(Q5(),".genie"),E2=q5(T3,"config.json")});var v3=l((IG,C5)=>{var DE=P("tty"),FE=DE?.WriteStream?.prototype?.hasColors?.()??!1,N=(D,F)=>{if(!FE)return(E)=>E;let B=`\x1B[${D}m`,$=`\x1B[${F}m`;return(E)=>{let J=E+"",X=J.indexOf($);if(X===-1)return B+J+$;let Y=B,Q=0,H=(F===22?$:"")+B;while(X!==-1)Y+=J.slice(Q,X)+H,Q=X+$.length,X=J.indexOf($,Q);return Y+=J.slice(Q)+$,Y}},T={};T.reset=N(0,0);T.bold=N(1,22);T.dim=N(2,22);T.italic=N(3,23);T.underline=N(4,24);T.overline=N(53,55);T.inverse=N(7,27);T.hidden=N(8,28);T.strikethrough=N(9,29);T.black=N(30,39);T.red=N(31,39);T.green=N(32,39);T.yellow=N(33,39);T.blue=N(34,39);T.magenta=N(35,39);T.cyan=N(36,39);T.white=N(37,39);T.gray=N(90,39);T.bgBlack=N(40,49);T.bgRed=N(41,49);T.bgGreen=N(42,49);T.bgYellow=N(43,49);T.bgBlue=N(44,49);T.bgMagenta=N(45,49);T.bgCyan=N(46,49);T.bgWhite=N(47,49);T.bgGray=N(100,49);T.redBright=N(91,39);T.greenBright=N(92,39);T.yellowBright=N(93,39);T.blueBright=N(94,39);T.magentaBright=N(95,39);T.cyanBright=N(96,39);T.whiteBright=N(97,39);T.bgRedBright=N(101,49);T.bgGreenBright=N(102,49);T.bgYellowBright=N(103,49);T.bgBlueBright=N(104,49);T.bgMagentaBright=N(105,49);T.bgCyanBright=N(106,49);T.bgWhiteBright=N(107,49);C5.exports=T});var N5=l((sG,Z5)=>{Z5.exports=qE;function QE(D){let F={defaultWidth:0,output:process.stdout,tty:P("tty")};if(!D)return F;return Object.keys(F).forEach(function(B){if(!D[B])D[B]=F[B]}),D}function qE(D){let F=QE(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 B=parseInt(process.env.CLI_WIDTH,10);if(!isNaN(B)&&B!==0)return B}return F.defaultWidth}});var I5=l((aG,b5)=>{b5.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 n8=l((tG,v5)=>{var HE=I5();v5.exports=(D)=>typeof D==="string"?D.replace(HE(),""):D});var P5=l((eG,r8)=>{var k5=(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};r8.exports=k5;r8.exports.default=k5});var u5=l((DW,w5)=>{w5.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 x5=l((FW,o8)=>{var GE=n8(),WE=P5(),UE=u5(),f5=(D)=>{if(typeof D!=="string"||D.length===0)return 0;if(D=GE(D),D.length===0)return 0;D=D.replace(UE()," ");let F=0;for(let B=0;B<D.length;B++){let $=D.codePointAt(B);if($<=31||$>=127&&$<=159)continue;if($>=768&&$<=879)continue;if($>65535)B++;F+=WE($)?2:1}return F};o8.exports=f5;o8.exports.default=f5});var h5=l((BW,y5)=>{y5.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 s8=l(($W,l5)=>{var b0=h5(),g5={};for(let D of Object.keys(b0))g5[b0[D]]=D;var R={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"]}};l5.exports=R;for(let D of Object.keys(R)){if(!("channels"in R[D]))throw Error("missing channels property: "+D);if(!("labels"in R[D]))throw Error("missing channel labels property: "+D);if(R[D].labels.length!==R[D].channels)throw Error("channel and label counts mismatch: "+D);let{channels:F,labels:B}=R[D];delete R[D].channels,delete R[D].labels,Object.defineProperty(R[D],"channels",{value:F}),Object.defineProperty(R[D],"labels",{value:B})}R.rgb.hsl=function(D){let F=D[0]/255,B=D[1]/255,$=D[2]/255,E=Math.min(F,B,$),J=Math.max(F,B,$),X=J-E,Y,Q;if(J===E)Y=0;else if(F===J)Y=(B-$)/X;else if(B===J)Y=2+($-F)/X;else if($===J)Y=4+(F-B)/X;if(Y=Math.min(Y*60,360),Y<0)Y+=360;let q=(E+J)/2;if(J===E)Q=0;else if(q<=0.5)Q=X/(J+E);else Q=X/(2-J-E);return[Y,Q*100,q*100]};R.rgb.hsv=function(D){let F,B,$,E,J,X=D[0]/255,Y=D[1]/255,Q=D[2]/255,q=Math.max(X,Y,Q),H=q-Math.min(X,Y,Q),G=function(U){return(q-U)/6/H+0.5};if(H===0)E=0,J=0;else{if(J=H/q,F=G(X),B=G(Y),$=G(Q),X===q)E=$-B;else if(Y===q)E=0.3333333333333333+F-$;else if(Q===q)E=0.6666666666666666+B-F;if(E<0)E+=1;else if(E>1)E-=1}return[E*360,J*100,q*100]};R.rgb.hwb=function(D){let F=D[0],B=D[1],$=D[2],E=R.rgb.hsl(D)[0],J=0.00392156862745098*Math.min(F,Math.min(B,$));return $=1-0.00392156862745098*Math.max(F,Math.max(B,$)),[E,J*100,$*100]};R.rgb.cmyk=function(D){let F=D[0]/255,B=D[1]/255,$=D[2]/255,E=Math.min(1-F,1-B,1-$),J=(1-F-E)/(1-E)||0,X=(1-B-E)/(1-E)||0,Y=(1-$-E)/(1-E)||0;return[J*100,X*100,Y*100,E*100]};function VE(D,F){return(D[0]-F[0])**2+(D[1]-F[1])**2+(D[2]-F[2])**2}R.rgb.keyword=function(D){let F=g5[D];if(F)return F;let B=1/0,$;for(let E of Object.keys(b0)){let J=b0[E],X=VE(D,J);if(X<B)B=X,$=E}return $};R.keyword.rgb=function(D){return b0[D]};R.rgb.xyz=function(D){let F=D[0]/255,B=D[1]/255,$=D[2]/255;F=F>0.04045?((F+0.055)/1.055)**2.4:F/12.92,B=B>0.04045?((B+0.055)/1.055)**2.4:B/12.92,$=$>0.04045?(($+0.055)/1.055)**2.4:$/12.92;let E=F*0.4124+B*0.3576+$*0.1805,J=F*0.2126+B*0.7152+$*0.0722,X=F*0.0193+B*0.1192+$*0.9505;return[E*100,J*100,X*100]};R.rgb.lab=function(D){let F=R.rgb.xyz(D),B=F[0],$=F[1],E=F[2];B/=95.047,$/=100,E/=108.883,B=B>0.008856?B**0.3333333333333333:7.787*B+0.13793103448275862,$=$>0.008856?$**0.3333333333333333:7.787*$+0.13793103448275862,E=E>0.008856?E**0.3333333333333333:7.787*E+0.13793103448275862;let J=116*$-16,X=500*(B-$),Y=200*($-E);return[J,X,Y]};R.hsl.rgb=function(D){let F=D[0]/360,B=D[1]/100,$=D[2]/100,E,J,X;if(B===0)return X=$*255,[X,X,X];if($<0.5)E=$*(1+B);else E=$+B-$*B;let Y=2*$-E,Q=[0,0,0];for(let q=0;q<3;q++){if(J=F+0.3333333333333333*-(q-1),J<0)J++;if(J>1)J--;if(6*J<1)X=Y+(E-Y)*6*J;else if(2*J<1)X=E;else if(3*J<2)X=Y+(E-Y)*(0.6666666666666666-J)*6;else X=Y;Q[q]=X*255}return Q};R.hsl.hsv=function(D){let F=D[0],B=D[1]/100,$=D[2]/100,E=B,J=Math.max($,0.01);$*=2,B*=$<=1?$:2-$,E*=J<=1?J:2-J;let X=($+B)/2,Y=$===0?2*E/(J+E):2*B/($+B);return[F,Y*100,X*100]};R.hsv.rgb=function(D){let F=D[0]/60,B=D[1]/100,$=D[2]/100,E=Math.floor(F)%6,J=F-Math.floor(F),X=255*$*(1-B),Y=255*$*(1-B*J),Q=255*$*(1-B*(1-J));switch($*=255,E){case 0:return[$,Q,X];case 1:return[Y,$,X];case 2:return[X,$,Q];case 3:return[X,Y,$];case 4:return[Q,X,$];case 5:return[$,X,Y]}};R.hsv.hsl=function(D){let F=D[0],B=D[1]/100,$=D[2]/100,E=Math.max($,0.01),J,X;X=(2-B)*$;let Y=(2-B)*E;return J=B*E,J/=Y<=1?Y:2-Y,J=J||0,X/=2,[F,J*100,X*100]};R.hwb.rgb=function(D){let F=D[0]/360,B=D[1]/100,$=D[2]/100,E=B+$,J;if(E>1)B/=E,$/=E;let X=Math.floor(6*F),Y=1-$;if(J=6*F-X,(X&1)!==0)J=1-J;let Q=B+J*(Y-B),q,H,G;switch(X){default:case 6:case 0:q=Y,H=Q,G=B;break;case 1:q=Q,H=Y,G=B;break;case 2:q=B,H=Y,G=Q;break;case 3:q=B,H=Q,G=Y;break;case 4:q=Q,H=B,G=Y;break;case 5:q=Y,H=B,G=Q;break}return[q*255,H*255,G*255]};R.cmyk.rgb=function(D){let F=D[0]/100,B=D[1]/100,$=D[2]/100,E=D[3]/100,J=1-Math.min(1,F*(1-E)+E),X=1-Math.min(1,B*(1-E)+E),Y=1-Math.min(1,$*(1-E)+E);return[J*255,X*255,Y*255]};R.xyz.rgb=function(D){let F=D[0]/100,B=D[1]/100,$=D[2]/100,E,J,X;return E=F*3.2406+B*-1.5372+$*-0.4986,J=F*-0.9689+B*1.8758+$*0.0415,X=F*0.0557+B*-0.204+$*1.057,E=E>0.0031308?1.055*E**0.4166666666666667-0.055:E*12.92,J=J>0.0031308?1.055*J**0.4166666666666667-0.055:J*12.92,X=X>0.0031308?1.055*X**0.4166666666666667-0.055:X*12.92,E=Math.min(Math.max(0,E),1),J=Math.min(Math.max(0,J),1),X=Math.min(Math.max(0,X),1),[E*255,J*255,X*255]};R.xyz.lab=function(D){let F=D[0],B=D[1],$=D[2];F/=95.047,B/=100,$/=108.883,F=F>0.008856?F**0.3333333333333333:7.787*F+0.13793103448275862,B=B>0.008856?B**0.3333333333333333:7.787*B+0.13793103448275862,$=$>0.008856?$**0.3333333333333333:7.787*$+0.13793103448275862;let E=116*B-16,J=500*(F-B),X=200*(B-$);return[E,J,X]};R.lab.xyz=function(D){let F=D[0],B=D[1],$=D[2],E,J,X;J=(F+16)/116,E=B/500+J,X=J-$/200;let Y=J**3,Q=E**3,q=X**3;return J=Y>0.008856?Y:(J-0.13793103448275862)/7.787,E=Q>0.008856?Q:(E-0.13793103448275862)/7.787,X=q>0.008856?q:(X-0.13793103448275862)/7.787,E*=95.047,J*=100,X*=108.883,[E,J,X]};R.lab.lch=function(D){let F=D[0],B=D[1],$=D[2],E;if(E=Math.atan2($,B)*360/2/Math.PI,E<0)E+=360;let X=Math.sqrt(B*B+$*$);return[F,X,E]};R.lch.lab=function(D){let F=D[0],B=D[1],E=D[2]/360*2*Math.PI,J=B*Math.cos(E),X=B*Math.sin(E);return[F,J,X]};R.rgb.ansi16=function(D,F=null){let[B,$,E]=D,J=F===null?R.rgb.hsv(D)[2]:F;if(J=Math.round(J/50),J===0)return 30;let X=30+(Math.round(E/255)<<2|Math.round($/255)<<1|Math.round(B/255));if(J===2)X+=60;return X};R.hsv.ansi16=function(D){return R.rgb.ansi16(R.hsv.rgb(D),D[2])};R.rgb.ansi256=function(D){let F=D[0],B=D[1],$=D[2];if(F===B&&B===$){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(B/255*5)+Math.round($/255*5)};R.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 B=(~~(D>50)+1)*0.5,$=(F&1)*B*255,E=(F>>1&1)*B*255,J=(F>>2&1)*B*255;return[$,E,J]};R.ansi256.rgb=function(D){if(D>=232){let J=(D-232)*10+8;return[J,J,J]}D-=16;let F,B=Math.floor(D/36)/5*255,$=Math.floor((F=D%36)/6)/5*255,E=F%6/5*255;return[B,$,E]};R.rgb.hex=function(D){let B=(((Math.round(D[0])&255)<<16)+((Math.round(D[1])&255)<<8)+(Math.round(D[2])&255)).toString(16).toUpperCase();return"000000".substring(B.length)+B};R.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 B=F[0];if(F[0].length===3)B=B.split("").map((Y)=>{return Y+Y}).join("");let $=parseInt(B,16),E=$>>16&255,J=$>>8&255,X=$&255;return[E,J,X]};R.rgb.hcg=function(D){let F=D[0]/255,B=D[1]/255,$=D[2]/255,E=Math.max(Math.max(F,B),$),J=Math.min(Math.min(F,B),$),X=E-J,Y,Q;if(X<1)Y=J/(1-X);else Y=0;if(X<=0)Q=0;else if(E===F)Q=(B-$)/X%6;else if(E===B)Q=2+($-F)/X;else Q=4+(F-B)/X;return Q/=6,Q%=1,[Q*360,X*100,Y*100]};R.hsl.hcg=function(D){let F=D[1]/100,B=D[2]/100,$=B<0.5?2*F*B:2*F*(1-B),E=0;if($<1)E=(B-0.5*$)/(1-$);return[D[0],$*100,E*100]};R.hsv.hcg=function(D){let F=D[1]/100,B=D[2]/100,$=F*B,E=0;if($<1)E=(B-$)/(1-$);return[D[0],$*100,E*100]};R.hcg.rgb=function(D){let F=D[0]/360,B=D[1]/100,$=D[2]/100;if(B===0)return[$*255,$*255,$*255];let E=[0,0,0],J=F%1*6,X=J%1,Y=1-X,Q=0;switch(Math.floor(J)){case 0:E[0]=1,E[1]=X,E[2]=0;break;case 1:E[0]=Y,E[1]=1,E[2]=0;break;case 2:E[0]=0,E[1]=1,E[2]=X;break;case 3:E[0]=0,E[1]=Y,E[2]=1;break;case 4:E[0]=X,E[1]=0,E[2]=1;break;default:E[0]=1,E[1]=0,E[2]=Y}return Q=(1-B)*$,[(B*E[0]+Q)*255,(B*E[1]+Q)*255,(B*E[2]+Q)*255]};R.hcg.hsv=function(D){let F=D[1]/100,B=D[2]/100,$=F+B*(1-F),E=0;if($>0)E=F/$;return[D[0],E*100,$*100]};R.hcg.hsl=function(D){let F=D[1]/100,$=D[2]/100*(1-F)+0.5*F,E=0;if($>0&&$<0.5)E=F/(2*$);else if($>=0.5&&$<1)E=F/(2*(1-$));return[D[0],E*100,$*100]};R.hcg.hwb=function(D){let F=D[1]/100,B=D[2]/100,$=F+B*(1-F);return[D[0],($-F)*100,(1-$)*100]};R.hwb.hcg=function(D){let F=D[1]/100,$=1-D[2]/100,E=$-F,J=0;if(E<1)J=($-E)/(1-E);return[D[0],E*100,J*100]};R.apple.rgb=function(D){return[D[0]/65535*255,D[1]/65535*255,D[2]/65535*255]};R.rgb.apple=function(D){return[D[0]/255*65535,D[1]/255*65535,D[2]/255*65535]};R.gray.rgb=function(D){return[D[0]/100*255,D[0]/100*255,D[0]/100*255]};R.gray.hsl=function(D){return[0,0,D[0]]};R.gray.hsv=R.gray.hsl;R.gray.hwb=function(D){return[0,100,D[0]]};R.gray.cmyk=function(D){return[0,0,0,D[0]]};R.gray.lab=function(D){return[D[0],0,0]};R.gray.hex=function(D){let F=Math.round(D[0]/100*255)&255,$=((F<<16)+(F<<8)+F).toString(16).toUpperCase();return"000000".substring($.length)+$};R.rgb.gray=function(D){return[(D[0]+D[1]+D[2])/3/255*100]}});var p5=l((EW,m5)=>{var k3=s8();function _E(){let D={},F=Object.keys(k3);for(let B=F.length,$=0;$<B;$++)D[F[$]]={distance:-1,parent:null};return D}function KE(D){let F=_E(),B=[D];F[D].distance=0;while(B.length){let $=B.pop(),E=Object.keys(k3[$]);for(let J=E.length,X=0;X<J;X++){let Y=E[X],Q=F[Y];if(Q.distance===-1)Q.distance=F[$].distance+1,Q.parent=$,B.unshift(Y)}}return F}function AE(D,F){return function(B){return F(D(B))}}function zE(D,F){let B=[F[D].parent,D],$=k3[F[D].parent][D],E=F[D].parent;while(F[E].parent)B.unshift(F[E].parent),$=AE(k3[F[E].parent][E],$),E=F[E].parent;return $.conversion=B,$}m5.exports=function(D){let F=KE(D),B={},$=Object.keys(F);for(let E=$.length,J=0;J<E;J++){let X=$[J];if(F[X].parent===null)continue;B[X]=zE(X,F)}return B}});var c5=l((JW,d5)=>{var a8=s8(),ME=p5(),r2={},RE=Object.keys(a8);function CE(D){let F=function(...B){let $=B[0];if($===void 0||$===null)return $;if($.length>1)B=$;return D(B)};if("conversion"in D)F.conversion=D.conversion;return F}function OE(D){let F=function(...B){let $=B[0];if($===void 0||$===null)return $;if($.length>1)B=$;let E=D(B);if(typeof E==="object")for(let J=E.length,X=0;X<J;X++)E[X]=Math.round(E[X]);return E};if("conversion"in D)F.conversion=D.conversion;return F}RE.forEach((D)=>{r2[D]={},Object.defineProperty(r2[D],"channels",{value:a8[D].channels}),Object.defineProperty(r2[D],"labels",{value:a8[D].labels});let F=ME(D);Object.keys(F).forEach(($)=>{let E=F[$];r2[D][$]=OE(E),r2[D][$].raw=CE(E)})});d5.exports=r2});var a5=l((XW,s5)=>{var i5=(D,F)=>(...B)=>{return`\x1B[${D(...B)+F}m`},n5=(D,F)=>(...B)=>{let $=D(...B);return`\x1B[${38+F};5;${$}m`},r5=(D,F)=>(...B)=>{let $=D(...B);return`\x1B[${38+F};2;${$[0]};${$[1]};${$[2]}m`},P3=(D)=>D,o5=(D,F,B)=>[D,F,B],o2=(D,F,B)=>{Object.defineProperty(D,F,{get:()=>{let $=B();return Object.defineProperty(D,F,{value:$,enumerable:!0,configurable:!0}),$},enumerable:!0,configurable:!0})},t8,s2=(D,F,B,$)=>{if(t8===void 0)t8=c5();let E=$?10:0,J={};for(let[X,Y]of Object.entries(t8)){let Q=X==="ansi16"?"ansi":X;if(X===F)J[Q]=D(B,E);else if(typeof Y==="object")J[Q]=D(Y[F],E)}return J};function LE(){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[B,$]of Object.entries(F)){for(let[E,J]of Object.entries($))F[E]={open:`\x1B[${J[0]}m`,close:`\x1B[${J[1]}m`},$[E]=F[E],D.set(J[0],J[1]);Object.defineProperty(F,B,{value:$,enumerable:!1})}return Object.defineProperty(F,"codes",{value:D,enumerable:!1}),F.color.close="\x1B[39m",F.bgColor.close="\x1B[49m",o2(F.color,"ansi",()=>s2(i5,"ansi16",P3,!1)),o2(F.color,"ansi256",()=>s2(n5,"ansi256",P3,!1)),o2(F.color,"ansi16m",()=>s2(r5,"rgb",o5,!1)),o2(F.bgColor,"ansi",()=>s2(i5,"ansi16",P3,!0)),o2(F.bgColor,"ansi256",()=>s2(n5,"ansi256",P3,!0)),o2(F.bgColor,"ansi16m",()=>s2(r5,"rgb",o5,!0)),F}Object.defineProperty(s5,"exports",{enumerable:!0,get:LE})});var D7=l((YW,e5)=>{var I0=x5(),jE=n8(),SE=a5(),D6=new Set(["\x1B","\x9B"]),t5=(D)=>`${D6.values().next().value}[${D}m`,TE=(D)=>D.split(" ").map((F)=>I0(F)),e8=(D,F,B)=>{let $=[...F],E=!1,J=I0(jE(D[D.length-1]));for(let[X,Y]of $.entries()){let Q=I0(Y);if(J+Q<=B)D[D.length-1]+=Y;else D.push(Y),J=0;if(D6.has(Y))E=!0;else if(E&&Y==="m"){E=!1;continue}if(E)continue;if(J+=Q,J===B&&X<$.length-1)D.push(""),J=0}if(!J&&D[D.length-1].length>0&&D.length>1)D[D.length-2]+=D.pop()},ZE=(D)=>{let F=D.split(" "),B=F.length;while(B>0){if(I0(F[B-1])>0)break;B--}if(B===F.length)return D;return F.slice(0,B).join(" ")+F.slice(B).join("")},NE=(D,F,B={})=>{if(B.trim!==!1&&D.trim()==="")return"";let $="",E="",J,X=TE(D),Y=[""];for(let[Q,q]of D.split(" ").entries()){if(B.trim!==!1)Y[Y.length-1]=Y[Y.length-1].trimLeft();let H=I0(Y[Y.length-1]);if(Q!==0){if(H>=F&&(B.wordWrap===!1||B.trim===!1))Y.push(""),H=0;if(H>0||B.trim===!1)Y[Y.length-1]+=" ",H++}if(B.hard&&X[Q]>F){let G=F-H,U=1+Math.floor((X[Q]-G-1)/F);if(Math.floor((X[Q]-1)/F)<U)Y.push("");e8(Y,q,F);continue}if(H+X[Q]>F&&H>0&&X[Q]>0){if(B.wordWrap===!1&&H<F){e8(Y,q,F);continue}Y.push("")}if(H+X[Q]>F&&B.wordWrap===!1){e8(Y,q,F);continue}Y[Y.length-1]+=q}if(B.trim!==!1)Y=Y.map(ZE);$=Y.join(`
|
|
25
25
|
`);for(let[Q,q]of[...$].entries()){if(E+=q,D6.has(q)){let G=parseFloat(/\d[^m]*/.exec($.slice(Q,Q+4)));J=G===39?null:G}let H=SE.codes.get(Number(J));if(J&&H){if($[Q+1]===`
|
|
26
26
|
`)E+=t5(H);else if(q===`
|
|
27
27
|
`)E+=t5(J)}}return E};e5.exports=(D,F,B)=>{return String(D).normalize().replace(/\r\n/g,`
|
|
@@ -37,11 +37,11 @@ ${F}`),changed:!0}}function cE(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 k0(){try{lE(O7,{recursive:!0});let D=M7(e2)?R7(e2,"utf-8"):"",F=!1,B=dE(D);D=B.content,F=F||B.changed;let $=cE(D);if(D=$.content,F=F||$.changed,F)mE(e2,D);return F?"changed":"unchanged"}catch{return"error"}}function j7(){return e2}var D0=14318,O7,e2;var W6=Z(()=>{O7=C7(pE(),".codex"),e2=C7(O7,"config.toml")});import{open as yJ,stat as hJ,unlink as R6}from"fs/promises";async function pJ(D){try{let F=await hJ(D);if(Date.now()-F.mtimeMs>mJ){try{await R6(D)}catch{}return!0}}catch{return!0}return!1}async function dJ(D){try{let F=await yJ(D,"wx");return await F.writeFile(String(process.pid)),await F.close(),async()=>{try{await R6(D)}catch{}}}catch(F){if((F instanceof Error&&"code"in F?F.code:void 0)!=="EEXIST")throw F;return null}}async function $D(D){let F=`${D}.lock`,B=Date.now()+gJ;while(!0){let $=await dJ(F);if($)return $;if(await pJ(F))continue;if(Date.now()>B){try{await R6(F)}catch{throw Error(`Lock timeout: could not remove stale lock at ${F}`)}continue}await new Promise((J)=>setTimeout(J,lJ))}}var gJ=5000,lJ=50,mJ=1e4;var M2=()=>{};var VD={};t(VD,{update:()=>O6,unregister:()=>TD,saveTemplate:()=>E0,removeSubPane:()=>BX,register:()=>y0,listTemplates:()=>h0,list:()=>m,getPane:()=>FX,getElapsedTime:()=>j6,get:()=>yD,findByWindow:()=>eJ,findByTask:()=>L6,findByPane:()=>tJ,addSubPane:()=>DX});import{mkdir as cJ,readFile as iJ,writeFile as nJ}from"fs/promises";import{homedir as rJ}from"os";import{dirname as oJ,join as B9}from"path";function sJ(){return process.env.GENIE_HOME??B9(rJ(),".genie")}function C6(){return B9(sJ(),"workers.json")}async function x0(D){try{let F=D??C6(),B=await iJ(F,"utf-8"),$=JSON.parse(B);if(!$.templates)$.templates={};return $}catch{return{workers:{},templates:{},lastUpdated:new Date().toISOString()}}}async function aJ(D,F){let B=F??C6();await cJ(oJ(B),{recursive:!0}),D.lastUpdated=new Date().toISOString(),await nJ(B,JSON.stringify(D,null,2))}async function $0(D,F){let B=F??C6(),$=await $D(B);try{let E=await x0(F),J=await D(E);return await aJ(E,F),J}finally{await $()}}async function y0(D){await $0((F)=>{F.workers[D.id]=D})}async function TD(D){await $0((F)=>{delete F.workers[D]})}async function yD(D){return(await x0()).workers[D]??null}async function m(){let D=await x0();return Object.values(D.workers)}async function O6(D,F){await $0((B)=>{let $=B.workers[D];if($){if(Object.assign($,F),F.state)$.lastStateChange=new Date().toISOString()}})}async function tJ(D){let F=await m(),B=D.startsWith("%")?D:`%${D}`;return F.find(($)=>$.paneId===B)??null}async function eJ(D){let F=await m(),B=D.startsWith("@")?D:`@${D}`;return F.find(($)=>$.windowId===B)??null}async function L6(D){return(await m()).find((B)=>B.taskId===D)??null}function j6(D){let F=new Date(D.startedAt).getTime(),B=Date.now()-F,$=Math.floor(B/60000),E=Math.floor($/60),J;if(E>0)J=`${E}h ${$%60}m`;else if($>0)J=`${$}m`;else J="<1m";return{ms:B,formatted:J}}async function DX(D,F,B){await $0(($)=>{let E=$.workers[D];if(!E)return;if(!E.subPanes)E.subPanes=[];E.subPanes.push(F)},B)}async function FX(D,F,B){let E=(await x0(B)).workers[D];if(!E)return null;if(F===0)return E.paneId;let J=F-1;if(!E.subPanes||J>=E.subPanes.length||J<0)return null;return E.subPanes[J]}async function BX(D,F,B){await $0(($)=>{let E=$.workers[D];if(!E||!E.subPanes)return;E.subPanes=E.subPanes.filter((J)=>J!==F)},B)}async function E0(D){await $0((F)=>{F.templates[D.id]=D})}async function h0(){let D=await x0();return Object.values(D.templates??{})}var _D=Z(()=>{M2()});function l0(D){return $X.parse(D)}function
|
|
40
|
+
`,changed:!0}}function k0(){try{lE(O7,{recursive:!0});let D=M7(e2)?R7(e2,"utf-8"):"",F=!1,B=dE(D);D=B.content,F=F||B.changed;let $=cE(D);if(D=$.content,F=F||$.changed,F)mE(e2,D);return F?"changed":"unchanged"}catch{return"error"}}function j7(){return e2}var D0=14318,O7,e2;var W6=Z(()=>{O7=C7(pE(),".codex"),e2=C7(O7,"config.toml")});import{open as yJ,stat as hJ,unlink as R6}from"fs/promises";async function pJ(D){try{let F=await hJ(D);if(Date.now()-F.mtimeMs>mJ){try{await R6(D)}catch{}return!0}}catch{return!0}return!1}async function dJ(D){try{let F=await yJ(D,"wx");return await F.writeFile(String(process.pid)),await F.close(),async()=>{try{await R6(D)}catch{}}}catch(F){if((F instanceof Error&&"code"in F?F.code:void 0)!=="EEXIST")throw F;return null}}async function $D(D){let F=`${D}.lock`,B=Date.now()+gJ;while(!0){let $=await dJ(F);if($)return $;if(await pJ(F))continue;if(Date.now()>B){try{await R6(F)}catch{throw Error(`Lock timeout: could not remove stale lock at ${F}`)}continue}await new Promise((J)=>setTimeout(J,lJ))}}var gJ=5000,lJ=50,mJ=1e4;var M2=()=>{};var VD={};t(VD,{update:()=>O6,unregister:()=>TD,saveTemplate:()=>E0,removeSubPane:()=>BX,register:()=>y0,listTemplates:()=>h0,list:()=>m,getPane:()=>FX,getElapsedTime:()=>j6,get:()=>yD,findByWindow:()=>eJ,findByTask:()=>L6,findByPane:()=>tJ,addSubPane:()=>DX});import{mkdir as cJ,readFile as iJ,writeFile as nJ}from"fs/promises";import{homedir as rJ}from"os";import{dirname as oJ,join as B9}from"path";function sJ(){return process.env.GENIE_HOME??B9(rJ(),".genie")}function C6(){return B9(sJ(),"workers.json")}async function x0(D){try{let F=D??C6(),B=await iJ(F,"utf-8"),$=JSON.parse(B);if(!$.templates)$.templates={};return $}catch{return{workers:{},templates:{},lastUpdated:new Date().toISOString()}}}async function aJ(D,F){let B=F??C6();await cJ(oJ(B),{recursive:!0}),D.lastUpdated=new Date().toISOString(),await nJ(B,JSON.stringify(D,null,2))}async function $0(D,F){let B=F??C6(),$=await $D(B);try{let E=await x0(F),J=await D(E);return await aJ(E,F),J}finally{await $()}}async function y0(D){await $0((F)=>{F.workers[D.id]=D})}async function TD(D){await $0((F)=>{delete F.workers[D]})}async function yD(D){return(await x0()).workers[D]??null}async function m(){let D=await x0();return Object.values(D.workers)}async function O6(D,F){await $0((B)=>{let $=B.workers[D];if($){if(Object.assign($,F),F.state)$.lastStateChange=new Date().toISOString()}})}async function tJ(D){let F=await m(),B=D.startsWith("%")?D:`%${D}`;return F.find(($)=>$.paneId===B)??null}async function eJ(D){let F=await m(),B=D.startsWith("@")?D:`@${D}`;return F.find(($)=>$.windowId===B)??null}async function L6(D){return(await m()).find((B)=>B.taskId===D)??null}function j6(D){let F=new Date(D.startedAt).getTime(),B=Date.now()-F,$=Math.floor(B/60000),E=Math.floor($/60),J;if(E>0)J=`${E}h ${$%60}m`;else if($>0)J=`${$}m`;else J="<1m";return{ms:B,formatted:J}}async function DX(D,F,B){await $0(($)=>{let E=$.workers[D];if(!E)return;if(!E.subPanes)E.subPanes=[];E.subPanes.push(F)},B)}async function FX(D,F,B){let E=(await x0(B)).workers[D];if(!E)return null;if(F===0)return E.paneId;let J=F-1;if(!E.subPanes||J>=E.subPanes.length||J<0)return null;return E.subPanes[J]}async function BX(D,F,B){await $0(($)=>{let E=$.workers[D];if(!E||!E.subPanes)return;E.subPanes=E.subPanes.filter((J)=>J!==F)},B)}async function E0(D){await $0((F)=>{F.templates[D.id]=D})}async function h0(){let D=await x0();return Object.values(D.templates??{})}var _D=Z(()=>{M2()});function l0(D){return $X.parse(D)}function i(D){return`'${D.replace(/'/g,"'\\''")}'`}function EX(D){try{let F=Bun;if(typeof F.which==="function")return Boolean(F.which(D));let{execSync:B}=P("child_process");return B(`which ${D}`,{stdio:"ignore"}),!0}catch{return!1}}function $9(D){if(!EX(D))throw Error(`Provider binary "${D}" not found on PATH. Install ${D} or check your environment.`)}function JX(D,F,B,$){F.CLAUDECODE="1",F.CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS="1";let E=B.agentName??$.role??"worker";if(F.GENIE_AGENT_NAME=E,D.push("--agent-id",i(`${E}@${$.team}`)),D.push("--agent-name",i(E)),D.push("--team-name",i($.team)),B.color)D.push("--agent-color",i(B.color));if(B.parentSessionId)D.push("--parent-session-id",i(B.parentSessionId));if(B.agentType)D.push("--agent-type",i(B.agentType));if(B.planModeRequired)D.push("--plan-mode-required");if(B.permissionMode)D.push("--permission-mode",i(B.permissionMode))}function XX(D){$9("claude");let F=["claude","--dangerously-skip-permissions"],B={};if(D.role)B.GENIE_AGENT_NAME=D.role;if(D.nativeTeam?.enabled)JX(F,B,D.nativeTeam,D);if(D.resume)F.push("--resume",i(D.resume));else if(D.sessionId)F.push("--session-id",i(D.sessionId));if(D.role)F.push("--agent",i(D.role));if(D.model)F.push("--model",i(D.model));if(D.systemPrompt){let{mkdirSync:$,writeFileSync:E,readFileSync:J}=P("fs"),{join:X}=P("path"),Y="/tmp/genie-prompts";$("/tmp/genie-prompts",{recursive:!0});let Q=Date.now().toString(36),q=X("/tmp/genie-prompts",`${D.role||"agent"}-${Q}.md`),H=D.systemPrompt;if(D.systemPromptFile)H=`${J(D.systemPromptFile,"utf-8")}
|
|
41
41
|
|
|
42
42
|
${H}`;if(D.extraArgs){let U=D.extraArgs.indexOf("--append-system-prompt-file");if(U!==-1&&D.extraArgs[U+1])H=`${H}
|
|
43
43
|
|
|
44
|
-
${J(D.extraArgs[U+1],"utf-8")}`,D.extraArgs.splice(U,2)}E(q,H);let G=D.promptMode==="system"?"--system-prompt-file":"--append-system-prompt-file";F.push(G,
|
|
44
|
+
${J(D.extraArgs[U+1],"utf-8")}`,D.extraArgs.splice(U,2)}E(q,H);let G=D.promptMode==="system"?"--system-prompt-file":"--append-system-prompt-file";F.push(G,i(q))}else if(D.systemPromptFile){let $=D.promptMode==="system"?"--system-prompt-file":"--append-system-prompt-file";F.push($,i(D.systemPromptFile))}if(D.extraArgs)for(let $ of D.extraArgs)F.push(i($));if(D.initialPrompt)F.push(i(D.initialPrompt));return{command:F.join(" "),provider:"claude",env:Object.keys(B).length>0?B:void 0,meta:{role:D.role,skill:D.skill}}}function YX(D){$9("codex");let F=["codex"];if(F.push("--yolo"),F.push("--no-alt-screen"),D.extraArgs)for(let E of D.extraArgs)F.push(i(E));let B=[`Genie worker. Team: ${D.team}.`];if(D.role)B.push(`Role: ${D.role}.`);if(D.skill)B.push(`Execute the ${D.skill} skill instructions.`);let $=B.join(" ");return F.push(i($)),{command:F.join(" "),provider:"codex",meta:{role:D.role,skill:D.skill}}}function g3(D){let F=l0(D);switch(F.provider){case"claude":return XX(F);case"codex":return YX(F);default:throw Error(`Unknown provider "${F.provider}". Valid providers: claude, codex`)}}var g0,$X;var l3=Z(()=>{S3();g0=["red","blue","green","yellow","purple","orange","pink","cyan"],$X=_.object({provider:_.enum(["claude","codex"]),team:_.string().min(1,"Team name is required"),role:_.string().optional(),skill:_.string().optional(),extraArgs:_.array(_.string()).optional(),nativeTeam:_.object({enabled:_.boolean(),parentSessionId:_.string().optional(),color:_.string().optional(),agentType:_.string().optional(),planModeRequired:_.boolean().optional(),permissionMode:_.string().optional(),agentName:_.string().optional()}).optional(),sessionId:_.string().uuid().optional(),resume:_.string().uuid().optional(),systemPromptFile:_.string().optional(),systemPrompt:_.string().optional(),promptMode:_.enum(["system","append"]).optional(),model:_.string().optional(),initialPrompt:_.string().optional()})});import{existsSync as T6}from"fs";import{mkdir as S6,readFile as Z6,readdir as J9,rm as QX,stat as qX,unlink as HX,writeFile as R2}from"fs/promises";import{homedir as GX}from"os";import{join as hD}from"path";function X9(){return process.env.CLAUDE_CONFIG_DIR??hD(GX(),".claude")}function Y9(){return hD(X9(),"teams")}function n(D){return D.replace(/[^a-zA-Z0-9]/g,"-").toLowerCase()}function m3(D){return hD(Y9(),n(D))}function Q9(D){return hD(m3(D),"config.json")}function N6(D){return hD(m3(D),"inboxes")}function p3(D,F){return hD(N6(D),`${n(F)}.json`)}function q9(D){return`${D}.lock`}async function H9(D){let F=q9(D),B=Date.now()+WX;while(Date.now()<B)try{await R2(F,String(process.pid),{flag:"wx"});return}catch{let $=Math.floor(Math.random()*E9);await new Promise((E)=>setTimeout(E,E9+$))}console.warn(`[claude-native-teams] Force-acquiring stale lock: ${F}`),await R2(F,String(process.pid))}async function G9(D){try{await HX(q9(D))}catch{}}async function C2(D){try{let F=await Z6(Q9(D),"utf-8");return JSON.parse(F)}catch(F){if(F instanceof Error&&"code"in F&&F.code==="ENOENT")return null;let B=F instanceof Error?F.message:String(F);return console.warn(`[claude-native-teams] Failed to load config for "${D}": ${B}`),null}}async function m0(D,F){await R2(Q9(D),JSON.stringify(F,null,2))}async function O2(D,F,B){let $=m3(D),E=N6(D);await S6($,{recursive:!0}),await S6(E,{recursive:!0});let J=await C2(D);if(J)return J;let X=n(D),Y={name:X,description:F,createdAt:Date.now(),leadAgentId:`team-lead@${X}`,leadSessionId:B,members:[]};return await m0(D,Y),Y}async function L2(D,F){let B=await C2(D);if(!B)throw Error(`Native team "${D}" not found`);let $=n(D),E=`${n(F.agentName)}@${$}`;B.members=B.members.filter((X)=>X.agentId!==E),B.members.push({agentId:E,name:n(F.agentName),agentType:F.agentType??"general-purpose",joinedAt:Date.now(),tmuxPaneId:F.tmuxPaneId,cwd:F.cwd??process.cwd(),backendType:"tmux",color:F.color,planModeRequired:F.planModeRequired??!1,isActive:!0}),await m0(D,B);let J=p3(D,F.agentName);if(!T6(J))await R2(J,"[]")}async function b6(D,F){let B=await C2(D);if(!B)return;let $=n(D),E=`${n(F)}@${$}`,J=B.members.find((X)=>X.agentId===E);if(J)J.isActive=!1;await m0(D,B)}async function j2(D,F,B){let $=p3(D,F);await S6(N6(D),{recursive:!0}),await H9($);try{let E=[];try{let J=await Z6($,"utf-8");E=JSON.parse(J)}catch{}E.push(B),await R2($,JSON.stringify(E,null,2))}finally{await G9($)}}async function d3(D){let F=await C2(D);if(!F)return g0[0];let B=new Set(F.members.map(($)=>$.color));for(let $ of g0)if(!B.has($))return $;return g0[F.members.length%g0.length]}async function I6(D,F){let B=p3(D,F);await H9(B);try{await R2(B,"[]")}finally{await G9(B)}}async function c3(D){let F=m3(D);if(!T6(F))return!1;return await QX(F,{recursive:!0,force:!0}),!0}function UX(D){return D.replace(/[^a-zA-Z0-9]/g,"-")}async function J0(D){let F=process.env.CLAUDE_CODE_SESSION_ID;if(F)return F;let B=hD(X9(),"projects",UX(D??process.cwd()));try{let E=(await J9(B)).filter((X)=>X.endsWith(".jsonl"));if(E.length===0)return null;let J=null;for(let X of E){let Y=await qX(hD(B,X));if(!J||Y.mtimeMs>J.mtime)J={name:X,mtime:Y.mtimeMs}}if(!J)return null;return J.name.replace(".jsonl","")}catch{return null}}function W9(){return process.env.CLAUDECODE==="1"}async function i3(D){let F=process.env.GENIE_TEAM;if(F)return F;let B=await J0(D);if(!B)return null;let $=Y9();try{let E=await J9($);for(let J of E){let X=hD($,J,"config.json");try{let Y=await Z6(X,"utf-8"),Q=JSON.parse(Y);if(Q.leadSessionId===B)return Q.name}catch{}}}catch{}return null}async function U9(D,F){let B=await J0(F?.cwd);if(!B)throw Error("Could not discover Claude Code session ID. Are you running inside Claude Code with CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1?");let $=await O2(D,`Genie team: ${D}`,B);if($.leadSessionId!==B)$.leadSessionId=B,await m0(D,$);let J=`team-lead@${n(D)}`,X=$.members.find((H)=>H.agentId===J),Y=F?.tmuxPaneId??process.env.TMUX_PANE;if(!X||!X.isActive)await L2(D,{agentName:"team-lead",agentType:"general-purpose",color:F?.color??"blue",tmuxPaneId:Y,cwd:F?.cwd??process.cwd()});else if(Y&&X.tmuxPaneId!==Y)X.tmuxPaneId=Y,await m0(D,$);let Q=p3(D,"team-lead");if(!T6(Q))await R2(Q,"[]");let q=await C2(D);if(!q)throw Error(`Failed to load config for team "${D}" after creation`);return{sessionId:B,config:q}}var WX=5000,E9=50;var S2=Z(()=>{l3()});var K9={};t(K9,{shellQuote:()=>u,buildTeamLeadCommand:()=>v6});import{mkdirSync as VX,writeFileSync as _X}from"fs";import{homedir as KX}from"os";import{join as _9}from"path";function u(D){return`'${D.replace(/'/g,"'\\''")}'`}function v6(D,F){let B=n(D),$=u(B),E=["CLAUDECODE=1","CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1",`GENIE_TEAM=${$}`,"GENIE_AGENT_NAME='team-lead'","claude",`--agent-id ${u(`team-lead@${B}`)}`,`--agent-name ${u("team-lead")}`,`--team-name ${$}`,"--dangerously-skip-permissions"];if(F?.resumeSessionId)E.push(`--resume ${u(F.resumeSessionId)}`);else if(F?.sessionId)E.push(`--session-id ${u(F.sessionId)}`);if(F?.systemPrompt){VX(V9,{recursive:!0});let J=_9(V9,`${B}.md`);_X(J,F.systemPrompt,"utf-8");let Y=(F?.promptMode??c2().promptMode)==="system"?"--system-prompt-file":"--append-system-prompt-file";E.push(`${Y} ${u(J)}`)}return E.join(" ")}var V9;var r3=Z(()=>{S2();PD();V9=_9(KX(),".genie","prompts")});import{exec as AX}from"child_process";import{existsSync as zX,mkdirSync as MX}from"fs";import{homedir as RX}from"os";import{join as CX}from"path";import{promisify as OX}from"util";function jX(){let D=CX(RX(),".genie","logs","tmux");if(!zX(D))MX(D,{recursive:!0});return D}function SX(D){return D.filter((F)=>!/^-v+$/.test(F))}function TX(){return process.env.GENIE_TMUX_DEBUG==="1"}async function A9(D){let F=typeof D==="string"?D.split(/\s+/).filter(Boolean):D,B=SX(F),$=TX(),E={};if($)B=["-v",...B],E.cwd=jX();let J=`tmux ${B.join(" ")}`,{stdout:X}=await LX(J,E);return X.trim()}var LX;var z9=Z(()=>{LX=OX(AX)});var zD={};t(zD,{setWindowEnv:()=>o3,listWindows:()=>KD,listSessions:()=>C9,listPanes:()=>X0,killSession:()=>P6,isPaneAlive:()=>AD,getWindowEnv:()=>k6,findWindowByName:()=>s3,findSessionByName:()=>gD,executeTmux:()=>w,ensureTeamWindow:()=>Z2,createWindow:()=>O9,createSession:()=>w6,capturePaneContent:()=>YD,applyPaneColor:()=>d0});async function w(D){try{return await A9(D)}catch(F){let B=F instanceof Error?F.message:String(F);throw Error(`Failed to execute tmux command: ${B}`)}}async function C9(){try{let F=await w("list-sessions -F '#{session_id}:#{session_name}:#{?session_attached,1,0}:#{session_windows}'");if(!F)return[];return F.split(`
|
|
45
45
|
`).map((B)=>{let[$,E,J,X]=B.split(":");return{id:$,name:E,attached:J==="1",windows:Number.parseInt(X,10)}})}catch(D){if((D instanceof Error?D.message:String(D)).includes("no server running"))return[];throw D}}async function gD(D){try{return(await C9()).find((B)=>B.name===D)||null}catch(F){return null}}async function k6(D,F){try{let B=await w(`show-environment -t ${u(D)} ${u(F)}`),$=`${F}=`;if(B?.startsWith($))return B.slice($.length).trim();return null}catch{return null}}async function o3(D,F,B){await w(`set-environment -t ${u(D)} ${u(F)} ${u(B)}`)}async function P6(D){await w(`kill-session -t '${D}'`)}async function KD(D){try{let B=await w(`list-windows -t '${D}' -F '#{window_id}:#{window_name}:#{?window_active,1,0}'`);if(!B)return[];return B.split(`
|
|
46
46
|
`).map(($)=>{let[E,J,X]=$.split(":");return{id:E,name:J,active:X==="1",sessionId:D}})}catch(F){let B=F instanceof Error?F.message:String(F);if(B.includes("no server running")||B.includes("session not found"))return[];throw F}}async function X0(D){try{let B=await w(`list-panes -t '${D}' -F '#{pane_id}:#{pane_title}:#{?pane_active,1,0}'`);if(!B)return[];return B.split(`
|
|
47
47
|
`).map(($)=>{let[E,J,X]=$.split(":");return{id:E,windowId:D,title:J,active:X==="1"}})}catch(F){let B=F instanceof Error?F.message:String(F);if(B.includes("no server running")||B.includes("window not found"))return[];throw F}}async function YD(D,F=200,B=!1){try{return await w(`capture-pane -p ${B?"-e":""} -t '${D}' -S -${F} -E -`)}catch($){let E=$ instanceof Error?$.message:String($);if(E.includes("no server running")||E.includes("pane not found"))return"";throw $}}async function w6(D){return await w(`new-session -d -s "${D}" -e LC_ALL=C.UTF-8 -e LANG=C.UTF-8`),gD(D)}async function O9(D,F,B){let $=B?` -c '${B.replace(/'/g,"'\\''")}'`:"",J=(await w(`new-window -d -P -F '#{window_id}' -t '${D}:' -n '${F}'${$}`)).trim();if(!J)return null;try{await w(`set-window-option -t '${J}' automatic-rename off`)}catch{}return{id:J,name:F,active:!1,sessionId:D}}async function s3(D,F){return(await KD(D)).find(($)=>$.name===F)||null}async function Z2(D,F,B){let $=await s3(D,F);if($){try{await w(`set-window-option -t '${$.id}' automatic-rename off`)}catch{}await R9($.id);let Y=await X0($.id),Q=Y.length>0?Y[0].id:`${D}:${F}.0`;return{windowId:$.id,windowName:F,paneId:Q,created:!1}}let E=await O9(D,F,B);if(!E)throw Error(`Failed to create team window "${F}" in session "${D}"`);await R9(E.id);let J=await X0(E.id),X=J.length>0?J[0].id:`${D}:${F}.0`;return{windowId:E.id,windowName:F,paneId:X,created:!0}}function L9(){let{existsSync:D,writeFileSync:F,mkdirSync:B,chmodSync:$}=P("fs"),{dirname:E}=P("path");if(D(T2))return;B(E(T2),{recursive:!0}),F(T2,`#!/bin/bash
|
|
@@ -459,14 +459,14 @@ process.on('SIGTERM', () => { server.close(); process.exit(0); });
|
|
|
459
459
|
process.on('SIGINT', () => { server.close(); process.exit(0); });
|
|
460
460
|
`,{mode:420});let{spawn:U}=P("child_process");U("node",[Y],{detached:!0,stdio:"ignore"}).unref();for(let z=0;z<30;z++)if(await new Promise((C)=>setTimeout(C,100)),c9(X))return!0;return!1}catch{return!1}}async function qY(D,F){let B=F?`${D}-${F}`:D;if(!(await m()).some((J)=>J.id===B))return B;let E=crypto.randomUUID().slice(0,8);return`${B}-${E}`}async function n9(D,F,B){let $=D.validated.nativeTeam,E={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:$?.enabled??!1,nativeAgentId:`${D.agentName}@${D.validated.team}`,nativeColor:$?.color??D.spawnColor,parentSessionId:$?.parentSessionId??D.parentSessionId,window:B?.windowName,windowName:B?.windowName,windowId:B?.windowId};return await y0(E),E}async function r9(D,F){let B=D.validated.nativeTeam;await L2(D.validated.team,{agentName:D.agentName,agentType:B?.agentType??D.validated.role??"general-purpose",color:B?.color??D.spawnColor??"blue",tmuxPaneId:F,cwd:D.cwd,planModeRequired:B?.planModeRequired}),await j2(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:B?.color??D.spawnColor??"blue",read:!1})}function HY(D,F,B,$){let{writeFileSync:E}=P("fs"),{join:J}=P("path"),{homedir:X}=P("os"),Y=J(X(),".genie","relay");E(J(Y,`${D}-pane`),F),E(J(Y,`${D}-meta`),JSON.stringify({agent:B,color:$}))}function GY(D,F,B){let $=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(B.claudeSessionId)console.log(` Session: ${B.claudeSessionId}`);if(console.log(` Layout: ${D.layoutMode}`),$?.enabled)console.log(" Native: enabled"),console.log(` AgentID: ${B.nativeAgentId}`),console.log(` Color: ${$.color}`);if(D.otelRelayActive)console.log(` OTel: relay on port ${D0}`)}async function WY(D,F){if(!D)return null;try{return await Z2("genie",D,F)}catch(B){return console.warn(`Warning: could not ensure team window for "${D}": ${B instanceof Error?B.message:B}`),null}}async function UY(D){let{execSync:F}=P("child_process"),B=await WY(D.validated.team,D.cwd),$=B?`-t '${B.windowId}'`:"",E;try{let Q=D.cwd?`-c '${D.cwd}'`:"",q=`tmux split-window -d ${$} ${Q} -P -F '#{pane_id}' ${D.fullCommand}`;E=F(q,{encoding:"utf-8"}).trim()}catch(Q){console.error(`Failed to create tmux pane: ${Q instanceof Error?Q.message:"unknown error"}`),process.exit(1)}let J="genie",X=`${J}:${B?.windowName??""}`;if(!B){let Q=await KD(J);X=Q[0]?Q[0].id:`${J}:`}try{F(`tmux ${e3(X,D.layoutMode)}`,{stdio:"ignore"})}catch{}let Y=await n9(D,E,B);if(await r9(D,E),D.spawnColor&&E!=="inline")await d0(E,D.spawnColor,B?.windowId);if(await E0({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:Y.nativeTeamEnabled,lastSpawnedAt:new Date().toISOString(),lastSessionId:Y.claudeSessionId}),D.otelRelayActive&&E!=="%0")HY(D.workerId,E,D.agentName,D.spawnColor);if(B)console.log(` Window: ${B.windowName} (${B.windowId})`);GY(D,E,Y)}async function VY(D){let F=D.validated.nativeTeam,B="inline",$=await n9(D,"inline");if(await r9(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: ${$.nativeAgentId}`);console.log("");let{spawnSync:E}=P("child_process"),J={...process.env,...D.launch.env??{}},X=E("sh",["-c",D.launch.command],{env:J,stdio:"inherit"});if(await TD(D.workerId),F?.enabled&&D.agentName)await I6(D.validated.team,D.agentName).catch(()=>{}),await b6(D.validated.team,D.agentName).catch(()=>{});console.log(`
|
|
461
461
|
Agent "${D.workerId}" session ended.`),process.exit(X.status??0)}function _Y(D,F){if(!F||Object.keys(F).length===0)return D;return`env ${Object.entries(F).map(([$,E])=>`${$}=${E}`).join(" ")} ${D}`}async function KY(D,F){let B=await m();for(let $ of B)if($.role===F&&$.team===D&&await AD($.paneId))console.error(`Error: Worker with role "${F}" already exists in team "${D}" (state: ${$.state}, pane: ${$.paneId})
|
|
462
|
-
Use a different --role name for a second worker, e.g.: --role ${F}-2`),process.exit(1)}async function AY(D,F,B){let E=(await MD(D))?.nativeTeamParentSessionId;if(!E)E=await J0()??crypto.randomUUID();await O2(D,`Genie team: ${D}`,E);let J=B.color??await d3(D),X;if(B.provider==="claude")X={enabled:!0,parentSessionId:E,color:J,agentType:B.role??"general-purpose",planModeRequired:B.planMode,permissionMode:B.permissionMode,agentName:B.role};return{parentSessionId:E,spawnColor:J,nativeTeam:X}}async function zY(D,F){let B=await r0(D);if(!B)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: implementor, tester, reviewer, debugger, ..."),process.exit(1);let $=B.entry,E;if(B.builtin)E=j9(D)?.systemPrompt;return{entry:$,repoPath:F.cwd??($.dir||void 0)??process.cwd(),identityPath:$.dir?l6($):null,model:F.model??$.model,systemPrompt:E}}async function MY(D,F,B,$){let E={provider:B.provider,team:F,role:D,skill:B.skill,extraArgs:B.extraArgs,model:$.model,systemPromptFile:$.identityPath??void 0,systemPrompt:$.systemPrompt,promptMode:$.entry.promptMode},{parentSessionId:J,spawnColor:X,nativeTeam:Y}=await AY(F,$.repoPath,{...B,role:D});if(Y)E.nativeTeam=Y;try{let{injectTeamHooks:q}=await Promise.resolve().then(() => (y9(),x9));if(await q(F))console.log(` Hooks: injected genie hook dispatch into team "${F}"`)}catch(q){console.warn(`Warning: could not inject hooks for team "${F}": ${q instanceof Error?q.message:q}`)}let Q=E.provider==="claude"?crypto.randomUUID():void 0;if(Q)E.sessionId=Q;return{params:E,parentSessionId:J,spawnColor:X}}async function sD(D,F){let B=await zY(D,F),$=F.team||await i3();if(!$)console.error("Error: --team is required (or set GENIE_TEAM, or run inside a genie session)"),process.exit(1);await KY($,D);let E=await MD($);if(E?.worktreePath)B={...B,repoPath:E.worktreePath};let{params:J,parentSessionId:X,spawnColor:Y}=await MY(D,$,F,B),Q=l0(J),q=g3(Q),H=D8(F.layout),G=await qY(Q.team,D),U=Boolean(process.env.TMUX),A=Q.nativeTeam,z=new Date().toISOString(),C=A?.agentName??D,b=!1;if(!A?.enabled&&Q.provider==="codex"&&U)k0(),b=await QY(Q.team);let I=_Y(q.command,q.env),j={workerId:G,validated:Q,launch:q,layoutMode:H,fullCommand:I,agentName:C,spawnColor:Y,parentSessionId:X,claudeSessionId:J.sessionId,otelRelayActive:b,now:z,transport:U?"tmux":"inline",extraArgs:F.extraArgs,cwd:B.repoPath};if(U)await UY(j);else await VY(j)}async function RY(D){if(!D.team||!D.nativeAgentId)return;let F=D.nativeAgentId.split("@")[0];await I6(D.team,F).catch(()=>{}),await b6(D.team,F).catch(()=>{})}function CY(D){try{let{execSync:F}=P("child_process"),B=F("tmux display-message -p '#{pane_id}'",{encoding:"utf-8"}).trim();if(D.paneId&&/^(%\d+|inline)$/.test(D.paneId)&&D.paneId!==B)F(`tmux kill-pane -t ${D.paneId}`,{stdio:"ignore"});else if(D.paneId===B)console.log(" (skipped pane kill \u2014 would kill current session)")}catch{}}function OY(D){try{let{join:F}=P("path"),{homedir:B}=P("os"),{unlinkSync:$}=P("fs"),E=F(B(),".genie","relay");for(let J of["-pane","-meta"])try{$(F(E,`${D}${J}`))}catch{}}catch{}}async function o9(D){let F=await yD(D);if(F)return F;let B=await m(),$=B.filter((J)=>J.role===D);if($.length===1)return $[0];if($.length>1){console.error(`Multiple agents with role "${D}". Specify full ID:`);for(let J of $)console.error(` ${J.id} (team: ${J.team})`);process.exit(1)}let E=B.filter((J)=>J.id.endsWith(`-${D}`));if(E.length===1)return E[0];if(E.length>1){console.error(`Multiple agents matching "${D}". Specify full ID:`);for(let J of E)console.error(` ${J.id}`);process.exit(1)}console.error(`Agent "${D}" not found.`),console.error(" Run `genie ls` to see agents."),process.exit(1)}async function a6(D){let F=await o9(D);if(CY(F),OY(F.id),await RY(F),F.claudeSessionId){let $=(await h0()).find((E)=>E.id===F.id||E.id===F.role||E.role===F.role);if($)await E0({...$,lastSessionId:F.claudeSessionId})}await TD(F.id),console.log(`Agent "${F.id}" killed and unregistered (template preserved).`)}async function t6(D){let F=await o9(D);if(F.state==="suspended"){console.log(`Agent "${F.id}" is already stopped.`);return}let{suspendWorker:B}=await Promise.resolve().then(() => (d9(),p9));if(await B(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 e6(D){let F=await o0(),B=await m(),$=new Map;for(let J of B){let X=J.role||J.id;if(await AD(J.paneId))$.set(X,{state:J.state,team:J.team||"-"})}let E=[];for(let J of F){let X=$.get(J.name);E.push({name:J.name,dir:J.dir||"-",status:X?X.state:"offline",team:X?.team||"-",model:J.model||"-"}),$.delete(J.name)}for(let[J,X]of $)E.push({name:J,dir:"(built-in)",status:X.state,team:X.team,model:"-"});if(D.json){console.log(JSON.stringify(E,null,2));return}if(E.length===0){console.log("No agents registered. Use `genie dir add <name> --dir <path>` to register one.");return}console.log(""),console.log(i9("NAME","DIR","STATUS","TEAM","MODEL")),console.log("-".repeat(94));for(let J of E)console.log(i9(J.name,J.dir,J.status,J.team,J.model));console.log("")}function i9(D,F,B,$,E){return`${D.padEnd(20).substring(0,20)}${F.padEnd(40).substring(0,40)}${B.padEnd(12).substring(0,12)}${$.padEnd(12).substring(0,12)}${E}`}var Y8=Z(()=>{a0();_D();c0();S2();W6();l3();D3();s();s()});import{randomUUID as ZQ}from"crypto";var B1;var C4=Z(()=>{B1={randomUUID:ZQ}});import{randomFillSync as NQ}from"crypto";function $1(){if(U8>V8.length-16)NQ(V8),U8=0;return V8.slice(U8,U8+=16)}var V8,U8;var O4=Z(()=>{V8=new Uint8Array(256),U8=V8.length});function L4(D,F=0){return(n[D[F+0]]+n[D[F+1]]+n[D[F+2]]+n[D[F+3]]+"-"+n[D[F+4]]+n[D[F+5]]+"-"+n[D[F+6]]+n[D[F+7]]+"-"+n[D[F+8]]+n[D[F+9]]+"-"+n[D[F+10]]+n[D[F+11]]+n[D[F+12]]+n[D[F+13]]+n[D[F+14]]+n[D[F+15]]).toLowerCase()}var n;var j4=Z(()=>{n=[];for(let D=0;D<256;++D)n.push((D+256).toString(16).slice(1))});function bQ(D,F,B){if(B1.randomUUID&&!F&&!D)return B1.randomUUID();D=D||{};let $=D.random??D.rng?.()??$1();if($.length<16)throw Error("Random bytes length must be >= 16");if($[6]=$[6]&15|64,$[8]=$[8]&63|128,F){if(B=B||0,B<0||B+16>F.length)throw RangeError(`UUID byte range ${B}:${B+15} is out of buffer bounds`);for(let E=0;E<16;++E)F[B+E]=$[E];return F}return L4($)}var Q3;var S4=Z(()=>{C4();O4();j4();Q3=bQ});var E1=Z(()=>{S4()});import{mkdir as J1,readFile as IQ,writeFile as vQ}from"fs/promises";import kQ,{join as T4}from"path";function _8(D){return T4(D,".genie","mailbox")}function K8(D,F){let B=kQ.basename(F);return T4(_8(D),`${B}.json`)}async function X1(D,F){try{let B=await IQ(K8(D,F),"utf-8");return JSON.parse(B)}catch{return{workerId:F,messages:[],lastUpdated:new Date().toISOString()}}}async function Z4(D,F){let B=_8(D);await J1(B,{recursive:!0}),F.lastUpdated=new Date().toISOString(),await vQ(K8(D,F.workerId),JSON.stringify(F,null,2))}function PQ(){return`msg-${Q3()}`}async function Y1(D,F,B,$){await J1(_8(D),{recursive:!0});let E=await $D(K8(D,B));try{let J=await X1(D,B),X={id:PQ(),from:F,to:B,body:$,createdAt:new Date().toISOString(),read:!1,deliveredAt:null};return J.messages.push(X),await Z4(D,J),X}finally{await E()}}async function N4(D,F){return(await X1(D,F)).messages}async function Q1(D,F,B){await J1(_8(D),{recursive:!0});let $=await $D(K8(D,F));try{let E=await X1(D,F),J=E.messages.find((X)=>X.id===B);if(!J)return!1;return J.deliveredAt=new Date().toISOString(),await Z4(D,E),!0}finally{await $()}}function b4(D,F="blue"){let B=D.body.split(/\s+/),$=B.slice(0,8).join(" ")+(B.length>8?"...":"");return{from:D.from,text:D.body,summary:$,timestamp:D.createdAt,color:F,read:!1}}var I4=Z(()=>{E1();M2()});function N2(D){return D.replace(/\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])/g,"")}function A8(D,F){let B=N2(D),$=[];for(let E of F){let J=new RegExp(E.pattern.source,E.pattern.flags||"g"),X=J.exec(B);while(X!==null){if($.push({type:E.type,match:X,extracted:E.extract?E.extract(X):void 0}),!E.pattern.flags?.includes("g"))break;X=J.exec(B)}}return $}function q3(D,F){return A8(D,F).length>0}function z8(D,F){let B=A8(D,F);return B.length>0?B[0]:null}var v4,q1,k4,P4,w4,u4,f4;var H1=Z(()=>{v4=[{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}],q1=[{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}],k4=[{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]})}],P4=[{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}],w4=[{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/}],u4=[{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}],f4=[{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 uQ(D,F,B){if(D.length===0&&!F)return null;let $=D.filter((J)=>J.type==="claude_code_numbered_options"&&J.extracted?.option).map((J)=>J.extracted?.option).filter((J)=>J!==void 0);if($.length>=2||F)return{...B,type:"question",options:$.length>0?$:void 0,detail:F?"plan_approval":void 0,confidence:0.85};let E=D.filter((J)=>J.extracted?.option&&J.type!=="claude_code_numbered_options").map((J)=>J.extracted?.option).filter((J)=>J!==void 0);if(E.length>=2)return{...B,type:"question",options:E,confidence:0.85};return null}function M8(D,F={}){let{linesToAnalyze:B=50,minConfidence:$=0.3}=F,E=D.split(`
|
|
462
|
+
Use a different --role name for a second worker, e.g.: --role ${F}-2`),process.exit(1)}async function AY(D,F,B){let E=(await MD(D))?.nativeTeamParentSessionId;if(!E)E=await J0()??crypto.randomUUID();await O2(D,`Genie team: ${D}`,E);let J=B.color??await d3(D),X;if(B.provider==="claude")X={enabled:!0,parentSessionId:E,color:J,agentType:B.role??"general-purpose",planModeRequired:B.planMode,permissionMode:B.permissionMode,agentName:B.role};return{parentSessionId:E,spawnColor:J,nativeTeam:X}}async function zY(D,F){let B=await r0(D);if(!B)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: implementor, tester, reviewer, debugger, ..."),process.exit(1);let $=B.entry,E;if(B.builtin)E=j9(D)?.systemPrompt;return{entry:$,repoPath:F.cwd??($.dir||void 0)??process.cwd(),identityPath:$.dir?l6($):null,model:F.model??$.model,systemPrompt:E}}async function MY(D,F,B,$){let E={provider:B.provider,team:F,role:D,skill:B.skill,extraArgs:B.extraArgs,model:$.model,systemPromptFile:$.identityPath??void 0,systemPrompt:$.systemPrompt,promptMode:$.entry.promptMode,initialPrompt:B.initialPrompt},{parentSessionId:J,spawnColor:X,nativeTeam:Y}=await AY(F,$.repoPath,{...B,role:D});if(Y)E.nativeTeam=Y;try{let{injectTeamHooks:q}=await Promise.resolve().then(() => (y9(),x9));if(await q(F))console.log(` Hooks: injected genie hook dispatch into team "${F}"`)}catch(q){console.warn(`Warning: could not inject hooks for team "${F}": ${q instanceof Error?q.message:q}`)}let Q=E.provider==="claude"?crypto.randomUUID():void 0;if(Q)E.sessionId=Q;return{params:E,parentSessionId:J,spawnColor:X}}async function sD(D,F){let B=await zY(D,F),$=F.team||await i3();if(!$)console.error("Error: --team is required (or set GENIE_TEAM, or run inside a genie session)"),process.exit(1);await KY($,D);let E=await MD($);if(E?.worktreePath)B={...B,repoPath:E.worktreePath};let{params:J,parentSessionId:X,spawnColor:Y}=await MY(D,$,F,B),Q=l0(J),q=g3(Q),H=D8(F.layout),G=await qY(Q.team,D),U=Boolean(process.env.TMUX),A=Q.nativeTeam,z=new Date().toISOString(),C=A?.agentName??D,b=!1;if(!A?.enabled&&Q.provider==="codex"&&U)k0(),b=await QY(Q.team);let I=_Y(q.command,q.env),j={workerId:G,validated:Q,launch:q,layoutMode:H,fullCommand:I,agentName:C,spawnColor:Y,parentSessionId:X,claudeSessionId:J.sessionId,otelRelayActive:b,now:z,transport:U?"tmux":"inline",extraArgs:F.extraArgs,cwd:B.repoPath};if(U)await UY(j);else await VY(j)}async function RY(D){if(!D.team||!D.nativeAgentId)return;let F=D.nativeAgentId.split("@")[0];await I6(D.team,F).catch(()=>{}),await b6(D.team,F).catch(()=>{})}function CY(D){try{let{execSync:F}=P("child_process"),B=F("tmux display-message -p '#{pane_id}'",{encoding:"utf-8"}).trim();if(D.paneId&&/^(%\d+|inline)$/.test(D.paneId)&&D.paneId!==B)F(`tmux kill-pane -t ${D.paneId}`,{stdio:"ignore"});else if(D.paneId===B)console.log(" (skipped pane kill \u2014 would kill current session)")}catch{}}function OY(D){try{let{join:F}=P("path"),{homedir:B}=P("os"),{unlinkSync:$}=P("fs"),E=F(B(),".genie","relay");for(let J of["-pane","-meta"])try{$(F(E,`${D}${J}`))}catch{}}catch{}}async function o9(D){let F=await yD(D);if(F)return F;let B=await m(),$=B.filter((J)=>J.role===D);if($.length===1)return $[0];if($.length>1){console.error(`Multiple agents with role "${D}". Specify full ID:`);for(let J of $)console.error(` ${J.id} (team: ${J.team})`);process.exit(1)}let E=B.filter((J)=>J.id.endsWith(`-${D}`));if(E.length===1)return E[0];if(E.length>1){console.error(`Multiple agents matching "${D}". Specify full ID:`);for(let J of E)console.error(` ${J.id}`);process.exit(1)}console.error(`Agent "${D}" not found.`),console.error(" Run `genie ls` to see agents."),process.exit(1)}async function a6(D){let F=await o9(D);if(CY(F),OY(F.id),await RY(F),F.claudeSessionId){let $=(await h0()).find((E)=>E.id===F.id||E.id===F.role||E.role===F.role);if($)await E0({...$,lastSessionId:F.claudeSessionId})}await TD(F.id),console.log(`Agent "${F.id}" killed and unregistered (template preserved).`)}async function t6(D){let F=await o9(D);if(F.state==="suspended"){console.log(`Agent "${F.id}" is already stopped.`);return}let{suspendWorker:B}=await Promise.resolve().then(() => (d9(),p9));if(await B(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 e6(D){let F=await o0(),B=await m(),$=new Map;for(let J of B){let X=J.role||J.id;if(await AD(J.paneId))$.set(X,{state:J.state,team:J.team||"-"})}let E=[];for(let J of F){let X=$.get(J.name);E.push({name:J.name,dir:J.dir||"-",status:X?X.state:"offline",team:X?.team||"-",model:J.model||"-"}),$.delete(J.name)}for(let[J,X]of $)E.push({name:J,dir:"(built-in)",status:X.state,team:X.team,model:"-"});if(D.json){console.log(JSON.stringify(E,null,2));return}if(E.length===0){console.log("No agents registered. Use `genie dir add <name> --dir <path>` to register one.");return}console.log(""),console.log(i9("NAME","DIR","STATUS","TEAM","MODEL")),console.log("-".repeat(94));for(let J of E)console.log(i9(J.name,J.dir,J.status,J.team,J.model));console.log("")}function i9(D,F,B,$,E){return`${D.padEnd(20).substring(0,20)}${F.padEnd(40).substring(0,40)}${B.padEnd(12).substring(0,12)}${$.padEnd(12).substring(0,12)}${E}`}var Y8=Z(()=>{a0();_D();c0();S2();W6();l3();D3();s();s()});import{randomUUID as ZQ}from"crypto";var B1;var C4=Z(()=>{B1={randomUUID:ZQ}});import{randomFillSync as NQ}from"crypto";function $1(){if(U8>V8.length-16)NQ(V8),U8=0;return V8.slice(U8,U8+=16)}var V8,U8;var O4=Z(()=>{V8=new Uint8Array(256),U8=V8.length});function L4(D,F=0){return(r[D[F+0]]+r[D[F+1]]+r[D[F+2]]+r[D[F+3]]+"-"+r[D[F+4]]+r[D[F+5]]+"-"+r[D[F+6]]+r[D[F+7]]+"-"+r[D[F+8]]+r[D[F+9]]+"-"+r[D[F+10]]+r[D[F+11]]+r[D[F+12]]+r[D[F+13]]+r[D[F+14]]+r[D[F+15]]).toLowerCase()}var r;var j4=Z(()=>{r=[];for(let D=0;D<256;++D)r.push((D+256).toString(16).slice(1))});function bQ(D,F,B){if(B1.randomUUID&&!F&&!D)return B1.randomUUID();D=D||{};let $=D.random??D.rng?.()??$1();if($.length<16)throw Error("Random bytes length must be >= 16");if($[6]=$[6]&15|64,$[8]=$[8]&63|128,F){if(B=B||0,B<0||B+16>F.length)throw RangeError(`UUID byte range ${B}:${B+15} is out of buffer bounds`);for(let E=0;E<16;++E)F[B+E]=$[E];return F}return L4($)}var Q3;var S4=Z(()=>{C4();O4();j4();Q3=bQ});var E1=Z(()=>{S4()});import{mkdir as J1,readFile as IQ,writeFile as vQ}from"fs/promises";import kQ,{join as T4}from"path";function _8(D){return T4(D,".genie","mailbox")}function K8(D,F){let B=kQ.basename(F);return T4(_8(D),`${B}.json`)}async function X1(D,F){try{let B=await IQ(K8(D,F),"utf-8");return JSON.parse(B)}catch{return{workerId:F,messages:[],lastUpdated:new Date().toISOString()}}}async function Z4(D,F){let B=_8(D);await J1(B,{recursive:!0}),F.lastUpdated=new Date().toISOString(),await vQ(K8(D,F.workerId),JSON.stringify(F,null,2))}function PQ(){return`msg-${Q3()}`}async function Y1(D,F,B,$){await J1(_8(D),{recursive:!0});let E=await $D(K8(D,B));try{let J=await X1(D,B),X={id:PQ(),from:F,to:B,body:$,createdAt:new Date().toISOString(),read:!1,deliveredAt:null};return J.messages.push(X),await Z4(D,J),X}finally{await E()}}async function N4(D,F){return(await X1(D,F)).messages}async function Q1(D,F,B){await J1(_8(D),{recursive:!0});let $=await $D(K8(D,F));try{let E=await X1(D,F),J=E.messages.find((X)=>X.id===B);if(!J)return!1;return J.deliveredAt=new Date().toISOString(),await Z4(D,E),!0}finally{await $()}}function b4(D,F="blue"){let B=D.body.split(/\s+/),$=B.slice(0,8).join(" ")+(B.length>8?"...":"");return{from:D.from,text:D.body,summary:$,timestamp:D.createdAt,color:F,read:!1}}var I4=Z(()=>{E1();M2()});function N2(D){return D.replace(/\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])/g,"")}function A8(D,F){let B=N2(D),$=[];for(let E of F){let J=new RegExp(E.pattern.source,E.pattern.flags||"g"),X=J.exec(B);while(X!==null){if($.push({type:E.type,match:X,extracted:E.extract?E.extract(X):void 0}),!E.pattern.flags?.includes("g"))break;X=J.exec(B)}}return $}function q3(D,F){return A8(D,F).length>0}function z8(D,F){let B=A8(D,F);return B.length>0?B[0]:null}var v4,q1,k4,P4,w4,u4,f4;var H1=Z(()=>{v4=[{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}],q1=[{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}],k4=[{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]})}],P4=[{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}],w4=[{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/}],u4=[{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}],f4=[{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 uQ(D,F,B){if(D.length===0&&!F)return null;let $=D.filter((J)=>J.type==="claude_code_numbered_options"&&J.extracted?.option).map((J)=>J.extracted?.option).filter((J)=>J!==void 0);if($.length>=2||F)return{...B,type:"question",options:$.length>0?$:void 0,detail:F?"plan_approval":void 0,confidence:0.85};let E=D.filter((J)=>J.extracted?.option&&J.type!=="claude_code_numbered_options").map((J)=>J.extracted?.option).filter((J)=>J!==void 0);if(E.length>=2)return{...B,type:"question",options:E,confidence:0.85};return null}function M8(D,F={}){let{linesToAnalyze:B=50,minConfidence:$=0.3}=F,E=D.split(`
|
|
463
463
|
`),J=E.slice(-B).join(`
|
|
464
464
|
`),X=N2(J),Y={timestamp:Date.now(),rawOutput:J},Q=z8(X,v4);if(Q)return{...Y,type:"permission",detail:Q.type.replace("_permission",""),confidence:0.9};let q=q3(X,q1.filter((j)=>j.type==="claude_code_plan_approval")),H=N2(E.slice(-15).join(`
|
|
465
465
|
`)),G=A8(H,q1),U=uQ(G,q,Y);if(U)return U;let A=G.find((j)=>j.type==="yes_no_question");if(A)return{...Y,type:"question",options:["Yes","No"],detail:`default: ${A.extracted?.default||"y"}`,confidence:0.85};let z=z8(X,k4);if(z)return{...Y,type:"error",detail:z.extracted?.message||z.match[0],confidence:0.8};let C=z8(X,f4);if(C)return{...Y,type:"tool_use",detail:`${C.type}: ${C.extracted?.command||C.extracted?.file||C.extracted?.query||""}`,confidence:0.75};if(q3(X,w4))return{...Y,type:"working",confidence:0.7};if(q3(X,P4))return{...Y,type:"complete",confidence:0.6};let b=N2(E.slice(-5).join(`
|
|
466
466
|
`));if(q3(b,u4))return{...Y,type:"idle",confidence:0.7};let I=b.trim();if(I.endsWith(">")||I.match(/>\s*$/))return{...Y,type:"idle",detail:"prompt detected",confidence:0.65};return{...Y,type:"unknown",confidence:$}}var x4=Z(()=>{H1()});var G1=Z(()=>{H1();x4()});var h4={};t(h4,{spawnWorkerFromTemplate:()=>mQ});import{exec as fQ}from"child_process";import{promisify as xQ}from"util";async function yQ(D,F){let B=await MD(F);if(B?.nativeTeamParentSessionId)return B.nativeTeamParentSessionId;return await J0()??crypto.randomUUID()}function hQ(D,F,B,$){let E=D.provider==="claude",J={provider:D.provider,team:D.team,role:D.role,skill:D.skill,extraArgs:D.extraArgs,sessionId:E&&!$?crypto.randomUUID():void 0,resume:E?$:void 0};if(E)J.nativeTeam={enabled:!0,parentSessionId:F,color:B,agentType:D.role??"general-purpose",agentName:D.role};return J}function gQ(D){if(D.env&&Object.keys(D.env).length>0)return`env ${Object.entries(D.env).map(([B,$])=>`${B}=${$}`).join(" ")} ${D.command}`;return D.command}async function lQ(D,F){let B=F?`${D}-${F}`:D;return(await m()).some((E)=>E.id===B)?`${B}-${crypto.randomUUID().slice(0,8)}`:B}async function mQ(D,F){let B=D.cwd??process.cwd(),$=D.team,E=await yQ(B,$);await O2($,`Genie team: ${$}`,E);let J=await d3($),X=hQ(D,E,J,F),Y=g3(l0(X)),Q=gQ(Y),q=await lQ($,D.role),H="genie",G=null;try{G=await Z2(H,$,B)}catch{}let U=G?`-t '${G.windowId}'`:"",{stdout:A}=await y4(`tmux split-window -d ${U} -P -F '#{pane_id}' ${Q}`),z=A.trim(),C=`${H}:${G?.windowName??""}`;if(!G){let FD=await KD(H);C=FD[0]?FD[0].id:`${H}:`}try{await y4(`tmux ${e3(C,D8())}`)}catch{}let b=new Date().toISOString(),I=D.role??"worker",j=D.provider==="claude",f={id:q,paneId:z,session:H,provider:D.provider,transport:"tmux",role:D.role,skill:D.skill,team:$,worktree:null,startedAt:b,state:"spawning",lastStateChange:b,repoPath:B,claudeSessionId:F??X.sessionId,nativeTeamEnabled:j,nativeAgentId:`${I}@${$}`,nativeColor:J,parentSessionId:E,window:G?.windowName,windowName:G?.windowName,windowId:G?.windowId};if(await y0(f),await L2($,{agentName:I,agentType:D.role??"general-purpose",color:J??"blue",tmuxPaneId:z,cwd:B}),await j2($,"team-lead",{from:I,text:`Worker ${I} (${D.provider}) auto-spawned${F?" with --resume":""}. Ready for tasks.`,summary:`${I} auto-spawned`,timestamp:b,color:J??"blue",read:!1}),J)await d0(z,J,G?.windowId);return{worker:f,paneId:z,workerId:q}}var y4;var g4=Z(()=>{_D();S2();l3();D3();s();y4=xQ(fQ)});var p4={};t(p4,{sendMessage:()=>sQ,getInbox:()=>eQ});async function cQ(D,F=pQ){let B=Date.now();while(Date.now()-B<F){try{let $=await YD(D,30);if(M8($).type==="idle")return!0}catch{}await new Promise(($)=>setTimeout($,dQ))}return!1}async function m4(D){let F=await m(),B=[],$=[],E=[];for(let J of F){if(J.state==="suspended")continue;if(!await AD(J.paneId))continue;if(J.id===D)B.push(J);else if(J.role===D)$.push(J);else if(`${J.team}:${J.role}`===D)E.push(J)}if(B.length>0)return B;if($.length>0)return $;return E}async function iQ(D){let F=await m4(D);return F.length===1?F[0]:null}async function nQ(D,F){if(D&&D.state!=="suspended"&&await AD(D.paneId))return{worker:D,respawned:!1};let B=await iQ(F);if(B)return{worker:B,respawned:!1};if(!process.env.TMUX)return null;let $=await h0(),E=[D?.role,D?.id,F].filter((q)=>Boolean(q)),J=[...new Set(E)],X=D?.team,Y=$.find((q)=>{if(X&&q.team!==X)return!1;return J.some((H)=>q.id===H||q.role===H||`${q.team}:${q.role}`===H)});if(!Y)return null;let Q=Y.provider==="claude"?D?.claudeSessionId??Y.lastSessionId:void 0;try{if(await rQ(F,X),D)await TD(D.id);let{spawnWorkerFromTemplate:q}=await Promise.resolve().then(() => (g4(),h4)),H=await q(Y,Q);if(await E0({...Y,lastSpawnedAt:new Date().toISOString(),lastSessionId:H.worker.claudeSessionId}),await cQ(H.paneId),!await AD(H.paneId))return await TD(H.worker.id),null;return{worker:H.worker,respawned:!0}}catch{return null}}async function rQ(D,F){let B=await m();for(let $ of B){if(F&&$.team!==F)continue;if(!($.role===D||$.id===D))continue;if(await AD($.paneId))continue;await TD($.id)}}async function l4(D,F,B,$){let E=await Y1(D,F,B.id,$),J=B.nativeTeamEnabled&&B.team&&B.role?await aQ(B,E):await tQ(B,E);if(J)await Q1(D,B.id,E.id);return{messageId:E.id,workerId:B.id,delivered:J}}async function oQ(D,F,B,$,E){let J=E??await i3();if(!J)return null;let X=await C2(J).catch(()=>null);if(!X)return null;if(!X.members?.some((Q)=>Q.name===B||Q.agentId===`${B}@${J}`))return null;try{let Q=await Y1(D,F,B,$),q={from:F,text:$,summary:$.length>50?`${$.substring(0,50)}...`:$,timestamp:new Date().toISOString(),color:"blue",read:!1};return await j2(J,B,q),await Q1(D,B,Q.id),{messageId:Q.id,workerId:B,delivered:!0}}catch{return null}}async function sQ(D,F,B,$,E){let J=await m4(B);if(J.length===1)return l4(D,F,J[0],$);if(J.length>1)return{messageId:"",workerId:B,delivered:!1,reason:`Worker "${B}" is ambiguous. Found ${J.length} live matches: ${J.map((H)=>H.id).join(", ")}. Use exact worker ID.`};let{resolve:X}=await Promise.resolve().then(() => (a0(),s0)),Y=await X(B),Q=await yD(B);if(!Q){let H=await m();Q=H.find((G)=>G.role===B&&G.state==="suspended")??H.find((G)=>G.role===B)??null}if(Y||Q){let H=await nQ(Q,B);if(H)return l4(D,F,H.worker,$)}let q=await oQ(D,F,B,$,E);if(q)return q;return{messageId:"",workerId:B,delivered:!1,reason:`Worker "${B}" not found or not alive`}}async function aQ(D,F){try{let B=b4(F,D.nativeColor??"blue"),$=D.role??D.id;return await j2(D.team??"",$,B),!0}catch{return!1}}async function tQ(D,F){if(!D.paneId)return!1;if(!/^%\d+$/.test(D.paneId))return!1;try{let B=F.body.replace(/'/g,"'\\''");return await w(`send-keys -t '${D.paneId}' '${B}'`),await new Promise(($)=>setTimeout($,200)),await w(`send-keys -t '${D.paneId}' Enter`),!0}catch{return!1}}async function eQ(D,F){return N4(D,F)}var pQ=15000,dQ=1000;var d4=Z(()=>{_D();S2();I4();G1();s()});var n4={};t(n4,{readMessages:()=>Eq,postMessage:()=>$q});import{appendFile as Dq,mkdir as Fq,readFile as Bq}from"fs/promises";import{join as c4}from"path";function i4(D){return c4(D,".genie","chat")}function W1(D,F){let B=F.replace(/\//g,"--");return c4(i4(D),`${B}.jsonl`)}async function $q(D,F,B,$){let E=i4(D);await Fq(E,{recursive:!0});let J=await $D(W1(D,F));try{let X={id:`chat-${Q3()}`,sender:B,body:$,timestamp:new Date().toISOString()},Y=W1(D,F);return await Dq(Y,`${JSON.stringify(X)}
|
|
467
467
|
`),X}finally{await J()}}async function Eq(D,F,B){let $=W1(D,F),E;try{E=await Bq($,"utf-8")}catch{return[]}let J=E.trim().split(`
|
|
468
468
|
`).filter(Boolean),X=[];for(let Y of J)try{X.push(JSON.parse(Y))}catch{}if(B){let Y=new Date(B).getTime();X=X.filter((Q)=>new Date(Q.timestamp).getTime()>=Y)}return X}var r4=Z(()=>{E1();M2()});var WF={};t(WF,{getOrCreateSession:()=>nq});import{mkdir as lq,readFile as mq,writeFile as pq}from"fs/promises";import{homedir as dq}from"os";import{dirname as cq,join as qF}from"path";function GF(){return qF(process.env.GENIE_HOME??qF(dq(),".genie"),"sessions.json")}async function iq(){try{let D=await mq(GF(),"utf-8");return JSON.parse(D)}catch{return{sessions:{}}}}async function HF(D){let F=GF();await lq(cq(F),{recursive:!0}),await pq(F,JSON.stringify(D,null,2))}async function nq(D){let F=await iq(),B=F.sessions[D];if(B)return B.lastUsedAt=new Date().toISOString(),await HF(F),{uuid:B.uuid,isNew:!1};let $=crypto.randomUUID();return F.sessions[D]={uuid:$,createdAt:new Date().toISOString(),lastUsedAt:new Date().toISOString()},await HF(F),{uuid:$,isNew:!0}}var UF=()=>{};var C1={};t(C1,{sessionCommand:()=>QH,sanitizeWindowName:()=>U3,getAgentsSystemPrompt:()=>AF,buildClaudeCommand:()=>R1});import{spawnSync as rq}from"child_process";import{createHash as oq}from"crypto";import{existsSync as VF,readFileSync as _F,readdirSync as sq,statSync as aq}from"fs";import{homedir as tq}from"os";import{basename as KF,join as M1}from"path";function DH(D){return oq("md5").update(D).digest("hex").slice(0,4)}function AF(){let D=M1(process.cwd(),"AGENTS.md");if(VF(D))return _F(D,"utf-8");return null}function FH(D){return D.replace(/\//g,"-")}function zF(D,F,B){let $=FH(B),E=M1(tq(),".claude","projects",$);if(!VF(E))return null;let J;try{J=sq(E).filter((X)=>X.endsWith(".jsonl")).map((X)=>{let Y=M1(E,X);return{path:Y,mtime:aq(Y).mtimeMs}}).sort((X,Y)=>Y.mtime-X.mtime)}catch{return null}for(let{path:X}of J)try{let Y=_F(X,"utf-8").split(`
|
|
469
|
-
`)[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 MF(D,F){await O2(D,`Genie team: ${D}`,"pending"),await L2(D,{agentName:"team-lead",agentType:"general-purpose",color:"blue",cwd:F})}function R1(D,F,B){return v6(D,{systemPrompt:F,resumeSessionId:B})}async function BH(D,F){let B=U3(KF(F));if(!await s3(D,B))return B;if(await k6(`${D}:${B}`,"GENIE_CWD")===F)return B;return`${B}-${DH(F)}`}async function $H(D,F,B,$){if(await MF(F,B),console.log(`Native team "${F}" ready at ~/.claude/teams/${
|
|
469
|
+
`)[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 MF(D,F){await O2(D,`Genie team: ${D}`,"pending"),await L2(D,{agentName:"team-lead",agentType:"general-purpose",color:"blue",cwd:F})}function R1(D,F,B){return v6(D,{systemPrompt:F,resumeSessionId:B})}async function BH(D,F){let B=U3(KF(F));if(!await s3(D,B))return B;if(await k6(`${D}:${B}`,"GENIE_CWD")===F)return B;return`${B}-${DH(F)}`}async function $H(D,F,B,$){if(await MF(F,B),console.log(`Native team "${F}" ready at ~/.claude/teams/${n(F)}/`),console.log(`Creating session "${D}"...`),!await w6(D))console.error(`Failed to create session "${D}"`),process.exit(1);let X=(await KD(D))[0];if(!X)console.error(`Failed to find initial window in session "${D}"`),process.exit(1);await w(`rename-window -t ${u(X.id)} ${u(F)}`),await w(`set-window-option -t ${u(X.id)} automatic-rename off`),await o3(`${D}:${F}`,"GENIE_CWD",B);let Y=`${D}:${F}`,Q=`cd ${u(B)}`;await w(`send-keys -t ${u(Y)} ${u(Q)} Enter`);let q=zF(n(F),"team-lead",B);if(q)console.log(`Resuming previous session: ${q}`);let H=R1(F,$||void 0,q||void 0);await w(`send-keys -t ${u(Y)} ${u(H)} Enter`),console.log(`Started Claude Code as team-lead@${n(F)} in ${B}`)}async function EH(D,F,B,$){if((await Z2(D,F,B)).created){console.log(`Created team window "${F}"`),await o3(`${D}:${F}`,"GENIE_CWD",B),await MF(F,B);let J=`${D}:${F}`,X=`cd ${u(B)}`;await w(`send-keys -t ${u(J)} ${u(X)} Enter`);let Y=zF(n(F),"team-lead",B);if(Y)console.log(`Resuming previous session: ${Y}`);let Q=R1(F,$||void 0,Y||void 0);await w(`send-keys -t ${u(J)} ${u(Q)} Enter`),console.log(`Started Claude Code as team-lead@${n(F)} in ${B}`)}await w(`select-window -t ${u(`${D}:${F}`)}`),console.log(`Focused team window "${F}"`)}function U3(D){return D.replace(/\./g,"-")}async function JH(D,F,B){if(B)return U3(B);if(await gD(D))return U3(await BH(D,F));return U3(KF(F))}async function XH(D,F){if(await gD(D))console.log(`Resetting session "${D}"...`),await P6(D);await c3(F)}function YH(D,F){console.log("Attaching...");let B=`${D}:${F}`,$=process.env.TMUX?"switch-client":"attach";rq("tmux",[$,"-t",B],{stdio:"inherit"})}async function QH(D={}){let F=D.name??eq,B=D.dir??process.cwd();try{let $=await JH(F,B,D.team);if(D.reset)await XH(F,$);let E=await gD(F),J=AF();if(!J)console.warn("Info: No AGENTS.md found in current directory. Team-lead will use orchestration rules only.");if(!E)await $H(F,$,B,J);else console.log(`Session "${F}" already exists`),await EH(F,$,B,J);YH(F,$)}catch($){let E=$ instanceof Error?$.message:String($);console.error(`Error: ${E}`),process.exit(1)}}var eq="genie";var O1=Z(()=>{S2();r3();s()});var x1=tD(f1(),1),{program:zH,createCommand:MH,createArgument:RH,createOption:CH,CommanderError:OH,InvalidArgumentError:LH,InvalidOptionArgumentError:jH,Command:y1,Argument:SH,Option:TH,Help:ZH}=x1.default;import{existsSync as p$}from"fs";var{$:K5}=globalThis.Bun;import{existsSync as h1,unlinkSync as AB}from"fs";import{homedir as g1}from"os";import{join as z3}from"path";var l1=z3(g1(),".claude"),zB=z3(l1,"hooks"),MB=z3(l1,"settings.json"),RB="genie-bash-hook.sh";function m1(){return MB}function p1(){return z3(zB,RB)}function d1(){return h1(p1())}function c1(){let D=p1();if(h1(D))AB(D)}function P8(D){let F=g1();if(D.startsWith(`${F}/`))return`~${D.slice(F.length)}`;if(D===F)return"~";return D}PD();var{$:g8}=globalThis.Bun;async function X2(D){try{let B=(await g8`which ${D}`.quiet().text()).trim();if(!B)return{exists:!1};let $;try{let J=(await g8`${D} --version`.quiet().text()).split(`
|
|
470
470
|
`)[0].trim(),X=J.match(/(\d+\.[\d.]+[a-z0-9-]*)/i);$=X?X[1]:J.slice(0,50)}catch{try{let J=(await g8`${D} -v`.quiet().text()).split(`
|
|
471
471
|
`)[0].trim(),X=J.match(/(\d+\.[\d.]+[a-z0-9-]*)/i);$=X?X[1]:J.slice(0,50)}catch{}}return{exists:!0,version:$,path:B}}catch{return{exists:!1}}}function d$(D){console.log(),console.log(`\x1B[1m${D}:\x1B[0m`)}function c$(D){let B={pass:"\x1B[32m\u2713\x1B[0m",fail:"\x1B[31m\u2717\x1B[0m",warn:"\x1B[33m!\x1B[0m"}[D.status],$=D.message?` ${D.message}`:"";if(console.log(` ${B} ${D.name}${$}`),D.suggestion)console.log(` \x1B[2m${D.suggestion}\x1B[0m`)}async function i$(){let D=[],F=await X2("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 B=await X2("jq");if(B.exists)D.push({name:"jq",status:"pass",message:B.version||""});else D.push({name:"jq",status:"fail",suggestion:"Install with: brew install jq (or apt install jq)"});let $=await X2("bun");if($.exists)D.push({name:"bun",status:"pass",message:$.version||""});else D.push({name:"bun",status:"fail",suggestion:"Install with: curl -fsSL https://bun.sh/install | bash"});let E=await X2("claude");if(E.exists)D.push({name:"Claude Code",status:"pass",message:E.version||""});else D.push({name:"Claude Code",status:"warn",suggestion:"Install with: npm install -g @anthropic-ai/claude-code"});return D}async function n$(){let D=[];if(J2())D.push({name:"Genie config exists",status:"pass",message:P8(L0())});else D.push({name:"Genie config exists",status:"warn",message:"not found",suggestion:"Run: genie setup"});if(W5())D.push({name:"Setup complete",status:"pass"});else D.push({name:"Setup complete",status:"warn",message:"not completed",suggestion:"Run: genie setup"});let F=m1();if(p$(F))D.push({name:"Claude settings exists",status:"pass",message:P8(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 r$(){let D=[];try{if((await K5`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 B=(await ED()).session.name;try{if((await K5`tmux has-session -t ${B} 2>/dev/null`.quiet()).exitCode===0)D.push({name:`Session '${B}' exists`,status:"pass"});else D.push({name:`Session '${B}' exists`,status:"warn",suggestion:`Start with: tmux new-session -d -s ${B}`})}catch{D.push({name:`Session '${B}' exists`,status:"warn",message:"could not check"})}return D}async function o$(){let D=[];if(!J2())return D.push({name:"Worker profiles",status:"warn",message:"no genie config",suggestion:"Run: genie setup"}),D;let F=await ED(),B=F.workerProfiles;if(!B||Object.keys(B).length===0)return D.push({name:"Worker profiles",status:"pass",message:"none configured (using defaults)"}),D;let $=Object.keys(B).length;D.push({name:"Profiles configured",status:"pass",message:`${$} profile${$===1?"":"s"}`});for(let E of Object.keys(B))D.push({name:`Profile '${E}'`,status:"pass",message:"claude (direct)"});if(F.defaultWorkerProfile)if(B[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 N3(D,F,B){d$(D);for(let $ of F){if(c$($),$.status==="fail")B.errors=!0;if($.status==="warn")B.warnings=!0}}async function A5(){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(N3("Prerequisites",await i$(),D),N3("Configuration",await n$(),D),N3("Tmux",await r$(),D),N3("Worker Profiles",await o$(),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 EJ}from"os";import{join as JJ}from"path";var j0=(D,F=[])=>D.name==="up"||F.includes("vim")&&D.name==="k"||F.includes("emacs")&&D.ctrl&&D.name==="p",b3=(D,F=[])=>D.name==="down"||F.includes("vim")&&D.name==="j"||F.includes("emacs")&&D.ctrl&&D.name==="n";var S0=(D)=>D.name==="backspace",T0=(D)=>D.name==="tab",l8=(D)=>"1234567890".includes(D.name),Y2=(D)=>D.name==="enter"||D.name==="return";class m8 extends Error{name="AbortPromptError";message="Prompt was aborted";constructor(D){super();this.cause=D?.cause}}class p8 extends Error{name="CancelPromptError";message="Prompt was canceled"}class I3 extends Error{name="ExitPromptError"}class d8 extends Error{name="HookError"}class Z0 extends Error{name="ValidationError"}import{AsyncResource as e$}from"async_hooks";import{AsyncLocalStorage as s$,AsyncResource as a$}from"async_hooks";var z5=new s$;function t$(D){return{rl:D,hooks:[],hooksCleanup:[],hooksEffect:[],index:0,handleChange(){}}}function M5(D,F){let B=t$(D);return z5.run(B,()=>{function $(E){B.handleChange=()=>{B.index=0,E()},B.handleChange()}return F($)})}function Q2(){let D=z5.getStore();if(!D)throw new d8("[Inquirer] Hook functions can only be called from within a prompt");return D}function c8(){return Q2().rl}function i8(D){let F=(...B)=>{let $=Q2(),E=!1,J=$.handleChange;$.handleChange=()=>{E=!0};let X=D(...B);if(E)J();return $.handleChange=J,X};return a$.bind(F)}function i2(D){let F=Q2(),{index:B}=F,$={get(){return F.hooks[B]},set(J){F.hooks[B]=J},initialized:B in F.hooks},E=D($);return F.index++,E}function R5(){Q2().handleChange()}var q2={queue(D){let F=Q2(),{index:B}=F;F.hooksEffect.push(()=>{F.hooksCleanup[B]?.();let $=D(c8());if($!=null&&typeof $!=="function")throw new Z0("useEffect return value must be a cleanup function or nothing.");F.hooksCleanup[B]=$})},run(){let D=Q2();i8(()=>{D.hooksEffect.forEach((F)=>{F()}),D.hooksEffect.length=0})()},clearAll(){let D=Q2();D.hooksCleanup.forEach((F)=>{F?.()}),D.hooksEffect.length=0,D.hooksCleanup.length=0}};function c(D){return i2((F)=>{let B=e$.bind(function(J){if(F.get()!==J)F.set(J),R5()});if(F.initialized)return[F.get(),B];let $=typeof D==="function"?D():D;return F.set($),[$,B]})}function wD(D,F){i2((B)=>{let $=B.get();if(!Array.isArray($)||F.some((J,X)=>!Object.is(J,$[X])))q2.queue(D);B.set(F)})}var XD=tD(v3(),1);import jD from"process";function BE(){if(jD.platform!=="win32")return jD.env.TERM!=="linux";return Boolean(jD.env.WT_SESSION)||Boolean(jD.env.TERMINUS_SUBLIME)||jD.env.ConEmuTask==="{cmd::Cmder}"||jD.env.TERM_PROGRAM==="Terminus-Sublime"||jD.env.TERM_PROGRAM==="vscode"||jD.env.TERM==="xterm-256color"||jD.env.TERM==="alacritty"||jD.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var O5={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"},L5={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"},$E={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"},EE={...O5,...L5},JE={...O5,...$E},XE=BE(),YE=XE?EE:JE,n2=YE,kG=Object.entries(L5);var j5={prefix:{idle:XD.default.blue("?"),done:XD.default.green(n2.tick)},spinner:{interval:80,frames:["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"].map((D)=>XD.default.yellow(D))},style:{answer:XD.default.cyan,message:XD.default.bold,error:(D)=>XD.default.red(`> ${D}`),defaultAnswer:(D)=>XD.default.dim(`(${D})`),help:XD.default.dim,highlight:XD.default.cyan,key:(D)=>XD.default.cyan(XD.default.bold(`<${D}>`))}};function S5(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 T5(...D){let F={};for(let B of D)for(let[$,E]of Object.entries(B)){let J=F[$];F[$]=S5(J)&&S5(E)?T5(J,E):E}return F}function uD(...D){let F=[j5,...D.filter((B)=>B!=null)];return T5(...F)}function H2({status:D="idle",theme:F}){let[B,$]=c(!1),[E,J]=c(0),{prefix:X,spinner:Y}=uD(F);if(wD(()=>{if(D==="loading"){let q,H=-1,G=setTimeout(()=>{$(!0),q=setInterval(()=>{H=H+1,J(H%Y.frames.length)},Y.interval)},300);return()=>{clearTimeout(G),clearInterval(q)}}else $(!1)},[D]),B)return Y.frames[E];return typeof X==="string"?X:X[D==="loading"?"idle":D]??X.idle}function N0(D,F){return i2((B)=>{let $=B.get();if(!$||$.dependencies.length!==F.length||$.dependencies.some((E,J)=>E!==F[J])){let E=D();return B.set({value:E,dependencies:F}),E}return $.value})}function G2(D){return c({current:D})[0]}function W2(D){let F=G2(D);F.current=D,wD((B)=>{let $=!1,E=i8((J,X)=>{if($)return;F.current(X,B)});return B.input.on("keypress",E),()=>{$=!0,B.input.removeListener("keypress",E)}},[])}var F7=tD(N5(),1),B7=tD(D7(),1);function v0(D,F){return D.split(`
|
|
472
472
|
`).flatMap((B)=>B7.default(B,F,{trim:!1,hard:!0}).split(`
|
|
@@ -598,4 +598,4 @@ Run 'genie ls' to list agents.`)}function DF(D,F){let B=[];if(D.workerId){if(B.p
|
|
|
598
598
|
`),A=U.length>0?U.length-1:0,z=U[U.length-1];for(let C of G.slice(A))if(C&&C!==z)F(C)}let Q=setInterval(async()=>{if(!X){clearInterval(Q);return}try{let q=W3(await YD(E,100));if(q!==J)Y(J,q),J=q}catch{clearInterval(Q),X=!1}},500);return()=>{X=!1,clearInterval(Q)}}async function EF(D,F){try{let B=await C8(D),$=B.paneId,E=B.session||D,X=G5().readLines,Y={lines:F.lines?Number.parseInt(F.lines,10):X,from:F.from?Number.parseInt(F.from,10):void 0,to:F.to?Number.parseInt(F.to,10):void 0,range:F.range,search:F.search,grep:F.grep,follow:F.follow,all:F.all,reverse:F.reverse,pane:$};if(F.follow){console.log(`Following "${D}" (Ctrl+C to stop)...`),console.log("");let q=await $F(E,(H)=>{console.log(H)},{pane:$});process.on("SIGINT",()=>{q(),console.log(`
|
|
599
599
|
Stopped following`),process.exit(0)}),await new Promise(()=>{});return}let Q=await BF(E,Y);if(F.json){let q=Q.split(`
|
|
600
600
|
`);console.log(JSON.stringify({target:D,session:E,lineCount:q.length,content:q},null,2));return}console.log(Q)}catch(B){let $=B instanceof Error?B.message:String(B);console.error(`Error reading logs: ${$}`),process.exit(1)}}D3();import{existsSync as XF}from"fs";import{copyFile as wq,mkdir as uq,readFile as fq}from"fs/promises";import{join as O8,resolve as YF}from"path";function QF(D){let F=D.command("team").description("Team lifecycle management");F.command("create <name>").description("Create a new team with a git worktree").requiredOption("--repo <path>","Path to the git repository").option("--branch <branch>","Base branch to create from","dev").option("--wish <slug>","Wish slug \u2014 auto-spawns a task leader with wish context").action(async(B,$)=>{try{if($.wish){let J=YF($.repo),X=O8(J,".genie","wishes",$.wish,"WISH.md");if(!XF(X))console.error(`Error: Wish not found at ${X}`),process.exit(1)}let E=await i6(B,$.repo,$.branch);if(console.log(`Team "${E.name}" created.`),console.log(` Worktree: ${E.worktreePath}`),console.log(` Branch: ${E.name} (from ${E.baseBranch})`),E.nativeTeamsEnabled)console.log(" Native teams: enabled");if($.wish)await xq(E,$.wish,$.repo)}catch(E){let J=E instanceof Error?E.message:String(E);console.error(`Error: ${J}`),process.exit(1)}}),F.command("hire <agent>").description('Add an agent to a team ("council" hires all 10 council members)').option("--team <name>","Team name (auto-detects from leader context if omitted)").action(async(B,$)=>{try{let E=$.team??await JF();if(!E)console.error("Error: Could not detect team. Use --team <name> to specify."),process.exit(1);let J=await $8(E,B);if(J.length===0)console.log(`Agent "${B}" is already a member of "${E}".`);else if(B==="council"){console.log(`Hired ${J.length} council members to "${E}":`);for(let X of J)console.log(` + ${X}`)}else console.log(`Hired "${B}" to team "${E}".`)}catch(E){let J=E instanceof Error?E.message:String(E);console.error(`Error: ${J}`),process.exit(1)}}),F.command("fire <agent>").description("Remove an agent from a team").option("--team <name>","Team name (auto-detects from leader context if omitted)").action(async(B,$)=>{try{let E=$.team??await JF();if(!E)console.error("Error: Could not detect team. Use --team <name> to specify."),process.exit(1);if(await n6(E,B))console.log(`Fired "${B}" from team "${E}".`);else console.error(`Agent "${B}" is not a member of "${E}".`),process.exit(1)}catch(E){let J=E instanceof Error?E.message:String(E);console.error(`Error: ${J}`),process.exit(1)}}),F.command("ls [name]").alias("list").description("List teams or members of a team").option("--json","Output as JSON").action(async(B,$)=>{try{if(B)await yq(B,$.json);else await hq($.json)}catch(E){let J=E instanceof Error?E.message:String(E);console.error(`Error: ${J}`),process.exit(1)}}),F.command("disband <name>").description("Disband a team: kill members, remove worktree, delete config").action(async(B)=>{try{if(await r6(B))console.log(`Team "${B}" disbanded.`);else console.error(`Team "${B}" not found.`),process.exit(1)}catch($){let E=$ instanceof Error?$.message:String($);console.error(`Error: ${E}`),process.exit(1)}}),F.command("done <name>").description("Mark a team as done").action(async(B)=>{try{await J8(B,"done"),console.log(`Team "${B}" marked as done.`)}catch($){let E=$ instanceof Error?$.message:String($);console.error(`Error: ${E}`),process.exit(1)}}),F.command("blocked <name>").description("Mark a team as blocked").action(async(B)=>{try{await J8(B,"blocked"),console.log(`Team "${B}" marked as blocked.`)}catch($){let E=$ instanceof Error?$.message:String($);console.error(`Error: ${E}`),process.exit(1)}})}async function xq(D,F,B){let{handleWorkerSpawn:$}=await Promise.resolve().then(() => (Y8(),s9)),E=YF(B),J=O8(E,".genie","wishes",F,"WISH.md");if(!XF(J))console.error(`Error: Wish not found at ${J}`),process.exit(1);let X=O8(D.worktreePath,".genie","wishes",F);await uq(X,{recursive:!0});let Y=O8(X,"WISH.md");await wq(J,Y),console.log(` Wish: copied ${F}/WISH.md into worktree`),await $8(D.name,"leader"),console.log(" Leader: hired");let Q=await fq(Y,"utf-8"),q=["# Task Leader Context","",`**Wish slug:** \`${F}\``,`**Wish file:** \`${Y}\``,`**Team name:** \`${D.name}\``,`**Worktree:** \`${D.worktreePath}\``,"","## Wish Content","",Q].join(`
|
|
601
|
-
`),H=await G0(q)
|
|
601
|
+
`),H=await G0(q),G=`Begin. Read the wish at .genie/wishes/${F}/WISH.md and execute the full lifecycle autonomously. Your team is ${D.name}.`;await $("leader",{provider:"claude",team:D.name,cwd:D.worktreePath,extraArgs:["--append-system-prompt-file",H],initialPrompt:G}),console.log(" Leader: spawned and working")}async function JF(){let D=process.env.GENIE_TEAM;if(D)return D;let F=await E8();if(F.length===1)return F[0].name;return null}async function yq(D,F){let B=await o6(D);if(B===null)console.error(`Team "${D}" not found.`),process.exit(1);if(F){console.log(JSON.stringify(B,null,2));return}if(B.length===0){console.log(`Team "${D}" has no members. Hire agents with: genie team hire <agent> --team ${D}`);return}console.log(""),console.log(`MEMBERS of "${D}"`),console.log("-".repeat(60));for(let $ of B)console.log(` ${$}`);console.log("")}async function hq(D){let F=await E8();if(D){console.log(JSON.stringify(F,null,2));return}if(F.length===0){console.log("No teams found. Create one with: genie team create <name> --repo <path>");return}console.log(""),console.log("TEAMS"),console.log("-".repeat(60));for(let B of F)gq(B);console.log("")}function gq(D){let F=D.status??"in_progress";console.log(` ${D.name} [${F}]`),console.log(` Repo: ${D.repo}`),console.log(` Branch: ${D.name} (from ${D.baseBranch})`),console.log(` Worktree: ${D.worktreePath}`),console.log(` Members: ${D.members.length}`)}var p=new y1;p.name("genie").description("Genie CLI - AI-assisted development").version(F9);async function qH(D){let{getOrCreateSession:F}=await Promise.resolve().then(() => (UF(),WF)),{buildTeamLeadCommand:B}=await Promise.resolve().then(() => (r3(),K9)),{getAgentsSystemPrompt:$}=await Promise.resolve().then(() => (O1(),C1)),{uuid:E,isNew:J}=await F(D),X=$(),Y=B(D,{systemPrompt:X??void 0,...J?{sessionId:E}:{resumeSessionId:E}});console.log(J?`Starting new session: ${D}`:`Resuming session: ${D}`);let{spawnSync:Q}=await import("child_process"),q=Q("sh",["-c",Y],{stdio:"inherit"});if(q.status)process.exit(q.status)}p.command("setup").description("Configure genie settings").option("--quick","Accept all defaults").option("--shortcuts","Only configure keyboard shortcuts").option("--codex","Only configure Codex integration").option("--terminal","Only configure terminal defaults").option("--session","Only configure session settings").option("--reset","Reset configuration to defaults").option("--show","Show current configuration").action(async(D)=>{await x7(D)});p.command("doctor").description("Run diagnostic checks on genie installation").action(A5);p.command("update").description("Update Genie CLI to the latest version").option("--next","Switch to dev builds (npm @next tag)").option("--stable","Switch to stable releases (npm @latest tag)").action(D9);p.command("uninstall").description("Remove Genie CLI and clean up hooks").action(d7);var L8=p.command("shortcuts").description("Manage tmux keyboard shortcuts");L8.action(K6);L8.command("show").description("Show available shortcuts and installation status").action(K6);L8.command("install").description("Install shortcuts to config files (~/.tmux.conf, shell rc)").action(y7);L8.command("uninstall").description("Remove shortcuts from config files").action(h7);QF(p);a9(p);t4(p);q4(p);U4(p);I9(p);p.command("spawn <name>").description("Spawn a new agent by name (resolves from directory or built-ins)").option("--provider <provider>","Provider: claude or codex","claude").option("--team <team>","Team name",process.env.GENIE_TEAM??"genie").option("--model <model>","Model override (e.g., sonnet, opus)").option("--skill <skill>","Skill to load (optional)").option("--layout <layout>","Layout mode: mosaic (default) or vertical").option("--color <color>","Teammate pane border color").option("--plan-mode","Start teammate in plan mode").option("--permission-mode <mode>","Permission mode (e.g., acceptEdits)").option("--extra-args <args...>","Extra CLI args forwarded to provider").option("--cwd <path>","Working directory for the agent (overrides directory entry)").action(async(D,F)=>{try{await sD(D,F)}catch(B){let $=B instanceof Error?B.message:String(B);console.error(`Error: ${$}`),process.exit(1)}});p.command("kill <name>").description("Force kill an agent by name").action(async(D)=>{try{await a6(D)}catch(F){let B=F instanceof Error?F.message:String(F);console.error(`Error: ${B}`),process.exit(1)}});p.command("stop <name>").description("Stop an agent (preserves session for resume)").action(async(D)=>{try{await t6(D)}catch(F){let B=F instanceof Error?F.message:String(F);console.error(`Error: ${B}`),process.exit(1)}});p.command("history <name>").description("Show compressed session history for an agent").option("--full","Show full conversation without compression").option("--since <n>","Show last N user/assistant exchanges",Number.parseInt).option("--json","Output as JSON").option("--raw","Output raw JSONL entries").option("--log-file <path>","Direct path to log file (for testing)").action(async(D,F)=>{await R4(D,F)});p.command("read <name>").description("Read terminal output from an agent pane").option("-n, --lines <number>","Number of lines to read").option("--from <line>","Start line").option("--to <line>","End line").option("--range <range>",'Line range (e.g., "10-20")').option("--search <text>","Search for text").option("--grep <pattern>","Grep for pattern").option("-f, --follow","Follow mode (like tail -f)").option("--all","Show all output").option("-r, --reverse","Reverse order").option("--json","Output as JSON").action(async(D,F)=>{await EF(D,F)});p.command("answer <name> <choice>").description('Answer a question for an agent (use "text:..." for text input)').action(async(D,F)=>{await FF(D,F)});p.command("ls").description("List registered agents with runtime status").option("--json","Output as JSON").action(async(D)=>{try{await e6(D)}catch(F){let B=F instanceof Error?F.message:String(F);console.error(`Error: ${B}`),process.exit(1)}});var b2=process.argv.slice(2);if(b2.length===0||b2.every((D)=>D==="--reset")){let{sessionCommand:D}=await Promise.resolve().then(() => (O1(),C1));await D({reset:b2.includes("--reset")}),process.exit(0)}var V3=b2.indexOf("--session");if(V3!==-1&&V3+1<b2.length){let D=b2[V3+1];if(!b2.filter(($,E)=>E!==V3&&E!==V3+1).some(($)=>!$.startsWith("-")))try{await qH(D),process.exit(0)}catch($){console.error(`Error: ${$ instanceof Error?$.message:$}`),process.exit(1)}else p.parse()}else p.parse();
|
package/install.sh
CHANGED
|
@@ -657,8 +657,6 @@ inject_orchestration_prompt() {
|
|
|
657
657
|
mkdir -p "$rules_dir"
|
|
658
658
|
|
|
659
659
|
cat > "$rules_file" <<'ORCHESTRATION_EOF'
|
|
660
|
-
<!-- SOURCE OF TRUTH: This content is injected into ~/.claude/rules/genie-orchestration.md
|
|
661
|
-
by install.sh and smart-install.js. Edits here must be copied to both scripts. -->
|
|
662
660
|
<GENIE_CLI>
|
|
663
661
|
# Genie CLI — MANDATORY Agent Orchestration
|
|
664
662
|
|
|
@@ -679,8 +677,8 @@ If you catch yourself about to use Agent, SendMessage, TeamCreate, or TeamDelete
|
|
|
679
677
|
```bash
|
|
680
678
|
genie spawn <role> # Spawn agent (implementor, tests, review, fix, refactor)
|
|
681
679
|
genie kill <name> # Force kill agent
|
|
682
|
-
genie stop <name> # Graceful stop
|
|
683
|
-
genie ls # List all agents
|
|
680
|
+
genie stop <name> # Graceful stop (preserves session for resume)
|
|
681
|
+
genie ls # List all agents with status
|
|
684
682
|
genie history <name> # Session history
|
|
685
683
|
genie read <name> --follow # Tail terminal output
|
|
686
684
|
genie answer <name> <choice> # Answer prompt (1-9 or text:...)
|
|
@@ -698,11 +696,23 @@ genie inbox [agent] # View message inbox
|
|
|
698
696
|
### Teams
|
|
699
697
|
|
|
700
698
|
```bash
|
|
701
|
-
genie team create <name> --repo <path> # Create
|
|
699
|
+
genie team create <name> --repo <path> # Create team with git worktree
|
|
700
|
+
genie team create <name> --repo <path> --wish <slug> # Create team + auto-spawn task leader
|
|
702
701
|
genie team hire <agent> # Add agent to team
|
|
703
702
|
genie team fire <agent> # Remove agent from team
|
|
704
703
|
genie team ls [name] # List teams or team members
|
|
705
704
|
genie team disband <name> # Disband and clean up team
|
|
705
|
+
genie team done <name> # Mark team as done
|
|
706
|
+
genie team blocked <name> # Mark team as blocked
|
|
707
|
+
```
|
|
708
|
+
|
|
709
|
+
### Agent Directory
|
|
710
|
+
|
|
711
|
+
```bash
|
|
712
|
+
genie dir add <name> --dir <path> # Register agent directory
|
|
713
|
+
genie dir rm <name> # Remove agent from directory
|
|
714
|
+
genie dir ls [name] # List agents or agent details
|
|
715
|
+
genie dir edit <name> # Edit agent config
|
|
706
716
|
```
|
|
707
717
|
|
|
708
718
|
### Dispatch (Skill-Bound Work)
|
|
@@ -722,6 +732,14 @@ genie status <slug> # Check wish/group status
|
|
|
722
732
|
genie reset <ref> # Reset stuck group
|
|
723
733
|
```
|
|
724
734
|
|
|
735
|
+
### System
|
|
736
|
+
|
|
737
|
+
```bash
|
|
738
|
+
genie update # Update to latest stable version
|
|
739
|
+
genie update --next # Switch to dev builds (npm @next tag)
|
|
740
|
+
genie update --stable # Switch to stable releases (npm @latest tag)
|
|
741
|
+
```
|
|
742
|
+
|
|
725
743
|
## 3. Skill Flow — Auto-Invocation Chain
|
|
726
744
|
|
|
727
745
|
Skills trigger the next step automatically where possible:
|
|
@@ -745,7 +763,17 @@ Skills trigger the next step automatically where possible:
|
|
|
745
763
|
Decisions stuck after 2+ exchanges ──▸ suggest /council
|
|
746
764
|
```
|
|
747
765
|
|
|
748
|
-
## 4.
|
|
766
|
+
## 4. Task Leader Workflow
|
|
767
|
+
|
|
768
|
+
For autonomous wish execution, use `--wish` to spawn a task leader that works without manual intervention:
|
|
769
|
+
|
|
770
|
+
```bash
|
|
771
|
+
genie team create <name> --repo <path> --wish <slug>
|
|
772
|
+
```
|
|
773
|
+
|
|
774
|
+
This creates the team, copies the wish into the worktree, hires a leader, and auto-sends a kickoff prompt so the leader begins immediately — no manual `genie send` needed.
|
|
775
|
+
|
|
776
|
+
## 5. Team Lifecycle
|
|
749
777
|
|
|
750
778
|
```
|
|
751
779
|
create team ──▸ hire agents ──▸ dispatch work ──▸ review ──▸ PR to dev ──▸ QA ──▸ disband
|
|
@@ -758,9 +786,16 @@ create team ──▸ hire agents ──▸ dispatch work ──▸ review ─
|
|
|
758
786
|
5. Workers signal completion via `genie send`; leader runs `/review`
|
|
759
787
|
6. Create PR targeting `dev`. CI must be green before merge.
|
|
760
788
|
7. QA loop on dev: test against wish criteria → `/fix` → retest
|
|
761
|
-
8. `
|
|
789
|
+
8. If `autoMergeDev` config is true, leader merges PR to dev automatically. Otherwise, leave PR open for human review.
|
|
790
|
+
9. `genie team disband <name>` — clean up when done
|
|
791
|
+
|
|
792
|
+
## 6. Configuration
|
|
793
|
+
|
|
794
|
+
Key config options in `~/.genie/config.json`:
|
|
795
|
+
|
|
796
|
+
- **`autoMergeDev`** (boolean, default: false) — When true, task leaders can auto-merge PRs to `dev` after CI passes. When false (default), PRs are left open for human review.
|
|
762
797
|
|
|
763
|
-
##
|
|
798
|
+
## 7. Rules
|
|
764
799
|
|
|
765
800
|
- **No native tools.** All agent/team/messaging operations go through `genie` CLI.
|
|
766
801
|
- **Role separation.** Leader orchestrates; workers implement. Workers never spawn other agents.
|
package/openclaw.plugin.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "genie",
|
|
3
|
-
"version": "3.260315.
|
|
3
|
+
"version": "3.260315.3",
|
|
4
4
|
"description": "Human-AI partnership for Claude Code. Share a terminal, orchestrate workers, evolve together. Brainstorm ideas, turn them into wishes, execute with /work, validate with /review, and ship as one team.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Namastex Labs"
|
|
@@ -260,8 +260,8 @@ If you catch yourself about to use Agent, SendMessage, TeamCreate, or TeamDelete
|
|
|
260
260
|
\`\`\`bash
|
|
261
261
|
genie spawn <role> # Spawn agent (implementor, tests, review, fix, refactor)
|
|
262
262
|
genie kill <name> # Force kill agent
|
|
263
|
-
genie stop <name> # Graceful stop
|
|
264
|
-
genie ls # List all agents
|
|
263
|
+
genie stop <name> # Graceful stop (preserves session for resume)
|
|
264
|
+
genie ls # List all agents with status
|
|
265
265
|
genie history <name> # Session history
|
|
266
266
|
genie read <name> --follow # Tail terminal output
|
|
267
267
|
genie answer <name> <choice> # Answer prompt (1-9 or text:...)
|
|
@@ -279,11 +279,23 @@ genie inbox [agent] # View message inbox
|
|
|
279
279
|
### Teams
|
|
280
280
|
|
|
281
281
|
\`\`\`bash
|
|
282
|
-
genie team create <name> --repo <path> # Create
|
|
282
|
+
genie team create <name> --repo <path> # Create team with git worktree
|
|
283
|
+
genie team create <name> --repo <path> --wish <slug> # Create team + auto-spawn task leader
|
|
283
284
|
genie team hire <agent> # Add agent to team
|
|
284
285
|
genie team fire <agent> # Remove agent from team
|
|
285
286
|
genie team ls [name] # List teams or team members
|
|
286
287
|
genie team disband <name> # Disband and clean up team
|
|
288
|
+
genie team done <name> # Mark team as done
|
|
289
|
+
genie team blocked <name> # Mark team as blocked
|
|
290
|
+
\`\`\`
|
|
291
|
+
|
|
292
|
+
### Agent Directory
|
|
293
|
+
|
|
294
|
+
\`\`\`bash
|
|
295
|
+
genie dir add <name> --dir <path> # Register agent directory
|
|
296
|
+
genie dir rm <name> # Remove agent from directory
|
|
297
|
+
genie dir ls [name] # List agents or agent details
|
|
298
|
+
genie dir edit <name> # Edit agent config
|
|
287
299
|
\`\`\`
|
|
288
300
|
|
|
289
301
|
### Dispatch (Skill-Bound Work)
|
|
@@ -303,6 +315,14 @@ genie status <slug> # Check wish/group status
|
|
|
303
315
|
genie reset <ref> # Reset stuck group
|
|
304
316
|
\`\`\`
|
|
305
317
|
|
|
318
|
+
### System
|
|
319
|
+
|
|
320
|
+
\`\`\`bash
|
|
321
|
+
genie update # Update to latest stable version
|
|
322
|
+
genie update --next # Switch to dev builds (npm @next tag)
|
|
323
|
+
genie update --stable # Switch to stable releases (npm @latest tag)
|
|
324
|
+
\`\`\`
|
|
325
|
+
|
|
306
326
|
## 3. Skill Flow — Auto-Invocation Chain
|
|
307
327
|
|
|
308
328
|
Skills trigger the next step automatically where possible:
|
|
@@ -326,7 +346,17 @@ Skills trigger the next step automatically where possible:
|
|
|
326
346
|
Decisions stuck after 2+ exchanges ──▸ suggest /council
|
|
327
347
|
\`\`\`
|
|
328
348
|
|
|
329
|
-
## 4.
|
|
349
|
+
## 4. Task Leader Workflow
|
|
350
|
+
|
|
351
|
+
For autonomous wish execution, use \`--wish\` to spawn a task leader that works without manual intervention:
|
|
352
|
+
|
|
353
|
+
\`\`\`bash
|
|
354
|
+
genie team create <name> --repo <path> --wish <slug>
|
|
355
|
+
\`\`\`
|
|
356
|
+
|
|
357
|
+
This creates the team, copies the wish into the worktree, hires a leader, and auto-sends a kickoff prompt so the leader begins immediately — no manual \`genie send\` needed.
|
|
358
|
+
|
|
359
|
+
## 5. Team Lifecycle
|
|
330
360
|
|
|
331
361
|
\`\`\`
|
|
332
362
|
create team ──▸ hire agents ──▸ dispatch work ──▸ review ──▸ PR to dev ──▸ QA ──▸ disband
|
|
@@ -339,9 +369,16 @@ create team ──▸ hire agents ──▸ dispatch work ──▸ review ─
|
|
|
339
369
|
5. Workers signal completion via \`genie send\`; leader runs \`/review\`
|
|
340
370
|
6. Create PR targeting \`dev\`. CI must be green before merge.
|
|
341
371
|
7. QA loop on dev: test against wish criteria → \`/fix\` → retest
|
|
342
|
-
8. \`
|
|
372
|
+
8. If \`autoMergeDev\` config is true, leader merges PR to dev automatically. Otherwise, leave PR open for human review.
|
|
373
|
+
9. \`genie team disband <name>\` — clean up when done
|
|
374
|
+
|
|
375
|
+
## 6. Configuration
|
|
376
|
+
|
|
377
|
+
Key config options in \`~/.genie/config.json\`:
|
|
378
|
+
|
|
379
|
+
- **\`autoMergeDev\`** (boolean, default: false) — When true, task leaders can auto-merge PRs to \`dev\` after CI passes. When false (default), PRs are left open for human review.
|
|
343
380
|
|
|
344
|
-
##
|
|
381
|
+
## 7. Rules
|
|
345
382
|
|
|
346
383
|
- **No native tools.** All agent/team/messaging operations go through \`genie\` CLI.
|
|
347
384
|
- **Role separation.** Leader orchestrates; workers implement. Workers never spawn other agents.
|
|
@@ -74,6 +74,8 @@ export interface SpawnParams {
|
|
|
74
74
|
promptMode?: 'system' | 'append';
|
|
75
75
|
/** Model override (e.g., 'sonnet', 'opus'). Emits --model flag. */
|
|
76
76
|
model?: string;
|
|
77
|
+
/** Initial prompt to send as the first user message (Claude Code positional [prompt] arg). */
|
|
78
|
+
initialPrompt?: string;
|
|
77
79
|
}
|
|
78
80
|
|
|
79
81
|
/** Result of a successful launch-command build. */
|
|
@@ -118,6 +120,7 @@ const spawnParamsSchema = z.object({
|
|
|
118
120
|
systemPrompt: z.string().optional(),
|
|
119
121
|
promptMode: z.enum(['system', 'append']).optional(),
|
|
120
122
|
model: z.string().optional(),
|
|
123
|
+
initialPrompt: z.string().optional(),
|
|
121
124
|
});
|
|
122
125
|
|
|
123
126
|
/**
|
|
@@ -269,6 +272,11 @@ export function buildClaudeCommand(params: SpawnParams): LaunchCommand {
|
|
|
269
272
|
for (const arg of params.extraArgs) parts.push(escapeShellArg(arg));
|
|
270
273
|
}
|
|
271
274
|
|
|
275
|
+
// Positional [prompt] arg must be last — becomes the first user message
|
|
276
|
+
if (params.initialPrompt) {
|
|
277
|
+
parts.push(escapeShellArg(params.initialPrompt));
|
|
278
|
+
}
|
|
279
|
+
|
|
272
280
|
return {
|
|
273
281
|
command: parts.join(' '),
|
|
274
282
|
provider: 'claude',
|
|
@@ -653,6 +653,8 @@ export interface SpawnOptions {
|
|
|
653
653
|
permissionMode?: string;
|
|
654
654
|
extraArgs?: string[];
|
|
655
655
|
cwd?: string;
|
|
656
|
+
/** Initial prompt to send as the first user message (Claude Code positional [prompt] arg). */
|
|
657
|
+
initialPrompt?: string;
|
|
656
658
|
}
|
|
657
659
|
|
|
658
660
|
/** Resolve agent from directory, returning entry + derived CWD/identity/model/systemPrompt. */
|
|
@@ -708,6 +710,7 @@ async function buildSpawnParams(
|
|
|
708
710
|
systemPromptFile: agent.identityPath ?? undefined,
|
|
709
711
|
systemPrompt: agent.systemPrompt,
|
|
710
712
|
promptMode: agent.entry.promptMode,
|
|
713
|
+
initialPrompt: options.initialPrompt,
|
|
711
714
|
};
|
|
712
715
|
|
|
713
716
|
const { parentSessionId, spawnColor, nativeTeam } = await resolveNativeTeam(team, agent.repoPath, {
|
|
@@ -231,12 +231,14 @@ async function spawnLeaderWithWish(config: TeamConfig, slug: string, repoPath: s
|
|
|
231
231
|
].join('\n');
|
|
232
232
|
const contextFile = await writeContextFile(contextContent);
|
|
233
233
|
|
|
234
|
-
// Spawn leader in the worktree
|
|
234
|
+
// Spawn leader in the worktree with auto-kickoff prompt
|
|
235
|
+
const kickoffPrompt = `Begin. Read the wish at .genie/wishes/${slug}/WISH.md and execute the full lifecycle autonomously. Your team is ${config.name}.`;
|
|
235
236
|
await handleWorkerSpawn('leader', {
|
|
236
237
|
provider: 'claude',
|
|
237
238
|
team: config.name,
|
|
238
239
|
cwd: config.worktreePath,
|
|
239
240
|
extraArgs: ['--append-system-prompt-file', contextFile],
|
|
241
|
+
initialPrompt: kickoffPrompt,
|
|
240
242
|
});
|
|
241
243
|
console.log(' Leader: spawned and working');
|
|
242
244
|
}
|