claude-mem 3.9.13 → 3.9.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,33 +1,33 @@
1
1
  #!/usr/bin/env node
2
- import{createRequire as IX}from"node:module";var jX=Object.create;var{getPrototypeOf:RX,defineProperty:Y1,getOwnPropertyNames:_X}=Object;var OX=Object.prototype.hasOwnProperty;var a0=(D,F,Q)=>{Q=D!=null?jX(RX(D)):{};let B=F||!D||!D.__esModule?Y1(Q,"default",{value:D,enumerable:!0}):Q;for(let Y of _X(D))if(!OX.call(B,Y))Y1(B,Y,{get:()=>D[Y],enumerable:!0});return B};var VD=(D,F)=>()=>(F||D((F={exports:{}}).exports,F),F.exports);var MF=(D,F)=>{for(var Q in F)Y1(D,Q,{get:F[Q],enumerable:!0,configurable:!0,set:(B)=>F[Q]=()=>B})};var zF=(D,F)=>()=>(D&&(F=D(D=0)),F);var gD=IX(import.meta.url);var n2=VD((wX)=>{class J1 extends Error{constructor(D,F,Q){super(Q);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=F,this.exitCode=D,this.nestedError=void 0}}class k9 extends J1{constructor(D){super(1,"commander.invalidArgument",D);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}wX.CommanderError=J1;wX.InvalidArgumentError=k9});var l8=VD((bX)=>{var{InvalidArgumentError:SX}=n2();class b9{constructor(D,F){switch(this.description=F||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,D[0]){case"<":this.required=!0,this._name=D.slice(1,-1);break;case"[":this.required=!1,this._name=D.slice(1,-1);break;default:this.required=!0,this._name=D;break}if(this._name.endsWith("..."))this.variadic=!0,this._name=this._name.slice(0,-3)}name(){return this._name}_collectValue(D,F){if(F===this.defaultValue||!Array.isArray(F))return[D];return F.push(D),F}default(D,F){return this.defaultValue=D,this.defaultValueDescription=F,this}argParser(D){return this.parseArg=D,this}choices(D){return this.argChoices=D.slice(),this.parseArg=(F,Q)=>{if(!this.argChoices.includes(F))throw new SX(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._collectValue(F,Q);return F},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}}function kX(D){let F=D.name()+(D.variadic===!0?"...":"");return D.required?"<"+F+">":"["+F+"]"}bX.Argument=b9;bX.humanReadableArgName=kX});var C1=VD((yX)=>{var{humanReadableArgName:uX}=l8();class v9{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(D){this.helpWidth=this.helpWidth??D.helpWidth??80}visibleCommands(D){let F=D.commands.filter((B)=>!B._hidden),Q=D._getHelpCommand();if(Q&&!Q._hidden)F.push(Q);if(this.sortSubcommands)F.sort((B,Y)=>{return B.name().localeCompare(Y.name())});return F}compareOptions(D,F){let Q=(B)=>{return B.short?B.short.replace(/^-/,""):B.long.replace(/^--/,"")};return Q(D).localeCompare(Q(F))}visibleOptions(D){let F=D.options.filter((B)=>!B.hidden),Q=D._getHelpOption();if(Q&&!Q.hidden){let B=Q.short&&D._findOption(Q.short),Y=Q.long&&D._findOption(Q.long);if(!B&&!Y)F.push(Q);else if(Q.long&&!Y)F.push(D.createOption(Q.long,Q.description));else if(Q.short&&!B)F.push(D.createOption(Q.short,Q.description))}if(this.sortOptions)F.sort(this.compareOptions);return F}visibleGlobalOptions(D){if(!this.showGlobalOptions)return[];let F=[];for(let Q=D.parent;Q;Q=Q.parent){let B=Q.options.filter((Y)=>!Y.hidden);F.push(...B)}if(this.sortOptions)F.sort(this.compareOptions);return F}visibleArguments(D){if(D._argsDescription)D.registeredArguments.forEach((F)=>{F.description=F.description||D._argsDescription[F.name()]||""});if(D.registeredArguments.find((F)=>F.description))return D.registeredArguments;return[]}subcommandTerm(D){let F=D.registeredArguments.map((Q)=>uX(Q)).join(" ");return D._name+(D._aliases[0]?"|"+D._aliases[0]:"")+(D.options.length?" [options]":"")+(F?" "+F:"")}optionTerm(D){return D.flags}argumentTerm(D){return D.name()}longestSubcommandTermLength(D,F){return F.visibleCommands(D).reduce((Q,B)=>{return Math.max(Q,this.displayWidth(F.styleSubcommandTerm(F.subcommandTerm(B))))},0)}longestOptionTermLength(D,F){return F.visibleOptions(D).reduce((Q,B)=>{return Math.max(Q,this.displayWidth(F.styleOptionTerm(F.optionTerm(B))))},0)}longestGlobalOptionTermLength(D,F){return F.visibleGlobalOptions(D).reduce((Q,B)=>{return Math.max(Q,this.displayWidth(F.styleOptionTerm(F.optionTerm(B))))},0)}longestArgumentTermLength(D,F){return F.visibleArguments(D).reduce((Q,B)=>{return Math.max(Q,this.displayWidth(F.styleArgumentTerm(F.argumentTerm(B))))},0)}commandUsage(D){let F=D._name;if(D._aliases[0])F=F+"|"+D._aliases[0];let Q="";for(let B=D.parent;B;B=B.parent)Q=B.name()+" "+Q;return Q+F+" "+D.usage()}commandDescription(D){return D.description()}subcommandDescription(D){return D.summary()||D.description()}optionDescription(D){let F=[];if(D.argChoices)F.push(`choices: ${D.argChoices.map((Q)=>JSON.stringify(Q)).join(", ")}`);if(D.defaultValue!==void 0){if(D.required||D.optional||D.isBoolean()&&typeof D.defaultValue==="boolean")F.push(`default: ${D.defaultValueDescription||JSON.stringify(D.defaultValue)}`)}if(D.presetArg!==void 0&&D.optional)F.push(`preset: ${JSON.stringify(D.presetArg)}`);if(D.envVar!==void 0)F.push(`env: ${D.envVar}`);if(F.length>0){let Q=`(${F.join(", ")})`;if(D.description)return`${D.description} ${Q}`;return Q}return D.description}argumentDescription(D){let F=[];if(D.argChoices)F.push(`choices: ${D.argChoices.map((Q)=>JSON.stringify(Q)).join(", ")}`);if(D.defaultValue!==void 0)F.push(`default: ${D.defaultValueDescription||JSON.stringify(D.defaultValue)}`);if(F.length>0){let Q=`(${F.join(", ")})`;if(D.description)return`${D.description} ${Q}`;return Q}return D.description}formatItemList(D,F,Q){if(F.length===0)return[];return[Q.styleTitle(D),...F,""]}groupItems(D,F,Q){let B=new Map;return D.forEach((Y)=>{let J=Q(Y);if(!B.has(J))B.set(J,[])}),F.forEach((Y)=>{let J=Q(Y);if(!B.has(J))B.set(J,[]);B.get(J).push(Y)}),B}formatHelp(D,F){let Q=F.padWidth(D,F),B=F.helpWidth??80;function Y(G,q){return F.formatItem(G,Q,q,F)}let J=[`${F.styleTitle("Usage:")} ${F.styleUsage(F.commandUsage(D))}`,""],X=F.commandDescription(D);if(X.length>0)J=J.concat([F.boxWrap(F.styleCommandDescription(X),B),""]);let C=F.visibleArguments(D).map((G)=>{return Y(F.styleArgumentTerm(F.argumentTerm(G)),F.styleArgumentDescription(F.argumentDescription(G)))});if(J=J.concat(this.formatItemList("Arguments:",C,F)),this.groupItems(D.options,F.visibleOptions(D),(G)=>G.helpGroupHeading??"Options:").forEach((G,q)=>{let A=G.map((U)=>{return Y(F.styleOptionTerm(F.optionTerm(U)),F.styleOptionDescription(F.optionDescription(U)))});J=J.concat(this.formatItemList(q,A,F))}),F.showGlobalOptions){let G=F.visibleGlobalOptions(D).map((q)=>{return Y(F.styleOptionTerm(F.optionTerm(q)),F.styleOptionDescription(F.optionDescription(q)))});J=J.concat(this.formatItemList("Global Options:",G,F))}return this.groupItems(D.commands,F.visibleCommands(D),(G)=>G.helpGroup()||"Commands:").forEach((G,q)=>{let A=G.map((U)=>{return Y(F.styleSubcommandTerm(F.subcommandTerm(U)),F.styleSubcommandDescription(F.subcommandDescription(U)))});J=J.concat(this.formatItemList(q,A,F))}),J.join(`
3
- `)}displayWidth(D){return x9(D).length}styleTitle(D){return D}styleUsage(D){return D.split(" ").map((F)=>{if(F==="[options]")return this.styleOptionText(F);if(F==="[command]")return this.styleSubcommandText(F);if(F[0]==="["||F[0]==="<")return this.styleArgumentText(F);return this.styleCommandText(F)}).join(" ")}styleCommandDescription(D){return this.styleDescriptionText(D)}styleOptionDescription(D){return this.styleDescriptionText(D)}styleSubcommandDescription(D){return this.styleDescriptionText(D)}styleArgumentDescription(D){return this.styleDescriptionText(D)}styleDescriptionText(D){return D}styleOptionTerm(D){return this.styleOptionText(D)}styleSubcommandTerm(D){return D.split(" ").map((F)=>{if(F==="[options]")return this.styleOptionText(F);if(F[0]==="["||F[0]==="<")return this.styleArgumentText(F);return this.styleSubcommandText(F)}).join(" ")}styleArgumentTerm(D){return this.styleArgumentText(D)}styleOptionText(D){return D}styleArgumentText(D){return D}styleSubcommandText(D){return D}styleCommandText(D){return D}padWidth(D,F){return Math.max(F.longestOptionTermLength(D,F),F.longestGlobalOptionTermLength(D,F),F.longestSubcommandTermLength(D,F),F.longestArgumentTermLength(D,F))}preformatted(D){return/\n[^\S\r\n]/.test(D)}formatItem(D,F,Q,B){let J=" ".repeat(2);if(!Q)return J+D;let X=D.padEnd(F+D.length-B.displayWidth(D)),C=2,W=(this.helpWidth??80)-F-C-2,G;if(W<this.minWidthToWrap||B.preformatted(Q))G=Q;else G=B.boxWrap(Q,W).replace(/\n/g,`
2
+ import{createRequire as IX}from"node:module";var jX=Object.create;var{getPrototypeOf:RX,defineProperty:Y1,getOwnPropertyNames:_X}=Object;var OX=Object.prototype.hasOwnProperty;var a0=(D,F,Q)=>{Q=D!=null?jX(RX(D)):{};let B=F||!D||!D.__esModule?Y1(Q,"default",{value:D,enumerable:!0}):Q;for(let Y of _X(D))if(!OX.call(B,Y))Y1(B,Y,{get:()=>D[Y],enumerable:!0});return B};var VD=(D,F)=>()=>(F||D((F={exports:{}}).exports,F),F.exports);var MF=(D,F)=>{for(var Q in F)Y1(D,Q,{get:F[Q],enumerable:!0,configurable:!0,set:(B)=>F[Q]=()=>B})};var zF=(D,F)=>()=>(D&&(F=D(D=0)),F);var gD=IX(import.meta.url);var n2=VD((wX)=>{class J1 extends Error{constructor(D,F,Q){super(Q);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=F,this.exitCode=D,this.nestedError=void 0}}class k9 extends J1{constructor(D){super(1,"commander.invalidArgument",D);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}wX.CommanderError=J1;wX.InvalidArgumentError=k9});var l8=VD((bX)=>{var{InvalidArgumentError:SX}=n2();class b9{constructor(D,F){switch(this.description=F||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,D[0]){case"<":this.required=!0,this._name=D.slice(1,-1);break;case"[":this.required=!1,this._name=D.slice(1,-1);break;default:this.required=!0,this._name=D;break}if(this._name.length>3&&this._name.slice(-3)==="...")this.variadic=!0,this._name=this._name.slice(0,-3)}name(){return this._name}_concatValue(D,F){if(F===this.defaultValue||!Array.isArray(F))return[D];return F.concat(D)}default(D,F){return this.defaultValue=D,this.defaultValueDescription=F,this}argParser(D){return this.parseArg=D,this}choices(D){return this.argChoices=D.slice(),this.parseArg=(F,Q)=>{if(!this.argChoices.includes(F))throw new SX(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._concatValue(F,Q);return F},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}}function kX(D){let F=D.name()+(D.variadic===!0?"...":"");return D.required?"<"+F+">":"["+F+"]"}bX.Argument=b9;bX.humanReadableArgName=kX});var C1=VD((yX)=>{var{humanReadableArgName:uX}=l8();class v9{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(D){this.helpWidth=this.helpWidth??D.helpWidth??80}visibleCommands(D){let F=D.commands.filter((B)=>!B._hidden),Q=D._getHelpCommand();if(Q&&!Q._hidden)F.push(Q);if(this.sortSubcommands)F.sort((B,Y)=>{return B.name().localeCompare(Y.name())});return F}compareOptions(D,F){let Q=(B)=>{return B.short?B.short.replace(/^-/,""):B.long.replace(/^--/,"")};return Q(D).localeCompare(Q(F))}visibleOptions(D){let F=D.options.filter((B)=>!B.hidden),Q=D._getHelpOption();if(Q&&!Q.hidden){let B=Q.short&&D._findOption(Q.short),Y=Q.long&&D._findOption(Q.long);if(!B&&!Y)F.push(Q);else if(Q.long&&!Y)F.push(D.createOption(Q.long,Q.description));else if(Q.short&&!B)F.push(D.createOption(Q.short,Q.description))}if(this.sortOptions)F.sort(this.compareOptions);return F}visibleGlobalOptions(D){if(!this.showGlobalOptions)return[];let F=[];for(let Q=D.parent;Q;Q=Q.parent){let B=Q.options.filter((Y)=>!Y.hidden);F.push(...B)}if(this.sortOptions)F.sort(this.compareOptions);return F}visibleArguments(D){if(D._argsDescription)D.registeredArguments.forEach((F)=>{F.description=F.description||D._argsDescription[F.name()]||""});if(D.registeredArguments.find((F)=>F.description))return D.registeredArguments;return[]}subcommandTerm(D){let F=D.registeredArguments.map((Q)=>uX(Q)).join(" ");return D._name+(D._aliases[0]?"|"+D._aliases[0]:"")+(D.options.length?" [options]":"")+(F?" "+F:"")}optionTerm(D){return D.flags}argumentTerm(D){return D.name()}longestSubcommandTermLength(D,F){return F.visibleCommands(D).reduce((Q,B)=>{return Math.max(Q,this.displayWidth(F.styleSubcommandTerm(F.subcommandTerm(B))))},0)}longestOptionTermLength(D,F){return F.visibleOptions(D).reduce((Q,B)=>{return Math.max(Q,this.displayWidth(F.styleOptionTerm(F.optionTerm(B))))},0)}longestGlobalOptionTermLength(D,F){return F.visibleGlobalOptions(D).reduce((Q,B)=>{return Math.max(Q,this.displayWidth(F.styleOptionTerm(F.optionTerm(B))))},0)}longestArgumentTermLength(D,F){return F.visibleArguments(D).reduce((Q,B)=>{return Math.max(Q,this.displayWidth(F.styleArgumentTerm(F.argumentTerm(B))))},0)}commandUsage(D){let F=D._name;if(D._aliases[0])F=F+"|"+D._aliases[0];let Q="";for(let B=D.parent;B;B=B.parent)Q=B.name()+" "+Q;return Q+F+" "+D.usage()}commandDescription(D){return D.description()}subcommandDescription(D){return D.summary()||D.description()}optionDescription(D){let F=[];if(D.argChoices)F.push(`choices: ${D.argChoices.map((Q)=>JSON.stringify(Q)).join(", ")}`);if(D.defaultValue!==void 0){if(D.required||D.optional||D.isBoolean()&&typeof D.defaultValue==="boolean")F.push(`default: ${D.defaultValueDescription||JSON.stringify(D.defaultValue)}`)}if(D.presetArg!==void 0&&D.optional)F.push(`preset: ${JSON.stringify(D.presetArg)}`);if(D.envVar!==void 0)F.push(`env: ${D.envVar}`);if(F.length>0){let Q=`(${F.join(", ")})`;if(D.description)return`${D.description} ${Q}`;return Q}return D.description}argumentDescription(D){let F=[];if(D.argChoices)F.push(`choices: ${D.argChoices.map((Q)=>JSON.stringify(Q)).join(", ")}`);if(D.defaultValue!==void 0)F.push(`default: ${D.defaultValueDescription||JSON.stringify(D.defaultValue)}`);if(F.length>0){let Q=`(${F.join(", ")})`;if(D.description)return`${D.description} ${Q}`;return Q}return D.description}formatItemList(D,F,Q){if(F.length===0)return[];return[Q.styleTitle(D),...F,""]}groupItems(D,F,Q){let B=new Map;return D.forEach((Y)=>{let J=Q(Y);if(!B.has(J))B.set(J,[])}),F.forEach((Y)=>{let J=Q(Y);if(!B.has(J))B.set(J,[]);B.get(J).push(Y)}),B}formatHelp(D,F){let Q=F.padWidth(D,F),B=F.helpWidth??80;function Y(G,q){return F.formatItem(G,Q,q,F)}let J=[`${F.styleTitle("Usage:")} ${F.styleUsage(F.commandUsage(D))}`,""],X=F.commandDescription(D);if(X.length>0)J=J.concat([F.boxWrap(F.styleCommandDescription(X),B),""]);let C=F.visibleArguments(D).map((G)=>{return Y(F.styleArgumentTerm(F.argumentTerm(G)),F.styleArgumentDescription(F.argumentDescription(G)))});if(J=J.concat(this.formatItemList("Arguments:",C,F)),this.groupItems(D.options,F.visibleOptions(D),(G)=>G.helpGroupHeading??"Options:").forEach((G,q)=>{let A=G.map((U)=>{return Y(F.styleOptionTerm(F.optionTerm(U)),F.styleOptionDescription(F.optionDescription(U)))});J=J.concat(this.formatItemList(q,A,F))}),F.showGlobalOptions){let G=F.visibleGlobalOptions(D).map((q)=>{return Y(F.styleOptionTerm(F.optionTerm(q)),F.styleOptionDescription(F.optionDescription(q)))});J=J.concat(this.formatItemList("Global Options:",G,F))}return this.groupItems(D.commands,F.visibleCommands(D),(G)=>G.helpGroup()||"Commands:").forEach((G,q)=>{let A=G.map((U)=>{return Y(F.styleSubcommandTerm(F.subcommandTerm(U)),F.styleSubcommandDescription(F.subcommandDescription(U)))});J=J.concat(this.formatItemList(q,A,F))}),J.join(`
3
+ `)}displayWidth(D){return x9(D).length}styleTitle(D){return D}styleUsage(D){return D.split(" ").map((F)=>{if(F==="[options]")return this.styleOptionText(F);if(F==="[command]")return this.styleSubcommandText(F);if(F[0]==="["||F[0]==="<")return this.styleArgumentText(F);return this.styleCommandText(F)}).join(" ")}styleCommandDescription(D){return this.styleDescriptionText(D)}styleOptionDescription(D){return this.styleDescriptionText(D)}styleSubcommandDescription(D){return this.styleDescriptionText(D)}styleArgumentDescription(D){return this.styleDescriptionText(D)}styleDescriptionText(D){return D}styleOptionTerm(D){return this.styleOptionText(D)}styleSubcommandTerm(D){return D.split(" ").map((F)=>{if(F==="[options]")return this.styleOptionText(F);if(F[0]==="["||F[0]==="<")return this.styleArgumentText(F);return this.styleSubcommandText(F)}).join(" ")}styleArgumentTerm(D){return this.styleArgumentText(D)}styleOptionText(D){return D}styleArgumentText(D){return D}styleSubcommandText(D){return D}styleCommandText(D){return D}padWidth(D,F){return Math.max(F.longestOptionTermLength(D,F),F.longestGlobalOptionTermLength(D,F),F.longestSubcommandTermLength(D,F),F.longestArgumentTermLength(D,F))}preformatted(D){return/\n[^\S\r\n]/.test(D)}formatItem(D,F,Q,B){let J=" ".repeat(2);if(!Q)return J+D;let X=D.padEnd(F+D.length-B.displayWidth(D)),C=2,z=(this.helpWidth??80)-F-C-2,G;if(z<this.minWidthToWrap||B.preformatted(Q))G=Q;else G=B.boxWrap(Q,z).replace(/\n/g,`
4
4
  `+" ".repeat(F+C));return J+X+" ".repeat(C)+G.replace(/\n/g,`
5
- ${J}`)}boxWrap(D,F){if(F<this.minWidthToWrap)return D;let Q=D.split(/\r\n|\n/),B=/[\s]*[^\s]+/g,Y=[];return Q.forEach((J)=>{let X=J.match(B);if(X===null){Y.push("");return}let C=[X.shift()],z=this.displayWidth(C[0]);X.forEach((W)=>{let G=this.displayWidth(W);if(z+G<=F){C.push(W),z+=G;return}Y.push(C.join(""));let q=W.trimStart();C=[q],z=this.displayWidth(q)}),Y.push(C.join(""))}),Y.join(`
6
- `)}}function x9(D){let F=/\x1b\[\d*(;\d*)*m/g;return D.replace(F,"")}yX.Help=v9;yX.stripColor=x9});var W1=VD((mX)=>{var{InvalidArgumentError:$X}=n2();class y9{constructor(D,F){this.flags=D,this.description=F||"",this.required=D.includes("<"),this.optional=D.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(D),this.mandatory=!1;let Q=hX(D);if(this.short=Q.shortFlag,this.long=Q.longFlag,this.negate=!1,this.long)this.negate=this.long.startsWith("--no-");this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0,this.helpGroupHeading=void 0}default(D,F){return this.defaultValue=D,this.defaultValueDescription=F,this}preset(D){return this.presetArg=D,this}conflicts(D){return this.conflictsWith=this.conflictsWith.concat(D),this}implies(D){let F=D;if(typeof D==="string")F={[D]:!0};return this.implied=Object.assign(this.implied||{},F),this}env(D){return this.envVar=D,this}argParser(D){return this.parseArg=D,this}makeOptionMandatory(D=!0){return this.mandatory=!!D,this}hideHelp(D=!0){return this.hidden=!!D,this}_collectValue(D,F){if(F===this.defaultValue||!Array.isArray(F))return[D];return F.push(D),F}choices(D){return this.argChoices=D.slice(),this.parseArg=(F,Q)=>{if(!this.argChoices.includes(F))throw new $X(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._collectValue(F,Q);return F},this}name(){if(this.long)return this.long.replace(/^--/,"");return this.short.replace(/^-/,"")}attributeName(){if(this.negate)return u9(this.name().replace(/^no-/,""));return u9(this.name())}helpGroup(D){return this.helpGroupHeading=D,this}is(D){return this.short===D||this.long===D}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class f9{constructor(D){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,D.forEach((F)=>{if(F.negate)this.negativeOptions.set(F.attributeName(),F);else this.positiveOptions.set(F.attributeName(),F)}),this.negativeOptions.forEach((F,Q)=>{if(this.positiveOptions.has(Q))this.dualOptions.add(Q)})}valueFromOption(D,F){let Q=F.attributeName();if(!this.dualOptions.has(Q))return!0;let B=this.negativeOptions.get(Q).presetArg,Y=B!==void 0?B:!1;return F.negate===(Y===D)}}function u9(D){return D.split("-").reduce((F,Q)=>{return F+Q[0].toUpperCase()+Q.slice(1)})}function hX(D){let F,Q,B=/^-[^-]$/,Y=/^--[^-]/,J=D.split(/[ |,]+/).concat("guard");if(B.test(J[0]))F=J.shift();if(Y.test(J[0]))Q=J.shift();if(!F&&B.test(J[0]))F=J.shift();if(!F&&Y.test(J[0]))F=Q,Q=J.shift();if(J[0].startsWith("-")){let X=J[0],C=`option creation failed due to '${X}' in option flags '${D}'`;if(/^-[^-][^-]/.test(X))throw new Error(`${C}
5
+ ${J}`)}boxWrap(D,F){if(F<this.minWidthToWrap)return D;let Q=D.split(/\r\n|\n/),B=/[\s]*[^\s]+/g,Y=[];return Q.forEach((J)=>{let X=J.match(B);if(X===null){Y.push("");return}let C=[X.shift()],W=this.displayWidth(C[0]);X.forEach((z)=>{let G=this.displayWidth(z);if(W+G<=F){C.push(z),W+=G;return}Y.push(C.join(""));let q=z.trimStart();C=[q],W=this.displayWidth(q)}),Y.push(C.join(""))}),Y.join(`
6
+ `)}}function x9(D){let F=/\x1b\[\d*(;\d*)*m/g;return D.replace(F,"")}yX.Help=v9;yX.stripColor=x9});var W1=VD((mX)=>{var{InvalidArgumentError:$X}=n2();class y9{constructor(D,F){this.flags=D,this.description=F||"",this.required=D.includes("<"),this.optional=D.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(D),this.mandatory=!1;let Q=hX(D);if(this.short=Q.shortFlag,this.long=Q.longFlag,this.negate=!1,this.long)this.negate=this.long.startsWith("--no-");this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0,this.helpGroupHeading=void 0}default(D,F){return this.defaultValue=D,this.defaultValueDescription=F,this}preset(D){return this.presetArg=D,this}conflicts(D){return this.conflictsWith=this.conflictsWith.concat(D),this}implies(D){let F=D;if(typeof D==="string")F={[D]:!0};return this.implied=Object.assign(this.implied||{},F),this}env(D){return this.envVar=D,this}argParser(D){return this.parseArg=D,this}makeOptionMandatory(D=!0){return this.mandatory=!!D,this}hideHelp(D=!0){return this.hidden=!!D,this}_concatValue(D,F){if(F===this.defaultValue||!Array.isArray(F))return[D];return F.concat(D)}choices(D){return this.argChoices=D.slice(),this.parseArg=(F,Q)=>{if(!this.argChoices.includes(F))throw new $X(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._concatValue(F,Q);return F},this}name(){if(this.long)return this.long.replace(/^--/,"");return this.short.replace(/^-/,"")}attributeName(){if(this.negate)return u9(this.name().replace(/^no-/,""));return u9(this.name())}helpGroup(D){return this.helpGroupHeading=D,this}is(D){return this.short===D||this.long===D}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class f9{constructor(D){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,D.forEach((F)=>{if(F.negate)this.negativeOptions.set(F.attributeName(),F);else this.positiveOptions.set(F.attributeName(),F)}),this.negativeOptions.forEach((F,Q)=>{if(this.positiveOptions.has(Q))this.dualOptions.add(Q)})}valueFromOption(D,F){let Q=F.attributeName();if(!this.dualOptions.has(Q))return!0;let B=this.negativeOptions.get(Q).presetArg,Y=B!==void 0?B:!1;return F.negate===(Y===D)}}function u9(D){return D.split("-").reduce((F,Q)=>{return F+Q[0].toUpperCase()+Q.slice(1)})}function hX(D){let F,Q,B=/^-[^-]$/,Y=/^--[^-]/,J=D.split(/[ |,]+/).concat("guard");if(B.test(J[0]))F=J.shift();if(Y.test(J[0]))Q=J.shift();if(!F&&B.test(J[0]))F=J.shift();if(!F&&Y.test(J[0]))F=Q,Q=J.shift();if(J[0].startsWith("-")){let X=J[0],C=`option creation failed due to '${X}' in option flags '${D}'`;if(/^-[^-][^-]/.test(X))throw new Error(`${C}
7
7
  - a short flag is a single dash and a single character
8
8
  - either use a single dash and a single character (for a short flag)
9
9
  - or use a double dash for a long option (and can have two, like '--ws, --workspace')`);if(B.test(X))throw new Error(`${C}
10
10
  - too many short flags`);if(Y.test(X))throw new Error(`${C}
11
11
  - too many long flags`);throw new Error(`${C}
12
- - unrecognised flag format`)}if(F===void 0&&Q===void 0)throw new Error(`option creation failed due to no flags found in '${D}'.`);return{shortFlag:F,longFlag:Q}}mX.Option=y9;mX.DualOptions=f9});var g9=VD((nX)=>{function cX(D,F){if(Math.abs(D.length-F.length)>3)return Math.max(D.length,F.length);let Q=[];for(let B=0;B<=D.length;B++)Q[B]=[B];for(let B=0;B<=F.length;B++)Q[0][B]=B;for(let B=1;B<=F.length;B++)for(let Y=1;Y<=D.length;Y++){let J=1;if(D[Y-1]===F[B-1])J=0;else J=1;if(Q[Y][B]=Math.min(Q[Y-1][B]+1,Q[Y][B-1]+1,Q[Y-1][B-1]+J),Y>1&&B>1&&D[Y-1]===F[B-2]&&D[Y-2]===F[B-1])Q[Y][B]=Math.min(Q[Y][B],Q[Y-2][B-2]+1)}return Q[D.length][F.length]}function pX(D,F){if(!F||F.length===0)return"";F=Array.from(new Set(F));let Q=D.startsWith("--");if(Q)D=D.slice(2),F=F.map((X)=>X.slice(2));let B=[],Y=3,J=0.4;if(F.forEach((X)=>{if(X.length<=1)return;let C=cX(D,X),z=Math.max(D.length,X.length);if((z-C)/z>J){if(C<Y)Y=C,B=[X];else if(C===Y)B.push(X)}}),B.sort((X,C)=>X.localeCompare(C)),Q)B=B.map((X)=>`--${X}`);if(B.length>1)return`
12
+ - unrecognised flag format`)}if(F===void 0&&Q===void 0)throw new Error(`option creation failed due to no flags found in '${D}'.`);return{shortFlag:F,longFlag:Q}}mX.Option=y9;mX.DualOptions=f9});var g9=VD((nX)=>{function cX(D,F){if(Math.abs(D.length-F.length)>3)return Math.max(D.length,F.length);let Q=[];for(let B=0;B<=D.length;B++)Q[B]=[B];for(let B=0;B<=F.length;B++)Q[0][B]=B;for(let B=1;B<=F.length;B++)for(let Y=1;Y<=D.length;Y++){let J=1;if(D[Y-1]===F[B-1])J=0;else J=1;if(Q[Y][B]=Math.min(Q[Y-1][B]+1,Q[Y][B-1]+1,Q[Y-1][B-1]+J),Y>1&&B>1&&D[Y-1]===F[B-2]&&D[Y-2]===F[B-1])Q[Y][B]=Math.min(Q[Y][B],Q[Y-2][B-2]+1)}return Q[D.length][F.length]}function pX(D,F){if(!F||F.length===0)return"";F=Array.from(new Set(F));let Q=D.startsWith("--");if(Q)D=D.slice(2),F=F.map((X)=>X.slice(2));let B=[],Y=3,J=0.4;if(F.forEach((X)=>{if(X.length<=1)return;let C=cX(D,X),W=Math.max(D.length,X.length);if((W-C)/W>J){if(C<Y)Y=C,B=[X];else if(C===Y)B.push(X)}}),B.sort((X,C)=>X.localeCompare(C)),Q)B=B.map((X)=>`--${X}`);if(B.length>1)return`
13
13
  (Did you mean one of ${B.join(", ")}?)`;if(B.length===1)return`
14
- (Did you mean ${B[0]}?)`;return""}nX.suggestSimilar=pX});var l9=VD((DY)=>{var aX=gD("node:events").EventEmitter,z1=gD("node:child_process"),NF=gD("node:path"),d8=gD("node:fs"),OD=gD("node:process"),{Argument:rX,humanReadableArgName:oX}=l8(),{CommanderError:G1}=n2(),{Help:sX,stripColor:tX}=C1(),{Option:$9,DualOptions:eX}=W1(),{suggestSimilar:h9}=g9();class H1 extends aX{constructor(D){super();this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=D||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._savedState=null,this._outputConfiguration={writeOut:(F)=>OD.stdout.write(F),writeErr:(F)=>OD.stderr.write(F),outputError:(F,Q)=>Q(F),getOutHelpWidth:()=>OD.stdout.isTTY?OD.stdout.columns:void 0,getErrHelpWidth:()=>OD.stderr.isTTY?OD.stderr.columns:void 0,getOutHasColors:()=>q1()??(OD.stdout.isTTY&&OD.stdout.hasColors?.()),getErrHasColors:()=>q1()??(OD.stderr.isTTY&&OD.stderr.hasColors?.()),stripColor:(F)=>tX(F)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}copyInheritedSettings(D){return this._outputConfiguration=D._outputConfiguration,this._helpOption=D._helpOption,this._helpCommand=D._helpCommand,this._helpConfiguration=D._helpConfiguration,this._exitCallback=D._exitCallback,this._storeOptionsAsProperties=D._storeOptionsAsProperties,this._combineFlagAndOptionalValue=D._combineFlagAndOptionalValue,this._allowExcessArguments=D._allowExcessArguments,this._enablePositionalOptions=D._enablePositionalOptions,this._showHelpAfterError=D._showHelpAfterError,this._showSuggestionAfterError=D._showSuggestionAfterError,this}_getCommandAndAncestors(){let D=[];for(let F=this;F;F=F.parent)D.push(F);return D}command(D,F,Q){let B=F,Y=Q;if(typeof B==="object"&&B!==null)Y=B,B=null;Y=Y||{};let[,J,X]=D.match(/([^ ]+) *(.*)/),C=this.createCommand(J);if(B)C.description(B),C._executableHandler=!0;if(Y.isDefault)this._defaultCommandName=C._name;if(C._hidden=!!(Y.noHelp||Y.hidden),C._executableFile=Y.executableFile||null,X)C.arguments(X);if(this._registerCommand(C),C.parent=this,C.copyInheritedSettings(this),B)return this;return C}createCommand(D){return new H1(D)}createHelp(){return Object.assign(new sX,this.configureHelp())}configureHelp(D){if(D===void 0)return this._helpConfiguration;return this._helpConfiguration=D,this}configureOutput(D){if(D===void 0)return this._outputConfiguration;return this._outputConfiguration={...this._outputConfiguration,...D},this}showHelpAfterError(D=!0){if(typeof D!=="string")D=!!D;return this._showHelpAfterError=D,this}showSuggestionAfterError(D=!0){return this._showSuggestionAfterError=!!D,this}addCommand(D,F){if(!D._name)throw new Error(`Command passed to .addCommand() must have a name
15
- - specify the name in Command constructor or using .name()`);if(F=F||{},F.isDefault)this._defaultCommandName=D._name;if(F.noHelp||F.hidden)D._hidden=!0;return this._registerCommand(D),D.parent=this,D._checkForBrokenPassThrough(),this}createArgument(D,F){return new rX(D,F)}argument(D,F,Q,B){let Y=this.createArgument(D,F);if(typeof Q==="function")Y.default(B).argParser(Q);else Y.default(Q);return this.addArgument(Y),this}arguments(D){return D.trim().split(/ +/).forEach((F)=>{this.argument(F)}),this}addArgument(D){let F=this.registeredArguments.slice(-1)[0];if(F?.variadic)throw new Error(`only the last argument can be variadic '${F.name()}'`);if(D.required&&D.defaultValue!==void 0&&D.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${D.name()}'`);return this.registeredArguments.push(D),this}helpCommand(D,F){if(typeof D==="boolean"){if(this._addImplicitHelpCommand=D,D&&this._defaultCommandGroup)this._initCommandGroup(this._getHelpCommand());return this}let Q=D??"help [command]",[,B,Y]=Q.match(/([^ ]+) *(.*)/),J=F??"display help for command",X=this.createCommand(B);if(X.helpOption(!1),Y)X.arguments(Y);if(J)X.description(J);if(this._addImplicitHelpCommand=!0,this._helpCommand=X,D||F)this._initCommandGroup(X);return this}addHelpCommand(D,F){if(typeof D!=="object")return this.helpCommand(D,F),this;return this._addImplicitHelpCommand=!0,this._helpCommand=D,this._initCommandGroup(D),this}_getHelpCommand(){if(this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))){if(this._helpCommand===void 0)this.helpCommand(void 0,void 0);return this._helpCommand}return null}hook(D,F){let Q=["preSubcommand","preAction","postAction"];if(!Q.includes(D))throw new Error(`Unexpected value for event passed to hook : '${D}'.
14
+ (Did you mean ${B[0]}?)`;return""}nX.suggestSimilar=pX});var l9=VD((DY)=>{var aX=gD("node:events").EventEmitter,z1=gD("node:child_process"),NF=gD("node:path"),d8=gD("node:fs"),OD=gD("node:process"),{Argument:rX,humanReadableArgName:oX}=l8(),{CommanderError:G1}=n2(),{Help:sX,stripColor:tX}=C1(),{Option:$9,DualOptions:eX}=W1(),{suggestSimilar:h9}=g9();class H1 extends aX{constructor(D){super();this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=D||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._savedState=null,this._outputConfiguration={writeOut:(F)=>OD.stdout.write(F),writeErr:(F)=>OD.stderr.write(F),outputError:(F,Q)=>Q(F),getOutHelpWidth:()=>OD.stdout.isTTY?OD.stdout.columns:void 0,getErrHelpWidth:()=>OD.stderr.isTTY?OD.stderr.columns:void 0,getOutHasColors:()=>q1()??(OD.stdout.isTTY&&OD.stdout.hasColors?.()),getErrHasColors:()=>q1()??(OD.stderr.isTTY&&OD.stderr.hasColors?.()),stripColor:(F)=>tX(F)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}copyInheritedSettings(D){return this._outputConfiguration=D._outputConfiguration,this._helpOption=D._helpOption,this._helpCommand=D._helpCommand,this._helpConfiguration=D._helpConfiguration,this._exitCallback=D._exitCallback,this._storeOptionsAsProperties=D._storeOptionsAsProperties,this._combineFlagAndOptionalValue=D._combineFlagAndOptionalValue,this._allowExcessArguments=D._allowExcessArguments,this._enablePositionalOptions=D._enablePositionalOptions,this._showHelpAfterError=D._showHelpAfterError,this._showSuggestionAfterError=D._showSuggestionAfterError,this}_getCommandAndAncestors(){let D=[];for(let F=this;F;F=F.parent)D.push(F);return D}command(D,F,Q){let B=F,Y=Q;if(typeof B==="object"&&B!==null)Y=B,B=null;Y=Y||{};let[,J,X]=D.match(/([^ ]+) *(.*)/),C=this.createCommand(J);if(B)C.description(B),C._executableHandler=!0;if(Y.isDefault)this._defaultCommandName=C._name;if(C._hidden=!!(Y.noHelp||Y.hidden),C._executableFile=Y.executableFile||null,X)C.arguments(X);if(this._registerCommand(C),C.parent=this,C.copyInheritedSettings(this),B)return this;return C}createCommand(D){return new H1(D)}createHelp(){return Object.assign(new sX,this.configureHelp())}configureHelp(D){if(D===void 0)return this._helpConfiguration;return this._helpConfiguration=D,this}configureOutput(D){if(D===void 0)return this._outputConfiguration;return this._outputConfiguration=Object.assign({},this._outputConfiguration,D),this}showHelpAfterError(D=!0){if(typeof D!=="string")D=!!D;return this._showHelpAfterError=D,this}showSuggestionAfterError(D=!0){return this._showSuggestionAfterError=!!D,this}addCommand(D,F){if(!D._name)throw new Error(`Command passed to .addCommand() must have a name
15
+ - specify the name in Command constructor or using .name()`);if(F=F||{},F.isDefault)this._defaultCommandName=D._name;if(F.noHelp||F.hidden)D._hidden=!0;return this._registerCommand(D),D.parent=this,D._checkForBrokenPassThrough(),this}createArgument(D,F){return new rX(D,F)}argument(D,F,Q,B){let Y=this.createArgument(D,F);if(typeof Q==="function")Y.default(B).argParser(Q);else Y.default(Q);return this.addArgument(Y),this}arguments(D){return D.trim().split(/ +/).forEach((F)=>{this.argument(F)}),this}addArgument(D){let F=this.registeredArguments.slice(-1)[0];if(F&&F.variadic)throw new Error(`only the last argument can be variadic '${F.name()}'`);if(D.required&&D.defaultValue!==void 0&&D.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${D.name()}'`);return this.registeredArguments.push(D),this}helpCommand(D,F){if(typeof D==="boolean"){if(this._addImplicitHelpCommand=D,D&&this._defaultCommandGroup)this._initCommandGroup(this._getHelpCommand());return this}let Q=D??"help [command]",[,B,Y]=Q.match(/([^ ]+) *(.*)/),J=F??"display help for command",X=this.createCommand(B);if(X.helpOption(!1),Y)X.arguments(Y);if(J)X.description(J);if(this._addImplicitHelpCommand=!0,this._helpCommand=X,D||F)this._initCommandGroup(X);return this}addHelpCommand(D,F){if(typeof D!=="object")return this.helpCommand(D,F),this;return this._addImplicitHelpCommand=!0,this._helpCommand=D,this._initCommandGroup(D),this}_getHelpCommand(){if(this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))){if(this._helpCommand===void 0)this.helpCommand(void 0,void 0);return this._helpCommand}return null}hook(D,F){let Q=["preSubcommand","preAction","postAction"];if(!Q.includes(D))throw new Error(`Unexpected value for event passed to hook : '${D}'.
16
16
  Expecting one of '${Q.join("', '")}'`);if(this._lifeCycleHooks[D])this._lifeCycleHooks[D].push(F);else this._lifeCycleHooks[D]=[F];return this}exitOverride(D){if(D)this._exitCallback=D;else this._exitCallback=(F)=>{if(F.code!=="commander.executeSubCommandAsync")throw F};return this}_exit(D,F,Q){if(this._exitCallback)this._exitCallback(new G1(D,F,Q));OD.exit(D)}action(D){let F=(Q)=>{let B=this.registeredArguments.length,Y=Q.slice(0,B);if(this._storeOptionsAsProperties)Y[B]=this;else Y[B]=this.opts();return Y.push(this),D.apply(this,Y)};return this._actionHandler=F,this}createOption(D,F){return new $9(D,F)}_callParseArg(D,F,Q,B){try{return D.parseArg(F,Q)}catch(Y){if(Y.code==="commander.invalidArgument"){let J=`${B} ${Y.message}`;this.error(J,{exitCode:Y.exitCode,code:Y.code})}throw Y}}_registerOption(D){let F=D.short&&this._findOption(D.short)||D.long&&this._findOption(D.long);if(F){let Q=D.long&&this._findOption(D.long)?D.long:D.short;throw new Error(`Cannot add option '${D.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${Q}'
17
- - already used by option '${F.flags}'`)}this._initOptionGroup(D),this.options.push(D)}_registerCommand(D){let F=(B)=>{return[B.name()].concat(B.aliases())},Q=F(D).find((B)=>this._findCommand(B));if(Q){let B=F(this._findCommand(Q)).join("|"),Y=F(D).join("|");throw new Error(`cannot add command '${Y}' as already have command '${B}'`)}this._initCommandGroup(D),this.commands.push(D)}addOption(D){this._registerOption(D);let F=D.name(),Q=D.attributeName();if(D.negate){let Y=D.long.replace(/^--no-/,"--");if(!this._findOption(Y))this.setOptionValueWithSource(Q,D.defaultValue===void 0?!0:D.defaultValue,"default")}else if(D.defaultValue!==void 0)this.setOptionValueWithSource(Q,D.defaultValue,"default");let B=(Y,J,X)=>{if(Y==null&&D.presetArg!==void 0)Y=D.presetArg;let C=this.getOptionValue(Q);if(Y!==null&&D.parseArg)Y=this._callParseArg(D,Y,C,J);else if(Y!==null&&D.variadic)Y=D._collectValue(Y,C);if(Y==null)if(D.negate)Y=!1;else if(D.isBoolean()||D.optional)Y=!0;else Y="";this.setOptionValueWithSource(Q,Y,X)};if(this.on("option:"+F,(Y)=>{let J=`error: option '${D.flags}' argument '${Y}' is invalid.`;B(Y,J,"cli")}),D.envVar)this.on("optionEnv:"+F,(Y)=>{let J=`error: option '${D.flags}' value '${Y}' from env '${D.envVar}' is invalid.`;B(Y,J,"env")});return this}_optionEx(D,F,Q,B,Y){if(typeof F==="object"&&F instanceof $9)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let J=this.createOption(F,Q);if(J.makeOptionMandatory(!!D.mandatory),typeof B==="function")J.default(Y).argParser(B);else if(B instanceof RegExp){let X=B;B=(C,z)=>{let W=X.exec(C);return W?W[0]:z},J.default(Y).argParser(B)}else J.default(B);return this.addOption(J)}option(D,F,Q,B){return this._optionEx({},D,F,Q,B)}requiredOption(D,F,Q,B){return this._optionEx({mandatory:!0},D,F,Q,B)}combineFlagAndOptionalValue(D=!0){return this._combineFlagAndOptionalValue=!!D,this}allowUnknownOption(D=!0){return this._allowUnknownOption=!!D,this}allowExcessArguments(D=!0){return this._allowExcessArguments=!!D,this}enablePositionalOptions(D=!0){return this._enablePositionalOptions=!!D,this}passThroughOptions(D=!0){return this._passThroughOptions=!!D,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(D=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!D,this}getOptionValue(D){if(this._storeOptionsAsProperties)return this[D];return this._optionValues[D]}setOptionValue(D,F){return this.setOptionValueWithSource(D,F,void 0)}setOptionValueWithSource(D,F,Q){if(this._storeOptionsAsProperties)this[D]=F;else this._optionValues[D]=F;return this._optionValueSources[D]=Q,this}getOptionValueSource(D){return this._optionValueSources[D]}getOptionValueSourceWithGlobals(D){let F;return this._getCommandAndAncestors().forEach((Q)=>{if(Q.getOptionValueSource(D)!==void 0)F=Q.getOptionValueSource(D)}),F}_prepareUserArgs(D,F){if(D!==void 0&&!Array.isArray(D))throw new Error("first parameter to parse must be array or undefined");if(F=F||{},D===void 0&&F.from===void 0){if(OD.versions?.electron)F.from="electron";let B=OD.execArgv??[];if(B.includes("-e")||B.includes("--eval")||B.includes("-p")||B.includes("--print"))F.from="eval"}if(D===void 0)D=OD.argv;this.rawArgs=D.slice();let Q;switch(F.from){case void 0:case"node":this._scriptPath=D[1],Q=D.slice(2);break;case"electron":if(OD.defaultApp)this._scriptPath=D[1],Q=D.slice(2);else Q=D.slice(1);break;case"user":Q=D.slice(0);break;case"eval":Q=D.slice(1);break;default:throw new Error(`unexpected parse option { from: '${F.from}' }`)}if(!this._name&&this._scriptPath)this.nameFromFilename(this._scriptPath);return this._name=this._name||"program",Q}parse(D,F){this._prepareForParse();let Q=this._prepareUserArgs(D,F);return this._parseCommand([],Q),this}async parseAsync(D,F){this._prepareForParse();let Q=this._prepareUserArgs(D,F);return await this._parseCommand([],Q),this}_prepareForParse(){if(this._savedState===null)this.saveStateBeforeParse();else this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw new Error(`Can not call parse again when storeOptionsAsProperties is true.
17
+ - already used by option '${F.flags}'`)}this._initOptionGroup(D),this.options.push(D)}_registerCommand(D){let F=(B)=>{return[B.name()].concat(B.aliases())},Q=F(D).find((B)=>this._findCommand(B));if(Q){let B=F(this._findCommand(Q)).join("|"),Y=F(D).join("|");throw new Error(`cannot add command '${Y}' as already have command '${B}'`)}this._initCommandGroup(D),this.commands.push(D)}addOption(D){this._registerOption(D);let F=D.name(),Q=D.attributeName();if(D.negate){let Y=D.long.replace(/^--no-/,"--");if(!this._findOption(Y))this.setOptionValueWithSource(Q,D.defaultValue===void 0?!0:D.defaultValue,"default")}else if(D.defaultValue!==void 0)this.setOptionValueWithSource(Q,D.defaultValue,"default");let B=(Y,J,X)=>{if(Y==null&&D.presetArg!==void 0)Y=D.presetArg;let C=this.getOptionValue(Q);if(Y!==null&&D.parseArg)Y=this._callParseArg(D,Y,C,J);else if(Y!==null&&D.variadic)Y=D._concatValue(Y,C);if(Y==null)if(D.negate)Y=!1;else if(D.isBoolean()||D.optional)Y=!0;else Y="";this.setOptionValueWithSource(Q,Y,X)};if(this.on("option:"+F,(Y)=>{let J=`error: option '${D.flags}' argument '${Y}' is invalid.`;B(Y,J,"cli")}),D.envVar)this.on("optionEnv:"+F,(Y)=>{let J=`error: option '${D.flags}' value '${Y}' from env '${D.envVar}' is invalid.`;B(Y,J,"env")});return this}_optionEx(D,F,Q,B,Y){if(typeof F==="object"&&F instanceof $9)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let J=this.createOption(F,Q);if(J.makeOptionMandatory(!!D.mandatory),typeof B==="function")J.default(Y).argParser(B);else if(B instanceof RegExp){let X=B;B=(C,W)=>{let z=X.exec(C);return z?z[0]:W},J.default(Y).argParser(B)}else J.default(B);return this.addOption(J)}option(D,F,Q,B){return this._optionEx({},D,F,Q,B)}requiredOption(D,F,Q,B){return this._optionEx({mandatory:!0},D,F,Q,B)}combineFlagAndOptionalValue(D=!0){return this._combineFlagAndOptionalValue=!!D,this}allowUnknownOption(D=!0){return this._allowUnknownOption=!!D,this}allowExcessArguments(D=!0){return this._allowExcessArguments=!!D,this}enablePositionalOptions(D=!0){return this._enablePositionalOptions=!!D,this}passThroughOptions(D=!0){return this._passThroughOptions=!!D,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(D=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!D,this}getOptionValue(D){if(this._storeOptionsAsProperties)return this[D];return this._optionValues[D]}setOptionValue(D,F){return this.setOptionValueWithSource(D,F,void 0)}setOptionValueWithSource(D,F,Q){if(this._storeOptionsAsProperties)this[D]=F;else this._optionValues[D]=F;return this._optionValueSources[D]=Q,this}getOptionValueSource(D){return this._optionValueSources[D]}getOptionValueSourceWithGlobals(D){let F;return this._getCommandAndAncestors().forEach((Q)=>{if(Q.getOptionValueSource(D)!==void 0)F=Q.getOptionValueSource(D)}),F}_prepareUserArgs(D,F){if(D!==void 0&&!Array.isArray(D))throw new Error("first parameter to parse must be array or undefined");if(F=F||{},D===void 0&&F.from===void 0){if(OD.versions?.electron)F.from="electron";let B=OD.execArgv??[];if(B.includes("-e")||B.includes("--eval")||B.includes("-p")||B.includes("--print"))F.from="eval"}if(D===void 0)D=OD.argv;this.rawArgs=D.slice();let Q;switch(F.from){case void 0:case"node":this._scriptPath=D[1],Q=D.slice(2);break;case"electron":if(OD.defaultApp)this._scriptPath=D[1],Q=D.slice(2);else Q=D.slice(1);break;case"user":Q=D.slice(0);break;case"eval":Q=D.slice(1);break;default:throw new Error(`unexpected parse option { from: '${F.from}' }`)}if(!this._name&&this._scriptPath)this.nameFromFilename(this._scriptPath);return this._name=this._name||"program",Q}parse(D,F){this._prepareForParse();let Q=this._prepareUserArgs(D,F);return this._parseCommand([],Q),this}async parseAsync(D,F){this._prepareForParse();let Q=this._prepareUserArgs(D,F);return await this._parseCommand([],Q),this}_prepareForParse(){if(this._savedState===null)this.saveStateBeforeParse();else this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw new Error(`Can not call parse again when storeOptionsAsProperties is true.
18
18
  - either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable(D,F,Q){if(d8.existsSync(D))return;let B=F?`searched for local subcommand relative to directory '${F}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",Y=`'${D}' does not exist
19
19
  - if '${Q}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
20
20
  - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
21
- - ${B}`;throw new Error(Y)}_executeSubCommand(D,F){F=F.slice();let Q=!1,B=[".js",".ts",".tsx",".mjs",".cjs"];function Y(W,G){let q=NF.resolve(W,G);if(d8.existsSync(q))return q;if(B.includes(NF.extname(G)))return;let A=B.find((U)=>d8.existsSync(`${q}${U}`));if(A)return`${q}${A}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let J=D._executableFile||`${this._name}-${D._name}`,X=this._executableDir||"";if(this._scriptPath){let W;try{W=d8.realpathSync(this._scriptPath)}catch{W=this._scriptPath}X=NF.resolve(NF.dirname(W),X)}if(X){let W=Y(X,J);if(!W&&!D._executableFile&&this._scriptPath){let G=NF.basename(this._scriptPath,NF.extname(this._scriptPath));if(G!==this._name)W=Y(X,`${G}-${D._name}`)}J=W||J}Q=B.includes(NF.extname(J));let C;if(OD.platform!=="win32")if(Q)F.unshift(J),F=m9(OD.execArgv).concat(F),C=z1.spawn(OD.argv[0],F,{stdio:"inherit"});else C=z1.spawn(J,F,{stdio:"inherit"});else this._checkForMissingExecutable(J,X,D._name),F.unshift(J),F=m9(OD.execArgv).concat(F),C=z1.spawn(OD.execPath,F,{stdio:"inherit"});if(!C.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((G)=>{OD.on(G,()=>{if(C.killed===!1&&C.exitCode===null)C.kill(G)})});let z=this._exitCallback;C.on("close",(W)=>{if(W=W??1,!z)OD.exit(W);else z(new G1(W,"commander.executeSubCommandAsync","(close)"))}),C.on("error",(W)=>{if(W.code==="ENOENT")this._checkForMissingExecutable(J,X,D._name);else if(W.code==="EACCES")throw new Error(`'${J}' not executable`);if(!z)OD.exit(1);else{let G=new G1(1,"commander.executeSubCommandAsync","(error)");G.nestedError=W,z(G)}}),this.runningCommand=C}_dispatchSubcommand(D,F,Q){let B=this._findCommand(D);if(!B)this.help({error:!0});B._prepareForParse();let Y;return Y=this._chainOrCallSubCommandHook(Y,B,"preSubcommand"),Y=this._chainOrCall(Y,()=>{if(B._executableHandler)this._executeSubCommand(B,F.concat(Q));else return B._parseCommand(F,Q)}),Y}_dispatchHelpCommand(D){if(!D)this.help();let F=this._findCommand(D);if(F&&!F._executableHandler)F.help();return this._dispatchSubcommand(D,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){if(this.registeredArguments.forEach((D,F)=>{if(D.required&&this.args[F]==null)this.missingArgument(D.name())}),this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)return;if(this.args.length>this.registeredArguments.length)this._excessArguments(this.args)}_processArguments(){let D=(Q,B,Y)=>{let J=B;if(B!==null&&Q.parseArg){let X=`error: command-argument value '${B}' is invalid for argument '${Q.name()}'.`;J=this._callParseArg(Q,B,Y,X)}return J};this._checkNumberOfArguments();let F=[];this.registeredArguments.forEach((Q,B)=>{let Y=Q.defaultValue;if(Q.variadic){if(B<this.args.length){if(Y=this.args.slice(B),Q.parseArg)Y=Y.reduce((J,X)=>{return D(Q,X,J)},Q.defaultValue)}else if(Y===void 0)Y=[]}else if(B<this.args.length){if(Y=this.args[B],Q.parseArg)Y=D(Q,Y,Q.defaultValue)}F[B]=Y}),this.processedArgs=F}_chainOrCall(D,F){if(D?.then&&typeof D.then==="function")return D.then(()=>F());return F()}_chainOrCallHooks(D,F){let Q=D,B=[];if(this._getCommandAndAncestors().reverse().filter((Y)=>Y._lifeCycleHooks[F]!==void 0).forEach((Y)=>{Y._lifeCycleHooks[F].forEach((J)=>{B.push({hookedCommand:Y,callback:J})})}),F==="postAction")B.reverse();return B.forEach((Y)=>{Q=this._chainOrCall(Q,()=>{return Y.callback(Y.hookedCommand,this)})}),Q}_chainOrCallSubCommandHook(D,F,Q){let B=D;if(this._lifeCycleHooks[Q]!==void 0)this._lifeCycleHooks[Q].forEach((Y)=>{B=this._chainOrCall(B,()=>{return Y(this,F)})});return B}_parseCommand(D,F){let Q=this.parseOptions(F);if(this._parseOptionsEnv(),this._parseOptionsImplied(),D=D.concat(Q.operands),F=Q.unknown,this.args=D.concat(F),D&&this._findCommand(D[0]))return this._dispatchSubcommand(D[0],D.slice(1),F);if(this._getHelpCommand()&&D[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(D[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(F),this._dispatchSubcommand(this._defaultCommandName,D,F);if(this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName)this.help({error:!0});this._outputHelpIfRequested(Q.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let B=()=>{if(Q.unknown.length>0)this.unknownOption(Q.unknown[0])},Y=`command:${this.name()}`;if(this._actionHandler){B(),this._processArguments();let J;if(J=this._chainOrCallHooks(J,"preAction"),J=this._chainOrCall(J,()=>this._actionHandler(this.processedArgs)),this.parent)J=this._chainOrCall(J,()=>{this.parent.emit(Y,D,F)});return J=this._chainOrCallHooks(J,"postAction"),J}if(this.parent?.listenerCount(Y))B(),this._processArguments(),this.parent.emit(Y,D,F);else if(D.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",D,F);if(this.listenerCount("command:*"))this.emit("command:*",D,F);else if(this.commands.length)this.unknownCommand();else B(),this._processArguments()}else if(this.commands.length)B(),this.help({error:!0});else B(),this._processArguments()}_findCommand(D){if(!D)return;return this.commands.find((F)=>F._name===D||F._aliases.includes(D))}_findOption(D){return this.options.find((F)=>F.is(D))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach((D)=>{D.options.forEach((F)=>{if(F.mandatory&&D.getOptionValue(F.attributeName())===void 0)D.missingMandatoryOptionValue(F)})})}_checkForConflictingLocalOptions(){let D=this.options.filter((Q)=>{let B=Q.attributeName();if(this.getOptionValue(B)===void 0)return!1;return this.getOptionValueSource(B)!=="default"});D.filter((Q)=>Q.conflictsWith.length>0).forEach((Q)=>{let B=D.find((Y)=>Q.conflictsWith.includes(Y.attributeName()));if(B)this._conflictingOption(Q,B)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach((D)=>{D._checkForConflictingLocalOptions()})}parseOptions(D){let F=[],Q=[],B=F;function Y(W){return W.length>1&&W[0]==="-"}let J=(W)=>{if(!/^-\d*\.?\d+(e[+-]?\d+)?$/.test(W))return!1;return!this._getCommandAndAncestors().some((G)=>G.options.map((q)=>q.short).some((q)=>/^-\d$/.test(q)))},X=null,C=null,z=0;while(z<D.length||C){let W=C??D[z++];if(C=null,W==="--"){if(B===Q)B.push(W);B.push(...D.slice(z));break}if(X&&(!Y(W)||J(W))){this.emit(`option:${X.name()}`,W);continue}if(X=null,Y(W)){let G=this._findOption(W);if(G){if(G.required){let q=D[z++];if(q===void 0)this.optionMissingArgument(G);this.emit(`option:${G.name()}`,q)}else if(G.optional){let q=null;if(z<D.length&&(!Y(D[z])||J(D[z])))q=D[z++];this.emit(`option:${G.name()}`,q)}else this.emit(`option:${G.name()}`);X=G.variadic?G:null;continue}}if(W.length>2&&W[0]==="-"&&W[1]!=="-"){let G=this._findOption(`-${W[1]}`);if(G){if(G.required||G.optional&&this._combineFlagAndOptionalValue)this.emit(`option:${G.name()}`,W.slice(2));else this.emit(`option:${G.name()}`),C=`-${W.slice(2)}`;continue}}if(/^--[^=]+=/.test(W)){let G=W.indexOf("="),q=this._findOption(W.slice(0,G));if(q&&(q.required||q.optional)){this.emit(`option:${q.name()}`,W.slice(G+1));continue}}if(B===F&&Y(W)&&!(this.commands.length===0&&J(W)))B=Q;if((this._enablePositionalOptions||this._passThroughOptions)&&F.length===0&&Q.length===0){if(this._findCommand(W)){F.push(W),Q.push(...D.slice(z));break}else if(this._getHelpCommand()&&W===this._getHelpCommand().name()){F.push(W,...D.slice(z));break}else if(this._defaultCommandName){Q.push(W,...D.slice(z));break}}if(this._passThroughOptions){B.push(W,...D.slice(z));break}B.push(W)}return{operands:F,unknown:Q}}opts(){if(this._storeOptionsAsProperties){let D={},F=this.options.length;for(let Q=0;Q<F;Q++){let B=this.options[Q].attributeName();D[B]=B===this._versionOptionName?this._version:this[B]}return D}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((D,F)=>Object.assign(D,F.opts()),{})}error(D,F){if(this._outputConfiguration.outputError(`${D}
21
+ - ${B}`;throw new Error(Y)}_executeSubCommand(D,F){F=F.slice();let Q=!1,B=[".js",".ts",".tsx",".mjs",".cjs"];function Y(z,G){let q=NF.resolve(z,G);if(d8.existsSync(q))return q;if(B.includes(NF.extname(G)))return;let A=B.find((U)=>d8.existsSync(`${q}${U}`));if(A)return`${q}${A}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let J=D._executableFile||`${this._name}-${D._name}`,X=this._executableDir||"";if(this._scriptPath){let z;try{z=d8.realpathSync(this._scriptPath)}catch{z=this._scriptPath}X=NF.resolve(NF.dirname(z),X)}if(X){let z=Y(X,J);if(!z&&!D._executableFile&&this._scriptPath){let G=NF.basename(this._scriptPath,NF.extname(this._scriptPath));if(G!==this._name)z=Y(X,`${G}-${D._name}`)}J=z||J}Q=B.includes(NF.extname(J));let C;if(OD.platform!=="win32")if(Q)F.unshift(J),F=m9(OD.execArgv).concat(F),C=z1.spawn(OD.argv[0],F,{stdio:"inherit"});else C=z1.spawn(J,F,{stdio:"inherit"});else this._checkForMissingExecutable(J,X,D._name),F.unshift(J),F=m9(OD.execArgv).concat(F),C=z1.spawn(OD.execPath,F,{stdio:"inherit"});if(!C.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((G)=>{OD.on(G,()=>{if(C.killed===!1&&C.exitCode===null)C.kill(G)})});let W=this._exitCallback;C.on("close",(z)=>{if(z=z??1,!W)OD.exit(z);else W(new G1(z,"commander.executeSubCommandAsync","(close)"))}),C.on("error",(z)=>{if(z.code==="ENOENT")this._checkForMissingExecutable(J,X,D._name);else if(z.code==="EACCES")throw new Error(`'${J}' not executable`);if(!W)OD.exit(1);else{let G=new G1(1,"commander.executeSubCommandAsync","(error)");G.nestedError=z,W(G)}}),this.runningCommand=C}_dispatchSubcommand(D,F,Q){let B=this._findCommand(D);if(!B)this.help({error:!0});B._prepareForParse();let Y;return Y=this._chainOrCallSubCommandHook(Y,B,"preSubcommand"),Y=this._chainOrCall(Y,()=>{if(B._executableHandler)this._executeSubCommand(B,F.concat(Q));else return B._parseCommand(F,Q)}),Y}_dispatchHelpCommand(D){if(!D)this.help();let F=this._findCommand(D);if(F&&!F._executableHandler)F.help();return this._dispatchSubcommand(D,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){if(this.registeredArguments.forEach((D,F)=>{if(D.required&&this.args[F]==null)this.missingArgument(D.name())}),this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)return;if(this.args.length>this.registeredArguments.length)this._excessArguments(this.args)}_processArguments(){let D=(Q,B,Y)=>{let J=B;if(B!==null&&Q.parseArg){let X=`error: command-argument value '${B}' is invalid for argument '${Q.name()}'.`;J=this._callParseArg(Q,B,Y,X)}return J};this._checkNumberOfArguments();let F=[];this.registeredArguments.forEach((Q,B)=>{let Y=Q.defaultValue;if(Q.variadic){if(B<this.args.length){if(Y=this.args.slice(B),Q.parseArg)Y=Y.reduce((J,X)=>{return D(Q,X,J)},Q.defaultValue)}else if(Y===void 0)Y=[]}else if(B<this.args.length){if(Y=this.args[B],Q.parseArg)Y=D(Q,Y,Q.defaultValue)}F[B]=Y}),this.processedArgs=F}_chainOrCall(D,F){if(D&&D.then&&typeof D.then==="function")return D.then(()=>F());return F()}_chainOrCallHooks(D,F){let Q=D,B=[];if(this._getCommandAndAncestors().reverse().filter((Y)=>Y._lifeCycleHooks[F]!==void 0).forEach((Y)=>{Y._lifeCycleHooks[F].forEach((J)=>{B.push({hookedCommand:Y,callback:J})})}),F==="postAction")B.reverse();return B.forEach((Y)=>{Q=this._chainOrCall(Q,()=>{return Y.callback(Y.hookedCommand,this)})}),Q}_chainOrCallSubCommandHook(D,F,Q){let B=D;if(this._lifeCycleHooks[Q]!==void 0)this._lifeCycleHooks[Q].forEach((Y)=>{B=this._chainOrCall(B,()=>{return Y(this,F)})});return B}_parseCommand(D,F){let Q=this.parseOptions(F);if(this._parseOptionsEnv(),this._parseOptionsImplied(),D=D.concat(Q.operands),F=Q.unknown,this.args=D.concat(F),D&&this._findCommand(D[0]))return this._dispatchSubcommand(D[0],D.slice(1),F);if(this._getHelpCommand()&&D[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(D[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(F),this._dispatchSubcommand(this._defaultCommandName,D,F);if(this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName)this.help({error:!0});this._outputHelpIfRequested(Q.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let B=()=>{if(Q.unknown.length>0)this.unknownOption(Q.unknown[0])},Y=`command:${this.name()}`;if(this._actionHandler){B(),this._processArguments();let J;if(J=this._chainOrCallHooks(J,"preAction"),J=this._chainOrCall(J,()=>this._actionHandler(this.processedArgs)),this.parent)J=this._chainOrCall(J,()=>{this.parent.emit(Y,D,F)});return J=this._chainOrCallHooks(J,"postAction"),J}if(this.parent&&this.parent.listenerCount(Y))B(),this._processArguments(),this.parent.emit(Y,D,F);else if(D.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",D,F);if(this.listenerCount("command:*"))this.emit("command:*",D,F);else if(this.commands.length)this.unknownCommand();else B(),this._processArguments()}else if(this.commands.length)B(),this.help({error:!0});else B(),this._processArguments()}_findCommand(D){if(!D)return;return this.commands.find((F)=>F._name===D||F._aliases.includes(D))}_findOption(D){return this.options.find((F)=>F.is(D))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach((D)=>{D.options.forEach((F)=>{if(F.mandatory&&D.getOptionValue(F.attributeName())===void 0)D.missingMandatoryOptionValue(F)})})}_checkForConflictingLocalOptions(){let D=this.options.filter((Q)=>{let B=Q.attributeName();if(this.getOptionValue(B)===void 0)return!1;return this.getOptionValueSource(B)!=="default"});D.filter((Q)=>Q.conflictsWith.length>0).forEach((Q)=>{let B=D.find((Y)=>Q.conflictsWith.includes(Y.attributeName()));if(B)this._conflictingOption(Q,B)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach((D)=>{D._checkForConflictingLocalOptions()})}parseOptions(D){let F=[],Q=[],B=F,Y=D.slice();function J(W){return W.length>1&&W[0]==="-"}let X=(W)=>{if(!/^-\d*\.?\d+(e[+-]?\d+)?$/.test(W))return!1;return!this._getCommandAndAncestors().some((z)=>z.options.map((G)=>G.short).some((G)=>/^-\d$/.test(G)))},C=null;while(Y.length){let W=Y.shift();if(W==="--"){if(B===Q)B.push(W);B.push(...Y);break}if(C&&(!J(W)||X(W))){this.emit(`option:${C.name()}`,W);continue}if(C=null,J(W)){let z=this._findOption(W);if(z){if(z.required){let G=Y.shift();if(G===void 0)this.optionMissingArgument(z);this.emit(`option:${z.name()}`,G)}else if(z.optional){let G=null;if(Y.length>0&&(!J(Y[0])||X(Y[0])))G=Y.shift();this.emit(`option:${z.name()}`,G)}else this.emit(`option:${z.name()}`);C=z.variadic?z:null;continue}}if(W.length>2&&W[0]==="-"&&W[1]!=="-"){let z=this._findOption(`-${W[1]}`);if(z){if(z.required||z.optional&&this._combineFlagAndOptionalValue)this.emit(`option:${z.name()}`,W.slice(2));else this.emit(`option:${z.name()}`),Y.unshift(`-${W.slice(2)}`);continue}}if(/^--[^=]+=/.test(W)){let z=W.indexOf("="),G=this._findOption(W.slice(0,z));if(G&&(G.required||G.optional)){this.emit(`option:${G.name()}`,W.slice(z+1));continue}}if(B===F&&J(W)&&!(this.commands.length===0&&X(W)))B=Q;if((this._enablePositionalOptions||this._passThroughOptions)&&F.length===0&&Q.length===0){if(this._findCommand(W)){if(F.push(W),Y.length>0)Q.push(...Y);break}else if(this._getHelpCommand()&&W===this._getHelpCommand().name()){if(F.push(W),Y.length>0)F.push(...Y);break}else if(this._defaultCommandName){if(Q.push(W),Y.length>0)Q.push(...Y);break}}if(this._passThroughOptions){if(B.push(W),Y.length>0)B.push(...Y);break}B.push(W)}return{operands:F,unknown:Q}}opts(){if(this._storeOptionsAsProperties){let D={},F=this.options.length;for(let Q=0;Q<F;Q++){let B=this.options[Q].attributeName();D[B]=B===this._versionOptionName?this._version:this[B]}return D}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((D,F)=>Object.assign(D,F.opts()),{})}error(D,F){if(this._outputConfiguration.outputError(`${D}
22
22
  `,this._outputConfiguration.writeErr),typeof this._showHelpAfterError==="string")this._outputConfiguration.writeErr(`${this._showHelpAfterError}
23
23
  `);else if(this._showHelpAfterError)this._outputConfiguration.writeErr(`
24
- `),this.outputHelp({error:!0});let Q=F||{},B=Q.exitCode||1,Y=Q.code||"commander.error";this._exit(B,Y,D)}_parseOptionsEnv(){this.options.forEach((D)=>{if(D.envVar&&D.envVar in OD.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()}`,OD.env[D.envVar]);else this.emit(`optionEnv:${D.name()}`)}})}_parseOptionsImplied(){let D=new eX(this.options),F=(Q)=>{return this.getOptionValue(Q)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(Q))};this.options.filter((Q)=>Q.implied!==void 0&&F(Q.attributeName())&&D.valueFromOption(this.getOptionValue(Q.attributeName()),Q)).forEach((Q)=>{Object.keys(Q.implied).filter((B)=>!F(B)).forEach((B)=>{this.setOptionValueWithSource(B,Q.implied[B],"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 Q=(J)=>{let X=J.attributeName(),C=this.getOptionValue(X),z=this.options.find((G)=>G.negate&&X===G.attributeName()),W=this.options.find((G)=>!G.negate&&X===G.attributeName());if(z&&(z.presetArg===void 0&&C===!1||z.presetArg!==void 0&&C===z.presetArg))return z;return W||J},B=(J)=>{let X=Q(J),C=X.attributeName();if(this.getOptionValueSource(C)==="env")return`environment variable '${X.envVar}'`;return`option '${X.flags}'`},Y=`error: ${B(D)} cannot be used with ${B(F)}`;this.error(Y,{code:"commander.conflictingOption"})}unknownOption(D){if(this._allowUnknownOption)return;let F="";if(D.startsWith("--")&&this._showSuggestionAfterError){let B=[],Y=this;do{let J=Y.createHelp().visibleOptions(Y).filter((X)=>X.long).map((X)=>X.long);B=B.concat(J),Y=Y.parent}while(Y&&!Y._enablePositionalOptions);F=h9(D,B)}let Q=`error: unknown option '${D}'${F}`;this.error(Q,{code:"commander.unknownOption"})}_excessArguments(D){if(this._allowExcessArguments)return;let F=this.registeredArguments.length,Q=F===1?"":"s",Y=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${F} argument${Q} but got ${D.length}.`;this.error(Y,{code:"commander.excessArguments"})}unknownCommand(){let D=this.args[0],F="";if(this._showSuggestionAfterError){let B=[];this.createHelp().visibleCommands(this).forEach((Y)=>{if(B.push(Y.name()),Y.alias())B.push(Y.alias())}),F=h9(D,B)}let Q=`error: unknown command '${D}'${F}`;this.error(Q,{code:"commander.unknownCommand"})}version(D,F,Q){if(D===void 0)return this._version;this._version=D,F=F||"-V, --version",Q=Q||"output the version number";let B=this.createOption(F,Q);return this._versionOptionName=B.attributeName(),this._registerOption(B),this.on("option:"+B.name(),()=>{this._outputConfiguration.writeOut(`${D}
24
+ `),this.outputHelp({error:!0});let Q=F||{},B=Q.exitCode||1,Y=Q.code||"commander.error";this._exit(B,Y,D)}_parseOptionsEnv(){this.options.forEach((D)=>{if(D.envVar&&D.envVar in OD.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()}`,OD.env[D.envVar]);else this.emit(`optionEnv:${D.name()}`)}})}_parseOptionsImplied(){let D=new eX(this.options),F=(Q)=>{return this.getOptionValue(Q)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(Q))};this.options.filter((Q)=>Q.implied!==void 0&&F(Q.attributeName())&&D.valueFromOption(this.getOptionValue(Q.attributeName()),Q)).forEach((Q)=>{Object.keys(Q.implied).filter((B)=>!F(B)).forEach((B)=>{this.setOptionValueWithSource(B,Q.implied[B],"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 Q=(J)=>{let X=J.attributeName(),C=this.getOptionValue(X),W=this.options.find((G)=>G.negate&&X===G.attributeName()),z=this.options.find((G)=>!G.negate&&X===G.attributeName());if(W&&(W.presetArg===void 0&&C===!1||W.presetArg!==void 0&&C===W.presetArg))return W;return z||J},B=(J)=>{let X=Q(J),C=X.attributeName();if(this.getOptionValueSource(C)==="env")return`environment variable '${X.envVar}'`;return`option '${X.flags}'`},Y=`error: ${B(D)} cannot be used with ${B(F)}`;this.error(Y,{code:"commander.conflictingOption"})}unknownOption(D){if(this._allowUnknownOption)return;let F="";if(D.startsWith("--")&&this._showSuggestionAfterError){let B=[],Y=this;do{let J=Y.createHelp().visibleOptions(Y).filter((X)=>X.long).map((X)=>X.long);B=B.concat(J),Y=Y.parent}while(Y&&!Y._enablePositionalOptions);F=h9(D,B)}let Q=`error: unknown option '${D}'${F}`;this.error(Q,{code:"commander.unknownOption"})}_excessArguments(D){if(this._allowExcessArguments)return;let F=this.registeredArguments.length,Q=F===1?"":"s",Y=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${F} argument${Q} but got ${D.length}.`;this.error(Y,{code:"commander.excessArguments"})}unknownCommand(){let D=this.args[0],F="";if(this._showSuggestionAfterError){let B=[];this.createHelp().visibleCommands(this).forEach((Y)=>{if(B.push(Y.name()),Y.alias())B.push(Y.alias())}),F=h9(D,B)}let Q=`error: unknown command '${D}'${F}`;this.error(Q,{code:"commander.unknownCommand"})}version(D,F,Q){if(D===void 0)return this._version;this._version=D,F=F||"-V, --version",Q=Q||"output the version number";let B=this.createOption(F,Q);return this._versionOptionName=B.attributeName(),this._registerOption(B),this.on("option:"+B.name(),()=>{this._outputConfiguration.writeOut(`${D}
25
25
  `),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 new Error("Command alias can't be the same as its name");let Q=this.parent?._findCommand(D);if(Q){let B=[Q.name()].concat(Q.aliases()).join("|");throw new Error(`cannot add alias '${D}' to command '${this.name()}' as already have command '${B}'`)}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((Q)=>{return oX(Q)});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}helpGroup(D){if(D===void 0)return this._helpGroupHeading??"";return this._helpGroupHeading=D,this}commandsGroup(D){if(D===void 0)return this._defaultCommandGroup??"";return this._defaultCommandGroup=D,this}optionsGroup(D){if(D===void 0)return this._defaultOptionGroup??"";return this._defaultOptionGroup=D,this}_initOptionGroup(D){if(this._defaultOptionGroup&&!D.helpGroupHeading)D.helpGroup(this._defaultOptionGroup)}_initCommandGroup(D){if(this._defaultCommandGroup&&!D.helpGroup())D.helpGroup(this._defaultCommandGroup)}nameFromFilename(D){return this._name=NF.basename(D,NF.extname(D)),this}executableDir(D){if(D===void 0)return this._executableDir;return this._executableDir=D,this}helpInformation(D){let F=this.createHelp(),Q=this._getOutputContext(D);F.prepareContext({error:Q.error,helpWidth:Q.helpWidth,outputHasColors:Q.hasColors});let B=F.formatHelp(this,F);if(Q.hasColors)return B;return this._outputConfiguration.stripColor(B)}_getOutputContext(D){D=D||{};let F=!!D.error,Q,B,Y;if(F)Q=(X)=>this._outputConfiguration.writeErr(X),B=this._outputConfiguration.getErrHasColors(),Y=this._outputConfiguration.getErrHelpWidth();else Q=(X)=>this._outputConfiguration.writeOut(X),B=this._outputConfiguration.getOutHasColors(),Y=this._outputConfiguration.getOutHelpWidth();return{error:F,write:(X)=>{if(!B)X=this._outputConfiguration.stripColor(X);return Q(X)},hasColors:B,helpWidth:Y}}outputHelp(D){let F;if(typeof D==="function")F=D,D=void 0;let Q=this._getOutputContext(D),B={error:Q.error,write:Q.write,command:this};this._getCommandAndAncestors().reverse().forEach((J)=>J.emit("beforeAllHelp",B)),this.emit("beforeHelp",B);let Y=this.helpInformation({error:Q.error});if(F){if(Y=F(Y),typeof Y!=="string"&&!Buffer.isBuffer(Y))throw new Error("outputHelp callback must return a string or a Buffer")}if(Q.write(Y),this._getHelpOption()?.long)this.emit(this._getHelpOption().long);this.emit("afterHelp",B),this._getCommandAndAncestors().forEach((J)=>J.emit("afterAllHelp",B))}helpOption(D,F){if(typeof D==="boolean"){if(D){if(this._helpOption===null)this._helpOption=void 0;if(this._defaultOptionGroup)this._initOptionGroup(this._getHelpOption())}else this._helpOption=null;return this}if(this._helpOption=this.createOption(D??"-h, --help",F??"display help for command"),D||F)this._initOptionGroup(this._helpOption);return this}_getHelpOption(){if(this._helpOption===void 0)this.helpOption(void 0,void 0);return this._helpOption}addHelpOption(D){return this._helpOption=D,this._initOptionGroup(D),this}help(D){this.outputHelp(D);let F=Number(OD.exitCode??0);if(F===0&&D&&typeof D!=="function"&&D.error)F=1;this._exit(F,"commander.help","(outputHelp)")}addHelpText(D,F){let Q=["beforeAll","before","after","afterAll"];if(!Q.includes(D))throw new Error(`Unexpected value for position to addHelpText.
26
26
  Expecting one of '${Q.join("', '")}'`);let B=`${D}Help`;return this.on(B,(Y)=>{let J;if(typeof F==="function")J=F({error:Y.error,command:Y.command});else J=F;if(J)Y.write(`${J}
27
- `)}),this}_outputHelpIfRequested(D){let F=this._getHelpOption();if(F&&D.find((B)=>F.is(B)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function m9(D){return D.map((F)=>{if(!F.startsWith("--inspect"))return F;let Q,B="127.0.0.1",Y="9229",J;if((J=F.match(/^(--inspect(-brk)?)$/))!==null)Q=J[1];else if((J=F.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(Q=J[1],/^\d+$/.test(J[3]))Y=J[3];else B=J[3];else if((J=F.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)Q=J[1],B=J[3],Y=J[4];if(Q&&Y!=="0")return`${Q}=${B}:${parseInt(Y)+1}`;return F})}function q1(){if(OD.env.NO_COLOR||OD.env.FORCE_COLOR==="0"||OD.env.FORCE_COLOR==="false")return!1;if(OD.env.FORCE_COLOR||OD.env.CLICOLOR_FORCE!==void 0)return!0;return}DY.Command=H1;DY.useColor=q1});var n9=VD((YY)=>{var{Argument:d9}=l8(),{Command:K1}=l9(),{CommanderError:QY,InvalidArgumentError:c9}=n2(),{Help:XY}=C1(),{Option:p9}=W1();YY.program=new K1;YY.createCommand=(D)=>new K1(D);YY.createOption=(D,F)=>new p9(D,F);YY.createArgument=(D,F)=>new d9(D,F);YY.Command=K1;YY.Option=p9;YY.Argument=d9;YY.Help=XY;YY.CommanderError=QY;YY.InvalidArgumentError=c9;YY.InvalidOptionArgumentError=c9});var E1=VD((ZE,Q3)=>{var U1={to(D,F){if(!F)return`\x1B[${D+1}G`;return`\x1B[${F+1};${D+1}H`},move(D,F){let Q="";if(D<0)Q+=`\x1B[${-D}D`;else if(D>0)Q+=`\x1B[${D}C`;if(F<0)Q+=`\x1B[${-F}A`;else if(F>0)Q+=`\x1B[${F}B`;return Q},up:(D=1)=>`\x1B[${D}A`,down:(D=1)=>`\x1B[${D}B`,forward:(D=1)=>`\x1B[${D}C`,backward:(D=1)=>`\x1B[${D}D`,nextLine:(D=1)=>"\x1B[E".repeat(D),prevLine:(D=1)=>"\x1B[F".repeat(D),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},jY={up:(D=1)=>"\x1B[S".repeat(D),down:(D=1)=>"\x1B[T".repeat(D)},RY={screen:"\x1B[2J",up:(D=1)=>"\x1B[1J".repeat(D),down:(D=1)=>"\x1B[J".repeat(D),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines(D){let F="";for(let Q=0;Q<D;Q++)F+=this.line+(Q<D-1?U1.up():"");if(D)F+=U1.left;return F}};Q3.exports={cursor:U1,scroll:jY,erase:RY,beep:"\x07"}});var Z1=VD((VE,A1)=>{var p8=process||{},X3=p8.argv||[],c8=p8.env||{},_Y=!(!!c8.NO_COLOR||X3.includes("--no-color"))&&(!!c8.FORCE_COLOR||X3.includes("--color")||p8.platform==="win32"||(p8.stdout||{}).isTTY&&c8.TERM!=="dumb"||!!c8.CI),OY=(D,F,Q=D)=>(B)=>{let Y=""+B,J=Y.indexOf(F,D.length);return~J?D+IY(Y,F,Q,J)+F:D+Y+F},IY=(D,F,Q,B)=>{let Y="",J=0;do Y+=D.substring(J,B)+Q,J=B+F.length,B=D.indexOf(F,J);while(~B);return Y+D.substring(J)},Y3=(D=_Y)=>{let F=D?OY:()=>String;return{isColorSupported:D,reset:F("\x1B[0m","\x1B[0m"),bold:F("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:F("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:F("\x1B[3m","\x1B[23m"),underline:F("\x1B[4m","\x1B[24m"),inverse:F("\x1B[7m","\x1B[27m"),hidden:F("\x1B[8m","\x1B[28m"),strikethrough:F("\x1B[9m","\x1B[29m"),black:F("\x1B[30m","\x1B[39m"),red:F("\x1B[31m","\x1B[39m"),green:F("\x1B[32m","\x1B[39m"),yellow:F("\x1B[33m","\x1B[39m"),blue:F("\x1B[34m","\x1B[39m"),magenta:F("\x1B[35m","\x1B[39m"),cyan:F("\x1B[36m","\x1B[39m"),white:F("\x1B[37m","\x1B[39m"),gray:F("\x1B[90m","\x1B[39m"),bgBlack:F("\x1B[40m","\x1B[49m"),bgRed:F("\x1B[41m","\x1B[49m"),bgGreen:F("\x1B[42m","\x1B[49m"),bgYellow:F("\x1B[43m","\x1B[49m"),bgBlue:F("\x1B[44m","\x1B[49m"),bgMagenta:F("\x1B[45m","\x1B[49m"),bgCyan:F("\x1B[46m","\x1B[49m"),bgWhite:F("\x1B[47m","\x1B[49m"),blackBright:F("\x1B[90m","\x1B[39m"),redBright:F("\x1B[91m","\x1B[39m"),greenBright:F("\x1B[92m","\x1B[39m"),yellowBright:F("\x1B[93m","\x1B[39m"),blueBright:F("\x1B[94m","\x1B[39m"),magentaBright:F("\x1B[95m","\x1B[39m"),cyanBright:F("\x1B[96m","\x1B[39m"),whiteBright:F("\x1B[97m","\x1B[39m"),bgBlackBright:F("\x1B[100m","\x1B[49m"),bgRedBright:F("\x1B[101m","\x1B[49m"),bgGreenBright:F("\x1B[102m","\x1B[49m"),bgYellowBright:F("\x1B[103m","\x1B[49m"),bgBlueBright:F("\x1B[104m","\x1B[49m"),bgMagentaBright:F("\x1B[105m","\x1B[49m"),bgCyanBright:F("\x1B[106m","\x1B[49m"),bgWhiteBright:F("\x1B[107m","\x1B[49m")}};A1.exports=Y3();A1.exports.createColors=Y3});var g3=VD((y1,f1)=>{(function(D,F){typeof y1==="object"&&typeof f1!=="undefined"?f1.exports=F():typeof define==="function"&&define.amd?define(F):(D=typeof globalThis!=="undefined"?globalThis:D||self,D.tinycolor=F())})(y1,function(){function D(j){return D=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(_){return typeof _}:function(_){return _&&typeof Symbol=="function"&&_.constructor===Symbol&&_!==Symbol.prototype?"symbol":typeof _},D(j)}var F=/^\s+/,Q=/\s+$/;function B(j,_){if(j=j?j:"",_=_||{},j instanceof B)return j;if(!(this instanceof B))return new B(j,_);var K=Y(j);if(this._originalInput=j,this._r=K.r,this._g=K.g,this._b=K.b,this._a=K.a,this._roundA=Math.round(100*this._a)/100,this._format=_.format||K.format,this._gradientType=_.gradientType,this._r<1)this._r=Math.round(this._r);if(this._g<1)this._g=Math.round(this._g);if(this._b<1)this._b=Math.round(this._b);this._ok=K.ok}B.prototype={isDark:function j(){return this.getBrightness()<128},isLight:function j(){return!this.isDark()},isValid:function j(){return this._ok},getOriginalInput:function j(){return this._originalInput},getFormat:function j(){return this._format},getAlpha:function j(){return this._a},getBrightness:function j(){var _=this.toRgb();return(_.r*299+_.g*587+_.b*114)/1000},getLuminance:function j(){var _=this.toRgb(),K,T,h,c,l,p;if(K=_.r/255,T=_.g/255,h=_.b/255,K<=0.03928)c=K/12.92;else c=Math.pow((K+0.055)/1.055,2.4);if(T<=0.03928)l=T/12.92;else l=Math.pow((T+0.055)/1.055,2.4);if(h<=0.03928)p=h/12.92;else p=Math.pow((h+0.055)/1.055,2.4);return 0.2126*c+0.7152*l+0.0722*p},setAlpha:function j(_){return this._a=w(_),this._roundA=Math.round(100*this._a)/100,this},toHsv:function j(){var _=z(this._r,this._g,this._b);return{h:_.h*360,s:_.s,v:_.v,a:this._a}},toHsvString:function j(){var _=z(this._r,this._g,this._b),K=Math.round(_.h*360),T=Math.round(_.s*100),h=Math.round(_.v*100);return this._a==1?"hsv("+K+", "+T+"%, "+h+"%)":"hsva("+K+", "+T+"%, "+h+"%, "+this._roundA+")"},toHsl:function j(){var _=X(this._r,this._g,this._b);return{h:_.h*360,s:_.s,l:_.l,a:this._a}},toHslString:function j(){var _=X(this._r,this._g,this._b),K=Math.round(_.h*360),T=Math.round(_.s*100),h=Math.round(_.l*100);return this._a==1?"hsl("+K+", "+T+"%, "+h+"%)":"hsla("+K+", "+T+"%, "+h+"%, "+this._roundA+")"},toHex:function j(_){return G(this._r,this._g,this._b,_)},toHexString:function j(_){return"#"+this.toHex(_)},toHex8:function j(_){return q(this._r,this._g,this._b,this._a,_)},toHex8String:function j(_){return"#"+this.toHex8(_)},toRgb:function j(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function j(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function j(){return{r:Math.round(S(this._r,255)*100)+"%",g:Math.round(S(this._g,255)*100)+"%",b:Math.round(S(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function j(){return this._a==1?"rgb("+Math.round(S(this._r,255)*100)+"%, "+Math.round(S(this._g,255)*100)+"%, "+Math.round(S(this._b,255)*100)+"%)":"rgba("+Math.round(S(this._r,255)*100)+"%, "+Math.round(S(this._g,255)*100)+"%, "+Math.round(S(this._b,255)*100)+"%, "+this._roundA+")"},toName:function j(){if(this._a===0)return"transparent";if(this._a<1)return!1;return y[G(this._r,this._g,this._b,!0)]||!1},toFilter:function j(_){var K="#"+A(this._r,this._g,this._b,this._a),T=K,h=this._gradientType?"GradientType = 1, ":"";if(_){var c=B(_);T="#"+A(c._r,c._g,c._b,c._a)}return"progid:DXImageTransform.Microsoft.gradient("+h+"startColorstr="+K+",endColorstr="+T+")"},toString:function j(_){var K=!!_;_=_||this._format;var T=!1,h=this._a<1&&this._a>=0,c=!K&&h&&(_==="hex"||_==="hex6"||_==="hex3"||_==="hex4"||_==="hex8"||_==="name");if(c){if(_==="name"&&this._a===0)return this.toName();return this.toRgbString()}if(_==="rgb")T=this.toRgbString();if(_==="prgb")T=this.toPercentageRgbString();if(_==="hex"||_==="hex6")T=this.toHexString();if(_==="hex3")T=this.toHexString(!0);if(_==="hex4")T=this.toHex8String(!0);if(_==="hex8")T=this.toHex8String();if(_==="name")T=this.toName();if(_==="hsl")T=this.toHslString();if(_==="hsv")T=this.toHsvString();return T||this.toHexString()},clone:function j(){return B(this.toString())},_applyModification:function j(_,K){var T=_.apply(null,[this].concat([].slice.call(K)));return this._r=T._r,this._g=T._g,this._b=T._b,this.setAlpha(T._a),this},lighten:function j(){return this._applyModification(V,arguments)},brighten:function j(){return this._applyModification(N,arguments)},darken:function j(){return this._applyModification(L,arguments)},desaturate:function j(){return this._applyModification(U,arguments)},saturate:function j(){return this._applyModification(Z,arguments)},greyscale:function j(){return this._applyModification(H,arguments)},spin:function j(){return this._applyModification(R,arguments)},_applyCombination:function j(_,K){return _.apply(null,[this].concat([].slice.call(K)))},analogous:function j(){return this._applyCombination(u,arguments)},complement:function j(){return this._applyCombination(k,arguments)},monochromatic:function j(){return this._applyCombination(f,arguments)},splitcomplement:function j(){return this._applyCombination(I,arguments)},triad:function j(){return this._applyCombination(b,[3])},tetrad:function j(){return this._applyCombination(b,[4])}},B.fromRatio=function(j,_){if(D(j)=="object"){var K={};for(var T in j)if(j.hasOwnProperty(T))if(T==="a")K[T]=j[T];else K[T]=o(j[T]);j=K}return B(j,_)};function Y(j){var _={r:0,g:0,b:0},K=1,T=null,h=null,c=null,l=!1,p=!1;if(typeof j=="string")j=hD(j);if(D(j)=="object"){if(LD(j.r)&&LD(j.g)&&LD(j.b))_=J(j.r,j.g,j.b),l=!0,p=String(j.r).substr(-1)==="%"?"prgb":"rgb";else if(LD(j.h)&&LD(j.s)&&LD(j.v))T=o(j.s),h=o(j.v),_=W(j.h,T,h),l=!0,p="hsv";else if(LD(j.h)&&LD(j.s)&&LD(j.l))T=o(j.s),c=o(j.l),_=C(j.h,T,c),l=!0,p="hsl";if(j.hasOwnProperty("a"))K=j.a}return K=w(K),{ok:l,format:j.format||p,r:Math.min(255,Math.max(_.r,0)),g:Math.min(255,Math.max(_.g,0)),b:Math.min(255,Math.max(_.b,0)),a:K}}function J(j,_,K){return{r:S(j,255)*255,g:S(_,255)*255,b:S(K,255)*255}}function X(j,_,K){j=S(j,255),_=S(_,255),K=S(K,255);var T=Math.max(j,_,K),h=Math.min(j,_,K),c,l,p=(T+h)/2;if(T==h)c=l=0;else{var BD=T-h;switch(l=p>0.5?BD/(2-T-h):BD/(T+h),T){case j:c=(_-K)/BD+(_<K?6:0);break;case _:c=(K-j)/BD+2;break;case K:c=(j-_)/BD+4;break}c/=6}return{h:c,s:l,l:p}}function C(j,_,K){var T,h,c;j=S(j,360),_=S(_,100),K=S(K,100);function l(qD,JD,ZD){if(ZD<0)ZD+=1;if(ZD>1)ZD-=1;if(ZD<0.16666666666666666)return qD+(JD-qD)*6*ZD;if(ZD<0.5)return JD;if(ZD<0.6666666666666666)return qD+(JD-qD)*(0.6666666666666666-ZD)*6;return qD}if(_===0)T=h=c=K;else{var p=K<0.5?K*(1+_):K+_-K*_,BD=2*K-p;T=l(BD,p,j+0.3333333333333333),h=l(BD,p,j),c=l(BD,p,j-0.3333333333333333)}return{r:T*255,g:h*255,b:c*255}}function z(j,_,K){j=S(j,255),_=S(_,255),K=S(K,255);var T=Math.max(j,_,K),h=Math.min(j,_,K),c,l,p=T,BD=T-h;if(l=T===0?0:BD/T,T==h)c=0;else{switch(T){case j:c=(_-K)/BD+(_<K?6:0);break;case _:c=(K-j)/BD+2;break;case K:c=(j-_)/BD+4;break}c/=6}return{h:c,s:l,v:p}}function W(j,_,K){j=S(j,360)*6,_=S(_,100),K=S(K,100);var T=Math.floor(j),h=j-T,c=K*(1-_),l=K*(1-h*_),p=K*(1-(1-h)*_),BD=T%6,qD=[K,l,c,c,p,K][BD],JD=[p,K,K,l,c,c][BD],ZD=[c,c,p,K,K,l][BD];return{r:qD*255,g:JD*255,b:ZD*255}}function G(j,_,K,T){var h=[DD(Math.round(j).toString(16)),DD(Math.round(_).toString(16)),DD(Math.round(K).toString(16))];if(T&&h[0].charAt(0)==h[0].charAt(1)&&h[1].charAt(0)==h[1].charAt(1)&&h[2].charAt(0)==h[2].charAt(1))return h[0].charAt(0)+h[1].charAt(0)+h[2].charAt(0);return h.join("")}function q(j,_,K,T,h){var c=[DD(Math.round(j).toString(16)),DD(Math.round(_).toString(16)),DD(Math.round(K).toString(16)),DD(XD(T))];if(h&&c[0].charAt(0)==c[0].charAt(1)&&c[1].charAt(0)==c[1].charAt(1)&&c[2].charAt(0)==c[2].charAt(1)&&c[3].charAt(0)==c[3].charAt(1))return c[0].charAt(0)+c[1].charAt(0)+c[2].charAt(0)+c[3].charAt(0);return c.join("")}function A(j,_,K,T){var h=[DD(XD(T)),DD(Math.round(j).toString(16)),DD(Math.round(_).toString(16)),DD(Math.round(K).toString(16))];return h.join("")}B.equals=function(j,_){if(!j||!_)return!1;return B(j).toRgbString()==B(_).toRgbString()},B.random=function(){return B.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function U(j,_){_=_===0?0:_||10;var K=B(j).toHsl();return K.s-=_/100,K.s=g(K.s),B(K)}function Z(j,_){_=_===0?0:_||10;var K=B(j).toHsl();return K.s+=_/100,K.s=g(K.s),B(K)}function H(j){return B(j).desaturate(100)}function V(j,_){_=_===0?0:_||10;var K=B(j).toHsl();return K.l+=_/100,K.l=g(K.l),B(K)}function N(j,_){_=_===0?0:_||10;var K=B(j).toRgb();return K.r=Math.max(0,Math.min(255,K.r-Math.round(255*-(_/100)))),K.g=Math.max(0,Math.min(255,K.g-Math.round(255*-(_/100)))),K.b=Math.max(0,Math.min(255,K.b-Math.round(255*-(_/100)))),B(K)}function L(j,_){_=_===0?0:_||10;var K=B(j).toHsl();return K.l-=_/100,K.l=g(K.l),B(K)}function R(j,_){var K=B(j).toHsl(),T=(K.h+_)%360;return K.h=T<0?360+T:T,B(K)}function k(j){var _=B(j).toHsl();return _.h=(_.h+180)%360,B(_)}function b(j,_){if(isNaN(_)||_<=0)throw new Error("Argument to polyad must be a positive number");var K=B(j).toHsl(),T=[B(j)],h=360/_;for(var c=1;c<_;c++)T.push(B({h:(K.h+c*h)%360,s:K.s,l:K.l}));return T}function I(j){var _=B(j).toHsl(),K=_.h;return[B(j),B({h:(K+72)%360,s:_.s,l:_.l}),B({h:(K+216)%360,s:_.s,l:_.l})]}function u(j,_,K){_=_||6,K=K||30;var T=B(j).toHsl(),h=360/K,c=[B(j)];for(T.h=(T.h-(h*_>>1)+720)%360;--_;)T.h=(T.h+h)%360,c.push(B(T));return c}function f(j,_){_=_||6;var K=B(j).toHsv(),T=K.h,h=K.s,c=K.v,l=[],p=1/_;while(_--)l.push(B({h:T,s:h,v:c})),c=(c+p)%1;return l}B.mix=function(j,_,K){K=K===0?0:K||50;var T=B(j).toRgb(),h=B(_).toRgb(),c=K/100,l={r:(h.r-T.r)*c+T.r,g:(h.g-T.g)*c+T.g,b:(h.b-T.b)*c+T.b,a:(h.a-T.a)*c+T.a};return B(l)},B.readability=function(j,_){var K=B(j),T=B(_);return(Math.max(K.getLuminance(),T.getLuminance())+0.05)/(Math.min(K.getLuminance(),T.getLuminance())+0.05)},B.isReadable=function(j,_,K){var T=B.readability(j,_),h,c;switch(c=!1,h=cD(K),h.level+h.size){case"AAsmall":case"AAAlarge":c=T>=4.5;break;case"AAlarge":c=T>=3;break;case"AAAsmall":c=T>=7;break}return c},B.mostReadable=function(j,_,K){var T=null,h=0,c,l,p,BD;K=K||{},l=K.includeFallbackColors,p=K.level,BD=K.size;for(var qD=0;qD<_.length;qD++)if(c=B.readability(j,_[qD]),c>h)h=c,T=B(_[qD]);if(B.isReadable(j,T,{level:p,size:BD})||!l)return T;else return K.includeFallbackColors=!1,B.mostReadable(j,["#fff","#000"],K)};var O=B.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},y=B.hexNames=x(O);function x(j){var _={};for(var K in j)if(j.hasOwnProperty(K))_[j[K]]=K;return _}function w(j){if(j=parseFloat(j),isNaN(j)||j<0||j>1)j=1;return j}function S(j,_){if(n(j))j="100%";var K=a(j);if(j=Math.min(_,Math.max(0,parseFloat(j))),K)j=parseInt(j*_,10)/100;if(Math.abs(j-_)<0.000001)return 1;return j%_/parseFloat(_)}function g(j){return Math.min(1,Math.max(0,j))}function d(j){return parseInt(j,16)}function n(j){return typeof j=="string"&&j.indexOf(".")!=-1&&parseFloat(j)===1}function a(j){return typeof j==="string"&&j.indexOf("%")!=-1}function DD(j){return j.length==1?"0"+j:""+j}function o(j){if(j<=1)j=j*100+"%";return j}function XD(j){return Math.round(parseFloat(j)*255).toString(16)}function YD(j){return d(j)/255}var FD=function(){var j="[-\\+]?\\d+%?",_="[-\\+]?\\d*\\.\\d+%?",K="(?:"+_+")|(?:"+j+")",T="[\\s|\\(]+("+K+")[,|\\s]+("+K+")[,|\\s]+("+K+")\\s*\\)?",h="[\\s|\\(]+("+K+")[,|\\s]+("+K+")[,|\\s]+("+K+")[,|\\s]+("+K+")\\s*\\)?";return{CSS_UNIT:new RegExp(K),rgb:new RegExp("rgb"+T),rgba:new RegExp("rgba"+h),hsl:new RegExp("hsl"+T),hsla:new RegExp("hsla"+h),hsv:new RegExp("hsv"+T),hsva:new RegExp("hsva"+h),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function LD(j){return!!FD.CSS_UNIT.exec(j)}function hD(j){j=j.replace(F,"").replace(Q,"").toLowerCase();var _=!1;if(O[j])j=O[j],_=!0;else if(j=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var K;if(K=FD.rgb.exec(j))return{r:K[1],g:K[2],b:K[3]};if(K=FD.rgba.exec(j))return{r:K[1],g:K[2],b:K[3],a:K[4]};if(K=FD.hsl.exec(j))return{h:K[1],s:K[2],l:K[3]};if(K=FD.hsla.exec(j))return{h:K[1],s:K[2],l:K[3],a:K[4]};if(K=FD.hsv.exec(j))return{h:K[1],s:K[2],v:K[3]};if(K=FD.hsva.exec(j))return{h:K[1],s:K[2],v:K[3],a:K[4]};if(K=FD.hex8.exec(j))return{r:d(K[1]),g:d(K[2]),b:d(K[3]),a:YD(K[4]),format:_?"name":"hex8"};if(K=FD.hex6.exec(j))return{r:d(K[1]),g:d(K[2]),b:d(K[3]),format:_?"name":"hex"};if(K=FD.hex4.exec(j))return{r:d(K[1]+""+K[1]),g:d(K[2]+""+K[2]),b:d(K[3]+""+K[3]),a:YD(K[4]+""+K[4]),format:_?"name":"hex8"};if(K=FD.hex3.exec(j))return{r:d(K[1]+""+K[1]),g:d(K[2]+""+K[2]),b:d(K[3]+""+K[3]),format:_?"name":"hex"};return!1}function cD(j){var _,K;if(j=j||{level:"AA",size:"small"},_=(j.level||"AA").toUpperCase(),K=(j.size||"small").toLowerCase(),_!=="AA"&&_!=="AAA")_="AA";if(K!=="small"&&K!=="large")K="small";return{level:_,size:K}}return B})});var p3=VD((DA,c3)=>{var s2=g3(),l3={r:256,g:256,b:256,a:1},d3={h:360,s:1,v:1,a:1};function $1(D,F,Q){let B={};for(let Y in D)if(D.hasOwnProperty(Y))B[Y]=Q===0?0:(F[Y]-D[Y])/Q;return B}function h1(D,F,Q,B){let Y={};for(let J in F)if(F.hasOwnProperty(J))Y[J]=D[J]*Q+F[J],Y[J]=Y[J]<0?Y[J]+B[J]:B[J]!==1?Y[J]%B[J]:Y[J];return Y}function g1(D,F,Q){let B=D.color.toRgb(),Y=F.color.toRgb(),J=$1(B,Y,Q),X=[D.color];for(let C=1;C<Q;C++){let z=h1(J,B,C,l3);X.push(s2(z))}return X}function $3(D,F,Q,B){let Y=D.color.toHsv(),J=F.color.toHsv();if(Y.s===0||J.s===0)return g1(D,F,Q);let X;if(typeof B==="boolean")X=B;else{let G=Y.h<J.h&&J.h-Y.h<180||Y.h>J.h&&Y.h-J.h>180;X=B==="long"&&G||B==="short"&&!G}let C=$1(Y,J,Q),z=[D.color],W;if(Y.h<=J.h&&!X||Y.h>=J.h&&X)W=J.h-Y.h;else if(X)W=360-J.h+Y.h;else W=360-Y.h+J.h;C.h=Math.pow(-1,X?1:0)*Math.abs(W)/Q;for(let G=1;G<Q;G++){let q=h1(C,Y,G,d3);z.push(s2(q))}return z}function h3(D,F){let Q=D.length;if(F=parseInt(F,10),isNaN(F)||F<2)throw new Error("Invalid number of steps (< 2)");if(F<Q)throw new Error("Number of steps cannot be inferior to number of stops");let B=[];for(let J=1;J<Q;J++){let X=(F-1)*(D[J].pos-D[J-1].pos);B.push(Math.max(1,Math.round(X)))}let Y=1;for(let J=Q-1;J--;)Y+=B[J];while(Y!==F)if(Y<F){let J=Math.min.apply(null,B);B[B.indexOf(J)]++,Y++}else{let J=Math.max.apply(null,B);B[B.indexOf(J)]--,Y--}return B}function m3(D,F,Q,B){if(F<0||F>1)throw new Error("Position must be between 0 and 1");let Y,J;for(let z=0,W=D.length;z<W-1;z++)if(F>=D[z].pos&&F<D[z+1].pos){Y=D[z],J=D[z+1];break}if(!Y)Y=J=D[D.length-1];let X=$1(Y.color[Q](),J.color[Q](),(J.pos-Y.pos)*100),C=h1(X,Y.color[Q](),(F-Y.pos)*100,B);return s2(C)}class F6{constructor(D){if(D.length<2)throw new Error("Invalid number of stops (< 2)");let F=D[0].pos!==void 0,Q=D.length,B=-1,Y=!1;if(this.stops=D.map((J,X)=>{let C=J.pos!==void 0;if(F^C)throw new Error("Cannot mix positionned and not posionned color stops");if(C){let z=J.color!==void 0;if(!z&&(Y||X===0||X===Q-1))throw new Error("Cannot define two consecutive position-only stops");if(Y=!z,J={color:z?s2(J.color):null,colorLess:!z,pos:J.pos},J.pos<0||J.pos>1)throw new Error("Color stops positions must be between 0 and 1");else if(J.pos<B)throw new Error("Color stops positions are not ordered");B=J.pos}else J={color:s2(J.color!==void 0?J.color:J),pos:X/(Q-1)};return J}),this.stops[0].pos!==0)this.stops.unshift({color:this.stops[0].color,pos:0}),Q++;if(this.stops[Q-1].pos!==1)this.stops.push({color:this.stops[Q-1].color,pos:1})}reverse(){let D=[];return this.stops.forEach(function(F){D.push({color:F.color,pos:1-F.pos})}),new F6(D.reverse())}loop(){let D=[],F=[];return this.stops.forEach((Q)=>{D.push({color:Q.color,pos:Q.pos/2})}),this.stops.slice(0,-1).forEach((Q)=>{F.push({color:Q.color,pos:1-Q.pos/2})}),new F6(D.concat(F.reverse()))}rgb(D){let F=h3(this.stops,D),Q=[];this.stops.forEach((B,Y)=>{if(B.colorLess)B.color=g1(this.stops[Y-1],this.stops[Y+1],2)[1]});for(let B=0,Y=this.stops.length;B<Y-1;B++){let J=g1(this.stops[B],this.stops[B+1],F[B]);Q.splice(Q.length,0,...J)}return Q.push(this.stops[this.stops.length-1].color),Q}hsv(D,F){let Q=h3(this.stops,D),B=[];this.stops.forEach((Y,J)=>{if(Y.colorLess)Y.color=$3(this.stops[J-1],this.stops[J+1],2,F)[1]});for(let Y=0,J=this.stops.length;Y<J-1;Y++){let X=$3(this.stops[Y],this.stops[Y+1],Q[Y],F);B.splice(B.length,0,...X)}return B.push(this.stops[this.stops.length-1].color),B}css(D,F){D=D||"linear",F=F||(D==="linear"?"to right":"ellipse at center");let Q=D+"-gradient("+F;return this.stops.forEach(function(B){Q+=", "+(B.colorLess?"":B.color.toRgbString()+" ")+B.pos*100+"%"}),Q+=")",Q}rgbAt(D){return m3(this.stops,D,"toRgb",l3)}hsvAt(D){return m3(this.stops,D,"toHsv",d3)}}c3.exports=function(D){if(arguments.length===1){if(!Array.isArray(arguments[0]))throw new Error('"stops" is not an array');D=arguments[0]}else D=Array.prototype.slice.call(arguments);return new F6(D)}});var t3=VD((GA,s3)=>{s3.exports=()=>{return/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g}});var D4=VD((AA,gJ)=>{gJ.exports={single:{topLeft:"┌",top:"─",topRight:"┐",right:"│",bottomRight:"┘",bottom:"─",bottomLeft:"└",left:"│"},double:{topLeft:"╔",top:"═",topRight:"╗",right:"║",bottomRight:"╝",bottom:"═",bottomLeft:"╚",left:"║"},round:{topLeft:"╭",top:"─",topRight:"╮",right:"│",bottomRight:"╯",bottom:"─",bottomLeft:"╰",left:"│"},bold:{topLeft:"┏",top:"━",topRight:"┓",right:"┃",bottomRight:"┛",bottom:"━",bottomLeft:"┗",left:"┃"},singleDouble:{topLeft:"╓",top:"─",topRight:"╖",right:"║",bottomRight:"╜",bottom:"─",bottomLeft:"╙",left:"║"},doubleSingle:{topLeft:"╒",top:"═",topRight:"╕",right:"│",bottomRight:"╛",bottom:"═",bottomLeft:"╘",left:"│"},classic:{topLeft:"+",top:"-",topRight:"+",right:"|",bottomRight:"+",bottom:"-",bottomLeft:"+",left:"|"},arrow:{topLeft:"↘",top:"↓",topRight:"↙",right:"←",bottomRight:"↖",bottom:"↑",bottomLeft:"↗",left:"→"}}});var i1=VD((ZA,n1)=>{var F4=D4();n1.exports=F4;n1.exports.default=F4});var C4=VD((LA,J4)=>{J4.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 z4=VD((MA,W4)=>{var pJ=C4();W4.exports=(D)=>typeof D==="string"?D.replace(pJ(),""):D});var q4=VD((NA,o1)=>{var G4=(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};o1.exports=G4;o1.exports.default=G4});var K4=VD((jA,H4)=>{H4.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 E4=VD((RA,s1)=>{var nJ=z4(),iJ=q4(),aJ=K4(),U4=(D)=>{if(typeof D!=="string"||D.length===0)return 0;if(D=nJ(D),D.length===0)return 0;D=D.replace(aJ()," ");let F=0;for(let Q=0;Q<D.length;Q++){let B=D.codePointAt(Q);if(B<=31||B>=127&&B<=159)continue;if(B>=768&&B<=879)continue;if(B>65535)Q++;F+=iJ(B)?2:1}return F};s1.exports=U4;s1.exports.default=U4});var Z4=VD((_A,A4)=>{var rJ=E4();function lF(D,F){if(!D)return D;F=F||{};let Q=F.align||"center";if(Q==="left")return D;let B=F.split||`
28
- `,Y=F.pad||" ",J=Q!=="right"?oJ:sJ,X=!1;if(!Array.isArray(D))X=!0,D=String(D).split(B);let C,z=0;return D=D.map(function(W){return W=String(W),C=rJ(W),z=Math.max(C,z),{str:W,width:C}}).map(function(W){return new Array(J(z,W.width)+1).join(Y)+W.str}),X?D.join(B):D}lF.left=function D(F){return lF(F,{align:"left"})};lF.center=function D(F){return lF(F,{align:"center"})};lF.right=function D(F){return lF(F,{align:"right"})};A4.exports=lF;function oJ(D,F){return Math.floor((D-F)/2)}function sJ(D,F){return D-F}});var k4={};MF(k4,{version:()=>VC,type:()=>MC,scripts:()=>RC,repository:()=>wC,publishConfig:()=>SC,name:()=>ZC,main:()=>NC,license:()=>IC,keywords:()=>_C,homepage:()=>TC,files:()=>uC,exports:()=>jC,engines:()=>vC,devDependencies:()=>bC,description:()=>LC,dependencies:()=>kC,default:()=>yC,bugs:()=>PC,bin:()=>xC,author:()=>OC});var ZC="claude-mem",VC="3.9.13",LC="Memory compression system for Claude Code - persist context across sessions",MC="module",NC="dist/claude-mem.min.js",jC,RC,_C,OC="Alex Newman",IC="SEE LICENSE IN LICENSE",wC,TC="https://github.com/thedotmack/claude-mem#readme",PC,SC,kC,bC,vC,xC,uC,yC;var b4=zF(()=>{jC={".":"./dist/claude-mem.min.js"},RC={dev:"tsx src/bin/cli.ts","dev:install":"node dist/claude-mem.min.js install --force","dev:status":"node dist/claude-mem.min.js status","dev:compress":"node dist/claude-mem.min.js compress","dev:load":"node dist/claude-mem.min.js load-context","dev:uninstall":"node dist/claude-mem.min.js uninstall","memory-stream:server":"node src/ui/memory-stream/server.js",build:"./scripts/build-minified.sh",test:"bun test test/unit/ test/basic.test.ts && npm run test:integration","test:unit":"bun test test/unit/","test:integration":"vitest run","test:integration:watch":"vitest watch","test:integration:ui":"vitest --ui","test:e2e":"bun test test/e2e/","test:performance":"bun test test/performance/ --benchmark","test:coverage":"bun test --coverage","test:watch":"bun test --watch",lint:"eslint 'src/**/*.ts' 'hook-templates/**/*.ts' 'test/**/*.ts'","lint:fix":"npm run lint -- --fix",format:"prettier --write 'src/**/*.ts' 'hook-templates/**/*.ts' 'test/**/*.ts'","build:npm":"./scripts/npm-publish.sh",publish:"./scripts/publish-with-changelog.sh","publish:latest":"./scripts/publish-latest.sh","publish:with-changelog":"./scripts/publish-with-changelog.sh bump","publish:github":"./scripts/github-publish.sh"},_C=["claude","claude-agent-sdk","mcp","memory","compression","knowledge-graph","transcript","cli","typescript","bun"],wC={type:"git",url:"https://github.com/thedotmack/claude-mem.git"},PC={url:"https://github.com/thedotmack/claude-mem/issues"},SC={access:"public",registry:"https://registry.npmjs.org/"},kC={"@anthropic-ai/claude-agent-sdk":"^0.1.0","@clack/prompts":"^0.11.0","better-sqlite3":"^11.8.0",boxen:"^8.0.1",chalk:"^5.6.0",commander:"^14.0.0",glob:"^11.0.3","gradient-string":"^3.0.0",handlebars:"^4.7.8"},bC={"@types/handlebars":"^4.0.40","@types/node":"^20.0.0","@typescript-eslint/eslint-plugin":"^6.0.0","@typescript-eslint/parser":"^6.0.0","@vitest/ui":"^3.2.4",eslint:"^8.0.0",prettier:"^3.0.0",tsx:"^4.20.5",typescript:"^5.0.0",vitest:"^3.2.4"},vC={node:">=18.0.0",bun:">=1.0.0"},xC={"claude-mem":"dist/claude-mem.min.js"},uC=["dist","hook-templates","commands","docs","src","CHANGELOG.md"],yC={name:ZC,version:VC,description:LC,type:MC,main:NC,exports:jC,scripts:RC,keywords:_C,author:OC,license:IC,repository:wC,homepage:TC,bugs:PC,publishConfig:SC,dependencies:kC,devDependencies:bC,engines:vC,bin:xC,files:uC}});import{join as nD,dirname as W6,sep as fC}from"path";import{homedir as X7}from"os";import{existsSync as D8,statSync as gC}from"fs";import{execSync as v4}from"child_process";import{fileURLToPath as $C}from"url";class CD{static instance=null;_dataDirectory=null;_packageRoot=null;_claudeConfigDirectory=null;static getInstance(){if(!CD.instance)CD.instance=new CD;return CD.instance}getDataDirectory(){if(this._dataDirectory)return this._dataDirectory;return this._dataDirectory=process.env.CLAUDE_MEM_DATA_DIR||nD(X7(),".claude-mem"),this._dataDirectory}getArchivesDirectory(){return nD(this.getDataDirectory(),"archives")}getHooksDirectory(){return nD(this.getDataDirectory(),"hooks")}getLogsDirectory(){return nD(this.getDataDirectory(),"logs")}getIndexDirectory(){return this.getDataDirectory()}getIndexPath(){return nD(this.getIndexDirectory(),"claude-mem-index.jsonl")}getTrashDirectory(){return nD(this.getDataDirectory(),"trash")}getBackupsDirectory(){return nD(this.getDataDirectory(),"backups")}getChromaDirectory(){return nD(this.getDataDirectory(),"chroma")}getProjectArchiveDirectory(D){return nD(this.getArchivesDirectory(),D)}getUserSettingsPath(){return nD(this.getDataDirectory(),"settings.json")}getClaudeConfigDirectory(){if(this._claudeConfigDirectory)return this._claudeConfigDirectory;return this._claudeConfigDirectory=process.env.CLAUDE_CONFIG_DIR||nD(X7(),".claude"),this._claudeConfigDirectory}getClaudeSettingsPath(){return nD(this.getClaudeConfigDirectory(),"settings.json")}getClaudeCommandsDirectory(){return nD(this.getClaudeConfigDirectory(),"commands")}getClaudeMdPath(){return nD(this.getClaudeConfigDirectory(),"CLAUDE.md")}getMcpConfigPath(){return nD(X7(),".claude.json")}getProjectMcpConfigPath(){return nD(process.cwd(),".mcp.json")}getPackageRoot(){if(this._packageRoot)return this._packageRoot;try{let Q=gD.resolve("/Users/alexnewman/Scripts/claude-mem-source__ui/package.json");return this._packageRoot=W6(Q),this._packageRoot}catch{}let D=$C(import.meta.url),F=W6(D);for(let Q=0;Q<10;Q++){let B=nD(F,"package.json");if(D8(B)){if(gD(B).name==="claude-mem")return this._packageRoot=F,this._packageRoot}let Y=W6(F);if(Y===F)break;F=Y}try{let Q=v4("npm list -g claude-mem --json 2>/dev/null || npm list claude-mem --json 2>/dev/null",{encoding:"utf8"}),B=JSON.parse(Q);if(B.dependencies?.["claude-mem"]?.resolved)return this._packageRoot=W6(B.dependencies["claude-mem"].resolved),this._packageRoot}catch{}throw new Error("Cannot locate claude-mem package root. Ensure claude-mem is properly installed.")}findPackageHookTemplatesDirectory(){let D=this.getPackageRoot(),F=nD(D,"hook-templates"),Q=["session-start.js","stop.js","user-prompt-submit.js","post-tool-use.js"];for(let B of Q)if(!D8(nD(F,B)))throw new Error(`Package hook-templates directory missing required template file: ${B}`);return F}findPackageCommandsDirectory(){let D=this.getPackageRoot(),F=nD(D,"commands"),Q=["save.md"];for(let B of Q)if(!D8(nD(F,B)))throw new Error(`Package commands directory missing required file: ${B}`);return F}ensureDirectory(D){if(!D8(D))gD("fs").mkdirSync(D,{recursive:!0})}ensureDirectories(D){D.forEach((F)=>this.ensureDirectory(F))}ensureAllDataDirectories(){this.ensureDirectories([this.getDataDirectory(),this.getArchivesDirectory(),this.getHooksDirectory(),this.getLogsDirectory(),this.getTrashDirectory(),this.getBackupsDirectory(),this.getChromaDirectory()])}ensureAllClaudeDirectories(){this.ensureDirectories([this.getClaudeConfigDirectory(),this.getClaudeCommandsDirectory()])}static extractProjectName(D){let F=D.split(fC),Q=["src","lib","app","project","workspace"];for(let B=F.length-1;B>=0;B--)if(Q.includes(F[B])&&B>0)return F[B-1];if(F.length>1)return F[F.length-2];return"unknown-project"}static getCurrentProjectName(){try{let D=v4("git rev-parse --show-toplevel",{cwd:process.cwd(),encoding:"utf8",stdio:["pipe","pipe","ignore"]}).trim();return gD("path").basename(D)}catch{return gD("path").basename(process.cwd())}}static createBackupFilename(D){let F=new Date().toISOString().replace(/[:.]/g,"-").replace("T","_").slice(0,19);return`${D}.backup.${F}`}static isPathAccessible(D){return D8(D)&&gC(D).isDirectory()}}var E0=()=>{};var GF=VD((CW)=>{CW.getBooleanOption=(D,F)=>{let Q=!1;if(F in D&&typeof(Q=D[F])!=="boolean")throw new TypeError(`Expected the "${F}" option to be a boolean`);return Q};CW.cppdb=Symbol();CW.inspect=Symbol.for("nodejs.util.inspect.custom")});var q7=VD((VZ,m4)=>{var G7={value:"SqliteError",writable:!0,enumerable:!1,configurable:!0};function cF(D,F){if(new.target!==cF)return new cF(D,F);if(typeof F!=="string")throw new TypeError("Expected second argument to be a string");Error.call(this,D),G7.value=""+D,Object.defineProperty(this,"message",G7),Error.captureStackTrace(this,cF),this.code=F}Object.setPrototypeOf(cF,Error);Object.setPrototypeOf(cF.prototype,Error.prototype);Object.defineProperty(cF.prototype,"name",G7);m4.exports=cF});var d4=VD((LZ,l4)=>{var H6=gD("path").sep||"/";l4.exports=qW;function qW(D){if(typeof D!="string"||D.length<=7||D.substring(0,7)!="file://")throw new TypeError("must pass in a file:// URI to convert to a file path");var F=decodeURI(D.substring(7)),Q=F.indexOf("/"),B=F.substring(0,Q),Y=F.substring(Q+1);if(B=="localhost")B="";if(B)B=H6+H6+B;if(Y=Y.replace(/^(.+)\|/,"$1:"),H6=="\\")Y=Y.replace(/\//g,"\\");if(/^.+\:/.test(Y));else Y=H6+Y;return B+Y}});var i4=VD((E6,n4)=>{var __filename="/Users/alexnewman/Scripts/claude-mem-source__ui/node_modules/bindings/bindings.js",H7=gD("fs"),U6=gD("path"),HW=d4(),K6=U6.join,KW=U6.dirname,c4=H7.accessSync&&function(D){try{H7.accessSync(D)}catch(F){return!1}return!0}||H7.existsSync||U6.existsSync,p4={arrow:process.env.NODE_BINDINGS_ARROW||" → ",compiled:process.env.NODE_BINDINGS_COMPILED_DIR||"compiled",platform:process.platform,arch:process.arch,nodePreGyp:"node-v"+process.versions.modules+"-"+process.platform+"-"+process.arch,version:process.versions.node,bindings:"bindings.node",try:[["module_root","build","bindings"],["module_root","build","Debug","bindings"],["module_root","build","Release","bindings"],["module_root","out","Debug","bindings"],["module_root","Debug","bindings"],["module_root","out","Release","bindings"],["module_root","Release","bindings"],["module_root","build","default","bindings"],["module_root","compiled","version","platform","arch","bindings"],["module_root","addon-build","release","install-root","bindings"],["module_root","addon-build","debug","install-root","bindings"],["module_root","addon-build","default","install-root","bindings"],["module_root","lib","binding","nodePreGyp","bindings"]]};function UW(D){if(typeof D=="string")D={bindings:D};else if(!D)D={};if(Object.keys(p4).map(function(z){if(!(z in D))D[z]=p4[z]}),!D.module_root)D.module_root=E6.getRoot(E6.getFileName());if(U6.extname(D.bindings)!=".node")D.bindings+=".node";var F=typeof __webpack_require__==="function"?__non_webpack_require__:gD,Q=[],B=0,Y=D.try.length,J,X,C;for(;B<Y;B++){J=K6.apply(null,D.try[B].map(function(z){return D[z]||z})),Q.push(J);try{if(X=D.path?F.resolve(J):F(J),!D.path)X.path=J;return X}catch(z){if(z.code!=="MODULE_NOT_FOUND"&&z.code!=="QUALIFIED_PATH_RESOLUTION_FAILED"&&!/not find/i.test(z.message))throw z}}throw C=new Error(`Could not locate the bindings file. Tried:
29
- `+Q.map(function(z){return D.arrow+z}).join(`
30
- `)),C.tries=Q,C}n4.exports=E6=UW;E6.getFileName=function D(F){var{prepareStackTrace:Q,stackTraceLimit:B}=Error,Y={},J;Error.stackTraceLimit=10,Error.prepareStackTrace=function(C,z){for(var W=0,G=z.length;W<G;W++)if(J=z[W].getFileName(),J!==__filename)if(F){if(J!==F)return}else return},Error.captureStackTrace(Y),Y.stack,Error.prepareStackTrace=Q,Error.stackTraceLimit=B;var X="file://";if(J.indexOf(X)===0)J=HW(J);return J};E6.getRoot=function D(F){var Q=KW(F),B;while(!0){if(Q===".")Q=process.cwd();if(c4(K6(Q,"package.json"))||c4(K6(Q,"node_modules")))return Q;if(B===Q)throw new Error('Could not find module root given file: "'+F+'". Do you have a `package.json` file? ');B=Q,Q=K6(Q,"..")}}});var a4=VD((EW)=>{var{cppdb:s0}=GF();EW.prepare=function D(F){return this[s0].prepare(F,this,!1)};EW.exec=function D(F){return this[s0].exec(F),this};EW.close=function D(){return this[s0].close(),this};EW.loadExtension=function D(...F){return this[s0].loadExtension(...F),this};EW.defaultSafeIntegers=function D(...F){return this[s0].defaultSafeIntegers(...F),this};EW.unsafeMode=function D(...F){return this[s0].unsafeMode(...F),this};EW.getters={name:{get:function D(){return this[s0].name},enumerable:!0},open:{get:function D(){return this[s0].open},enumerable:!0},inTransaction:{get:function D(){return this[s0].inTransaction},enumerable:!0},readonly:{get:function D(){return this[s0].readonly},enumerable:!0},memory:{get:function D(){return this[s0].memory},enumerable:!0}}});var s4=VD((_Z,o4)=>{var{cppdb:RW}=GF(),r4=new WeakMap;o4.exports=function D(F){if(typeof F!=="function")throw new TypeError("Expected first argument to be a function");let Q=this[RW],B=_W(Q,this),{apply:Y}=Function.prototype,J={default:{value:A6(Y,F,Q,B.default)},deferred:{value:A6(Y,F,Q,B.deferred)},immediate:{value:A6(Y,F,Q,B.immediate)},exclusive:{value:A6(Y,F,Q,B.exclusive)},database:{value:this,enumerable:!0}};return Object.defineProperties(J.default.value,J),Object.defineProperties(J.deferred.value,J),Object.defineProperties(J.immediate.value,J),Object.defineProperties(J.exclusive.value,J),J.default.value};var _W=(D,F)=>{let Q=r4.get(D);if(!Q){let B={commit:D.prepare("COMMIT",F,!1),rollback:D.prepare("ROLLBACK",F,!1),savepoint:D.prepare("SAVEPOINT `\t_bs3. `",F,!1),release:D.prepare("RELEASE `\t_bs3. `",F,!1),rollbackTo:D.prepare("ROLLBACK TO `\t_bs3. `",F,!1)};r4.set(D,Q={default:Object.assign({begin:D.prepare("BEGIN",F,!1)},B),deferred:Object.assign({begin:D.prepare("BEGIN DEFERRED",F,!1)},B),immediate:Object.assign({begin:D.prepare("BEGIN IMMEDIATE",F,!1)},B),exclusive:Object.assign({begin:D.prepare("BEGIN EXCLUSIVE",F,!1)},B)})}return Q},A6=(D,F,Q,{begin:B,commit:Y,rollback:J,savepoint:X,release:C,rollbackTo:z})=>function W(){let G,q,A;if(Q.inTransaction)G=X,q=C,A=z;else G=B,q=Y,A=J;G.run();try{let U=D.call(F,this,arguments);if(U&&typeof U.then==="function")throw new TypeError("Transaction function cannot return a promise");return q.run(),U}catch(U){if(Q.inTransaction){if(A.run(),A!==J)q.run()}throw U}}});var e4=VD((OZ,t4)=>{var{getBooleanOption:OW,cppdb:IW}=GF();t4.exports=function D(F,Q){if(Q==null)Q={};if(typeof F!=="string")throw new TypeError("Expected first argument to be a string");if(typeof Q!=="object")throw new TypeError("Expected second argument to be an options object");let B=OW(Q,"simple"),Y=this[IW].prepare(`PRAGMA ${F}`,this,!0);return B?Y.pluck().get():Y.all()}});var B5=VD((IZ,F5)=>{var wW=gD("fs"),TW=gD("path"),{promisify:PW}=gD("util"),{cppdb:SW}=GF(),D5=PW(wW.access);F5.exports=async function D(F,Q){if(Q==null)Q={};if(typeof F!=="string")throw new TypeError("Expected first argument to be a string");if(typeof Q!=="object")throw new TypeError("Expected second argument to be an options object");F=F.trim();let B="attached"in Q?Q.attached:"main",Y="progress"in Q?Q.progress:null;if(!F)throw new TypeError("Backup filename cannot be an empty string");if(F===":memory:")throw new TypeError('Invalid backup filename ":memory:"');if(typeof B!=="string")throw new TypeError('Expected the "attached" option to be a string');if(!B)throw new TypeError('The "attached" option cannot be an empty string');if(Y!=null&&typeof Y!=="function")throw new TypeError('Expected the "progress" option to be a function');await D5(TW.dirname(F)).catch(()=>{throw new TypeError("Cannot save backup because the directory does not exist")});let J=await D5(F).then(()=>!1,()=>!0);return kW(this[SW].backup(this,B,F,J),Y||null)};var kW=(D,F)=>{let Q=0,B=!0;return new Promise((Y,J)=>{setImmediate(function X(){try{let C=D.transfer(Q);if(!C.remainingPages){D.close(),Y(C);return}if(B)B=!1,Q=100;if(F){let z=F(C);if(z!==void 0)if(typeof z==="number"&&z===z)Q=Math.max(0,Math.min(2147483647,Math.round(z)));else throw new TypeError("Expected progress callback to return a number or undefined")}setImmediate(X)}catch(C){D.close(),J(C)}})})}});var X5=VD((wZ,Q5)=>{var{cppdb:bW}=GF();Q5.exports=function D(F){if(F==null)F={};if(typeof F!=="object")throw new TypeError("Expected first argument to be an options object");let Q="attached"in F?F.attached:"main";if(typeof Q!=="string")throw new TypeError('Expected the "attached" option to be a string');if(!Q)throw new TypeError('The "attached" option cannot be an empty string');return this[bW].serialize(Q)}});var J5=VD((TZ,Y5)=>{var{getBooleanOption:Z6,cppdb:vW}=GF();Y5.exports=function D(F,Q,B){if(Q==null)Q={};if(typeof Q==="function")B=Q,Q={};if(typeof F!=="string")throw new TypeError("Expected first argument to be a string");if(typeof B!=="function")throw new TypeError("Expected last argument to be a function");if(typeof Q!=="object")throw new TypeError("Expected second argument to be an options object");if(!F)throw new TypeError("User-defined function name cannot be an empty string");let Y="safeIntegers"in Q?+Z6(Q,"safeIntegers"):2,J=Z6(Q,"deterministic"),X=Z6(Q,"directOnly"),C=Z6(Q,"varargs"),z=-1;if(!C){if(z=B.length,!Number.isInteger(z)||z<0)throw new TypeError("Expected function.length to be a positive integer");if(z>100)throw new RangeError("User-defined functions cannot have more than 100 arguments")}return this[vW].function(B,F,z,Y,J,X),this}});var z5=VD((PZ,W5)=>{var{getBooleanOption:V6,cppdb:xW}=GF();W5.exports=function D(F,Q){if(typeof F!=="string")throw new TypeError("Expected first argument to be a string");if(typeof Q!=="object"||Q===null)throw new TypeError("Expected second argument to be an options object");if(!F)throw new TypeError("User-defined function name cannot be an empty string");let B="start"in Q?Q.start:null,Y=K7(Q,"step",!0),J=K7(Q,"inverse",!1),X=K7(Q,"result",!1),C="safeIntegers"in Q?+V6(Q,"safeIntegers"):2,z=V6(Q,"deterministic"),W=V6(Q,"directOnly"),G=V6(Q,"varargs"),q=-1;if(!G){if(q=Math.max(C5(Y),J?C5(J):0),q>0)q-=1;if(q>100)throw new RangeError("User-defined functions cannot have more than 100 arguments")}return this[xW].aggregate(B,Y,J,X,F,q,C,z,W),this};var K7=(D,F,Q)=>{let B=F in D?D[F]:null;if(typeof B==="function")return B;if(B!=null)throw new TypeError(`Expected the "${F}" option to be a function`);if(Q)throw new TypeError(`Missing required option "${F}"`);return null},C5=({length:D})=>{if(Number.isInteger(D)&&D>=0)return D;throw new TypeError("Expected function.length to be a positive integer")}});var K5=VD((SZ,H5)=>{var{cppdb:uW}=GF();H5.exports=function D(F,Q){if(typeof F!=="string")throw new TypeError("Expected first argument to be a string");if(!F)throw new TypeError("Virtual table module name cannot be an empty string");let B=!1;if(typeof Q==="object"&&Q!==null)B=!0,Q=dW(q5(Q,"used",F));else{if(typeof Q!=="function")throw new TypeError("Expected second argument to be a function or a table definition object");Q=yW(Q)}return this[uW].table(Q,F,B),this};function yW(D){return function F(Q,B,Y,...J){let X={module:Q,database:B,table:Y},C=mW.call(D,X,J);if(typeof C!=="object"||C===null)throw new TypeError(`Virtual table module "${Q}" did not return a table definition object`);return q5(C,"returned",Q)}}function q5(D,F,Q){if(!X8.call(D,"rows"))throw new TypeError(`Virtual table module "${Q}" ${F} a table definition without a "rows" property`);if(!X8.call(D,"columns"))throw new TypeError(`Virtual table module "${Q}" ${F} a table definition without a "columns" property`);let B=D.rows;if(typeof B!=="function"||Object.getPrototypeOf(B)!==lW)throw new TypeError(`Virtual table module "${Q}" ${F} a table definition with an invalid "rows" property (should be a generator function)`);let Y=D.columns;if(!Array.isArray(Y)||!(Y=[...Y]).every((W)=>typeof W==="string"))throw new TypeError(`Virtual table module "${Q}" ${F} a table definition with an invalid "columns" property (should be an array of strings)`);if(Y.length!==new Set(Y).size)throw new TypeError(`Virtual table module "${Q}" ${F} a table definition with duplicate column names`);if(!Y.length)throw new RangeError(`Virtual table module "${Q}" ${F} a table definition with zero columns`);let J;if(X8.call(D,"parameters")){if(J=D.parameters,!Array.isArray(J)||!(J=[...J]).every((W)=>typeof W==="string"))throw new TypeError(`Virtual table module "${Q}" ${F} a table definition with an invalid "parameters" property (should be an array of strings)`)}else J=hW(B);if(J.length!==new Set(J).size)throw new TypeError(`Virtual table module "${Q}" ${F} a table definition with duplicate parameter names`);if(J.length>32)throw new RangeError(`Virtual table module "${Q}" ${F} a table definition with more than the maximum number of 32 parameters`);for(let W of J)if(Y.includes(W))throw new TypeError(`Virtual table module "${Q}" ${F} a table definition with column "${W}" which was ambiguously defined as both a column and parameter`);let X=2;if(X8.call(D,"safeIntegers")){let W=D.safeIntegers;if(typeof W!=="boolean")throw new TypeError(`Virtual table module "${Q}" ${F} a table definition with an invalid "safeIntegers" property (should be a boolean)`);X=+W}let C=!1;if(X8.call(D,"directOnly")){if(C=D.directOnly,typeof C!=="boolean")throw new TypeError(`Virtual table module "${Q}" ${F} a table definition with an invalid "directOnly" property (should be a boolean)`)}return[`CREATE TABLE x(${[...J.map(G5).map((W)=>`${W} HIDDEN`),...Y.map(G5)].join(", ")});`,fW(B,new Map(Y.map((W,G)=>[W,J.length+G])),Q),J,X,C]}function fW(D,F,Q){return function*B(...Y){let J=Y.map((X)=>Buffer.isBuffer(X)?Buffer.from(X):X);for(let X=0;X<F.size;++X)J.push(null);for(let X of D(...Y))if(Array.isArray(X))gW(X,J,F.size,Q),yield J;else if(typeof X==="object"&&X!==null)$W(X,J,F,Q),yield J;else throw new TypeError(`Virtual table module "${Q}" yielded something that isn't a valid row object`)}}function gW(D,F,Q,B){if(D.length!==Q)throw new TypeError(`Virtual table module "${B}" yielded a row with an incorrect number of columns`);let Y=F.length-Q;for(let J=0;J<Q;++J)F[J+Y]=D[J]}function $W(D,F,Q,B){let Y=0;for(let J of Object.keys(D)){let X=Q.get(J);if(X===void 0)throw new TypeError(`Virtual table module "${B}" yielded a row with an undeclared column "${J}"`);F[X]=D[J],Y+=1}if(Y!==Q.size)throw new TypeError(`Virtual table module "${B}" yielded a row with missing columns`)}function hW({length:D}){if(!Number.isInteger(D)||D<0)throw new TypeError("Expected function.length to be a positive integer");let F=[];for(let Q=0;Q<D;++Q)F.push(`$${Q+1}`);return F}var{hasOwnProperty:X8}=Object.prototype,{apply:mW}=Function.prototype,lW=Object.getPrototypeOf(function*(){}),G5=(D)=>`"${D.replace(/"/g,'""')}"`,dW=(D)=>()=>D});var E5=VD((kZ,U5)=>{var cW=function D(){};U5.exports=function D(F,Q){return Object.assign(new cW,this)}});var L5=VD((bZ,V5)=>{var pW=gD("fs"),A5=gD("path"),L6=GF(),nW=q7(),Z5;function W0(D,F){if(new.target==null)return new W0(D,F);let Q;if(Buffer.isBuffer(D))Q=D,D=":memory:";if(D==null)D="";if(F==null)F={};if(typeof D!=="string")throw new TypeError("Expected first argument to be a string");if(typeof F!=="object")throw new TypeError("Expected second argument to be an options object");if("readOnly"in F)throw new TypeError('Misspelled option "readOnly" should be "readonly"');if("memory"in F)throw new TypeError('Option "memory" was removed in v7.0.0 (use ":memory:" filename instead)');let B=D.trim(),Y=B===""||B===":memory:",J=L6.getBooleanOption(F,"readonly"),X=L6.getBooleanOption(F,"fileMustExist"),C="timeout"in F?F.timeout:5000,z="verbose"in F?F.verbose:null,W="nativeBinding"in F?F.nativeBinding:null;if(J&&Y&&!Q)throw new TypeError("In-memory/temporary databases cannot be readonly");if(!Number.isInteger(C)||C<0)throw new TypeError('Expected the "timeout" option to be a positive integer');if(C>2147483647)throw new RangeError('Option "timeout" cannot be greater than 2147483647');if(z!=null&&typeof z!=="function")throw new TypeError('Expected the "verbose" option to be a function');if(W!=null&&typeof W!=="string"&&typeof W!=="object")throw new TypeError('Expected the "nativeBinding" option to be a string or addon object');let G;if(W==null)G=Z5||(Z5=i4()("better_sqlite3.node"));else if(typeof W==="string")G=(typeof __non_webpack_require__==="function"?__non_webpack_require__:gD)(A5.resolve(W).replace(/(\.node)?$/,".node"));else G=W;if(!G.isInitialized)G.setErrorConstructor(nW),G.isInitialized=!0;if(!Y&&!pW.existsSync(A5.dirname(B)))throw new TypeError("Cannot open database because the directory does not exist");Object.defineProperties(this,{[L6.cppdb]:{value:new G.Database(B,D,Y,J,X,C,z||null,Q||null)},...pF.getters})}var pF=a4();W0.prototype.prepare=pF.prepare;W0.prototype.transaction=s4();W0.prototype.pragma=e4();W0.prototype.backup=B5();W0.prototype.serialize=X5();W0.prototype.function=J5();W0.prototype.aggregate=z5();W0.prototype.table=K5();W0.prototype.loadExtension=pF.loadExtension;W0.prototype.exec=pF.exec;W0.prototype.close=pF.close;W0.prototype.defaultSafeIntegers=pF.defaultSafeIntegers;W0.prototype.unsafeMode=pF.unsafeMode;W0.prototype[L6.inspect]=E5();V5.exports=W0});var M5=VD((xZ,U7)=>{U7.exports=L5();U7.exports.SqliteError=q7()});var N5={};MF(N5,{initializeDatabase:()=>A7,getDatabase:()=>A0,DatabaseManager:()=>S0,Database:()=>E7.default});import iW from"path";import aW from"fs";class S0{static instance;db=null;migrations=[];static getInstance(){if(!S0.instance)S0.instance=new S0;return S0.instance}registerMigration(D){this.migrations.push(D),this.migrations.sort((F,Q)=>F.version-Q.version)}async initialize(){if(this.db)return this.db;let D=CD.getInstance().getDataDirectory();aW.mkdirSync(D,{recursive:!0});let F=iW.join(D,"claude-mem.db");return this.db=new E7.default(F),this.db.pragma("journal_mode = WAL"),this.db.pragma("synchronous = NORMAL"),this.db.pragma("foreign_keys = ON"),this.db.pragma("temp_store = memory"),this.db.pragma("mmap_size = 268435456"),this.db.pragma("cache_size = 10000"),this.initializeSchemaVersions(),await this.runMigrations(),M6=this.db,this.db}getConnection(){if(!this.db)throw new Error("Database not initialized. Call initialize() first.");return this.db}withTransaction(D){let F=this.getConnection();return F.transaction(D)(F)}close(){if(this.db)this.db.close(),this.db=null,M6=null}initializeSchemaVersions(){if(!this.db)return;this.db.exec(`
27
+ `)}),this}_outputHelpIfRequested(D){let F=this._getHelpOption();if(F&&D.find((B)=>F.is(B)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function m9(D){return D.map((F)=>{if(!F.startsWith("--inspect"))return F;let Q,B="127.0.0.1",Y="9229",J;if((J=F.match(/^(--inspect(-brk)?)$/))!==null)Q=J[1];else if((J=F.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(Q=J[1],/^\d+$/.test(J[3]))Y=J[3];else B=J[3];else if((J=F.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)Q=J[1],B=J[3],Y=J[4];if(Q&&Y!=="0")return`${Q}=${B}:${parseInt(Y)+1}`;return F})}function q1(){if(OD.env.NO_COLOR||OD.env.FORCE_COLOR==="0"||OD.env.FORCE_COLOR==="false")return!1;if(OD.env.FORCE_COLOR||OD.env.CLICOLOR_FORCE!==void 0)return!0;return}DY.Command=H1;DY.useColor=q1});var n9=VD((YY)=>{var{Argument:d9}=l8(),{Command:K1}=l9(),{CommanderError:QY,InvalidArgumentError:c9}=n2(),{Help:XY}=C1(),{Option:p9}=W1();YY.program=new K1;YY.createCommand=(D)=>new K1(D);YY.createOption=(D,F)=>new p9(D,F);YY.createArgument=(D,F)=>new d9(D,F);YY.Command=K1;YY.Option=p9;YY.Argument=d9;YY.Help=XY;YY.CommanderError=QY;YY.InvalidArgumentError=c9;YY.InvalidOptionArgumentError=c9});var E1=VD((ZE,Q3)=>{var U1={to(D,F){if(!F)return`\x1B[${D+1}G`;return`\x1B[${F+1};${D+1}H`},move(D,F){let Q="";if(D<0)Q+=`\x1B[${-D}D`;else if(D>0)Q+=`\x1B[${D}C`;if(F<0)Q+=`\x1B[${-F}A`;else if(F>0)Q+=`\x1B[${F}B`;return Q},up:(D=1)=>`\x1B[${D}A`,down:(D=1)=>`\x1B[${D}B`,forward:(D=1)=>`\x1B[${D}C`,backward:(D=1)=>`\x1B[${D}D`,nextLine:(D=1)=>"\x1B[E".repeat(D),prevLine:(D=1)=>"\x1B[F".repeat(D),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},jY={up:(D=1)=>"\x1B[S".repeat(D),down:(D=1)=>"\x1B[T".repeat(D)},RY={screen:"\x1B[2J",up:(D=1)=>"\x1B[1J".repeat(D),down:(D=1)=>"\x1B[J".repeat(D),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines(D){let F="";for(let Q=0;Q<D;Q++)F+=this.line+(Q<D-1?U1.up():"");if(D)F+=U1.left;return F}};Q3.exports={cursor:U1,scroll:jY,erase:RY,beep:"\x07"}});var Z1=VD((VE,A1)=>{var p8=process||{},X3=p8.argv||[],c8=p8.env||{},_Y=!(!!c8.NO_COLOR||X3.includes("--no-color"))&&(!!c8.FORCE_COLOR||X3.includes("--color")||p8.platform==="win32"||(p8.stdout||{}).isTTY&&c8.TERM!=="dumb"||!!c8.CI),OY=(D,F,Q=D)=>(B)=>{let Y=""+B,J=Y.indexOf(F,D.length);return~J?D+IY(Y,F,Q,J)+F:D+Y+F},IY=(D,F,Q,B)=>{let Y="",J=0;do Y+=D.substring(J,B)+Q,J=B+F.length,B=D.indexOf(F,J);while(~B);return Y+D.substring(J)},Y3=(D=_Y)=>{let F=D?OY:()=>String;return{isColorSupported:D,reset:F("\x1B[0m","\x1B[0m"),bold:F("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:F("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:F("\x1B[3m","\x1B[23m"),underline:F("\x1B[4m","\x1B[24m"),inverse:F("\x1B[7m","\x1B[27m"),hidden:F("\x1B[8m","\x1B[28m"),strikethrough:F("\x1B[9m","\x1B[29m"),black:F("\x1B[30m","\x1B[39m"),red:F("\x1B[31m","\x1B[39m"),green:F("\x1B[32m","\x1B[39m"),yellow:F("\x1B[33m","\x1B[39m"),blue:F("\x1B[34m","\x1B[39m"),magenta:F("\x1B[35m","\x1B[39m"),cyan:F("\x1B[36m","\x1B[39m"),white:F("\x1B[37m","\x1B[39m"),gray:F("\x1B[90m","\x1B[39m"),bgBlack:F("\x1B[40m","\x1B[49m"),bgRed:F("\x1B[41m","\x1B[49m"),bgGreen:F("\x1B[42m","\x1B[49m"),bgYellow:F("\x1B[43m","\x1B[49m"),bgBlue:F("\x1B[44m","\x1B[49m"),bgMagenta:F("\x1B[45m","\x1B[49m"),bgCyan:F("\x1B[46m","\x1B[49m"),bgWhite:F("\x1B[47m","\x1B[49m"),blackBright:F("\x1B[90m","\x1B[39m"),redBright:F("\x1B[91m","\x1B[39m"),greenBright:F("\x1B[92m","\x1B[39m"),yellowBright:F("\x1B[93m","\x1B[39m"),blueBright:F("\x1B[94m","\x1B[39m"),magentaBright:F("\x1B[95m","\x1B[39m"),cyanBright:F("\x1B[96m","\x1B[39m"),whiteBright:F("\x1B[97m","\x1B[39m"),bgBlackBright:F("\x1B[100m","\x1B[49m"),bgRedBright:F("\x1B[101m","\x1B[49m"),bgGreenBright:F("\x1B[102m","\x1B[49m"),bgYellowBright:F("\x1B[103m","\x1B[49m"),bgBlueBright:F("\x1B[104m","\x1B[49m"),bgMagentaBright:F("\x1B[105m","\x1B[49m"),bgCyanBright:F("\x1B[106m","\x1B[49m"),bgWhiteBright:F("\x1B[107m","\x1B[49m")}};A1.exports=Y3();A1.exports.createColors=Y3});var g3=VD((y1,f1)=>{(function(D,F){typeof y1==="object"&&typeof f1!=="undefined"?f1.exports=F():typeof define==="function"&&define.amd?define(F):(D=typeof globalThis!=="undefined"?globalThis:D||self,D.tinycolor=F())})(y1,function(){function D(N){return D=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(_){return typeof _}:function(_){return _&&typeof Symbol=="function"&&_.constructor===Symbol&&_!==Symbol.prototype?"symbol":typeof _},D(N)}var F=/^\s+/,Q=/\s+$/;function B(N,_){if(N=N?N:"",_=_||{},N instanceof B)return N;if(!(this instanceof B))return new B(N,_);var K=Y(N);if(this._originalInput=N,this._r=K.r,this._g=K.g,this._b=K.b,this._a=K.a,this._roundA=Math.round(100*this._a)/100,this._format=_.format||K.format,this._gradientType=_.gradientType,this._r<1)this._r=Math.round(this._r);if(this._g<1)this._g=Math.round(this._g);if(this._b<1)this._b=Math.round(this._b);this._ok=K.ok}B.prototype={isDark:function N(){return this.getBrightness()<128},isLight:function N(){return!this.isDark()},isValid:function N(){return this._ok},getOriginalInput:function N(){return this._originalInput},getFormat:function N(){return this._format},getAlpha:function N(){return this._a},getBrightness:function N(){var _=this.toRgb();return(_.r*299+_.g*587+_.b*114)/1000},getLuminance:function N(){var _=this.toRgb(),K,T,h,c,l,p;if(K=_.r/255,T=_.g/255,h=_.b/255,K<=0.03928)c=K/12.92;else c=Math.pow((K+0.055)/1.055,2.4);if(T<=0.03928)l=T/12.92;else l=Math.pow((T+0.055)/1.055,2.4);if(h<=0.03928)p=h/12.92;else p=Math.pow((h+0.055)/1.055,2.4);return 0.2126*c+0.7152*l+0.0722*p},setAlpha:function N(_){return this._a=w(_),this._roundA=Math.round(100*this._a)/100,this},toHsv:function N(){var _=W(this._r,this._g,this._b);return{h:_.h*360,s:_.s,v:_.v,a:this._a}},toHsvString:function N(){var _=W(this._r,this._g,this._b),K=Math.round(_.h*360),T=Math.round(_.s*100),h=Math.round(_.v*100);return this._a==1?"hsv("+K+", "+T+"%, "+h+"%)":"hsva("+K+", "+T+"%, "+h+"%, "+this._roundA+")"},toHsl:function N(){var _=X(this._r,this._g,this._b);return{h:_.h*360,s:_.s,l:_.l,a:this._a}},toHslString:function N(){var _=X(this._r,this._g,this._b),K=Math.round(_.h*360),T=Math.round(_.s*100),h=Math.round(_.l*100);return this._a==1?"hsl("+K+", "+T+"%, "+h+"%)":"hsla("+K+", "+T+"%, "+h+"%, "+this._roundA+")"},toHex:function N(_){return G(this._r,this._g,this._b,_)},toHexString:function N(_){return"#"+this.toHex(_)},toHex8:function N(_){return q(this._r,this._g,this._b,this._a,_)},toHex8String:function N(_){return"#"+this.toHex8(_)},toRgb:function N(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function N(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function N(){return{r:Math.round(S(this._r,255)*100)+"%",g:Math.round(S(this._g,255)*100)+"%",b:Math.round(S(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function N(){return this._a==1?"rgb("+Math.round(S(this._r,255)*100)+"%, "+Math.round(S(this._g,255)*100)+"%, "+Math.round(S(this._b,255)*100)+"%)":"rgba("+Math.round(S(this._r,255)*100)+"%, "+Math.round(S(this._g,255)*100)+"%, "+Math.round(S(this._b,255)*100)+"%, "+this._roundA+")"},toName:function N(){if(this._a===0)return"transparent";if(this._a<1)return!1;return y[G(this._r,this._g,this._b,!0)]||!1},toFilter:function N(_){var K="#"+A(this._r,this._g,this._b,this._a),T=K,h=this._gradientType?"GradientType = 1, ":"";if(_){var c=B(_);T="#"+A(c._r,c._g,c._b,c._a)}return"progid:DXImageTransform.Microsoft.gradient("+h+"startColorstr="+K+",endColorstr="+T+")"},toString:function N(_){var K=!!_;_=_||this._format;var T=!1,h=this._a<1&&this._a>=0,c=!K&&h&&(_==="hex"||_==="hex6"||_==="hex3"||_==="hex4"||_==="hex8"||_==="name");if(c){if(_==="name"&&this._a===0)return this.toName();return this.toRgbString()}if(_==="rgb")T=this.toRgbString();if(_==="prgb")T=this.toPercentageRgbString();if(_==="hex"||_==="hex6")T=this.toHexString();if(_==="hex3")T=this.toHexString(!0);if(_==="hex4")T=this.toHex8String(!0);if(_==="hex8")T=this.toHex8String();if(_==="name")T=this.toName();if(_==="hsl")T=this.toHslString();if(_==="hsv")T=this.toHsvString();return T||this.toHexString()},clone:function N(){return B(this.toString())},_applyModification:function N(_,K){var T=_.apply(null,[this].concat([].slice.call(K)));return this._r=T._r,this._g=T._g,this._b=T._b,this.setAlpha(T._a),this},lighten:function N(){return this._applyModification(V,arguments)},brighten:function N(){return this._applyModification(j,arguments)},darken:function N(){return this._applyModification(L,arguments)},desaturate:function N(){return this._applyModification(U,arguments)},saturate:function N(){return this._applyModification(Z,arguments)},greyscale:function N(){return this._applyModification(H,arguments)},spin:function N(){return this._applyModification(R,arguments)},_applyCombination:function N(_,K){return _.apply(null,[this].concat([].slice.call(K)))},analogous:function N(){return this._applyCombination(u,arguments)},complement:function N(){return this._applyCombination(k,arguments)},monochromatic:function N(){return this._applyCombination(f,arguments)},splitcomplement:function N(){return this._applyCombination(I,arguments)},triad:function N(){return this._applyCombination(b,[3])},tetrad:function N(){return this._applyCombination(b,[4])}},B.fromRatio=function(N,_){if(D(N)=="object"){var K={};for(var T in N)if(N.hasOwnProperty(T))if(T==="a")K[T]=N[T];else K[T]=o(N[T]);N=K}return B(N,_)};function Y(N){var _={r:0,g:0,b:0},K=1,T=null,h=null,c=null,l=!1,p=!1;if(typeof N=="string")N=hD(N);if(D(N)=="object"){if(LD(N.r)&&LD(N.g)&&LD(N.b))_=J(N.r,N.g,N.b),l=!0,p=String(N.r).substr(-1)==="%"?"prgb":"rgb";else if(LD(N.h)&&LD(N.s)&&LD(N.v))T=o(N.s),h=o(N.v),_=z(N.h,T,h),l=!0,p="hsv";else if(LD(N.h)&&LD(N.s)&&LD(N.l))T=o(N.s),c=o(N.l),_=C(N.h,T,c),l=!0,p="hsl";if(N.hasOwnProperty("a"))K=N.a}return K=w(K),{ok:l,format:N.format||p,r:Math.min(255,Math.max(_.r,0)),g:Math.min(255,Math.max(_.g,0)),b:Math.min(255,Math.max(_.b,0)),a:K}}function J(N,_,K){return{r:S(N,255)*255,g:S(_,255)*255,b:S(K,255)*255}}function X(N,_,K){N=S(N,255),_=S(_,255),K=S(K,255);var T=Math.max(N,_,K),h=Math.min(N,_,K),c,l,p=(T+h)/2;if(T==h)c=l=0;else{var BD=T-h;switch(l=p>0.5?BD/(2-T-h):BD/(T+h),T){case N:c=(_-K)/BD+(_<K?6:0);break;case _:c=(K-N)/BD+2;break;case K:c=(N-_)/BD+4;break}c/=6}return{h:c,s:l,l:p}}function C(N,_,K){var T,h,c;N=S(N,360),_=S(_,100),K=S(K,100);function l(qD,JD,ZD){if(ZD<0)ZD+=1;if(ZD>1)ZD-=1;if(ZD<0.16666666666666666)return qD+(JD-qD)*6*ZD;if(ZD<0.5)return JD;if(ZD<0.6666666666666666)return qD+(JD-qD)*(0.6666666666666666-ZD)*6;return qD}if(_===0)T=h=c=K;else{var p=K<0.5?K*(1+_):K+_-K*_,BD=2*K-p;T=l(BD,p,N+0.3333333333333333),h=l(BD,p,N),c=l(BD,p,N-0.3333333333333333)}return{r:T*255,g:h*255,b:c*255}}function W(N,_,K){N=S(N,255),_=S(_,255),K=S(K,255);var T=Math.max(N,_,K),h=Math.min(N,_,K),c,l,p=T,BD=T-h;if(l=T===0?0:BD/T,T==h)c=0;else{switch(T){case N:c=(_-K)/BD+(_<K?6:0);break;case _:c=(K-N)/BD+2;break;case K:c=(N-_)/BD+4;break}c/=6}return{h:c,s:l,v:p}}function z(N,_,K){N=S(N,360)*6,_=S(_,100),K=S(K,100);var T=Math.floor(N),h=N-T,c=K*(1-_),l=K*(1-h*_),p=K*(1-(1-h)*_),BD=T%6,qD=[K,l,c,c,p,K][BD],JD=[p,K,K,l,c,c][BD],ZD=[c,c,p,K,K,l][BD];return{r:qD*255,g:JD*255,b:ZD*255}}function G(N,_,K,T){var h=[DD(Math.round(N).toString(16)),DD(Math.round(_).toString(16)),DD(Math.round(K).toString(16))];if(T&&h[0].charAt(0)==h[0].charAt(1)&&h[1].charAt(0)==h[1].charAt(1)&&h[2].charAt(0)==h[2].charAt(1))return h[0].charAt(0)+h[1].charAt(0)+h[2].charAt(0);return h.join("")}function q(N,_,K,T,h){var c=[DD(Math.round(N).toString(16)),DD(Math.round(_).toString(16)),DD(Math.round(K).toString(16)),DD(XD(T))];if(h&&c[0].charAt(0)==c[0].charAt(1)&&c[1].charAt(0)==c[1].charAt(1)&&c[2].charAt(0)==c[2].charAt(1)&&c[3].charAt(0)==c[3].charAt(1))return c[0].charAt(0)+c[1].charAt(0)+c[2].charAt(0)+c[3].charAt(0);return c.join("")}function A(N,_,K,T){var h=[DD(XD(T)),DD(Math.round(N).toString(16)),DD(Math.round(_).toString(16)),DD(Math.round(K).toString(16))];return h.join("")}B.equals=function(N,_){if(!N||!_)return!1;return B(N).toRgbString()==B(_).toRgbString()},B.random=function(){return B.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function U(N,_){_=_===0?0:_||10;var K=B(N).toHsl();return K.s-=_/100,K.s=g(K.s),B(K)}function Z(N,_){_=_===0?0:_||10;var K=B(N).toHsl();return K.s+=_/100,K.s=g(K.s),B(K)}function H(N){return B(N).desaturate(100)}function V(N,_){_=_===0?0:_||10;var K=B(N).toHsl();return K.l+=_/100,K.l=g(K.l),B(K)}function j(N,_){_=_===0?0:_||10;var K=B(N).toRgb();return K.r=Math.max(0,Math.min(255,K.r-Math.round(255*-(_/100)))),K.g=Math.max(0,Math.min(255,K.g-Math.round(255*-(_/100)))),K.b=Math.max(0,Math.min(255,K.b-Math.round(255*-(_/100)))),B(K)}function L(N,_){_=_===0?0:_||10;var K=B(N).toHsl();return K.l-=_/100,K.l=g(K.l),B(K)}function R(N,_){var K=B(N).toHsl(),T=(K.h+_)%360;return K.h=T<0?360+T:T,B(K)}function k(N){var _=B(N).toHsl();return _.h=(_.h+180)%360,B(_)}function b(N,_){if(isNaN(_)||_<=0)throw new Error("Argument to polyad must be a positive number");var K=B(N).toHsl(),T=[B(N)],h=360/_;for(var c=1;c<_;c++)T.push(B({h:(K.h+c*h)%360,s:K.s,l:K.l}));return T}function I(N){var _=B(N).toHsl(),K=_.h;return[B(N),B({h:(K+72)%360,s:_.s,l:_.l}),B({h:(K+216)%360,s:_.s,l:_.l})]}function u(N,_,K){_=_||6,K=K||30;var T=B(N).toHsl(),h=360/K,c=[B(N)];for(T.h=(T.h-(h*_>>1)+720)%360;--_;)T.h=(T.h+h)%360,c.push(B(T));return c}function f(N,_){_=_||6;var K=B(N).toHsv(),T=K.h,h=K.s,c=K.v,l=[],p=1/_;while(_--)l.push(B({h:T,s:h,v:c})),c=(c+p)%1;return l}B.mix=function(N,_,K){K=K===0?0:K||50;var T=B(N).toRgb(),h=B(_).toRgb(),c=K/100,l={r:(h.r-T.r)*c+T.r,g:(h.g-T.g)*c+T.g,b:(h.b-T.b)*c+T.b,a:(h.a-T.a)*c+T.a};return B(l)},B.readability=function(N,_){var K=B(N),T=B(_);return(Math.max(K.getLuminance(),T.getLuminance())+0.05)/(Math.min(K.getLuminance(),T.getLuminance())+0.05)},B.isReadable=function(N,_,K){var T=B.readability(N,_),h,c;switch(c=!1,h=cD(K),h.level+h.size){case"AAsmall":case"AAAlarge":c=T>=4.5;break;case"AAlarge":c=T>=3;break;case"AAAsmall":c=T>=7;break}return c},B.mostReadable=function(N,_,K){var T=null,h=0,c,l,p,BD;K=K||{},l=K.includeFallbackColors,p=K.level,BD=K.size;for(var qD=0;qD<_.length;qD++)if(c=B.readability(N,_[qD]),c>h)h=c,T=B(_[qD]);if(B.isReadable(N,T,{level:p,size:BD})||!l)return T;else return K.includeFallbackColors=!1,B.mostReadable(N,["#fff","#000"],K)};var O=B.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},y=B.hexNames=x(O);function x(N){var _={};for(var K in N)if(N.hasOwnProperty(K))_[N[K]]=K;return _}function w(N){if(N=parseFloat(N),isNaN(N)||N<0||N>1)N=1;return N}function S(N,_){if(n(N))N="100%";var K=a(N);if(N=Math.min(_,Math.max(0,parseFloat(N))),K)N=parseInt(N*_,10)/100;if(Math.abs(N-_)<0.000001)return 1;return N%_/parseFloat(_)}function g(N){return Math.min(1,Math.max(0,N))}function d(N){return parseInt(N,16)}function n(N){return typeof N=="string"&&N.indexOf(".")!=-1&&parseFloat(N)===1}function a(N){return typeof N==="string"&&N.indexOf("%")!=-1}function DD(N){return N.length==1?"0"+N:""+N}function o(N){if(N<=1)N=N*100+"%";return N}function XD(N){return Math.round(parseFloat(N)*255).toString(16)}function YD(N){return d(N)/255}var FD=function(){var N="[-\\+]?\\d+%?",_="[-\\+]?\\d*\\.\\d+%?",K="(?:"+_+")|(?:"+N+")",T="[\\s|\\(]+("+K+")[,|\\s]+("+K+")[,|\\s]+("+K+")\\s*\\)?",h="[\\s|\\(]+("+K+")[,|\\s]+("+K+")[,|\\s]+("+K+")[,|\\s]+("+K+")\\s*\\)?";return{CSS_UNIT:new RegExp(K),rgb:new RegExp("rgb"+T),rgba:new RegExp("rgba"+h),hsl:new RegExp("hsl"+T),hsla:new RegExp("hsla"+h),hsv:new RegExp("hsv"+T),hsva:new RegExp("hsva"+h),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function LD(N){return!!FD.CSS_UNIT.exec(N)}function hD(N){N=N.replace(F,"").replace(Q,"").toLowerCase();var _=!1;if(O[N])N=O[N],_=!0;else if(N=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var K;if(K=FD.rgb.exec(N))return{r:K[1],g:K[2],b:K[3]};if(K=FD.rgba.exec(N))return{r:K[1],g:K[2],b:K[3],a:K[4]};if(K=FD.hsl.exec(N))return{h:K[1],s:K[2],l:K[3]};if(K=FD.hsla.exec(N))return{h:K[1],s:K[2],l:K[3],a:K[4]};if(K=FD.hsv.exec(N))return{h:K[1],s:K[2],v:K[3]};if(K=FD.hsva.exec(N))return{h:K[1],s:K[2],v:K[3],a:K[4]};if(K=FD.hex8.exec(N))return{r:d(K[1]),g:d(K[2]),b:d(K[3]),a:YD(K[4]),format:_?"name":"hex8"};if(K=FD.hex6.exec(N))return{r:d(K[1]),g:d(K[2]),b:d(K[3]),format:_?"name":"hex"};if(K=FD.hex4.exec(N))return{r:d(K[1]+""+K[1]),g:d(K[2]+""+K[2]),b:d(K[3]+""+K[3]),a:YD(K[4]+""+K[4]),format:_?"name":"hex8"};if(K=FD.hex3.exec(N))return{r:d(K[1]+""+K[1]),g:d(K[2]+""+K[2]),b:d(K[3]+""+K[3]),format:_?"name":"hex"};return!1}function cD(N){var _,K;if(N=N||{level:"AA",size:"small"},_=(N.level||"AA").toUpperCase(),K=(N.size||"small").toLowerCase(),_!=="AA"&&_!=="AAA")_="AA";if(K!=="small"&&K!=="large")K="small";return{level:_,size:K}}return B})});var p3=VD((DA,c3)=>{var s2=g3(),l3={r:256,g:256,b:256,a:1},d3={h:360,s:1,v:1,a:1};function $1(D,F,Q){let B={};for(let Y in D)if(D.hasOwnProperty(Y))B[Y]=Q===0?0:(F[Y]-D[Y])/Q;return B}function h1(D,F,Q,B){let Y={};for(let J in F)if(F.hasOwnProperty(J))Y[J]=D[J]*Q+F[J],Y[J]=Y[J]<0?Y[J]+B[J]:B[J]!==1?Y[J]%B[J]:Y[J];return Y}function g1(D,F,Q){let B=D.color.toRgb(),Y=F.color.toRgb(),J=$1(B,Y,Q),X=[D.color];for(let C=1;C<Q;C++){let W=h1(J,B,C,l3);X.push(s2(W))}return X}function $3(D,F,Q,B){let Y=D.color.toHsv(),J=F.color.toHsv();if(Y.s===0||J.s===0)return g1(D,F,Q);let X;if(typeof B==="boolean")X=B;else{let G=Y.h<J.h&&J.h-Y.h<180||Y.h>J.h&&Y.h-J.h>180;X=B==="long"&&G||B==="short"&&!G}let C=$1(Y,J,Q),W=[D.color],z;if(Y.h<=J.h&&!X||Y.h>=J.h&&X)z=J.h-Y.h;else if(X)z=360-J.h+Y.h;else z=360-Y.h+J.h;C.h=Math.pow(-1,X?1:0)*Math.abs(z)/Q;for(let G=1;G<Q;G++){let q=h1(C,Y,G,d3);W.push(s2(q))}return W}function h3(D,F){let Q=D.length;if(F=parseInt(F,10),isNaN(F)||F<2)throw new Error("Invalid number of steps (< 2)");if(F<Q)throw new Error("Number of steps cannot be inferior to number of stops");let B=[];for(let J=1;J<Q;J++){let X=(F-1)*(D[J].pos-D[J-1].pos);B.push(Math.max(1,Math.round(X)))}let Y=1;for(let J=Q-1;J--;)Y+=B[J];while(Y!==F)if(Y<F){let J=Math.min.apply(null,B);B[B.indexOf(J)]++,Y++}else{let J=Math.max.apply(null,B);B[B.indexOf(J)]--,Y--}return B}function m3(D,F,Q,B){if(F<0||F>1)throw new Error("Position must be between 0 and 1");let Y,J;for(let W=0,z=D.length;W<z-1;W++)if(F>=D[W].pos&&F<D[W+1].pos){Y=D[W],J=D[W+1];break}if(!Y)Y=J=D[D.length-1];let X=$1(Y.color[Q](),J.color[Q](),(J.pos-Y.pos)*100),C=h1(X,Y.color[Q](),(F-Y.pos)*100,B);return s2(C)}class F6{constructor(D){if(D.length<2)throw new Error("Invalid number of stops (< 2)");let F=D[0].pos!==void 0,Q=D.length,B=-1,Y=!1;if(this.stops=D.map((J,X)=>{let C=J.pos!==void 0;if(F^C)throw new Error("Cannot mix positionned and not posionned color stops");if(C){let W=J.color!==void 0;if(!W&&(Y||X===0||X===Q-1))throw new Error("Cannot define two consecutive position-only stops");if(Y=!W,J={color:W?s2(J.color):null,colorLess:!W,pos:J.pos},J.pos<0||J.pos>1)throw new Error("Color stops positions must be between 0 and 1");else if(J.pos<B)throw new Error("Color stops positions are not ordered");B=J.pos}else J={color:s2(J.color!==void 0?J.color:J),pos:X/(Q-1)};return J}),this.stops[0].pos!==0)this.stops.unshift({color:this.stops[0].color,pos:0}),Q++;if(this.stops[Q-1].pos!==1)this.stops.push({color:this.stops[Q-1].color,pos:1})}reverse(){let D=[];return this.stops.forEach(function(F){D.push({color:F.color,pos:1-F.pos})}),new F6(D.reverse())}loop(){let D=[],F=[];return this.stops.forEach((Q)=>{D.push({color:Q.color,pos:Q.pos/2})}),this.stops.slice(0,-1).forEach((Q)=>{F.push({color:Q.color,pos:1-Q.pos/2})}),new F6(D.concat(F.reverse()))}rgb(D){let F=h3(this.stops,D),Q=[];this.stops.forEach((B,Y)=>{if(B.colorLess)B.color=g1(this.stops[Y-1],this.stops[Y+1],2)[1]});for(let B=0,Y=this.stops.length;B<Y-1;B++){let J=g1(this.stops[B],this.stops[B+1],F[B]);Q.splice(Q.length,0,...J)}return Q.push(this.stops[this.stops.length-1].color),Q}hsv(D,F){let Q=h3(this.stops,D),B=[];this.stops.forEach((Y,J)=>{if(Y.colorLess)Y.color=$3(this.stops[J-1],this.stops[J+1],2,F)[1]});for(let Y=0,J=this.stops.length;Y<J-1;Y++){let X=$3(this.stops[Y],this.stops[Y+1],Q[Y],F);B.splice(B.length,0,...X)}return B.push(this.stops[this.stops.length-1].color),B}css(D,F){D=D||"linear",F=F||(D==="linear"?"to right":"ellipse at center");let Q=D+"-gradient("+F;return this.stops.forEach(function(B){Q+=", "+(B.colorLess?"":B.color.toRgbString()+" ")+B.pos*100+"%"}),Q+=")",Q}rgbAt(D){return m3(this.stops,D,"toRgb",l3)}hsvAt(D){return m3(this.stops,D,"toHsv",d3)}}c3.exports=function(D){if(arguments.length===1){if(!Array.isArray(arguments[0]))throw new Error('"stops" is not an array');D=arguments[0]}else D=Array.prototype.slice.call(arguments);return new F6(D)}});var t3=VD((GA,s3)=>{s3.exports=()=>{return/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g}});var D4=VD((AA,gJ)=>{gJ.exports={single:{topLeft:"┌",top:"─",topRight:"┐",right:"│",bottomRight:"┘",bottom:"─",bottomLeft:"└",left:"│"},double:{topLeft:"╔",top:"═",topRight:"╗",right:"║",bottomRight:"╝",bottom:"═",bottomLeft:"╚",left:"║"},round:{topLeft:"╭",top:"─",topRight:"╮",right:"│",bottomRight:"╯",bottom:"─",bottomLeft:"╰",left:"│"},bold:{topLeft:"┏",top:"━",topRight:"┓",right:"┃",bottomRight:"┛",bottom:"━",bottomLeft:"┗",left:"┃"},singleDouble:{topLeft:"╓",top:"─",topRight:"╖",right:"║",bottomRight:"╜",bottom:"─",bottomLeft:"╙",left:"║"},doubleSingle:{topLeft:"╒",top:"═",topRight:"╕",right:"│",bottomRight:"╛",bottom:"═",bottomLeft:"╘",left:"│"},classic:{topLeft:"+",top:"-",topRight:"+",right:"|",bottomRight:"+",bottom:"-",bottomLeft:"+",left:"|"},arrow:{topLeft:"↘",top:"↓",topRight:"↙",right:"←",bottomRight:"↖",bottom:"↑",bottomLeft:"↗",left:"→"}}});var i1=VD((ZA,n1)=>{var F4=D4();n1.exports=F4;n1.exports.default=F4});var C4=VD((LA,J4)=>{J4.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 z4=VD((MA,W4)=>{var pJ=C4();W4.exports=(D)=>typeof D==="string"?D.replace(pJ(),""):D});var q4=VD((NA,o1)=>{var G4=(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};o1.exports=G4;o1.exports.default=G4});var K4=VD((jA,H4)=>{H4.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 E4=VD((RA,s1)=>{var nJ=z4(),iJ=q4(),aJ=K4(),U4=(D)=>{if(typeof D!=="string"||D.length===0)return 0;if(D=nJ(D),D.length===0)return 0;D=D.replace(aJ()," ");let F=0;for(let Q=0;Q<D.length;Q++){let B=D.codePointAt(Q);if(B<=31||B>=127&&B<=159)continue;if(B>=768&&B<=879)continue;if(B>65535)Q++;F+=iJ(B)?2:1}return F};s1.exports=U4;s1.exports.default=U4});var Z4=VD((_A,A4)=>{var rJ=E4();function lF(D,F){if(!D)return D;F=F||{};let Q=F.align||"center";if(Q==="left")return D;let B=F.split||`
28
+ `,Y=F.pad||" ",J=Q!=="right"?oJ:sJ,X=!1;if(!Array.isArray(D))X=!0,D=String(D).split(B);let C,W=0;return D=D.map(function(z){return z=String(z),C=rJ(z),W=Math.max(C,W),{str:z,width:C}}).map(function(z){return new Array(J(W,z.width)+1).join(Y)+z.str}),X?D.join(B):D}lF.left=function D(F){return lF(F,{align:"left"})};lF.center=function D(F){return lF(F,{align:"center"})};lF.right=function D(F){return lF(F,{align:"right"})};A4.exports=lF;function oJ(D,F){return Math.floor((D-F)/2)}function sJ(D,F){return D-F}});var k4={};MF(k4,{version:()=>VC,type:()=>MC,scripts:()=>RC,repository:()=>wC,publishConfig:()=>SC,name:()=>ZC,main:()=>NC,license:()=>IC,keywords:()=>_C,homepage:()=>TC,files:()=>uC,exports:()=>jC,engines:()=>vC,devDependencies:()=>bC,description:()=>LC,dependencies:()=>kC,default:()=>yC,bugs:()=>PC,bin:()=>xC,author:()=>OC});var ZC="claude-mem",VC="3.9.16",LC="Memory compression system for Claude Code - persist context across sessions",MC="module",NC="dist/claude-mem.min.js",jC,RC,_C,OC="Alex Newman",IC="SEE LICENSE IN LICENSE",wC,TC="https://github.com/thedotmack/claude-mem#readme",PC,SC,kC,bC,vC,xC,uC,yC;var b4=zF(()=>{jC={".":"./dist/claude-mem.min.js"},RC={dev:"tsx src/bin/cli.ts","dev:install":"node dist/claude-mem.min.js install --force","dev:status":"node dist/claude-mem.min.js status","dev:compress":"node dist/claude-mem.min.js compress","dev:load":"node dist/claude-mem.min.js load-context","dev:uninstall":"node dist/claude-mem.min.js uninstall","memory-stream:server":"node src/ui/memory-stream/server.js",build:"./scripts/build-minified.sh",test:"bun test test/unit/ test/basic.test.ts && npm run test:integration","test:unit":"bun test test/unit/","test:integration":"vitest run","test:integration:watch":"vitest watch","test:integration:ui":"vitest --ui","test:e2e":"bun test test/e2e/","test:performance":"bun test test/performance/ --benchmark","test:coverage":"bun test --coverage","test:watch":"bun test --watch",lint:"eslint 'src/**/*.ts' 'hook-templates/**/*.ts' 'test/**/*.ts'","lint:fix":"npm run lint -- --fix",format:"prettier --write 'src/**/*.ts' 'hook-templates/**/*.ts' 'test/**/*.ts'","build:npm":"./scripts/npm-publish.sh",publish:"./scripts/publish-with-changelog.sh","publish:latest":"./scripts/publish-latest.sh","publish:with-changelog":"./scripts/publish-with-changelog.sh bump","publish:github":"./scripts/github-publish.sh"},_C=["claude","claude-agent-sdk","mcp","memory","compression","knowledge-graph","transcript","cli","typescript","bun"],wC={type:"git",url:"https://github.com/thedotmack/claude-mem.git"},PC={url:"https://github.com/thedotmack/claude-mem/issues"},SC={access:"public",registry:"https://registry.npmjs.org/"},kC={"@anthropic-ai/claude-agent-sdk":"^0.1.0","@clack/prompts":"^0.11.0","better-sqlite3":"^11.8.0",boxen:"^8.0.1",chalk:"^5.6.0",commander:"^14.0.0",glob:"^11.0.3","gradient-string":"^3.0.0",handlebars:"^4.7.8"},bC={"@types/handlebars":"^4.0.40","@types/node":"^20.0.0","@typescript-eslint/eslint-plugin":"^6.0.0","@typescript-eslint/parser":"^6.0.0","@vitest/ui":"^3.2.4",eslint:"^8.0.0",prettier:"^3.0.0",tsx:"^4.20.5",typescript:"^5.0.0",vitest:"^3.2.4"},vC={node:">=18.0.0",bun:">=1.0.0"},xC={"claude-mem":"dist/claude-mem.min.js"},uC=["dist","hook-templates","commands","docs","src","CHANGELOG.md"],yC={name:ZC,version:VC,description:LC,type:MC,main:NC,exports:jC,scripts:RC,keywords:_C,author:OC,license:IC,repository:wC,homepage:TC,bugs:PC,publishConfig:SC,dependencies:kC,devDependencies:bC,engines:vC,bin:xC,files:uC}});import{join as nD,dirname as W6,sep as fC}from"path";import{homedir as X7}from"os";import{existsSync as D8,statSync as gC}from"fs";import{execSync as v4}from"child_process";import{fileURLToPath as $C}from"url";class CD{static instance=null;_dataDirectory=null;_packageRoot=null;_claudeConfigDirectory=null;static getInstance(){if(!CD.instance)CD.instance=new CD;return CD.instance}getDataDirectory(){if(this._dataDirectory)return this._dataDirectory;return this._dataDirectory=process.env.CLAUDE_MEM_DATA_DIR||nD(X7(),".claude-mem"),this._dataDirectory}getArchivesDirectory(){return nD(this.getDataDirectory(),"archives")}getHooksDirectory(){return nD(this.getDataDirectory(),"hooks")}getLogsDirectory(){return nD(this.getDataDirectory(),"logs")}getIndexDirectory(){return this.getDataDirectory()}getIndexPath(){return nD(this.getIndexDirectory(),"claude-mem-index.jsonl")}getTrashDirectory(){return nD(this.getDataDirectory(),"trash")}getBackupsDirectory(){return nD(this.getDataDirectory(),"backups")}getChromaDirectory(){return nD(this.getDataDirectory(),"chroma")}getProjectArchiveDirectory(D){return nD(this.getArchivesDirectory(),D)}getUserSettingsPath(){return nD(this.getDataDirectory(),"settings.json")}getClaudeConfigDirectory(){if(this._claudeConfigDirectory)return this._claudeConfigDirectory;return this._claudeConfigDirectory=process.env.CLAUDE_CONFIG_DIR||nD(X7(),".claude"),this._claudeConfigDirectory}getClaudeSettingsPath(){return nD(this.getClaudeConfigDirectory(),"settings.json")}getClaudeCommandsDirectory(){return nD(this.getClaudeConfigDirectory(),"commands")}getClaudeMdPath(){return nD(this.getClaudeConfigDirectory(),"CLAUDE.md")}getMcpConfigPath(){return nD(X7(),".claude.json")}getProjectMcpConfigPath(){return nD(process.cwd(),".mcp.json")}getPackageRoot(){if(this._packageRoot)return this._packageRoot;try{let Q=gD.resolve("/Users/alexnewman/Scripts/claude-mem-source/package.json");return this._packageRoot=W6(Q),this._packageRoot}catch{}let D=$C(import.meta.url),F=W6(D);for(let Q=0;Q<10;Q++){let B=nD(F,"package.json");if(D8(B)){if(gD(B).name==="claude-mem")return this._packageRoot=F,this._packageRoot}let Y=W6(F);if(Y===F)break;F=Y}try{let Q=v4("npm list -g claude-mem --json 2>/dev/null || npm list claude-mem --json 2>/dev/null",{encoding:"utf8"}),B=JSON.parse(Q);if(B.dependencies?.["claude-mem"]?.resolved)return this._packageRoot=W6(B.dependencies["claude-mem"].resolved),this._packageRoot}catch{}throw new Error("Cannot locate claude-mem package root. Ensure claude-mem is properly installed.")}findPackageHookTemplatesDirectory(){let D=this.getPackageRoot(),F=nD(D,"hook-templates"),Q=["session-start.js","stop.js","user-prompt-submit.js","post-tool-use.js"];for(let B of Q)if(!D8(nD(F,B)))throw new Error(`Package hook-templates directory missing required template file: ${B}`);return F}findPackageCommandsDirectory(){let D=this.getPackageRoot(),F=nD(D,"commands"),Q=["save.md"];for(let B of Q)if(!D8(nD(F,B)))throw new Error(`Package commands directory missing required file: ${B}`);return F}ensureDirectory(D){if(!D8(D))gD("fs").mkdirSync(D,{recursive:!0})}ensureDirectories(D){D.forEach((F)=>this.ensureDirectory(F))}ensureAllDataDirectories(){this.ensureDirectories([this.getDataDirectory(),this.getArchivesDirectory(),this.getHooksDirectory(),this.getLogsDirectory(),this.getTrashDirectory(),this.getBackupsDirectory(),this.getChromaDirectory()])}ensureAllClaudeDirectories(){this.ensureDirectories([this.getClaudeConfigDirectory(),this.getClaudeCommandsDirectory()])}static extractProjectName(D){let F=D.split(fC),Q=["src","lib","app","project","workspace"];for(let B=F.length-1;B>=0;B--)if(Q.includes(F[B])&&B>0)return F[B-1];if(F.length>1)return F[F.length-2];return"unknown-project"}static getCurrentProjectName(){try{let D=v4("git rev-parse --show-toplevel",{cwd:process.cwd(),encoding:"utf8",stdio:["pipe","pipe","ignore"]}).trim();return gD("path").basename(D)}catch{return gD("path").basename(process.cwd())}}static createBackupFilename(D){let F=new Date().toISOString().replace(/[:.]/g,"-").replace("T","_").slice(0,19);return`${D}.backup.${F}`}static isPathAccessible(D){return D8(D)&&gC(D).isDirectory()}}var E0=()=>{};var GF=VD((CW)=>{CW.getBooleanOption=(D,F)=>{let Q=!1;if(F in D&&typeof(Q=D[F])!=="boolean")throw new TypeError(`Expected the "${F}" option to be a boolean`);return Q};CW.cppdb=Symbol();CW.inspect=Symbol.for("nodejs.util.inspect.custom")});var q7=VD((VZ,m4)=>{var G7={value:"SqliteError",writable:!0,enumerable:!1,configurable:!0};function cF(D,F){if(new.target!==cF)return new cF(D,F);if(typeof F!=="string")throw new TypeError("Expected second argument to be a string");Error.call(this,D),G7.value=""+D,Object.defineProperty(this,"message",G7),Error.captureStackTrace(this,cF),this.code=F}Object.setPrototypeOf(cF,Error);Object.setPrototypeOf(cF.prototype,Error.prototype);Object.defineProperty(cF.prototype,"name",G7);m4.exports=cF});var d4=VD((LZ,l4)=>{var H6=gD("path").sep||"/";l4.exports=qW;function qW(D){if(typeof D!="string"||D.length<=7||D.substring(0,7)!="file://")throw new TypeError("must pass in a file:// URI to convert to a file path");var F=decodeURI(D.substring(7)),Q=F.indexOf("/"),B=F.substring(0,Q),Y=F.substring(Q+1);if(B=="localhost")B="";if(B)B=H6+H6+B;if(Y=Y.replace(/^(.+)\|/,"$1:"),H6=="\\")Y=Y.replace(/\//g,"\\");if(/^.+\:/.test(Y));else Y=H6+Y;return B+Y}});var i4=VD((E6,n4)=>{var __filename="/Users/alexnewman/Scripts/claude-mem-source/node_modules/bindings/bindings.js",H7=gD("fs"),U6=gD("path"),HW=d4(),K6=U6.join,KW=U6.dirname,c4=H7.accessSync&&function(D){try{H7.accessSync(D)}catch(F){return!1}return!0}||H7.existsSync||U6.existsSync,p4={arrow:process.env.NODE_BINDINGS_ARROW||" → ",compiled:process.env.NODE_BINDINGS_COMPILED_DIR||"compiled",platform:process.platform,arch:process.arch,nodePreGyp:"node-v"+process.versions.modules+"-"+process.platform+"-"+process.arch,version:process.versions.node,bindings:"bindings.node",try:[["module_root","build","bindings"],["module_root","build","Debug","bindings"],["module_root","build","Release","bindings"],["module_root","out","Debug","bindings"],["module_root","Debug","bindings"],["module_root","out","Release","bindings"],["module_root","Release","bindings"],["module_root","build","default","bindings"],["module_root","compiled","version","platform","arch","bindings"],["module_root","addon-build","release","install-root","bindings"],["module_root","addon-build","debug","install-root","bindings"],["module_root","addon-build","default","install-root","bindings"],["module_root","lib","binding","nodePreGyp","bindings"]]};function UW(D){if(typeof D=="string")D={bindings:D};else if(!D)D={};if(Object.keys(p4).map(function(W){if(!(W in D))D[W]=p4[W]}),!D.module_root)D.module_root=E6.getRoot(E6.getFileName());if(U6.extname(D.bindings)!=".node")D.bindings+=".node";var F=typeof __webpack_require__==="function"?__non_webpack_require__:gD,Q=[],B=0,Y=D.try.length,J,X,C;for(;B<Y;B++){J=K6.apply(null,D.try[B].map(function(W){return D[W]||W})),Q.push(J);try{if(X=D.path?F.resolve(J):F(J),!D.path)X.path=J;return X}catch(W){if(W.code!=="MODULE_NOT_FOUND"&&W.code!=="QUALIFIED_PATH_RESOLUTION_FAILED"&&!/not find/i.test(W.message))throw W}}throw C=new Error(`Could not locate the bindings file. Tried:
29
+ `+Q.map(function(W){return D.arrow+W}).join(`
30
+ `)),C.tries=Q,C}n4.exports=E6=UW;E6.getFileName=function D(F){var{prepareStackTrace:Q,stackTraceLimit:B}=Error,Y={},J;Error.stackTraceLimit=10,Error.prepareStackTrace=function(C,W){for(var z=0,G=W.length;z<G;z++)if(J=W[z].getFileName(),J!==__filename)if(F){if(J!==F)return}else return},Error.captureStackTrace(Y),Y.stack,Error.prepareStackTrace=Q,Error.stackTraceLimit=B;var X="file://";if(J.indexOf(X)===0)J=HW(J);return J};E6.getRoot=function D(F){var Q=KW(F),B;while(!0){if(Q===".")Q=process.cwd();if(c4(K6(Q,"package.json"))||c4(K6(Q,"node_modules")))return Q;if(B===Q)throw new Error('Could not find module root given file: "'+F+'". Do you have a `package.json` file? ');B=Q,Q=K6(Q,"..")}}});var a4=VD((EW)=>{var{cppdb:s0}=GF();EW.prepare=function D(F){return this[s0].prepare(F,this,!1)};EW.exec=function D(F){return this[s0].exec(F),this};EW.close=function D(){return this[s0].close(),this};EW.loadExtension=function D(...F){return this[s0].loadExtension(...F),this};EW.defaultSafeIntegers=function D(...F){return this[s0].defaultSafeIntegers(...F),this};EW.unsafeMode=function D(...F){return this[s0].unsafeMode(...F),this};EW.getters={name:{get:function D(){return this[s0].name},enumerable:!0},open:{get:function D(){return this[s0].open},enumerable:!0},inTransaction:{get:function D(){return this[s0].inTransaction},enumerable:!0},readonly:{get:function D(){return this[s0].readonly},enumerable:!0},memory:{get:function D(){return this[s0].memory},enumerable:!0}}});var s4=VD((_Z,o4)=>{var{cppdb:RW}=GF(),r4=new WeakMap;o4.exports=function D(F){if(typeof F!=="function")throw new TypeError("Expected first argument to be a function");let Q=this[RW],B=_W(Q,this),{apply:Y}=Function.prototype,J={default:{value:A6(Y,F,Q,B.default)},deferred:{value:A6(Y,F,Q,B.deferred)},immediate:{value:A6(Y,F,Q,B.immediate)},exclusive:{value:A6(Y,F,Q,B.exclusive)},database:{value:this,enumerable:!0}};return Object.defineProperties(J.default.value,J),Object.defineProperties(J.deferred.value,J),Object.defineProperties(J.immediate.value,J),Object.defineProperties(J.exclusive.value,J),J.default.value};var _W=(D,F)=>{let Q=r4.get(D);if(!Q){let B={commit:D.prepare("COMMIT",F,!1),rollback:D.prepare("ROLLBACK",F,!1),savepoint:D.prepare("SAVEPOINT `\t_bs3. `",F,!1),release:D.prepare("RELEASE `\t_bs3. `",F,!1),rollbackTo:D.prepare("ROLLBACK TO `\t_bs3. `",F,!1)};r4.set(D,Q={default:Object.assign({begin:D.prepare("BEGIN",F,!1)},B),deferred:Object.assign({begin:D.prepare("BEGIN DEFERRED",F,!1)},B),immediate:Object.assign({begin:D.prepare("BEGIN IMMEDIATE",F,!1)},B),exclusive:Object.assign({begin:D.prepare("BEGIN EXCLUSIVE",F,!1)},B)})}return Q},A6=(D,F,Q,{begin:B,commit:Y,rollback:J,savepoint:X,release:C,rollbackTo:W})=>function z(){let G,q,A;if(Q.inTransaction)G=X,q=C,A=W;else G=B,q=Y,A=J;G.run();try{let U=D.call(F,this,arguments);if(U&&typeof U.then==="function")throw new TypeError("Transaction function cannot return a promise");return q.run(),U}catch(U){if(Q.inTransaction){if(A.run(),A!==J)q.run()}throw U}}});var e4=VD((OZ,t4)=>{var{getBooleanOption:OW,cppdb:IW}=GF();t4.exports=function D(F,Q){if(Q==null)Q={};if(typeof F!=="string")throw new TypeError("Expected first argument to be a string");if(typeof Q!=="object")throw new TypeError("Expected second argument to be an options object");let B=OW(Q,"simple"),Y=this[IW].prepare(`PRAGMA ${F}`,this,!0);return B?Y.pluck().get():Y.all()}});var B5=VD((IZ,F5)=>{var wW=gD("fs"),TW=gD("path"),{promisify:PW}=gD("util"),{cppdb:SW}=GF(),D5=PW(wW.access);F5.exports=async function D(F,Q){if(Q==null)Q={};if(typeof F!=="string")throw new TypeError("Expected first argument to be a string");if(typeof Q!=="object")throw new TypeError("Expected second argument to be an options object");F=F.trim();let B="attached"in Q?Q.attached:"main",Y="progress"in Q?Q.progress:null;if(!F)throw new TypeError("Backup filename cannot be an empty string");if(F===":memory:")throw new TypeError('Invalid backup filename ":memory:"');if(typeof B!=="string")throw new TypeError('Expected the "attached" option to be a string');if(!B)throw new TypeError('The "attached" option cannot be an empty string');if(Y!=null&&typeof Y!=="function")throw new TypeError('Expected the "progress" option to be a function');await D5(TW.dirname(F)).catch(()=>{throw new TypeError("Cannot save backup because the directory does not exist")});let J=await D5(F).then(()=>!1,()=>!0);return kW(this[SW].backup(this,B,F,J),Y||null)};var kW=(D,F)=>{let Q=0,B=!0;return new Promise((Y,J)=>{setImmediate(function X(){try{let C=D.transfer(Q);if(!C.remainingPages){D.close(),Y(C);return}if(B)B=!1,Q=100;if(F){let W=F(C);if(W!==void 0)if(typeof W==="number"&&W===W)Q=Math.max(0,Math.min(2147483647,Math.round(W)));else throw new TypeError("Expected progress callback to return a number or undefined")}setImmediate(X)}catch(C){D.close(),J(C)}})})}});var X5=VD((wZ,Q5)=>{var{cppdb:bW}=GF();Q5.exports=function D(F){if(F==null)F={};if(typeof F!=="object")throw new TypeError("Expected first argument to be an options object");let Q="attached"in F?F.attached:"main";if(typeof Q!=="string")throw new TypeError('Expected the "attached" option to be a string');if(!Q)throw new TypeError('The "attached" option cannot be an empty string');return this[bW].serialize(Q)}});var J5=VD((TZ,Y5)=>{var{getBooleanOption:Z6,cppdb:vW}=GF();Y5.exports=function D(F,Q,B){if(Q==null)Q={};if(typeof Q==="function")B=Q,Q={};if(typeof F!=="string")throw new TypeError("Expected first argument to be a string");if(typeof B!=="function")throw new TypeError("Expected last argument to be a function");if(typeof Q!=="object")throw new TypeError("Expected second argument to be an options object");if(!F)throw new TypeError("User-defined function name cannot be an empty string");let Y="safeIntegers"in Q?+Z6(Q,"safeIntegers"):2,J=Z6(Q,"deterministic"),X=Z6(Q,"directOnly"),C=Z6(Q,"varargs"),W=-1;if(!C){if(W=B.length,!Number.isInteger(W)||W<0)throw new TypeError("Expected function.length to be a positive integer");if(W>100)throw new RangeError("User-defined functions cannot have more than 100 arguments")}return this[vW].function(B,F,W,Y,J,X),this}});var z5=VD((PZ,W5)=>{var{getBooleanOption:V6,cppdb:xW}=GF();W5.exports=function D(F,Q){if(typeof F!=="string")throw new TypeError("Expected first argument to be a string");if(typeof Q!=="object"||Q===null)throw new TypeError("Expected second argument to be an options object");if(!F)throw new TypeError("User-defined function name cannot be an empty string");let B="start"in Q?Q.start:null,Y=K7(Q,"step",!0),J=K7(Q,"inverse",!1),X=K7(Q,"result",!1),C="safeIntegers"in Q?+V6(Q,"safeIntegers"):2,W=V6(Q,"deterministic"),z=V6(Q,"directOnly"),G=V6(Q,"varargs"),q=-1;if(!G){if(q=Math.max(C5(Y),J?C5(J):0),q>0)q-=1;if(q>100)throw new RangeError("User-defined functions cannot have more than 100 arguments")}return this[xW].aggregate(B,Y,J,X,F,q,C,W,z),this};var K7=(D,F,Q)=>{let B=F in D?D[F]:null;if(typeof B==="function")return B;if(B!=null)throw new TypeError(`Expected the "${F}" option to be a function`);if(Q)throw new TypeError(`Missing required option "${F}"`);return null},C5=({length:D})=>{if(Number.isInteger(D)&&D>=0)return D;throw new TypeError("Expected function.length to be a positive integer")}});var K5=VD((SZ,H5)=>{var{cppdb:uW}=GF();H5.exports=function D(F,Q){if(typeof F!=="string")throw new TypeError("Expected first argument to be a string");if(!F)throw new TypeError("Virtual table module name cannot be an empty string");let B=!1;if(typeof Q==="object"&&Q!==null)B=!0,Q=dW(q5(Q,"used",F));else{if(typeof Q!=="function")throw new TypeError("Expected second argument to be a function or a table definition object");Q=yW(Q)}return this[uW].table(Q,F,B),this};function yW(D){return function F(Q,B,Y,...J){let X={module:Q,database:B,table:Y},C=mW.call(D,X,J);if(typeof C!=="object"||C===null)throw new TypeError(`Virtual table module "${Q}" did not return a table definition object`);return q5(C,"returned",Q)}}function q5(D,F,Q){if(!X8.call(D,"rows"))throw new TypeError(`Virtual table module "${Q}" ${F} a table definition without a "rows" property`);if(!X8.call(D,"columns"))throw new TypeError(`Virtual table module "${Q}" ${F} a table definition without a "columns" property`);let B=D.rows;if(typeof B!=="function"||Object.getPrototypeOf(B)!==lW)throw new TypeError(`Virtual table module "${Q}" ${F} a table definition with an invalid "rows" property (should be a generator function)`);let Y=D.columns;if(!Array.isArray(Y)||!(Y=[...Y]).every((z)=>typeof z==="string"))throw new TypeError(`Virtual table module "${Q}" ${F} a table definition with an invalid "columns" property (should be an array of strings)`);if(Y.length!==new Set(Y).size)throw new TypeError(`Virtual table module "${Q}" ${F} a table definition with duplicate column names`);if(!Y.length)throw new RangeError(`Virtual table module "${Q}" ${F} a table definition with zero columns`);let J;if(X8.call(D,"parameters")){if(J=D.parameters,!Array.isArray(J)||!(J=[...J]).every((z)=>typeof z==="string"))throw new TypeError(`Virtual table module "${Q}" ${F} a table definition with an invalid "parameters" property (should be an array of strings)`)}else J=hW(B);if(J.length!==new Set(J).size)throw new TypeError(`Virtual table module "${Q}" ${F} a table definition with duplicate parameter names`);if(J.length>32)throw new RangeError(`Virtual table module "${Q}" ${F} a table definition with more than the maximum number of 32 parameters`);for(let z of J)if(Y.includes(z))throw new TypeError(`Virtual table module "${Q}" ${F} a table definition with column "${z}" which was ambiguously defined as both a column and parameter`);let X=2;if(X8.call(D,"safeIntegers")){let z=D.safeIntegers;if(typeof z!=="boolean")throw new TypeError(`Virtual table module "${Q}" ${F} a table definition with an invalid "safeIntegers" property (should be a boolean)`);X=+z}let C=!1;if(X8.call(D,"directOnly")){if(C=D.directOnly,typeof C!=="boolean")throw new TypeError(`Virtual table module "${Q}" ${F} a table definition with an invalid "directOnly" property (should be a boolean)`)}return[`CREATE TABLE x(${[...J.map(G5).map((z)=>`${z} HIDDEN`),...Y.map(G5)].join(", ")});`,fW(B,new Map(Y.map((z,G)=>[z,J.length+G])),Q),J,X,C]}function fW(D,F,Q){return function*B(...Y){let J=Y.map((X)=>Buffer.isBuffer(X)?Buffer.from(X):X);for(let X=0;X<F.size;++X)J.push(null);for(let X of D(...Y))if(Array.isArray(X))gW(X,J,F.size,Q),yield J;else if(typeof X==="object"&&X!==null)$W(X,J,F,Q),yield J;else throw new TypeError(`Virtual table module "${Q}" yielded something that isn't a valid row object`)}}function gW(D,F,Q,B){if(D.length!==Q)throw new TypeError(`Virtual table module "${B}" yielded a row with an incorrect number of columns`);let Y=F.length-Q;for(let J=0;J<Q;++J)F[J+Y]=D[J]}function $W(D,F,Q,B){let Y=0;for(let J of Object.keys(D)){let X=Q.get(J);if(X===void 0)throw new TypeError(`Virtual table module "${B}" yielded a row with an undeclared column "${J}"`);F[X]=D[J],Y+=1}if(Y!==Q.size)throw new TypeError(`Virtual table module "${B}" yielded a row with missing columns`)}function hW({length:D}){if(!Number.isInteger(D)||D<0)throw new TypeError("Expected function.length to be a positive integer");let F=[];for(let Q=0;Q<D;++Q)F.push(`$${Q+1}`);return F}var{hasOwnProperty:X8}=Object.prototype,{apply:mW}=Function.prototype,lW=Object.getPrototypeOf(function*(){}),G5=(D)=>`"${D.replace(/"/g,'""')}"`,dW=(D)=>()=>D});var E5=VD((kZ,U5)=>{var cW=function D(){};U5.exports=function D(F,Q){return Object.assign(new cW,this)}});var L5=VD((bZ,V5)=>{var pW=gD("fs"),A5=gD("path"),L6=GF(),nW=q7(),Z5;function W0(D,F){if(new.target==null)return new W0(D,F);let Q;if(Buffer.isBuffer(D))Q=D,D=":memory:";if(D==null)D="";if(F==null)F={};if(typeof D!=="string")throw new TypeError("Expected first argument to be a string");if(typeof F!=="object")throw new TypeError("Expected second argument to be an options object");if("readOnly"in F)throw new TypeError('Misspelled option "readOnly" should be "readonly"');if("memory"in F)throw new TypeError('Option "memory" was removed in v7.0.0 (use ":memory:" filename instead)');let B=D.trim(),Y=B===""||B===":memory:",J=L6.getBooleanOption(F,"readonly"),X=L6.getBooleanOption(F,"fileMustExist"),C="timeout"in F?F.timeout:5000,W="verbose"in F?F.verbose:null,z="nativeBinding"in F?F.nativeBinding:null;if(J&&Y&&!Q)throw new TypeError("In-memory/temporary databases cannot be readonly");if(!Number.isInteger(C)||C<0)throw new TypeError('Expected the "timeout" option to be a positive integer');if(C>2147483647)throw new RangeError('Option "timeout" cannot be greater than 2147483647');if(W!=null&&typeof W!=="function")throw new TypeError('Expected the "verbose" option to be a function');if(z!=null&&typeof z!=="string"&&typeof z!=="object")throw new TypeError('Expected the "nativeBinding" option to be a string or addon object');let G;if(z==null)G=Z5||(Z5=i4()("better_sqlite3.node"));else if(typeof z==="string")G=(typeof __non_webpack_require__==="function"?__non_webpack_require__:gD)(A5.resolve(z).replace(/(\.node)?$/,".node"));else G=z;if(!G.isInitialized)G.setErrorConstructor(nW),G.isInitialized=!0;if(!Y&&!pW.existsSync(A5.dirname(B)))throw new TypeError("Cannot open database because the directory does not exist");Object.defineProperties(this,{[L6.cppdb]:{value:new G.Database(B,D,Y,J,X,C,W||null,Q||null)},...pF.getters})}var pF=a4();W0.prototype.prepare=pF.prepare;W0.prototype.transaction=s4();W0.prototype.pragma=e4();W0.prototype.backup=B5();W0.prototype.serialize=X5();W0.prototype.function=J5();W0.prototype.aggregate=z5();W0.prototype.table=K5();W0.prototype.loadExtension=pF.loadExtension;W0.prototype.exec=pF.exec;W0.prototype.close=pF.close;W0.prototype.defaultSafeIntegers=pF.defaultSafeIntegers;W0.prototype.unsafeMode=pF.unsafeMode;W0.prototype[L6.inspect]=E5();V5.exports=W0});var M5=VD((xZ,U7)=>{U7.exports=L5();U7.exports.SqliteError=q7()});var N5={};MF(N5,{initializeDatabase:()=>A7,getDatabase:()=>A0,DatabaseManager:()=>S0,Database:()=>E7.default});import iW from"path";import aW from"fs";class S0{static instance;db=null;migrations=[];static getInstance(){if(!S0.instance)S0.instance=new S0;return S0.instance}registerMigration(D){this.migrations.push(D),this.migrations.sort((F,Q)=>F.version-Q.version)}async initialize(){if(this.db)return this.db;let D=CD.getInstance().getDataDirectory();aW.mkdirSync(D,{recursive:!0});let F=iW.join(D,"claude-mem.db");return this.db=new E7.default(F),this.db.pragma("journal_mode = WAL"),this.db.pragma("synchronous = NORMAL"),this.db.pragma("foreign_keys = ON"),this.db.pragma("temp_store = memory"),this.db.pragma("mmap_size = 268435456"),this.db.pragma("cache_size = 10000"),this.initializeSchemaVersions(),await this.runMigrations(),M6=this.db,this.db}getConnection(){if(!this.db)throw new Error("Database not initialized. Call initialize() first.");return this.db}withTransaction(D){let F=this.getConnection();return F.transaction(D)(F)}close(){if(this.db)this.db.close(),this.db=null,M6=null}initializeSchemaVersions(){if(!this.db)return;this.db.exec(`
31
31
  CREATE TABLE IF NOT EXISTS schema_versions (
32
32
  id INTEGER PRIMARY KEY,
33
33
  version INTEGER UNIQUE NOT NULL,
@@ -175,7 +175,7 @@ Expecting one of '${Q.join("', '")}'`);let B=`${D}Help`;return this.on(B,(Y)=>{l
175
175
  INSERT INTO streaming_sessions (
176
176
  claude_session_id, project, user_prompt, started_at, started_at_epoch, status
177
177
  ) VALUES (?, ?, ?, ?, ?, 'active')
178
- `).run(D.claude_session_id,D.project,D.user_prompt||null,F,Q);return this.getById(Y.lastInsertRowid)}update(D,F){let{isoString:Q,epoch:B}=eD(new Date);if(!this.getById(D))throw new Error(`Streaming session with id ${D} not found`);let J=[],X=[];if(F.sdk_session_id!==void 0)J.push("sdk_session_id = ?"),X.push(F.sdk_session_id);if(F.title!==void 0)J.push("title = ?"),X.push(F.title);if(F.subtitle!==void 0)J.push("subtitle = ?"),X.push(F.subtitle);if(F.status!==void 0)J.push("status = ?"),X.push(F.status);if(F.completed_at!==void 0){let{isoString:z,epoch:W}=eD(F.completed_at);J.push("completed_at = ?","completed_at_epoch = ?"),X.push(z,W)}return J.push("updated_at = ?","updated_at_epoch = ?"),X.push(Q,B),X.push(D),this.db.prepare(`
178
+ `).run(D.claude_session_id,D.project,D.user_prompt||null,F,Q);return this.getById(Y.lastInsertRowid)}update(D,F){let{isoString:Q,epoch:B}=eD(new Date);if(!this.getById(D))throw new Error(`Streaming session with id ${D} not found`);let J=[],X=[];if(F.sdk_session_id!==void 0)J.push("sdk_session_id = ?"),X.push(F.sdk_session_id);if(F.title!==void 0)J.push("title = ?"),X.push(F.title);if(F.subtitle!==void 0)J.push("subtitle = ?"),X.push(F.subtitle);if(F.status!==void 0)J.push("status = ?"),X.push(F.status);if(F.completed_at!==void 0){let{isoString:W,epoch:z}=eD(F.completed_at);J.push("completed_at = ?","completed_at_epoch = ?"),X.push(W,z)}return J.push("updated_at = ?","updated_at_epoch = ?"),X.push(Q,B),X.push(D),this.db.prepare(`
179
179
  UPDATE streaming_sessions
180
180
  SET ${J.join(", ")}
181
181
  WHERE id = ?
@@ -326,20 +326,20 @@ Expecting one of '${Q.join("', '")}'`);let B=`${D}Help`;return this.on(B,(Y)=>{l
326
326
  CREATE INDEX IF NOT EXISTS idx_streaming_sessions_started ON streaming_sessions(started_at_epoch DESC);
327
327
  `),console.log("✅ Created streaming_sessions table for real-time session tracking")},down:(D)=>{D.exec(`
328
328
  DROP TABLE IF EXISTS streaming_sessions;
329
- `)}},W8=[x5,u5,y5]});var i9=a0(n9(),1),{program:BE,createCommand:QE,createArgument:XE,createOption:YE,CommanderError:JE,InvalidArgumentError:CE,InvalidOptionArgumentError:WE,Command:a9,Argument:zE,Option:GE,Help:qE}=i9.default;import{readFileSync as ZY,existsSync as VY}from"fs";import{join as LY,dirname as MY}from"path";import{fileURLToPath as NY}from"url";var r9="claude-mem",o9="3.9.13",s9="Memory compression system for Claude Code - persist context across sessions",t9=r9,e9=o9,D3=s9;try{let D=NY(import.meta.url),F=MY(D),Q=LY(F,"..","..","package.json");if(VY(Q)){let B=JSON.parse(ZY(Q,"utf-8"));t9=B.name||r9,e9=B.version||o9,D3=B.description||s9}}catch{}var W2=t9,F3=e9,B3=D3;import{readFileSync as G6,writeFileSync as SF,existsSync as g0,mkdirSync as Q8,copyFileSync as W7,statSync as dC,readdirSync as cC}from"fs";import{join as tD,dirname as z7}from"path";import{homedir as u4}from"os";import{execSync as C7}from"child_process";var J0=a0(E1(),1),A3=a0(Z1(),1);import{stdin as U3,stdout as E3}from"node:process";import*as wF from"node:readline";import J3 from"node:readline";import{Writable as wY}from"node:stream";function TY({onlyFirst:D=!1}={}){let F=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(F,D?void 0:"g")}var PY=TY();function Z3(D){if(typeof D!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof D}\``);return D.replace(PY,"")}function V3(D){return D&&D.__esModule&&Object.prototype.hasOwnProperty.call(D,"default")?D.default:D}var L3={exports:{}};(function(D){var F={};D.exports=F,F.eastAsianWidth=function(B){var Y=B.charCodeAt(0),J=B.length==2?B.charCodeAt(1):0,X=Y;return 55296<=Y&&Y<=56319&&56320<=J&&J<=57343&&(Y&=1023,J&=1023,X=Y<<10|J,X+=65536),X==12288||65281<=X&&X<=65376||65504<=X&&X<=65510?"F":X==8361||65377<=X&&X<=65470||65474<=X&&X<=65479||65482<=X&&X<=65487||65490<=X&&X<=65495||65498<=X&&X<=65500||65512<=X&&X<=65518?"H":4352<=X&&X<=4447||4515<=X&&X<=4519||4602<=X&&X<=4607||9001<=X&&X<=9002||11904<=X&&X<=11929||11931<=X&&X<=12019||12032<=X&&X<=12245||12272<=X&&X<=12283||12289<=X&&X<=12350||12353<=X&&X<=12438||12441<=X&&X<=12543||12549<=X&&X<=12589||12593<=X&&X<=12686||12688<=X&&X<=12730||12736<=X&&X<=12771||12784<=X&&X<=12830||12832<=X&&X<=12871||12880<=X&&X<=13054||13056<=X&&X<=19903||19968<=X&&X<=42124||42128<=X&&X<=42182||43360<=X&&X<=43388||44032<=X&&X<=55203||55216<=X&&X<=55238||55243<=X&&X<=55291||63744<=X&&X<=64255||65040<=X&&X<=65049||65072<=X&&X<=65106||65108<=X&&X<=65126||65128<=X&&X<=65131||110592<=X&&X<=110593||127488<=X&&X<=127490||127504<=X&&X<=127546||127552<=X&&X<=127560||127568<=X&&X<=127569||131072<=X&&X<=194367||177984<=X&&X<=196605||196608<=X&&X<=262141?"W":32<=X&&X<=126||162<=X&&X<=163||165<=X&&X<=166||X==172||X==175||10214<=X&&X<=10221||10629<=X&&X<=10630?"Na":X==161||X==164||167<=X&&X<=168||X==170||173<=X&&X<=174||176<=X&&X<=180||182<=X&&X<=186||188<=X&&X<=191||X==198||X==208||215<=X&&X<=216||222<=X&&X<=225||X==230||232<=X&&X<=234||236<=X&&X<=237||X==240||242<=X&&X<=243||247<=X&&X<=250||X==252||X==254||X==257||X==273||X==275||X==283||294<=X&&X<=295||X==299||305<=X&&X<=307||X==312||319<=X&&X<=322||X==324||328<=X&&X<=331||X==333||338<=X&&X<=339||358<=X&&X<=359||X==363||X==462||X==464||X==466||X==468||X==470||X==472||X==474||X==476||X==593||X==609||X==708||X==711||713<=X&&X<=715||X==717||X==720||728<=X&&X<=731||X==733||X==735||768<=X&&X<=879||913<=X&&X<=929||931<=X&&X<=937||945<=X&&X<=961||963<=X&&X<=969||X==1025||1040<=X&&X<=1103||X==1105||X==8208||8211<=X&&X<=8214||8216<=X&&X<=8217||8220<=X&&X<=8221||8224<=X&&X<=8226||8228<=X&&X<=8231||X==8240||8242<=X&&X<=8243||X==8245||X==8251||X==8254||X==8308||X==8319||8321<=X&&X<=8324||X==8364||X==8451||X==8453||X==8457||X==8467||X==8470||8481<=X&&X<=8482||X==8486||X==8491||8531<=X&&X<=8532||8539<=X&&X<=8542||8544<=X&&X<=8555||8560<=X&&X<=8569||X==8585||8592<=X&&X<=8601||8632<=X&&X<=8633||X==8658||X==8660||X==8679||X==8704||8706<=X&&X<=8707||8711<=X&&X<=8712||X==8715||X==8719||X==8721||X==8725||X==8730||8733<=X&&X<=8736||X==8739||X==8741||8743<=X&&X<=8748||X==8750||8756<=X&&X<=8759||8764<=X&&X<=8765||X==8776||X==8780||X==8786||8800<=X&&X<=8801||8804<=X&&X<=8807||8810<=X&&X<=8811||8814<=X&&X<=8815||8834<=X&&X<=8835||8838<=X&&X<=8839||X==8853||X==8857||X==8869||X==8895||X==8978||9312<=X&&X<=9449||9451<=X&&X<=9547||9552<=X&&X<=9587||9600<=X&&X<=9615||9618<=X&&X<=9621||9632<=X&&X<=9633||9635<=X&&X<=9641||9650<=X&&X<=9651||9654<=X&&X<=9655||9660<=X&&X<=9661||9664<=X&&X<=9665||9670<=X&&X<=9672||X==9675||9678<=X&&X<=9681||9698<=X&&X<=9701||X==9711||9733<=X&&X<=9734||X==9737||9742<=X&&X<=9743||9748<=X&&X<=9749||X==9756||X==9758||X==9792||X==9794||9824<=X&&X<=9825||9827<=X&&X<=9829||9831<=X&&X<=9834||9836<=X&&X<=9837||X==9839||9886<=X&&X<=9887||9918<=X&&X<=9919||9924<=X&&X<=9933||9935<=X&&X<=9953||X==9955||9960<=X&&X<=9983||X==10045||X==10071||10102<=X&&X<=10111||11093<=X&&X<=11097||12872<=X&&X<=12879||57344<=X&&X<=63743||65024<=X&&X<=65039||X==65533||127232<=X&&X<=127242||127248<=X&&X<=127277||127280<=X&&X<=127337||127344<=X&&X<=127386||917760<=X&&X<=917999||983040<=X&&X<=1048573||1048576<=X&&X<=1114109?"A":"N"},F.characterLength=function(B){var Y=this.eastAsianWidth(B);return Y=="F"||Y=="W"||Y=="A"?2:1};function Q(B){return B.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}F.length=function(B){for(var Y=Q(B),J=0,X=0;X<Y.length;X++)J=J+this.characterLength(Y[X]);return J},F.slice=function(B,Y,J){textLen=F.length(B),Y=Y||0,J=J||1,Y<0&&(Y=textLen+Y),J<0&&(J=textLen+J);for(var X="",C=0,z=Q(B),W=0;W<z.length;W++){var G=z[W],q=F.length(G);if(C>=Y-(q==2?1:0))if(C+q<=J)X+=G;else break;C+=q}return X}})(L3);var SY=L3.exports,kY=V3(SY),bY=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\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])|\uD83C[\uDF3E\uDF73\uDF7C\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\uDF7C\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\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\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\uDF7C\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\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\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\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\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-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*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\u26A7\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-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\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[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g},vY=V3(bY);function i2(D,F={}){if(typeof D!="string"||D.length===0||(F={ambiguousIsNarrow:!0,...F},D=Z3(D),D.length===0))return 0;D=D.replace(vY()," ");let Q=F.ambiguousIsNarrow?1:2,B=0;for(let Y of D){let J=Y.codePointAt(0);if(J<=31||J>=127&&J<=159||J>=768&&J<=879)continue;switch(kY.eastAsianWidth(Y)){case"F":case"W":B+=2;break;case"A":B+=Q;break;default:B+=1}}return B}var V1=10,C3=(D=0)=>(F)=>`\x1B[${F+D}m`,W3=(D=0)=>(F)=>`\x1B[${38+D};5;${F}m`,z3=(D=0)=>(F,Q,B)=>`\x1B[${38+D};2;${F};${Q};${B}m`,bD={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],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],gray:[90,39],grey:[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],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(bD.modifier);var xY=Object.keys(bD.color),uY=Object.keys(bD.bgColor);[...xY];function yY(){let D=new Map;for(let[F,Q]of Object.entries(bD)){for(let[B,Y]of Object.entries(Q))bD[B]={open:`\x1B[${Y[0]}m`,close:`\x1B[${Y[1]}m`},Q[B]=bD[B],D.set(Y[0],Y[1]);Object.defineProperty(bD,F,{value:Q,enumerable:!1})}return Object.defineProperty(bD,"codes",{value:D,enumerable:!1}),bD.color.close="\x1B[39m",bD.bgColor.close="\x1B[49m",bD.color.ansi=C3(),bD.color.ansi256=W3(),bD.color.ansi16m=z3(),bD.bgColor.ansi=C3(V1),bD.bgColor.ansi256=W3(V1),bD.bgColor.ansi16m=z3(V1),Object.defineProperties(bD,{rgbToAnsi256:{value:(F,Q,B)=>F===Q&&Q===B?F<8?16:F>248?231:Math.round((F-8)/247*24)+232:16+36*Math.round(F/255*5)+6*Math.round(Q/255*5)+Math.round(B/255*5),enumerable:!1},hexToRgb:{value:(F)=>{let Q=/[a-f\d]{6}|[a-f\d]{3}/i.exec(F.toString(16));if(!Q)return[0,0,0];let[B]=Q;B.length===3&&(B=[...B].map((J)=>J+J).join(""));let Y=Number.parseInt(B,16);return[Y>>16&255,Y>>8&255,Y&255]},enumerable:!1},hexToAnsi256:{value:(F)=>bD.rgbToAnsi256(...bD.hexToRgb(F)),enumerable:!1},ansi256ToAnsi:{value:(F)=>{if(F<8)return 30+F;if(F<16)return 90+(F-8);let Q,B,Y;if(F>=232)Q=((F-232)*10+8)/255,B=Q,Y=Q;else{F-=16;let C=F%36;Q=Math.floor(F/36)/5,B=Math.floor(C/6)/5,Y=C%6/5}let J=Math.max(Q,B,Y)*2;if(J===0)return 30;let X=30+(Math.round(Y)<<2|Math.round(B)<<1|Math.round(Q));return J===2&&(X+=60),X},enumerable:!1},rgbToAnsi:{value:(F,Q,B)=>bD.ansi256ToAnsi(bD.rgbToAnsi256(F,Q,B)),enumerable:!1},hexToAnsi:{value:(F)=>bD.ansi256ToAnsi(bD.hexToAnsi256(F)),enumerable:!1}}),bD}var fY=yY(),a8=new Set(["\x1B","›"]),gY=39,N1="\x07",M3="[",$Y="]",N3="m",j1=`${$Y}8;;`,G3=(D)=>`${a8.values().next().value}${M3}${D}${N3}`,q3=(D)=>`${a8.values().next().value}${j1}${D}${N1}`,hY=(D)=>D.split(" ").map((F)=>i2(F)),L1=(D,F,Q)=>{let B=[...F],Y=!1,J=!1,X=i2(Z3(D[D.length-1]));for(let[C,z]of B.entries()){let W=i2(z);if(X+W<=Q?D[D.length-1]+=z:(D.push(z),X=0),a8.has(z)&&(Y=!0,J=B.slice(C+1).join("").startsWith(j1)),Y){J?z===N1&&(Y=!1,J=!1):z===N3&&(Y=!1);continue}X+=W,X===Q&&C<B.length-1&&(D.push(""),X=0)}!X&&D[D.length-1].length>0&&D.length>1&&(D[D.length-2]+=D.pop())},mY=(D)=>{let F=D.split(" "),Q=F.length;for(;Q>0&&!(i2(F[Q-1])>0);)Q--;return Q===F.length?D:F.slice(0,Q).join(" ")+F.slice(Q).join("")},lY=(D,F,Q={})=>{if(Q.trim!==!1&&D.trim()==="")return"";let B="",Y,J,X=hY(D),C=[""];for(let[W,G]of D.split(" ").entries()){Q.trim!==!1&&(C[C.length-1]=C[C.length-1].trimStart());let q=i2(C[C.length-1]);if(W!==0&&(q>=F&&(Q.wordWrap===!1||Q.trim===!1)&&(C.push(""),q=0),(q>0||Q.trim===!1)&&(C[C.length-1]+=" ",q++)),Q.hard&&X[W]>F){let A=F-q,U=1+Math.floor((X[W]-A-1)/F);Math.floor((X[W]-1)/F)<U&&C.push(""),L1(C,G,F);continue}if(q+X[W]>F&&q>0&&X[W]>0){if(Q.wordWrap===!1&&q<F){L1(C,G,F);continue}C.push("")}if(q+X[W]>F&&Q.wordWrap===!1){L1(C,G,F);continue}C[C.length-1]+=G}Q.trim!==!1&&(C=C.map((W)=>mY(W)));let z=[...C.join(`
330
- `)];for(let[W,G]of z.entries()){if(B+=G,a8.has(G)){let{groups:A}=new RegExp(`(?:\\${M3}(?<code>\\d+)m|\\${j1}(?<uri>.*)${N1})`).exec(z.slice(W).join(""))||{groups:{}};if(A.code!==void 0){let U=Number.parseFloat(A.code);Y=U===gY?void 0:U}else A.uri!==void 0&&(J=A.uri.length===0?void 0:A.uri)}let q=fY.codes.get(Number(Y));z[W+1]===`
329
+ `)}},W8=[x5,u5,y5]});var i9=a0(n9(),1),{program:BE,createCommand:QE,createArgument:XE,createOption:YE,CommanderError:JE,InvalidArgumentError:CE,InvalidOptionArgumentError:WE,Command:a9,Argument:zE,Option:GE,Help:qE}=i9.default;import{readFileSync as ZY,existsSync as VY}from"fs";import{join as LY,dirname as MY}from"path";import{fileURLToPath as NY}from"url";var r9="claude-mem",o9="3.9.16",s9="Memory compression system for Claude Code - persist context across sessions",t9=r9,e9=o9,D3=s9;try{let D=NY(import.meta.url),F=MY(D),Q=LY(F,"..","..","package.json");if(VY(Q)){let B=JSON.parse(ZY(Q,"utf-8"));t9=B.name||r9,e9=B.version||o9,D3=B.description||s9}}catch{}var W2=t9,F3=e9,B3=D3;import{readFileSync as G6,writeFileSync as SF,existsSync as g0,mkdirSync as Q8,copyFileSync as W7,statSync as dC,readdirSync as cC}from"fs";import{join as tD,dirname as z7}from"path";import{homedir as u4}from"os";import{execSync as C7}from"child_process";var J0=a0(E1(),1),A3=a0(Z1(),1);import{stdin as U3,stdout as E3}from"node:process";import*as wF from"node:readline";import J3 from"node:readline";import{Writable as wY}from"node:stream";function TY({onlyFirst:D=!1}={}){let F=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(F,D?void 0:"g")}var PY=TY();function Z3(D){if(typeof D!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof D}\``);return D.replace(PY,"")}function V3(D){return D&&D.__esModule&&Object.prototype.hasOwnProperty.call(D,"default")?D.default:D}var L3={exports:{}};(function(D){var F={};D.exports=F,F.eastAsianWidth=function(B){var Y=B.charCodeAt(0),J=B.length==2?B.charCodeAt(1):0,X=Y;return 55296<=Y&&Y<=56319&&56320<=J&&J<=57343&&(Y&=1023,J&=1023,X=Y<<10|J,X+=65536),X==12288||65281<=X&&X<=65376||65504<=X&&X<=65510?"F":X==8361||65377<=X&&X<=65470||65474<=X&&X<=65479||65482<=X&&X<=65487||65490<=X&&X<=65495||65498<=X&&X<=65500||65512<=X&&X<=65518?"H":4352<=X&&X<=4447||4515<=X&&X<=4519||4602<=X&&X<=4607||9001<=X&&X<=9002||11904<=X&&X<=11929||11931<=X&&X<=12019||12032<=X&&X<=12245||12272<=X&&X<=12283||12289<=X&&X<=12350||12353<=X&&X<=12438||12441<=X&&X<=12543||12549<=X&&X<=12589||12593<=X&&X<=12686||12688<=X&&X<=12730||12736<=X&&X<=12771||12784<=X&&X<=12830||12832<=X&&X<=12871||12880<=X&&X<=13054||13056<=X&&X<=19903||19968<=X&&X<=42124||42128<=X&&X<=42182||43360<=X&&X<=43388||44032<=X&&X<=55203||55216<=X&&X<=55238||55243<=X&&X<=55291||63744<=X&&X<=64255||65040<=X&&X<=65049||65072<=X&&X<=65106||65108<=X&&X<=65126||65128<=X&&X<=65131||110592<=X&&X<=110593||127488<=X&&X<=127490||127504<=X&&X<=127546||127552<=X&&X<=127560||127568<=X&&X<=127569||131072<=X&&X<=194367||177984<=X&&X<=196605||196608<=X&&X<=262141?"W":32<=X&&X<=126||162<=X&&X<=163||165<=X&&X<=166||X==172||X==175||10214<=X&&X<=10221||10629<=X&&X<=10630?"Na":X==161||X==164||167<=X&&X<=168||X==170||173<=X&&X<=174||176<=X&&X<=180||182<=X&&X<=186||188<=X&&X<=191||X==198||X==208||215<=X&&X<=216||222<=X&&X<=225||X==230||232<=X&&X<=234||236<=X&&X<=237||X==240||242<=X&&X<=243||247<=X&&X<=250||X==252||X==254||X==257||X==273||X==275||X==283||294<=X&&X<=295||X==299||305<=X&&X<=307||X==312||319<=X&&X<=322||X==324||328<=X&&X<=331||X==333||338<=X&&X<=339||358<=X&&X<=359||X==363||X==462||X==464||X==466||X==468||X==470||X==472||X==474||X==476||X==593||X==609||X==708||X==711||713<=X&&X<=715||X==717||X==720||728<=X&&X<=731||X==733||X==735||768<=X&&X<=879||913<=X&&X<=929||931<=X&&X<=937||945<=X&&X<=961||963<=X&&X<=969||X==1025||1040<=X&&X<=1103||X==1105||X==8208||8211<=X&&X<=8214||8216<=X&&X<=8217||8220<=X&&X<=8221||8224<=X&&X<=8226||8228<=X&&X<=8231||X==8240||8242<=X&&X<=8243||X==8245||X==8251||X==8254||X==8308||X==8319||8321<=X&&X<=8324||X==8364||X==8451||X==8453||X==8457||X==8467||X==8470||8481<=X&&X<=8482||X==8486||X==8491||8531<=X&&X<=8532||8539<=X&&X<=8542||8544<=X&&X<=8555||8560<=X&&X<=8569||X==8585||8592<=X&&X<=8601||8632<=X&&X<=8633||X==8658||X==8660||X==8679||X==8704||8706<=X&&X<=8707||8711<=X&&X<=8712||X==8715||X==8719||X==8721||X==8725||X==8730||8733<=X&&X<=8736||X==8739||X==8741||8743<=X&&X<=8748||X==8750||8756<=X&&X<=8759||8764<=X&&X<=8765||X==8776||X==8780||X==8786||8800<=X&&X<=8801||8804<=X&&X<=8807||8810<=X&&X<=8811||8814<=X&&X<=8815||8834<=X&&X<=8835||8838<=X&&X<=8839||X==8853||X==8857||X==8869||X==8895||X==8978||9312<=X&&X<=9449||9451<=X&&X<=9547||9552<=X&&X<=9587||9600<=X&&X<=9615||9618<=X&&X<=9621||9632<=X&&X<=9633||9635<=X&&X<=9641||9650<=X&&X<=9651||9654<=X&&X<=9655||9660<=X&&X<=9661||9664<=X&&X<=9665||9670<=X&&X<=9672||X==9675||9678<=X&&X<=9681||9698<=X&&X<=9701||X==9711||9733<=X&&X<=9734||X==9737||9742<=X&&X<=9743||9748<=X&&X<=9749||X==9756||X==9758||X==9792||X==9794||9824<=X&&X<=9825||9827<=X&&X<=9829||9831<=X&&X<=9834||9836<=X&&X<=9837||X==9839||9886<=X&&X<=9887||9918<=X&&X<=9919||9924<=X&&X<=9933||9935<=X&&X<=9953||X==9955||9960<=X&&X<=9983||X==10045||X==10071||10102<=X&&X<=10111||11093<=X&&X<=11097||12872<=X&&X<=12879||57344<=X&&X<=63743||65024<=X&&X<=65039||X==65533||127232<=X&&X<=127242||127248<=X&&X<=127277||127280<=X&&X<=127337||127344<=X&&X<=127386||917760<=X&&X<=917999||983040<=X&&X<=1048573||1048576<=X&&X<=1114109?"A":"N"},F.characterLength=function(B){var Y=this.eastAsianWidth(B);return Y=="F"||Y=="W"||Y=="A"?2:1};function Q(B){return B.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}F.length=function(B){for(var Y=Q(B),J=0,X=0;X<Y.length;X++)J=J+this.characterLength(Y[X]);return J},F.slice=function(B,Y,J){textLen=F.length(B),Y=Y||0,J=J||1,Y<0&&(Y=textLen+Y),J<0&&(J=textLen+J);for(var X="",C=0,W=Q(B),z=0;z<W.length;z++){var G=W[z],q=F.length(G);if(C>=Y-(q==2?1:0))if(C+q<=J)X+=G;else break;C+=q}return X}})(L3);var SY=L3.exports,kY=V3(SY),bY=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\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])|\uD83C[\uDF3E\uDF73\uDF7C\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\uDF7C\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\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\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\uDF7C\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\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\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\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\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-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*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\u26A7\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-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\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[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g},vY=V3(bY);function i2(D,F={}){if(typeof D!="string"||D.length===0||(F={ambiguousIsNarrow:!0,...F},D=Z3(D),D.length===0))return 0;D=D.replace(vY()," ");let Q=F.ambiguousIsNarrow?1:2,B=0;for(let Y of D){let J=Y.codePointAt(0);if(J<=31||J>=127&&J<=159||J>=768&&J<=879)continue;switch(kY.eastAsianWidth(Y)){case"F":case"W":B+=2;break;case"A":B+=Q;break;default:B+=1}}return B}var V1=10,C3=(D=0)=>(F)=>`\x1B[${F+D}m`,W3=(D=0)=>(F)=>`\x1B[${38+D};5;${F}m`,z3=(D=0)=>(F,Q,B)=>`\x1B[${38+D};2;${F};${Q};${B}m`,bD={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],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],gray:[90,39],grey:[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],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(bD.modifier);var xY=Object.keys(bD.color),uY=Object.keys(bD.bgColor);[...xY];function yY(){let D=new Map;for(let[F,Q]of Object.entries(bD)){for(let[B,Y]of Object.entries(Q))bD[B]={open:`\x1B[${Y[0]}m`,close:`\x1B[${Y[1]}m`},Q[B]=bD[B],D.set(Y[0],Y[1]);Object.defineProperty(bD,F,{value:Q,enumerable:!1})}return Object.defineProperty(bD,"codes",{value:D,enumerable:!1}),bD.color.close="\x1B[39m",bD.bgColor.close="\x1B[49m",bD.color.ansi=C3(),bD.color.ansi256=W3(),bD.color.ansi16m=z3(),bD.bgColor.ansi=C3(V1),bD.bgColor.ansi256=W3(V1),bD.bgColor.ansi16m=z3(V1),Object.defineProperties(bD,{rgbToAnsi256:{value:(F,Q,B)=>F===Q&&Q===B?F<8?16:F>248?231:Math.round((F-8)/247*24)+232:16+36*Math.round(F/255*5)+6*Math.round(Q/255*5)+Math.round(B/255*5),enumerable:!1},hexToRgb:{value:(F)=>{let Q=/[a-f\d]{6}|[a-f\d]{3}/i.exec(F.toString(16));if(!Q)return[0,0,0];let[B]=Q;B.length===3&&(B=[...B].map((J)=>J+J).join(""));let Y=Number.parseInt(B,16);return[Y>>16&255,Y>>8&255,Y&255]},enumerable:!1},hexToAnsi256:{value:(F)=>bD.rgbToAnsi256(...bD.hexToRgb(F)),enumerable:!1},ansi256ToAnsi:{value:(F)=>{if(F<8)return 30+F;if(F<16)return 90+(F-8);let Q,B,Y;if(F>=232)Q=((F-232)*10+8)/255,B=Q,Y=Q;else{F-=16;let C=F%36;Q=Math.floor(F/36)/5,B=Math.floor(C/6)/5,Y=C%6/5}let J=Math.max(Q,B,Y)*2;if(J===0)return 30;let X=30+(Math.round(Y)<<2|Math.round(B)<<1|Math.round(Q));return J===2&&(X+=60),X},enumerable:!1},rgbToAnsi:{value:(F,Q,B)=>bD.ansi256ToAnsi(bD.rgbToAnsi256(F,Q,B)),enumerable:!1},hexToAnsi:{value:(F)=>bD.ansi256ToAnsi(bD.hexToAnsi256(F)),enumerable:!1}}),bD}var fY=yY(),a8=new Set(["\x1B","›"]),gY=39,N1="\x07",M3="[",$Y="]",N3="m",j1=`${$Y}8;;`,G3=(D)=>`${a8.values().next().value}${M3}${D}${N3}`,q3=(D)=>`${a8.values().next().value}${j1}${D}${N1}`,hY=(D)=>D.split(" ").map((F)=>i2(F)),L1=(D,F,Q)=>{let B=[...F],Y=!1,J=!1,X=i2(Z3(D[D.length-1]));for(let[C,W]of B.entries()){let z=i2(W);if(X+z<=Q?D[D.length-1]+=W:(D.push(W),X=0),a8.has(W)&&(Y=!0,J=B.slice(C+1).join("").startsWith(j1)),Y){J?W===N1&&(Y=!1,J=!1):W===N3&&(Y=!1);continue}X+=z,X===Q&&C<B.length-1&&(D.push(""),X=0)}!X&&D[D.length-1].length>0&&D.length>1&&(D[D.length-2]+=D.pop())},mY=(D)=>{let F=D.split(" "),Q=F.length;for(;Q>0&&!(i2(F[Q-1])>0);)Q--;return Q===F.length?D:F.slice(0,Q).join(" ")+F.slice(Q).join("")},lY=(D,F,Q={})=>{if(Q.trim!==!1&&D.trim()==="")return"";let B="",Y,J,X=hY(D),C=[""];for(let[z,G]of D.split(" ").entries()){Q.trim!==!1&&(C[C.length-1]=C[C.length-1].trimStart());let q=i2(C[C.length-1]);if(z!==0&&(q>=F&&(Q.wordWrap===!1||Q.trim===!1)&&(C.push(""),q=0),(q>0||Q.trim===!1)&&(C[C.length-1]+=" ",q++)),Q.hard&&X[z]>F){let A=F-q,U=1+Math.floor((X[z]-A-1)/F);Math.floor((X[z]-1)/F)<U&&C.push(""),L1(C,G,F);continue}if(q+X[z]>F&&q>0&&X[z]>0){if(Q.wordWrap===!1&&q<F){L1(C,G,F);continue}C.push("")}if(q+X[z]>F&&Q.wordWrap===!1){L1(C,G,F);continue}C[C.length-1]+=G}Q.trim!==!1&&(C=C.map((z)=>mY(z)));let W=[...C.join(`
330
+ `)];for(let[z,G]of W.entries()){if(B+=G,a8.has(G)){let{groups:A}=new RegExp(`(?:\\${M3}(?<code>\\d+)m|\\${j1}(?<uri>.*)${N1})`).exec(W.slice(z).join(""))||{groups:{}};if(A.code!==void 0){let U=Number.parseFloat(A.code);Y=U===gY?void 0:U}else A.uri!==void 0&&(J=A.uri.length===0?void 0:A.uri)}let q=fY.codes.get(Number(Y));W[z+1]===`
331
331
  `?(J&&(B+=q3("")),Y&&q&&(B+=G3(q))):G===`
332
332
  `&&(Y&&q&&(B+=G3(Y)),J&&(B+=q3(J)))}return B};function H3(D,F,Q){return String(D).normalize().replace(/\r\n/g,`
333
333
  `).split(`
334
334
  `).map((B)=>lY(B,F,Q)).join(`
335
335
  `)}var dY=["up","down","left","right","space","enter","cancel"],i8={actions:new Set(dY),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["\x03","cancel"],["escape","cancel"]])};function R1(D,F){if(typeof D=="string")return i8.aliases.get(D)===F;for(let Q of D)if(Q!==void 0&&R1(Q,F))return!0;return!1}function cY(D,F){if(D===F)return;let Q=D.split(`
336
336
  `),B=F.split(`
337
- `),Y=[];for(let J=0;J<Math.max(Q.length,B.length);J++)Q[J]!==B[J]&&Y.push(J);return Y}var pY=globalThis.process.platform.startsWith("win"),M1=Symbol("clack:cancel");function y0(D){return D===M1}function n8(D,F){let Q=D;Q.isTTY&&Q.setRawMode(F)}function j3({input:D=U3,output:F=E3,overwrite:Q=!0,hideCursor:B=!0}={}){let Y=wF.createInterface({input:D,output:F,prompt:"",tabSize:1});wF.emitKeypressEvents(D,Y),D.isTTY&&D.setRawMode(!0);let J=(X,{name:C,sequence:z})=>{let W=String(X);if(R1([W,C,z],"cancel")){B&&F.write(J0.cursor.show),process.exit(0);return}if(!Q)return;wF.moveCursor(F,C==="return"?0:-1,C==="return"?-1:0,()=>{wF.clearLine(F,1,()=>{D.once("keypress",J)})})};return B&&F.write(J0.cursor.hide),D.once("keypress",J),()=>{D.off("keypress",J),B&&F.write(J0.cursor.show),D.isTTY&&!pY&&D.setRawMode(!1),Y.terminal=!1,Y.close()}}var nY=Object.defineProperty,iY=(D,F,Q)=>(F in D)?nY(D,F,{enumerable:!0,configurable:!0,writable:!0,value:Q}):D[F]=Q,I0=(D,F,Q)=>(iY(D,typeof F!="symbol"?F+"":F,Q),Q);class r8{constructor(D,F=!0){I0(this,"input"),I0(this,"output"),I0(this,"_abortSignal"),I0(this,"rl"),I0(this,"opts"),I0(this,"_render"),I0(this,"_track",!1),I0(this,"_prevFrame",""),I0(this,"_subscribers",new Map),I0(this,"_cursor",0),I0(this,"state","initial"),I0(this,"error",""),I0(this,"value");let{input:Q=U3,output:B=E3,render:Y,signal:J,...X}=D;this.opts=X,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=Y.bind(this),this._track=F,this._abortSignal=J,this.input=Q,this.output=B}unsubscribe(){this._subscribers.clear()}setSubscriber(D,F){let Q=this._subscribers.get(D)??[];Q.push(F),this._subscribers.set(D,Q)}on(D,F){this.setSubscriber(D,{cb:F})}once(D,F){this.setSubscriber(D,{cb:F,once:!0})}emit(D,...F){let Q=this._subscribers.get(D)??[],B=[];for(let Y of Q)Y.cb(...F),Y.once&&B.push(()=>Q.splice(Q.indexOf(Y),1));for(let Y of B)Y()}prompt(){return new Promise((D,F)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),D(M1);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}let Q=new wY;Q._write=(B,Y,J)=>{this._track&&(this.value=this.rl?.line.replace(/\t/g,""),this._cursor=this.rl?.cursor??0,this.emit("value",this.value)),J()},this.input.pipe(Q),this.rl=J3.createInterface({input:this.input,output:Q,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),J3.emitKeypressEvents(this.input,this.rl),this.rl.prompt(),this.opts.initialValue!==void 0&&this._track&&this.rl.write(this.opts.initialValue),this.input.on("keypress",this.onKeypress),n8(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(J0.cursor.show),this.output.off("resize",this.render),n8(this.input,!1),D(this.value)}),this.once("cancel",()=>{this.output.write(J0.cursor.show),this.output.off("resize",this.render),n8(this.input,!1),D(M1)})})}onKeypress(D,F){if(this.state==="error"&&(this.state="active"),F?.name&&(!this._track&&i8.aliases.has(F.name)&&this.emit("cursor",i8.aliases.get(F.name)),i8.actions.has(F.name)&&this.emit("cursor",F.name)),D&&(D.toLowerCase()==="y"||D.toLowerCase()==="n")&&this.emit("confirm",D.toLowerCase()==="y"),D==="\t"&&this.opts.placeholder&&(this.value||(this.rl?.write(this.opts.placeholder),this.emit("value",this.opts.placeholder))),D&&this.emit("key",D.toLowerCase()),F?.name==="return"){if(this.opts.validate){let Q=this.opts.validate(this.value);Q&&(this.error=Q instanceof Error?Q.message:Q,this.state="error",this.rl?.write(this.value))}this.state!=="error"&&(this.state="submit")}R1([D,F?.name,F?.sequence],"cancel")&&(this.state="cancel"),(this.state==="submit"||this.state==="cancel")&&this.emit("finalize"),this.render(),(this.state==="submit"||this.state==="cancel")&&this.close()}close(){this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(`
337
+ `),Y=[];for(let J=0;J<Math.max(Q.length,B.length);J++)Q[J]!==B[J]&&Y.push(J);return Y}var pY=globalThis.process.platform.startsWith("win"),M1=Symbol("clack:cancel");function y0(D){return D===M1}function n8(D,F){let Q=D;Q.isTTY&&Q.setRawMode(F)}function j3({input:D=U3,output:F=E3,overwrite:Q=!0,hideCursor:B=!0}={}){let Y=wF.createInterface({input:D,output:F,prompt:"",tabSize:1});wF.emitKeypressEvents(D,Y),D.isTTY&&D.setRawMode(!0);let J=(X,{name:C,sequence:W})=>{let z=String(X);if(R1([z,C,W],"cancel")){B&&F.write(J0.cursor.show),process.exit(0);return}if(!Q)return;wF.moveCursor(F,C==="return"?0:-1,C==="return"?-1:0,()=>{wF.clearLine(F,1,()=>{D.once("keypress",J)})})};return B&&F.write(J0.cursor.hide),D.once("keypress",J),()=>{D.off("keypress",J),B&&F.write(J0.cursor.show),D.isTTY&&!pY&&D.setRawMode(!1),Y.terminal=!1,Y.close()}}var nY=Object.defineProperty,iY=(D,F,Q)=>(F in D)?nY(D,F,{enumerable:!0,configurable:!0,writable:!0,value:Q}):D[F]=Q,I0=(D,F,Q)=>(iY(D,typeof F!="symbol"?F+"":F,Q),Q);class r8{constructor(D,F=!0){I0(this,"input"),I0(this,"output"),I0(this,"_abortSignal"),I0(this,"rl"),I0(this,"opts"),I0(this,"_render"),I0(this,"_track",!1),I0(this,"_prevFrame",""),I0(this,"_subscribers",new Map),I0(this,"_cursor",0),I0(this,"state","initial"),I0(this,"error",""),I0(this,"value");let{input:Q=U3,output:B=E3,render:Y,signal:J,...X}=D;this.opts=X,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=Y.bind(this),this._track=F,this._abortSignal=J,this.input=Q,this.output=B}unsubscribe(){this._subscribers.clear()}setSubscriber(D,F){let Q=this._subscribers.get(D)??[];Q.push(F),this._subscribers.set(D,Q)}on(D,F){this.setSubscriber(D,{cb:F})}once(D,F){this.setSubscriber(D,{cb:F,once:!0})}emit(D,...F){let Q=this._subscribers.get(D)??[],B=[];for(let Y of Q)Y.cb(...F),Y.once&&B.push(()=>Q.splice(Q.indexOf(Y),1));for(let Y of B)Y()}prompt(){return new Promise((D,F)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),D(M1);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}let Q=new wY;Q._write=(B,Y,J)=>{this._track&&(this.value=this.rl?.line.replace(/\t/g,""),this._cursor=this.rl?.cursor??0,this.emit("value",this.value)),J()},this.input.pipe(Q),this.rl=J3.createInterface({input:this.input,output:Q,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),J3.emitKeypressEvents(this.input,this.rl),this.rl.prompt(),this.opts.initialValue!==void 0&&this._track&&this.rl.write(this.opts.initialValue),this.input.on("keypress",this.onKeypress),n8(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(J0.cursor.show),this.output.off("resize",this.render),n8(this.input,!1),D(this.value)}),this.once("cancel",()=>{this.output.write(J0.cursor.show),this.output.off("resize",this.render),n8(this.input,!1),D(M1)})})}onKeypress(D,F){if(this.state==="error"&&(this.state="active"),F?.name&&(!this._track&&i8.aliases.has(F.name)&&this.emit("cursor",i8.aliases.get(F.name)),i8.actions.has(F.name)&&this.emit("cursor",F.name)),D&&(D.toLowerCase()==="y"||D.toLowerCase()==="n")&&this.emit("confirm",D.toLowerCase()==="y"),D==="\t"&&this.opts.placeholder&&(this.value||(this.rl?.write(this.opts.placeholder),this.emit("value",this.opts.placeholder))),D&&this.emit("key",D.toLowerCase()),F?.name==="return"){if(this.opts.validate){let Q=this.opts.validate(this.value);Q&&(this.error=Q instanceof Error?Q.message:Q,this.state="error",this.rl?.write(this.value))}this.state!=="error"&&(this.state="submit")}R1([D,F?.name,F?.sequence],"cancel")&&(this.state="cancel"),(this.state==="submit"||this.state==="cancel")&&this.emit("finalize"),this.render(),(this.state==="submit"||this.state==="cancel")&&this.close()}close(){this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(`
338
338
  `),n8(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let D=H3(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
339
339
  `).length-1;this.output.write(J0.cursor.move(-999,D*-1))}render(){let D=H3(this._render(this)??"",process.stdout.columns,{hard:!0});if(D!==this._prevFrame){if(this.state==="initial")this.output.write(J0.cursor.hide);else{let F=cY(this._prevFrame,D);if(this.restoreCursor(),F&&F?.length===1){let Q=F[0];this.output.write(J0.cursor.move(0,Q)),this.output.write(J0.erase.lines(1));let B=D.split(`
340
340
  `);this.output.write(B[Q]),this._prevFrame=D,this.output.write(J0.cursor.move(0,B.length-Q-1));return}if(F&&F?.length>1){let Q=F[0];this.output.write(J0.cursor.move(0,Q)),this.output.write(J0.erase.down());let B=D.split(`
341
341
  `).slice(Q);this.output.write(B.join(`
342
- `)),this._prevFrame=D;return}this.output.write(J0.erase.down())}this.output.write(D),this.state==="initial"&&(this.state="active"),this._prevFrame=D}}}class _1 extends r8{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(D){super(D,!1),this.value=!!D.initialValue,this.on("value",()=>{this.value=this._value}),this.on("confirm",(F)=>{this.output.write(J0.cursor.move(0,-1)),this.value=F,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}}var aY;aY=new WeakMap;var rY=Object.defineProperty,oY=(D,F,Q)=>(F in D)?rY(D,F,{enumerable:!0,configurable:!0,writable:!0,value:Q}):D[F]=Q,K3=(D,F,Q)=>(oY(D,typeof F!="symbol"?F+"":F,Q),Q);class O1 extends r8{constructor(D){super(D,!1),K3(this,"options"),K3(this,"cursor",0),this.options=D.options,this.cursor=this.options.findIndex(({value:F})=>F===D.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on("cursor",(F)=>{switch(F){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break}this.changeValue()})}get _value(){return this.options[this.cursor]}changeValue(){this.value=this._value.value}}class I1 extends r8{get valueWithCursor(){if(this.state==="submit")return this.value;if(this.cursor>=this.value.length)return`${this.value}█`;let D=this.value.slice(0,this.cursor),[F,...Q]=this.value.slice(this.cursor);return`${D}${A3.default.inverse(F)}${Q.join("")}`}get cursor(){return this._cursor}constructor(D){super(D),this.on("finalize",()=>{this.value||(this.value=D.defaultValue)})}}var e=a0(Z1(),1),o8=a0(E1(),1);import r0 from"node:process";function sY(){return r0.platform!=="win32"?r0.env.TERM!=="linux":!!r0.env.CI||!!r0.env.WT_SESSION||!!r0.env.TERMINUS_SUBLIME||r0.env.ConEmuTask==="{cmd::Cmder}"||r0.env.TERM_PROGRAM==="Terminus-Sublime"||r0.env.TERM_PROGRAM==="vscode"||r0.env.TERM==="xterm-256color"||r0.env.TERM==="alacritty"||r0.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var w1=sY(),pD=(D,F)=>w1?D:F,tY=pD("◆","*"),R3=pD("■","x"),_3=pD("▲","x"),S1=pD("◇","o"),SE=pD("┌","T"),lD=pD("│","|"),a2=pD("└","—"),T1=pD("●",">"),P1=pD("○"," "),kE=pD("◻","[•]"),bE=pD("◼","[+]"),vE=pD("◻","[ ]"),xE=pD("▪","•"),uE=pD("─","-"),yE=pD("╮","+"),fE=pD("├","+"),gE=pD("╯","+"),eY=pD("●","•"),DJ=pD("◆","*"),FJ=pD("▲","!"),BJ=pD("■","x"),k1=(D)=>{switch(D){case"initial":case"active":return e.default.cyan(tY);case"cancel":return e.default.red(R3);case"error":return e.default.yellow(_3);case"submit":return e.default.green(S1)}},QJ=(D)=>{let{cursor:F,options:Q,style:B}=D,Y=D.maxItems??Number.POSITIVE_INFINITY,J=Math.max(process.stdout.rows-4,0),X=Math.min(J,Math.max(Y,5)),C=0;F>=C+X-3?C=Math.max(Math.min(F-X+3,Q.length-X),0):F<C+2&&(C=Math.max(F-2,0));let z=X<Q.length&&C>0,W=X<Q.length&&C+X<Q.length;return Q.slice(C,C+X).map((G,q,A)=>{let U=q===0&&z,Z=q===A.length-1&&W;return U||Z?e.default.dim("..."):B(G,q+C===F)})},O3=(D)=>new I1({validate:D.validate,placeholder:D.placeholder,defaultValue:D.defaultValue,initialValue:D.initialValue,render(){let F=`${e.default.gray(lD)}
342
+ `)),this._prevFrame=D;return}this.output.write(J0.erase.down())}this.output.write(D),this.state==="initial"&&(this.state="active"),this._prevFrame=D}}}class _1 extends r8{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(D){super(D,!1),this.value=!!D.initialValue,this.on("value",()=>{this.value=this._value}),this.on("confirm",(F)=>{this.output.write(J0.cursor.move(0,-1)),this.value=F,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}}var aY;aY=new WeakMap;var rY=Object.defineProperty,oY=(D,F,Q)=>(F in D)?rY(D,F,{enumerable:!0,configurable:!0,writable:!0,value:Q}):D[F]=Q,K3=(D,F,Q)=>(oY(D,typeof F!="symbol"?F+"":F,Q),Q);class O1 extends r8{constructor(D){super(D,!1),K3(this,"options"),K3(this,"cursor",0),this.options=D.options,this.cursor=this.options.findIndex(({value:F})=>F===D.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on("cursor",(F)=>{switch(F){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break}this.changeValue()})}get _value(){return this.options[this.cursor]}changeValue(){this.value=this._value.value}}class I1 extends r8{get valueWithCursor(){if(this.state==="submit")return this.value;if(this.cursor>=this.value.length)return`${this.value}█`;let D=this.value.slice(0,this.cursor),[F,...Q]=this.value.slice(this.cursor);return`${D}${A3.default.inverse(F)}${Q.join("")}`}get cursor(){return this._cursor}constructor(D){super(D),this.on("finalize",()=>{this.value||(this.value=D.defaultValue)})}}var e=a0(Z1(),1),o8=a0(E1(),1);import r0 from"node:process";function sY(){return r0.platform!=="win32"?r0.env.TERM!=="linux":!!r0.env.CI||!!r0.env.WT_SESSION||!!r0.env.TERMINUS_SUBLIME||r0.env.ConEmuTask==="{cmd::Cmder}"||r0.env.TERM_PROGRAM==="Terminus-Sublime"||r0.env.TERM_PROGRAM==="vscode"||r0.env.TERM==="xterm-256color"||r0.env.TERM==="alacritty"||r0.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var w1=sY(),pD=(D,F)=>w1?D:F,tY=pD("◆","*"),R3=pD("■","x"),_3=pD("▲","x"),S1=pD("◇","o"),SE=pD("┌","T"),lD=pD("│","|"),a2=pD("└","—"),T1=pD("●",">"),P1=pD("○"," "),kE=pD("◻","[•]"),bE=pD("◼","[+]"),vE=pD("◻","[ ]"),xE=pD("▪","•"),uE=pD("─","-"),yE=pD("╮","+"),fE=pD("├","+"),gE=pD("╯","+"),eY=pD("●","•"),DJ=pD("◆","*"),FJ=pD("▲","!"),BJ=pD("■","x"),k1=(D)=>{switch(D){case"initial":case"active":return e.default.cyan(tY);case"cancel":return e.default.red(R3);case"error":return e.default.yellow(_3);case"submit":return e.default.green(S1)}},QJ=(D)=>{let{cursor:F,options:Q,style:B}=D,Y=D.maxItems??Number.POSITIVE_INFINITY,J=Math.max(process.stdout.rows-4,0),X=Math.min(J,Math.max(Y,5)),C=0;F>=C+X-3?C=Math.max(Math.min(F-X+3,Q.length-X),0):F<C+2&&(C=Math.max(F-2,0));let W=X<Q.length&&C>0,z=X<Q.length&&C+X<Q.length;return Q.slice(C,C+X).map((G,q,A)=>{let U=q===0&&W,Z=q===A.length-1&&z;return U||Z?e.default.dim("..."):B(G,q+C===F)})},O3=(D)=>new I1({validate:D.validate,placeholder:D.placeholder,defaultValue:D.defaultValue,initialValue:D.initialValue,render(){let F=`${e.default.gray(lD)}
343
343
  ${k1(this.state)} ${D.message}
344
344
  `,Q=D.placeholder?e.default.inverse(D.placeholder[0])+e.default.dim(D.placeholder.slice(1)):e.default.inverse(e.default.hidden("_")),B=this.value?this.valueWithCursor:Q;switch(this.state){case"error":return`${F.trim()}
345
345
  ${e.default.yellow(lD)} ${B}
@@ -363,20 +363,20 @@ ${e.default.cyan(a2)}
363
363
  `)};var K0={message:(D="",{symbol:F=e.default.gray(lD)}={})=>{let Q=[`${e.default.gray(lD)}`];if(D){let[B,...Y]=D.split(`
364
364
  `);Q.push(`${F} ${B}`,...Y.map((J)=>`${e.default.gray(lD)} ${J}`))}process.stdout.write(`${Q.join(`
365
365
  `)}
366
- `)},info:(D)=>{K0.message(D,{symbol:e.default.blue(eY)})},success:(D)=>{K0.message(D,{symbol:e.default.green(DJ)})},step:(D)=>{K0.message(D,{symbol:e.default.green(S1)})},warn:(D)=>{K0.message(D,{symbol:e.default.yellow(FJ)})},warning:(D)=>{K0.warn(D)},error:(D)=>{K0.message(D,{symbol:e.default.red(BJ)})}},$E=`${e.default.gray(lD)} `;var I3=({indicator:D="dots"}={})=>{let F=w1?["◒","◐","◓","◑"]:["•","o","O","0"],Q=w1?80:120,B=process.env.CI==="true",Y,J,X=!1,C="",z,W=performance.now(),G=(k)=>{let b=k>1?"Something went wrong":"Canceled";X&&R(b,k)},q=()=>G(2),A=()=>G(1),U=()=>{process.on("uncaughtExceptionMonitor",q),process.on("unhandledRejection",q),process.on("SIGINT",A),process.on("SIGTERM",A),process.on("exit",G)},Z=()=>{process.removeListener("uncaughtExceptionMonitor",q),process.removeListener("unhandledRejection",q),process.removeListener("SIGINT",A),process.removeListener("SIGTERM",A),process.removeListener("exit",G)},H=()=>{if(z===void 0)return;B&&process.stdout.write(`
367
- `);let k=z.split(`
368
- `);process.stdout.write(o8.cursor.move(-999,k.length-1)),process.stdout.write(o8.erase.down(k.length))},V=(k)=>k.replace(/\.+$/,""),N=(k)=>{let b=(performance.now()-k)/1000,I=Math.floor(b/60),u=Math.floor(b%60);return I>0?`[${I}m ${u}s]`:`[${u}s]`},L=(k="")=>{X=!0,Y=j3(),C=V(k),W=performance.now(),process.stdout.write(`${e.default.gray(lD)}
369
- `);let b=0,I=0;U(),J=setInterval(()=>{if(B&&C===z)return;H(),z=C;let u=e.default.magenta(F[b]);if(B)process.stdout.write(`${u} ${C}...`);else if(D==="timer")process.stdout.write(`${u} ${C} ${N(W)}`);else{let f=".".repeat(Math.floor(I)).slice(0,3);process.stdout.write(`${u} ${C}${f}`)}b=b+1<F.length?b+1:0,I=I<F.length?I+0.125:0},Q)},R=(k="",b=0)=>{X=!1,clearInterval(J),H();let I=b===0?e.default.green(S1):b===1?e.default.red(R3):e.default.red(_3);C=V(k??C),D==="timer"?process.stdout.write(`${I} ${C} ${N(W)}
366
+ `)},info:(D)=>{K0.message(D,{symbol:e.default.blue(eY)})},success:(D)=>{K0.message(D,{symbol:e.default.green(DJ)})},step:(D)=>{K0.message(D,{symbol:e.default.green(S1)})},warn:(D)=>{K0.message(D,{symbol:e.default.yellow(FJ)})},warning:(D)=>{K0.warn(D)},error:(D)=>{K0.message(D,{symbol:e.default.red(BJ)})}},$E=`${e.default.gray(lD)} `;var I3=({indicator:D="dots"}={})=>{let F=w1?["◒","◐","◓","◑"]:["•","o","O","0"],Q=w1?80:120,B=process.env.CI==="true",Y,J,X=!1,C="",W,z=performance.now(),G=(k)=>{let b=k>1?"Something went wrong":"Canceled";X&&R(b,k)},q=()=>G(2),A=()=>G(1),U=()=>{process.on("uncaughtExceptionMonitor",q),process.on("unhandledRejection",q),process.on("SIGINT",A),process.on("SIGTERM",A),process.on("exit",G)},Z=()=>{process.removeListener("uncaughtExceptionMonitor",q),process.removeListener("unhandledRejection",q),process.removeListener("SIGINT",A),process.removeListener("SIGTERM",A),process.removeListener("exit",G)},H=()=>{if(W===void 0)return;B&&process.stdout.write(`
367
+ `);let k=W.split(`
368
+ `);process.stdout.write(o8.cursor.move(-999,k.length-1)),process.stdout.write(o8.erase.down(k.length))},V=(k)=>k.replace(/\.+$/,""),j=(k)=>{let b=(performance.now()-k)/1000,I=Math.floor(b/60),u=Math.floor(b%60);return I>0?`[${I}m ${u}s]`:`[${u}s]`},L=(k="")=>{X=!0,Y=j3(),C=V(k),z=performance.now(),process.stdout.write(`${e.default.gray(lD)}
369
+ `);let b=0,I=0;U(),J=setInterval(()=>{if(B&&C===W)return;H(),W=C;let u=e.default.magenta(F[b]);if(B)process.stdout.write(`${u} ${C}...`);else if(D==="timer")process.stdout.write(`${u} ${C} ${j(z)}`);else{let f=".".repeat(Math.floor(I)).slice(0,3);process.stdout.write(`${u} ${C}${f}`)}b=b+1<F.length?b+1:0,I=I<F.length?I+0.125:0},Q)},R=(k="",b=0)=>{X=!1,clearInterval(J),H();let I=b===0?e.default.green(S1):b===1?e.default.red(R3):e.default.red(_3);C=V(k??C),D==="timer"?process.stdout.write(`${I} ${C} ${j(z)}
370
370
  `):process.stdout.write(`${I} ${C}
371
371
  `),Z(),Y()};return{start:L,stop:R,message:(k="")=>{C=V(k??C)}}};var w3=(D=0)=>(F)=>`\x1B[${F+D}m`,T3=(D=0)=>(F)=>`\x1B[${38+D};5;${F}m`,P3=(D=0)=>(F,Q,B)=>`\x1B[${38+D};2;${F};${Q};${B}m`,vD={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],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],gray:[90,39],grey:[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],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},mE=Object.keys(vD.modifier),XJ=Object.keys(vD.color),YJ=Object.keys(vD.bgColor),lE=[...XJ,...YJ];function JJ(){let D=new Map;for(let[F,Q]of Object.entries(vD)){for(let[B,Y]of Object.entries(Q))vD[B]={open:`\x1B[${Y[0]}m`,close:`\x1B[${Y[1]}m`},Q[B]=vD[B],D.set(Y[0],Y[1]);Object.defineProperty(vD,F,{value:Q,enumerable:!1})}return Object.defineProperty(vD,"codes",{value:D,enumerable:!1}),vD.color.close="\x1B[39m",vD.bgColor.close="\x1B[49m",vD.color.ansi=w3(),vD.color.ansi256=T3(),vD.color.ansi16m=P3(),vD.bgColor.ansi=w3(10),vD.bgColor.ansi256=T3(10),vD.bgColor.ansi16m=P3(10),Object.defineProperties(vD,{rgbToAnsi256:{value(F,Q,B){if(F===Q&&Q===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(Q/255*5)+Math.round(B/255*5)},enumerable:!1},hexToRgb:{value(F){let Q=/[a-f\d]{6}|[a-f\d]{3}/i.exec(F.toString(16));if(!Q)return[0,0,0];let[B]=Q;if(B.length===3)B=[...B].map((J)=>J+J).join("");let Y=Number.parseInt(B,16);return[Y>>16&255,Y>>8&255,Y&255]},enumerable:!1},hexToAnsi256:{value:(F)=>vD.rgbToAnsi256(...vD.hexToRgb(F)),enumerable:!1},ansi256ToAnsi:{value(F){if(F<8)return 30+F;if(F<16)return 90+(F-8);let Q,B,Y;if(F>=232)Q=((F-232)*10+8)/255,B=Q,Y=Q;else{F-=16;let C=F%36;Q=Math.floor(F/36)/5,B=Math.floor(C/6)/5,Y=C%6/5}let J=Math.max(Q,B,Y)*2;if(J===0)return 30;let X=30+(Math.round(Y)<<2|Math.round(B)<<1|Math.round(Q));if(J===2)X+=60;return X},enumerable:!1},rgbToAnsi:{value:(F,Q,B)=>vD.ansi256ToAnsi(vD.rgbToAnsi256(F,Q,B)),enumerable:!1},hexToAnsi:{value:(F)=>vD.ansi256ToAnsi(vD.hexToAnsi256(F)),enumerable:!1}}),vD}var CJ=JJ(),o0=CJ;import b1 from"node:process";import WJ from"node:os";import S3 from"node:tty";function f0(D,F=globalThis.Deno?globalThis.Deno.args:b1.argv){let Q=D.startsWith("-")?"":D.length===1?"-":"--",B=F.indexOf(Q+D),Y=F.indexOf("--");return B!==-1&&(Y===-1||B<Y)}var{env:xD}=b1,e8;if(f0("no-color")||f0("no-colors")||f0("color=false")||f0("color=never"))e8=0;else if(f0("color")||f0("colors")||f0("color=true")||f0("color=always"))e8=1;function zJ(){if("FORCE_COLOR"in xD){if(xD.FORCE_COLOR==="true")return 1;if(xD.FORCE_COLOR==="false")return 0;return xD.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(xD.FORCE_COLOR,10),3)}}function GJ(D){if(D===0)return!1;return{level:D,hasBasic:!0,has256:D>=2,has16m:D>=3}}function qJ(D,{streamIsTTY:F,sniffFlags:Q=!0}={}){let B=zJ();if(B!==void 0)e8=B;let Y=Q?e8:B;if(Y===0)return 0;if(Q){if(f0("color=16m")||f0("color=full")||f0("color=truecolor"))return 3;if(f0("color=256"))return 2}if("TF_BUILD"in xD&&"AGENT_NAME"in xD)return 1;if(D&&!F&&Y===void 0)return 0;let J=Y||0;if(xD.TERM==="dumb")return J;if(b1.platform==="win32"){let X=WJ.release().split(".");if(Number(X[0])>=10&&Number(X[2])>=10586)return Number(X[2])>=14931?3:2;return 1}if("CI"in xD){if(["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some((X)=>(X in xD)))return 3;if(["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some((X)=>(X in xD))||xD.CI_NAME==="codeship")return 1;return J}if("TEAMCITY_VERSION"in xD)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(xD.TEAMCITY_VERSION)?1:0;if(xD.COLORTERM==="truecolor")return 3;if(xD.TERM==="xterm-kitty")return 3;if(xD.TERM==="xterm-ghostty")return 3;if(xD.TERM==="wezterm")return 3;if("TERM_PROGRAM"in xD){let X=Number.parseInt((xD.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(xD.TERM_PROGRAM){case"iTerm.app":return X>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(xD.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(xD.TERM))return 1;if("COLORTERM"in xD)return 1;return J}function k3(D,F={}){let Q=qJ(D,{streamIsTTY:D&&D.isTTY,...F});return GJ(Q)}var HJ={stdout:k3({isTTY:S3.isatty(1)}),stderr:k3({isTTY:S3.isatty(2)})},b3=HJ;function v3(D,F,Q){let B=D.indexOf(F);if(B===-1)return D;let Y=F.length,J=0,X="";do X+=D.slice(J,B)+F+Q,J=B+Y,B=D.indexOf(F,J);while(B!==-1);return X+=D.slice(J),X}function x3(D,F,Q,B){let Y=0,J="";do{let X=D[B-1]==="\r";J+=D.slice(Y,X?B-1:B)+F+(X?`\r
372
372
  `:`
373
373
  `)+Q,Y=B+1,B=D.indexOf(`
374
374
  `,Y)}while(B!==-1);return J+=D.slice(Y),J}var{stdout:u3,stderr:y3}=b3,v1=Symbol("GENERATOR"),q2=Symbol("STYLER"),r2=Symbol("IS_EMPTY"),f3=["ansi","ansi","ansi256","ansi16m"],H2=Object.create(null),KJ=(D,F={})=>{if(F.level&&!(Number.isInteger(F.level)&&F.level>=0&&F.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let Q=u3?u3.level:0;D.level=F.level===void 0?Q:F.level};var UJ=(D)=>{let F=(...Q)=>Q.join(" ");return KJ(F,D),Object.setPrototypeOf(F,o2.prototype),F};function o2(D){return UJ(D)}Object.setPrototypeOf(o2.prototype,Function.prototype);for(let[D,F]of Object.entries(o0))H2[D]={get(){let Q=D6(this,u1(F.open,F.close,this[q2]),this[r2]);return Object.defineProperty(this,D,{value:Q}),Q}};H2.visible={get(){let D=D6(this,this[q2],!0);return Object.defineProperty(this,"visible",{value:D}),D}};var x1=(D,F,Q,...B)=>{if(D==="rgb"){if(F==="ansi16m")return o0[Q].ansi16m(...B);if(F==="ansi256")return o0[Q].ansi256(o0.rgbToAnsi256(...B));return o0[Q].ansi(o0.rgbToAnsi(...B))}if(D==="hex")return x1("rgb",F,Q,...o0.hexToRgb(...B));return o0[Q][D](...B)},EJ=["rgb","hex","ansi256"];for(let D of EJ){H2[D]={get(){let{level:Q}=this;return function(...B){let Y=u1(x1(D,f3[Q],"color",...B),o0.color.close,this[q2]);return D6(this,Y,this[r2])}}};let F="bg"+D[0].toUpperCase()+D.slice(1);H2[F]={get(){let{level:Q}=this;return function(...B){let Y=u1(x1(D,f3[Q],"bgColor",...B),o0.bgColor.close,this[q2]);return D6(this,Y,this[r2])}}}}var AJ=Object.defineProperties(()=>{},{...H2,level:{enumerable:!0,get(){return this[v1].level},set(D){this[v1].level=D}}}),u1=(D,F,Q)=>{let B,Y;if(Q===void 0)B=D,Y=F;else B=Q.openAll+D,Y=F+Q.closeAll;return{open:D,close:F,openAll:B,closeAll:Y,parent:Q}},D6=(D,F,Q)=>{let B=(...Y)=>ZJ(B,Y.length===1?""+Y[0]:Y.join(" "));return Object.setPrototypeOf(B,AJ),B[v1]=D,B[q2]=F,B[r2]=Q,B},ZJ=(D,F)=>{if(D.level<=0||!F)return D[r2]?"":F;let Q=D[q2];if(Q===void 0)return F;let{openAll:B,closeAll:Y}=Q;if(F.includes("\x1B"))while(Q!==void 0)F=v3(F,Q.close,Q.open),Q=Q.parent;let J=F.indexOf(`
375
375
  `);if(J!==-1)F=x3(F,Y,B,J);return B+F+Y};Object.defineProperties(o2.prototype,H2);var VJ=o2(),tE=o2({level:y3?y3.level:0});var HD=VJ;var m1=a0(p3(),1),C0=(...D)=>{let F,Q;if(D.length===0)throw new Error("Missing gradient colors");if(!Array.isArray(D[0])){if(D.length===1)throw new Error(`Expected an array of colors, received ${JSON.stringify(D[0])}`);F=m1.default(...D)}else F=m1.default(D[0]),Q=l1(D[1]);let B=(Y,J)=>{return LJ(Y?Y.toString():"",F,J??Q)};return B.multiline=(Y,J)=>MJ(Y?Y.toString():"",F,J??Q),B},n3=(D,F,Q)=>{return F.interpolation?.toLowerCase()==="hsv"?D.hsv(Q,F.hsvSpin?.toLowerCase()||!1):D.rgb(Q)};function LJ(D,F,Q){let B=l1(Q),Y=Math.max(D.replace(/\s/g,"").length,F.stops.length),J=n3(F,B,Y),X="";for(let C of D)X+=C.match(/\s/g)?C:HD.hex(J.shift()?.toHex()||"#000")(C);return X}function MJ(D,F,Q){let B=l1(Q),Y=D.split(`
376
- `),J=Math.max(...Y.map((z)=>z.length),F.stops.length),X=n3(F,B,J),C=[];for(let z of Y){let W=X.slice(0),G="";for(let q of z)G+=HD.hex(W.shift()?.toHex()||"#000")(q);C.push(G)}return C.join(`
377
- `)}function l1(D){let F={interpolation:"rgb",hsvSpin:"short",...D};if(D!==void 0&&typeof D!=="object")throw new TypeError(`Expected \`options\` to be an \`object\`, got \`${typeof D}\``);if(typeof F.interpolation!=="string")throw new TypeError(`Expected \`options.interpolation\` to be \`rgb\` or \`hsv\`, got \`${typeof F.interpolation}\``);if(F.interpolation.toLowerCase()==="hsv"&&typeof F.hsvSpin!=="string")throw new TypeError(`Expected \`options.hsvSpin\` to be a \`short\` or \`long\`, got \`${typeof F.hsvSpin}\``);return F}var w0={atlas:{colors:["#feac5e","#c779d0","#4bc0c8"],options:{}},cristal:{colors:["#bdfff3","#4ac29a"],options:{}},teen:{colors:["#77a1d3","#79cbca","#e684ae"],options:{}},mind:{colors:["#473b7b","#3584a7","#30d2be"],options:{}},morning:{colors:["#ff5f6d","#ffc371"],options:{interpolation:"hsv"}},vice:{colors:["#5ee7df","#b490ca"],options:{interpolation:"hsv"}},passion:{colors:["#f43b47","#453a94"],options:{}},fruit:{colors:["#ff4e50","#f9d423"],options:{}},instagram:{colors:["#833ab4","#fd1d1d","#fcb045"],options:{}},retro:{colors:["#3f51b1","#5a55ae","#7b5fac","#8f6aae","#a86aa4","#cc6b8e","#f18271","#f3a469","#f7c978"],options:{}},summer:{colors:["#fdbb2d","#22c1c3"],options:{}},rainbow:{colors:["#ff0000","#ff0100"],options:{interpolation:"hsv",hsvSpin:"long"}},pastel:{colors:["#74ebd5","#74ecd5"],options:{interpolation:"hsv",hsvSpin:"long"}}};function T0(D){let F=(Q)=>C0(...D.colors)(Q,D.options);return F.multiline=(Q="")=>C0(...D.colors).multiline(Q,D.options),F}var d1=C0,NJ=T0(w0.atlas),jJ=T0(w0.cristal),RJ=T0(w0.teen),_J=T0(w0.mind),OJ=T0(w0.morning),IJ=T0(w0.vice),wJ=T0(w0.passion),TJ=T0(w0.fruit),PJ=T0(w0.instagram),SJ=T0(w0.retro),kJ=T0(w0.summer),bJ=T0(w0.rainbow),vJ=T0(w0.pastel);C0.atlas=NJ;C0.cristal=jJ;C0.teen=RJ;C0.mind=_J;C0.morning=OJ;C0.vice=IJ;C0.passion=wJ;C0.fruit=TJ;C0.instagram=PJ;C0.retro=SJ;C0.summer=kJ;C0.rainbow=bJ;C0.pastel=vJ;import J6 from"node:process";function c1({onlyFirst:D=!1}={}){return new RegExp("(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]",D?void 0:"g")}var xJ=c1();function p1(D){if(typeof D!=="string")throw new TypeError(`Expected a \`string\`, got \`${typeof D}\``);return D.replace(xJ,"")}function i3(D){return D===161||D===164||D===167||D===168||D===170||D===173||D===174||D>=176&&D<=180||D>=182&&D<=186||D>=188&&D<=191||D===198||D===208||D===215||D===216||D>=222&&D<=225||D===230||D>=232&&D<=234||D===236||D===237||D===240||D===242||D===243||D>=247&&D<=250||D===252||D===254||D===257||D===273||D===275||D===283||D===294||D===295||D===299||D>=305&&D<=307||D===312||D>=319&&D<=322||D===324||D>=328&&D<=331||D===333||D===338||D===339||D===358||D===359||D===363||D===462||D===464||D===466||D===468||D===470||D===472||D===474||D===476||D===593||D===609||D===708||D===711||D>=713&&D<=715||D===717||D===720||D>=728&&D<=731||D===733||D===735||D>=768&&D<=879||D>=913&&D<=929||D>=931&&D<=937||D>=945&&D<=961||D>=963&&D<=969||D===1025||D>=1040&&D<=1103||D===1105||D===8208||D>=8211&&D<=8214||D===8216||D===8217||D===8220||D===8221||D>=8224&&D<=8226||D>=8228&&D<=8231||D===8240||D===8242||D===8243||D===8245||D===8251||D===8254||D===8308||D===8319||D>=8321&&D<=8324||D===8364||D===8451||D===8453||D===8457||D===8467||D===8470||D===8481||D===8482||D===8486||D===8491||D===8531||D===8532||D>=8539&&D<=8542||D>=8544&&D<=8555||D>=8560&&D<=8569||D===8585||D>=8592&&D<=8601||D===8632||D===8633||D===8658||D===8660||D===8679||D===8704||D===8706||D===8707||D===8711||D===8712||D===8715||D===8719||D===8721||D===8725||D===8730||D>=8733&&D<=8736||D===8739||D===8741||D>=8743&&D<=8748||D===8750||D>=8756&&D<=8759||D===8764||D===8765||D===8776||D===8780||D===8786||D===8800||D===8801||D>=8804&&D<=8807||D===8810||D===8811||D===8814||D===8815||D===8834||D===8835||D===8838||D===8839||D===8853||D===8857||D===8869||D===8895||D===8978||D>=9312&&D<=9449||D>=9451&&D<=9547||D>=9552&&D<=9587||D>=9600&&D<=9615||D>=9618&&D<=9621||D===9632||D===9633||D>=9635&&D<=9641||D===9650||D===9651||D===9654||D===9655||D===9660||D===9661||D===9664||D===9665||D>=9670&&D<=9672||D===9675||D>=9678&&D<=9681||D>=9698&&D<=9701||D===9711||D===9733||D===9734||D===9737||D===9742||D===9743||D===9756||D===9758||D===9792||D===9794||D===9824||D===9825||D>=9827&&D<=9829||D>=9831&&D<=9834||D===9836||D===9837||D===9839||D===9886||D===9887||D===9919||D>=9926&&D<=9933||D>=9935&&D<=9939||D>=9941&&D<=9953||D===9955||D===9960||D===9961||D>=9963&&D<=9969||D===9972||D>=9974&&D<=9977||D===9979||D===9980||D===9982||D===9983||D===10045||D>=10102&&D<=10111||D>=11094&&D<=11097||D>=12872&&D<=12879||D>=57344&&D<=63743||D>=65024&&D<=65039||D===65533||D>=127232&&D<=127242||D>=127248&&D<=127277||D>=127280&&D<=127337||D>=127344&&D<=127373||D===127375||D===127376||D>=127387&&D<=127404||D>=917760&&D<=917999||D>=983040&&D<=1048573||D>=1048576&&D<=1114109}function a3(D){return D===12288||D>=65281&&D<=65376||D>=65504&&D<=65510}function r3(D){return D>=4352&&D<=4447||D===8986||D===8987||D===9001||D===9002||D>=9193&&D<=9196||D===9200||D===9203||D===9725||D===9726||D===9748||D===9749||D>=9776&&D<=9783||D>=9800&&D<=9811||D===9855||D>=9866&&D<=9871||D===9875||D===9889||D===9898||D===9899||D===9917||D===9918||D===9924||D===9925||D===9934||D===9940||D===9962||D===9970||D===9971||D===9973||D===9978||D===9981||D===9989||D===9994||D===9995||D===10024||D===10060||D===10062||D>=10067&&D<=10069||D===10071||D>=10133&&D<=10135||D===10160||D===10175||D===11035||D===11036||D===11088||D===11093||D>=11904&&D<=11929||D>=11931&&D<=12019||D>=12032&&D<=12245||D>=12272&&D<=12287||D>=12289&&D<=12350||D>=12353&&D<=12438||D>=12441&&D<=12543||D>=12549&&D<=12591||D>=12593&&D<=12686||D>=12688&&D<=12773||D>=12783&&D<=12830||D>=12832&&D<=12871||D>=12880&&D<=42124||D>=42128&&D<=42182||D>=43360&&D<=43388||D>=44032&&D<=55203||D>=63744&&D<=64255||D>=65040&&D<=65049||D>=65072&&D<=65106||D>=65108&&D<=65126||D>=65128&&D<=65131||D>=94176&&D<=94180||D>=94192&&D<=94198||D>=94208&&D<=101589||D>=101631&&D<=101662||D>=101760&&D<=101874||D>=110576&&D<=110579||D>=110581&&D<=110587||D===110589||D===110590||D>=110592&&D<=110882||D===110898||D>=110928&&D<=110930||D===110933||D>=110948&&D<=110951||D>=110960&&D<=111355||D>=119552&&D<=119638||D>=119648&&D<=119670||D===126980||D===127183||D===127374||D>=127377&&D<=127386||D>=127488&&D<=127490||D>=127504&&D<=127547||D>=127552&&D<=127560||D===127568||D===127569||D>=127584&&D<=127589||D>=127744&&D<=127776||D>=127789&&D<=127797||D>=127799&&D<=127868||D>=127870&&D<=127891||D>=127904&&D<=127946||D>=127951&&D<=127955||D>=127968&&D<=127984||D===127988||D>=127992&&D<=128062||D===128064||D>=128066&&D<=128252||D>=128255&&D<=128317||D>=128331&&D<=128334||D>=128336&&D<=128359||D===128378||D===128405||D===128406||D===128420||D>=128507&&D<=128591||D>=128640&&D<=128709||D===128716||D>=128720&&D<=128722||D>=128725&&D<=128728||D>=128732&&D<=128735||D===128747||D===128748||D>=128756&&D<=128764||D>=128992&&D<=129003||D===129008||D>=129292&&D<=129338||D>=129340&&D<=129349||D>=129351&&D<=129535||D>=129648&&D<=129660||D>=129664&&D<=129674||D>=129678&&D<=129734||D===129736||D>=129741&&D<=129756||D>=129759&&D<=129770||D>=129775&&D<=129784||D>=131072&&D<=196605||D>=196608&&D<=262141}function uJ(D){if(!Number.isSafeInteger(D))throw new TypeError(`Expected a code point, got \`${typeof D}\`.`)}function o3(D,{ambiguousAsWide:F=!1}={}){if(uJ(D),a3(D)||r3(D)||F&&i3(D))return 2;return 1}var e3=a0(t3(),1),yJ=new Intl.Segmenter,fJ=/^\p{Default_Ignorable_Code_Point}$/u;function U0(D,F={}){if(typeof D!=="string"||D.length===0)return 0;let{ambiguousIsNarrow:Q=!0,countAnsiEscapeCodes:B=!1}=F;if(!B)D=p1(D);if(D.length===0)return 0;let Y=0,J={ambiguousAsWide:!Q};for(let{segment:X}of yJ.segment(D)){let C=X.codePointAt(0);if(C<=31||C>=127&&C<=159)continue;if(C>=8203&&C<=8207||C===65279)continue;if(C>=768&&C<=879||C>=6832&&C<=6911||C>=7616&&C<=7679||C>=8400&&C<=8447||C>=65056&&C<=65071)continue;if(C>=55296&&C<=57343)continue;if(C>=65024&&C<=65039)continue;if(fJ.test(X))continue;if(e3.default().test(X)){Y+=2;continue}Y+=o3(C,J)}return Y}function B6(D){let F=0;for(let Q of D.split(`
378
- `))F=Math.max(F,U0(Q));return F}var P4=a0(i1(),1);var $J=/[\p{Lu}]/u,hJ=/[\p{Ll}]/u,B4=/^[\p{Lu}](?![\p{Lu}])/gu,Y4=/([\p{Alpha}\p{N}_]|$)/u,a1=/[_.\- ]+/,mJ=new RegExp("^"+a1.source),Q4=new RegExp(a1.source+Y4.source,"gu"),X4=new RegExp("\\d+"+Y4.source,"gu"),lJ=(D,F,Q,B)=>{let Y=!1,J=!1,X=!1,C=!1;for(let z=0;z<D.length;z++){let W=D[z];if(C=z>2?D[z-3]==="-":!0,Y&&$J.test(W))D=D.slice(0,z)+"-"+D.slice(z),Y=!1,X=J,J=!0,z++;else if(J&&X&&hJ.test(W)&&(!C||B))D=D.slice(0,z-1)+"-"+D.slice(z-1),X=J,J=!1,Y=!0;else Y=F(W)===W&&Q(W)!==W,X=J,J=Q(W)===W&&F(W)!==W}return D},dJ=(D,F)=>{return B4.lastIndex=0,D.replaceAll(B4,(Q)=>F(Q))},cJ=(D,F)=>{return Q4.lastIndex=0,X4.lastIndex=0,D.replaceAll(X4,(Q,B,Y)=>["_","-"].includes(D.charAt(Y+Q.length))?Q:F(Q)).replaceAll(Q4,(Q,B)=>F(B))};function r1(D,F){if(!(typeof D==="string"||Array.isArray(D)))throw new TypeError("Expected the input to be `string | string[]`");if(F={pascalCase:!1,preserveConsecutiveUppercase:!1,...F},Array.isArray(D))D=D.map((J)=>J.trim()).filter((J)=>J.length).join("-");else D=D.trim();if(D.length===0)return"";let Q=F.locale===!1?(J)=>J.toLowerCase():(J)=>J.toLocaleLowerCase(F.locale),B=F.locale===!1?(J)=>J.toUpperCase():(J)=>J.toLocaleUpperCase(F.locale);if(D.length===1){if(a1.test(D))return"";return F.pascalCase?B(D):Q(D)}if(D!==Q(D))D=lJ(D,Q,B,F.preserveConsecutiveUppercase);if(D=D.replace(mJ,""),D=F.preserveConsecutiveUppercase?dJ(D,Q):Q(D),F.pascalCase)D=B(D.charAt(0))+D.slice(1);return cJ(D,B)}var B7=a0(Z4(),1);function t1({onlyFirst:D=!1}={}){return new RegExp("(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]",D?void 0:"g")}var tJ=t1();function e1(D){if(typeof D!=="string")throw new TypeError(`Expected a \`string\`, got \`${typeof D}\``);return D.replace(tJ,"")}var V4=(D=0)=>(F)=>`\x1B[${F+D}m`,L4=(D=0)=>(F)=>`\x1B[${38+D};5;${F}m`,M4=(D=0)=>(F,Q,B)=>`\x1B[${38+D};2;${F};${Q};${B}m`,uD={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],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],gray:[90,39],grey:[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],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},TA=Object.keys(uD.modifier),eJ=Object.keys(uD.color),DC=Object.keys(uD.bgColor),PA=[...eJ,...DC];function FC(){let D=new Map;for(let[F,Q]of Object.entries(uD)){for(let[B,Y]of Object.entries(Q))uD[B]={open:`\x1B[${Y[0]}m`,close:`\x1B[${Y[1]}m`},Q[B]=uD[B],D.set(Y[0],Y[1]);Object.defineProperty(uD,F,{value:Q,enumerable:!1})}return Object.defineProperty(uD,"codes",{value:D,enumerable:!1}),uD.color.close="\x1B[39m",uD.bgColor.close="\x1B[49m",uD.color.ansi=V4(),uD.color.ansi256=L4(),uD.color.ansi16m=M4(),uD.bgColor.ansi=V4(10),uD.bgColor.ansi256=L4(10),uD.bgColor.ansi16m=M4(10),Object.defineProperties(uD,{rgbToAnsi256:{value(F,Q,B){if(F===Q&&Q===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(Q/255*5)+Math.round(B/255*5)},enumerable:!1},hexToRgb:{value(F){let Q=/[a-f\d]{6}|[a-f\d]{3}/i.exec(F.toString(16));if(!Q)return[0,0,0];let[B]=Q;if(B.length===3)B=[...B].map((J)=>J+J).join("");let Y=Number.parseInt(B,16);return[Y>>16&255,Y>>8&255,Y&255]},enumerable:!1},hexToAnsi256:{value:(F)=>uD.rgbToAnsi256(...uD.hexToRgb(F)),enumerable:!1},ansi256ToAnsi:{value(F){if(F<8)return 30+F;if(F<16)return 90+(F-8);let Q,B,Y;if(F>=232)Q=((F-232)*10+8)/255,B=Q,Y=Q;else{F-=16;let C=F%36;Q=Math.floor(F/36)/5,B=Math.floor(C/6)/5,Y=C%6/5}let J=Math.max(Q,B,Y)*2;if(J===0)return 30;let X=30+(Math.round(Y)<<2|Math.round(B)<<1|Math.round(Q));if(J===2)X+=60;return X},enumerable:!1},rgbToAnsi:{value:(F,Q,B)=>uD.ansi256ToAnsi(uD.rgbToAnsi256(F,Q,B)),enumerable:!1},hexToAnsi:{value:(F)=>uD.ansi256ToAnsi(uD.hexToAnsi256(F)),enumerable:!1}}),uD}var BC=FC(),N4=BC;var X6=new Set(["\x1B","›"]),QC=39,F7="\x07",_4="[",XC="]",O4="m",Q6=`${XC}8;;`,j4=(D)=>`${X6.values().next().value}${_4}${D}${O4}`,R4=(D)=>`${X6.values().next().value}${Q6}${D}${F7}`,YC=(D)=>D.split(" ").map((F)=>U0(F)),D7=(D,F,Q)=>{let B=[...F],Y=!1,J=!1,X=U0(e1(D.at(-1)));for(let[C,z]of B.entries()){let W=U0(z);if(X+W<=Q)D[D.length-1]+=z;else D.push(z),X=0;if(X6.has(z))Y=!0,J=B.slice(C+1,C+1+Q6.length).join("")===Q6;if(Y){if(J){if(z===F7)Y=!1,J=!1}else if(z===O4)Y=!1;continue}if(X+=W,X===Q&&C<B.length-1)D.push(""),X=0}if(!X&&D.at(-1).length>0&&D.length>1)D[D.length-2]+=D.pop()},JC=(D)=>{let F=D.split(" "),Q=F.length;while(Q>0){if(U0(F[Q-1])>0)break;Q--}if(Q===F.length)return D;return F.slice(0,Q).join(" ")+F.slice(Q).join("")},CC=(D,F,Q={})=>{if(Q.trim!==!1&&D.trim()==="")return"";let B="",Y,J,X=YC(D),C=[""];for(let[q,A]of D.split(" ").entries()){if(Q.trim!==!1)C[C.length-1]=C.at(-1).trimStart();let U=U0(C.at(-1));if(q!==0){if(U>=F&&(Q.wordWrap===!1||Q.trim===!1))C.push(""),U=0;if(U>0||Q.trim===!1)C[C.length-1]+=" ",U++}if(Q.hard&&X[q]>F){let Z=F-U,H=1+Math.floor((X[q]-Z-1)/F);if(Math.floor((X[q]-1)/F)<H)C.push("");D7(C,A,F);continue}if(U+X[q]>F&&U>0&&X[q]>0){if(Q.wordWrap===!1&&U<F){D7(C,A,F);continue}C.push("")}if(U+X[q]>F&&Q.wordWrap===!1){D7(C,A,F);continue}C[C.length-1]+=A}if(Q.trim!==!1)C=C.map((q)=>JC(q));let z=C.join(`
379
- `),W=[...z],G=0;for(let[q,A]of W.entries()){if(B+=A,X6.has(A)){let{groups:Z}=new RegExp(`(?:\\${_4}(?<code>\\d+)m|\\${Q6}(?<uri>.*)${F7})`).exec(z.slice(G))||{groups:{}};if(Z.code!==void 0){let H=Number.parseFloat(Z.code);Y=H===QC?void 0:H}else if(Z.uri!==void 0)J=Z.uri.length===0?void 0:Z.uri}let U=N4.codes.get(Number(Y));if(W[q+1]===`
376
+ `),J=Math.max(...Y.map((W)=>W.length),F.stops.length),X=n3(F,B,J),C=[];for(let W of Y){let z=X.slice(0),G="";for(let q of W)G+=HD.hex(z.shift()?.toHex()||"#000")(q);C.push(G)}return C.join(`
377
+ `)}function l1(D){let F={interpolation:"rgb",hsvSpin:"short",...D};if(D!==void 0&&typeof D!=="object")throw new TypeError(`Expected \`options\` to be an \`object\`, got \`${typeof D}\``);if(typeof F.interpolation!=="string")throw new TypeError(`Expected \`options.interpolation\` to be \`rgb\` or \`hsv\`, got \`${typeof F.interpolation}\``);if(F.interpolation.toLowerCase()==="hsv"&&typeof F.hsvSpin!=="string")throw new TypeError(`Expected \`options.hsvSpin\` to be a \`short\` or \`long\`, got \`${typeof F.hsvSpin}\``);return F}var w0={atlas:{colors:["#feac5e","#c779d0","#4bc0c8"],options:{}},cristal:{colors:["#bdfff3","#4ac29a"],options:{}},teen:{colors:["#77a1d3","#79cbca","#e684ae"],options:{}},mind:{colors:["#473b7b","#3584a7","#30d2be"],options:{}},morning:{colors:["#ff5f6d","#ffc371"],options:{interpolation:"hsv"}},vice:{colors:["#5ee7df","#b490ca"],options:{interpolation:"hsv"}},passion:{colors:["#f43b47","#453a94"],options:{}},fruit:{colors:["#ff4e50","#f9d423"],options:{}},instagram:{colors:["#833ab4","#fd1d1d","#fcb045"],options:{}},retro:{colors:["#3f51b1","#5a55ae","#7b5fac","#8f6aae","#a86aa4","#cc6b8e","#f18271","#f3a469","#f7c978"],options:{}},summer:{colors:["#fdbb2d","#22c1c3"],options:{}},rainbow:{colors:["#ff0000","#ff0100"],options:{interpolation:"hsv",hsvSpin:"long"}},pastel:{colors:["#74ebd5","#74ecd5"],options:{interpolation:"hsv",hsvSpin:"long"}}};function T0(D){let F=(Q)=>C0(...D.colors)(Q,D.options);return F.multiline=(Q="")=>C0(...D.colors).multiline(Q,D.options),F}var d1=C0,NJ=T0(w0.atlas),jJ=T0(w0.cristal),RJ=T0(w0.teen),_J=T0(w0.mind),OJ=T0(w0.morning),IJ=T0(w0.vice),wJ=T0(w0.passion),TJ=T0(w0.fruit),PJ=T0(w0.instagram),SJ=T0(w0.retro),kJ=T0(w0.summer),bJ=T0(w0.rainbow),vJ=T0(w0.pastel);C0.atlas=NJ;C0.cristal=jJ;C0.teen=RJ;C0.mind=_J;C0.morning=OJ;C0.vice=IJ;C0.passion=wJ;C0.fruit=TJ;C0.instagram=PJ;C0.retro=SJ;C0.summer=kJ;C0.rainbow=bJ;C0.pastel=vJ;import J6 from"node:process";function c1({onlyFirst:D=!1}={}){return new RegExp("(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]",D?void 0:"g")}var xJ=c1();function p1(D){if(typeof D!=="string")throw new TypeError(`Expected a \`string\`, got \`${typeof D}\``);return D.replace(xJ,"")}function i3(D){return D===161||D===164||D===167||D===168||D===170||D===173||D===174||D>=176&&D<=180||D>=182&&D<=186||D>=188&&D<=191||D===198||D===208||D===215||D===216||D>=222&&D<=225||D===230||D>=232&&D<=234||D===236||D===237||D===240||D===242||D===243||D>=247&&D<=250||D===252||D===254||D===257||D===273||D===275||D===283||D===294||D===295||D===299||D>=305&&D<=307||D===312||D>=319&&D<=322||D===324||D>=328&&D<=331||D===333||D===338||D===339||D===358||D===359||D===363||D===462||D===464||D===466||D===468||D===470||D===472||D===474||D===476||D===593||D===609||D===708||D===711||D>=713&&D<=715||D===717||D===720||D>=728&&D<=731||D===733||D===735||D>=768&&D<=879||D>=913&&D<=929||D>=931&&D<=937||D>=945&&D<=961||D>=963&&D<=969||D===1025||D>=1040&&D<=1103||D===1105||D===8208||D>=8211&&D<=8214||D===8216||D===8217||D===8220||D===8221||D>=8224&&D<=8226||D>=8228&&D<=8231||D===8240||D===8242||D===8243||D===8245||D===8251||D===8254||D===8308||D===8319||D>=8321&&D<=8324||D===8364||D===8451||D===8453||D===8457||D===8467||D===8470||D===8481||D===8482||D===8486||D===8491||D===8531||D===8532||D>=8539&&D<=8542||D>=8544&&D<=8555||D>=8560&&D<=8569||D===8585||D>=8592&&D<=8601||D===8632||D===8633||D===8658||D===8660||D===8679||D===8704||D===8706||D===8707||D===8711||D===8712||D===8715||D===8719||D===8721||D===8725||D===8730||D>=8733&&D<=8736||D===8739||D===8741||D>=8743&&D<=8748||D===8750||D>=8756&&D<=8759||D===8764||D===8765||D===8776||D===8780||D===8786||D===8800||D===8801||D>=8804&&D<=8807||D===8810||D===8811||D===8814||D===8815||D===8834||D===8835||D===8838||D===8839||D===8853||D===8857||D===8869||D===8895||D===8978||D>=9312&&D<=9449||D>=9451&&D<=9547||D>=9552&&D<=9587||D>=9600&&D<=9615||D>=9618&&D<=9621||D===9632||D===9633||D>=9635&&D<=9641||D===9650||D===9651||D===9654||D===9655||D===9660||D===9661||D===9664||D===9665||D>=9670&&D<=9672||D===9675||D>=9678&&D<=9681||D>=9698&&D<=9701||D===9711||D===9733||D===9734||D===9737||D===9742||D===9743||D===9756||D===9758||D===9792||D===9794||D===9824||D===9825||D>=9827&&D<=9829||D>=9831&&D<=9834||D===9836||D===9837||D===9839||D===9886||D===9887||D===9919||D>=9926&&D<=9933||D>=9935&&D<=9939||D>=9941&&D<=9953||D===9955||D===9960||D===9961||D>=9963&&D<=9969||D===9972||D>=9974&&D<=9977||D===9979||D===9980||D===9982||D===9983||D===10045||D>=10102&&D<=10111||D>=11094&&D<=11097||D>=12872&&D<=12879||D>=57344&&D<=63743||D>=65024&&D<=65039||D===65533||D>=127232&&D<=127242||D>=127248&&D<=127277||D>=127280&&D<=127337||D>=127344&&D<=127373||D===127375||D===127376||D>=127387&&D<=127404||D>=917760&&D<=917999||D>=983040&&D<=1048573||D>=1048576&&D<=1114109}function a3(D){return D===12288||D>=65281&&D<=65376||D>=65504&&D<=65510}function r3(D){return D>=4352&&D<=4447||D===8986||D===8987||D===9001||D===9002||D>=9193&&D<=9196||D===9200||D===9203||D===9725||D===9726||D===9748||D===9749||D>=9776&&D<=9783||D>=9800&&D<=9811||D===9855||D>=9866&&D<=9871||D===9875||D===9889||D===9898||D===9899||D===9917||D===9918||D===9924||D===9925||D===9934||D===9940||D===9962||D===9970||D===9971||D===9973||D===9978||D===9981||D===9989||D===9994||D===9995||D===10024||D===10060||D===10062||D>=10067&&D<=10069||D===10071||D>=10133&&D<=10135||D===10160||D===10175||D===11035||D===11036||D===11088||D===11093||D>=11904&&D<=11929||D>=11931&&D<=12019||D>=12032&&D<=12245||D>=12272&&D<=12287||D>=12289&&D<=12350||D>=12353&&D<=12438||D>=12441&&D<=12543||D>=12549&&D<=12591||D>=12593&&D<=12686||D>=12688&&D<=12773||D>=12783&&D<=12830||D>=12832&&D<=12871||D>=12880&&D<=42124||D>=42128&&D<=42182||D>=43360&&D<=43388||D>=44032&&D<=55203||D>=63744&&D<=64255||D>=65040&&D<=65049||D>=65072&&D<=65106||D>=65108&&D<=65126||D>=65128&&D<=65131||D>=94176&&D<=94180||D===94192||D===94193||D>=94208&&D<=100343||D>=100352&&D<=101589||D>=101631&&D<=101640||D>=110576&&D<=110579||D>=110581&&D<=110587||D===110589||D===110590||D>=110592&&D<=110882||D===110898||D>=110928&&D<=110930||D===110933||D>=110948&&D<=110951||D>=110960&&D<=111355||D>=119552&&D<=119638||D>=119648&&D<=119670||D===126980||D===127183||D===127374||D>=127377&&D<=127386||D>=127488&&D<=127490||D>=127504&&D<=127547||D>=127552&&D<=127560||D===127568||D===127569||D>=127584&&D<=127589||D>=127744&&D<=127776||D>=127789&&D<=127797||D>=127799&&D<=127868||D>=127870&&D<=127891||D>=127904&&D<=127946||D>=127951&&D<=127955||D>=127968&&D<=127984||D===127988||D>=127992&&D<=128062||D===128064||D>=128066&&D<=128252||D>=128255&&D<=128317||D>=128331&&D<=128334||D>=128336&&D<=128359||D===128378||D===128405||D===128406||D===128420||D>=128507&&D<=128591||D>=128640&&D<=128709||D===128716||D>=128720&&D<=128722||D>=128725&&D<=128727||D>=128732&&D<=128735||D===128747||D===128748||D>=128756&&D<=128764||D>=128992&&D<=129003||D===129008||D>=129292&&D<=129338||D>=129340&&D<=129349||D>=129351&&D<=129535||D>=129648&&D<=129660||D>=129664&&D<=129673||D>=129679&&D<=129734||D>=129742&&D<=129756||D>=129759&&D<=129769||D>=129776&&D<=129784||D>=131072&&D<=196605||D>=196608&&D<=262141}function uJ(D){if(!Number.isSafeInteger(D))throw new TypeError(`Expected a code point, got \`${typeof D}\`.`)}function o3(D,{ambiguousAsWide:F=!1}={}){if(uJ(D),a3(D)||r3(D)||F&&i3(D))return 2;return 1}var e3=a0(t3(),1),yJ=new Intl.Segmenter,fJ=/^\p{Default_Ignorable_Code_Point}$/u;function U0(D,F={}){if(typeof D!=="string"||D.length===0)return 0;let{ambiguousIsNarrow:Q=!0,countAnsiEscapeCodes:B=!1}=F;if(!B)D=p1(D);if(D.length===0)return 0;let Y=0,J={ambiguousAsWide:!Q};for(let{segment:X}of yJ.segment(D)){let C=X.codePointAt(0);if(C<=31||C>=127&&C<=159)continue;if(C>=8203&&C<=8207||C===65279)continue;if(C>=768&&C<=879||C>=6832&&C<=6911||C>=7616&&C<=7679||C>=8400&&C<=8447||C>=65056&&C<=65071)continue;if(C>=55296&&C<=57343)continue;if(C>=65024&&C<=65039)continue;if(fJ.test(X))continue;if(e3.default().test(X)){Y+=2;continue}Y+=o3(C,J)}return Y}function B6(D){let F=0;for(let Q of D.split(`
378
+ `))F=Math.max(F,U0(Q));return F}var P4=a0(i1(),1);var $J=/[\p{Lu}]/u,hJ=/[\p{Ll}]/u,B4=/^[\p{Lu}](?![\p{Lu}])/gu,Y4=/([\p{Alpha}\p{N}_]|$)/u,a1=/[_.\- ]+/,mJ=new RegExp("^"+a1.source),Q4=new RegExp(a1.source+Y4.source,"gu"),X4=new RegExp("\\d+"+Y4.source,"gu"),lJ=(D,F,Q,B)=>{let Y=!1,J=!1,X=!1,C=!1;for(let W=0;W<D.length;W++){let z=D[W];if(C=W>2?D[W-3]==="-":!0,Y&&$J.test(z))D=D.slice(0,W)+"-"+D.slice(W),Y=!1,X=J,J=!0,W++;else if(J&&X&&hJ.test(z)&&(!C||B))D=D.slice(0,W-1)+"-"+D.slice(W-1),X=J,J=!1,Y=!0;else Y=F(z)===z&&Q(z)!==z,X=J,J=Q(z)===z&&F(z)!==z}return D},dJ=(D,F)=>{return B4.lastIndex=0,D.replaceAll(B4,(Q)=>F(Q))},cJ=(D,F)=>{return Q4.lastIndex=0,X4.lastIndex=0,D.replaceAll(X4,(Q,B,Y)=>["_","-"].includes(D.charAt(Y+Q.length))?Q:F(Q)).replaceAll(Q4,(Q,B)=>F(B))};function r1(D,F){if(!(typeof D==="string"||Array.isArray(D)))throw new TypeError("Expected the input to be `string | string[]`");if(F={pascalCase:!1,preserveConsecutiveUppercase:!1,...F},Array.isArray(D))D=D.map((J)=>J.trim()).filter((J)=>J.length).join("-");else D=D.trim();if(D.length===0)return"";let Q=F.locale===!1?(J)=>J.toLowerCase():(J)=>J.toLocaleLowerCase(F.locale),B=F.locale===!1?(J)=>J.toUpperCase():(J)=>J.toLocaleUpperCase(F.locale);if(D.length===1){if(a1.test(D))return"";return F.pascalCase?B(D):Q(D)}if(D!==Q(D))D=lJ(D,Q,B,F.preserveConsecutiveUppercase);if(D=D.replace(mJ,""),D=F.preserveConsecutiveUppercase?dJ(D,Q):Q(D),F.pascalCase)D=B(D.charAt(0))+D.slice(1);return cJ(D,B)}var B7=a0(Z4(),1);function t1({onlyFirst:D=!1}={}){return new RegExp("(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]",D?void 0:"g")}var tJ=t1();function e1(D){if(typeof D!=="string")throw new TypeError(`Expected a \`string\`, got \`${typeof D}\``);return D.replace(tJ,"")}var V4=(D=0)=>(F)=>`\x1B[${F+D}m`,L4=(D=0)=>(F)=>`\x1B[${38+D};5;${F}m`,M4=(D=0)=>(F,Q,B)=>`\x1B[${38+D};2;${F};${Q};${B}m`,uD={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],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],gray:[90,39],grey:[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],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},TA=Object.keys(uD.modifier),eJ=Object.keys(uD.color),DC=Object.keys(uD.bgColor),PA=[...eJ,...DC];function FC(){let D=new Map;for(let[F,Q]of Object.entries(uD)){for(let[B,Y]of Object.entries(Q))uD[B]={open:`\x1B[${Y[0]}m`,close:`\x1B[${Y[1]}m`},Q[B]=uD[B],D.set(Y[0],Y[1]);Object.defineProperty(uD,F,{value:Q,enumerable:!1})}return Object.defineProperty(uD,"codes",{value:D,enumerable:!1}),uD.color.close="\x1B[39m",uD.bgColor.close="\x1B[49m",uD.color.ansi=V4(),uD.color.ansi256=L4(),uD.color.ansi16m=M4(),uD.bgColor.ansi=V4(10),uD.bgColor.ansi256=L4(10),uD.bgColor.ansi16m=M4(10),Object.defineProperties(uD,{rgbToAnsi256:{value:(F,Q,B)=>{if(F===Q&&Q===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(Q/255*5)+Math.round(B/255*5)},enumerable:!1},hexToRgb:{value:(F)=>{let Q=/[a-f\d]{6}|[a-f\d]{3}/i.exec(F.toString(16));if(!Q)return[0,0,0];let[B]=Q;if(B.length===3)B=[...B].map((J)=>J+J).join("");let Y=Number.parseInt(B,16);return[Y>>16&255,Y>>8&255,Y&255]},enumerable:!1},hexToAnsi256:{value:(F)=>uD.rgbToAnsi256(...uD.hexToRgb(F)),enumerable:!1},ansi256ToAnsi:{value:(F)=>{if(F<8)return 30+F;if(F<16)return 90+(F-8);let Q,B,Y;if(F>=232)Q=((F-232)*10+8)/255,B=Q,Y=Q;else{F-=16;let C=F%36;Q=Math.floor(F/36)/5,B=Math.floor(C/6)/5,Y=C%6/5}let J=Math.max(Q,B,Y)*2;if(J===0)return 30;let X=30+(Math.round(Y)<<2|Math.round(B)<<1|Math.round(Q));if(J===2)X+=60;return X},enumerable:!1},rgbToAnsi:{value:(F,Q,B)=>uD.ansi256ToAnsi(uD.rgbToAnsi256(F,Q,B)),enumerable:!1},hexToAnsi:{value:(F)=>uD.ansi256ToAnsi(uD.hexToAnsi256(F)),enumerable:!1}}),uD}var BC=FC(),N4=BC;var X6=new Set(["\x1B","›"]),QC=39,F7="\x07",_4="[",XC="]",O4="m",Q6=`${XC}8;;`,j4=(D)=>`${X6.values().next().value}${_4}${D}${O4}`,R4=(D)=>`${X6.values().next().value}${Q6}${D}${F7}`,YC=(D)=>D.split(" ").map((F)=>U0(F)),D7=(D,F,Q)=>{let B=[...F],Y=!1,J=!1,X=U0(e1(D.at(-1)));for(let[C,W]of B.entries()){let z=U0(W);if(X+z<=Q)D[D.length-1]+=W;else D.push(W),X=0;if(X6.has(W))Y=!0,J=B.slice(C+1,C+1+Q6.length).join("")===Q6;if(Y){if(J){if(W===F7)Y=!1,J=!1}else if(W===O4)Y=!1;continue}if(X+=z,X===Q&&C<B.length-1)D.push(""),X=0}if(!X&&D.at(-1).length>0&&D.length>1)D[D.length-2]+=D.pop()},JC=(D)=>{let F=D.split(" "),Q=F.length;while(Q>0){if(U0(F[Q-1])>0)break;Q--}if(Q===F.length)return D;return F.slice(0,Q).join(" ")+F.slice(Q).join("")},CC=(D,F,Q={})=>{if(Q.trim!==!1&&D.trim()==="")return"";let B="",Y,J,X=YC(D),C=[""];for(let[q,A]of D.split(" ").entries()){if(Q.trim!==!1)C[C.length-1]=C.at(-1).trimStart();let U=U0(C.at(-1));if(q!==0){if(U>=F&&(Q.wordWrap===!1||Q.trim===!1))C.push(""),U=0;if(U>0||Q.trim===!1)C[C.length-1]+=" ",U++}if(Q.hard&&X[q]>F){let Z=F-U,H=1+Math.floor((X[q]-Z-1)/F);if(Math.floor((X[q]-1)/F)<H)C.push("");D7(C,A,F);continue}if(U+X[q]>F&&U>0&&X[q]>0){if(Q.wordWrap===!1&&U<F){D7(C,A,F);continue}C.push("")}if(U+X[q]>F&&Q.wordWrap===!1){D7(C,A,F);continue}C[C.length-1]+=A}if(Q.trim!==!1)C=C.map((q)=>JC(q));let W=C.join(`
379
+ `),z=[...W],G=0;for(let[q,A]of z.entries()){if(B+=A,X6.has(A)){let{groups:Z}=new RegExp(`(?:\\${_4}(?<code>\\d+)m|\\${Q6}(?<uri>.*)${F7})`).exec(W.slice(G))||{groups:{}};if(Z.code!==void 0){let H=Number.parseFloat(Z.code);Y=H===QC?void 0:H}else if(Z.uri!==void 0)J=Z.uri.length===0?void 0:Z.uri}let U=N4.codes.get(Number(Y));if(z[q+1]===`
380
380
  `){if(J)B+=R4("");if(Y&&U)B+=j4(U)}else if(A===`
381
381
  `){if(Y&&U)B+=j4(Y);if(J)B+=R4(J)}G+=A.length}return B};function Y6(D,F,Q){return String(D).normalize().replaceAll(`\r
382
382
  `,`
@@ -384,10 +384,10 @@ ${e.default.cyan(a2)}
384
384
  `).map((B)=>CC(B,F,Q)).join(`
385
385
  `)}var AC=a0(i1(),1),TF=`
386
386
  `,P0=" ",t2="none",S4=()=>{let{env:D,stdout:F,stderr:Q}=J6;if(F?.columns)return F.columns;if(Q?.columns)return Q.columns;if(D.COLUMNS)return Number.parseInt(D.COLUMNS,10);return 80},I4=(D)=>typeof D==="number"?{top:D,right:D*3,bottom:D,left:D*3}:{top:0,right:0,bottom:0,left:0,...D},e2=(D)=>D===t2?0:2,WC=(D)=>{let F=["topLeft","topRight","bottomRight","bottomLeft","left","right","top","bottom"],Q;if(D===t2){D={};for(let B of F)D[B]=""}if(typeof D==="string"){if(Q=P4.default[D],!Q)throw new TypeError(`Invalid border style: ${D}`)}else{if(typeof D?.vertical==="string")D.left=D.vertical,D.right=D.vertical;if(typeof D?.horizontal==="string")D.top=D.horizontal,D.bottom=D.horizontal;for(let B of F)if(D[B]===null||typeof D[B]!=="string")throw new TypeError(`Invalid border style: ${B}`);Q=D}return Q},zC=(D,F,Q)=>{let B="",Y=U0(D);switch(Q){case"left":{B=D+F.slice(Y);break}case"right":{B=F.slice(Y)+D;break}default:{if(F=F.slice(Y),F.length%2===1)F=F.slice(Math.floor(F.length/2)),B=F.slice(1)+D+F;else F=F.slice(F.length/2),B=F+D+F;break}}return B},GC=(D,{padding:F,width:Q,textAlignment:B,height:Y})=>{D=B7.default(D,{align:B});let J=D.split(TF),X=B6(D),C=Q-F.left-F.right;if(X>C){let G=[];for(let q of J){let A=Y6(q,C,{hard:!0}),Z=B7.default(A,{align:B}).split(`
387
- `),H=Math.max(...Z.map((V)=>U0(V)));for(let V of Z){let N;switch(B){case"center":{N=P0.repeat((C-H)/2)+V;break}case"right":{N=P0.repeat(C-H)+V;break}default:{N=V;break}}G.push(N)}}J=G}if(B==="center"&&X<C)J=J.map((G)=>P0.repeat((C-X)/2)+G);else if(B==="right"&&X<C)J=J.map((G)=>P0.repeat(C-X)+G);let z=P0.repeat(F.left),W=P0.repeat(F.right);if(J=J.map((G)=>{let q=z+G+W;return q+P0.repeat(Q-U0(q))}),F.top>0)J=[...Array.from({length:F.top}).fill(P0.repeat(Q)),...J];if(F.bottom>0)J=[...J,...Array.from({length:F.bottom}).fill(P0.repeat(Q))];if(Y&&J.length>Y)J=J.slice(0,Y);else if(Y&&J.length<Y)J=[...J,...Array.from({length:Y-J.length}).fill(P0.repeat(Q))];return J.join(TF)},qC=(D,F,Q)=>{let B=(G)=>{let q=Q.borderColor?UC(Q.borderColor)(G):G;return Q.dimBorder?HD.dim(q):q},Y=(G)=>Q.backgroundColor?EC(Q.backgroundColor)(G):G,J=WC(Q.borderStyle),X=S4(),C=P0.repeat(Q.margin.left);if(Q.float==="center"){let G=Math.max((X-F-e2(Q.borderStyle))/2,0);C=P0.repeat(G)}else if(Q.float==="right"){let G=Math.max(X-F-Q.margin.right-e2(Q.borderStyle),0);C=P0.repeat(G)}let z="";if(Q.margin.top)z+=TF.repeat(Q.margin.top);if(Q.borderStyle!==t2||Q.title)z+=B(C+J.topLeft+(Q.title?zC(Q.title,J.top.repeat(F),Q.titleAlignment):J.top.repeat(F))+J.topRight)+TF;let W=D.split(TF);if(z+=W.map((G)=>C+B(J.left)+Y(G)+B(J.right)).join(TF),Q.borderStyle!==t2)z+=TF+B(C+J.bottomLeft+J.bottom.repeat(F)+J.bottomRight);if(Q.margin.bottom)z+=TF.repeat(Q.margin.bottom);return z},HC=(D)=>{if(D.fullscreen&&J6?.stdout){let F=[J6.stdout.columns,J6.stdout.rows];if(typeof D.fullscreen==="function")F=D.fullscreen(...F);D.width||=F[0],D.height||=F[1]}return D.width&&=Math.max(1,D.width-e2(D.borderStyle)),D.height&&=Math.max(1,D.height-e2(D.borderStyle)),D},w4=(D,F)=>F===t2?D:` ${D} `,KC=(D,F)=>{F=HC(F);let Q=F.width!==void 0,B=S4(),Y=e2(F.borderStyle),J=B-F.margin.left-F.margin.right-Y,X=B6(Y6(D,B-Y,{hard:!0,trim:!1}))+F.padding.left+F.padding.right;if(F.title&&Q)F.title=F.title.slice(0,Math.max(0,F.width-2)),F.title&&=w4(F.title,F.borderStyle);else if(F.title){if(F.title=F.title.slice(0,Math.max(0,J-2)),F.title){if(F.title=w4(F.title,F.borderStyle),U0(F.title)>X)F.width=U0(F.title)}}if(F.width||=X,!Q){if(F.margin.left&&F.margin.right&&F.width>J){let z=(B-F.width-Y)/(F.margin.left+F.margin.right);F.margin.left=Math.max(0,Math.floor(F.margin.left*z)),F.margin.right=Math.max(0,Math.floor(F.margin.right*z))}F.width=Math.min(F.width,B-Y-F.margin.left-F.margin.right)}if(F.width-(F.padding.left+F.padding.right)<=0)F.padding.left=0,F.padding.right=0;if(F.height&&F.height-(F.padding.top+F.padding.bottom)<=0)F.padding.top=0,F.padding.bottom=0;return F},Q7=(D)=>D.match(/^#(?:[0-f]{3}){1,2}$/i),T4=(D)=>typeof D==="string"&&(HD[D]??Q7(D)),UC=(D)=>Q7(D)?HD.hex(D):HD[D],EC=(D)=>Q7(D)?HD.bgHex(D):HD[r1(["bg",D])];function C6(D,F){if(F={padding:0,borderStyle:"single",dimBorder:!1,textAlignment:"left",float:"left",titleAlignment:"left",...F},F.align)F.textAlignment=F.align;if(F.borderColor&&!T4(F.borderColor))throw new Error(`${F.borderColor} is not a valid borderColor`);if(F.backgroundColor&&!T4(F.backgroundColor))throw new Error(`${F.backgroundColor} is not a valid backgroundColor`);return F.padding=I4(F.padding),F.margin=I4(F.margin),F=KC(D,F),D=GC(D,F),qC(D,F.width,F)}E0();import{platform as hC,homedir as mC}from"os";import{execSync as Y7}from"child_process";import{chmodSync as lC}from"fs";import{join as F8}from"path";var PF=hC()==="win32",dF={getShell:()=>{return PF?"powershell":"/bin/sh"},getHookExtension:()=>{return".js"},findExecutable:(D)=>{let F=PF?`where ${D}`:`which ${D}`;return Y7(F,{encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()},makeExecutable:(D)=>{if(!PF)lC(D,493)},installUv:()=>{if(PF)Y7('powershell -Command "irm https://astral.sh/uv/install.ps1 | iex"',{stdio:"pipe"});else Y7("curl -LsSf https://astral.sh/uv/install.sh | sh",{stdio:"pipe",shell:"/bin/sh"})},getShellConfigPaths:()=>{let D=mC();if(PF)return[F8(D,"Documents","PowerShell","Microsoft.PowerShell_profile.ps1"),F8(D,"Documents","WindowsPowerShell","Microsoft.PowerShell_profile.ps1")];return[F8(D,".bashrc"),F8(D,".zshrc"),F8(D,".bash_profile")]},getAliasDefinition:(D,F)=>{if(PF)return`function ${D} { ${F} $args }`;return`alias ${D}='${F}'`},isWindows:()=>PF,isUnix:()=>!PF};function pC(D){let F,Q=0,B=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"];return{start(){F=setInterval(()=>{process.stdout.write(`\r${HD.cyan(B[Q%B.length])} ${D}`),Q++},50)},stop(Y,J=!0){clearInterval(F);let X=J?HD.green("✓"):HD.red("✗");process.stdout.write(`\r${X} ${Y}
387
+ `),H=Math.max(...Z.map((V)=>U0(V)));for(let V of Z){let j;switch(B){case"center":{j=P0.repeat((C-H)/2)+V;break}case"right":{j=P0.repeat(C-H)+V;break}default:{j=V;break}}G.push(j)}}J=G}if(B==="center"&&X<C)J=J.map((G)=>P0.repeat((C-X)/2)+G);else if(B==="right"&&X<C)J=J.map((G)=>P0.repeat(C-X)+G);let W=P0.repeat(F.left),z=P0.repeat(F.right);if(J=J.map((G)=>{let q=W+G+z;return q+P0.repeat(Q-U0(q))}),F.top>0)J=[...Array.from({length:F.top}).fill(P0.repeat(Q)),...J];if(F.bottom>0)J=[...J,...Array.from({length:F.bottom}).fill(P0.repeat(Q))];if(Y&&J.length>Y)J=J.slice(0,Y);else if(Y&&J.length<Y)J=[...J,...Array.from({length:Y-J.length}).fill(P0.repeat(Q))];return J.join(TF)},qC=(D,F,Q)=>{let B=(G)=>{let q=Q.borderColor?UC(Q.borderColor)(G):G;return Q.dimBorder?HD.dim(q):q},Y=(G)=>Q.backgroundColor?EC(Q.backgroundColor)(G):G,J=WC(Q.borderStyle),X=S4(),C=P0.repeat(Q.margin.left);if(Q.float==="center"){let G=Math.max((X-F-e2(Q.borderStyle))/2,0);C=P0.repeat(G)}else if(Q.float==="right"){let G=Math.max(X-F-Q.margin.right-e2(Q.borderStyle),0);C=P0.repeat(G)}let W="";if(Q.margin.top)W+=TF.repeat(Q.margin.top);if(Q.borderStyle!==t2||Q.title)W+=B(C+J.topLeft+(Q.title?zC(Q.title,J.top.repeat(F),Q.titleAlignment):J.top.repeat(F))+J.topRight)+TF;let z=D.split(TF);if(W+=z.map((G)=>C+B(J.left)+Y(G)+B(J.right)).join(TF),Q.borderStyle!==t2)W+=TF+B(C+J.bottomLeft+J.bottom.repeat(F)+J.bottomRight);if(Q.margin.bottom)W+=TF.repeat(Q.margin.bottom);return W},HC=(D)=>{if(D.fullscreen&&J6?.stdout){let F=[J6.stdout.columns,J6.stdout.rows];if(typeof D.fullscreen==="function")F=D.fullscreen(...F);D.width||=F[0],D.height||=F[1]}return D.width&&=Math.max(1,D.width-e2(D.borderStyle)),D.height&&=Math.max(1,D.height-e2(D.borderStyle)),D},w4=(D,F)=>F===t2?D:` ${D} `,KC=(D,F)=>{F=HC(F);let Q=F.width!==void 0,B=S4(),Y=e2(F.borderStyle),J=B-F.margin.left-F.margin.right-Y,X=B6(Y6(D,B-Y,{hard:!0,trim:!1}))+F.padding.left+F.padding.right;if(F.title&&Q)F.title=F.title.slice(0,Math.max(0,F.width-2)),F.title&&=w4(F.title,F.borderStyle);else if(F.title){if(F.title=F.title.slice(0,Math.max(0,J-2)),F.title){if(F.title=w4(F.title,F.borderStyle),U0(F.title)>X)F.width=U0(F.title)}}if(F.width||=X,!Q){if(F.margin.left&&F.margin.right&&F.width>J){let W=(B-F.width-Y)/(F.margin.left+F.margin.right);F.margin.left=Math.max(0,Math.floor(F.margin.left*W)),F.margin.right=Math.max(0,Math.floor(F.margin.right*W))}F.width=Math.min(F.width,B-Y-F.margin.left-F.margin.right)}if(F.width-(F.padding.left+F.padding.right)<=0)F.padding.left=0,F.padding.right=0;if(F.height&&F.height-(F.padding.top+F.padding.bottom)<=0)F.padding.top=0,F.padding.bottom=0;return F},Q7=(D)=>D.match(/^#(?:[0-f]{3}){1,2}$/i),T4=(D)=>typeof D==="string"&&(HD[D]??Q7(D)),UC=(D)=>Q7(D)?HD.hex(D):HD[D],EC=(D)=>Q7(D)?HD.bgHex(D):HD[r1(["bg",D])];function C6(D,F){if(F={padding:0,borderStyle:"single",dimBorder:!1,textAlignment:"left",float:"left",titleAlignment:"left",...F},F.align)F.textAlignment=F.align;if(F.borderColor&&!T4(F.borderColor))throw new Error(`${F.borderColor} is not a valid borderColor`);if(F.backgroundColor&&!T4(F.backgroundColor))throw new Error(`${F.backgroundColor} is not a valid backgroundColor`);return F.padding=I4(F.padding),F.margin=I4(F.margin),F=KC(D,F),D=GC(D,F),qC(D,F.width,F)}E0();import{platform as hC,homedir as mC}from"os";import{execSync as Y7}from"child_process";import{chmodSync as lC}from"fs";import{join as F8}from"path";var PF=hC()==="win32",dF={getShell:()=>{return PF?"powershell":"/bin/sh"},getHookExtension:()=>{return".js"},findExecutable:(D)=>{let F=PF?`where ${D}`:`which ${D}`;return Y7(F,{encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()},makeExecutable:(D)=>{if(!PF)lC(D,493)},installUv:()=>{if(PF)Y7('powershell -Command "irm https://astral.sh/uv/install.ps1 | iex"',{stdio:"pipe"});else Y7("curl -LsSf https://astral.sh/uv/install.sh | sh",{stdio:"pipe",shell:"/bin/sh"})},getShellConfigPaths:()=>{let D=mC();if(PF)return[F8(D,"Documents","PowerShell","Microsoft.PowerShell_profile.ps1"),F8(D,"Documents","WindowsPowerShell","Microsoft.PowerShell_profile.ps1")];return[F8(D,".bashrc"),F8(D,".zshrc"),F8(D,".bash_profile")]},getAliasDefinition:(D,F)=>{if(PF)return`function ${D} { ${F} $args }`;return`alias ${D}='${F}'`},isWindows:()=>PF,isUnix:()=>!PF};function pC(D){let F,Q=0,B=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"];return{start(){F=setInterval(()=>{process.stdout.write(`\r${HD.cyan(B[Q%B.length])} ${D}`),Q++},50)},stop(Y,J=!0){clearInterval(F);let X=J?HD.green("✓"):HD.red("✗");process.stdout.write(`\r${X} ${Y}
388
388
  `)}}}var x4=(D)=>new Promise((F)=>setTimeout(F,D)),B8=d1(["#ff0000","#ff4500","#ffa500","#ffff00","#00ff00","#00ffff","#0000ff","#8b00ff"]),J7=d1(["#ff006e","#fb5607","#ffbe0b","#8338ec","#3a86ff"]);function nC(){dF.installUv(),process.env.PATH=`${u4()}/.cargo/bin:${process.env.PATH}`}function iC(){return dF.findExecutable("claude")}function aC(){let D=CD.getInstance();return g0(D.getHooksDirectory())}async function rC(D){let F={};if(D){let J=await z2({message:`\uD83E\uDDE0 Existing claude-mem installation detected. Your memories and data are safe!
389
389
 
390
- Reinstall to update hooks and configuration?`,initialValue:!0});if(y0(J)||!J)return G2("Installation cancelled"),null;F.forceReinstall=!0}else F.forceReinstall=!1;let Q=await s8({message:"Select installation scope",options:[{value:"user",label:"User (Recommended)",hint:"Install for current user (~/.claude)"},{value:"project",label:"Project",hint:"Install for current project only (./.mcp.json)"},{value:"local",label:"Local",hint:"Custom local installation"}],initialValue:"user"});if(y0(Q))return G2("Installation cancelled"),null;if(F.scope=Q,Q==="local"){let J=await O3({message:"Enter custom installation directory",placeholder:tD(process.cwd(),".claude-mem"),validate:(X)=>{if(!X)return"Path is required";if(!X.startsWith("/")&&!X.startsWith("~"))return"Please provide an absolute path"}});if(y0(J))return G2("Installation cancelled"),null;F.customPath=J}F.hookTimeout=180000;let B=await z2({message:'Enable Smart Trash? This creates an alias for "rm" that moves files to ~/.claude-mem/trash instead of permanently deleting them. You can restore files anytime by typing "claude-mem restore".',initialValue:!0});if(y0(B))return G2("Installation cancelled"),null;F.enableSmartTrash=B;let Y=await z2({message:'Would you like to save memories when you type "/clear" in Claude Code? When running /clear with this on, it takes about a minute to save memories before your new session starts.',initialValue:!1});if(y0(Y))return G2("Installation cancelled"),null;return F.saveMemoriesOnClear=Y,F}function oC(){let D=CD.getInstance();D.ensureAllDataDirectories(),D.ensureAllClaudeDirectories();let F=tD(D.getDataDirectory(),"package.json");if(!g0(F))SF(F,JSON.stringify({name:"claude-mem-data",type:"module"},null,2))}function y4(D,F){if(dC(D).isDirectory()){if(!g0(F))Q8(F,{recursive:!0});cC(D).forEach((Y)=>{y4(tD(D,Y),tD(F,Y))})}else W7(D,F)}function sC(D=180000){let F=CD.getInstance(),Q=F.getHooksDirectory(),B=F.findPackageHookTemplatesDirectory(),Y=["session-start.js","stop.js","user-prompt-submit.js","post-tool-use.js"];for(let W of Y){let G=tD(B,W),q=tD(Q,W);W7(G,q),dF.makeExecutable(q)}let J=tD(B,"shared"),X=tD(Q,"shared");if(g0(J))y4(J,X);let C={packageName:W2,cliCommand:W2,backend:"chroma",timeout:D};SF(tD(Q,"config.json"),JSON.stringify(C,null,2));let z={name:"claude-mem-hooks",type:"module",dependencies:{"better-sqlite3":"^11.8.0"}};SF(tD(Q,"package.json"),JSON.stringify(z,null,2));try{C7("npm install --silent",{cwd:Q,stdio:"pipe"})}catch(W){}}function tC(){let F=CD.getInstance().getClaudeMdPath(),Q=z7(F);if(!g0(Q))Q8(Q,{recursive:!0});let B=`
390
+ Reinstall to update hooks and configuration?`,initialValue:!0});if(y0(J)||!J)return G2("Installation cancelled"),null;F.forceReinstall=!0}else F.forceReinstall=!1;let Q=await s8({message:"Select installation scope",options:[{value:"user",label:"User (Recommended)",hint:"Install for current user (~/.claude)"},{value:"project",label:"Project",hint:"Install for current project only (./.mcp.json)"},{value:"local",label:"Local",hint:"Custom local installation"}],initialValue:"user"});if(y0(Q))return G2("Installation cancelled"),null;if(F.scope=Q,Q==="local"){let J=await O3({message:"Enter custom installation directory",placeholder:tD(process.cwd(),".claude-mem"),validate:(X)=>{if(!X)return"Path is required";if(!X.startsWith("/")&&!X.startsWith("~"))return"Please provide an absolute path"}});if(y0(J))return G2("Installation cancelled"),null;F.customPath=J}F.hookTimeout=180000;let B=await z2({message:'Enable Smart Trash? This creates an alias for "rm" that moves files to ~/.claude-mem/trash instead of permanently deleting them. You can restore files anytime by typing "claude-mem restore".',initialValue:!0});if(y0(B))return G2("Installation cancelled"),null;F.enableSmartTrash=B;let Y=await z2({message:'Would you like to save memories when you type "/clear" in Claude Code? When running /clear with this on, it takes about a minute to save memories before your new session starts.',initialValue:!1});if(y0(Y))return G2("Installation cancelled"),null;return F.saveMemoriesOnClear=Y,F}function oC(){let D=CD.getInstance();D.ensureAllDataDirectories(),D.ensureAllClaudeDirectories();let F=tD(D.getDataDirectory(),"package.json");if(!g0(F))SF(F,JSON.stringify({name:"claude-mem-data",type:"module"},null,2))}function y4(D,F){if(dC(D).isDirectory()){if(!g0(F))Q8(F,{recursive:!0});cC(D).forEach((Y)=>{y4(tD(D,Y),tD(F,Y))})}else W7(D,F)}function sC(D=180000){let F=CD.getInstance(),Q=F.getHooksDirectory(),B=F.findPackageHookTemplatesDirectory(),Y=["session-start.js","stop.js","user-prompt-submit.js","post-tool-use.js"];for(let z of Y){let G=tD(B,z),q=tD(Q,z);W7(G,q),dF.makeExecutable(q)}let J=tD(B,"shared"),X=tD(Q,"shared");if(g0(J))y4(J,X);let C={packageName:W2,cliCommand:W2,backend:"chroma",timeout:D};SF(tD(Q,"config.json"),JSON.stringify(C,null,2));let W={name:"claude-mem-hooks",type:"module",dependencies:{"better-sqlite3":"^11.8.0"}};SF(tD(Q,"package.json"),JSON.stringify(W,null,2));try{C7("npm install --silent",{cwd:Q,stdio:"pipe"})}catch(z){}}function tC(){let F=CD.getInstance().getClaudeMdPath(),Q=z7(F);if(!g0(Q))Q8(Q,{recursive:!0});let B=`
391
391
  <!-- CLAUDE-MEM QUICK REFERENCE -->
392
392
  ## \uD83E\uDDE0 Memory System Quick Reference
393
393
 
@@ -412,7 +412,7 @@ Reinstall to update hooks and configuration?`,initialValue:!0});if(y0(J)||!J)ret
412
412
  ### Storage
413
413
  - Collection: "claude_memories"
414
414
  - Archives: ~/.claude-mem/archives/
415
- <!-- /CLAUDE-MEM QUICK REFERENCE -->`,Y="";if(g0(F)){Y=G6(F,"utf8");let J=Y.includes("<!-- CLAUDE-MEM INSTRUCTIONS -->"),X=Y.includes("<!-- CLAUDE-MEM QUICK REFERENCE -->");if(J||X){let C,z;if(J)C="<!-- CLAUDE-MEM INSTRUCTIONS -->",z="<!-- /CLAUDE-MEM INSTRUCTIONS -->";else C="<!-- CLAUDE-MEM QUICK REFERENCE -->",z="<!-- /CLAUDE-MEM QUICK REFERENCE -->";let W=Y.indexOf(C),G=Y.indexOf(z)+z.length;if(W!==-1&&G!==-1)Y=Y.substring(0,W)+B.trim()+Y.substring(G)}else Y=Y.trim()+`
415
+ <!-- /CLAUDE-MEM QUICK REFERENCE -->`,Y="";if(g0(F)){Y=G6(F,"utf8");let J=Y.includes("<!-- CLAUDE-MEM INSTRUCTIONS -->"),X=Y.includes("<!-- CLAUDE-MEM QUICK REFERENCE -->");if(J||X){let C,W;if(J)C="<!-- CLAUDE-MEM INSTRUCTIONS -->",W="<!-- /CLAUDE-MEM INSTRUCTIONS -->";else C="<!-- CLAUDE-MEM QUICK REFERENCE -->",W="<!-- /CLAUDE-MEM QUICK REFERENCE -->";let z=Y.indexOf(C),G=Y.indexOf(W)+W.length;if(z!==-1&&G!==-1)Y=Y.substring(0,z)+B.trim()+Y.substring(G)}else Y=Y.trim()+`
416
416
  `+B}else Y=B.trim();SF(F,Y)}function eC(D=!1){let F=`${u4()}/.cargo/bin`;if(g0(F)&&!process.env.PATH?.includes(F))process.env.PATH=`${F}:${process.env.PATH}`;if(D)try{C7("claude mcp remove claude-mem",{stdio:"pipe"})}catch(B){}let Q=`claude mcp add claude-mem -- uvx chroma-mcp --client-type persistent --data-dir ${CD.getInstance().getChromaDirectory()}`;C7(Q,{stdio:"inherit"})}function z6(D,F,Q){let B={hooks:[{type:"command",command:D,timeout:F}]};if(Q)B.matcher=Q;return B}function DW(D){let Q=CD.getInstance().getHooksDirectory(),B=g0(D)?JSON.parse(G6(D,"utf8")):{hooks:{}};if(Q8(z7(D),{recursive:!0}),!B.hooks)B.hooks={};["SessionStart","Stop","UserPromptSubmit","PostToolUse"].forEach((J)=>{if(B.hooks[J])B.hooks[J]=B.hooks[J].filter((X)=>!X.hooks?.some((C)=>C.command?.includes(W2)))}),B.hooks.SessionStart=[z6(tD(Q,"session-start.js"),180)],B.hooks.Stop=[z6(tD(Q,"stop.js"),60)],B.hooks.UserPromptSubmit=[z6(tD(Q,"user-prompt-submit.js"),60)],B.hooks.PostToolUse=[z6(tD(Q,"post-tool-use.js"),180,"*")],SF(D,JSON.stringify(B,null,2))}function FW(D){if(D.scope==="local"&&D.customPath)return tD(D.customPath,"settings.local.json");else if(D.scope==="project")return tD(process.cwd(),".claude","settings.json");else return CD.getInstance().getClaudeSettingsPath()}function BW(D){let Q=CD.getInstance().getUserSettingsPath(),B=g0(Q)?JSON.parse(G6(Q,"utf8")):{};B.backend="chroma",B.installed=!0,B.embedded=!0,B.saveMemoriesOnClear=D.saveMemoriesOnClear||!1,B.claudePath=iC(),SF(Q,JSON.stringify(B,null,2))}function QW(){let D=dF.getShellConfigPaths(),F=dF.getAliasDefinition("rm","claude-mem trash"),Q=dF.isWindows()?"# claude-mem smart trash alias":"# claude-mem smart trash alias";for(let B of D){if(!g0(B)){let X=z7(B);if(!g0(X))Q8(X,{recursive:!0});SF(B,"")}let Y=G6(B,"utf8");if(Y.includes(F))continue;let J=`
417
417
  ${Q}
418
418
  ${F}
@@ -420,9 +420,9 @@ ${F}
420
420
  ═══════════════════════════════════════`)),console.log(B8(" CLAUDE-MEM INSTALLER ")),console.log(B8("═══════════════════════════════════════")),console.log(C6(J7(`\uD83E\uDDE0 Persistent Memory System for Claude Code
421
421
 
422
422
  ✨ Transform your Claude experience with seamless context preservation
423
- \uD83D\uDE80 Never lose your conversation history again`),{padding:2,margin:1,borderStyle:"double",borderColor:"magenta",textAlignment:"center"})),await x4(500),nC();let F=D.user||D.project||D.local||D.force,Q;if(F)Q={scope:D.local?"local":D.project?"project":"user",customPath:D.path,hookTimeout:D.timeout?parseInt(D.timeout):180,forceReinstall:!!D.force,enableSmartTrash:!1,saveMemoriesOnClear:!1};else{let z=aC(),W=await rC(z);if(!W)process.exit(0);Q=W}console.log(J7(`
423
+ \uD83D\uDE80 Never lose your conversation history again`),{padding:2,margin:1,borderStyle:"double",borderColor:"magenta",textAlignment:"center"})),await x4(500),nC();let F=D.user||D.project||D.local||D.force,Q;if(F)Q={scope:D.local?"local":D.project?"project":"user",customPath:D.path,hookTimeout:D.timeout?parseInt(D.timeout):180,forceReinstall:!!D.force,enableSmartTrash:!1,saveMemoriesOnClear:!1};else{let W=aC(),z=await rC(W);if(!z)process.exit(0);Q=z}console.log(J7(`
424
424
  \uD83D\uDE80 Beginning Installation Process
425
- `));let B=[{name:"Creating directory structure",fn:()=>oC()},{name:"Installing Chroma MCP server",fn:()=>eC(Q.forceReinstall)},{name:"Adding CLAUDE.md instructions",fn:()=>tC()},{name:"Installing Claude commands",fn:()=>XW()},{name:"Installing memory hooks",fn:()=>sC(Q.hookTimeout)},{name:"Configuring Claude settings",fn:()=>DW(FW(Q))},{name:"Configuring user settings",fn:()=>BW(Q)}];if(Q.enableSmartTrash)B.push({name:"Configuring Smart Trash alias",fn:()=>QW()});for(let z=0;z<B.length;z++){let W=B[z],G=`[${z+1}/${B.length}]`,q=pC(`${HD.gray(G)} ${W.name}...`);q.start(),W.fn(),q.stop(`${HD.gray(G)} ${W.name} ${J7("completed! ✨")}`),await x4(150)}let Y=B8("\uD83C\uDF89 INSTALLATION COMPLETE! \uD83C\uDF89"),J=`
425
+ `));let B=[{name:"Creating directory structure",fn:()=>oC()},{name:"Installing Chroma MCP server",fn:()=>eC(Q.forceReinstall)},{name:"Adding CLAUDE.md instructions",fn:()=>tC()},{name:"Installing Claude commands",fn:()=>XW()},{name:"Installing memory hooks",fn:()=>sC(Q.hookTimeout)},{name:"Configuring Claude settings",fn:()=>DW(FW(Q))},{name:"Configuring user settings",fn:()=>BW(Q)}];if(Q.enableSmartTrash)B.push({name:"Configuring Smart Trash alias",fn:()=>QW()});for(let W=0;W<B.length;W++){let z=B[W],G=`[${W+1}/${B.length}]`,q=pC(`${HD.gray(G)} ${z.name}...`);q.start(),z.fn(),q.stop(`${HD.gray(G)} ${z.name} ${J7("completed! ✨")}`),await x4(150)}let Y=B8("\uD83C\uDF89 INSTALLATION COMPLETE! \uD83C\uDF89"),J=`
426
426
  ${HD.bold("How your new memory system works:")}
427
427
 
428
428
  ${HD.green("•")} When you start Claude Code, claude-mem loads your latest memories automatically
@@ -451,47 +451,47 @@ ${HD.magenta("\uD83D\uDCBE Save-on-clear enabled:")}
451
451
  ${HD.gray(" • /clear now saves memories automatically (takes ~1 minute)")}`:"";console.log(C6(Y+J+X+C,{padding:2,margin:1,borderStyle:"double",borderColor:"green",backgroundColor:"#001122"})),console.log(B8(`
452
452
  ✨ Welcome to the future of persistent AI conversations! ✨
453
453
  `))}E0();import{readFileSync as g4,writeFileSync as q6,existsSync as $4}from"fs";import{join as kF}from"path";import{homedir as YW}from"os";async function JW(){let D=YW(),F=[kF(D,".bashrc"),kF(D,".zshrc"),kF(D,".bash_profile")],Q='alias rm="claude-mem trash"',B=["# claude-mem smart trash alias","# claude-mem trash bin alias"],Y=!1;for(let J of F){if(!$4(J))continue;let X=g4(J,"utf8");if(!X.includes('alias rm="claude-mem trash"'))continue;let C=X.split(`
454
- `),W=C.filter((G,q)=>{if(G.trim()==='alias rm="claude-mem trash"')return!1;for(let A of B)if(G.trim()===A&&q+1<C.length&&C[q+1].trim()==='alias rm="claude-mem trash"')return!1;return!0}).join(`
455
- `);if(W!==X){let G=J+".backup."+Date.now();q6(G,X),q6(J,W),console.log(`✅ Removed Smart Trash alias from ${J.replace(D,"~")}`),Y=!0}}return Y}async function h4(D={}){console.log("\uD83D\uDD04 Uninstalling Claude Memory System hooks...");let F=[];if(D.all)F.push({name:"User",path:CD.getInstance().getClaudeSettingsPath()}),F.push({name:"Project",path:kF(process.cwd(),".claude","settings.json")});else{let W=D.project,G=CD.getInstance();F.push({name:W?"Project":"User",path:W?kF(process.cwd(),".claude","settings.json"):G.getClaudeSettingsPath()})}let B=CD.getInstance().getHooksDirectory(),Y=kF(B,"pre-compact.js"),J=kF(B,"session-start.js"),X=kF(B,"session-end.js"),C=0;for(let W of F){if(!$4(W.path)){console.log(`⏭️ No settings found at ${W.name} location`);continue}let G=g4(W.path,"utf8"),q=JSON.parse(G);if(!q.hooks){console.log(`⏭️ No hooks configured in ${W.name} settings`);continue}let A=!1;if(q.hooks.PreCompact){let U=q.hooks.PreCompact.filter((Z)=>!Z.hooks?.some((H)=>H.command===Y||H.command?.includes("pre-compact.js")||H.command?.includes("claude-mem")));if(U.length!==q.hooks.PreCompact.length)q.hooks.PreCompact=U.length?U:void 0,A=!0,console.log(`✅ Removed PreCompact hook from ${W.name} settings`)}if(q.hooks.SessionStart){let U=q.hooks.SessionStart.filter((Z)=>!Z.hooks?.some((H)=>H.command===J||H.command?.includes("session-start.js")||H.command?.includes("claude-mem")));if(U.length!==q.hooks.SessionStart.length)q.hooks.SessionStart=U.length?U:void 0,A=!0,console.log(`✅ Removed SessionStart hook from ${W.name} settings`)}if(q.hooks.SessionEnd){let U=q.hooks.SessionEnd.filter((Z)=>!Z.hooks?.some((H)=>H.command===X||H.command?.includes("session-end.js")||H.command?.includes("claude-mem")));if(U.length!==q.hooks.SessionEnd.length)q.hooks.SessionEnd=U.length?U:void 0,A=!0,console.log(`✅ Removed SessionEnd hook from ${W.name} settings`)}if(q.hooks.PreCompact===void 0)delete q.hooks.PreCompact;if(q.hooks.SessionStart===void 0)delete q.hooks.SessionStart;if(q.hooks.SessionEnd===void 0)delete q.hooks.SessionEnd;if(!Object.keys(q.hooks).length)delete q.hooks;if(A){let U=W.path+".backup."+Date.now();q6(U,G),console.log(`\uD83D\uDCCB Created backup: ${U}`),q6(W.path,JSON.stringify(q,null,2)),C++,console.log(`✅ Updated ${W.name} settings: ${W.path}`)}else console.log(`ℹ️ No Claude Memory System hooks found in ${W.name} settings`)}let z=await JW();if(console.log(""),C>0||z){if(console.log("✨ Uninstallation complete!"),C>0)console.log("The Claude Memory System hooks have been removed from your settings.");if(z)console.log("The Smart Trash alias has been removed from your shell configuration."),console.log("⚠️ Restart your terminal for the alias removal to take effect.");console.log(""),console.log("Note: Your compressed transcripts and archives are preserved."),console.log("To reinstall: claude-mem install")}else console.log("ℹ️ No Claude Memory System hooks or aliases were found to remove.")}E0();t0();N6();import{readFileSync as Z7,existsSync as J8,readdirSync as oW,statSync as sW}from"fs";import{join as bF,dirname as tW}from"path";import{execSync as eW}from"child_process";import{fileURLToPath as Dz}from"url";var tZ=tW(Dz(import.meta.url));async function R5(){console.log("\uD83D\uDD0D Claude Memory System Status Check"),console.log(`=====================================
456
- `),console.log("\uD83D\uDCC2 Runtime Hook Scripts (installed from hook-templates/):");let D=CD.getInstance(),F=D.getHooksDirectory(),Q=bF(F,"session-start.js"),B=bF(F,"stop.js"),Y=bF(F,"user-prompt-submit.js"),J=bF(F,"post-tool-use.js"),X=(Z,H)=>{if(J8(Z))console.log(` ✅ ${H}: Found at ${Z}`);else console.log(` ❌ ${H}: Not found at ${Z}`)};X(Q,"session-start.js"),X(B,"stop.js"),X(Y,"user-prompt-submit.js"),X(J,"post-tool-use.js"),console.log(""),console.log("⚙️ Settings Configuration:");let C=(Z,H)=>{if(!J8(H)){console.log(` ⏭️ ${Z}: No settings file`);return}console.log(` \uD83D\uDCCB ${Z}: ${H}`);try{let V=JSON.parse(Z7(H,"utf8")),N=V.hooks?.SessionStart?.some((b)=>b.hooks?.some((I)=>I.command?.includes("session-start.js")||I.command?.includes("claude-mem"))),L=V.hooks?.Stop?.some((b)=>b.hooks?.some((I)=>I.command?.includes("stop.js")||I.command?.includes("claude-mem"))),R=V.hooks?.UserPromptSubmit?.some((b)=>b.hooks?.some((I)=>I.command?.includes("user-prompt-submit.js")||I.command?.includes("claude-mem"))),k=V.hooks?.PostToolUse?.some((b)=>b.hooks?.some((I)=>I.command?.includes("post-tool-use.js")||I.command?.includes("claude-mem")));console.log(` SessionStart: ${N?"✅":"❌"}`),console.log(` Stop: ${L?"✅":"❌"}`),console.log(` UserPromptSubmit: ${R?"✅":"❌"}`),console.log(` PostToolUse: ${k?"✅":"❌"}`)}catch(V){console.log(" ⚠️ Could not parse settings")}};C("Global",D.getClaudeSettingsPath()),C("Project",bF(process.cwd(),".claude","settings.json")),console.log(""),console.log("\uD83D\uDCE6 Compressed Transcripts:");let z=bF(D.getClaudeConfigDirectory(),"projects");if(J8(z))try{let Z=0,H=0,V=(N,L=0)=>{if(L>3)return;let R=oW(N);for(let k of R){let b=bF(N,k);if(sW(b).isDirectory()&&!k.startsWith("."))V(b,L+1);else if(k.endsWith(".jsonl.compressed"))Z++;else if(k.endsWith(".jsonl.archive"))H++}};V(z),console.log(` Compressed files: ${Z}`),console.log(` Archive files: ${H}`)}catch(Z){console.log(" ⚠️ Could not scan projects directory")}else console.log(" ℹ️ No Claude projects directory found");console.log(""),console.log("\uD83D\uDD27 Runtime Environment:");let W=(Z,H)=>{try{let V=eW(`${Z} --version`,{encoding:"utf8"}).trim();console.log(` ✅ ${H}: ${V}`)}catch{console.log(` ❌ ${H}: Not found`)}};W("node","Node.js"),W("bun","Bun"),console.log(""),console.log("\uD83E\uDDE0 Chroma Storage Status:"),console.log(" ✅ Storage backend: Chroma MCP"),console.log(` \uD83D\uDCCD Data location: ${D.getChromaDirectory()}`),console.log(" \uD83D\uDD0D Features: Vector search, semantic similarity, document storage"),console.log(""),console.log("\uD83E\uDD16 Claude Agent SDK Sessions:");try{await S0.getInstance().initialize();let V=new Y8().getAll();if(V.length===0)console.log(HD.gray(" No active sessions"));else{let N=V.filter((L)=>{return(Date.now()-L.last_used_epoch)/86400000<7}).length;console.log(` \uD83D\uDCCA Total sessions: ${V.length}`),console.log(` ✅ Active (< 7 days): ${N}`),console.log(HD.dim(" \uD83D\uDCA1 View details: claude-mem sessions list"))}}catch(Z){console.log(HD.gray(" ⚠️ Could not load session info"))}console.log(""),console.log("\uD83D\uDCCA Summary:");let G=D.getClaudeSettingsPath(),q=bF(process.cwd(),".claude","settings.json"),A=!1,U="Not installed";try{if(J8(G)){let Z=JSON.parse(Z7(G,"utf8"));if(Z.hooks?.SessionStart||Z.hooks?.Stop||Z.hooks?.PostToolUse)A=!0,U="Global"}if(J8(q)){let Z=JSON.parse(Z7(q,"utf8"));if(Z.hooks?.SessionStart||Z.hooks?.Stop||Z.hooks?.PostToolUse)A=!0,U=U==="Global"?"Global + Project":"Project"}}catch{}if(A)console.log(` ✅ Claude Memory System is installed (${U})`),console.log(""),console.log("\uD83D\uDCA1 To test: Use /compact in Claude Code");else console.log(" ❌ Claude Memory System is not installed"),console.log(""),console.log("\uD83D\uDCA1 To install: claude-mem install")}E0();import{readFileSync as Fz,readdirSync as Bz,statSync as Qz}from"fs";import{join as _5}from"path";async function Xz(D,F,Q){try{let J=Fz(D,"utf8").split(`
457
- `).filter((X)=>X.trim()).slice(-Q);if(console.log(`\uD83D\uDCCB ${F} Logs (last ${Q} lines):`),console.log(` File: ${D}`),console.log(""),J.length===0)console.log(" No log entries found");else J.forEach((X)=>{console.log(` ${X}`)});console.log("")}catch(B){console.log(`❌ Could not read ${F.toLowerCase()} log: ${D}`)}}async function O5(D={}){let F=CD.getLogsDirectory(),Q=parseInt(D.tail)||20;try{let Y=Bz(F).filter((J)=>J.startsWith("claude-mem-")&&J.endsWith(".log")).map((J)=>({name:J,path:_5(F,J),mtime:Qz(_5(F,J)).mtime})).sort((J,X)=>X.mtime.getTime()-J.mtime.getTime());if(Y.length===0){console.log("❌ No log files found in ~/.claude-mem/logs/");return}if(await Xz(Y[0].path,"Most Recent",Q),D.all&&Y.length>1)console.log(`\uD83D\uDCDA Found ${Y.length} total log files`)}catch(B){console.log("❌ Could not read logs directory: ~/.claude-mem/logs/"),console.log(" Run a compression first to generate logs")}if(D.follow)console.log("Following logs... (Press Ctrl+C to stop)"),setInterval(()=>{},1000)}E0();import G8 from"fs";import{join as Vz}from"path";function I5(D){try{let F=D instanceof Date?D:new Date(D),B=new Date().getTime()-F.getTime(),Y=Math.floor(B/1000),J=Math.floor(Y/60),X=Math.floor(J/60),C=Math.floor(X/24),z=Math.floor(C/7),W=Math.floor(C/30);if(Y<60)return"Just now";else if(J<60)return J===1?"1 minute ago":`${J} minutes ago`;else if(X<24)return X===1?"1 hour ago":`${X} hours ago`;else if(C===1)return"Yesterday";else if(C<7)return`${C} days ago`;else if(z===1)return"1 week ago";else if(z<4)return`${z} weeks ago`;else if(W===1)return"1 month ago";else if(W<12)return`${W} months ago`;else{let G=Math.floor(W/12);return G===1?"1 year ago":`${G} years ago`}}catch(F){return"Recently"}}function R6(){let D=process.env.CLAUDE_MEM_WRAP_WIDTH;if(D){let F=parseInt(D,10);if(!Number.isNaN(F)&&F>40&&F<=200)return F}return 80}function Yz(D,F){if(!D)return"";if(/^[\-=\u2014_\u2500\u2550]{5,}$/.test(D.trim()))return D;if(D.length<=F)return D;let Q=D.match(/^\s*/),B=Q?Q[0]:"",Y=D.slice(B.length),J=Math.max(10,F-B.length),X=Y.split(/(\s+)/),C=[],z="",W=()=>{C.push(B+z.trimEnd()),z=""};for(let G of X){if(G==="")continue;if(!/\s/.test(G)&&G.length>J){if(z.trim().length>0)W();let q=0;while(q<G.length){let A=G.slice(q,q+J);C.push(B+A),q+=J}z="";continue}if(B.length+z.length+G.length>F)W();z+=G}if(z.trim().length>0||C.length===0)W();return C.join(`
454
+ `),z=C.filter((G,q)=>{if(G.trim()==='alias rm="claude-mem trash"')return!1;for(let A of B)if(G.trim()===A&&q+1<C.length&&C[q+1].trim()==='alias rm="claude-mem trash"')return!1;return!0}).join(`
455
+ `);if(z!==X){let G=J+".backup."+Date.now();q6(G,X),q6(J,z),console.log(`✅ Removed Smart Trash alias from ${J.replace(D,"~")}`),Y=!0}}return Y}async function h4(D={}){console.log("\uD83D\uDD04 Uninstalling Claude Memory System hooks...");let F=[];if(D.all)F.push({name:"User",path:CD.getInstance().getClaudeSettingsPath()}),F.push({name:"Project",path:kF(process.cwd(),".claude","settings.json")});else{let z=D.project,G=CD.getInstance();F.push({name:z?"Project":"User",path:z?kF(process.cwd(),".claude","settings.json"):G.getClaudeSettingsPath()})}let B=CD.getInstance().getHooksDirectory(),Y=kF(B,"pre-compact.js"),J=kF(B,"session-start.js"),X=kF(B,"session-end.js"),C=0;for(let z of F){if(!$4(z.path)){console.log(`⏭️ No settings found at ${z.name} location`);continue}let G=g4(z.path,"utf8"),q=JSON.parse(G);if(!q.hooks){console.log(`⏭️ No hooks configured in ${z.name} settings`);continue}let A=!1;if(q.hooks.PreCompact){let U=q.hooks.PreCompact.filter((Z)=>!Z.hooks?.some((H)=>H.command===Y||H.command?.includes("pre-compact.js")||H.command?.includes("claude-mem")));if(U.length!==q.hooks.PreCompact.length)q.hooks.PreCompact=U.length?U:void 0,A=!0,console.log(`✅ Removed PreCompact hook from ${z.name} settings`)}if(q.hooks.SessionStart){let U=q.hooks.SessionStart.filter((Z)=>!Z.hooks?.some((H)=>H.command===J||H.command?.includes("session-start.js")||H.command?.includes("claude-mem")));if(U.length!==q.hooks.SessionStart.length)q.hooks.SessionStart=U.length?U:void 0,A=!0,console.log(`✅ Removed SessionStart hook from ${z.name} settings`)}if(q.hooks.SessionEnd){let U=q.hooks.SessionEnd.filter((Z)=>!Z.hooks?.some((H)=>H.command===X||H.command?.includes("session-end.js")||H.command?.includes("claude-mem")));if(U.length!==q.hooks.SessionEnd.length)q.hooks.SessionEnd=U.length?U:void 0,A=!0,console.log(`✅ Removed SessionEnd hook from ${z.name} settings`)}if(q.hooks.PreCompact===void 0)delete q.hooks.PreCompact;if(q.hooks.SessionStart===void 0)delete q.hooks.SessionStart;if(q.hooks.SessionEnd===void 0)delete q.hooks.SessionEnd;if(!Object.keys(q.hooks).length)delete q.hooks;if(A){let U=z.path+".backup."+Date.now();q6(U,G),console.log(`\uD83D\uDCCB Created backup: ${U}`),q6(z.path,JSON.stringify(q,null,2)),C++,console.log(`✅ Updated ${z.name} settings: ${z.path}`)}else console.log(`ℹ️ No Claude Memory System hooks found in ${z.name} settings`)}let W=await JW();if(console.log(""),C>0||W){if(console.log("✨ Uninstallation complete!"),C>0)console.log("The Claude Memory System hooks have been removed from your settings.");if(W)console.log("The Smart Trash alias has been removed from your shell configuration."),console.log("⚠️ Restart your terminal for the alias removal to take effect.");console.log(""),console.log("Note: Your compressed transcripts and archives are preserved."),console.log("To reinstall: claude-mem install")}else console.log("ℹ️ No Claude Memory System hooks or aliases were found to remove.")}E0();t0();N6();import{readFileSync as Z7,existsSync as J8,readdirSync as oW,statSync as sW}from"fs";import{join as bF,dirname as tW}from"path";import{execSync as eW}from"child_process";import{fileURLToPath as Dz}from"url";var tZ=tW(Dz(import.meta.url));async function R5(){console.log("\uD83D\uDD0D Claude Memory System Status Check"),console.log(`=====================================
456
+ `),console.log("\uD83D\uDCC2 Runtime Hook Scripts (installed from hook-templates/):");let D=CD.getInstance(),F=D.getHooksDirectory(),Q=bF(F,"session-start.js"),B=bF(F,"stop.js"),Y=bF(F,"user-prompt-submit.js"),J=bF(F,"post-tool-use.js"),X=(Z,H)=>{if(J8(Z))console.log(` ✅ ${H}: Found at ${Z}`);else console.log(` ❌ ${H}: Not found at ${Z}`)};X(Q,"session-start.js"),X(B,"stop.js"),X(Y,"user-prompt-submit.js"),X(J,"post-tool-use.js"),console.log(""),console.log("⚙️ Settings Configuration:");let C=(Z,H)=>{if(!J8(H)){console.log(` ⏭️ ${Z}: No settings file`);return}console.log(` \uD83D\uDCCB ${Z}: ${H}`);try{let V=JSON.parse(Z7(H,"utf8")),j=V.hooks?.SessionStart?.some((b)=>b.hooks?.some((I)=>I.command?.includes("session-start.js")||I.command?.includes("claude-mem"))),L=V.hooks?.Stop?.some((b)=>b.hooks?.some((I)=>I.command?.includes("stop.js")||I.command?.includes("claude-mem"))),R=V.hooks?.UserPromptSubmit?.some((b)=>b.hooks?.some((I)=>I.command?.includes("user-prompt-submit.js")||I.command?.includes("claude-mem"))),k=V.hooks?.PostToolUse?.some((b)=>b.hooks?.some((I)=>I.command?.includes("post-tool-use.js")||I.command?.includes("claude-mem")));console.log(` SessionStart: ${j?"✅":"❌"}`),console.log(` Stop: ${L?"✅":"❌"}`),console.log(` UserPromptSubmit: ${R?"✅":"❌"}`),console.log(` PostToolUse: ${k?"✅":"❌"}`)}catch(V){console.log(" ⚠️ Could not parse settings")}};C("Global",D.getClaudeSettingsPath()),C("Project",bF(process.cwd(),".claude","settings.json")),console.log(""),console.log("\uD83D\uDCE6 Compressed Transcripts:");let W=bF(D.getClaudeConfigDirectory(),"projects");if(J8(W))try{let Z=0,H=0,V=(j,L=0)=>{if(L>3)return;let R=oW(j);for(let k of R){let b=bF(j,k);if(sW(b).isDirectory()&&!k.startsWith("."))V(b,L+1);else if(k.endsWith(".jsonl.compressed"))Z++;else if(k.endsWith(".jsonl.archive"))H++}};V(W),console.log(` Compressed files: ${Z}`),console.log(` Archive files: ${H}`)}catch(Z){console.log(" ⚠️ Could not scan projects directory")}else console.log(" ℹ️ No Claude projects directory found");console.log(""),console.log("\uD83D\uDD27 Runtime Environment:");let z=(Z,H)=>{try{let V=eW(`${Z} --version`,{encoding:"utf8"}).trim();console.log(` ✅ ${H}: ${V}`)}catch{console.log(` ❌ ${H}: Not found`)}};z("node","Node.js"),z("bun","Bun"),console.log(""),console.log("\uD83E\uDDE0 Chroma Storage Status:"),console.log(" ✅ Storage backend: Chroma MCP"),console.log(` \uD83D\uDCCD Data location: ${D.getChromaDirectory()}`),console.log(" \uD83D\uDD0D Features: Vector search, semantic similarity, document storage"),console.log(""),console.log("\uD83E\uDD16 Claude Agent SDK Sessions:");try{await S0.getInstance().initialize();let V=new Y8().getAll();if(V.length===0)console.log(HD.gray(" No active sessions"));else{let j=V.filter((L)=>{return(Date.now()-L.last_used_epoch)/86400000<7}).length;console.log(` \uD83D\uDCCA Total sessions: ${V.length}`),console.log(` ✅ Active (< 7 days): ${j}`),console.log(HD.dim(" \uD83D\uDCA1 View details: claude-mem sessions list"))}}catch(Z){console.log(HD.gray(" ⚠️ Could not load session info"))}console.log(""),console.log("\uD83D\uDCCA Summary:");let G=D.getClaudeSettingsPath(),q=bF(process.cwd(),".claude","settings.json"),A=!1,U="Not installed";try{if(J8(G)){let Z=JSON.parse(Z7(G,"utf8"));if(Z.hooks?.SessionStart||Z.hooks?.Stop||Z.hooks?.PostToolUse)A=!0,U="Global"}if(J8(q)){let Z=JSON.parse(Z7(q,"utf8"));if(Z.hooks?.SessionStart||Z.hooks?.Stop||Z.hooks?.PostToolUse)A=!0,U=U==="Global"?"Global + Project":"Project"}}catch{}if(A)console.log(` ✅ Claude Memory System is installed (${U})`),console.log(""),console.log("\uD83D\uDCA1 To test: Use /compact in Claude Code");else console.log(" ❌ Claude Memory System is not installed"),console.log(""),console.log("\uD83D\uDCA1 To install: claude-mem install")}E0();import{readFileSync as Fz,readdirSync as Bz,statSync as Qz}from"fs";import{join as _5}from"path";async function Xz(D,F,Q){try{let J=Fz(D,"utf8").split(`
457
+ `).filter((X)=>X.trim()).slice(-Q);if(console.log(`\uD83D\uDCCB ${F} Logs (last ${Q} lines):`),console.log(` File: ${D}`),console.log(""),J.length===0)console.log(" No log entries found");else J.forEach((X)=>{console.log(` ${X}`)});console.log("")}catch(B){console.log(`❌ Could not read ${F.toLowerCase()} log: ${D}`)}}async function O5(D={}){let F=CD.getLogsDirectory(),Q=parseInt(D.tail)||20;try{let Y=Bz(F).filter((J)=>J.startsWith("claude-mem-")&&J.endsWith(".log")).map((J)=>({name:J,path:_5(F,J),mtime:Qz(_5(F,J)).mtime})).sort((J,X)=>X.mtime.getTime()-J.mtime.getTime());if(Y.length===0){console.log("❌ No log files found in ~/.claude-mem/logs/");return}if(await Xz(Y[0].path,"Most Recent",Q),D.all&&Y.length>1)console.log(`\uD83D\uDCDA Found ${Y.length} total log files`)}catch(B){console.log("❌ Could not read logs directory: ~/.claude-mem/logs/"),console.log(" Run a compression first to generate logs")}if(D.follow)console.log("Following logs... (Press Ctrl+C to stop)"),setInterval(()=>{},1000)}E0();import G8 from"fs";import{join as Vz}from"path";function I5(D){try{let F=D instanceof Date?D:new Date(D),B=new Date().getTime()-F.getTime(),Y=Math.floor(B/1000),J=Math.floor(Y/60),X=Math.floor(J/60),C=Math.floor(X/24),W=Math.floor(C/7),z=Math.floor(C/30);if(Y<60)return"Just now";else if(J<60)return J===1?"1 minute ago":`${J} minutes ago`;else if(X<24)return X===1?"1 hour ago":`${X} hours ago`;else if(C===1)return"Yesterday";else if(C<7)return`${C} days ago`;else if(W===1)return"1 week ago";else if(W<4)return`${W} weeks ago`;else if(z===1)return"1 month ago";else if(z<12)return`${z} months ago`;else{let G=Math.floor(z/12);return G===1?"1 year ago":`${G} years ago`}}catch(F){return"Recently"}}function R6(){let D=process.env.CLAUDE_MEM_WRAP_WIDTH;if(D){let F=parseInt(D,10);if(!Number.isNaN(F)&&F>40&&F<=200)return F}return 80}function Yz(D,F){if(!D)return"";if(/^[\-=\u2014_\u2500\u2550]{5,}$/.test(D.trim()))return D;if(D.length<=F)return D;let Q=D.match(/^\s*/),B=Q?Q[0]:"",Y=D.slice(B.length),J=Math.max(10,F-B.length),X=Y.split(/(\s+)/),C=[],W="",z=()=>{C.push(B+W.trimEnd()),W=""};for(let G of X){if(G==="")continue;if(!/\s/.test(G)&&G.length>J){if(W.trim().length>0)z();let q=0;while(q<G.length){let A=G.slice(q,q+J);C.push(B+A),q+=J}W="";continue}if(B.length+W.length+G.length>F)z();W+=G}if(W.trim().length>0||C.length===0)z();return C.join(`
458
458
  `)}function $0(D,F){if(!D)return"";return D.split(`
459
459
  `).map((Q)=>Yz(Q,F)).join(`
460
460
  `)}function j6(D="─",F=R6()){if(!D||D.length===0)D="-";return D.repeat(F).slice(0,F)}function V7(D,F,Q){let B=F!==void 0?` (${F} items)`:"",Y=Q?`
461
461
  ${Q}`:"",J=R6();return $0(`✅ ${D} completed successfully${B}${Y}`,J)}function L7(D,F,Q){let B=Q?`
462
462
 
463
- \uD83D\uDCA1 ${Q}`:"",Y=R6();return $0(`❌ ${D} encountered an issue: ${F}${B}`,Y)}var Jz={NO_MEMORIES:(D)=>({message:`No previous memories found for ${D}`,suggestion:"This appears to be your first session. Memories will be created as you work."}),CONNECTION_FAILED:()=>({message:"Could not connect to memory system",suggestion:"Try restarting Claude Code or check if the MCP server is properly configured."}),SEARCH_FAILED:(D)=>({message:`Search for "${D}" didn't return any results`,suggestion:"Try using different keywords or check if memories exist for this project."}),LOAD_TIMEOUT:()=>({message:"Memory loading timed out",suggestion:"The operation is taking longer than expected. You can continue without loaded context."})};function C8(D,...F){let Q=Jz[D](...F);return L7("Memory system",Q.message,Q.suggestion)}function w5(D){let F=typeof D==="string"?new Date(D):D,B=new Date().getTime()-F.getTime(),Y=Math.floor(B/60000),J=Math.floor(B/3600000),X=Math.floor(B/86400000);if(Y<1)return"just now";if(Y<60)return`${Y} minute${Y>1?"s":""} ago`;if(J<24)return`${J} hour${J>1?"s":""} ago`;if(X<7)return`${X} day${X>1?"s":""} ago`;return F.toLocaleDateString()}function Cz(D){if(D.length===0)return[];return D.filter((F)=>F.type==="memory").map((F)=>{let Q={summary:F.text||"",sessionId:F.session_id||""};if(F.keywords)Q.keywords=F.keywords;if(F.document_id&&!F.document_id.includes("Session:"))Q.location=F.document_id;return Q}).filter((F)=>F.summary.length>0)}function Wz(D){let F=new Map;return D.forEach((Q)=>{let B=Q.sessionId;if(B){if(!F.has(B))F.set(B,[]);F.get(B).push(Q)}}),Array.from(F.entries()).map(([Q,B])=>{let Y=B.map((J,X)=>({...J,number:X+1}));return{sessionId:Q,memories:Y}})}function zz(D){let F=new Map;return D.forEach((Q)=>{let B=Q.sessionId||"unknown";if(!F.has(B))F.set(B,[]);F.get(B).push(Q)}),Array.from(F.entries()).map(([Q,B])=>{let Y=B.map((X)=>X.timestamp).filter((X)=>X!==void 0).sort((X,C)=>X.getTime()-C.getTime()),J={sessionId:Q,overviews:B};if(Y.length>0)J.earliestTimestamp=Y[0],J.timeAgo=I5(Y[0]);return J})}function T5(D){let{projectName:F,memoryCount:Q,lastSessionTime:B,recentObjects:Y}=D,J=R6(),C=new Date().toLocaleString("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric",hour:"2-digit",minute:"2-digit",timeZoneName:"short"});console.log(""),console.log($0(`\uD83D\uDCC5 ${C}`,J)),console.log(j6("─",J));let z=extractOverviews(Y,10,F);console.error(`[DEBUG] recentObjects has ${Y.length} items`),console.error(`[DEBUG] overviews extracted: ${z.length}`);let W=Cz(Y),G=(q,A)=>{let U=q.includes(",")||q.includes(`
464
- `)?q.split(/[\n,]+/):[q];for(let Z of U){let H=Z.trim();if(!H)continue;let V=H.toLowerCase();if(!A.has(V))A.set(V,H)}};if(W.length>0){let q=Wz(W);console.log(""),console.log(""),console.log($0("\uD83D\uDCDA Memories",J)),q.forEach((A)=>{console.log(j6("─",J)),console.log(""),console.log($0(`\uD83D\uDD0D ${A.sessionId}`,J));let U=new Map;A.memories.forEach((H)=>{if(console.log(""),console.log($0(`${H.number}. ${H.summary}`,J)),H.keywords)G(H.keywords,U)});let Z=Array.from(U.values());if(Z.length>0)console.log(""),console.log($0(`\uD83C\uDFF7️ ${Z.join(", ")}`,J));console.log("")})}if(z.length>0){let q=zz(z);q.sort((A,U)=>{let Z=A.earliestTimestamp?.getTime()||0,H=U.earliestTimestamp?.getTime()||0;return Z-H}),console.log(""),console.log($0("\uD83E\uDDE0 Overviews",J)),console.log(j6("─",J)),q.forEach((A)=>{console.log(""),console.log($0(`\uD83D\uDD0D ${A.sessionId}`,J)),A.overviews.forEach((U,Z)=>{if(console.log(""),console.log($0(`${Z+1}. ${U.content}`,J)),console.log(""),U.timeAgo)console.log($0(`\uD83D\uDCC5 ${U.timeAgo}`,J))}),console.log(""),console.log(j6("─",J))})}else if(W.length===0)console.log($0(`\uD83E\uDDE0 No recent context found for ${F}`,J))}E0();import nF from"fs";t0();N6();N7();R7();O7();w7();_6();O6();async function e0(){let{DatabaseManager:D}=await Promise.resolve().then(() => (t0(),N5)),{migrations:F}=await Promise.resolve().then(() => (O6(),f5)),Q=D.getInstance();for(let G of F)Q.registerMigration(G);let B=await Q.initialize(),{SessionStore:Y}=await Promise.resolve().then(() => (N6(),j5)),{MemoryStore:J}=await Promise.resolve().then(() => (N7(),P5)),{OverviewStore:X}=await Promise.resolve().then(() => (R7(),S5)),{DiagnosticsStore:C}=await Promise.resolve().then(() => (O7(),k5)),{TranscriptEventStore:z}=await Promise.resolve().then(() => (w7(),b5)),{StreamingSessionStore:W}=await Promise.resolve().then(() => (_6(),v5));return{sessions:new Y(B),memories:new J(B),overviews:new X(B),diagnostics:new C(B),transcriptEvents:new z(B),streamingSessions:new W(B)}}class T7{backend="sqlite";stores;async getStores(){if(!this.stores)this.stores=await e0();return this.stores}async isAvailable(){try{return await this.getStores(),!0}catch(D){return!1}}async createSession(D){return(await this.getStores()).sessions.create(D)}async getSession(D){return(await this.getStores()).sessions.getBySessionId(D)}async hasSession(D){return(await this.getStores()).sessions.has(D)}async getAllSessionIds(){return(await this.getStores()).sessions.getAllSessionIds()}async getRecentSessions(D=5){return(await this.getStores()).sessions.getRecent(D)}async getRecentSessionsForProject(D,F=5){return(await this.getStores()).sessions.getRecentForProject(D,F)}async createMemory(D){return(await this.getStores()).memories.create(D)}async createMemories(D){(await this.getStores()).memories.createMany(D)}async getRecentMemories(D=10){return(await this.getStores()).memories.getRecent(D)}async getRecentMemoriesForProject(D,F=10){return(await this.getStores()).memories.getRecentForProject(D,F)}async hasDocumentId(D){return(await this.getStores()).memories.hasDocumentId(D)}async createOverview(D){return(await this.getStores()).overviews.create(D)}async upsertOverview(D){return(await this.getStores()).overviews.upsert(D)}async getRecentOverviews(D=5){return(await this.getStores()).overviews.getRecent(D)}async getRecentOverviewsForProject(D,F=5){return(await this.getStores()).overviews.getRecentForProject(D,F)}async createDiagnostic(D){return(await this.getStores()).diagnostics.create(D)}}class g5{backend="jsonl";pathDiscovery=CD.getInstance();async isAvailable(){try{let D=this.pathDiscovery.getDataDirectory();return nF.mkdirSync(D,{recursive:!0}),!0}catch{return!1}}appendToIndex(D){let F=this.pathDiscovery.getIndexPath();nF.appendFileSync(F,JSON.stringify(D)+"\\n","utf8")}async createSession(D){let F={type:"session",session_id:D.session_id,project:D.project,timestamp:D.created_at};this.appendToIndex(F)}async getSession(){return null}async hasSession(D){return(await this.getAllSessionIds()).has(D)}async getAllSessionIds(){let D=this.pathDiscovery.getIndexPath();if(!nF.existsSync(D))return new Set;let Q=nF.readFileSync(D,"utf-8").trim().split("\\n").filter((Y)=>Y.trim()),B=new Set;for(let Y of Q)try{let J=JSON.parse(Y);if(J.session_id)B.add(J.session_id)}catch{}return B}async getRecentSessions(){return[]}async getRecentSessionsForProject(){return[]}async createMemory(D){let F={type:"memory",text:D.text,document_id:D.document_id,keywords:D.keywords,session_id:D.session_id,project:D.project,timestamp:D.created_at,archive:D.archive_basename};this.appendToIndex(F)}async createMemories(D){for(let F of D)await this.createMemory(F)}async getRecentMemories(){return[]}async getRecentMemoriesForProject(){return[]}async hasDocumentId(D){let F=this.pathDiscovery.getIndexPath();if(!nF.existsSync(F))return!1;let B=nF.readFileSync(F,"utf-8").trim().split("\\n").filter((Y)=>Y.trim());for(let Y of B)try{let J=JSON.parse(Y);if(J.type==="memory"&&J.document_id===D)return!0}catch{}return!1}async createOverview(D){let F={type:"overview",content:D.content,session_id:D.session_id,project:D.project,timestamp:D.created_at};this.appendToIndex(F)}async upsertOverview(D){await this.createOverview(D)}async getRecentOverviews(){return[]}async getRecentOverviewsForProject(){return[]}async createDiagnostic(D){let F={type:"diagnostic",message:D.message,session_id:D.session_id,project:D.project,timestamp:D.created_at};this.appendToIndex(F)}}var U2=null;async function $5(){if(U2)return U2;let D=new T7;if(await D.isAvailable())return U2=D,U2;let F=new g5;if(await F.isAvailable())return U2=F,U2;throw new Error("No storage backend available")}async function h5(){let F=CD.getInstance().getIndexPath();if(nF.existsSync(F)){if(!await new T7().isAvailable())return!0;try{return(await e0()).sessions.count()===0}catch{return!0}}return!1}import{readFileSync as Gz,existsSync as qz}from"fs";import{join as Hz}from"path";E0();class P7{pathDiscovery;constructor(){this.pathDiscovery=CD.getInstance()}getConfigDir(){return this.pathDiscovery.getDataDirectory()}getIndexDir(){return this.pathDiscovery.getIndexDirectory()}getIndexPath(){return this.pathDiscovery.getIndexPath()}getArchiveDir(){return this.pathDiscovery.getArchivesDirectory()}getProjectArchiveDir(D){return this.pathDiscovery.getProjectArchiveDirectory(D)}getLogsDir(){return this.pathDiscovery.getLogsDirectory()}static ensureDirectory(D){CD.getInstance().ensureDirectory(D)}static ensureDirectories(D){CD.getInstance().ensureDirectories(D)}static extractProjectName(D){return CD.extractProjectName(D)}static getCurrentProjectPrefix(){return CD.getCurrentProjectName()}static getCurrentProjectName(){return CD.getCurrentProjectName()}}class S7{static settingsPath;static cachedSettings=null;static{let D=new P7;this.settingsPath=Hz(D.getConfigDir(),"settings.json")}static readSettings(){if(this.cachedSettings!==null)return this.cachedSettings;try{if(qz(this.settingsPath)){let F=Gz(this.settingsPath,"utf-8"),Q=JSON.parse(F);return this.cachedSettings=Q,Q}}catch{}let D={};return this.cachedSettings=D,D}static getSetting(D,F){return this.readSettings()[D]??F}static getClaudePath(){return this.getSetting("claudePath","claude")}static clearCache(){this.cachedSettings=null}}function z8(){return S7.getClaudePath()}function m5(){return S7.readSettings()}var E2={captureEnabled:!0,summaryEnabled:!0,sessionStartEnabled:!0,chunkTokenLimit:600,chunkOverlapTokens:200,summaryTurnLimit:20};function k7(D,F){if(typeof D==="boolean")return D;if(typeof D==="string"){let Q=D.toLowerCase();if(Q==="true")return!0;if(Q==="false")return!1}return F}function b7(D,F){if(typeof D==="number"&&Number.isFinite(D))return D;if(typeof D==="string"){let Q=Number(D);if(!Number.isNaN(Q)&&Number.isFinite(Q))return Q}return F}function l5(){let D=m5();return{captureEnabled:k7(D.rollingCaptureEnabled,E2.captureEnabled),summaryEnabled:k7(D.rollingSummaryEnabled,E2.summaryEnabled),sessionStartEnabled:k7(D.rollingSessionStartEnabled,E2.sessionStartEnabled),chunkTokenLimit:b7(D.rollingChunkTokens,E2.chunkTokenLimit),chunkOverlapTokens:b7(D.rollingChunkOverlapTokens,E2.chunkOverlapTokens),summaryTurnLimit:b7(D.rollingSummaryTurnLimit,E2.summaryTurnLimit)}}E0();import{appendFileSync as Kz,existsSync as Uz,mkdirSync as Ez}from"fs";import{join as Az}from"path";var I6=null;function Zz(){if(I6)return I6;let F=CD.getInstance().getLogsDirectory();if(!Uz(F))Ez(F,{recursive:!0});return I6=Az(F,"rolling-memory.log"),I6}function w6(D,F,Q={}){try{let B=Zz(),Y={timestamp:new Date().toISOString(),level:D,message:F,...Q};Kz(B,`${JSON.stringify(Y)}
465
- `,"utf8")}catch{}}function d5(D=new Date){return D.toLocaleString("en-US",{weekday:"long",month:"long",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit",timeZoneName:"short"})}function v7(D,F,Q){let B=D.split(" "),Y=[],J=Q,X=" ".repeat(Q.length);for(let C of B){let W=J+(J!==Q&&J!==X?" ":"")+C;if(W.length<=F)J=W;else{if(J.trim())Y.push(J);J=X+C}}if(J.trim())Y.push(J);return Y.join(`
466
- `)}function Lz(D){let F=new Set;return F.add(D),F.add(D.replace(/-/g,"_")),F.add(D.replace(/_/g,"-")),(Q)=>!!Q&&F.has(Q)}function x7(D){if(D===0)return"0 B";let F=1024,Q=["B","KB","MB","GB"],B=Math.floor(Math.log(D)/Math.log(F));return parseFloat((D/Math.pow(F,B)).toFixed(1))+" "+Q[B]}function u7(){let D=CD.getInstance().getTrashDirectory();if(!G8.existsSync(D))return{folderCount:0,fileCount:0,totalSize:0,isEmpty:!0};let F=G8.readdirSync(D);if(F.length===0)return{folderCount:0,fileCount:0,totalSize:0,isEmpty:!0};let Q=0,B=0,Y=0;for(let J of F){let X=Vz(D,J),C=G8.statSync(X);if(C.isDirectory())Q++;else B++;Y+=C.size}return{folderCount:Q,fileCount:B,totalSize:Y,isEmpty:!1}}async function Mz(D){if(!l5().sessionStartEnabled){console.log("Rolling session-start output disabled in settings."),w6("info","session-start output skipped (disabled)",{project:D});return}let Q=await e0(),B=D||CD.getCurrentProjectName(),J=Q.overviews.getAllForProject(B).slice(-10);if(J.length===0){console.log("==============================================================================="),console.log(`What's new | ${d5()}`),console.log("==============================================================================="),console.log("No previous sessions found for this project."),console.log("Start working and claude-mem will automatically capture context for future sessions."),console.log("===============================================================================");let C=u7();if(!C.isEmpty){let z=x7(C.totalSize);console.log(`\uD83D\uDDD1️ Trash – ${C.folderCount} folders | ${C.fileCount} files | ${z} – use \`claude-mem restore\``),console.log("===============================================================================")}return}console.log("==============================================================================="),console.log(`What's new | ${d5()}`),console.log("==============================================================================="),J.forEach((C)=>{let z=new Date(C.created_at),W=z.getFullYear(),G=String(z.getMonth()+1).padStart(2,"0"),q=String(z.getDate()).padStart(2,"0"),A=z.getHours(),U=String(z.getMinutes()).padStart(2,"0"),Z=A>=12?"PM":"AM",H=A%12||12;console.log(`[${W}-${G}-${q} at ${H}:${U} ${Z}]`);let V=Q.memories.getBySessionId(C.session_id),N=V.map((k)=>({title:k.title,subtitle:k.subtitle})).filter((k)=>k.title),L=new Set,R=new Set;if(V.forEach((k)=>{if(k.files_touched)try{let b=JSON.parse(k.files_touched);if(Array.isArray(b))b.forEach((I)=>L.add(I))}catch(b){}if(k.keywords)k.keywords.split(",").forEach((b)=>R.add(b.trim()))}),console.log(""),console.log(v7(C.content,80,"")),L.size>0)console.log(""),console.log(v7(`- ${Array.from(L).join(", ")}`,80,""));if(R.size>0)console.log(""),console.log(v7(`Tags: ${Array.from(R).join(", ")}`,80,""));console.log("")}),console.log("===============================================================================");let X=u7();if(!X.isEmpty){let C=x7(X.totalSize);console.log(`\uD83D\uDDD1️ Trash – ${X.folderCount} folders | ${X.fileCount} files | ${C} – use \`claude-mem restore\``),console.log("===============================================================================")}}async function c5(D={}){try{if(await h5())console.warn("⚠️ JSONL to SQLite migration recommended. Run: claude-mem migrate-index");let F=await $5();if(F.backend==="jsonl")return await Nz(D);let Q=[],B=[],Y=D.project;if(!Y&&D.format==="session-start")Y=CD.getCurrentProjectName();if(D.format==="session-start"){await Mz(Y);return}let J=D.format==="json"?5:3;if(Y)Q=await F.getRecentMemoriesForProject(Y,10),B=await F.getRecentOverviewsForProject(Y,J);else Q=await F.getRecentMemories(10),B=await F.getRecentOverviews(J);let X=Q.map((z)=>({type:"memory",text:z.text,document_id:z.document_id,keywords:z.keywords,session_id:z.session_id,project:z.project,timestamp:z.created_at,archive:z.archive_basename})),C=B.map((z)=>({type:"overview",content:z.content,session_id:z.session_id,project:z.project,timestamp:z.created_at}));if(X.length===0&&C.length===0)return;if(D.format==="json"){let z=[...X,...C];console.log(JSON.stringify(z))}else{let z=X.length+C.length;console.log(V7("Context loading",z,"recent entries found")),X.forEach((W)=>{console.log(`${W.text} | ${W.document_id} | ${W.keywords}`)}),C.forEach((W)=>{console.log(`**Overview:** ${W.content}`)})}if(D.format!=="json"){let z=u7();if(!z.isEmpty){let W=x7(z.totalSize);console.log(`\uD83D\uDDD1️ Trash – ${z.folderCount} folders | ${z.fileCount} files | ${W} – use \`claude-mem restore\``),console.log("")}}}catch(F){let Q=F instanceof Error?F.message:String(F);if(D.format==="session-start")console.log(C8("CONNECTION_FAILED",Q));else console.log(L7("Context loading",Q,"Check file permissions and try again"))}}async function Nz(D={}){let Q=CD.getInstance().getIndexPath(),B=D.project;if(!B&&D.format==="session-start")B=CD.getCurrentProjectName();if(!G8.existsSync(Q)){if(D.format==="session-start")console.log(C8("NO_MEMORIES",B||"this project"));return}let J=G8.readFileSync(Q,"utf-8").trim().split(`
467
- `).filter((U)=>U.trim());if(J.length===0){if(D.format==="session-start")console.log(C8("NO_MEMORIES",B||"this project"));return}let X=[];for(let U of J)try{if(!U.trim().startsWith("{"))continue;let Z=JSON.parse(U);X.push(Z)}catch(Z){continue}if(X.length===0){if(D.format==="session-start")console.log(C8("NO_MEMORIES",B||"this project"));return}let C=X.filter((U)=>U.type==="memory"),z=X.filter((U)=>U.type==="overview"),W=X.filter((U)=>U.type==="session"),G=C,q=z,A=W;if(B){let U=Lz(B);G=C.filter((Z)=>U(Z.project)),q=z.filter((Z)=>U(Z.project)),A=W.filter((Z)=>U(Z.project))}if(D.format==="session-start"){let U=G.slice(-10),Z=q.slice(-10),V=[...A.slice(-10),...U,...Z],N="recently",L=V.map((R)=>{return R.timestamp?new Date(R.timestamp):null}).filter((R)=>R!==null).sort((R,k)=>k.getTime()-R.getTime());if(L.length>0)N=w5(L[0]);T5({projectName:B||"your project",memoryCount:U.length,lastSessionTime:N,recentObjects:V})}else if(D.format==="json"){let U=G.slice(-10),Z=q.slice(-3),H=[...U,...Z];console.log(JSON.stringify(H))}else{let U=G.slice(-10),Z=q.slice(-3),H=U.length+Z.length;console.log(V7("Context loading",H,"recent entries found")),U.forEach((V)=>{console.log(`${V.text} | ${V.document_id} | ${V.keywords}`)}),Z.forEach((V)=>{console.log(`**Overview:** ${V.content}`)})}}import{renameSync as Jq,existsSync as $B,mkdirSync as Cq,statSync as Wq}from"fs";import{join as zq,basename as Gq}from"path";var y7=(D,F,Q)=>{let B=D instanceof RegExp?p5(D,Q):D,Y=F instanceof RegExp?p5(F,Q):F,J=B!==null&&Y!=null&&jz(B,Y,Q);return J&&{start:J[0],end:J[1],pre:Q.slice(0,J[0]),body:Q.slice(J[0]+B.length,J[1]),post:Q.slice(J[1]+Y.length)}},p5=(D,F)=>{let Q=F.match(D);return Q?Q[0]:null},jz=(D,F,Q)=>{let B,Y,J,X=void 0,C,z=Q.indexOf(D),W=Q.indexOf(F,z+1),G=z;if(z>=0&&W>0){if(D===F)return[z,W];B=[],J=Q.length;while(G>=0&&!C){if(G===z)B.push(G),z=Q.indexOf(D,G+1);else if(B.length===1){let q=B.pop();if(q!==void 0)C=[q,W]}else{if(Y=B.pop(),Y!==void 0&&Y<J)J=Y,X=W;W=Q.indexOf(F,G+1)}G=z<W&&z>=0?z:W}if(B.length&&X!==void 0)C=[J,X]}return C};var n5="\x00SLASH"+Math.random()+"\x00",i5="\x00OPEN"+Math.random()+"\x00",g7="\x00CLOSE"+Math.random()+"\x00",a5="\x00COMMA"+Math.random()+"\x00",r5="\x00PERIOD"+Math.random()+"\x00",Rz=new RegExp(n5,"g"),_z=new RegExp(i5,"g"),Oz=new RegExp(g7,"g"),Iz=new RegExp(a5,"g"),wz=new RegExp(r5,"g"),Tz=/\\\\/g,Pz=/\\{/g,Sz=/\\}/g,kz=/\\,/g,bz=/\\./g;function f7(D){return!isNaN(D)?parseInt(D,10):D.charCodeAt(0)}function vz(D){return D.replace(Tz,n5).replace(Pz,i5).replace(Sz,g7).replace(kz,a5).replace(bz,r5)}function xz(D){return D.replace(Rz,"\\").replace(_z,"{").replace(Oz,"}").replace(Iz,",").replace(wz,".")}function o5(D){if(!D)return[""];let F=[],Q=y7("{","}",D);if(!Q)return D.split(",");let{pre:B,body:Y,post:J}=Q,X=B.split(",");X[X.length-1]+="{"+Y+"}";let C=o5(J);if(J.length)X[X.length-1]+=C.shift(),X.push.apply(X,C);return F.push.apply(F,X),F}function s5(D){if(!D)return[];if(D.slice(0,2)==="{}")D="\\{\\}"+D.slice(2);return q8(vz(D),!0).map(xz)}function uz(D){return"{"+D+"}"}function yz(D){return/^-?0\d/.test(D)}function fz(D,F){return D<=F}function gz(D,F){return D>=F}function q8(D,F){let Q=[],B=y7("{","}",D);if(!B)return[D];let Y=B.pre,J=B.post.length?q8(B.post,!1):[""];if(/\$$/.test(B.pre))for(let X=0;X<J.length;X++){let C=Y+"{"+B.body+"}"+J[X];Q.push(C)}else{let X=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(B.body),C=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(B.body),z=X||C,W=B.body.indexOf(",")>=0;if(!z&&!W){if(B.post.match(/,(?!,).*\}/))return D=B.pre+"{"+B.body+g7+B.post,q8(D);return[D]}let G;if(z)G=B.body.split(/\.\./);else if(G=o5(B.body),G.length===1&&G[0]!==void 0){if(G=q8(G[0],!1).map(uz),G.length===1)return J.map((A)=>B.pre+G[0]+A)}let q;if(z&&G[0]!==void 0&&G[1]!==void 0){let A=f7(G[0]),U=f7(G[1]),Z=Math.max(G[0].length,G[1].length),H=G.length===3&&G[2]!==void 0?Math.abs(f7(G[2])):1,V=fz;if(U<A)H*=-1,V=gz;let L=G.some(yz);q=[];for(let R=A;V(R,U);R+=H){let k;if(C){if(k=String.fromCharCode(R),k==="\\")k=""}else if(k=String(R),L){let b=Z-k.length;if(b>0){let I=new Array(b+1).join("0");if(R<0)k="-"+I+k.slice(1);else k=I+k}}q.push(k)}}else{q=[];for(let A=0;A<G.length;A++)q.push.apply(q,q8(G[A],!1))}for(let A=0;A<q.length;A++)for(let U=0;U<J.length;U++){let Z=Y+q[A]+J[U];if(!F||z||Z)Q.push(Z)}}return Q}var H8=(D)=>{if(typeof D!=="string")throw new TypeError("invalid pattern");if(D.length>65536)throw new TypeError("pattern is too long")};var $z={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},K8=(D)=>D.replace(/[[\]\\-]/g,"\\$&"),hz=(D)=>D.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),t5=(D)=>D.join(""),e5=(D,F)=>{let Q=F;if(D.charAt(Q)!=="[")throw new Error("not in a brace expression");let B=[],Y=[],J=Q+1,X=!1,C=!1,z=!1,W=!1,G=Q,q="";D:while(J<D.length){let H=D.charAt(J);if((H==="!"||H==="^")&&J===Q+1){W=!0,J++;continue}if(H==="]"&&X&&!z){G=J+1;break}if(X=!0,H==="\\"){if(!z){z=!0,J++;continue}}if(H==="["&&!z){for(let[V,[N,L,R]]of Object.entries($z))if(D.startsWith(V,J)){if(q)return["$.",!1,D.length-Q,!0];if(J+=V.length,R)Y.push(N);else B.push(N);C=C||L;continue D}}if(z=!1,q){if(H>q)B.push(K8(q)+"-"+K8(H));else if(H===q)B.push(K8(H));q="",J++;continue}if(D.startsWith("-]",J+1)){B.push(K8(H+"-")),J+=2;continue}if(D.startsWith("-",J+1)){q=H,J+=2;continue}B.push(K8(H)),J++}if(G<J)return["",!1,0,!1];if(!B.length&&!Y.length)return["$.",!1,D.length-Q,!0];if(Y.length===0&&B.length===1&&/^\\?.$/.test(B[0])&&!W){let H=B[0].length===2?B[0].slice(-1):B[0];return[hz(H),!1,G-Q,!1]}let A="["+(W?"^":"")+t5(B)+"]",U="["+(W?"":"^")+t5(Y)+"]";return[B.length&&Y.length?"("+A+"|"+U+")":B.length?A:U,C,G-Q,!0]};var DF=(D,{windowsPathsNoEscape:F=!1}={})=>{return F?D.replace(/\[([^\/\\])\]/g,"$1"):D.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1")};var mz=new Set(["!","?","+","*","@"]),DB=(D)=>mz.has(D),lz="(?!(?:^|/)\\.\\.?(?:$|/))",T6="(?!\\.)",dz=new Set(["[","."]),cz=new Set(["..","."]),pz=new Set("().*{}+?[]^$\\!"),nz=(D)=>D.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),$7="[^/]",FB=$7+"*?",BB=$7+"+?";class X0{type;#D;#F;#Y=!1;#X=[];#J;#M;#V;#G=!1;#C;#H;#q=!1;constructor(D,F,Q={}){if(this.type=D,D)this.#F=!0;if(this.#J=F,this.#D=this.#J?this.#J.#D:this,this.#C=this.#D===this?Q:this.#D.#C,this.#V=this.#D===this?[]:this.#D.#V,D==="!"&&!this.#D.#G)this.#V.push(this);this.#M=this.#J?this.#J.#X.length:0}get hasMagic(){if(this.#F!==void 0)return this.#F;for(let D of this.#X){if(typeof D==="string")continue;if(D.type||D.hasMagic)return this.#F=!0}return this.#F}toString(){if(this.#H!==void 0)return this.#H;if(!this.type)return this.#H=this.#X.map((D)=>String(D)).join("");else return this.#H=this.type+"("+this.#X.map((D)=>String(D)).join("|")+")"}#W(){if(this!==this.#D)throw new Error("should only call on root");if(this.#G)return this;this.toString(),this.#G=!0;let D;while(D=this.#V.pop()){if(D.type!=="!")continue;let F=D,Q=F.#J;while(Q){for(let B=F.#M+1;!Q.type&&B<Q.#X.length;B++)for(let Y of D.#X){if(typeof Y==="string")throw new Error("string part in extglob AST??");Y.copyIn(Q.#X[B])}F=Q,Q=F.#J}}return this}push(...D){for(let F of D){if(F==="")continue;if(typeof F!=="string"&&!(F instanceof X0&&F.#J===this))throw new Error("invalid part: "+F);this.#X.push(F)}}toJSON(){let D=this.type===null?this.#X.slice().map((F)=>typeof F==="string"?F:F.toJSON()):[this.type,...this.#X.map((F)=>F.toJSON())];if(this.isStart()&&!this.type)D.unshift([]);if(this.isEnd()&&(this===this.#D||this.#D.#G&&this.#J?.type==="!"))D.push({});return D}isStart(){if(this.#D===this)return!0;if(!this.#J?.isStart())return!1;if(this.#M===0)return!0;let D=this.#J;for(let F=0;F<this.#M;F++){let Q=D.#X[F];if(!(Q instanceof X0&&Q.type==="!"))return!1}return!0}isEnd(){if(this.#D===this)return!0;if(this.#J?.type==="!")return!0;if(!this.#J?.isEnd())return!1;if(!this.type)return this.#J?.isEnd();let D=this.#J?this.#J.#X.length:0;return this.#M===D-1}copyIn(D){if(typeof D==="string")this.push(D);else this.push(D.clone(this))}clone(D){let F=new X0(this.type,D);for(let Q of this.#X)F.copyIn(Q);return F}static#B(D,F,Q,B){let Y=!1,J=!1,X=-1,C=!1;if(F.type===null){let A=Q,U="";while(A<D.length){let Z=D.charAt(A++);if(Y||Z==="\\"){Y=!Y,U+=Z;continue}if(J){if(A===X+1){if(Z==="^"||Z==="!")C=!0}else if(Z==="]"&&!(A===X+2&&C))J=!1;U+=Z;continue}else if(Z==="["){J=!0,X=A,C=!1,U+=Z;continue}if(!B.noext&&DB(Z)&&D.charAt(A)==="("){F.push(U),U="";let H=new X0(Z,F);A=X0.#B(D,H,A,B),F.push(H);continue}U+=Z}return F.push(U),A}let z=Q+1,W=new X0(null,F),G=[],q="";while(z<D.length){let A=D.charAt(z++);if(Y||A==="\\"){Y=!Y,q+=A;continue}if(J){if(z===X+1){if(A==="^"||A==="!")C=!0}else if(A==="]"&&!(z===X+2&&C))J=!1;q+=A;continue}else if(A==="["){J=!0,X=z,C=!1,q+=A;continue}if(DB(A)&&D.charAt(z)==="("){W.push(q),q="";let U=new X0(A,W);W.push(U),z=X0.#B(D,U,z,B);continue}if(A==="|"){W.push(q),q="",G.push(W),W=new X0(null,F);continue}if(A===")"){if(q===""&&F.#X.length===0)F.#q=!0;return W.push(q),q="",F.push(...G,W),z}q+=A}return F.type=null,F.#F=void 0,F.#X=[D.substring(Q-1)],z}static fromGlob(D,F={}){let Q=new X0(null,void 0,F);return X0.#B(D,Q,0,F),Q}toMMPattern(){if(this!==this.#D)return this.#D.toMMPattern();let D=this.toString(),[F,Q,B,Y]=this.toRegExpSource();if(!(B||this.#F||this.#C.nocase&&!this.#C.nocaseMagicOnly&&D.toUpperCase()!==D.toLowerCase()))return Q;let X=(this.#C.nocase?"i":"")+(Y?"u":"");return Object.assign(new RegExp(`^${F}$`,X),{_src:F,_glob:D})}get options(){return this.#C}toRegExpSource(D){let F=D??!!this.#C.dot;if(this.#D===this)this.#W();if(!this.type){let C=this.isStart()&&this.isEnd(),z=this.#X.map((A)=>{let[U,Z,H,V]=typeof A==="string"?X0.#N(A,this.#F,C):A.toRegExpSource(D);return this.#F=this.#F||H,this.#Y=this.#Y||V,U}).join(""),W="";if(this.isStart()){if(typeof this.#X[0]==="string"){if(!(this.#X.length===1&&cz.has(this.#X[0]))){let U=dz,Z=F&&U.has(z.charAt(0))||z.startsWith("\\.")&&U.has(z.charAt(2))||z.startsWith("\\.\\.")&&U.has(z.charAt(4)),H=!F&&!D&&U.has(z.charAt(0));W=Z?lz:H?T6:""}}}let G="";if(this.isEnd()&&this.#D.#G&&this.#J?.type==="!")G="(?:$|\\/)";return[W+z+G,DF(z),this.#F=!!this.#F,this.#Y]}let Q=this.type==="*"||this.type==="+",B=this.type==="!"?"(?:(?!(?:":"(?:",Y=this.#U(F);if(this.isStart()&&this.isEnd()&&!Y&&this.type!=="!"){let C=this.toString();return this.#X=[C],this.type=null,this.#F=void 0,[C,DF(this.toString()),!1,!1]}let J=!Q||D||F||!T6?"":this.#U(!0);if(J===Y)J="";if(J)Y=`(?:${Y})(?:${J})*?`;let X="";if(this.type==="!"&&this.#q)X=(this.isStart()&&!F?T6:"")+BB;else{let C=this.type==="!"?"))"+(this.isStart()&&!F&&!D?T6:"")+FB+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&J?")":this.type==="*"&&J?")?":`)${this.type}`;X=B+Y+C}return[X,DF(Y),this.#F=!!this.#F,this.#Y]}#U(D){return this.#X.map((F)=>{if(typeof F==="string")throw new Error("string type in extglob ast??");let[Q,B,Y,J]=F.toRegExpSource(D);return this.#Y=this.#Y||J,Q}).filter((F)=>!(this.isStart()&&this.isEnd())||!!F).join("|")}static#N(D,F,Q=!1){let B=!1,Y="",J=!1;for(let X=0;X<D.length;X++){let C=D.charAt(X);if(B){B=!1,Y+=(pz.has(C)?"\\":"")+C;continue}if(C==="\\"){if(X===D.length-1)Y+="\\\\";else B=!0;continue}if(C==="["){let[z,W,G,q]=e5(D,X);if(G){Y+=z,J=J||W,X+=G-1,F=F||q;continue}}if(C==="*"){if(Q&&D==="*")Y+=BB;else Y+=FB;F=!0;continue}if(C==="?"){Y+=$7,F=!0;continue}Y+=nz(C)}return[Y,DF(D),!!F,J]}}var A2=(D,{windowsPathsNoEscape:F=!1}={})=>{return F?D.replace(/[?*()[\]]/g,"[$&]"):D.replace(/[?*()[\]\\]/g,"\\$&")};var Z0=(D,F,Q={})=>{if(H8(F),!Q.nocomment&&F.charAt(0)==="#")return!1;return new m0(F,Q).match(D)},iz=/^\*+([^+@!?\*\[\(]*)$/,az=(D)=>(F)=>!F.startsWith(".")&&F.endsWith(D),rz=(D)=>(F)=>F.endsWith(D),oz=(D)=>{return D=D.toLowerCase(),(F)=>!F.startsWith(".")&&F.toLowerCase().endsWith(D)},sz=(D)=>{return D=D.toLowerCase(),(F)=>F.toLowerCase().endsWith(D)},tz=/^\*+\.\*+$/,ez=(D)=>!D.startsWith(".")&&D.includes("."),DG=(D)=>D!=="."&&D!==".."&&D.includes("."),FG=/^\.\*+$/,BG=(D)=>D!=="."&&D!==".."&&D.startsWith("."),QG=/^\*+$/,XG=(D)=>D.length!==0&&!D.startsWith("."),YG=(D)=>D.length!==0&&D!=="."&&D!=="..",JG=/^\?+([^+@!?\*\[\(]*)?$/,CG=([D,F=""])=>{let Q=YB([D]);if(!F)return Q;return F=F.toLowerCase(),(B)=>Q(B)&&B.toLowerCase().endsWith(F)},WG=([D,F=""])=>{let Q=JB([D]);if(!F)return Q;return F=F.toLowerCase(),(B)=>Q(B)&&B.toLowerCase().endsWith(F)},zG=([D,F=""])=>{let Q=JB([D]);return!F?Q:(B)=>Q(B)&&B.endsWith(F)},GG=([D,F=""])=>{let Q=YB([D]);return!F?Q:(B)=>Q(B)&&B.endsWith(F)},YB=([D])=>{let F=D.length;return(Q)=>Q.length===F&&!Q.startsWith(".")},JB=([D])=>{let F=D.length;return(Q)=>Q.length===F&&Q!=="."&&Q!==".."},CB=typeof process==="object"&&process?typeof process.env==="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",QB={win32:{sep:"\\"},posix:{sep:"/"}},qG=CB==="win32"?QB.win32.sep:QB.posix.sep;Z0.sep=qG;var Y0=Symbol("globstar **");Z0.GLOBSTAR=Y0;var HG="[^/]",KG=HG+"*?",UG="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",EG="(?:(?!(?:\\/|^)\\.).)*?",AG=(D,F={})=>(Q)=>Z0(Q,D,F);Z0.filter=AG;var h0=(D,F={})=>Object.assign({},D,F),ZG=(D)=>{if(!D||typeof D!=="object"||!Object.keys(D).length)return Z0;let F=Z0;return Object.assign((B,Y,J={})=>F(B,Y,h0(D,J)),{Minimatch:class B extends F.Minimatch{constructor(Y,J={}){super(Y,h0(D,J))}static defaults(Y){return F.defaults(h0(D,Y)).Minimatch}},AST:class B extends F.AST{constructor(Y,J,X={}){super(Y,J,h0(D,X))}static fromGlob(Y,J={}){return F.AST.fromGlob(Y,h0(D,J))}},unescape:(B,Y={})=>F.unescape(B,h0(D,Y)),escape:(B,Y={})=>F.escape(B,h0(D,Y)),filter:(B,Y={})=>F.filter(B,h0(D,Y)),defaults:(B)=>F.defaults(h0(D,B)),makeRe:(B,Y={})=>F.makeRe(B,h0(D,Y)),braceExpand:(B,Y={})=>F.braceExpand(B,h0(D,Y)),match:(B,Y,J={})=>F.match(B,Y,h0(D,J)),sep:F.sep,GLOBSTAR:Y0})};Z0.defaults=ZG;var WB=(D,F={})=>{if(H8(D),F.nobrace||!/\{(?:(?!\{).)*\}/.test(D))return[D];return s5(D)};Z0.braceExpand=WB;var VG=(D,F={})=>new m0(D,F).makeRe();Z0.makeRe=VG;var LG=(D,F,Q={})=>{let B=new m0(F,Q);if(D=D.filter((Y)=>B.match(Y)),B.options.nonull&&!D.length)D.push(F);return D};Z0.match=LG;var XB=/[?*]|[+@!]\(.*?\)|\[|\]/,MG=(D)=>D.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");class m0{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(D,F={}){if(H8(D),F=F||{},this.options=F,this.pattern=D,this.platform=F.platform||CB,this.isWindows=this.platform==="win32",this.windowsPathsNoEscape=!!F.windowsPathsNoEscape||F.allowWindowsEscape===!1,this.windowsPathsNoEscape)this.pattern=this.pattern.replace(/\\/g,"/");this.preserveMultipleSlashes=!!F.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!F.nonegate,this.comment=!1,this.empty=!1,this.partial=!!F.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=F.windowsNoMagicRoot!==void 0?F.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let D of this.set)for(let F of D)if(typeof F!=="string")return!0;return!1}debug(...D){}make(){let D=this.pattern,F=this.options;if(!F.nocomment&&D.charAt(0)==="#"){this.comment=!0;return}if(!D){this.empty=!0;return}if(this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],F.debug)this.debug=(...Y)=>console.error(...Y);this.debug(this.pattern,this.globSet);let Q=this.globSet.map((Y)=>this.slashSplit(Y));this.globParts=this.preprocess(Q),this.debug(this.pattern,this.globParts);let B=this.globParts.map((Y,J,X)=>{if(this.isWindows&&this.windowsNoMagicRoot){let C=Y[0]===""&&Y[1]===""&&(Y[2]==="?"||!XB.test(Y[2]))&&!XB.test(Y[3]),z=/^[a-z]:/i.test(Y[0]);if(C)return[...Y.slice(0,4),...Y.slice(4).map((W)=>this.parse(W))];else if(z)return[Y[0],...Y.slice(1).map((W)=>this.parse(W))]}return Y.map((C)=>this.parse(C))});if(this.debug(this.pattern,B),this.set=B.filter((Y)=>Y.indexOf(!1)===-1),this.isWindows)for(let Y=0;Y<this.set.length;Y++){let J=this.set[Y];if(J[0]===""&&J[1]===""&&this.globParts[Y][2]==="?"&&typeof J[3]==="string"&&/^[a-z]:$/i.test(J[3]))J[2]="?"}this.debug(this.pattern,this.set)}preprocess(D){if(this.options.noglobstar){for(let Q=0;Q<D.length;Q++)for(let B=0;B<D[Q].length;B++)if(D[Q][B]==="**")D[Q][B]="*"}let{optimizationLevel:F=1}=this.options;if(F>=2)D=this.firstPhasePreProcess(D),D=this.secondPhasePreProcess(D);else if(F>=1)D=this.levelOneOptimize(D);else D=this.adjascentGlobstarOptimize(D);return D}adjascentGlobstarOptimize(D){return D.map((F)=>{let Q=-1;while((Q=F.indexOf("**",Q+1))!==-1){let B=Q;while(F[B+1]==="**")B++;if(B!==Q)F.splice(Q,B-Q)}return F})}levelOneOptimize(D){return D.map((F)=>{return F=F.reduce((Q,B)=>{let Y=Q[Q.length-1];if(B==="**"&&Y==="**")return Q;if(B===".."){if(Y&&Y!==".."&&Y!=="."&&Y!=="**")return Q.pop(),Q}return Q.push(B),Q},[]),F.length===0?[""]:F})}levelTwoFileOptimize(D){if(!Array.isArray(D))D=this.slashSplit(D);let F=!1;do{if(F=!1,!this.preserveMultipleSlashes){for(let B=1;B<D.length-1;B++){let Y=D[B];if(B===1&&Y===""&&D[0]==="")continue;if(Y==="."||Y==="")F=!0,D.splice(B,1),B--}if(D[0]==="."&&D.length===2&&(D[1]==="."||D[1]===""))F=!0,D.pop()}let Q=0;while((Q=D.indexOf("..",Q+1))!==-1){let B=D[Q-1];if(B&&B!=="."&&B!==".."&&B!=="**")F=!0,D.splice(Q-1,2),Q-=2}}while(F);return D.length===0?[""]:D}firstPhasePreProcess(D){let F=!1;do{F=!1;for(let Q of D){let B=-1;while((B=Q.indexOf("**",B+1))!==-1){let J=B;while(Q[J+1]==="**")J++;if(J>B)Q.splice(B+1,J-B);let X=Q[B+1],C=Q[B+2],z=Q[B+3];if(X!=="..")continue;if(!C||C==="."||C===".."||!z||z==="."||z==="..")continue;F=!0,Q.splice(B,1);let W=Q.slice(0);W[B]="**",D.push(W),B--}if(!this.preserveMultipleSlashes){for(let J=1;J<Q.length-1;J++){let X=Q[J];if(J===1&&X===""&&Q[0]==="")continue;if(X==="."||X==="")F=!0,Q.splice(J,1),J--}if(Q[0]==="."&&Q.length===2&&(Q[1]==="."||Q[1]===""))F=!0,Q.pop()}let Y=0;while((Y=Q.indexOf("..",Y+1))!==-1){let J=Q[Y-1];if(J&&J!=="."&&J!==".."&&J!=="**"){F=!0;let C=Y===1&&Q[Y+1]==="**"?["."]:[];if(Q.splice(Y-1,2,...C),Q.length===0)Q.push("");Y-=2}}}}while(F);return D}secondPhasePreProcess(D){for(let F=0;F<D.length-1;F++)for(let Q=F+1;Q<D.length;Q++){let B=this.partsMatch(D[F],D[Q],!this.preserveMultipleSlashes);if(B){D[F]=[],D[Q]=B;break}}return D.filter((F)=>F.length)}partsMatch(D,F,Q=!1){let B=0,Y=0,J=[],X="";while(B<D.length&&Y<F.length)if(D[B]===F[Y])J.push(X==="b"?F[Y]:D[B]),B++,Y++;else if(Q&&D[B]==="**"&&F[Y]===D[B+1])J.push(D[B]),B++;else if(Q&&F[Y]==="**"&&D[B]===F[Y+1])J.push(F[Y]),Y++;else if(D[B]==="*"&&F[Y]&&(this.options.dot||!F[Y].startsWith("."))&&F[Y]!=="**"){if(X==="b")return!1;X="a",J.push(D[B]),B++,Y++}else if(F[Y]==="*"&&D[B]&&(this.options.dot||!D[B].startsWith("."))&&D[B]!=="**"){if(X==="a")return!1;X="b",J.push(F[Y]),B++,Y++}else return!1;return D.length===F.length&&J}parseNegate(){if(this.nonegate)return;let D=this.pattern,F=!1,Q=0;for(let B=0;B<D.length&&D.charAt(B)==="!";B++)F=!F,Q++;if(Q)this.pattern=D.slice(Q);this.negate=F}matchOne(D,F,Q=!1){let B=this.options;if(this.isWindows){let Z=typeof D[0]==="string"&&/^[a-z]:$/i.test(D[0]),H=!Z&&D[0]===""&&D[1]===""&&D[2]==="?"&&/^[a-z]:$/i.test(D[3]),V=typeof F[0]==="string"&&/^[a-z]:$/i.test(F[0]),N=!V&&F[0]===""&&F[1]===""&&F[2]==="?"&&typeof F[3]==="string"&&/^[a-z]:$/i.test(F[3]),L=H?3:Z?0:void 0,R=N?3:V?0:void 0;if(typeof L==="number"&&typeof R==="number"){let[k,b]=[D[L],F[R]];if(k.toLowerCase()===b.toLowerCase()){if(F[R]=k,R>L)F=F.slice(R);else if(L>R)D=D.slice(L)}}}let{optimizationLevel:Y=1}=this.options;if(Y>=2)D=this.levelTwoFileOptimize(D);this.debug("matchOne",this,{file:D,pattern:F}),this.debug("matchOne",D.length,F.length);for(var J=0,X=0,C=D.length,z=F.length;J<C&&X<z;J++,X++){this.debug("matchOne loop");var W=F[X],G=D[J];if(this.debug(F,W,G),W===!1)return!1;if(W===Y0){this.debug("GLOBSTAR",[F,W,G]);var q=J,A=X+1;if(A===z){this.debug("** at the end");for(;J<C;J++)if(D[J]==="."||D[J]===".."||!B.dot&&D[J].charAt(0)===".")return!1;return!0}while(q<C){var U=D[q];if(this.debug(`
463
+ \uD83D\uDCA1 ${Q}`:"",Y=R6();return $0(`❌ ${D} encountered an issue: ${F}${B}`,Y)}var Jz={NO_MEMORIES:(D)=>({message:`No previous memories found for ${D}`,suggestion:"This appears to be your first session. Memories will be created as you work."}),CONNECTION_FAILED:()=>({message:"Could not connect to memory system",suggestion:"Try restarting Claude Code or check if the MCP server is properly configured."}),SEARCH_FAILED:(D)=>({message:`Search for "${D}" didn't return any results`,suggestion:"Try using different keywords or check if memories exist for this project."}),LOAD_TIMEOUT:()=>({message:"Memory loading timed out",suggestion:"The operation is taking longer than expected. You can continue without loaded context."})};function C8(D,...F){let Q=Jz[D](...F);return L7("Memory system",Q.message,Q.suggestion)}function w5(D){let F=typeof D==="string"?new Date(D):D,B=new Date().getTime()-F.getTime(),Y=Math.floor(B/60000),J=Math.floor(B/3600000),X=Math.floor(B/86400000);if(Y<1)return"just now";if(Y<60)return`${Y} minute${Y>1?"s":""} ago`;if(J<24)return`${J} hour${J>1?"s":""} ago`;if(X<7)return`${X} day${X>1?"s":""} ago`;return F.toLocaleDateString()}function Cz(D){if(D.length===0)return[];return D.filter((F)=>F.type==="memory").map((F)=>{let Q={summary:F.text||"",sessionId:F.session_id||""};if(F.keywords)Q.keywords=F.keywords;if(F.document_id&&!F.document_id.includes("Session:"))Q.location=F.document_id;return Q}).filter((F)=>F.summary.length>0)}function Wz(D){let F=new Map;return D.forEach((Q)=>{let B=Q.sessionId;if(B){if(!F.has(B))F.set(B,[]);F.get(B).push(Q)}}),Array.from(F.entries()).map(([Q,B])=>{let Y=B.map((J,X)=>({...J,number:X+1}));return{sessionId:Q,memories:Y}})}function zz(D){let F=new Map;return D.forEach((Q)=>{let B=Q.sessionId||"unknown";if(!F.has(B))F.set(B,[]);F.get(B).push(Q)}),Array.from(F.entries()).map(([Q,B])=>{let Y=B.map((X)=>X.timestamp).filter((X)=>X!==void 0).sort((X,C)=>X.getTime()-C.getTime()),J={sessionId:Q,overviews:B};if(Y.length>0)J.earliestTimestamp=Y[0],J.timeAgo=I5(Y[0]);return J})}function T5(D){let{projectName:F,memoryCount:Q,lastSessionTime:B,recentObjects:Y}=D,J=R6(),C=new Date().toLocaleString("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric",hour:"2-digit",minute:"2-digit",timeZoneName:"short"});console.log(""),console.log($0(`\uD83D\uDCC5 ${C}`,J)),console.log(j6("─",J));let W=extractOverviews(Y,10,F);console.error(`[DEBUG] recentObjects has ${Y.length} items`),console.error(`[DEBUG] overviews extracted: ${W.length}`);let z=Cz(Y),G=(q,A)=>{let U=q.includes(",")||q.includes(`
464
+ `)?q.split(/[\n,]+/):[q];for(let Z of U){let H=Z.trim();if(!H)continue;let V=H.toLowerCase();if(!A.has(V))A.set(V,H)}};if(z.length>0){let q=Wz(z);console.log(""),console.log(""),console.log($0("\uD83D\uDCDA Memories",J)),q.forEach((A)=>{console.log(j6("─",J)),console.log(""),console.log($0(`\uD83D\uDD0D ${A.sessionId}`,J));let U=new Map;A.memories.forEach((H)=>{if(console.log(""),console.log($0(`${H.number}. ${H.summary}`,J)),H.keywords)G(H.keywords,U)});let Z=Array.from(U.values());if(Z.length>0)console.log(""),console.log($0(`\uD83C\uDFF7️ ${Z.join(", ")}`,J));console.log("")})}if(W.length>0){let q=zz(W);q.sort((A,U)=>{let Z=A.earliestTimestamp?.getTime()||0,H=U.earliestTimestamp?.getTime()||0;return Z-H}),console.log(""),console.log($0("\uD83E\uDDE0 Overviews",J)),console.log(j6("─",J)),q.forEach((A)=>{console.log(""),console.log($0(`\uD83D\uDD0D ${A.sessionId}`,J)),A.overviews.forEach((U,Z)=>{if(console.log(""),console.log($0(`${Z+1}. ${U.content}`,J)),console.log(""),U.timeAgo)console.log($0(`\uD83D\uDCC5 ${U.timeAgo}`,J))}),console.log(""),console.log(j6("─",J))})}else if(z.length===0)console.log($0(`\uD83E\uDDE0 No recent context found for ${F}`,J))}E0();import nF from"fs";t0();N6();N7();R7();O7();w7();_6();O6();async function e0(){let{DatabaseManager:D}=await Promise.resolve().then(() => (t0(),N5)),{migrations:F}=await Promise.resolve().then(() => (O6(),f5)),Q=D.getInstance();for(let G of F)Q.registerMigration(G);let B=await Q.initialize(),{SessionStore:Y}=await Promise.resolve().then(() => (N6(),j5)),{MemoryStore:J}=await Promise.resolve().then(() => (N7(),P5)),{OverviewStore:X}=await Promise.resolve().then(() => (R7(),S5)),{DiagnosticsStore:C}=await Promise.resolve().then(() => (O7(),k5)),{TranscriptEventStore:W}=await Promise.resolve().then(() => (w7(),b5)),{StreamingSessionStore:z}=await Promise.resolve().then(() => (_6(),v5));return{sessions:new Y(B),memories:new J(B),overviews:new X(B),diagnostics:new C(B),transcriptEvents:new W(B),streamingSessions:new z(B)}}class T7{backend="sqlite";stores;async getStores(){if(!this.stores)this.stores=await e0();return this.stores}async isAvailable(){try{return await this.getStores(),!0}catch(D){return!1}}async createSession(D){return(await this.getStores()).sessions.create(D)}async getSession(D){return(await this.getStores()).sessions.getBySessionId(D)}async hasSession(D){return(await this.getStores()).sessions.has(D)}async getAllSessionIds(){return(await this.getStores()).sessions.getAllSessionIds()}async getRecentSessions(D=5){return(await this.getStores()).sessions.getRecent(D)}async getRecentSessionsForProject(D,F=5){return(await this.getStores()).sessions.getRecentForProject(D,F)}async createMemory(D){return(await this.getStores()).memories.create(D)}async createMemories(D){(await this.getStores()).memories.createMany(D)}async getRecentMemories(D=10){return(await this.getStores()).memories.getRecent(D)}async getRecentMemoriesForProject(D,F=10){return(await this.getStores()).memories.getRecentForProject(D,F)}async hasDocumentId(D){return(await this.getStores()).memories.hasDocumentId(D)}async createOverview(D){return(await this.getStores()).overviews.create(D)}async upsertOverview(D){return(await this.getStores()).overviews.upsert(D)}async getRecentOverviews(D=5){return(await this.getStores()).overviews.getRecent(D)}async getRecentOverviewsForProject(D,F=5){return(await this.getStores()).overviews.getRecentForProject(D,F)}async createDiagnostic(D){return(await this.getStores()).diagnostics.create(D)}}class g5{backend="jsonl";pathDiscovery=CD.getInstance();async isAvailable(){try{let D=this.pathDiscovery.getDataDirectory();return nF.mkdirSync(D,{recursive:!0}),!0}catch{return!1}}appendToIndex(D){let F=this.pathDiscovery.getIndexPath();nF.appendFileSync(F,JSON.stringify(D)+"\\n","utf8")}async createSession(D){let F={type:"session",session_id:D.session_id,project:D.project,timestamp:D.created_at};this.appendToIndex(F)}async getSession(){return null}async hasSession(D){return(await this.getAllSessionIds()).has(D)}async getAllSessionIds(){let D=this.pathDiscovery.getIndexPath();if(!nF.existsSync(D))return new Set;let Q=nF.readFileSync(D,"utf-8").trim().split("\\n").filter((Y)=>Y.trim()),B=new Set;for(let Y of Q)try{let J=JSON.parse(Y);if(J.session_id)B.add(J.session_id)}catch{}return B}async getRecentSessions(){return[]}async getRecentSessionsForProject(){return[]}async createMemory(D){let F={type:"memory",text:D.text,document_id:D.document_id,keywords:D.keywords,session_id:D.session_id,project:D.project,timestamp:D.created_at,archive:D.archive_basename};this.appendToIndex(F)}async createMemories(D){for(let F of D)await this.createMemory(F)}async getRecentMemories(){return[]}async getRecentMemoriesForProject(){return[]}async hasDocumentId(D){let F=this.pathDiscovery.getIndexPath();if(!nF.existsSync(F))return!1;let B=nF.readFileSync(F,"utf-8").trim().split("\\n").filter((Y)=>Y.trim());for(let Y of B)try{let J=JSON.parse(Y);if(J.type==="memory"&&J.document_id===D)return!0}catch{}return!1}async createOverview(D){let F={type:"overview",content:D.content,session_id:D.session_id,project:D.project,timestamp:D.created_at};this.appendToIndex(F)}async upsertOverview(D){await this.createOverview(D)}async getRecentOverviews(){return[]}async getRecentOverviewsForProject(){return[]}async createDiagnostic(D){let F={type:"diagnostic",message:D.message,session_id:D.session_id,project:D.project,timestamp:D.created_at};this.appendToIndex(F)}}var U2=null;async function $5(){if(U2)return U2;let D=new T7;if(await D.isAvailable())return U2=D,U2;let F=new g5;if(await F.isAvailable())return U2=F,U2;throw new Error("No storage backend available")}async function h5(){let F=CD.getInstance().getIndexPath();if(nF.existsSync(F)){if(!await new T7().isAvailable())return!0;try{return(await e0()).sessions.count()===0}catch{return!0}}return!1}import{readFileSync as Gz,existsSync as qz}from"fs";import{join as Hz}from"path";E0();class P7{pathDiscovery;constructor(){this.pathDiscovery=CD.getInstance()}getConfigDir(){return this.pathDiscovery.getDataDirectory()}getIndexDir(){return this.pathDiscovery.getIndexDirectory()}getIndexPath(){return this.pathDiscovery.getIndexPath()}getArchiveDir(){return this.pathDiscovery.getArchivesDirectory()}getProjectArchiveDir(D){return this.pathDiscovery.getProjectArchiveDirectory(D)}getLogsDir(){return this.pathDiscovery.getLogsDirectory()}static ensureDirectory(D){CD.getInstance().ensureDirectory(D)}static ensureDirectories(D){CD.getInstance().ensureDirectories(D)}static extractProjectName(D){return CD.extractProjectName(D)}static getCurrentProjectPrefix(){return CD.getCurrentProjectName()}static getCurrentProjectName(){return CD.getCurrentProjectName()}}class S7{static settingsPath;static cachedSettings=null;static{let D=new P7;this.settingsPath=Hz(D.getConfigDir(),"settings.json")}static readSettings(){if(this.cachedSettings!==null)return this.cachedSettings;try{if(qz(this.settingsPath)){let F=Gz(this.settingsPath,"utf-8"),Q=JSON.parse(F);return this.cachedSettings=Q,Q}}catch{}let D={};return this.cachedSettings=D,D}static getSetting(D,F){return this.readSettings()[D]??F}static getClaudePath(){return this.getSetting("claudePath","claude")}static clearCache(){this.cachedSettings=null}}function z8(){return S7.getClaudePath()}function m5(){return S7.readSettings()}var E2={captureEnabled:!0,summaryEnabled:!0,sessionStartEnabled:!0,chunkTokenLimit:600,chunkOverlapTokens:200,summaryTurnLimit:20};function k7(D,F){if(typeof D==="boolean")return D;if(typeof D==="string"){let Q=D.toLowerCase();if(Q==="true")return!0;if(Q==="false")return!1}return F}function b7(D,F){if(typeof D==="number"&&Number.isFinite(D))return D;if(typeof D==="string"){let Q=Number(D);if(!Number.isNaN(Q)&&Number.isFinite(Q))return Q}return F}function l5(){let D=m5();return{captureEnabled:k7(D.rollingCaptureEnabled,E2.captureEnabled),summaryEnabled:k7(D.rollingSummaryEnabled,E2.summaryEnabled),sessionStartEnabled:k7(D.rollingSessionStartEnabled,E2.sessionStartEnabled),chunkTokenLimit:b7(D.rollingChunkTokens,E2.chunkTokenLimit),chunkOverlapTokens:b7(D.rollingChunkOverlapTokens,E2.chunkOverlapTokens),summaryTurnLimit:b7(D.rollingSummaryTurnLimit,E2.summaryTurnLimit)}}E0();import{appendFileSync as Kz,existsSync as Uz,mkdirSync as Ez}from"fs";import{join as Az}from"path";var I6=null;function Zz(){if(I6)return I6;let F=CD.getInstance().getLogsDirectory();if(!Uz(F))Ez(F,{recursive:!0});return I6=Az(F,"rolling-memory.log"),I6}function w6(D,F,Q={}){try{let B=Zz(),Y={timestamp:new Date().toISOString(),level:D,message:F,...Q};Kz(B,`${JSON.stringify(Y)}
465
+ `,"utf8")}catch{}}function d5(D=new Date){return D.toLocaleString("en-US",{weekday:"long",month:"long",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit",timeZoneName:"short"})}function v7(D,F,Q){let B=D.split(" "),Y=[],J=Q,X=" ".repeat(Q.length);for(let C of B){let z=J+(J!==Q&&J!==X?" ":"")+C;if(z.length<=F)J=z;else{if(J.trim())Y.push(J);J=X+C}}if(J.trim())Y.push(J);return Y.join(`
466
+ `)}function Lz(D){let F=new Set;return F.add(D),F.add(D.replace(/-/g,"_")),F.add(D.replace(/_/g,"-")),(Q)=>!!Q&&F.has(Q)}function x7(D){if(D===0)return"0 B";let F=1024,Q=["B","KB","MB","GB"],B=Math.floor(Math.log(D)/Math.log(F));return parseFloat((D/Math.pow(F,B)).toFixed(1))+" "+Q[B]}function u7(){let D=CD.getInstance().getTrashDirectory();if(!G8.existsSync(D))return{folderCount:0,fileCount:0,totalSize:0,isEmpty:!0};let F=G8.readdirSync(D);if(F.length===0)return{folderCount:0,fileCount:0,totalSize:0,isEmpty:!0};let Q=0,B=0,Y=0;for(let J of F){let X=Vz(D,J),C=G8.statSync(X);if(C.isDirectory())Q++;else B++;Y+=C.size}return{folderCount:Q,fileCount:B,totalSize:Y,isEmpty:!1}}async function Mz(D){if(!l5().sessionStartEnabled){console.log("Rolling session-start output disabled in settings."),w6("info","session-start output skipped (disabled)",{project:D});return}let Q=await e0(),B=D||CD.getCurrentProjectName(),J=Q.overviews.getAllForProject(B).slice(-10);if(J.length===0){console.log("==============================================================================="),console.log(`What's new | ${d5()}`),console.log("==============================================================================="),console.log("No previous sessions found for this project."),console.log("Start working and claude-mem will automatically capture context for future sessions."),console.log("===============================================================================");let C=u7();if(!C.isEmpty){let W=x7(C.totalSize);console.log(`\uD83D\uDDD1️ Trash – ${C.folderCount} folders | ${C.fileCount} files | ${W} – use \`claude-mem restore\``),console.log("===============================================================================")}return}console.log("==============================================================================="),console.log(`What's new | ${d5()}`),console.log("==============================================================================="),J.forEach((C)=>{let W=new Date(C.created_at),z=W.getFullYear(),G=String(W.getMonth()+1).padStart(2,"0"),q=String(W.getDate()).padStart(2,"0"),A=W.getHours(),U=String(W.getMinutes()).padStart(2,"0"),Z=A>=12?"PM":"AM",H=A%12||12;console.log(`[${z}-${G}-${q} at ${H}:${U} ${Z}]`);let V=Q.memories.getBySessionId(C.session_id),j=V.map((k)=>({title:k.title,subtitle:k.subtitle})).filter((k)=>k.title),L=new Set,R=new Set;if(V.forEach((k)=>{if(k.files_touched)try{let b=JSON.parse(k.files_touched);if(Array.isArray(b))b.forEach((I)=>L.add(I))}catch(b){}if(k.keywords)k.keywords.split(",").forEach((b)=>R.add(b.trim()))}),console.log(""),console.log(v7(C.content,80,"")),L.size>0)console.log(""),console.log(v7(`- ${Array.from(L).join(", ")}`,80,""));if(R.size>0)console.log(""),console.log(v7(`Tags: ${Array.from(R).join(", ")}`,80,""));console.log("")}),console.log("===============================================================================");let X=u7();if(!X.isEmpty){let C=x7(X.totalSize);console.log(`\uD83D\uDDD1️ Trash – ${X.folderCount} folders | ${X.fileCount} files | ${C} – use \`claude-mem restore\``),console.log("===============================================================================")}}async function c5(D={}){try{if(await h5())console.warn("⚠️ JSONL to SQLite migration recommended. Run: claude-mem migrate-index");let F=await $5();if(F.backend==="jsonl")return await Nz(D);let Q=[],B=[],Y=D.project;if(!Y&&D.format==="session-start")Y=CD.getCurrentProjectName();if(D.format==="session-start"){await Mz(Y);return}let J=D.format==="json"?5:3;if(Y)Q=await F.getRecentMemoriesForProject(Y,10),B=await F.getRecentOverviewsForProject(Y,J);else Q=await F.getRecentMemories(10),B=await F.getRecentOverviews(J);let X=Q.map((W)=>({type:"memory",text:W.text,document_id:W.document_id,keywords:W.keywords,session_id:W.session_id,project:W.project,timestamp:W.created_at,archive:W.archive_basename})),C=B.map((W)=>({type:"overview",content:W.content,session_id:W.session_id,project:W.project,timestamp:W.created_at}));if(X.length===0&&C.length===0)return;if(D.format==="json"){let W=[...X,...C];console.log(JSON.stringify(W))}else{let W=X.length+C.length;console.log(V7("Context loading",W,"recent entries found")),X.forEach((z)=>{console.log(`${z.text} | ${z.document_id} | ${z.keywords}`)}),C.forEach((z)=>{console.log(`**Overview:** ${z.content}`)})}if(D.format!=="json"){let W=u7();if(!W.isEmpty){let z=x7(W.totalSize);console.log(`\uD83D\uDDD1️ Trash – ${W.folderCount} folders | ${W.fileCount} files | ${z} – use \`claude-mem restore\``),console.log("")}}}catch(F){let Q=F instanceof Error?F.message:String(F);if(D.format==="session-start")console.log(C8("CONNECTION_FAILED",Q));else console.log(L7("Context loading",Q,"Check file permissions and try again"))}}async function Nz(D={}){let Q=CD.getInstance().getIndexPath(),B=D.project;if(!B&&D.format==="session-start")B=CD.getCurrentProjectName();if(!G8.existsSync(Q)){if(D.format==="session-start")console.log(C8("NO_MEMORIES",B||"this project"));return}let J=G8.readFileSync(Q,"utf-8").trim().split(`
467
+ `).filter((U)=>U.trim());if(J.length===0){if(D.format==="session-start")console.log(C8("NO_MEMORIES",B||"this project"));return}let X=[];for(let U of J)try{if(!U.trim().startsWith("{"))continue;let Z=JSON.parse(U);X.push(Z)}catch(Z){continue}if(X.length===0){if(D.format==="session-start")console.log(C8("NO_MEMORIES",B||"this project"));return}let C=X.filter((U)=>U.type==="memory"),W=X.filter((U)=>U.type==="overview"),z=X.filter((U)=>U.type==="session"),G=C,q=W,A=z;if(B){let U=Lz(B);G=C.filter((Z)=>U(Z.project)),q=W.filter((Z)=>U(Z.project)),A=z.filter((Z)=>U(Z.project))}if(D.format==="session-start"){let U=G.slice(-10),Z=q.slice(-10),V=[...A.slice(-10),...U,...Z],j="recently",L=V.map((R)=>{return R.timestamp?new Date(R.timestamp):null}).filter((R)=>R!==null).sort((R,k)=>k.getTime()-R.getTime());if(L.length>0)j=w5(L[0]);T5({projectName:B||"your project",memoryCount:U.length,lastSessionTime:j,recentObjects:V})}else if(D.format==="json"){let U=G.slice(-10),Z=q.slice(-3),H=[...U,...Z];console.log(JSON.stringify(H))}else{let U=G.slice(-10),Z=q.slice(-3),H=U.length+Z.length;console.log(V7("Context loading",H,"recent entries found")),U.forEach((V)=>{console.log(`${V.text} | ${V.document_id} | ${V.keywords}`)}),Z.forEach((V)=>{console.log(`**Overview:** ${V.content}`)})}}import{renameSync as Jq,existsSync as $B,mkdirSync as Cq,statSync as Wq}from"fs";import{join as zq,basename as Gq}from"path";var y7=(D,F,Q)=>{let B=D instanceof RegExp?p5(D,Q):D,Y=F instanceof RegExp?p5(F,Q):F,J=B!==null&&Y!=null&&jz(B,Y,Q);return J&&{start:J[0],end:J[1],pre:Q.slice(0,J[0]),body:Q.slice(J[0]+B.length,J[1]),post:Q.slice(J[1]+Y.length)}},p5=(D,F)=>{let Q=F.match(D);return Q?Q[0]:null},jz=(D,F,Q)=>{let B,Y,J,X=void 0,C,W=Q.indexOf(D),z=Q.indexOf(F,W+1),G=W;if(W>=0&&z>0){if(D===F)return[W,z];B=[],J=Q.length;while(G>=0&&!C){if(G===W)B.push(G),W=Q.indexOf(D,G+1);else if(B.length===1){let q=B.pop();if(q!==void 0)C=[q,z]}else{if(Y=B.pop(),Y!==void 0&&Y<J)J=Y,X=z;z=Q.indexOf(F,G+1)}G=W<z&&W>=0?W:z}if(B.length&&X!==void 0)C=[J,X]}return C};var n5="\x00SLASH"+Math.random()+"\x00",i5="\x00OPEN"+Math.random()+"\x00",g7="\x00CLOSE"+Math.random()+"\x00",a5="\x00COMMA"+Math.random()+"\x00",r5="\x00PERIOD"+Math.random()+"\x00",Rz=new RegExp(n5,"g"),_z=new RegExp(i5,"g"),Oz=new RegExp(g7,"g"),Iz=new RegExp(a5,"g"),wz=new RegExp(r5,"g"),Tz=/\\\\/g,Pz=/\\{/g,Sz=/\\}/g,kz=/\\,/g,bz=/\\./g;function f7(D){return!isNaN(D)?parseInt(D,10):D.charCodeAt(0)}function vz(D){return D.replace(Tz,n5).replace(Pz,i5).replace(Sz,g7).replace(kz,a5).replace(bz,r5)}function xz(D){return D.replace(Rz,"\\").replace(_z,"{").replace(Oz,"}").replace(Iz,",").replace(wz,".")}function o5(D){if(!D)return[""];let F=[],Q=y7("{","}",D);if(!Q)return D.split(",");let{pre:B,body:Y,post:J}=Q,X=B.split(",");X[X.length-1]+="{"+Y+"}";let C=o5(J);if(J.length)X[X.length-1]+=C.shift(),X.push.apply(X,C);return F.push.apply(F,X),F}function s5(D){if(!D)return[];if(D.slice(0,2)==="{}")D="\\{\\}"+D.slice(2);return q8(vz(D),!0).map(xz)}function uz(D){return"{"+D+"}"}function yz(D){return/^-?0\d/.test(D)}function fz(D,F){return D<=F}function gz(D,F){return D>=F}function q8(D,F){let Q=[],B=y7("{","}",D);if(!B)return[D];let Y=B.pre,J=B.post.length?q8(B.post,!1):[""];if(/\$$/.test(B.pre))for(let X=0;X<J.length;X++){let C=Y+"{"+B.body+"}"+J[X];Q.push(C)}else{let X=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(B.body),C=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(B.body),W=X||C,z=B.body.indexOf(",")>=0;if(!W&&!z){if(B.post.match(/,(?!,).*\}/))return D=B.pre+"{"+B.body+g7+B.post,q8(D);return[D]}let G;if(W)G=B.body.split(/\.\./);else if(G=o5(B.body),G.length===1&&G[0]!==void 0){if(G=q8(G[0],!1).map(uz),G.length===1)return J.map((A)=>B.pre+G[0]+A)}let q;if(W&&G[0]!==void 0&&G[1]!==void 0){let A=f7(G[0]),U=f7(G[1]),Z=Math.max(G[0].length,G[1].length),H=G.length===3&&G[2]!==void 0?Math.abs(f7(G[2])):1,V=fz;if(U<A)H*=-1,V=gz;let L=G.some(yz);q=[];for(let R=A;V(R,U);R+=H){let k;if(C){if(k=String.fromCharCode(R),k==="\\")k=""}else if(k=String(R),L){let b=Z-k.length;if(b>0){let I=new Array(b+1).join("0");if(R<0)k="-"+I+k.slice(1);else k=I+k}}q.push(k)}}else{q=[];for(let A=0;A<G.length;A++)q.push.apply(q,q8(G[A],!1))}for(let A=0;A<q.length;A++)for(let U=0;U<J.length;U++){let Z=Y+q[A]+J[U];if(!F||W||Z)Q.push(Z)}}return Q}var H8=(D)=>{if(typeof D!=="string")throw new TypeError("invalid pattern");if(D.length>65536)throw new TypeError("pattern is too long")};var $z={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},K8=(D)=>D.replace(/[[\]\\-]/g,"\\$&"),hz=(D)=>D.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),t5=(D)=>D.join(""),e5=(D,F)=>{let Q=F;if(D.charAt(Q)!=="[")throw new Error("not in a brace expression");let B=[],Y=[],J=Q+1,X=!1,C=!1,W=!1,z=!1,G=Q,q="";D:while(J<D.length){let H=D.charAt(J);if((H==="!"||H==="^")&&J===Q+1){z=!0,J++;continue}if(H==="]"&&X&&!W){G=J+1;break}if(X=!0,H==="\\"){if(!W){W=!0,J++;continue}}if(H==="["&&!W){for(let[V,[j,L,R]]of Object.entries($z))if(D.startsWith(V,J)){if(q)return["$.",!1,D.length-Q,!0];if(J+=V.length,R)Y.push(j);else B.push(j);C=C||L;continue D}}if(W=!1,q){if(H>q)B.push(K8(q)+"-"+K8(H));else if(H===q)B.push(K8(H));q="",J++;continue}if(D.startsWith("-]",J+1)){B.push(K8(H+"-")),J+=2;continue}if(D.startsWith("-",J+1)){q=H,J+=2;continue}B.push(K8(H)),J++}if(G<J)return["",!1,0,!1];if(!B.length&&!Y.length)return["$.",!1,D.length-Q,!0];if(Y.length===0&&B.length===1&&/^\\?.$/.test(B[0])&&!z){let H=B[0].length===2?B[0].slice(-1):B[0];return[hz(H),!1,G-Q,!1]}let A="["+(z?"^":"")+t5(B)+"]",U="["+(z?"":"^")+t5(Y)+"]";return[B.length&&Y.length?"("+A+"|"+U+")":B.length?A:U,C,G-Q,!0]};var DF=(D,{windowsPathsNoEscape:F=!1}={})=>{return F?D.replace(/\[([^\/\\])\]/g,"$1"):D.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1")};var mz=new Set(["!","?","+","*","@"]),DB=(D)=>mz.has(D),lz="(?!(?:^|/)\\.\\.?(?:$|/))",T6="(?!\\.)",dz=new Set(["[","."]),cz=new Set(["..","."]),pz=new Set("().*{}+?[]^$\\!"),nz=(D)=>D.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),$7="[^/]",FB=$7+"*?",BB=$7+"+?";class X0{type;#D;#F;#Y=!1;#X=[];#J;#M;#V;#G=!1;#C;#H;#q=!1;constructor(D,F,Q={}){if(this.type=D,D)this.#F=!0;if(this.#J=F,this.#D=this.#J?this.#J.#D:this,this.#C=this.#D===this?Q:this.#D.#C,this.#V=this.#D===this?[]:this.#D.#V,D==="!"&&!this.#D.#G)this.#V.push(this);this.#M=this.#J?this.#J.#X.length:0}get hasMagic(){if(this.#F!==void 0)return this.#F;for(let D of this.#X){if(typeof D==="string")continue;if(D.type||D.hasMagic)return this.#F=!0}return this.#F}toString(){if(this.#H!==void 0)return this.#H;if(!this.type)return this.#H=this.#X.map((D)=>String(D)).join("");else return this.#H=this.type+"("+this.#X.map((D)=>String(D)).join("|")+")"}#W(){if(this!==this.#D)throw new Error("should only call on root");if(this.#G)return this;this.toString(),this.#G=!0;let D;while(D=this.#V.pop()){if(D.type!=="!")continue;let F=D,Q=F.#J;while(Q){for(let B=F.#M+1;!Q.type&&B<Q.#X.length;B++)for(let Y of D.#X){if(typeof Y==="string")throw new Error("string part in extglob AST??");Y.copyIn(Q.#X[B])}F=Q,Q=F.#J}}return this}push(...D){for(let F of D){if(F==="")continue;if(typeof F!=="string"&&!(F instanceof X0&&F.#J===this))throw new Error("invalid part: "+F);this.#X.push(F)}}toJSON(){let D=this.type===null?this.#X.slice().map((F)=>typeof F==="string"?F:F.toJSON()):[this.type,...this.#X.map((F)=>F.toJSON())];if(this.isStart()&&!this.type)D.unshift([]);if(this.isEnd()&&(this===this.#D||this.#D.#G&&this.#J?.type==="!"))D.push({});return D}isStart(){if(this.#D===this)return!0;if(!this.#J?.isStart())return!1;if(this.#M===0)return!0;let D=this.#J;for(let F=0;F<this.#M;F++){let Q=D.#X[F];if(!(Q instanceof X0&&Q.type==="!"))return!1}return!0}isEnd(){if(this.#D===this)return!0;if(this.#J?.type==="!")return!0;if(!this.#J?.isEnd())return!1;if(!this.type)return this.#J?.isEnd();let D=this.#J?this.#J.#X.length:0;return this.#M===D-1}copyIn(D){if(typeof D==="string")this.push(D);else this.push(D.clone(this))}clone(D){let F=new X0(this.type,D);for(let Q of this.#X)F.copyIn(Q);return F}static#B(D,F,Q,B){let Y=!1,J=!1,X=-1,C=!1;if(F.type===null){let A=Q,U="";while(A<D.length){let Z=D.charAt(A++);if(Y||Z==="\\"){Y=!Y,U+=Z;continue}if(J){if(A===X+1){if(Z==="^"||Z==="!")C=!0}else if(Z==="]"&&!(A===X+2&&C))J=!1;U+=Z;continue}else if(Z==="["){J=!0,X=A,C=!1,U+=Z;continue}if(!B.noext&&DB(Z)&&D.charAt(A)==="("){F.push(U),U="";let H=new X0(Z,F);A=X0.#B(D,H,A,B),F.push(H);continue}U+=Z}return F.push(U),A}let W=Q+1,z=new X0(null,F),G=[],q="";while(W<D.length){let A=D.charAt(W++);if(Y||A==="\\"){Y=!Y,q+=A;continue}if(J){if(W===X+1){if(A==="^"||A==="!")C=!0}else if(A==="]"&&!(W===X+2&&C))J=!1;q+=A;continue}else if(A==="["){J=!0,X=W,C=!1,q+=A;continue}if(DB(A)&&D.charAt(W)==="("){z.push(q),q="";let U=new X0(A,z);z.push(U),W=X0.#B(D,U,W,B);continue}if(A==="|"){z.push(q),q="",G.push(z),z=new X0(null,F);continue}if(A===")"){if(q===""&&F.#X.length===0)F.#q=!0;return z.push(q),q="",F.push(...G,z),W}q+=A}return F.type=null,F.#F=void 0,F.#X=[D.substring(Q-1)],W}static fromGlob(D,F={}){let Q=new X0(null,void 0,F);return X0.#B(D,Q,0,F),Q}toMMPattern(){if(this!==this.#D)return this.#D.toMMPattern();let D=this.toString(),[F,Q,B,Y]=this.toRegExpSource();if(!(B||this.#F||this.#C.nocase&&!this.#C.nocaseMagicOnly&&D.toUpperCase()!==D.toLowerCase()))return Q;let X=(this.#C.nocase?"i":"")+(Y?"u":"");return Object.assign(new RegExp(`^${F}$`,X),{_src:F,_glob:D})}get options(){return this.#C}toRegExpSource(D){let F=D??!!this.#C.dot;if(this.#D===this)this.#W();if(!this.type){let C=this.isStart()&&this.isEnd(),W=this.#X.map((A)=>{let[U,Z,H,V]=typeof A==="string"?X0.#N(A,this.#F,C):A.toRegExpSource(D);return this.#F=this.#F||H,this.#Y=this.#Y||V,U}).join(""),z="";if(this.isStart()){if(typeof this.#X[0]==="string"){if(!(this.#X.length===1&&cz.has(this.#X[0]))){let U=dz,Z=F&&U.has(W.charAt(0))||W.startsWith("\\.")&&U.has(W.charAt(2))||W.startsWith("\\.\\.")&&U.has(W.charAt(4)),H=!F&&!D&&U.has(W.charAt(0));z=Z?lz:H?T6:""}}}let G="";if(this.isEnd()&&this.#D.#G&&this.#J?.type==="!")G="(?:$|\\/)";return[z+W+G,DF(W),this.#F=!!this.#F,this.#Y]}let Q=this.type==="*"||this.type==="+",B=this.type==="!"?"(?:(?!(?:":"(?:",Y=this.#U(F);if(this.isStart()&&this.isEnd()&&!Y&&this.type!=="!"){let C=this.toString();return this.#X=[C],this.type=null,this.#F=void 0,[C,DF(this.toString()),!1,!1]}let J=!Q||D||F||!T6?"":this.#U(!0);if(J===Y)J="";if(J)Y=`(?:${Y})(?:${J})*?`;let X="";if(this.type==="!"&&this.#q)X=(this.isStart()&&!F?T6:"")+BB;else{let C=this.type==="!"?"))"+(this.isStart()&&!F&&!D?T6:"")+FB+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&J?")":this.type==="*"&&J?")?":`)${this.type}`;X=B+Y+C}return[X,DF(Y),this.#F=!!this.#F,this.#Y]}#U(D){return this.#X.map((F)=>{if(typeof F==="string")throw new Error("string type in extglob ast??");let[Q,B,Y,J]=F.toRegExpSource(D);return this.#Y=this.#Y||J,Q}).filter((F)=>!(this.isStart()&&this.isEnd())||!!F).join("|")}static#N(D,F,Q=!1){let B=!1,Y="",J=!1;for(let X=0;X<D.length;X++){let C=D.charAt(X);if(B){B=!1,Y+=(pz.has(C)?"\\":"")+C;continue}if(C==="\\"){if(X===D.length-1)Y+="\\\\";else B=!0;continue}if(C==="["){let[W,z,G,q]=e5(D,X);if(G){Y+=W,J=J||z,X+=G-1,F=F||q;continue}}if(C==="*"){if(Q&&D==="*")Y+=BB;else Y+=FB;F=!0;continue}if(C==="?"){Y+=$7,F=!0;continue}Y+=nz(C)}return[Y,DF(D),!!F,J]}}var A2=(D,{windowsPathsNoEscape:F=!1}={})=>{return F?D.replace(/[?*()[\]]/g,"[$&]"):D.replace(/[?*()[\]\\]/g,"\\$&")};var Z0=(D,F,Q={})=>{if(H8(F),!Q.nocomment&&F.charAt(0)==="#")return!1;return new m0(F,Q).match(D)},iz=/^\*+([^+@!?\*\[\(]*)$/,az=(D)=>(F)=>!F.startsWith(".")&&F.endsWith(D),rz=(D)=>(F)=>F.endsWith(D),oz=(D)=>{return D=D.toLowerCase(),(F)=>!F.startsWith(".")&&F.toLowerCase().endsWith(D)},sz=(D)=>{return D=D.toLowerCase(),(F)=>F.toLowerCase().endsWith(D)},tz=/^\*+\.\*+$/,ez=(D)=>!D.startsWith(".")&&D.includes("."),DG=(D)=>D!=="."&&D!==".."&&D.includes("."),FG=/^\.\*+$/,BG=(D)=>D!=="."&&D!==".."&&D.startsWith("."),QG=/^\*+$/,XG=(D)=>D.length!==0&&!D.startsWith("."),YG=(D)=>D.length!==0&&D!=="."&&D!=="..",JG=/^\?+([^+@!?\*\[\(]*)?$/,CG=([D,F=""])=>{let Q=YB([D]);if(!F)return Q;return F=F.toLowerCase(),(B)=>Q(B)&&B.toLowerCase().endsWith(F)},WG=([D,F=""])=>{let Q=JB([D]);if(!F)return Q;return F=F.toLowerCase(),(B)=>Q(B)&&B.toLowerCase().endsWith(F)},zG=([D,F=""])=>{let Q=JB([D]);return!F?Q:(B)=>Q(B)&&B.endsWith(F)},GG=([D,F=""])=>{let Q=YB([D]);return!F?Q:(B)=>Q(B)&&B.endsWith(F)},YB=([D])=>{let F=D.length;return(Q)=>Q.length===F&&!Q.startsWith(".")},JB=([D])=>{let F=D.length;return(Q)=>Q.length===F&&Q!=="."&&Q!==".."},CB=typeof process==="object"&&process?typeof process.env==="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",QB={win32:{sep:"\\"},posix:{sep:"/"}},qG=CB==="win32"?QB.win32.sep:QB.posix.sep;Z0.sep=qG;var Y0=Symbol("globstar **");Z0.GLOBSTAR=Y0;var HG="[^/]",KG=HG+"*?",UG="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",EG="(?:(?!(?:\\/|^)\\.).)*?",AG=(D,F={})=>(Q)=>Z0(Q,D,F);Z0.filter=AG;var h0=(D,F={})=>Object.assign({},D,F),ZG=(D)=>{if(!D||typeof D!=="object"||!Object.keys(D).length)return Z0;let F=Z0;return Object.assign((B,Y,J={})=>F(B,Y,h0(D,J)),{Minimatch:class B extends F.Minimatch{constructor(Y,J={}){super(Y,h0(D,J))}static defaults(Y){return F.defaults(h0(D,Y)).Minimatch}},AST:class B extends F.AST{constructor(Y,J,X={}){super(Y,J,h0(D,X))}static fromGlob(Y,J={}){return F.AST.fromGlob(Y,h0(D,J))}},unescape:(B,Y={})=>F.unescape(B,h0(D,Y)),escape:(B,Y={})=>F.escape(B,h0(D,Y)),filter:(B,Y={})=>F.filter(B,h0(D,Y)),defaults:(B)=>F.defaults(h0(D,B)),makeRe:(B,Y={})=>F.makeRe(B,h0(D,Y)),braceExpand:(B,Y={})=>F.braceExpand(B,h0(D,Y)),match:(B,Y,J={})=>F.match(B,Y,h0(D,J)),sep:F.sep,GLOBSTAR:Y0})};Z0.defaults=ZG;var WB=(D,F={})=>{if(H8(D),F.nobrace||!/\{(?:(?!\{).)*\}/.test(D))return[D];return s5(D)};Z0.braceExpand=WB;var VG=(D,F={})=>new m0(D,F).makeRe();Z0.makeRe=VG;var LG=(D,F,Q={})=>{let B=new m0(F,Q);if(D=D.filter((Y)=>B.match(Y)),B.options.nonull&&!D.length)D.push(F);return D};Z0.match=LG;var XB=/[?*]|[+@!]\(.*?\)|\[|\]/,MG=(D)=>D.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");class m0{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(D,F={}){if(H8(D),F=F||{},this.options=F,this.pattern=D,this.platform=F.platform||CB,this.isWindows=this.platform==="win32",this.windowsPathsNoEscape=!!F.windowsPathsNoEscape||F.allowWindowsEscape===!1,this.windowsPathsNoEscape)this.pattern=this.pattern.replace(/\\/g,"/");this.preserveMultipleSlashes=!!F.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!F.nonegate,this.comment=!1,this.empty=!1,this.partial=!!F.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=F.windowsNoMagicRoot!==void 0?F.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let D of this.set)for(let F of D)if(typeof F!=="string")return!0;return!1}debug(...D){}make(){let D=this.pattern,F=this.options;if(!F.nocomment&&D.charAt(0)==="#"){this.comment=!0;return}if(!D){this.empty=!0;return}if(this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],F.debug)this.debug=(...Y)=>console.error(...Y);this.debug(this.pattern,this.globSet);let Q=this.globSet.map((Y)=>this.slashSplit(Y));this.globParts=this.preprocess(Q),this.debug(this.pattern,this.globParts);let B=this.globParts.map((Y,J,X)=>{if(this.isWindows&&this.windowsNoMagicRoot){let C=Y[0]===""&&Y[1]===""&&(Y[2]==="?"||!XB.test(Y[2]))&&!XB.test(Y[3]),W=/^[a-z]:/i.test(Y[0]);if(C)return[...Y.slice(0,4),...Y.slice(4).map((z)=>this.parse(z))];else if(W)return[Y[0],...Y.slice(1).map((z)=>this.parse(z))]}return Y.map((C)=>this.parse(C))});if(this.debug(this.pattern,B),this.set=B.filter((Y)=>Y.indexOf(!1)===-1),this.isWindows)for(let Y=0;Y<this.set.length;Y++){let J=this.set[Y];if(J[0]===""&&J[1]===""&&this.globParts[Y][2]==="?"&&typeof J[3]==="string"&&/^[a-z]:$/i.test(J[3]))J[2]="?"}this.debug(this.pattern,this.set)}preprocess(D){if(this.options.noglobstar){for(let Q=0;Q<D.length;Q++)for(let B=0;B<D[Q].length;B++)if(D[Q][B]==="**")D[Q][B]="*"}let{optimizationLevel:F=1}=this.options;if(F>=2)D=this.firstPhasePreProcess(D),D=this.secondPhasePreProcess(D);else if(F>=1)D=this.levelOneOptimize(D);else D=this.adjascentGlobstarOptimize(D);return D}adjascentGlobstarOptimize(D){return D.map((F)=>{let Q=-1;while((Q=F.indexOf("**",Q+1))!==-1){let B=Q;while(F[B+1]==="**")B++;if(B!==Q)F.splice(Q,B-Q)}return F})}levelOneOptimize(D){return D.map((F)=>{return F=F.reduce((Q,B)=>{let Y=Q[Q.length-1];if(B==="**"&&Y==="**")return Q;if(B===".."){if(Y&&Y!==".."&&Y!=="."&&Y!=="**")return Q.pop(),Q}return Q.push(B),Q},[]),F.length===0?[""]:F})}levelTwoFileOptimize(D){if(!Array.isArray(D))D=this.slashSplit(D);let F=!1;do{if(F=!1,!this.preserveMultipleSlashes){for(let B=1;B<D.length-1;B++){let Y=D[B];if(B===1&&Y===""&&D[0]==="")continue;if(Y==="."||Y==="")F=!0,D.splice(B,1),B--}if(D[0]==="."&&D.length===2&&(D[1]==="."||D[1]===""))F=!0,D.pop()}let Q=0;while((Q=D.indexOf("..",Q+1))!==-1){let B=D[Q-1];if(B&&B!=="."&&B!==".."&&B!=="**")F=!0,D.splice(Q-1,2),Q-=2}}while(F);return D.length===0?[""]:D}firstPhasePreProcess(D){let F=!1;do{F=!1;for(let Q of D){let B=-1;while((B=Q.indexOf("**",B+1))!==-1){let J=B;while(Q[J+1]==="**")J++;if(J>B)Q.splice(B+1,J-B);let X=Q[B+1],C=Q[B+2],W=Q[B+3];if(X!=="..")continue;if(!C||C==="."||C===".."||!W||W==="."||W==="..")continue;F=!0,Q.splice(B,1);let z=Q.slice(0);z[B]="**",D.push(z),B--}if(!this.preserveMultipleSlashes){for(let J=1;J<Q.length-1;J++){let X=Q[J];if(J===1&&X===""&&Q[0]==="")continue;if(X==="."||X==="")F=!0,Q.splice(J,1),J--}if(Q[0]==="."&&Q.length===2&&(Q[1]==="."||Q[1]===""))F=!0,Q.pop()}let Y=0;while((Y=Q.indexOf("..",Y+1))!==-1){let J=Q[Y-1];if(J&&J!=="."&&J!==".."&&J!=="**"){F=!0;let C=Y===1&&Q[Y+1]==="**"?["."]:[];if(Q.splice(Y-1,2,...C),Q.length===0)Q.push("");Y-=2}}}}while(F);return D}secondPhasePreProcess(D){for(let F=0;F<D.length-1;F++)for(let Q=F+1;Q<D.length;Q++){let B=this.partsMatch(D[F],D[Q],!this.preserveMultipleSlashes);if(B){D[F]=[],D[Q]=B;break}}return D.filter((F)=>F.length)}partsMatch(D,F,Q=!1){let B=0,Y=0,J=[],X="";while(B<D.length&&Y<F.length)if(D[B]===F[Y])J.push(X==="b"?F[Y]:D[B]),B++,Y++;else if(Q&&D[B]==="**"&&F[Y]===D[B+1])J.push(D[B]),B++;else if(Q&&F[Y]==="**"&&D[B]===F[Y+1])J.push(F[Y]),Y++;else if(D[B]==="*"&&F[Y]&&(this.options.dot||!F[Y].startsWith("."))&&F[Y]!=="**"){if(X==="b")return!1;X="a",J.push(D[B]),B++,Y++}else if(F[Y]==="*"&&D[B]&&(this.options.dot||!D[B].startsWith("."))&&D[B]!=="**"){if(X==="a")return!1;X="b",J.push(F[Y]),B++,Y++}else return!1;return D.length===F.length&&J}parseNegate(){if(this.nonegate)return;let D=this.pattern,F=!1,Q=0;for(let B=0;B<D.length&&D.charAt(B)==="!";B++)F=!F,Q++;if(Q)this.pattern=D.slice(Q);this.negate=F}matchOne(D,F,Q=!1){let B=this.options;if(this.isWindows){let Z=typeof D[0]==="string"&&/^[a-z]:$/i.test(D[0]),H=!Z&&D[0]===""&&D[1]===""&&D[2]==="?"&&/^[a-z]:$/i.test(D[3]),V=typeof F[0]==="string"&&/^[a-z]:$/i.test(F[0]),j=!V&&F[0]===""&&F[1]===""&&F[2]==="?"&&typeof F[3]==="string"&&/^[a-z]:$/i.test(F[3]),L=H?3:Z?0:void 0,R=j?3:V?0:void 0;if(typeof L==="number"&&typeof R==="number"){let[k,b]=[D[L],F[R]];if(k.toLowerCase()===b.toLowerCase()){if(F[R]=k,R>L)F=F.slice(R);else if(L>R)D=D.slice(L)}}}let{optimizationLevel:Y=1}=this.options;if(Y>=2)D=this.levelTwoFileOptimize(D);this.debug("matchOne",this,{file:D,pattern:F}),this.debug("matchOne",D.length,F.length);for(var J=0,X=0,C=D.length,W=F.length;J<C&&X<W;J++,X++){this.debug("matchOne loop");var z=F[X],G=D[J];if(this.debug(F,z,G),z===!1)return!1;if(z===Y0){this.debug("GLOBSTAR",[F,z,G]);var q=J,A=X+1;if(A===W){this.debug("** at the end");for(;J<C;J++)if(D[J]==="."||D[J]===".."||!B.dot&&D[J].charAt(0)===".")return!1;return!0}while(q<C){var U=D[q];if(this.debug(`
468
468
  globstar while`,D,q,F,A,U),this.matchOne(D.slice(q),F.slice(A),Q))return this.debug("globstar found match!",q,C,U),!0;else{if(U==="."||U===".."||!B.dot&&U.charAt(0)==="."){this.debug("dot detected!",D,q,F,A);break}this.debug("globstar swallow a segment, and continue"),q++}}if(Q){if(this.debug(`
469
- >>> no match, partial?`,D,q,F,A),q===C)return!0}return!1}let Z;if(typeof W==="string")Z=G===W,this.debug("string match",W,G,Z);else Z=W.test(G),this.debug("pattern match",W,G,Z);if(!Z)return!1}if(J===C&&X===z)return!0;else if(J===C)return Q;else if(X===z)return J===C-1&&D[J]==="";else throw new Error("wtf?")}braceExpand(){return WB(this.pattern,this.options)}parse(D){H8(D);let F=this.options;if(D==="**")return Y0;if(D==="")return"";let Q,B=null;if(Q=D.match(QG))B=F.dot?YG:XG;else if(Q=D.match(iz))B=(F.nocase?F.dot?sz:oz:F.dot?rz:az)(Q[1]);else if(Q=D.match(JG))B=(F.nocase?F.dot?WG:CG:F.dot?zG:GG)(Q);else if(Q=D.match(tz))B=F.dot?DG:ez;else if(Q=D.match(FG))B=BG;let Y=X0.fromGlob(D,this.options).toMMPattern();if(B&&typeof Y==="object")Reflect.defineProperty(Y,"test",{value:B});return Y}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let D=this.set;if(!D.length)return this.regexp=!1,this.regexp;let F=this.options,Q=F.noglobstar?KG:F.dot?UG:EG,B=new Set(F.nocase?["i"]:[]),Y=D.map((C)=>{let z=C.map((W)=>{if(W instanceof RegExp)for(let G of W.flags.split(""))B.add(G);return typeof W==="string"?MG(W):W===Y0?Y0:W._src});return z.forEach((W,G)=>{let q=z[G+1],A=z[G-1];if(W!==Y0||A===Y0)return;if(A===void 0)if(q!==void 0&&q!==Y0)z[G+1]="(?:\\/|"+Q+"\\/)?"+q;else z[G]=Q;else if(q===void 0)z[G-1]=A+"(?:\\/|"+Q+")?";else if(q!==Y0)z[G-1]=A+"(?:\\/|\\/"+Q+"\\/)"+q,z[G+1]=Y0}),z.filter((W)=>W!==Y0).join("/")}).join("|"),[J,X]=D.length>1?["(?:",")"]:["",""];if(Y="^"+J+Y+X+"$",this.negate)Y="^(?!"+Y+").+$";try{this.regexp=new RegExp(Y,[...B].join(""))}catch(C){this.regexp=!1}return this.regexp}slashSplit(D){if(this.preserveMultipleSlashes)return D.split("/");else if(this.isWindows&&/^\/\/[^\/]+/.test(D))return["",...D.split(/\/+/)];else return D.split(/\/+/)}match(D,F=this.partial){if(this.debug("match",D,this.pattern),this.comment)return!1;if(this.empty)return D==="";if(D==="/"&&F)return!0;let Q=this.options;if(this.isWindows)D=D.split("\\").join("/");let B=this.slashSplit(D);this.debug(this.pattern,"split",B);let Y=this.set;this.debug(this.pattern,"set",Y);let J=B[B.length-1];if(!J)for(let X=B.length-2;!J&&X>=0;X--)J=B[X];for(let X=0;X<Y.length;X++){let C=Y[X],z=B;if(Q.matchBase&&C.length===1)z=[J];if(this.matchOne(z,C,F)){if(Q.flipNegate)return!0;return!this.negate}}if(Q.flipNegate)return!1;return this.negate}static defaults(D){return Z0.defaults(D).Minimatch}}Z0.AST=X0;Z0.Minimatch=m0;Z0.escape=A2;Z0.unescape=DF;import{fileURLToPath as eG}from"node:url";var NG=typeof performance==="object"&&performance&&typeof performance.now==="function"?performance:Date,GB=new Set,h7=typeof process==="object"&&!!process?process:{},qB=(D,F,Q,B)=>{typeof h7.emitWarning==="function"?h7.emitWarning(D,F,Q,B):console.error(`[${Q}] ${F}: ${D}`)},P6=globalThis.AbortController,zB=globalThis.AbortSignal;if(typeof P6==="undefined"){zB=class Q{onabort;_onabort=[];reason;aborted=!1;addEventListener(B,Y){this._onabort.push(Y)}},P6=class Q{constructor(){F()}signal=new zB;abort(B){if(this.signal.aborted)return;this.signal.reason=B,this.signal.aborted=!0;for(let Y of this.signal._onabort)Y(B);this.signal.onabort?.(B)}};let D=h7.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",F=()=>{if(!D)return;D=!1,qB("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",F)}}var jG=(D)=>!GB.has(D),$L=Symbol("type"),vF=(D)=>D&&D===Math.floor(D)&&D>0&&isFinite(D),HB=(D)=>!vF(D)?null:D<=Math.pow(2,8)?Uint8Array:D<=Math.pow(2,16)?Uint16Array:D<=Math.pow(2,32)?Uint32Array:D<=Number.MAX_SAFE_INTEGER?U8:null;class U8 extends Array{constructor(D){super(D);this.fill(0)}}class Z2{heap;length;static#D=!1;static create(D){let F=HB(D);if(!F)return[];Z2.#D=!0;let Q=new Z2(D,F);return Z2.#D=!1,Q}constructor(D,F){if(!Z2.#D)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new F(D),this.length=0}push(D){this.heap[this.length++]=D}pop(){return this.heap[--this.length]}}class E8{#D;#F;#Y;#X;#J;#M;#V;#G;get perf(){return this.#G}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#C;#H;#q;#W;#B;#U;#N;#L;#E;#T;#A;#R;#I;#Z;#j;#w;#K;#Q;static unsafeExposeInternals(D){return{starts:D.#I,ttls:D.#Z,sizes:D.#R,keyMap:D.#q,keyList:D.#W,valList:D.#B,next:D.#U,prev:D.#N,get head(){return D.#L},get tail(){return D.#E},free:D.#T,isBackgroundFetch:(F)=>D.#z(F),backgroundFetch:(F,Q,B,Y)=>D.#d(F,Q,B,Y),moveToTail:(F)=>D.#f(F),indexes:(F)=>D.#S(F),rindexes:(F)=>D.#b(F),isStale:(F)=>D.#O(F)}}get max(){return this.#D}get maxSize(){return this.#F}get calculatedSize(){return this.#H}get size(){return this.#C}get fetchMethod(){return this.#M}get memoMethod(){return this.#V}get dispose(){return this.#Y}get onInsert(){return this.#X}get disposeAfter(){return this.#J}constructor(D){let{max:F=0,ttl:Q,ttlResolution:B=1,ttlAutopurge:Y,updateAgeOnGet:J,updateAgeOnHas:X,allowStale:C,dispose:z,onInsert:W,disposeAfter:G,noDisposeOnSet:q,noUpdateTTL:A,maxSize:U=0,maxEntrySize:Z=0,sizeCalculation:H,fetchMethod:V,memoMethod:N,noDeleteOnFetchRejection:L,noDeleteOnStaleGet:R,allowStaleOnFetchRejection:k,allowStaleOnFetchAbort:b,ignoreFetchAbort:I,perf:u}=D;if(u!==void 0){if(typeof u?.now!=="function")throw new TypeError("perf option must have a now() method if specified")}if(this.#G=u??NG,F!==0&&!vF(F))throw new TypeError("max option must be a nonnegative integer");let f=F?HB(F):Array;if(!f)throw new Error("invalid max value: "+F);if(this.#D=F,this.#F=U,this.maxEntrySize=Z||this.#F,this.sizeCalculation=H,this.sizeCalculation){if(!this.#F&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!=="function")throw new TypeError("sizeCalculation set to non-function")}if(N!==void 0&&typeof N!=="function")throw new TypeError("memoMethod must be a function if defined");if(this.#V=N,V!==void 0&&typeof V!=="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#M=V,this.#w=!!V,this.#q=new Map,this.#W=new Array(F).fill(void 0),this.#B=new Array(F).fill(void 0),this.#U=new f(F),this.#N=new f(F),this.#L=0,this.#E=0,this.#T=Z2.create(F),this.#C=0,this.#H=0,typeof z==="function")this.#Y=z;if(typeof W==="function")this.#X=W;if(typeof G==="function")this.#J=G,this.#A=[];else this.#J=void 0,this.#A=void 0;if(this.#j=!!this.#Y,this.#Q=!!this.#X,this.#K=!!this.#J,this.noDisposeOnSet=!!q,this.noUpdateTTL=!!A,this.noDeleteOnFetchRejection=!!L,this.allowStaleOnFetchRejection=!!k,this.allowStaleOnFetchAbort=!!b,this.ignoreFetchAbort=!!I,this.maxEntrySize!==0){if(this.#F!==0){if(!vF(this.#F))throw new TypeError("maxSize must be a positive integer if specified")}if(!vF(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#g()}if(this.allowStale=!!C,this.noDeleteOnStaleGet=!!R,this.updateAgeOnGet=!!J,this.updateAgeOnHas=!!X,this.ttlResolution=vF(B)||B===0?B:1,this.ttlAutopurge=!!Y,this.ttl=Q||0,this.ttl){if(!vF(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#v()}if(this.#D===0&&this.ttl===0&&this.#F===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#D&&!this.#F){if(jG("LRU_CACHE_UNBOUNDED"))GB.add("LRU_CACHE_UNBOUNDED"),qB("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning","LRU_CACHE_UNBOUNDED",E8)}}getRemainingTTL(D){return this.#q.has(D)?1/0:0}#v(){let D=new U8(this.#D),F=new U8(this.#D);this.#Z=D,this.#I=F,this.#m=(Y,J,X=this.#G.now())=>{if(F[Y]=J!==0?X:0,D[Y]=J,J!==0&&this.ttlAutopurge){let C=setTimeout(()=>{if(this.#O(Y))this.#k(this.#W[Y],"expire")},J+1);if(C.unref)C.unref()}},this.#P=(Y)=>{F[Y]=D[Y]!==0?this.#G.now():0},this.#_=(Y,J)=>{if(D[J]){let X=D[J],C=F[J];if(!X||!C)return;Y.ttl=X,Y.start=C,Y.now=Q||B();let z=Y.now-C;Y.remainingTTL=X-z}};let Q=0,B=()=>{let Y=this.#G.now();if(this.ttlResolution>0){Q=Y;let J=setTimeout(()=>Q=0,this.ttlResolution);if(J.unref)J.unref()}return Y};this.getRemainingTTL=(Y)=>{let J=this.#q.get(Y);if(J===void 0)return 0;let X=D[J],C=F[J];if(!X||!C)return 1/0;let z=(Q||B())-C;return X-z},this.#O=(Y)=>{let J=F[Y],X=D[Y];return!!X&&!!J&&(Q||B())-J>X}}#P=()=>{};#_=()=>{};#m=()=>{};#O=()=>!1;#g(){let D=new U8(this.#D);this.#H=0,this.#R=D,this.#x=(F)=>{this.#H-=D[F],D[F]=0},this.#u=(F,Q,B,Y)=>{if(this.#z(Q))return 0;if(!vF(B))if(Y){if(typeof Y!=="function")throw new TypeError("sizeCalculation must be a function");if(B=Y(Q,F),!vF(B))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return B},this.#$=(F,Q,B)=>{if(D[F]=Q,this.#F){let Y=this.#F-D[F];while(this.#H>Y)this.#y(!0)}if(this.#H+=D[F],B)B.entrySize=Q,B.totalCalculatedSize=this.#H}}#x=(D)=>{};#$=(D,F,Q)=>{};#u=(D,F,Q,B)=>{if(Q||B)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#S({allowStale:D=this.allowStale}={}){if(this.#C)for(let F=this.#E;;){if(!this.#l(F))break;if(D||!this.#O(F))yield F;if(F===this.#L)break;else F=this.#N[F]}}*#b({allowStale:D=this.allowStale}={}){if(this.#C)for(let F=this.#L;;){if(!this.#l(F))break;if(D||!this.#O(F))yield F;if(F===this.#E)break;else F=this.#U[F]}}#l(D){return D!==void 0&&this.#q.get(this.#W[D])===D}*entries(){for(let D of this.#S())if(this.#B[D]!==void 0&&this.#W[D]!==void 0&&!this.#z(this.#B[D]))yield[this.#W[D],this.#B[D]]}*rentries(){for(let D of this.#b())if(this.#B[D]!==void 0&&this.#W[D]!==void 0&&!this.#z(this.#B[D]))yield[this.#W[D],this.#B[D]]}*keys(){for(let D of this.#S()){let F=this.#W[D];if(F!==void 0&&!this.#z(this.#B[D]))yield F}}*rkeys(){for(let D of this.#b()){let F=this.#W[D];if(F!==void 0&&!this.#z(this.#B[D]))yield F}}*values(){for(let D of this.#S())if(this.#B[D]!==void 0&&!this.#z(this.#B[D]))yield this.#B[D]}*rvalues(){for(let D of this.#b())if(this.#B[D]!==void 0&&!this.#z(this.#B[D]))yield this.#B[D]}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(D,F={}){for(let Q of this.#S()){let B=this.#B[Q],Y=this.#z(B)?B.__staleWhileFetching:B;if(Y===void 0)continue;if(D(Y,this.#W[Q],this))return this.get(this.#W[Q],F)}}forEach(D,F=this){for(let Q of this.#S()){let B=this.#B[Q],Y=this.#z(B)?B.__staleWhileFetching:B;if(Y===void 0)continue;D.call(F,Y,this.#W[Q],this)}}rforEach(D,F=this){for(let Q of this.#b()){let B=this.#B[Q],Y=this.#z(B)?B.__staleWhileFetching:B;if(Y===void 0)continue;D.call(F,Y,this.#W[Q],this)}}purgeStale(){let D=!1;for(let F of this.#b({allowStale:!0}))if(this.#O(F))this.#k(this.#W[F],"expire"),D=!0;return D}info(D){let F=this.#q.get(D);if(F===void 0)return;let Q=this.#B[F],B=this.#z(Q)?Q.__staleWhileFetching:Q;if(B===void 0)return;let Y={value:B};if(this.#Z&&this.#I){let J=this.#Z[F],X=this.#I[F];if(J&&X){let C=J-(this.#G.now()-X);Y.ttl=C,Y.start=Date.now()}}if(this.#R)Y.size=this.#R[F];return Y}dump(){let D=[];for(let F of this.#S({allowStale:!0})){let Q=this.#W[F],B=this.#B[F],Y=this.#z(B)?B.__staleWhileFetching:B;if(Y===void 0||Q===void 0)continue;let J={value:Y};if(this.#Z&&this.#I){J.ttl=this.#Z[F];let X=this.#G.now()-this.#I[F];J.start=Math.floor(Date.now()-X)}if(this.#R)J.size=this.#R[F];D.unshift([Q,J])}return D}load(D){this.clear();for(let[F,Q]of D){if(Q.start){let B=Date.now()-Q.start;Q.start=this.#G.now()-B}this.set(F,Q.value,Q)}}set(D,F,Q={}){if(F===void 0)return this.delete(D),this;let{ttl:B=this.ttl,start:Y,noDisposeOnSet:J=this.noDisposeOnSet,sizeCalculation:X=this.sizeCalculation,status:C}=Q,{noUpdateTTL:z=this.noUpdateTTL}=Q,W=this.#u(D,F,Q.size||0,X);if(this.maxEntrySize&&W>this.maxEntrySize){if(C)C.set="miss",C.maxEntrySizeExceeded=!0;return this.#k(D,"set"),this}let G=this.#C===0?void 0:this.#q.get(D);if(G===void 0){if(G=this.#C===0?this.#E:this.#T.length!==0?this.#T.pop():this.#C===this.#D?this.#y(!1):this.#C,this.#W[G]=D,this.#B[G]=F,this.#q.set(D,G),this.#U[this.#E]=G,this.#N[G]=this.#E,this.#E=G,this.#C++,this.#$(G,W,C),C)C.set="add";if(z=!1,this.#Q)this.#X?.(F,D,"add")}else{this.#f(G);let q=this.#B[G];if(F!==q){if(this.#w&&this.#z(q)){q.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:A}=q;if(A!==void 0&&!J){if(this.#j)this.#Y?.(A,D,"set");if(this.#K)this.#A?.push([A,D,"set"])}}else if(!J){if(this.#j)this.#Y?.(q,D,"set");if(this.#K)this.#A?.push([q,D,"set"])}if(this.#x(G),this.#$(G,W,C),this.#B[G]=F,C){C.set="replace";let A=q&&this.#z(q)?q.__staleWhileFetching:q;if(A!==void 0)C.oldValue=A}}else if(C)C.set="update";if(this.#Q)this.onInsert?.(F,D,F===q?"update":"replace")}if(B!==0&&!this.#Z)this.#v();if(this.#Z){if(!z)this.#m(G,B,Y);if(C)this.#_(C,G)}if(!J&&this.#K&&this.#A){let q=this.#A,A;while(A=q?.shift())this.#J?.(...A)}return this}pop(){try{while(this.#C){let D=this.#B[this.#L];if(this.#y(!0),this.#z(D)){if(D.__staleWhileFetching)return D.__staleWhileFetching}else if(D!==void 0)return D}}finally{if(this.#K&&this.#A){let D=this.#A,F;while(F=D?.shift())this.#J?.(...F)}}}#y(D){let F=this.#L,Q=this.#W[F],B=this.#B[F];if(this.#w&&this.#z(B))B.__abortController.abort(new Error("evicted"));else if(this.#j||this.#K){if(this.#j)this.#Y?.(B,Q,"evict");if(this.#K)this.#A?.push([B,Q,"evict"])}if(this.#x(F),D)this.#W[F]=void 0,this.#B[F]=void 0,this.#T.push(F);if(this.#C===1)this.#L=this.#E=0,this.#T.length=0;else this.#L=this.#U[F];return this.#q.delete(Q),this.#C--,F}has(D,F={}){let{updateAgeOnHas:Q=this.updateAgeOnHas,status:B}=F,Y=this.#q.get(D);if(Y!==void 0){let J=this.#B[Y];if(this.#z(J)&&J.__staleWhileFetching===void 0)return!1;if(!this.#O(Y)){if(Q)this.#P(Y);if(B)B.has="hit",this.#_(B,Y);return!0}else if(B)B.has="stale",this.#_(B,Y)}else if(B)B.has="miss";return!1}peek(D,F={}){let{allowStale:Q=this.allowStale}=F,B=this.#q.get(D);if(B===void 0||!Q&&this.#O(B))return;let Y=this.#B[B];return this.#z(Y)?Y.__staleWhileFetching:Y}#d(D,F,Q,B){let Y=F===void 0?void 0:this.#B[F];if(this.#z(Y))return Y;let J=new P6,{signal:X}=Q;X?.addEventListener("abort",()=>J.abort(X.reason),{signal:J.signal});let C={signal:J.signal,options:Q,context:B},z=(Z,H=!1)=>{let{aborted:V}=J.signal,N=Q.ignoreFetchAbort&&Z!==void 0;if(Q.status)if(V&&!H){if(Q.status.fetchAborted=!0,Q.status.fetchError=J.signal.reason,N)Q.status.fetchAbortIgnored=!0}else Q.status.fetchResolved=!0;if(V&&!N&&!H)return G(J.signal.reason);let L=A,R=this.#B[F];if(R===A||N&&H&&R===void 0)if(Z===void 0)if(L.__staleWhileFetching!==void 0)this.#B[F]=L.__staleWhileFetching;else this.#k(D,"fetch");else{if(Q.status)Q.status.fetchUpdated=!0;this.set(D,Z,C.options)}return Z},W=(Z)=>{if(Q.status)Q.status.fetchRejected=!0,Q.status.fetchError=Z;return G(Z)},G=(Z)=>{let{aborted:H}=J.signal,V=H&&Q.allowStaleOnFetchAbort,N=V||Q.allowStaleOnFetchRejection,L=N||Q.noDeleteOnFetchRejection,R=A;if(this.#B[F]===A){if(!L||R.__staleWhileFetching===void 0)this.#k(D,"fetch");else if(!V)this.#B[F]=R.__staleWhileFetching}if(N){if(Q.status&&R.__staleWhileFetching!==void 0)Q.status.returnedStale=!0;return R.__staleWhileFetching}else if(R.__returned===R)throw Z},q=(Z,H)=>{let V=this.#M?.(D,Y,C);if(V&&V instanceof Promise)V.then((N)=>Z(N===void 0?void 0:N),H);J.signal.addEventListener("abort",()=>{if(!Q.ignoreFetchAbort||Q.allowStaleOnFetchAbort){if(Z(void 0),Q.allowStaleOnFetchAbort)Z=(N)=>z(N,!0)}})};if(Q.status)Q.status.fetchDispatched=!0;let A=new Promise(q).then(z,W),U=Object.assign(A,{__abortController:J,__staleWhileFetching:Y,__returned:void 0});if(F===void 0)this.set(D,U,{...C.options,status:void 0}),F=this.#q.get(D);else this.#B[F]=U;return U}#z(D){if(!this.#w)return!1;let F=D;return!!F&&F instanceof Promise&&F.hasOwnProperty("__staleWhileFetching")&&F.__abortController instanceof P6}async fetch(D,F={}){let{allowStale:Q=this.allowStale,updateAgeOnGet:B=this.updateAgeOnGet,noDeleteOnStaleGet:Y=this.noDeleteOnStaleGet,ttl:J=this.ttl,noDisposeOnSet:X=this.noDisposeOnSet,size:C=0,sizeCalculation:z=this.sizeCalculation,noUpdateTTL:W=this.noUpdateTTL,noDeleteOnFetchRejection:G=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:q=this.allowStaleOnFetchRejection,ignoreFetchAbort:A=this.ignoreFetchAbort,allowStaleOnFetchAbort:U=this.allowStaleOnFetchAbort,context:Z,forceRefresh:H=!1,status:V,signal:N}=F;if(!this.#w){if(V)V.fetch="get";return this.get(D,{allowStale:Q,updateAgeOnGet:B,noDeleteOnStaleGet:Y,status:V})}let L={allowStale:Q,updateAgeOnGet:B,noDeleteOnStaleGet:Y,ttl:J,noDisposeOnSet:X,size:C,sizeCalculation:z,noUpdateTTL:W,noDeleteOnFetchRejection:G,allowStaleOnFetchRejection:q,allowStaleOnFetchAbort:U,ignoreFetchAbort:A,status:V,signal:N},R=this.#q.get(D);if(R===void 0){if(V)V.fetch="miss";let k=this.#d(D,R,L,Z);return k.__returned=k}else{let k=this.#B[R];if(this.#z(k)){let O=Q&&k.__staleWhileFetching!==void 0;if(V){if(V.fetch="inflight",O)V.returnedStale=!0}return O?k.__staleWhileFetching:k.__returned=k}let b=this.#O(R);if(!H&&!b){if(V)V.fetch="hit";if(this.#f(R),B)this.#P(R);if(V)this.#_(V,R);return k}let I=this.#d(D,R,L,Z),f=I.__staleWhileFetching!==void 0&&Q;if(V){if(V.fetch=b?"stale":"refresh",f&&b)V.returnedStale=!0}return f?I.__staleWhileFetching:I.__returned=I}}async forceFetch(D,F={}){let Q=await this.fetch(D,F);if(Q===void 0)throw new Error("fetch() returned undefined");return Q}memo(D,F={}){let Q=this.#V;if(!Q)throw new Error("no memoMethod provided to constructor");let{context:B,forceRefresh:Y,...J}=F,X=this.get(D,J);if(!Y&&X!==void 0)return X;let C=Q(D,X,{options:J,context:B});return this.set(D,C,J),C}get(D,F={}){let{allowStale:Q=this.allowStale,updateAgeOnGet:B=this.updateAgeOnGet,noDeleteOnStaleGet:Y=this.noDeleteOnStaleGet,status:J}=F,X=this.#q.get(D);if(X!==void 0){let C=this.#B[X],z=this.#z(C);if(J)this.#_(J,X);if(this.#O(X)){if(J)J.get="stale";if(!z){if(!Y)this.#k(D,"expire");if(J&&Q)J.returnedStale=!0;return Q?C:void 0}else{if(J&&Q&&C.__staleWhileFetching!==void 0)J.returnedStale=!0;return Q?C.__staleWhileFetching:void 0}}else{if(J)J.get="hit";if(z)return C.__staleWhileFetching;if(this.#f(X),B)this.#P(X);return C}}else if(J)J.get="miss"}#c(D,F){this.#N[F]=D,this.#U[D]=F}#f(D){if(D!==this.#E){if(D===this.#L)this.#L=this.#U[D];else this.#c(this.#N[D],this.#U[D]);this.#c(this.#E,D),this.#E=D}}delete(D){return this.#k(D,"delete")}#k(D,F){let Q=!1;if(this.#C!==0){let B=this.#q.get(D);if(B!==void 0)if(Q=!0,this.#C===1)this.#h(F);else{this.#x(B);let Y=this.#B[B];if(this.#z(Y))Y.__abortController.abort(new Error("deleted"));else if(this.#j||this.#K){if(this.#j)this.#Y?.(Y,D,F);if(this.#K)this.#A?.push([Y,D,F])}if(this.#q.delete(D),this.#W[B]=void 0,this.#B[B]=void 0,B===this.#E)this.#E=this.#N[B];else if(B===this.#L)this.#L=this.#U[B];else{let J=this.#N[B];this.#U[J]=this.#U[B];let X=this.#U[B];this.#N[X]=this.#N[B]}this.#C--,this.#T.push(B)}}if(this.#K&&this.#A?.length){let B=this.#A,Y;while(Y=B?.shift())this.#J?.(...Y)}return Q}clear(){return this.#h("delete")}#h(D){for(let F of this.#b({allowStale:!0})){let Q=this.#B[F];if(this.#z(Q))Q.__abortController.abort(new Error("deleted"));else{let B=this.#W[F];if(this.#j)this.#Y?.(Q,B,D);if(this.#K)this.#A?.push([Q,B,D])}}if(this.#q.clear(),this.#B.fill(void 0),this.#W.fill(void 0),this.#Z&&this.#I)this.#Z.fill(0),this.#I.fill(0);if(this.#R)this.#R.fill(0);if(this.#L=0,this.#E=0,this.#T.length=0,this.#H=0,this.#C=0,this.#K&&this.#A){let F=this.#A,Q;while(Q=F?.shift())this.#J?.(...Q)}}}import{posix as vG,win32 as o7}from"node:path";import{fileURLToPath as xG}from"node:url";import{lstatSync as uG,readdir as yG,readdirSync as fG,readlinkSync as gG,realpathSync as $G}from"fs";import*as hG from"node:fs";import{lstat as lG,readdir as dG,readlink as cG,realpath as pG}from"node:fs/promises";import{EventEmitter as n7}from"node:events";import ZB from"node:stream";import{StringDecoder as RG}from"node:string_decoder";var KB=typeof process==="object"&&process?process:{stdout:null,stderr:null},_G=(D)=>!!D&&typeof D==="object"&&(D instanceof aF||D instanceof ZB||OG(D)||IG(D)),OG=(D)=>!!D&&typeof D==="object"&&D instanceof n7&&typeof D.pipe==="function"&&D.pipe!==ZB.Writable.prototype.pipe,IG=(D)=>!!D&&typeof D==="object"&&D instanceof n7&&typeof D.write==="function"&&typeof D.end==="function",jF=Symbol("EOF"),RF=Symbol("maybeEmitEnd"),xF=Symbol("emittedEnd"),S6=Symbol("emittingEnd"),A8=Symbol("emittedError"),k6=Symbol("closed"),UB=Symbol("read"),b6=Symbol("flush"),EB=Symbol("flushChunk"),FF=Symbol("encoding"),V2=Symbol("decoder"),D0=Symbol("flowing"),Z8=Symbol("paused"),L2=Symbol("resume"),F0=Symbol("buffer"),V0=Symbol("pipes"),B0=Symbol("bufferLength"),m7=Symbol("bufferPush"),v6=Symbol("bufferShift"),z0=Symbol("objectMode"),iD=Symbol("destroyed"),l7=Symbol("error"),d7=Symbol("emitData"),AB=Symbol("emitEnd"),c7=Symbol("emitEnd2"),qF=Symbol("async"),p7=Symbol("abort"),x6=Symbol("aborted"),V8=Symbol("signal"),iF=Symbol("dataListeners"),k0=Symbol("discarded"),L8=(D)=>Promise.resolve().then(D),wG=(D)=>D(),TG=(D)=>D==="end"||D==="finish"||D==="prefinish",PG=(D)=>D instanceof ArrayBuffer||!!D&&typeof D==="object"&&D.constructor&&D.constructor.name==="ArrayBuffer"&&D.byteLength>=0,SG=(D)=>!Buffer.isBuffer(D)&&ArrayBuffer.isView(D);class i7{src;dest;opts;ondrain;constructor(D,F,Q){this.src=D,this.dest=F,this.opts=Q,this.ondrain=()=>D[L2](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(D){}end(){if(this.unpipe(),this.opts.end)this.dest.end()}}class VB extends i7{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(D,F,Q){super(D,F,Q);this.proxyErrors=(B)=>F.emit("error",B),D.on("error",this.proxyErrors)}}var kG=(D)=>!!D.objectMode,bG=(D)=>!D.objectMode&&!!D.encoding&&D.encoding!=="buffer";class aF extends n7{[D0]=!1;[Z8]=!1;[V0]=[];[F0]=[];[z0];[FF];[qF];[V2];[jF]=!1;[xF]=!1;[S6]=!1;[k6]=!1;[A8]=null;[B0]=0;[iD]=!1;[V8];[x6]=!1;[iF]=0;[k0]=!1;writable=!0;readable=!0;constructor(...D){let F=D[0]||{};super();if(F.objectMode&&typeof F.encoding==="string")throw new TypeError("Encoding and objectMode may not be used together");if(kG(F))this[z0]=!0,this[FF]=null;else if(bG(F))this[FF]=F.encoding,this[z0]=!1;else this[z0]=!1,this[FF]=null;if(this[qF]=!!F.async,this[V2]=this[FF]?new RG(this[FF]):null,F&&F.debugExposeBuffer===!0)Object.defineProperty(this,"buffer",{get:()=>this[F0]});if(F&&F.debugExposePipes===!0)Object.defineProperty(this,"pipes",{get:()=>this[V0]});let{signal:Q}=F;if(Q)if(this[V8]=Q,Q.aborted)this[p7]();else Q.addEventListener("abort",()=>this[p7]())}get bufferLength(){return this[B0]}get encoding(){return this[FF]}set encoding(D){throw new Error("Encoding must be set at instantiation time")}setEncoding(D){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[z0]}set objectMode(D){throw new Error("objectMode must be set at instantiation time")}get["async"](){return this[qF]}set["async"](D){this[qF]=this[qF]||!!D}[p7](){this[x6]=!0,this.emit("abort",this[V8]?.reason),this.destroy(this[V8]?.reason)}get aborted(){return this[x6]}set aborted(D){}write(D,F,Q){if(this[x6])return!1;if(this[jF])throw new Error("write after end");if(this[iD])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;if(typeof F==="function")Q=F,F="utf8";if(!F)F="utf8";let B=this[qF]?L8:wG;if(!this[z0]&&!Buffer.isBuffer(D)){if(SG(D))D=Buffer.from(D.buffer,D.byteOffset,D.byteLength);else if(PG(D))D=Buffer.from(D);else if(typeof D!=="string")throw new Error("Non-contiguous data written to non-objectMode stream")}if(this[z0]){if(this[D0]&&this[B0]!==0)this[b6](!0);if(this[D0])this.emit("data",D);else this[m7](D);if(this[B0]!==0)this.emit("readable");if(Q)B(Q);return this[D0]}if(!D.length){if(this[B0]!==0)this.emit("readable");if(Q)B(Q);return this[D0]}if(typeof D==="string"&&!(F===this[FF]&&!this[V2]?.lastNeed))D=Buffer.from(D,F);if(Buffer.isBuffer(D)&&this[FF])D=this[V2].write(D);if(this[D0]&&this[B0]!==0)this[b6](!0);if(this[D0])this.emit("data",D);else this[m7](D);if(this[B0]!==0)this.emit("readable");if(Q)B(Q);return this[D0]}read(D){if(this[iD])return null;if(this[k0]=!1,this[B0]===0||D===0||D&&D>this[B0])return this[RF](),null;if(this[z0])D=null;if(this[F0].length>1&&!this[z0])this[F0]=[this[FF]?this[F0].join(""):Buffer.concat(this[F0],this[B0])];let F=this[UB](D||null,this[F0][0]);return this[RF](),F}[UB](D,F){if(this[z0])this[v6]();else{let Q=F;if(D===Q.length||D===null)this[v6]();else if(typeof Q==="string")this[F0][0]=Q.slice(D),F=Q.slice(0,D),this[B0]-=D;else this[F0][0]=Q.subarray(D),F=Q.subarray(0,D),this[B0]-=D}if(this.emit("data",F),!this[F0].length&&!this[jF])this.emit("drain");return F}end(D,F,Q){if(typeof D==="function")Q=D,D=void 0;if(typeof F==="function")Q=F,F="utf8";if(D!==void 0)this.write(D,F);if(Q)this.once("end",Q);if(this[jF]=!0,this.writable=!1,this[D0]||!this[Z8])this[RF]();return this}[L2](){if(this[iD])return;if(!this[iF]&&!this[V0].length)this[k0]=!0;if(this[Z8]=!1,this[D0]=!0,this.emit("resume"),this[F0].length)this[b6]();else if(this[jF])this[RF]();else this.emit("drain")}resume(){return this[L2]()}pause(){this[D0]=!1,this[Z8]=!0,this[k0]=!1}get destroyed(){return this[iD]}get flowing(){return this[D0]}get paused(){return this[Z8]}[m7](D){if(this[z0])this[B0]+=1;else this[B0]+=D.length;this[F0].push(D)}[v6](){if(this[z0])this[B0]-=1;else this[B0]-=this[F0][0].length;return this[F0].shift()}[b6](D=!1){do;while(this[EB](this[v6]())&&this[F0].length);if(!D&&!this[F0].length&&!this[jF])this.emit("drain")}[EB](D){return this.emit("data",D),this[D0]}pipe(D,F){if(this[iD])return D;this[k0]=!1;let Q=this[xF];if(F=F||{},D===KB.stdout||D===KB.stderr)F.end=!1;else F.end=F.end!==!1;if(F.proxyErrors=!!F.proxyErrors,Q){if(F.end)D.end()}else if(this[V0].push(!F.proxyErrors?new i7(this,D,F):new VB(this,D,F)),this[qF])L8(()=>this[L2]());else this[L2]();return D}unpipe(D){let F=this[V0].find((Q)=>Q.dest===D);if(F){if(this[V0].length===1){if(this[D0]&&this[iF]===0)this[D0]=!1;this[V0]=[]}else this[V0].splice(this[V0].indexOf(F),1);F.unpipe()}}addListener(D,F){return this.on(D,F)}on(D,F){let Q=super.on(D,F);if(D==="data"){if(this[k0]=!1,this[iF]++,!this[V0].length&&!this[D0])this[L2]()}else if(D==="readable"&&this[B0]!==0)super.emit("readable");else if(TG(D)&&this[xF])super.emit(D),this.removeAllListeners(D);else if(D==="error"&&this[A8]){let B=F;if(this[qF])L8(()=>B.call(this,this[A8]));else B.call(this,this[A8])}return Q}removeListener(D,F){return this.off(D,F)}off(D,F){let Q=super.off(D,F);if(D==="data"){if(this[iF]=this.listeners("data").length,this[iF]===0&&!this[k0]&&!this[V0].length)this[D0]=!1}return Q}removeAllListeners(D){let F=super.removeAllListeners(D);if(D==="data"||D===void 0){if(this[iF]=0,!this[k0]&&!this[V0].length)this[D0]=!1}return F}get emittedEnd(){return this[xF]}[RF](){if(!this[S6]&&!this[xF]&&!this[iD]&&this[F0].length===0&&this[jF]){if(this[S6]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[k6])this.emit("close");this[S6]=!1}}emit(D,...F){let Q=F[0];if(D!=="error"&&D!=="close"&&D!==iD&&this[iD])return!1;else if(D==="data")return!this[z0]&&!Q?!1:this[qF]?(L8(()=>this[d7](Q)),!0):this[d7](Q);else if(D==="end")return this[AB]();else if(D==="close"){if(this[k6]=!0,!this[xF]&&!this[iD])return!1;let Y=super.emit("close");return this.removeAllListeners("close"),Y}else if(D==="error"){this[A8]=Q,super.emit(l7,Q);let Y=!this[V8]||this.listeners("error").length?super.emit("error",Q):!1;return this[RF](),Y}else if(D==="resume"){let Y=super.emit("resume");return this[RF](),Y}else if(D==="finish"||D==="prefinish"){let Y=super.emit(D);return this.removeAllListeners(D),Y}let B=super.emit(D,...F);return this[RF](),B}[d7](D){for(let Q of this[V0])if(Q.dest.write(D)===!1)this.pause();let F=this[k0]?!1:super.emit("data",D);return this[RF](),F}[AB](){if(this[xF])return!1;return this[xF]=!0,this.readable=!1,this[qF]?(L8(()=>this[c7]()),!0):this[c7]()}[c7](){if(this[V2]){let F=this[V2].end();if(F){for(let Q of this[V0])Q.dest.write(F);if(!this[k0])super.emit("data",F)}}for(let F of this[V0])F.end();let D=super.emit("end");return this.removeAllListeners("end"),D}async collect(){let D=Object.assign([],{dataLength:0});if(!this[z0])D.dataLength=0;let F=this.promise();return this.on("data",(Q)=>{if(D.push(Q),!this[z0])D.dataLength+=Q.length}),await F,D}async concat(){if(this[z0])throw new Error("cannot concat in objectMode");let D=await this.collect();return this[FF]?D.join(""):Buffer.concat(D,D.dataLength)}async promise(){return new Promise((D,F)=>{this.on(iD,()=>F(new Error("stream destroyed"))),this.on("error",(Q)=>F(Q)),this.on("end",()=>D())})}[Symbol.asyncIterator](){this[k0]=!1;let D=!1,F=async()=>{return this.pause(),D=!0,{value:void 0,done:!0}};return{next:()=>{if(D)return F();let B=this.read();if(B!==null)return Promise.resolve({done:!1,value:B});if(this[jF])return F();let Y,J,X=(G)=>{this.off("data",C),this.off("end",z),this.off(iD,W),F(),J(G)},C=(G)=>{this.off("error",X),this.off("end",z),this.off(iD,W),this.pause(),Y({value:G,done:!!this[jF]})},z=()=>{this.off("error",X),this.off("data",C),this.off(iD,W),F(),Y({done:!0,value:void 0})},W=()=>X(new Error("stream destroyed"));return new Promise((G,q)=>{J=q,Y=G,this.once(iD,W),this.once("error",X),this.once("end",z),this.once("data",C)})},throw:F,return:F,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[k0]=!1;let D=!1,F=()=>{return this.pause(),this.off(l7,F),this.off(iD,F),this.off("end",F),D=!0,{done:!0,value:void 0}},Q=()=>{if(D)return F();let B=this.read();return B===null?F():{done:!1,value:B}};return this.once("end",F),this.once(l7,F),this.once(iD,F),{next:Q,throw:F,return:F,[Symbol.iterator](){return this}}}destroy(D){if(this[iD]){if(D)this.emit("error",D);else this.emit(iD);return this}this[iD]=!0,this[k0]=!0,this[F0].length=0,this[B0]=0;let F=this;if(typeof F.close==="function"&&!this[k6])F.close();if(D)this.emit("error",D);else this.emit(iD);return this}static get isStream(){return _G}}var mG=$G.native,N8={lstatSync:uG,readdir:yG,readdirSync:fG,readlinkSync:gG,realpathSync:mG,promises:{lstat:lG,readdir:dG,readlink:cG,realpath:pG}},RB=(D)=>!D||D===N8||D===hG?N8:{...N8,...D,promises:{...N8.promises,...D.promises||{}}},_B=/^\\\\\?\\([a-z]:)\\?$/i,nG=(D)=>D.replace(/\//g,"\\").replace(_B,"$1\\"),iG=/[\\\/]/,d0=0,OB=1,IB=2,HF=4,wB=6,TB=8,rF=10,PB=12,l0=15,M8=~l0,a7=16,LB=32,j8=64,BF=128,u6=256,f6=512,MB=j8|BF|f6,aG=1023,r7=(D)=>D.isFile()?TB:D.isDirectory()?HF:D.isSymbolicLink()?rF:D.isCharacterDevice()?IB:D.isBlockDevice()?wB:D.isSocket()?PB:D.isFIFO()?OB:d0,NB=new Map,R8=(D)=>{let F=NB.get(D);if(F)return F;let Q=D.normalize("NFKD");return NB.set(D,Q),Q},jB=new Map,y6=(D)=>{let F=jB.get(D);if(F)return F;let Q=R8(D.toLowerCase());return jB.set(D,Q),Q};class s7 extends E8{constructor(){super({max:256})}}class SB extends E8{constructor(D=16384){super({maxSize:D,sizeCalculation:(F)=>F.length+1})}}var kB=Symbol("PathScurry setAsCwd");class L0{name;root;roots;parent;nocase;isCWD=!1;#D;#F;get dev(){return this.#F}#Y;get mode(){return this.#Y}#X;get nlink(){return this.#X}#J;get uid(){return this.#J}#M;get gid(){return this.#M}#V;get rdev(){return this.#V}#G;get blksize(){return this.#G}#C;get ino(){return this.#C}#H;get size(){return this.#H}#q;get blocks(){return this.#q}#W;get atimeMs(){return this.#W}#B;get mtimeMs(){return this.#B}#U;get ctimeMs(){return this.#U}#N;get birthtimeMs(){return this.#N}#L;get atime(){return this.#L}#E;get mtime(){return this.#E}#T;get ctime(){return this.#T}#A;get birthtime(){return this.#A}#R;#I;#Z;#j;#w;#K;#Q;#v;#P;#_;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(D,F=d0,Q,B,Y,J,X){if(this.name=D,this.#R=Y?y6(D):R8(D),this.#Q=F&aG,this.nocase=Y,this.roots=B,this.root=Q||this,this.#v=J,this.#Z=X.fullpath,this.#w=X.relative,this.#K=X.relativePosix,this.parent=X.parent,this.parent)this.#D=this.parent.#D;else this.#D=RB(X.fs)}depth(){if(this.#I!==void 0)return this.#I;if(!this.parent)return this.#I=0;return this.#I=this.parent.depth()+1}childrenCache(){return this.#v}resolve(D){if(!D)return this;let F=this.getRootString(D),B=D.substring(F.length).split(this.splitSep);return F?this.getRoot(F).#m(B):this.#m(B)}#m(D){let F=this;for(let Q of D)F=F.child(Q);return F}children(){let D=this.#v.get(this);if(D)return D;let F=Object.assign([],{provisional:0});return this.#v.set(this,F),this.#Q&=~a7,F}child(D,F){if(D===""||D===".")return this;if(D==="..")return this.parent||this;let Q=this.children(),B=this.nocase?y6(D):R8(D);for(let C of Q)if(C.#R===B)return C;let Y=this.parent?this.sep:"",J=this.#Z?this.#Z+Y+D:void 0,X=this.newChild(D,d0,{...F,parent:this,fullpath:J});if(!this.canReaddir())X.#Q|=BF;return Q.push(X),X}relative(){if(this.isCWD)return"";if(this.#w!==void 0)return this.#w;let D=this.name,F=this.parent;if(!F)return this.#w=this.name;let Q=F.relative();return Q+(!Q||!F.parent?"":this.sep)+D}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#K!==void 0)return this.#K;let D=this.name,F=this.parent;if(!F)return this.#K=this.fullpathPosix();let Q=F.relativePosix();return Q+(!Q||!F.parent?"":"/")+D}fullpath(){if(this.#Z!==void 0)return this.#Z;let D=this.name,F=this.parent;if(!F)return this.#Z=this.name;let B=F.fullpath()+(!F.parent?"":this.sep)+D;return this.#Z=B}fullpathPosix(){if(this.#j!==void 0)return this.#j;if(this.sep==="/")return this.#j=this.fullpath();if(!this.parent){let B=this.fullpath().replace(/\\/g,"/");if(/^[a-z]:\//i.test(B))return this.#j=`//?/${B}`;else return this.#j=B}let D=this.parent,F=D.fullpathPosix(),Q=F+(!F||!D.parent?"":"/")+this.name;return this.#j=Q}isUnknown(){return(this.#Q&l0)===d0}isType(D){return this[`is${D}`]()}getType(){return this.isUnknown()?"Unknown":this.isDirectory()?"Directory":this.isFile()?"File":this.isSymbolicLink()?"SymbolicLink":this.isFIFO()?"FIFO":this.isCharacterDevice()?"CharacterDevice":this.isBlockDevice()?"BlockDevice":this.isSocket()?"Socket":"Unknown"}isFile(){return(this.#Q&l0)===TB}isDirectory(){return(this.#Q&l0)===HF}isCharacterDevice(){return(this.#Q&l0)===IB}isBlockDevice(){return(this.#Q&l0)===wB}isFIFO(){return(this.#Q&l0)===OB}isSocket(){return(this.#Q&l0)===PB}isSymbolicLink(){return(this.#Q&rF)===rF}lstatCached(){return this.#Q&LB?this:void 0}readlinkCached(){return this.#P}realpathCached(){return this.#_}readdirCached(){let D=this.children();return D.slice(0,D.provisional)}canReadlink(){if(this.#P)return!0;if(!this.parent)return!1;let D=this.#Q&l0;return!(D!==d0&&D!==rF||this.#Q&u6||this.#Q&BF)}calledReaddir(){return!!(this.#Q&a7)}isENOENT(){return!!(this.#Q&BF)}isNamed(D){return!this.nocase?this.#R===R8(D):this.#R===y6(D)}async readlink(){let D=this.#P;if(D)return D;if(!this.canReadlink())return;if(!this.parent)return;try{let F=await this.#D.promises.readlink(this.fullpath()),Q=(await this.parent.realpath())?.resolve(F);if(Q)return this.#P=Q}catch(F){this.#l(F.code);return}}readlinkSync(){let D=this.#P;if(D)return D;if(!this.canReadlink())return;if(!this.parent)return;try{let F=this.#D.readlinkSync(this.fullpath()),Q=this.parent.realpathSync()?.resolve(F);if(Q)return this.#P=Q}catch(F){this.#l(F.code);return}}#O(D){this.#Q|=a7;for(let F=D.provisional;F<D.length;F++){let Q=D[F];if(Q)Q.#g()}}#g(){if(this.#Q&BF)return;this.#Q=(this.#Q|BF)&M8,this.#x()}#x(){let D=this.children();D.provisional=0;for(let F of D)F.#g()}#$(){this.#Q|=f6,this.#u()}#u(){if(this.#Q&j8)return;let D=this.#Q;if((D&l0)===HF)D&=M8;this.#Q=D|j8,this.#x()}#S(D=""){if(D==="ENOTDIR"||D==="EPERM")this.#u();else if(D==="ENOENT")this.#g();else this.children().provisional=0}#b(D=""){if(D==="ENOTDIR")this.parent.#u();else if(D==="ENOENT")this.#g()}#l(D=""){let F=this.#Q;if(F|=u6,D==="ENOENT")F|=BF;if(D==="EINVAL"||D==="UNKNOWN")F&=M8;if(this.#Q=F,D==="ENOTDIR"&&this.parent)this.parent.#u()}#y(D,F){return this.#z(D,F)||this.#d(D,F)}#d(D,F){let Q=r7(D),B=this.newChild(D.name,Q,{parent:this}),Y=B.#Q&l0;if(Y!==HF&&Y!==rF&&Y!==d0)B.#Q|=j8;return F.unshift(B),F.provisional++,B}#z(D,F){for(let Q=F.provisional;Q<F.length;Q++){let B=F[Q];if((this.nocase?y6(D.name):R8(D.name))!==B.#R)continue;return this.#c(D,B,Q,F)}}#c(D,F,Q,B){let Y=F.name;if(F.#Q=F.#Q&M8|r7(D),Y!==D.name)F.name=D.name;if(Q!==B.provisional){if(Q===B.length-1)B.pop();else B.splice(Q,1);B.unshift(F)}return B.provisional++,F}async lstat(){if((this.#Q&BF)===0)try{return this.#f(await this.#D.promises.lstat(this.fullpath())),this}catch(D){this.#b(D.code)}}lstatSync(){if((this.#Q&BF)===0)try{return this.#f(this.#D.lstatSync(this.fullpath())),this}catch(D){this.#b(D.code)}}#f(D){let{atime:F,atimeMs:Q,birthtime:B,birthtimeMs:Y,blksize:J,blocks:X,ctime:C,ctimeMs:z,dev:W,gid:G,ino:q,mode:A,mtime:U,mtimeMs:Z,nlink:H,rdev:V,size:N,uid:L}=D;this.#L=F,this.#W=Q,this.#A=B,this.#N=Y,this.#G=J,this.#q=X,this.#T=C,this.#U=z,this.#F=W,this.#M=G,this.#C=q,this.#Y=A,this.#E=U,this.#B=Z,this.#X=H,this.#V=V,this.#H=N,this.#J=L;let R=r7(D);if(this.#Q=this.#Q&M8|R|LB,R!==d0&&R!==HF&&R!==rF)this.#Q|=j8}#k=[];#h=!1;#n(D){this.#h=!1;let F=this.#k.slice();this.#k.length=0,F.forEach((Q)=>Q(null,D))}readdirCB(D,F=!1){if(!this.canReaddir()){if(F)D(null,[]);else queueMicrotask(()=>D(null,[]));return}let Q=this.children();if(this.calledReaddir()){let Y=Q.slice(0,Q.provisional);if(F)D(null,Y);else queueMicrotask(()=>D(null,Y));return}if(this.#k.push(D),this.#h)return;this.#h=!0;let B=this.fullpath();this.#D.readdir(B,{withFileTypes:!0},(Y,J)=>{if(Y)this.#S(Y.code),Q.provisional=0;else{for(let X of J)this.#y(X,Q);this.#O(Q)}this.#n(Q.slice(0,Q.provisional));return})}#p;async readdir(){if(!this.canReaddir())return[];let D=this.children();if(this.calledReaddir())return D.slice(0,D.provisional);let F=this.fullpath();if(this.#p)await this.#p;else{let Q=()=>{};this.#p=new Promise((B)=>Q=B);try{for(let B of await this.#D.promises.readdir(F,{withFileTypes:!0}))this.#y(B,D);this.#O(D)}catch(B){this.#S(B.code),D.provisional=0}this.#p=void 0,Q()}return D.slice(0,D.provisional)}readdirSync(){if(!this.canReaddir())return[];let D=this.children();if(this.calledReaddir())return D.slice(0,D.provisional);let F=this.fullpath();try{for(let Q of this.#D.readdirSync(F,{withFileTypes:!0}))this.#y(Q,D);this.#O(D)}catch(Q){this.#S(Q.code),D.provisional=0}return D.slice(0,D.provisional)}canReaddir(){if(this.#Q&MB)return!1;let D=l0&this.#Q;if(!(D===d0||D===HF||D===rF))return!1;return!0}shouldWalk(D,F){return(this.#Q&HF)===HF&&!(this.#Q&MB)&&!D.has(this)&&(!F||F(this))}async realpath(){if(this.#_)return this.#_;if((f6|u6|BF)&this.#Q)return;try{let D=await this.#D.promises.realpath(this.fullpath());return this.#_=this.resolve(D)}catch(D){this.#$()}}realpathSync(){if(this.#_)return this.#_;if((f6|u6|BF)&this.#Q)return;try{let D=this.#D.realpathSync(this.fullpath());return this.#_=this.resolve(D)}catch(D){this.#$()}}[kB](D){if(D===this)return;D.isCWD=!1,this.isCWD=!0;let F=new Set([]),Q=[],B=this;while(B&&B.parent)F.add(B),B.#w=Q.join(this.sep),B.#K=Q.join("/"),B=B.parent,Q.push("..");B=D;while(B&&B.parent&&!F.has(B))B.#w=void 0,B.#K=void 0,B=B.parent}}class g6 extends L0{sep="\\";splitSep=iG;constructor(D,F=d0,Q,B,Y,J,X){super(D,F,Q,B,Y,J,X)}newChild(D,F=d0,Q={}){return new g6(D,F,this.root,this.roots,this.nocase,this.childrenCache(),Q)}getRootString(D){return o7.parse(D).root}getRoot(D){if(D=nG(D.toUpperCase()),D===this.root.name)return this.root;for(let[F,Q]of Object.entries(this.roots))if(this.sameRoot(D,F))return this.roots[D]=Q;return this.roots[D]=new _8(D,this).root}sameRoot(D,F=this.root.name){return D=D.toUpperCase().replace(/\//g,"\\").replace(_B,"$1\\"),D===F}}class $6 extends L0{splitSep="/";sep="/";constructor(D,F=d0,Q,B,Y,J,X){super(D,F,Q,B,Y,J,X)}getRootString(D){return D.startsWith("/")?"/":""}getRoot(D){return this.root}newChild(D,F=d0,Q={}){return new $6(D,F,this.root,this.roots,this.nocase,this.childrenCache(),Q)}}class t7{root;rootPath;roots;cwd;#D;#F;#Y;nocase;#X;constructor(D=process.cwd(),F,Q,{nocase:B,childrenCacheSize:Y=16384,fs:J=N8}={}){if(this.#X=RB(J),D instanceof URL||D.startsWith("file://"))D=xG(D);let X=F.resolve(D);this.roots=Object.create(null),this.rootPath=this.parseRootPath(X),this.#D=new s7,this.#F=new s7,this.#Y=new SB(Y);let C=X.substring(this.rootPath.length).split(Q);if(C.length===1&&!C[0])C.pop();if(B===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=B,this.root=this.newRoot(this.#X),this.roots[this.rootPath]=this.root;let z=this.root,W=C.length-1,G=F.sep,q=this.rootPath,A=!1;for(let U of C){let Z=W--;z=z.child(U,{relative:new Array(Z).fill("..").join(G),relativePosix:new Array(Z).fill("..").join("/"),fullpath:q+=(A?"":G)+U}),A=!0}this.cwd=z}depth(D=this.cwd){if(typeof D==="string")D=this.cwd.resolve(D);return D.depth()}childrenCache(){return this.#Y}resolve(...D){let F="";for(let Y=D.length-1;Y>=0;Y--){let J=D[Y];if(!J||J===".")continue;if(F=F?`${J}/${F}`:J,this.isAbsolute(J))break}let Q=this.#D.get(F);if(Q!==void 0)return Q;let B=this.cwd.resolve(F).fullpath();return this.#D.set(F,B),B}resolvePosix(...D){let F="";for(let Y=D.length-1;Y>=0;Y--){let J=D[Y];if(!J||J===".")continue;if(F=F?`${J}/${F}`:J,this.isAbsolute(J))break}let Q=this.#F.get(F);if(Q!==void 0)return Q;let B=this.cwd.resolve(F).fullpathPosix();return this.#F.set(F,B),B}relative(D=this.cwd){if(typeof D==="string")D=this.cwd.resolve(D);return D.relative()}relativePosix(D=this.cwd){if(typeof D==="string")D=this.cwd.resolve(D);return D.relativePosix()}basename(D=this.cwd){if(typeof D==="string")D=this.cwd.resolve(D);return D.name}dirname(D=this.cwd){if(typeof D==="string")D=this.cwd.resolve(D);return(D.parent||D).fullpath()}async readdir(D=this.cwd,F={withFileTypes:!0}){if(typeof D==="string")D=this.cwd.resolve(D);else if(!(D instanceof L0))F=D,D=this.cwd;let{withFileTypes:Q}=F;if(!D.canReaddir())return[];else{let B=await D.readdir();return Q?B:B.map((Y)=>Y.name)}}readdirSync(D=this.cwd,F={withFileTypes:!0}){if(typeof D==="string")D=this.cwd.resolve(D);else if(!(D instanceof L0))F=D,D=this.cwd;let{withFileTypes:Q=!0}=F;if(!D.canReaddir())return[];else if(Q)return D.readdirSync();else return D.readdirSync().map((B)=>B.name)}async lstat(D=this.cwd){if(typeof D==="string")D=this.cwd.resolve(D);return D.lstat()}lstatSync(D=this.cwd){if(typeof D==="string")D=this.cwd.resolve(D);return D.lstatSync()}async readlink(D=this.cwd,{withFileTypes:F}={withFileTypes:!1}){if(typeof D==="string")D=this.cwd.resolve(D);else if(!(D instanceof L0))F=D.withFileTypes,D=this.cwd;let Q=await D.readlink();return F?Q:Q?.fullpath()}readlinkSync(D=this.cwd,{withFileTypes:F}={withFileTypes:!1}){if(typeof D==="string")D=this.cwd.resolve(D);else if(!(D instanceof L0))F=D.withFileTypes,D=this.cwd;let Q=D.readlinkSync();return F?Q:Q?.fullpath()}async realpath(D=this.cwd,{withFileTypes:F}={withFileTypes:!1}){if(typeof D==="string")D=this.cwd.resolve(D);else if(!(D instanceof L0))F=D.withFileTypes,D=this.cwd;let Q=await D.realpath();return F?Q:Q?.fullpath()}realpathSync(D=this.cwd,{withFileTypes:F}={withFileTypes:!1}){if(typeof D==="string")D=this.cwd.resolve(D);else if(!(D instanceof L0))F=D.withFileTypes,D=this.cwd;let Q=D.realpathSync();return F?Q:Q?.fullpath()}async walk(D=this.cwd,F={}){if(typeof D==="string")D=this.cwd.resolve(D);else if(!(D instanceof L0))F=D,D=this.cwd;let{withFileTypes:Q=!0,follow:B=!1,filter:Y,walkFilter:J}=F,X=[];if(!Y||Y(D))X.push(Q?D:D.fullpath());let C=new Set,z=(G,q)=>{C.add(G),G.readdirCB((A,U)=>{if(A)return q(A);let Z=U.length;if(!Z)return q();let H=()=>{if(--Z===0)q()};for(let V of U){if(!Y||Y(V))X.push(Q?V:V.fullpath());if(B&&V.isSymbolicLink())V.realpath().then((N)=>N?.isUnknown()?N.lstat():N).then((N)=>N?.shouldWalk(C,J)?z(N,H):H());else if(V.shouldWalk(C,J))z(V,H);else H()}},!0)},W=D;return new Promise((G,q)=>{z(W,(A)=>{if(A)return q(A);G(X)})})}walkSync(D=this.cwd,F={}){if(typeof D==="string")D=this.cwd.resolve(D);else if(!(D instanceof L0))F=D,D=this.cwd;let{withFileTypes:Q=!0,follow:B=!1,filter:Y,walkFilter:J}=F,X=[];if(!Y||Y(D))X.push(Q?D:D.fullpath());let C=new Set([D]);for(let z of C){let W=z.readdirSync();for(let G of W){if(!Y||Y(G))X.push(Q?G:G.fullpath());let q=G;if(G.isSymbolicLink()){if(!(B&&(q=G.realpathSync())))continue;if(q.isUnknown())q.lstatSync()}if(q.shouldWalk(C,J))C.add(q)}}return X}[Symbol.asyncIterator](){return this.iterate()}iterate(D=this.cwd,F={}){if(typeof D==="string")D=this.cwd.resolve(D);else if(!(D instanceof L0))F=D,D=this.cwd;return this.stream(D,F)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(D=this.cwd,F={}){if(typeof D==="string")D=this.cwd.resolve(D);else if(!(D instanceof L0))F=D,D=this.cwd;let{withFileTypes:Q=!0,follow:B=!1,filter:Y,walkFilter:J}=F;if(!Y||Y(D))yield Q?D:D.fullpath();let X=new Set([D]);for(let C of X){let z=C.readdirSync();for(let W of z){if(!Y||Y(W))yield Q?W:W.fullpath();let G=W;if(W.isSymbolicLink()){if(!(B&&(G=W.realpathSync())))continue;if(G.isUnknown())G.lstatSync()}if(G.shouldWalk(X,J))X.add(G)}}}stream(D=this.cwd,F={}){if(typeof D==="string")D=this.cwd.resolve(D);else if(!(D instanceof L0))F=D,D=this.cwd;let{withFileTypes:Q=!0,follow:B=!1,filter:Y,walkFilter:J}=F,X=new aF({objectMode:!0});if(!Y||Y(D))X.write(Q?D:D.fullpath());let C=new Set,z=[D],W=0,G=()=>{let q=!1;while(!q){let A=z.shift();if(!A){if(W===0)X.end();return}W++,C.add(A);let U=(H,V,N=!1)=>{if(H)return X.emit("error",H);if(B&&!N){let L=[];for(let R of V)if(R.isSymbolicLink())L.push(R.realpath().then((k)=>k?.isUnknown()?k.lstat():k));if(L.length){Promise.all(L).then(()=>U(null,V,!0));return}}for(let L of V)if(L&&(!Y||Y(L))){if(!X.write(Q?L:L.fullpath()))q=!0}W--;for(let L of V){let R=L.realpathCached()||L;if(R.shouldWalk(C,J))z.push(R)}if(q&&!X.flowing)X.once("drain",G);else if(!Z)G()},Z=!0;A.readdirCB(U,!0),Z=!1}};return G(),X}streamSync(D=this.cwd,F={}){if(typeof D==="string")D=this.cwd.resolve(D);else if(!(D instanceof L0))F=D,D=this.cwd;let{withFileTypes:Q=!0,follow:B=!1,filter:Y,walkFilter:J}=F,X=new aF({objectMode:!0}),C=new Set;if(!Y||Y(D))X.write(Q?D:D.fullpath());let z=[D],W=0,G=()=>{let q=!1;while(!q){let A=z.shift();if(!A){if(W===0)X.end();return}W++,C.add(A);let U=A.readdirSync();for(let Z of U)if(!Y||Y(Z)){if(!X.write(Q?Z:Z.fullpath()))q=!0}W--;for(let Z of U){let H=Z;if(Z.isSymbolicLink()){if(!(B&&(H=Z.realpathSync())))continue;if(H.isUnknown())H.lstatSync()}if(H.shouldWalk(C,J))z.push(H)}}if(q&&!X.flowing)X.once("drain",G)};return G(),X}chdir(D=this.cwd){let F=this.cwd;this.cwd=typeof D==="string"?this.cwd.resolve(D):D,this.cwd[kB](F)}}class _8 extends t7{sep="\\";constructor(D=process.cwd(),F={}){let{nocase:Q=!0}=F;super(D,o7,"\\",{...F,nocase:Q});this.nocase=Q;for(let B=this.cwd;B;B=B.parent)B.nocase=this.nocase}parseRootPath(D){return o7.parse(D).root.toUpperCase()}newRoot(D){return new g6(this.rootPath,HF,void 0,this.roots,this.nocase,this.childrenCache(),{fs:D})}isAbsolute(D){return D.startsWith("/")||D.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(D)}}class O8 extends t7{sep="/";constructor(D=process.cwd(),F={}){let{nocase:Q=!1}=F;super(D,vG,"/",{...F,nocase:Q});this.nocase=Q}parseRootPath(D){return"/"}newRoot(D){return new $6(this.rootPath,HF,void 0,this.roots,this.nocase,this.childrenCache(),{fs:D})}isAbsolute(D){return D.startsWith("/")}}class h6 extends O8{constructor(D=process.cwd(),F={}){let{nocase:Q=!0}=F;super(D,{...F,nocase:Q})}}var sL=process.platform==="win32"?g6:$6,bB=process.platform==="win32"?_8:process.platform==="darwin"?h6:O8;var rG=(D)=>D.length>=1,oG=(D)=>D.length>=1;class M2{#D;#F;#Y;length;#X;#J;#M;#V;#G;#C;#H=!0;constructor(D,F,Q,B){if(!rG(D))throw new TypeError("empty pattern list");if(!oG(F))throw new TypeError("empty glob list");if(F.length!==D.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=D.length,Q<0||Q>=this.length)throw new TypeError("index out of range");if(this.#D=D,this.#F=F,this.#Y=Q,this.#X=B,this.#Y===0){if(this.isUNC()){let[Y,J,X,C,...z]=this.#D,[W,G,q,A,...U]=this.#F;if(z[0]==="")z.shift(),U.shift();let Z=[Y,J,X,C,""].join("/"),H=[W,G,q,A,""].join("/");this.#D=[Z,...z],this.#F=[H,...U],this.length=this.#D.length}else if(this.isDrive()||this.isAbsolute()){let[Y,...J]=this.#D,[X,...C]=this.#F;if(J[0]==="")J.shift(),C.shift();let z=Y+"/",W=X+"/";this.#D=[z,...J],this.#F=[W,...C],this.length=this.#D.length}}}pattern(){return this.#D[this.#Y]}isString(){return typeof this.#D[this.#Y]==="string"}isGlobstar(){return this.#D[this.#Y]===Y0}isRegExp(){return this.#D[this.#Y]instanceof RegExp}globString(){return this.#M=this.#M||(this.#Y===0?this.isAbsolute()?this.#F[0]+this.#F.slice(1).join("/"):this.#F.join("/"):this.#F.slice(this.#Y).join("/"))}hasMore(){return this.length>this.#Y+1}rest(){if(this.#J!==void 0)return this.#J;if(!this.hasMore())return this.#J=null;return this.#J=new M2(this.#D,this.#F,this.#Y+1,this.#X),this.#J.#C=this.#C,this.#J.#G=this.#G,this.#J.#V=this.#V,this.#J}isUNC(){let D=this.#D;return this.#G!==void 0?this.#G:this.#G=this.#X==="win32"&&this.#Y===0&&D[0]===""&&D[1]===""&&typeof D[2]==="string"&&!!D[2]&&typeof D[3]==="string"&&!!D[3]}isDrive(){let D=this.#D;return this.#V!==void 0?this.#V:this.#V=this.#X==="win32"&&this.#Y===0&&this.length>1&&typeof D[0]==="string"&&/^[a-z]:$/i.test(D[0])}isAbsolute(){let D=this.#D;return this.#C!==void 0?this.#C:this.#C=D[0]===""&&D.length>1||this.isDrive()||this.isUNC()}root(){let D=this.#D[0];return typeof D==="string"&&this.isAbsolute()&&this.#Y===0?D:""}checkFollowGlobstar(){return!(this.#Y===0||!this.isGlobstar()||!this.#H)}markFollowGlobstar(){if(this.#Y===0||!this.isGlobstar()||!this.#H)return!1;return this.#H=!1,!0}}var sG=typeof process==="object"&&process&&typeof process.platform==="string"?process.platform:"linux";class I8{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(D,{nobrace:F,nocase:Q,noext:B,noglobstar:Y,platform:J=sG}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=J,this.mmopts={dot:!0,nobrace:F,nocase:Q,noext:B,noglobstar:Y,optimizationLevel:2,platform:J,nocomment:!0,nonegate:!0};for(let X of D)this.add(X)}add(D){let F=new m0(D,this.mmopts);for(let Q=0;Q<F.set.length;Q++){let B=F.set[Q],Y=F.globParts[Q];if(!B||!Y)throw new Error("invalid pattern object");while(B[0]==="."&&Y[0]===".")B.shift(),Y.shift();let J=new M2(B,Y,0,this.platform),X=new m0(J.globString(),this.mmopts),C=Y[Y.length-1]==="**",z=J.isAbsolute();if(z)this.absolute.push(X);else this.relative.push(X);if(C)if(z)this.absoluteChildren.push(X);else this.relativeChildren.push(X)}}ignored(D){let F=D.fullpath(),Q=`${F}/`,B=D.relative()||".",Y=`${B}/`;for(let J of this.relative)if(J.match(B)||J.match(Y))return!0;for(let J of this.absolute)if(J.match(F)||J.match(Q))return!0;return!1}childrenIgnored(D){let F=D.fullpath()+"/",Q=(D.relative()||".")+"/";for(let B of this.relativeChildren)if(B.match(Q))return!0;for(let B of this.absoluteChildren)if(B.match(F))return!0;return!1}}class e7{store;constructor(D=new Map){this.store=D}copy(){return new e7(new Map(this.store))}hasWalked(D,F){return this.store.get(D.fullpath())?.has(F.globString())}storeWalked(D,F){let Q=D.fullpath(),B=this.store.get(Q);if(B)B.add(F.globString());else this.store.set(Q,new Set([F.globString()]))}}class vB{store=new Map;add(D,F,Q){let B=(F?2:0)|(Q?1:0),Y=this.store.get(D);this.store.set(D,Y===void 0?B:B&Y)}entries(){return[...this.store.entries()].map(([D,F])=>[D,!!(F&2),!!(F&1)])}}class xB{store=new Map;add(D,F){if(!D.canReaddir())return;let Q=this.store.get(D);if(Q){if(!Q.find((B)=>B.globString()===F.globString()))Q.push(F)}else this.store.set(D,[F])}get(D){let F=this.store.get(D);if(!F)throw new Error("attempting to walk unknown path");return F}entries(){return this.keys().map((D)=>[D,this.store.get(D)])}keys(){return[...this.store.keys()].filter((D)=>D.canReaddir())}}class w8{hasWalkedCache;matches=new vB;subwalks=new xB;patterns;follow;dot;opts;constructor(D,F){this.opts=D,this.follow=!!D.follow,this.dot=!!D.dot,this.hasWalkedCache=F?F.copy():new e7}processPatterns(D,F){this.patterns=F;let Q=F.map((B)=>[D,B]);for(let[B,Y]of Q){this.hasWalkedCache.storeWalked(B,Y);let J=Y.root(),X=Y.isAbsolute()&&this.opts.absolute!==!1;if(J){B=B.resolve(J==="/"&&this.opts.root!==void 0?this.opts.root:J);let G=Y.rest();if(!G){this.matches.add(B,!0,!1);continue}else Y=G}if(B.isENOENT())continue;let C,z,W=!1;while(typeof(C=Y.pattern())==="string"&&(z=Y.rest()))B=B.resolve(C),Y=z,W=!0;if(C=Y.pattern(),z=Y.rest(),W){if(this.hasWalkedCache.hasWalked(B,Y))continue;this.hasWalkedCache.storeWalked(B,Y)}if(typeof C==="string"){let G=C===".."||C===""||C===".";this.matches.add(B.resolve(C),X,G);continue}else if(C===Y0){if(!B.isSymbolicLink()||this.follow||Y.checkFollowGlobstar())this.subwalks.add(B,Y);let G=z?.pattern(),q=z?.rest();if(!z||(G===""||G===".")&&!q)this.matches.add(B,X,G===""||G===".");else if(G===".."){let A=B.parent||B;if(!q)this.matches.add(A,X,!0);else if(!this.hasWalkedCache.hasWalked(A,q))this.subwalks.add(A,q)}}else if(C instanceof RegExp)this.subwalks.add(B,Y)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new w8(this.opts,this.hasWalkedCache)}filterEntries(D,F){let Q=this.subwalks.get(D),B=this.child();for(let Y of F)for(let J of Q){let X=J.isAbsolute(),C=J.pattern(),z=J.rest();if(C===Y0)B.testGlobstar(Y,J,z,X);else if(C instanceof RegExp)B.testRegExp(Y,C,z,X);else B.testString(Y,C,z,X)}return B}testGlobstar(D,F,Q,B){if(this.dot||!D.name.startsWith(".")){if(!F.hasMore())this.matches.add(D,B,!1);if(D.canReaddir()){if(this.follow||!D.isSymbolicLink())this.subwalks.add(D,F);else if(D.isSymbolicLink()){if(Q&&F.checkFollowGlobstar())this.subwalks.add(D,Q);else if(F.markFollowGlobstar())this.subwalks.add(D,F)}}}if(Q){let Y=Q.pattern();if(typeof Y==="string"&&Y!==".."&&Y!==""&&Y!==".")this.testString(D,Y,Q.rest(),B);else if(Y===".."){let J=D.parent||D;this.subwalks.add(J,Q)}else if(Y instanceof RegExp)this.testRegExp(D,Y,Q.rest(),B)}}testRegExp(D,F,Q,B){if(!F.test(D.name))return;if(!Q)this.matches.add(D,B,!1);else this.subwalks.add(D,Q)}testString(D,F,Q,B){if(!D.isNamed(F))return;if(!Q)this.matches.add(D,B,!1);else this.subwalks.add(D,Q)}}var tG=(D,F)=>typeof D==="string"?new I8([D],F):Array.isArray(D)?new I8(D,F):D;class D9{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#D=[];#F;#Y;signal;maxDepth;includeChildMatches;constructor(D,F,Q){if(this.patterns=D,this.path=F,this.opts=Q,this.#Y=!Q.posix&&Q.platform==="win32"?"\\":"/",this.includeChildMatches=Q.includeChildMatches!==!1,Q.ignore||!this.includeChildMatches){if(this.#F=tG(Q.ignore??[],Q),!this.includeChildMatches&&typeof this.#F.add!=="function")throw new Error("cannot ignore child matches, ignore lacks add() method.")}if(this.maxDepth=Q.maxDepth||1/0,Q.signal)this.signal=Q.signal,this.signal.addEventListener("abort",()=>{this.#D.length=0})}#X(D){return this.seen.has(D)||!!this.#F?.ignored?.(D)}#J(D){return!!this.#F?.childrenIgnored?.(D)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let D=void 0;while(!this.paused&&(D=this.#D.shift()))D()}onResume(D){if(this.signal?.aborted)return;if(!this.paused)D();else this.#D.push(D)}async matchCheck(D,F){if(F&&this.opts.nodir)return;let Q;if(this.opts.realpath){if(Q=D.realpathCached()||await D.realpath(),!Q)return;D=Q}let Y=D.isUnknown()||this.opts.stat?await D.lstat():D;if(this.opts.follow&&this.opts.nodir&&Y?.isSymbolicLink()){let J=await Y.realpath();if(J&&(J.isUnknown()||this.opts.stat))await J.lstat()}return this.matchCheckTest(Y,F)}matchCheckTest(D,F){return D&&(this.maxDepth===1/0||D.depth()<=this.maxDepth)&&(!F||D.canReaddir())&&(!this.opts.nodir||!D.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!D.isSymbolicLink()||!D.realpathCached()?.isDirectory())&&!this.#X(D)?D:void 0}matchCheckSync(D,F){if(F&&this.opts.nodir)return;let Q;if(this.opts.realpath){if(Q=D.realpathCached()||D.realpathSync(),!Q)return;D=Q}let Y=D.isUnknown()||this.opts.stat?D.lstatSync():D;if(this.opts.follow&&this.opts.nodir&&Y?.isSymbolicLink()){let J=Y.realpathSync();if(J&&(J?.isUnknown()||this.opts.stat))J.lstatSync()}return this.matchCheckTest(Y,F)}matchFinish(D,F){if(this.#X(D))return;if(!this.includeChildMatches&&this.#F?.add){let Y=`${D.relativePosix()}/**`;this.#F.add(Y)}let Q=this.opts.absolute===void 0?F:this.opts.absolute;this.seen.add(D);let B=this.opts.mark&&D.isDirectory()?this.#Y:"";if(this.opts.withFileTypes)this.matchEmit(D);else if(Q){let Y=this.opts.posix?D.fullpathPosix():D.fullpath();this.matchEmit(Y+B)}else{let Y=this.opts.posix?D.relativePosix():D.relative(),J=this.opts.dotRelative&&!Y.startsWith(".."+this.#Y)?"."+this.#Y:"";this.matchEmit(!Y?"."+B:J+Y+B)}}async match(D,F,Q){let B=await this.matchCheck(D,Q);if(B)this.matchFinish(B,F)}matchSync(D,F,Q){let B=this.matchCheckSync(D,Q);if(B)this.matchFinish(B,F)}walkCB(D,F,Q){if(this.signal?.aborted)Q();this.walkCB2(D,F,new w8(this.opts),Q)}walkCB2(D,F,Q,B){if(this.#J(D))return B();if(this.signal?.aborted)B();if(this.paused){this.onResume(()=>this.walkCB2(D,F,Q,B));return}Q.processPatterns(D,F);let Y=1,J=()=>{if(--Y===0)B()};for(let[X,C,z]of Q.matches.entries()){if(this.#X(X))continue;Y++,this.match(X,C,z).then(()=>J())}for(let X of Q.subwalkTargets()){if(this.maxDepth!==1/0&&X.depth()>=this.maxDepth)continue;Y++;let C=X.readdirCached();if(X.calledReaddir())this.walkCB3(X,C,Q,J);else X.readdirCB((z,W)=>this.walkCB3(X,W,Q,J),!0)}J()}walkCB3(D,F,Q,B){Q=Q.filterEntries(D,F);let Y=1,J=()=>{if(--Y===0)B()};for(let[X,C,z]of Q.matches.entries()){if(this.#X(X))continue;Y++,this.match(X,C,z).then(()=>J())}for(let[X,C]of Q.subwalks.entries())Y++,this.walkCB2(X,C,Q.child(),J);J()}walkCBSync(D,F,Q){if(this.signal?.aborted)Q();this.walkCB2Sync(D,F,new w8(this.opts),Q)}walkCB2Sync(D,F,Q,B){if(this.#J(D))return B();if(this.signal?.aborted)B();if(this.paused){this.onResume(()=>this.walkCB2Sync(D,F,Q,B));return}Q.processPatterns(D,F);let Y=1,J=()=>{if(--Y===0)B()};for(let[X,C,z]of Q.matches.entries()){if(this.#X(X))continue;this.matchSync(X,C,z)}for(let X of Q.subwalkTargets()){if(this.maxDepth!==1/0&&X.depth()>=this.maxDepth)continue;Y++;let C=X.readdirSync();this.walkCB3Sync(X,C,Q,J)}J()}walkCB3Sync(D,F,Q,B){Q=Q.filterEntries(D,F);let Y=1,J=()=>{if(--Y===0)B()};for(let[X,C,z]of Q.matches.entries()){if(this.#X(X))continue;this.matchSync(X,C,z)}for(let[X,C]of Q.subwalks.entries())Y++,this.walkCB2Sync(X,C,Q.child(),J);J()}}class m6 extends D9{matches=new Set;constructor(D,F,Q){super(D,F,Q)}matchEmit(D){this.matches.add(D)}async walk(){if(this.signal?.aborted)throw this.signal.reason;if(this.path.isUnknown())await this.path.lstat();return await new Promise((D,F)=>{this.walkCB(this.path,this.patterns,()=>{if(this.signal?.aborted)F(this.signal.reason);else D(this.matches)})}),this.matches}walkSync(){if(this.signal?.aborted)throw this.signal.reason;if(this.path.isUnknown())this.path.lstatSync();return this.walkCBSync(this.path,this.patterns,()=>{if(this.signal?.aborted)throw this.signal.reason}),this.matches}}class l6 extends D9{results;constructor(D,F,Q){super(D,F,Q);this.results=new aF({signal:this.signal,objectMode:!0}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume())}matchEmit(D){if(this.results.write(D),!this.results.flowing)this.pause()}stream(){let D=this.path;if(D.isUnknown())D.lstat().then(()=>{this.walkCB(D,this.patterns,()=>this.results.end())});else this.walkCB(D,this.patterns,()=>this.results.end());return this.results}streamSync(){if(this.path.isUnknown())this.path.lstatSync();return this.walkCBSync(this.path,this.patterns,()=>this.results.end()),this.results}}var Dq=typeof process==="object"&&process&&typeof process.platform==="string"?process.platform:"linux";class KF{absolute;cwd;root;dot;dotRelative;follow;ignore;magicalBraces;mark;matchBase;maxDepth;nobrace;nocase;nodir;noext;noglobstar;pattern;platform;realpath;scurry;stat;signal;windowsPathsNoEscape;withFileTypes;includeChildMatches;opts;patterns;constructor(D,F){if(!F)throw new TypeError("glob options required");if(this.withFileTypes=!!F.withFileTypes,this.signal=F.signal,this.follow=!!F.follow,this.dot=!!F.dot,this.dotRelative=!!F.dotRelative,this.nodir=!!F.nodir,this.mark=!!F.mark,!F.cwd)this.cwd="";else if(F.cwd instanceof URL||F.cwd.startsWith("file://"))F.cwd=eG(F.cwd);if(this.cwd=F.cwd||"",this.root=F.root,this.magicalBraces=!!F.magicalBraces,this.nobrace=!!F.nobrace,this.noext=!!F.noext,this.realpath=!!F.realpath,this.absolute=F.absolute,this.includeChildMatches=F.includeChildMatches!==!1,this.noglobstar=!!F.noglobstar,this.matchBase=!!F.matchBase,this.maxDepth=typeof F.maxDepth==="number"?F.maxDepth:1/0,this.stat=!!F.stat,this.ignore=F.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof D==="string")D=[D];if(this.windowsPathsNoEscape=!!F.windowsPathsNoEscape||F.allowWindowsEscape===!1,this.windowsPathsNoEscape)D=D.map((C)=>C.replace(/\\/g,"/"));if(this.matchBase){if(F.noglobstar)throw new TypeError("base matching requires globstar");D=D.map((C)=>C.includes("/")?C:`./**/${C}`)}if(this.pattern=D,this.platform=F.platform||Dq,this.opts={...F,platform:this.platform},F.scurry){if(this.scurry=F.scurry,F.nocase!==void 0&&F.nocase!==F.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let C=F.platform==="win32"?_8:F.platform==="darwin"?h6:F.platform?O8:bB;this.scurry=new C(this.cwd,{nocase:F.nocase,fs:F.fs})}this.nocase=this.scurry.nocase;let Q=this.platform==="darwin"||this.platform==="win32",B={...F,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:Q,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},Y=this.pattern.map((C)=>new m0(C,B)),[J,X]=Y.reduce((C,z)=>{return C[0].push(...z.set),C[1].push(...z.globParts),C},[[],[]]);this.patterns=J.map((C,z)=>{let W=X[z];if(!W)throw new Error("invalid pattern object");return new M2(C,W,0,this.platform)})}async walk(){return[...await new m6(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walk()]}walkSync(){return[...new m6(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walkSync()]}stream(){return new l6(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).stream()}streamSync(){return new l6(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).streamSync()}iterateSync(){return this.streamSync()[Symbol.iterator]()}[Symbol.iterator](){return this.iterateSync()}iterate(){return this.stream()[Symbol.asyncIterator]()}[Symbol.asyncIterator](){return this.iterate()}}var F9=(D,F={})=>{if(!Array.isArray(D))D=[D];for(let Q of D)if(new m0(Q,F).hasMagic())return!0;return!1};function c6(D,F={}){return new KF(D,F).streamSync()}function yB(D,F={}){return new KF(D,F).stream()}function fB(D,F={}){return new KF(D,F).walkSync()}async function uB(D,F={}){return new KF(D,F).walk()}function p6(D,F={}){return new KF(D,F).iterateSync()}function gB(D,F={}){return new KF(D,F).iterate()}var Fq=c6,Bq=Object.assign(yB,{sync:c6}),Qq=p6,Xq=Object.assign(gB,{sync:p6}),Yq=Object.assign(fB,{stream:c6,iterate:p6}),d6=Object.assign(uB,{glob:uB,globSync:fB,sync:Yq,globStream:yB,stream:Bq,globStreamSync:c6,streamSync:Fq,globIterate:gB,iterate:Xq,globIterateSync:p6,iterateSync:Qq,Glob:KF,hasMagic:F9,escape:A2,unescape:DF});d6.glob=d6;E0();async function hB(D,F={}){let Q=CD.getInstance().getTrashDirectory();if(!$B(Q))Cq(Q,{recursive:!0});let B=Array.isArray(D)?D:[D];for(let Y of B){let J=await d6(Y),X=J.length>0?J:[Y];for(let C of X)try{if(!$B(C)){if(!F.force){console.error(`trash: ${C}: No such file or directory`);continue}continue}if(Wq(C).isDirectory()&&!F.recursive){if(!F.force){console.error(`trash: ${C}: is a directory`);continue}}let W=Gq(C),G=Date.now(),q=zq(Q,`${W}.${G}`);Jq(C,q),console.log(`Moved ${W} to trash`)}catch(z){if(!F.force){let W=z instanceof Error?z.message:String(z);console.error(`trash: ${C}: ${W}`)}}}}import{readdirSync as lB,statSync as dB}from"fs";import{join as cB}from"path";E0();function qq(D){let F=D.lastIndexOf(".");if(F===-1)return{name:D,timestamp:0};let Q=parseInt(D.substring(F+1));if(isNaN(Q))return{name:D,timestamp:0};return{name:D.substring(0,F),timestamp:Q}}function mB(D){if(D===0)return"0 B";let F=1024,Q=["B","KB","MB","GB"],B=Math.floor(Math.log(D)/Math.log(F));return parseFloat((D/Math.pow(F,B)).toFixed(2))+" "+Q[B]}function pB(D){let F=0,Q=lB(D);for(let B of Q){let Y=cB(D,B),J=dB(Y);if(J.isDirectory())F+=pB(Y);else F+=J.size}return F}async function nB(){let D=CD.getInstance().getTrashDirectory();try{let F=lB(D);if(F.length===0){K0.info("\uD83D\uDDD1️ Trash is empty");return}let Q=F.map((X)=>{let C=cB(D,X),z=dB(C),{name:W,timestamp:G}=qq(X),q=z.isDirectory()?pB(C):z.size;return{originalName:W,trashedName:X,size:q,trashedAt:new Date(G),isDirectory:z.isDirectory()}});Q.sort((X,C)=>C.trashedAt.getTime()-X.trashedAt.getTime()),console.log(`
469
+ >>> no match, partial?`,D,q,F,A),q===C)return!0}return!1}let Z;if(typeof z==="string")Z=G===z,this.debug("string match",z,G,Z);else Z=z.test(G),this.debug("pattern match",z,G,Z);if(!Z)return!1}if(J===C&&X===W)return!0;else if(J===C)return Q;else if(X===W)return J===C-1&&D[J]==="";else throw new Error("wtf?")}braceExpand(){return WB(this.pattern,this.options)}parse(D){H8(D);let F=this.options;if(D==="**")return Y0;if(D==="")return"";let Q,B=null;if(Q=D.match(QG))B=F.dot?YG:XG;else if(Q=D.match(iz))B=(F.nocase?F.dot?sz:oz:F.dot?rz:az)(Q[1]);else if(Q=D.match(JG))B=(F.nocase?F.dot?WG:CG:F.dot?zG:GG)(Q);else if(Q=D.match(tz))B=F.dot?DG:ez;else if(Q=D.match(FG))B=BG;let Y=X0.fromGlob(D,this.options).toMMPattern();if(B&&typeof Y==="object")Reflect.defineProperty(Y,"test",{value:B});return Y}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let D=this.set;if(!D.length)return this.regexp=!1,this.regexp;let F=this.options,Q=F.noglobstar?KG:F.dot?UG:EG,B=new Set(F.nocase?["i"]:[]),Y=D.map((C)=>{let W=C.map((z)=>{if(z instanceof RegExp)for(let G of z.flags.split(""))B.add(G);return typeof z==="string"?MG(z):z===Y0?Y0:z._src});return W.forEach((z,G)=>{let q=W[G+1],A=W[G-1];if(z!==Y0||A===Y0)return;if(A===void 0)if(q!==void 0&&q!==Y0)W[G+1]="(?:\\/|"+Q+"\\/)?"+q;else W[G]=Q;else if(q===void 0)W[G-1]=A+"(?:\\/|"+Q+")?";else if(q!==Y0)W[G-1]=A+"(?:\\/|\\/"+Q+"\\/)"+q,W[G+1]=Y0}),W.filter((z)=>z!==Y0).join("/")}).join("|"),[J,X]=D.length>1?["(?:",")"]:["",""];if(Y="^"+J+Y+X+"$",this.negate)Y="^(?!"+Y+").+$";try{this.regexp=new RegExp(Y,[...B].join(""))}catch(C){this.regexp=!1}return this.regexp}slashSplit(D){if(this.preserveMultipleSlashes)return D.split("/");else if(this.isWindows&&/^\/\/[^\/]+/.test(D))return["",...D.split(/\/+/)];else return D.split(/\/+/)}match(D,F=this.partial){if(this.debug("match",D,this.pattern),this.comment)return!1;if(this.empty)return D==="";if(D==="/"&&F)return!0;let Q=this.options;if(this.isWindows)D=D.split("\\").join("/");let B=this.slashSplit(D);this.debug(this.pattern,"split",B);let Y=this.set;this.debug(this.pattern,"set",Y);let J=B[B.length-1];if(!J)for(let X=B.length-2;!J&&X>=0;X--)J=B[X];for(let X=0;X<Y.length;X++){let C=Y[X],W=B;if(Q.matchBase&&C.length===1)W=[J];if(this.matchOne(W,C,F)){if(Q.flipNegate)return!0;return!this.negate}}if(Q.flipNegate)return!1;return this.negate}static defaults(D){return Z0.defaults(D).Minimatch}}Z0.AST=X0;Z0.Minimatch=m0;Z0.escape=A2;Z0.unescape=DF;import{fileURLToPath as eG}from"node:url";var NG=typeof performance==="object"&&performance&&typeof performance.now==="function"?performance:Date,GB=new Set,h7=typeof process==="object"&&!!process?process:{},qB=(D,F,Q,B)=>{typeof h7.emitWarning==="function"?h7.emitWarning(D,F,Q,B):console.error(`[${Q}] ${F}: ${D}`)},P6=globalThis.AbortController,zB=globalThis.AbortSignal;if(typeof P6==="undefined"){zB=class Q{onabort;_onabort=[];reason;aborted=!1;addEventListener(B,Y){this._onabort.push(Y)}},P6=class Q{constructor(){F()}signal=new zB;abort(B){if(this.signal.aborted)return;this.signal.reason=B,this.signal.aborted=!0;for(let Y of this.signal._onabort)Y(B);this.signal.onabort?.(B)}};let D=h7.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",F=()=>{if(!D)return;D=!1,qB("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",F)}}var jG=(D)=>!GB.has(D),$L=Symbol("type"),vF=(D)=>D&&D===Math.floor(D)&&D>0&&isFinite(D),HB=(D)=>!vF(D)?null:D<=Math.pow(2,8)?Uint8Array:D<=Math.pow(2,16)?Uint16Array:D<=Math.pow(2,32)?Uint32Array:D<=Number.MAX_SAFE_INTEGER?U8:null;class U8 extends Array{constructor(D){super(D);this.fill(0)}}class Z2{heap;length;static#D=!1;static create(D){let F=HB(D);if(!F)return[];Z2.#D=!0;let Q=new Z2(D,F);return Z2.#D=!1,Q}constructor(D,F){if(!Z2.#D)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new F(D),this.length=0}push(D){this.heap[this.length++]=D}pop(){return this.heap[--this.length]}}class E8{#D;#F;#Y;#X;#J;#M;#V;#G;get perf(){return this.#G}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#C;#H;#q;#W;#B;#U;#N;#L;#E;#T;#A;#R;#I;#Z;#j;#w;#K;#Q;static unsafeExposeInternals(D){return{starts:D.#I,ttls:D.#Z,sizes:D.#R,keyMap:D.#q,keyList:D.#W,valList:D.#B,next:D.#U,prev:D.#N,get head(){return D.#L},get tail(){return D.#E},free:D.#T,isBackgroundFetch:(F)=>D.#z(F),backgroundFetch:(F,Q,B,Y)=>D.#d(F,Q,B,Y),moveToTail:(F)=>D.#f(F),indexes:(F)=>D.#S(F),rindexes:(F)=>D.#b(F),isStale:(F)=>D.#O(F)}}get max(){return this.#D}get maxSize(){return this.#F}get calculatedSize(){return this.#H}get size(){return this.#C}get fetchMethod(){return this.#M}get memoMethod(){return this.#V}get dispose(){return this.#Y}get onInsert(){return this.#X}get disposeAfter(){return this.#J}constructor(D){let{max:F=0,ttl:Q,ttlResolution:B=1,ttlAutopurge:Y,updateAgeOnGet:J,updateAgeOnHas:X,allowStale:C,dispose:W,onInsert:z,disposeAfter:G,noDisposeOnSet:q,noUpdateTTL:A,maxSize:U=0,maxEntrySize:Z=0,sizeCalculation:H,fetchMethod:V,memoMethod:j,noDeleteOnFetchRejection:L,noDeleteOnStaleGet:R,allowStaleOnFetchRejection:k,allowStaleOnFetchAbort:b,ignoreFetchAbort:I,perf:u}=D;if(u!==void 0){if(typeof u?.now!=="function")throw new TypeError("perf option must have a now() method if specified")}if(this.#G=u??NG,F!==0&&!vF(F))throw new TypeError("max option must be a nonnegative integer");let f=F?HB(F):Array;if(!f)throw new Error("invalid max value: "+F);if(this.#D=F,this.#F=U,this.maxEntrySize=Z||this.#F,this.sizeCalculation=H,this.sizeCalculation){if(!this.#F&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!=="function")throw new TypeError("sizeCalculation set to non-function")}if(j!==void 0&&typeof j!=="function")throw new TypeError("memoMethod must be a function if defined");if(this.#V=j,V!==void 0&&typeof V!=="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#M=V,this.#w=!!V,this.#q=new Map,this.#W=new Array(F).fill(void 0),this.#B=new Array(F).fill(void 0),this.#U=new f(F),this.#N=new f(F),this.#L=0,this.#E=0,this.#T=Z2.create(F),this.#C=0,this.#H=0,typeof W==="function")this.#Y=W;if(typeof z==="function")this.#X=z;if(typeof G==="function")this.#J=G,this.#A=[];else this.#J=void 0,this.#A=void 0;if(this.#j=!!this.#Y,this.#Q=!!this.#X,this.#K=!!this.#J,this.noDisposeOnSet=!!q,this.noUpdateTTL=!!A,this.noDeleteOnFetchRejection=!!L,this.allowStaleOnFetchRejection=!!k,this.allowStaleOnFetchAbort=!!b,this.ignoreFetchAbort=!!I,this.maxEntrySize!==0){if(this.#F!==0){if(!vF(this.#F))throw new TypeError("maxSize must be a positive integer if specified")}if(!vF(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#g()}if(this.allowStale=!!C,this.noDeleteOnStaleGet=!!R,this.updateAgeOnGet=!!J,this.updateAgeOnHas=!!X,this.ttlResolution=vF(B)||B===0?B:1,this.ttlAutopurge=!!Y,this.ttl=Q||0,this.ttl){if(!vF(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#v()}if(this.#D===0&&this.ttl===0&&this.#F===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#D&&!this.#F){if(jG("LRU_CACHE_UNBOUNDED"))GB.add("LRU_CACHE_UNBOUNDED"),qB("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning","LRU_CACHE_UNBOUNDED",E8)}}getRemainingTTL(D){return this.#q.has(D)?1/0:0}#v(){let D=new U8(this.#D),F=new U8(this.#D);this.#Z=D,this.#I=F,this.#m=(Y,J,X=this.#G.now())=>{if(F[Y]=J!==0?X:0,D[Y]=J,J!==0&&this.ttlAutopurge){let C=setTimeout(()=>{if(this.#O(Y))this.#k(this.#W[Y],"expire")},J+1);if(C.unref)C.unref()}},this.#P=(Y)=>{F[Y]=D[Y]!==0?this.#G.now():0},this.#_=(Y,J)=>{if(D[J]){let X=D[J],C=F[J];if(!X||!C)return;Y.ttl=X,Y.start=C,Y.now=Q||B();let W=Y.now-C;Y.remainingTTL=X-W}};let Q=0,B=()=>{let Y=this.#G.now();if(this.ttlResolution>0){Q=Y;let J=setTimeout(()=>Q=0,this.ttlResolution);if(J.unref)J.unref()}return Y};this.getRemainingTTL=(Y)=>{let J=this.#q.get(Y);if(J===void 0)return 0;let X=D[J],C=F[J];if(!X||!C)return 1/0;let W=(Q||B())-C;return X-W},this.#O=(Y)=>{let J=F[Y],X=D[Y];return!!X&&!!J&&(Q||B())-J>X}}#P=()=>{};#_=()=>{};#m=()=>{};#O=()=>!1;#g(){let D=new U8(this.#D);this.#H=0,this.#R=D,this.#x=(F)=>{this.#H-=D[F],D[F]=0},this.#u=(F,Q,B,Y)=>{if(this.#z(Q))return 0;if(!vF(B))if(Y){if(typeof Y!=="function")throw new TypeError("sizeCalculation must be a function");if(B=Y(Q,F),!vF(B))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return B},this.#$=(F,Q,B)=>{if(D[F]=Q,this.#F){let Y=this.#F-D[F];while(this.#H>Y)this.#y(!0)}if(this.#H+=D[F],B)B.entrySize=Q,B.totalCalculatedSize=this.#H}}#x=(D)=>{};#$=(D,F,Q)=>{};#u=(D,F,Q,B)=>{if(Q||B)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#S({allowStale:D=this.allowStale}={}){if(this.#C)for(let F=this.#E;;){if(!this.#l(F))break;if(D||!this.#O(F))yield F;if(F===this.#L)break;else F=this.#N[F]}}*#b({allowStale:D=this.allowStale}={}){if(this.#C)for(let F=this.#L;;){if(!this.#l(F))break;if(D||!this.#O(F))yield F;if(F===this.#E)break;else F=this.#U[F]}}#l(D){return D!==void 0&&this.#q.get(this.#W[D])===D}*entries(){for(let D of this.#S())if(this.#B[D]!==void 0&&this.#W[D]!==void 0&&!this.#z(this.#B[D]))yield[this.#W[D],this.#B[D]]}*rentries(){for(let D of this.#b())if(this.#B[D]!==void 0&&this.#W[D]!==void 0&&!this.#z(this.#B[D]))yield[this.#W[D],this.#B[D]]}*keys(){for(let D of this.#S()){let F=this.#W[D];if(F!==void 0&&!this.#z(this.#B[D]))yield F}}*rkeys(){for(let D of this.#b()){let F=this.#W[D];if(F!==void 0&&!this.#z(this.#B[D]))yield F}}*values(){for(let D of this.#S())if(this.#B[D]!==void 0&&!this.#z(this.#B[D]))yield this.#B[D]}*rvalues(){for(let D of this.#b())if(this.#B[D]!==void 0&&!this.#z(this.#B[D]))yield this.#B[D]}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(D,F={}){for(let Q of this.#S()){let B=this.#B[Q],Y=this.#z(B)?B.__staleWhileFetching:B;if(Y===void 0)continue;if(D(Y,this.#W[Q],this))return this.get(this.#W[Q],F)}}forEach(D,F=this){for(let Q of this.#S()){let B=this.#B[Q],Y=this.#z(B)?B.__staleWhileFetching:B;if(Y===void 0)continue;D.call(F,Y,this.#W[Q],this)}}rforEach(D,F=this){for(let Q of this.#b()){let B=this.#B[Q],Y=this.#z(B)?B.__staleWhileFetching:B;if(Y===void 0)continue;D.call(F,Y,this.#W[Q],this)}}purgeStale(){let D=!1;for(let F of this.#b({allowStale:!0}))if(this.#O(F))this.#k(this.#W[F],"expire"),D=!0;return D}info(D){let F=this.#q.get(D);if(F===void 0)return;let Q=this.#B[F],B=this.#z(Q)?Q.__staleWhileFetching:Q;if(B===void 0)return;let Y={value:B};if(this.#Z&&this.#I){let J=this.#Z[F],X=this.#I[F];if(J&&X){let C=J-(this.#G.now()-X);Y.ttl=C,Y.start=Date.now()}}if(this.#R)Y.size=this.#R[F];return Y}dump(){let D=[];for(let F of this.#S({allowStale:!0})){let Q=this.#W[F],B=this.#B[F],Y=this.#z(B)?B.__staleWhileFetching:B;if(Y===void 0||Q===void 0)continue;let J={value:Y};if(this.#Z&&this.#I){J.ttl=this.#Z[F];let X=this.#G.now()-this.#I[F];J.start=Math.floor(Date.now()-X)}if(this.#R)J.size=this.#R[F];D.unshift([Q,J])}return D}load(D){this.clear();for(let[F,Q]of D){if(Q.start){let B=Date.now()-Q.start;Q.start=this.#G.now()-B}this.set(F,Q.value,Q)}}set(D,F,Q={}){if(F===void 0)return this.delete(D),this;let{ttl:B=this.ttl,start:Y,noDisposeOnSet:J=this.noDisposeOnSet,sizeCalculation:X=this.sizeCalculation,status:C}=Q,{noUpdateTTL:W=this.noUpdateTTL}=Q,z=this.#u(D,F,Q.size||0,X);if(this.maxEntrySize&&z>this.maxEntrySize){if(C)C.set="miss",C.maxEntrySizeExceeded=!0;return this.#k(D,"set"),this}let G=this.#C===0?void 0:this.#q.get(D);if(G===void 0){if(G=this.#C===0?this.#E:this.#T.length!==0?this.#T.pop():this.#C===this.#D?this.#y(!1):this.#C,this.#W[G]=D,this.#B[G]=F,this.#q.set(D,G),this.#U[this.#E]=G,this.#N[G]=this.#E,this.#E=G,this.#C++,this.#$(G,z,C),C)C.set="add";if(W=!1,this.#Q)this.#X?.(F,D,"add")}else{this.#f(G);let q=this.#B[G];if(F!==q){if(this.#w&&this.#z(q)){q.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:A}=q;if(A!==void 0&&!J){if(this.#j)this.#Y?.(A,D,"set");if(this.#K)this.#A?.push([A,D,"set"])}}else if(!J){if(this.#j)this.#Y?.(q,D,"set");if(this.#K)this.#A?.push([q,D,"set"])}if(this.#x(G),this.#$(G,z,C),this.#B[G]=F,C){C.set="replace";let A=q&&this.#z(q)?q.__staleWhileFetching:q;if(A!==void 0)C.oldValue=A}}else if(C)C.set="update";if(this.#Q)this.onInsert?.(F,D,F===q?"update":"replace")}if(B!==0&&!this.#Z)this.#v();if(this.#Z){if(!W)this.#m(G,B,Y);if(C)this.#_(C,G)}if(!J&&this.#K&&this.#A){let q=this.#A,A;while(A=q?.shift())this.#J?.(...A)}return this}pop(){try{while(this.#C){let D=this.#B[this.#L];if(this.#y(!0),this.#z(D)){if(D.__staleWhileFetching)return D.__staleWhileFetching}else if(D!==void 0)return D}}finally{if(this.#K&&this.#A){let D=this.#A,F;while(F=D?.shift())this.#J?.(...F)}}}#y(D){let F=this.#L,Q=this.#W[F],B=this.#B[F];if(this.#w&&this.#z(B))B.__abortController.abort(new Error("evicted"));else if(this.#j||this.#K){if(this.#j)this.#Y?.(B,Q,"evict");if(this.#K)this.#A?.push([B,Q,"evict"])}if(this.#x(F),D)this.#W[F]=void 0,this.#B[F]=void 0,this.#T.push(F);if(this.#C===1)this.#L=this.#E=0,this.#T.length=0;else this.#L=this.#U[F];return this.#q.delete(Q),this.#C--,F}has(D,F={}){let{updateAgeOnHas:Q=this.updateAgeOnHas,status:B}=F,Y=this.#q.get(D);if(Y!==void 0){let J=this.#B[Y];if(this.#z(J)&&J.__staleWhileFetching===void 0)return!1;if(!this.#O(Y)){if(Q)this.#P(Y);if(B)B.has="hit",this.#_(B,Y);return!0}else if(B)B.has="stale",this.#_(B,Y)}else if(B)B.has="miss";return!1}peek(D,F={}){let{allowStale:Q=this.allowStale}=F,B=this.#q.get(D);if(B===void 0||!Q&&this.#O(B))return;let Y=this.#B[B];return this.#z(Y)?Y.__staleWhileFetching:Y}#d(D,F,Q,B){let Y=F===void 0?void 0:this.#B[F];if(this.#z(Y))return Y;let J=new P6,{signal:X}=Q;X?.addEventListener("abort",()=>J.abort(X.reason),{signal:J.signal});let C={signal:J.signal,options:Q,context:B},W=(Z,H=!1)=>{let{aborted:V}=J.signal,j=Q.ignoreFetchAbort&&Z!==void 0;if(Q.status)if(V&&!H){if(Q.status.fetchAborted=!0,Q.status.fetchError=J.signal.reason,j)Q.status.fetchAbortIgnored=!0}else Q.status.fetchResolved=!0;if(V&&!j&&!H)return G(J.signal.reason);let L=A;if(this.#B[F]===A)if(Z===void 0)if(L.__staleWhileFetching!==void 0)this.#B[F]=L.__staleWhileFetching;else this.#k(D,"fetch");else{if(Q.status)Q.status.fetchUpdated=!0;this.set(D,Z,C.options)}return Z},z=(Z)=>{if(Q.status)Q.status.fetchRejected=!0,Q.status.fetchError=Z;return G(Z)},G=(Z)=>{let{aborted:H}=J.signal,V=H&&Q.allowStaleOnFetchAbort,j=V||Q.allowStaleOnFetchRejection,L=j||Q.noDeleteOnFetchRejection,R=A;if(this.#B[F]===A){if(!L||R.__staleWhileFetching===void 0)this.#k(D,"fetch");else if(!V)this.#B[F]=R.__staleWhileFetching}if(j){if(Q.status&&R.__staleWhileFetching!==void 0)Q.status.returnedStale=!0;return R.__staleWhileFetching}else if(R.__returned===R)throw Z},q=(Z,H)=>{let V=this.#M?.(D,Y,C);if(V&&V instanceof Promise)V.then((j)=>Z(j===void 0?void 0:j),H);J.signal.addEventListener("abort",()=>{if(!Q.ignoreFetchAbort||Q.allowStaleOnFetchAbort){if(Z(void 0),Q.allowStaleOnFetchAbort)Z=(j)=>W(j,!0)}})};if(Q.status)Q.status.fetchDispatched=!0;let A=new Promise(q).then(W,z),U=Object.assign(A,{__abortController:J,__staleWhileFetching:Y,__returned:void 0});if(F===void 0)this.set(D,U,{...C.options,status:void 0}),F=this.#q.get(D);else this.#B[F]=U;return U}#z(D){if(!this.#w)return!1;let F=D;return!!F&&F instanceof Promise&&F.hasOwnProperty("__staleWhileFetching")&&F.__abortController instanceof P6}async fetch(D,F={}){let{allowStale:Q=this.allowStale,updateAgeOnGet:B=this.updateAgeOnGet,noDeleteOnStaleGet:Y=this.noDeleteOnStaleGet,ttl:J=this.ttl,noDisposeOnSet:X=this.noDisposeOnSet,size:C=0,sizeCalculation:W=this.sizeCalculation,noUpdateTTL:z=this.noUpdateTTL,noDeleteOnFetchRejection:G=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:q=this.allowStaleOnFetchRejection,ignoreFetchAbort:A=this.ignoreFetchAbort,allowStaleOnFetchAbort:U=this.allowStaleOnFetchAbort,context:Z,forceRefresh:H=!1,status:V,signal:j}=F;if(!this.#w){if(V)V.fetch="get";return this.get(D,{allowStale:Q,updateAgeOnGet:B,noDeleteOnStaleGet:Y,status:V})}let L={allowStale:Q,updateAgeOnGet:B,noDeleteOnStaleGet:Y,ttl:J,noDisposeOnSet:X,size:C,sizeCalculation:W,noUpdateTTL:z,noDeleteOnFetchRejection:G,allowStaleOnFetchRejection:q,allowStaleOnFetchAbort:U,ignoreFetchAbort:A,status:V,signal:j},R=this.#q.get(D);if(R===void 0){if(V)V.fetch="miss";let k=this.#d(D,R,L,Z);return k.__returned=k}else{let k=this.#B[R];if(this.#z(k)){let O=Q&&k.__staleWhileFetching!==void 0;if(V){if(V.fetch="inflight",O)V.returnedStale=!0}return O?k.__staleWhileFetching:k.__returned=k}let b=this.#O(R);if(!H&&!b){if(V)V.fetch="hit";if(this.#f(R),B)this.#P(R);if(V)this.#_(V,R);return k}let I=this.#d(D,R,L,Z),f=I.__staleWhileFetching!==void 0&&Q;if(V){if(V.fetch=b?"stale":"refresh",f&&b)V.returnedStale=!0}return f?I.__staleWhileFetching:I.__returned=I}}async forceFetch(D,F={}){let Q=await this.fetch(D,F);if(Q===void 0)throw new Error("fetch() returned undefined");return Q}memo(D,F={}){let Q=this.#V;if(!Q)throw new Error("no memoMethod provided to constructor");let{context:B,forceRefresh:Y,...J}=F,X=this.get(D,J);if(!Y&&X!==void 0)return X;let C=Q(D,X,{options:J,context:B});return this.set(D,C,J),C}get(D,F={}){let{allowStale:Q=this.allowStale,updateAgeOnGet:B=this.updateAgeOnGet,noDeleteOnStaleGet:Y=this.noDeleteOnStaleGet,status:J}=F,X=this.#q.get(D);if(X!==void 0){let C=this.#B[X],W=this.#z(C);if(J)this.#_(J,X);if(this.#O(X)){if(J)J.get="stale";if(!W){if(!Y)this.#k(D,"expire");if(J&&Q)J.returnedStale=!0;return Q?C:void 0}else{if(J&&Q&&C.__staleWhileFetching!==void 0)J.returnedStale=!0;return Q?C.__staleWhileFetching:void 0}}else{if(J)J.get="hit";if(W)return C.__staleWhileFetching;if(this.#f(X),B)this.#P(X);return C}}else if(J)J.get="miss"}#c(D,F){this.#N[F]=D,this.#U[D]=F}#f(D){if(D!==this.#E){if(D===this.#L)this.#L=this.#U[D];else this.#c(this.#N[D],this.#U[D]);this.#c(this.#E,D),this.#E=D}}delete(D){return this.#k(D,"delete")}#k(D,F){let Q=!1;if(this.#C!==0){let B=this.#q.get(D);if(B!==void 0)if(Q=!0,this.#C===1)this.#h(F);else{this.#x(B);let Y=this.#B[B];if(this.#z(Y))Y.__abortController.abort(new Error("deleted"));else if(this.#j||this.#K){if(this.#j)this.#Y?.(Y,D,F);if(this.#K)this.#A?.push([Y,D,F])}if(this.#q.delete(D),this.#W[B]=void 0,this.#B[B]=void 0,B===this.#E)this.#E=this.#N[B];else if(B===this.#L)this.#L=this.#U[B];else{let J=this.#N[B];this.#U[J]=this.#U[B];let X=this.#U[B];this.#N[X]=this.#N[B]}this.#C--,this.#T.push(B)}}if(this.#K&&this.#A?.length){let B=this.#A,Y;while(Y=B?.shift())this.#J?.(...Y)}return Q}clear(){return this.#h("delete")}#h(D){for(let F of this.#b({allowStale:!0})){let Q=this.#B[F];if(this.#z(Q))Q.__abortController.abort(new Error("deleted"));else{let B=this.#W[F];if(this.#j)this.#Y?.(Q,B,D);if(this.#K)this.#A?.push([Q,B,D])}}if(this.#q.clear(),this.#B.fill(void 0),this.#W.fill(void 0),this.#Z&&this.#I)this.#Z.fill(0),this.#I.fill(0);if(this.#R)this.#R.fill(0);if(this.#L=0,this.#E=0,this.#T.length=0,this.#H=0,this.#C=0,this.#K&&this.#A){let F=this.#A,Q;while(Q=F?.shift())this.#J?.(...Q)}}}import{posix as vG,win32 as o7}from"node:path";import{fileURLToPath as xG}from"node:url";import{lstatSync as uG,readdir as yG,readdirSync as fG,readlinkSync as gG,realpathSync as $G}from"fs";import*as hG from"node:fs";import{lstat as lG,readdir as dG,readlink as cG,realpath as pG}from"node:fs/promises";import{EventEmitter as n7}from"node:events";import ZB from"node:stream";import{StringDecoder as RG}from"node:string_decoder";var KB=typeof process==="object"&&process?process:{stdout:null,stderr:null},_G=(D)=>!!D&&typeof D==="object"&&(D instanceof aF||D instanceof ZB||OG(D)||IG(D)),OG=(D)=>!!D&&typeof D==="object"&&D instanceof n7&&typeof D.pipe==="function"&&D.pipe!==ZB.Writable.prototype.pipe,IG=(D)=>!!D&&typeof D==="object"&&D instanceof n7&&typeof D.write==="function"&&typeof D.end==="function",jF=Symbol("EOF"),RF=Symbol("maybeEmitEnd"),xF=Symbol("emittedEnd"),S6=Symbol("emittingEnd"),A8=Symbol("emittedError"),k6=Symbol("closed"),UB=Symbol("read"),b6=Symbol("flush"),EB=Symbol("flushChunk"),FF=Symbol("encoding"),V2=Symbol("decoder"),D0=Symbol("flowing"),Z8=Symbol("paused"),L2=Symbol("resume"),F0=Symbol("buffer"),V0=Symbol("pipes"),B0=Symbol("bufferLength"),m7=Symbol("bufferPush"),v6=Symbol("bufferShift"),z0=Symbol("objectMode"),iD=Symbol("destroyed"),l7=Symbol("error"),d7=Symbol("emitData"),AB=Symbol("emitEnd"),c7=Symbol("emitEnd2"),qF=Symbol("async"),p7=Symbol("abort"),x6=Symbol("aborted"),V8=Symbol("signal"),iF=Symbol("dataListeners"),k0=Symbol("discarded"),L8=(D)=>Promise.resolve().then(D),wG=(D)=>D(),TG=(D)=>D==="end"||D==="finish"||D==="prefinish",PG=(D)=>D instanceof ArrayBuffer||!!D&&typeof D==="object"&&D.constructor&&D.constructor.name==="ArrayBuffer"&&D.byteLength>=0,SG=(D)=>!Buffer.isBuffer(D)&&ArrayBuffer.isView(D);class i7{src;dest;opts;ondrain;constructor(D,F,Q){this.src=D,this.dest=F,this.opts=Q,this.ondrain=()=>D[L2](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(D){}end(){if(this.unpipe(),this.opts.end)this.dest.end()}}class VB extends i7{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(D,F,Q){super(D,F,Q);this.proxyErrors=(B)=>F.emit("error",B),D.on("error",this.proxyErrors)}}var kG=(D)=>!!D.objectMode,bG=(D)=>!D.objectMode&&!!D.encoding&&D.encoding!=="buffer";class aF extends n7{[D0]=!1;[Z8]=!1;[V0]=[];[F0]=[];[z0];[FF];[qF];[V2];[jF]=!1;[xF]=!1;[S6]=!1;[k6]=!1;[A8]=null;[B0]=0;[iD]=!1;[V8];[x6]=!1;[iF]=0;[k0]=!1;writable=!0;readable=!0;constructor(...D){let F=D[0]||{};super();if(F.objectMode&&typeof F.encoding==="string")throw new TypeError("Encoding and objectMode may not be used together");if(kG(F))this[z0]=!0,this[FF]=null;else if(bG(F))this[FF]=F.encoding,this[z0]=!1;else this[z0]=!1,this[FF]=null;if(this[qF]=!!F.async,this[V2]=this[FF]?new RG(this[FF]):null,F&&F.debugExposeBuffer===!0)Object.defineProperty(this,"buffer",{get:()=>this[F0]});if(F&&F.debugExposePipes===!0)Object.defineProperty(this,"pipes",{get:()=>this[V0]});let{signal:Q}=F;if(Q)if(this[V8]=Q,Q.aborted)this[p7]();else Q.addEventListener("abort",()=>this[p7]())}get bufferLength(){return this[B0]}get encoding(){return this[FF]}set encoding(D){throw new Error("Encoding must be set at instantiation time")}setEncoding(D){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[z0]}set objectMode(D){throw new Error("objectMode must be set at instantiation time")}get["async"](){return this[qF]}set["async"](D){this[qF]=this[qF]||!!D}[p7](){this[x6]=!0,this.emit("abort",this[V8]?.reason),this.destroy(this[V8]?.reason)}get aborted(){return this[x6]}set aborted(D){}write(D,F,Q){if(this[x6])return!1;if(this[jF])throw new Error("write after end");if(this[iD])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;if(typeof F==="function")Q=F,F="utf8";if(!F)F="utf8";let B=this[qF]?L8:wG;if(!this[z0]&&!Buffer.isBuffer(D)){if(SG(D))D=Buffer.from(D.buffer,D.byteOffset,D.byteLength);else if(PG(D))D=Buffer.from(D);else if(typeof D!=="string")throw new Error("Non-contiguous data written to non-objectMode stream")}if(this[z0]){if(this[D0]&&this[B0]!==0)this[b6](!0);if(this[D0])this.emit("data",D);else this[m7](D);if(this[B0]!==0)this.emit("readable");if(Q)B(Q);return this[D0]}if(!D.length){if(this[B0]!==0)this.emit("readable");if(Q)B(Q);return this[D0]}if(typeof D==="string"&&!(F===this[FF]&&!this[V2]?.lastNeed))D=Buffer.from(D,F);if(Buffer.isBuffer(D)&&this[FF])D=this[V2].write(D);if(this[D0]&&this[B0]!==0)this[b6](!0);if(this[D0])this.emit("data",D);else this[m7](D);if(this[B0]!==0)this.emit("readable");if(Q)B(Q);return this[D0]}read(D){if(this[iD])return null;if(this[k0]=!1,this[B0]===0||D===0||D&&D>this[B0])return this[RF](),null;if(this[z0])D=null;if(this[F0].length>1&&!this[z0])this[F0]=[this[FF]?this[F0].join(""):Buffer.concat(this[F0],this[B0])];let F=this[UB](D||null,this[F0][0]);return this[RF](),F}[UB](D,F){if(this[z0])this[v6]();else{let Q=F;if(D===Q.length||D===null)this[v6]();else if(typeof Q==="string")this[F0][0]=Q.slice(D),F=Q.slice(0,D),this[B0]-=D;else this[F0][0]=Q.subarray(D),F=Q.subarray(0,D),this[B0]-=D}if(this.emit("data",F),!this[F0].length&&!this[jF])this.emit("drain");return F}end(D,F,Q){if(typeof D==="function")Q=D,D=void 0;if(typeof F==="function")Q=F,F="utf8";if(D!==void 0)this.write(D,F);if(Q)this.once("end",Q);if(this[jF]=!0,this.writable=!1,this[D0]||!this[Z8])this[RF]();return this}[L2](){if(this[iD])return;if(!this[iF]&&!this[V0].length)this[k0]=!0;if(this[Z8]=!1,this[D0]=!0,this.emit("resume"),this[F0].length)this[b6]();else if(this[jF])this[RF]();else this.emit("drain")}resume(){return this[L2]()}pause(){this[D0]=!1,this[Z8]=!0,this[k0]=!1}get destroyed(){return this[iD]}get flowing(){return this[D0]}get paused(){return this[Z8]}[m7](D){if(this[z0])this[B0]+=1;else this[B0]+=D.length;this[F0].push(D)}[v6](){if(this[z0])this[B0]-=1;else this[B0]-=this[F0][0].length;return this[F0].shift()}[b6](D=!1){do;while(this[EB](this[v6]())&&this[F0].length);if(!D&&!this[F0].length&&!this[jF])this.emit("drain")}[EB](D){return this.emit("data",D),this[D0]}pipe(D,F){if(this[iD])return D;this[k0]=!1;let Q=this[xF];if(F=F||{},D===KB.stdout||D===KB.stderr)F.end=!1;else F.end=F.end!==!1;if(F.proxyErrors=!!F.proxyErrors,Q){if(F.end)D.end()}else if(this[V0].push(!F.proxyErrors?new i7(this,D,F):new VB(this,D,F)),this[qF])L8(()=>this[L2]());else this[L2]();return D}unpipe(D){let F=this[V0].find((Q)=>Q.dest===D);if(F){if(this[V0].length===1){if(this[D0]&&this[iF]===0)this[D0]=!1;this[V0]=[]}else this[V0].splice(this[V0].indexOf(F),1);F.unpipe()}}addListener(D,F){return this.on(D,F)}on(D,F){let Q=super.on(D,F);if(D==="data"){if(this[k0]=!1,this[iF]++,!this[V0].length&&!this[D0])this[L2]()}else if(D==="readable"&&this[B0]!==0)super.emit("readable");else if(TG(D)&&this[xF])super.emit(D),this.removeAllListeners(D);else if(D==="error"&&this[A8]){let B=F;if(this[qF])L8(()=>B.call(this,this[A8]));else B.call(this,this[A8])}return Q}removeListener(D,F){return this.off(D,F)}off(D,F){let Q=super.off(D,F);if(D==="data"){if(this[iF]=this.listeners("data").length,this[iF]===0&&!this[k0]&&!this[V0].length)this[D0]=!1}return Q}removeAllListeners(D){let F=super.removeAllListeners(D);if(D==="data"||D===void 0){if(this[iF]=0,!this[k0]&&!this[V0].length)this[D0]=!1}return F}get emittedEnd(){return this[xF]}[RF](){if(!this[S6]&&!this[xF]&&!this[iD]&&this[F0].length===0&&this[jF]){if(this[S6]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[k6])this.emit("close");this[S6]=!1}}emit(D,...F){let Q=F[0];if(D!=="error"&&D!=="close"&&D!==iD&&this[iD])return!1;else if(D==="data")return!this[z0]&&!Q?!1:this[qF]?(L8(()=>this[d7](Q)),!0):this[d7](Q);else if(D==="end")return this[AB]();else if(D==="close"){if(this[k6]=!0,!this[xF]&&!this[iD])return!1;let Y=super.emit("close");return this.removeAllListeners("close"),Y}else if(D==="error"){this[A8]=Q,super.emit(l7,Q);let Y=!this[V8]||this.listeners("error").length?super.emit("error",Q):!1;return this[RF](),Y}else if(D==="resume"){let Y=super.emit("resume");return this[RF](),Y}else if(D==="finish"||D==="prefinish"){let Y=super.emit(D);return this.removeAllListeners(D),Y}let B=super.emit(D,...F);return this[RF](),B}[d7](D){for(let Q of this[V0])if(Q.dest.write(D)===!1)this.pause();let F=this[k0]?!1:super.emit("data",D);return this[RF](),F}[AB](){if(this[xF])return!1;return this[xF]=!0,this.readable=!1,this[qF]?(L8(()=>this[c7]()),!0):this[c7]()}[c7](){if(this[V2]){let F=this[V2].end();if(F){for(let Q of this[V0])Q.dest.write(F);if(!this[k0])super.emit("data",F)}}for(let F of this[V0])F.end();let D=super.emit("end");return this.removeAllListeners("end"),D}async collect(){let D=Object.assign([],{dataLength:0});if(!this[z0])D.dataLength=0;let F=this.promise();return this.on("data",(Q)=>{if(D.push(Q),!this[z0])D.dataLength+=Q.length}),await F,D}async concat(){if(this[z0])throw new Error("cannot concat in objectMode");let D=await this.collect();return this[FF]?D.join(""):Buffer.concat(D,D.dataLength)}async promise(){return new Promise((D,F)=>{this.on(iD,()=>F(new Error("stream destroyed"))),this.on("error",(Q)=>F(Q)),this.on("end",()=>D())})}[Symbol.asyncIterator](){this[k0]=!1;let D=!1,F=async()=>{return this.pause(),D=!0,{value:void 0,done:!0}};return{next:()=>{if(D)return F();let B=this.read();if(B!==null)return Promise.resolve({done:!1,value:B});if(this[jF])return F();let Y,J,X=(G)=>{this.off("data",C),this.off("end",W),this.off(iD,z),F(),J(G)},C=(G)=>{this.off("error",X),this.off("end",W),this.off(iD,z),this.pause(),Y({value:G,done:!!this[jF]})},W=()=>{this.off("error",X),this.off("data",C),this.off(iD,z),F(),Y({done:!0,value:void 0})},z=()=>X(new Error("stream destroyed"));return new Promise((G,q)=>{J=q,Y=G,this.once(iD,z),this.once("error",X),this.once("end",W),this.once("data",C)})},throw:F,return:F,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[k0]=!1;let D=!1,F=()=>{return this.pause(),this.off(l7,F),this.off(iD,F),this.off("end",F),D=!0,{done:!0,value:void 0}},Q=()=>{if(D)return F();let B=this.read();return B===null?F():{done:!1,value:B}};return this.once("end",F),this.once(l7,F),this.once(iD,F),{next:Q,throw:F,return:F,[Symbol.iterator](){return this}}}destroy(D){if(this[iD]){if(D)this.emit("error",D);else this.emit(iD);return this}this[iD]=!0,this[k0]=!0,this[F0].length=0,this[B0]=0;let F=this;if(typeof F.close==="function"&&!this[k6])F.close();if(D)this.emit("error",D);else this.emit(iD);return this}static get isStream(){return _G}}var mG=$G.native,N8={lstatSync:uG,readdir:yG,readdirSync:fG,readlinkSync:gG,realpathSync:mG,promises:{lstat:lG,readdir:dG,readlink:cG,realpath:pG}},RB=(D)=>!D||D===N8||D===hG?N8:{...N8,...D,promises:{...N8.promises,...D.promises||{}}},_B=/^\\\\\?\\([a-z]:)\\?$/i,nG=(D)=>D.replace(/\//g,"\\").replace(_B,"$1\\"),iG=/[\\\/]/,d0=0,OB=1,IB=2,HF=4,wB=6,TB=8,rF=10,PB=12,l0=15,M8=~l0,a7=16,LB=32,j8=64,BF=128,u6=256,f6=512,MB=j8|BF|f6,aG=1023,r7=(D)=>D.isFile()?TB:D.isDirectory()?HF:D.isSymbolicLink()?rF:D.isCharacterDevice()?IB:D.isBlockDevice()?wB:D.isSocket()?PB:D.isFIFO()?OB:d0,NB=new Map,R8=(D)=>{let F=NB.get(D);if(F)return F;let Q=D.normalize("NFKD");return NB.set(D,Q),Q},jB=new Map,y6=(D)=>{let F=jB.get(D);if(F)return F;let Q=R8(D.toLowerCase());return jB.set(D,Q),Q};class s7 extends E8{constructor(){super({max:256})}}class SB extends E8{constructor(D=16384){super({maxSize:D,sizeCalculation:(F)=>F.length+1})}}var kB=Symbol("PathScurry setAsCwd");class L0{name;root;roots;parent;nocase;isCWD=!1;#D;#F;get dev(){return this.#F}#Y;get mode(){return this.#Y}#X;get nlink(){return this.#X}#J;get uid(){return this.#J}#M;get gid(){return this.#M}#V;get rdev(){return this.#V}#G;get blksize(){return this.#G}#C;get ino(){return this.#C}#H;get size(){return this.#H}#q;get blocks(){return this.#q}#W;get atimeMs(){return this.#W}#B;get mtimeMs(){return this.#B}#U;get ctimeMs(){return this.#U}#N;get birthtimeMs(){return this.#N}#L;get atime(){return this.#L}#E;get mtime(){return this.#E}#T;get ctime(){return this.#T}#A;get birthtime(){return this.#A}#R;#I;#Z;#j;#w;#K;#Q;#v;#P;#_;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(D,F=d0,Q,B,Y,J,X){if(this.name=D,this.#R=Y?y6(D):R8(D),this.#Q=F&aG,this.nocase=Y,this.roots=B,this.root=Q||this,this.#v=J,this.#Z=X.fullpath,this.#w=X.relative,this.#K=X.relativePosix,this.parent=X.parent,this.parent)this.#D=this.parent.#D;else this.#D=RB(X.fs)}depth(){if(this.#I!==void 0)return this.#I;if(!this.parent)return this.#I=0;return this.#I=this.parent.depth()+1}childrenCache(){return this.#v}resolve(D){if(!D)return this;let F=this.getRootString(D),B=D.substring(F.length).split(this.splitSep);return F?this.getRoot(F).#m(B):this.#m(B)}#m(D){let F=this;for(let Q of D)F=F.child(Q);return F}children(){let D=this.#v.get(this);if(D)return D;let F=Object.assign([],{provisional:0});return this.#v.set(this,F),this.#Q&=~a7,F}child(D,F){if(D===""||D===".")return this;if(D==="..")return this.parent||this;let Q=this.children(),B=this.nocase?y6(D):R8(D);for(let C of Q)if(C.#R===B)return C;let Y=this.parent?this.sep:"",J=this.#Z?this.#Z+Y+D:void 0,X=this.newChild(D,d0,{...F,parent:this,fullpath:J});if(!this.canReaddir())X.#Q|=BF;return Q.push(X),X}relative(){if(this.isCWD)return"";if(this.#w!==void 0)return this.#w;let D=this.name,F=this.parent;if(!F)return this.#w=this.name;let Q=F.relative();return Q+(!Q||!F.parent?"":this.sep)+D}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#K!==void 0)return this.#K;let D=this.name,F=this.parent;if(!F)return this.#K=this.fullpathPosix();let Q=F.relativePosix();return Q+(!Q||!F.parent?"":"/")+D}fullpath(){if(this.#Z!==void 0)return this.#Z;let D=this.name,F=this.parent;if(!F)return this.#Z=this.name;let B=F.fullpath()+(!F.parent?"":this.sep)+D;return this.#Z=B}fullpathPosix(){if(this.#j!==void 0)return this.#j;if(this.sep==="/")return this.#j=this.fullpath();if(!this.parent){let B=this.fullpath().replace(/\\/g,"/");if(/^[a-z]:\//i.test(B))return this.#j=`//?/${B}`;else return this.#j=B}let D=this.parent,F=D.fullpathPosix(),Q=F+(!F||!D.parent?"":"/")+this.name;return this.#j=Q}isUnknown(){return(this.#Q&l0)===d0}isType(D){return this[`is${D}`]()}getType(){return this.isUnknown()?"Unknown":this.isDirectory()?"Directory":this.isFile()?"File":this.isSymbolicLink()?"SymbolicLink":this.isFIFO()?"FIFO":this.isCharacterDevice()?"CharacterDevice":this.isBlockDevice()?"BlockDevice":this.isSocket()?"Socket":"Unknown"}isFile(){return(this.#Q&l0)===TB}isDirectory(){return(this.#Q&l0)===HF}isCharacterDevice(){return(this.#Q&l0)===IB}isBlockDevice(){return(this.#Q&l0)===wB}isFIFO(){return(this.#Q&l0)===OB}isSocket(){return(this.#Q&l0)===PB}isSymbolicLink(){return(this.#Q&rF)===rF}lstatCached(){return this.#Q&LB?this:void 0}readlinkCached(){return this.#P}realpathCached(){return this.#_}readdirCached(){let D=this.children();return D.slice(0,D.provisional)}canReadlink(){if(this.#P)return!0;if(!this.parent)return!1;let D=this.#Q&l0;return!(D!==d0&&D!==rF||this.#Q&u6||this.#Q&BF)}calledReaddir(){return!!(this.#Q&a7)}isENOENT(){return!!(this.#Q&BF)}isNamed(D){return!this.nocase?this.#R===R8(D):this.#R===y6(D)}async readlink(){let D=this.#P;if(D)return D;if(!this.canReadlink())return;if(!this.parent)return;try{let F=await this.#D.promises.readlink(this.fullpath()),Q=(await this.parent.realpath())?.resolve(F);if(Q)return this.#P=Q}catch(F){this.#l(F.code);return}}readlinkSync(){let D=this.#P;if(D)return D;if(!this.canReadlink())return;if(!this.parent)return;try{let F=this.#D.readlinkSync(this.fullpath()),Q=this.parent.realpathSync()?.resolve(F);if(Q)return this.#P=Q}catch(F){this.#l(F.code);return}}#O(D){this.#Q|=a7;for(let F=D.provisional;F<D.length;F++){let Q=D[F];if(Q)Q.#g()}}#g(){if(this.#Q&BF)return;this.#Q=(this.#Q|BF)&M8,this.#x()}#x(){let D=this.children();D.provisional=0;for(let F of D)F.#g()}#$(){this.#Q|=f6,this.#u()}#u(){if(this.#Q&j8)return;let D=this.#Q;if((D&l0)===HF)D&=M8;this.#Q=D|j8,this.#x()}#S(D=""){if(D==="ENOTDIR"||D==="EPERM")this.#u();else if(D==="ENOENT")this.#g();else this.children().provisional=0}#b(D=""){if(D==="ENOTDIR")this.parent.#u();else if(D==="ENOENT")this.#g()}#l(D=""){let F=this.#Q;if(F|=u6,D==="ENOENT")F|=BF;if(D==="EINVAL"||D==="UNKNOWN")F&=M8;if(this.#Q=F,D==="ENOTDIR"&&this.parent)this.parent.#u()}#y(D,F){return this.#z(D,F)||this.#d(D,F)}#d(D,F){let Q=r7(D),B=this.newChild(D.name,Q,{parent:this}),Y=B.#Q&l0;if(Y!==HF&&Y!==rF&&Y!==d0)B.#Q|=j8;return F.unshift(B),F.provisional++,B}#z(D,F){for(let Q=F.provisional;Q<F.length;Q++){let B=F[Q];if((this.nocase?y6(D.name):R8(D.name))!==B.#R)continue;return this.#c(D,B,Q,F)}}#c(D,F,Q,B){let Y=F.name;if(F.#Q=F.#Q&M8|r7(D),Y!==D.name)F.name=D.name;if(Q!==B.provisional){if(Q===B.length-1)B.pop();else B.splice(Q,1);B.unshift(F)}return B.provisional++,F}async lstat(){if((this.#Q&BF)===0)try{return this.#f(await this.#D.promises.lstat(this.fullpath())),this}catch(D){this.#b(D.code)}}lstatSync(){if((this.#Q&BF)===0)try{return this.#f(this.#D.lstatSync(this.fullpath())),this}catch(D){this.#b(D.code)}}#f(D){let{atime:F,atimeMs:Q,birthtime:B,birthtimeMs:Y,blksize:J,blocks:X,ctime:C,ctimeMs:W,dev:z,gid:G,ino:q,mode:A,mtime:U,mtimeMs:Z,nlink:H,rdev:V,size:j,uid:L}=D;this.#L=F,this.#W=Q,this.#A=B,this.#N=Y,this.#G=J,this.#q=X,this.#T=C,this.#U=W,this.#F=z,this.#M=G,this.#C=q,this.#Y=A,this.#E=U,this.#B=Z,this.#X=H,this.#V=V,this.#H=j,this.#J=L;let R=r7(D);if(this.#Q=this.#Q&M8|R|LB,R!==d0&&R!==HF&&R!==rF)this.#Q|=j8}#k=[];#h=!1;#n(D){this.#h=!1;let F=this.#k.slice();this.#k.length=0,F.forEach((Q)=>Q(null,D))}readdirCB(D,F=!1){if(!this.canReaddir()){if(F)D(null,[]);else queueMicrotask(()=>D(null,[]));return}let Q=this.children();if(this.calledReaddir()){let Y=Q.slice(0,Q.provisional);if(F)D(null,Y);else queueMicrotask(()=>D(null,Y));return}if(this.#k.push(D),this.#h)return;this.#h=!0;let B=this.fullpath();this.#D.readdir(B,{withFileTypes:!0},(Y,J)=>{if(Y)this.#S(Y.code),Q.provisional=0;else{for(let X of J)this.#y(X,Q);this.#O(Q)}this.#n(Q.slice(0,Q.provisional));return})}#p;async readdir(){if(!this.canReaddir())return[];let D=this.children();if(this.calledReaddir())return D.slice(0,D.provisional);let F=this.fullpath();if(this.#p)await this.#p;else{let Q=()=>{};this.#p=new Promise((B)=>Q=B);try{for(let B of await this.#D.promises.readdir(F,{withFileTypes:!0}))this.#y(B,D);this.#O(D)}catch(B){this.#S(B.code),D.provisional=0}this.#p=void 0,Q()}return D.slice(0,D.provisional)}readdirSync(){if(!this.canReaddir())return[];let D=this.children();if(this.calledReaddir())return D.slice(0,D.provisional);let F=this.fullpath();try{for(let Q of this.#D.readdirSync(F,{withFileTypes:!0}))this.#y(Q,D);this.#O(D)}catch(Q){this.#S(Q.code),D.provisional=0}return D.slice(0,D.provisional)}canReaddir(){if(this.#Q&MB)return!1;let D=l0&this.#Q;if(!(D===d0||D===HF||D===rF))return!1;return!0}shouldWalk(D,F){return(this.#Q&HF)===HF&&!(this.#Q&MB)&&!D.has(this)&&(!F||F(this))}async realpath(){if(this.#_)return this.#_;if((f6|u6|BF)&this.#Q)return;try{let D=await this.#D.promises.realpath(this.fullpath());return this.#_=this.resolve(D)}catch(D){this.#$()}}realpathSync(){if(this.#_)return this.#_;if((f6|u6|BF)&this.#Q)return;try{let D=this.#D.realpathSync(this.fullpath());return this.#_=this.resolve(D)}catch(D){this.#$()}}[kB](D){if(D===this)return;D.isCWD=!1,this.isCWD=!0;let F=new Set([]),Q=[],B=this;while(B&&B.parent)F.add(B),B.#w=Q.join(this.sep),B.#K=Q.join("/"),B=B.parent,Q.push("..");B=D;while(B&&B.parent&&!F.has(B))B.#w=void 0,B.#K=void 0,B=B.parent}}class g6 extends L0{sep="\\";splitSep=iG;constructor(D,F=d0,Q,B,Y,J,X){super(D,F,Q,B,Y,J,X)}newChild(D,F=d0,Q={}){return new g6(D,F,this.root,this.roots,this.nocase,this.childrenCache(),Q)}getRootString(D){return o7.parse(D).root}getRoot(D){if(D=nG(D.toUpperCase()),D===this.root.name)return this.root;for(let[F,Q]of Object.entries(this.roots))if(this.sameRoot(D,F))return this.roots[D]=Q;return this.roots[D]=new _8(D,this).root}sameRoot(D,F=this.root.name){return D=D.toUpperCase().replace(/\//g,"\\").replace(_B,"$1\\"),D===F}}class $6 extends L0{splitSep="/";sep="/";constructor(D,F=d0,Q,B,Y,J,X){super(D,F,Q,B,Y,J,X)}getRootString(D){return D.startsWith("/")?"/":""}getRoot(D){return this.root}newChild(D,F=d0,Q={}){return new $6(D,F,this.root,this.roots,this.nocase,this.childrenCache(),Q)}}class t7{root;rootPath;roots;cwd;#D;#F;#Y;nocase;#X;constructor(D=process.cwd(),F,Q,{nocase:B,childrenCacheSize:Y=16384,fs:J=N8}={}){if(this.#X=RB(J),D instanceof URL||D.startsWith("file://"))D=xG(D);let X=F.resolve(D);this.roots=Object.create(null),this.rootPath=this.parseRootPath(X),this.#D=new s7,this.#F=new s7,this.#Y=new SB(Y);let C=X.substring(this.rootPath.length).split(Q);if(C.length===1&&!C[0])C.pop();if(B===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=B,this.root=this.newRoot(this.#X),this.roots[this.rootPath]=this.root;let W=this.root,z=C.length-1,G=F.sep,q=this.rootPath,A=!1;for(let U of C){let Z=z--;W=W.child(U,{relative:new Array(Z).fill("..").join(G),relativePosix:new Array(Z).fill("..").join("/"),fullpath:q+=(A?"":G)+U}),A=!0}this.cwd=W}depth(D=this.cwd){if(typeof D==="string")D=this.cwd.resolve(D);return D.depth()}childrenCache(){return this.#Y}resolve(...D){let F="";for(let Y=D.length-1;Y>=0;Y--){let J=D[Y];if(!J||J===".")continue;if(F=F?`${J}/${F}`:J,this.isAbsolute(J))break}let Q=this.#D.get(F);if(Q!==void 0)return Q;let B=this.cwd.resolve(F).fullpath();return this.#D.set(F,B),B}resolvePosix(...D){let F="";for(let Y=D.length-1;Y>=0;Y--){let J=D[Y];if(!J||J===".")continue;if(F=F?`${J}/${F}`:J,this.isAbsolute(J))break}let Q=this.#F.get(F);if(Q!==void 0)return Q;let B=this.cwd.resolve(F).fullpathPosix();return this.#F.set(F,B),B}relative(D=this.cwd){if(typeof D==="string")D=this.cwd.resolve(D);return D.relative()}relativePosix(D=this.cwd){if(typeof D==="string")D=this.cwd.resolve(D);return D.relativePosix()}basename(D=this.cwd){if(typeof D==="string")D=this.cwd.resolve(D);return D.name}dirname(D=this.cwd){if(typeof D==="string")D=this.cwd.resolve(D);return(D.parent||D).fullpath()}async readdir(D=this.cwd,F={withFileTypes:!0}){if(typeof D==="string")D=this.cwd.resolve(D);else if(!(D instanceof L0))F=D,D=this.cwd;let{withFileTypes:Q}=F;if(!D.canReaddir())return[];else{let B=await D.readdir();return Q?B:B.map((Y)=>Y.name)}}readdirSync(D=this.cwd,F={withFileTypes:!0}){if(typeof D==="string")D=this.cwd.resolve(D);else if(!(D instanceof L0))F=D,D=this.cwd;let{withFileTypes:Q=!0}=F;if(!D.canReaddir())return[];else if(Q)return D.readdirSync();else return D.readdirSync().map((B)=>B.name)}async lstat(D=this.cwd){if(typeof D==="string")D=this.cwd.resolve(D);return D.lstat()}lstatSync(D=this.cwd){if(typeof D==="string")D=this.cwd.resolve(D);return D.lstatSync()}async readlink(D=this.cwd,{withFileTypes:F}={withFileTypes:!1}){if(typeof D==="string")D=this.cwd.resolve(D);else if(!(D instanceof L0))F=D.withFileTypes,D=this.cwd;let Q=await D.readlink();return F?Q:Q?.fullpath()}readlinkSync(D=this.cwd,{withFileTypes:F}={withFileTypes:!1}){if(typeof D==="string")D=this.cwd.resolve(D);else if(!(D instanceof L0))F=D.withFileTypes,D=this.cwd;let Q=D.readlinkSync();return F?Q:Q?.fullpath()}async realpath(D=this.cwd,{withFileTypes:F}={withFileTypes:!1}){if(typeof D==="string")D=this.cwd.resolve(D);else if(!(D instanceof L0))F=D.withFileTypes,D=this.cwd;let Q=await D.realpath();return F?Q:Q?.fullpath()}realpathSync(D=this.cwd,{withFileTypes:F}={withFileTypes:!1}){if(typeof D==="string")D=this.cwd.resolve(D);else if(!(D instanceof L0))F=D.withFileTypes,D=this.cwd;let Q=D.realpathSync();return F?Q:Q?.fullpath()}async walk(D=this.cwd,F={}){if(typeof D==="string")D=this.cwd.resolve(D);else if(!(D instanceof L0))F=D,D=this.cwd;let{withFileTypes:Q=!0,follow:B=!1,filter:Y,walkFilter:J}=F,X=[];if(!Y||Y(D))X.push(Q?D:D.fullpath());let C=new Set,W=(G,q)=>{C.add(G),G.readdirCB((A,U)=>{if(A)return q(A);let Z=U.length;if(!Z)return q();let H=()=>{if(--Z===0)q()};for(let V of U){if(!Y||Y(V))X.push(Q?V:V.fullpath());if(B&&V.isSymbolicLink())V.realpath().then((j)=>j?.isUnknown()?j.lstat():j).then((j)=>j?.shouldWalk(C,J)?W(j,H):H());else if(V.shouldWalk(C,J))W(V,H);else H()}},!0)},z=D;return new Promise((G,q)=>{W(z,(A)=>{if(A)return q(A);G(X)})})}walkSync(D=this.cwd,F={}){if(typeof D==="string")D=this.cwd.resolve(D);else if(!(D instanceof L0))F=D,D=this.cwd;let{withFileTypes:Q=!0,follow:B=!1,filter:Y,walkFilter:J}=F,X=[];if(!Y||Y(D))X.push(Q?D:D.fullpath());let C=new Set([D]);for(let W of C){let z=W.readdirSync();for(let G of z){if(!Y||Y(G))X.push(Q?G:G.fullpath());let q=G;if(G.isSymbolicLink()){if(!(B&&(q=G.realpathSync())))continue;if(q.isUnknown())q.lstatSync()}if(q.shouldWalk(C,J))C.add(q)}}return X}[Symbol.asyncIterator](){return this.iterate()}iterate(D=this.cwd,F={}){if(typeof D==="string")D=this.cwd.resolve(D);else if(!(D instanceof L0))F=D,D=this.cwd;return this.stream(D,F)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(D=this.cwd,F={}){if(typeof D==="string")D=this.cwd.resolve(D);else if(!(D instanceof L0))F=D,D=this.cwd;let{withFileTypes:Q=!0,follow:B=!1,filter:Y,walkFilter:J}=F;if(!Y||Y(D))yield Q?D:D.fullpath();let X=new Set([D]);for(let C of X){let W=C.readdirSync();for(let z of W){if(!Y||Y(z))yield Q?z:z.fullpath();let G=z;if(z.isSymbolicLink()){if(!(B&&(G=z.realpathSync())))continue;if(G.isUnknown())G.lstatSync()}if(G.shouldWalk(X,J))X.add(G)}}}stream(D=this.cwd,F={}){if(typeof D==="string")D=this.cwd.resolve(D);else if(!(D instanceof L0))F=D,D=this.cwd;let{withFileTypes:Q=!0,follow:B=!1,filter:Y,walkFilter:J}=F,X=new aF({objectMode:!0});if(!Y||Y(D))X.write(Q?D:D.fullpath());let C=new Set,W=[D],z=0,G=()=>{let q=!1;while(!q){let A=W.shift();if(!A){if(z===0)X.end();return}z++,C.add(A);let U=(H,V,j=!1)=>{if(H)return X.emit("error",H);if(B&&!j){let L=[];for(let R of V)if(R.isSymbolicLink())L.push(R.realpath().then((k)=>k?.isUnknown()?k.lstat():k));if(L.length){Promise.all(L).then(()=>U(null,V,!0));return}}for(let L of V)if(L&&(!Y||Y(L))){if(!X.write(Q?L:L.fullpath()))q=!0}z--;for(let L of V){let R=L.realpathCached()||L;if(R.shouldWalk(C,J))W.push(R)}if(q&&!X.flowing)X.once("drain",G);else if(!Z)G()},Z=!0;A.readdirCB(U,!0),Z=!1}};return G(),X}streamSync(D=this.cwd,F={}){if(typeof D==="string")D=this.cwd.resolve(D);else if(!(D instanceof L0))F=D,D=this.cwd;let{withFileTypes:Q=!0,follow:B=!1,filter:Y,walkFilter:J}=F,X=new aF({objectMode:!0}),C=new Set;if(!Y||Y(D))X.write(Q?D:D.fullpath());let W=[D],z=0,G=()=>{let q=!1;while(!q){let A=W.shift();if(!A){if(z===0)X.end();return}z++,C.add(A);let U=A.readdirSync();for(let Z of U)if(!Y||Y(Z)){if(!X.write(Q?Z:Z.fullpath()))q=!0}z--;for(let Z of U){let H=Z;if(Z.isSymbolicLink()){if(!(B&&(H=Z.realpathSync())))continue;if(H.isUnknown())H.lstatSync()}if(H.shouldWalk(C,J))W.push(H)}}if(q&&!X.flowing)X.once("drain",G)};return G(),X}chdir(D=this.cwd){let F=this.cwd;this.cwd=typeof D==="string"?this.cwd.resolve(D):D,this.cwd[kB](F)}}class _8 extends t7{sep="\\";constructor(D=process.cwd(),F={}){let{nocase:Q=!0}=F;super(D,o7,"\\",{...F,nocase:Q});this.nocase=Q;for(let B=this.cwd;B;B=B.parent)B.nocase=this.nocase}parseRootPath(D){return o7.parse(D).root.toUpperCase()}newRoot(D){return new g6(this.rootPath,HF,void 0,this.roots,this.nocase,this.childrenCache(),{fs:D})}isAbsolute(D){return D.startsWith("/")||D.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(D)}}class O8 extends t7{sep="/";constructor(D=process.cwd(),F={}){let{nocase:Q=!1}=F;super(D,vG,"/",{...F,nocase:Q});this.nocase=Q}parseRootPath(D){return"/"}newRoot(D){return new $6(this.rootPath,HF,void 0,this.roots,this.nocase,this.childrenCache(),{fs:D})}isAbsolute(D){return D.startsWith("/")}}class h6 extends O8{constructor(D=process.cwd(),F={}){let{nocase:Q=!0}=F;super(D,{...F,nocase:Q})}}var sL=process.platform==="win32"?g6:$6,bB=process.platform==="win32"?_8:process.platform==="darwin"?h6:O8;var rG=(D)=>D.length>=1,oG=(D)=>D.length>=1;class M2{#D;#F;#Y;length;#X;#J;#M;#V;#G;#C;#H=!0;constructor(D,F,Q,B){if(!rG(D))throw new TypeError("empty pattern list");if(!oG(F))throw new TypeError("empty glob list");if(F.length!==D.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=D.length,Q<0||Q>=this.length)throw new TypeError("index out of range");if(this.#D=D,this.#F=F,this.#Y=Q,this.#X=B,this.#Y===0){if(this.isUNC()){let[Y,J,X,C,...W]=this.#D,[z,G,q,A,...U]=this.#F;if(W[0]==="")W.shift(),U.shift();let Z=[Y,J,X,C,""].join("/"),H=[z,G,q,A,""].join("/");this.#D=[Z,...W],this.#F=[H,...U],this.length=this.#D.length}else if(this.isDrive()||this.isAbsolute()){let[Y,...J]=this.#D,[X,...C]=this.#F;if(J[0]==="")J.shift(),C.shift();let W=Y+"/",z=X+"/";this.#D=[W,...J],this.#F=[z,...C],this.length=this.#D.length}}}pattern(){return this.#D[this.#Y]}isString(){return typeof this.#D[this.#Y]==="string"}isGlobstar(){return this.#D[this.#Y]===Y0}isRegExp(){return this.#D[this.#Y]instanceof RegExp}globString(){return this.#M=this.#M||(this.#Y===0?this.isAbsolute()?this.#F[0]+this.#F.slice(1).join("/"):this.#F.join("/"):this.#F.slice(this.#Y).join("/"))}hasMore(){return this.length>this.#Y+1}rest(){if(this.#J!==void 0)return this.#J;if(!this.hasMore())return this.#J=null;return this.#J=new M2(this.#D,this.#F,this.#Y+1,this.#X),this.#J.#C=this.#C,this.#J.#G=this.#G,this.#J.#V=this.#V,this.#J}isUNC(){let D=this.#D;return this.#G!==void 0?this.#G:this.#G=this.#X==="win32"&&this.#Y===0&&D[0]===""&&D[1]===""&&typeof D[2]==="string"&&!!D[2]&&typeof D[3]==="string"&&!!D[3]}isDrive(){let D=this.#D;return this.#V!==void 0?this.#V:this.#V=this.#X==="win32"&&this.#Y===0&&this.length>1&&typeof D[0]==="string"&&/^[a-z]:$/i.test(D[0])}isAbsolute(){let D=this.#D;return this.#C!==void 0?this.#C:this.#C=D[0]===""&&D.length>1||this.isDrive()||this.isUNC()}root(){let D=this.#D[0];return typeof D==="string"&&this.isAbsolute()&&this.#Y===0?D:""}checkFollowGlobstar(){return!(this.#Y===0||!this.isGlobstar()||!this.#H)}markFollowGlobstar(){if(this.#Y===0||!this.isGlobstar()||!this.#H)return!1;return this.#H=!1,!0}}var sG=typeof process==="object"&&process&&typeof process.platform==="string"?process.platform:"linux";class I8{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(D,{nobrace:F,nocase:Q,noext:B,noglobstar:Y,platform:J=sG}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=J,this.mmopts={dot:!0,nobrace:F,nocase:Q,noext:B,noglobstar:Y,optimizationLevel:2,platform:J,nocomment:!0,nonegate:!0};for(let X of D)this.add(X)}add(D){let F=new m0(D,this.mmopts);for(let Q=0;Q<F.set.length;Q++){let B=F.set[Q],Y=F.globParts[Q];if(!B||!Y)throw new Error("invalid pattern object");while(B[0]==="."&&Y[0]===".")B.shift(),Y.shift();let J=new M2(B,Y,0,this.platform),X=new m0(J.globString(),this.mmopts),C=Y[Y.length-1]==="**",W=J.isAbsolute();if(W)this.absolute.push(X);else this.relative.push(X);if(C)if(W)this.absoluteChildren.push(X);else this.relativeChildren.push(X)}}ignored(D){let F=D.fullpath(),Q=`${F}/`,B=D.relative()||".",Y=`${B}/`;for(let J of this.relative)if(J.match(B)||J.match(Y))return!0;for(let J of this.absolute)if(J.match(F)||J.match(Q))return!0;return!1}childrenIgnored(D){let F=D.fullpath()+"/",Q=(D.relative()||".")+"/";for(let B of this.relativeChildren)if(B.match(Q))return!0;for(let B of this.absoluteChildren)if(B.match(F))return!0;return!1}}class e7{store;constructor(D=new Map){this.store=D}copy(){return new e7(new Map(this.store))}hasWalked(D,F){return this.store.get(D.fullpath())?.has(F.globString())}storeWalked(D,F){let Q=D.fullpath(),B=this.store.get(Q);if(B)B.add(F.globString());else this.store.set(Q,new Set([F.globString()]))}}class vB{store=new Map;add(D,F,Q){let B=(F?2:0)|(Q?1:0),Y=this.store.get(D);this.store.set(D,Y===void 0?B:B&Y)}entries(){return[...this.store.entries()].map(([D,F])=>[D,!!(F&2),!!(F&1)])}}class xB{store=new Map;add(D,F){if(!D.canReaddir())return;let Q=this.store.get(D);if(Q){if(!Q.find((B)=>B.globString()===F.globString()))Q.push(F)}else this.store.set(D,[F])}get(D){let F=this.store.get(D);if(!F)throw new Error("attempting to walk unknown path");return F}entries(){return this.keys().map((D)=>[D,this.store.get(D)])}keys(){return[...this.store.keys()].filter((D)=>D.canReaddir())}}class w8{hasWalkedCache;matches=new vB;subwalks=new xB;patterns;follow;dot;opts;constructor(D,F){this.opts=D,this.follow=!!D.follow,this.dot=!!D.dot,this.hasWalkedCache=F?F.copy():new e7}processPatterns(D,F){this.patterns=F;let Q=F.map((B)=>[D,B]);for(let[B,Y]of Q){this.hasWalkedCache.storeWalked(B,Y);let J=Y.root(),X=Y.isAbsolute()&&this.opts.absolute!==!1;if(J){B=B.resolve(J==="/"&&this.opts.root!==void 0?this.opts.root:J);let G=Y.rest();if(!G){this.matches.add(B,!0,!1);continue}else Y=G}if(B.isENOENT())continue;let C,W,z=!1;while(typeof(C=Y.pattern())==="string"&&(W=Y.rest()))B=B.resolve(C),Y=W,z=!0;if(C=Y.pattern(),W=Y.rest(),z){if(this.hasWalkedCache.hasWalked(B,Y))continue;this.hasWalkedCache.storeWalked(B,Y)}if(typeof C==="string"){let G=C===".."||C===""||C===".";this.matches.add(B.resolve(C),X,G);continue}else if(C===Y0){if(!B.isSymbolicLink()||this.follow||Y.checkFollowGlobstar())this.subwalks.add(B,Y);let G=W?.pattern(),q=W?.rest();if(!W||(G===""||G===".")&&!q)this.matches.add(B,X,G===""||G===".");else if(G===".."){let A=B.parent||B;if(!q)this.matches.add(A,X,!0);else if(!this.hasWalkedCache.hasWalked(A,q))this.subwalks.add(A,q)}}else if(C instanceof RegExp)this.subwalks.add(B,Y)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new w8(this.opts,this.hasWalkedCache)}filterEntries(D,F){let Q=this.subwalks.get(D),B=this.child();for(let Y of F)for(let J of Q){let X=J.isAbsolute(),C=J.pattern(),W=J.rest();if(C===Y0)B.testGlobstar(Y,J,W,X);else if(C instanceof RegExp)B.testRegExp(Y,C,W,X);else B.testString(Y,C,W,X)}return B}testGlobstar(D,F,Q,B){if(this.dot||!D.name.startsWith(".")){if(!F.hasMore())this.matches.add(D,B,!1);if(D.canReaddir()){if(this.follow||!D.isSymbolicLink())this.subwalks.add(D,F);else if(D.isSymbolicLink()){if(Q&&F.checkFollowGlobstar())this.subwalks.add(D,Q);else if(F.markFollowGlobstar())this.subwalks.add(D,F)}}}if(Q){let Y=Q.pattern();if(typeof Y==="string"&&Y!==".."&&Y!==""&&Y!==".")this.testString(D,Y,Q.rest(),B);else if(Y===".."){let J=D.parent||D;this.subwalks.add(J,Q)}else if(Y instanceof RegExp)this.testRegExp(D,Y,Q.rest(),B)}}testRegExp(D,F,Q,B){if(!F.test(D.name))return;if(!Q)this.matches.add(D,B,!1);else this.subwalks.add(D,Q)}testString(D,F,Q,B){if(!D.isNamed(F))return;if(!Q)this.matches.add(D,B,!1);else this.subwalks.add(D,Q)}}var tG=(D,F)=>typeof D==="string"?new I8([D],F):Array.isArray(D)?new I8(D,F):D;class D9{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#D=[];#F;#Y;signal;maxDepth;includeChildMatches;constructor(D,F,Q){if(this.patterns=D,this.path=F,this.opts=Q,this.#Y=!Q.posix&&Q.platform==="win32"?"\\":"/",this.includeChildMatches=Q.includeChildMatches!==!1,Q.ignore||!this.includeChildMatches){if(this.#F=tG(Q.ignore??[],Q),!this.includeChildMatches&&typeof this.#F.add!=="function")throw new Error("cannot ignore child matches, ignore lacks add() method.")}if(this.maxDepth=Q.maxDepth||1/0,Q.signal)this.signal=Q.signal,this.signal.addEventListener("abort",()=>{this.#D.length=0})}#X(D){return this.seen.has(D)||!!this.#F?.ignored?.(D)}#J(D){return!!this.#F?.childrenIgnored?.(D)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let D=void 0;while(!this.paused&&(D=this.#D.shift()))D()}onResume(D){if(this.signal?.aborted)return;if(!this.paused)D();else this.#D.push(D)}async matchCheck(D,F){if(F&&this.opts.nodir)return;let Q;if(this.opts.realpath){if(Q=D.realpathCached()||await D.realpath(),!Q)return;D=Q}let Y=D.isUnknown()||this.opts.stat?await D.lstat():D;if(this.opts.follow&&this.opts.nodir&&Y?.isSymbolicLink()){let J=await Y.realpath();if(J&&(J.isUnknown()||this.opts.stat))await J.lstat()}return this.matchCheckTest(Y,F)}matchCheckTest(D,F){return D&&(this.maxDepth===1/0||D.depth()<=this.maxDepth)&&(!F||D.canReaddir())&&(!this.opts.nodir||!D.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!D.isSymbolicLink()||!D.realpathCached()?.isDirectory())&&!this.#X(D)?D:void 0}matchCheckSync(D,F){if(F&&this.opts.nodir)return;let Q;if(this.opts.realpath){if(Q=D.realpathCached()||D.realpathSync(),!Q)return;D=Q}let Y=D.isUnknown()||this.opts.stat?D.lstatSync():D;if(this.opts.follow&&this.opts.nodir&&Y?.isSymbolicLink()){let J=Y.realpathSync();if(J&&(J?.isUnknown()||this.opts.stat))J.lstatSync()}return this.matchCheckTest(Y,F)}matchFinish(D,F){if(this.#X(D))return;if(!this.includeChildMatches&&this.#F?.add){let Y=`${D.relativePosix()}/**`;this.#F.add(Y)}let Q=this.opts.absolute===void 0?F:this.opts.absolute;this.seen.add(D);let B=this.opts.mark&&D.isDirectory()?this.#Y:"";if(this.opts.withFileTypes)this.matchEmit(D);else if(Q){let Y=this.opts.posix?D.fullpathPosix():D.fullpath();this.matchEmit(Y+B)}else{let Y=this.opts.posix?D.relativePosix():D.relative(),J=this.opts.dotRelative&&!Y.startsWith(".."+this.#Y)?"."+this.#Y:"";this.matchEmit(!Y?"."+B:J+Y+B)}}async match(D,F,Q){let B=await this.matchCheck(D,Q);if(B)this.matchFinish(B,F)}matchSync(D,F,Q){let B=this.matchCheckSync(D,Q);if(B)this.matchFinish(B,F)}walkCB(D,F,Q){if(this.signal?.aborted)Q();this.walkCB2(D,F,new w8(this.opts),Q)}walkCB2(D,F,Q,B){if(this.#J(D))return B();if(this.signal?.aborted)B();if(this.paused){this.onResume(()=>this.walkCB2(D,F,Q,B));return}Q.processPatterns(D,F);let Y=1,J=()=>{if(--Y===0)B()};for(let[X,C,W]of Q.matches.entries()){if(this.#X(X))continue;Y++,this.match(X,C,W).then(()=>J())}for(let X of Q.subwalkTargets()){if(this.maxDepth!==1/0&&X.depth()>=this.maxDepth)continue;Y++;let C=X.readdirCached();if(X.calledReaddir())this.walkCB3(X,C,Q,J);else X.readdirCB((W,z)=>this.walkCB3(X,z,Q,J),!0)}J()}walkCB3(D,F,Q,B){Q=Q.filterEntries(D,F);let Y=1,J=()=>{if(--Y===0)B()};for(let[X,C,W]of Q.matches.entries()){if(this.#X(X))continue;Y++,this.match(X,C,W).then(()=>J())}for(let[X,C]of Q.subwalks.entries())Y++,this.walkCB2(X,C,Q.child(),J);J()}walkCBSync(D,F,Q){if(this.signal?.aborted)Q();this.walkCB2Sync(D,F,new w8(this.opts),Q)}walkCB2Sync(D,F,Q,B){if(this.#J(D))return B();if(this.signal?.aborted)B();if(this.paused){this.onResume(()=>this.walkCB2Sync(D,F,Q,B));return}Q.processPatterns(D,F);let Y=1,J=()=>{if(--Y===0)B()};for(let[X,C,W]of Q.matches.entries()){if(this.#X(X))continue;this.matchSync(X,C,W)}for(let X of Q.subwalkTargets()){if(this.maxDepth!==1/0&&X.depth()>=this.maxDepth)continue;Y++;let C=X.readdirSync();this.walkCB3Sync(X,C,Q,J)}J()}walkCB3Sync(D,F,Q,B){Q=Q.filterEntries(D,F);let Y=1,J=()=>{if(--Y===0)B()};for(let[X,C,W]of Q.matches.entries()){if(this.#X(X))continue;this.matchSync(X,C,W)}for(let[X,C]of Q.subwalks.entries())Y++,this.walkCB2Sync(X,C,Q.child(),J);J()}}class m6 extends D9{matches=new Set;constructor(D,F,Q){super(D,F,Q)}matchEmit(D){this.matches.add(D)}async walk(){if(this.signal?.aborted)throw this.signal.reason;if(this.path.isUnknown())await this.path.lstat();return await new Promise((D,F)=>{this.walkCB(this.path,this.patterns,()=>{if(this.signal?.aborted)F(this.signal.reason);else D(this.matches)})}),this.matches}walkSync(){if(this.signal?.aborted)throw this.signal.reason;if(this.path.isUnknown())this.path.lstatSync();return this.walkCBSync(this.path,this.patterns,()=>{if(this.signal?.aborted)throw this.signal.reason}),this.matches}}class l6 extends D9{results;constructor(D,F,Q){super(D,F,Q);this.results=new aF({signal:this.signal,objectMode:!0}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume())}matchEmit(D){if(this.results.write(D),!this.results.flowing)this.pause()}stream(){let D=this.path;if(D.isUnknown())D.lstat().then(()=>{this.walkCB(D,this.patterns,()=>this.results.end())});else this.walkCB(D,this.patterns,()=>this.results.end());return this.results}streamSync(){if(this.path.isUnknown())this.path.lstatSync();return this.walkCBSync(this.path,this.patterns,()=>this.results.end()),this.results}}var Dq=typeof process==="object"&&process&&typeof process.platform==="string"?process.platform:"linux";class KF{absolute;cwd;root;dot;dotRelative;follow;ignore;magicalBraces;mark;matchBase;maxDepth;nobrace;nocase;nodir;noext;noglobstar;pattern;platform;realpath;scurry;stat;signal;windowsPathsNoEscape;withFileTypes;includeChildMatches;opts;patterns;constructor(D,F){if(!F)throw new TypeError("glob options required");if(this.withFileTypes=!!F.withFileTypes,this.signal=F.signal,this.follow=!!F.follow,this.dot=!!F.dot,this.dotRelative=!!F.dotRelative,this.nodir=!!F.nodir,this.mark=!!F.mark,!F.cwd)this.cwd="";else if(F.cwd instanceof URL||F.cwd.startsWith("file://"))F.cwd=eG(F.cwd);if(this.cwd=F.cwd||"",this.root=F.root,this.magicalBraces=!!F.magicalBraces,this.nobrace=!!F.nobrace,this.noext=!!F.noext,this.realpath=!!F.realpath,this.absolute=F.absolute,this.includeChildMatches=F.includeChildMatches!==!1,this.noglobstar=!!F.noglobstar,this.matchBase=!!F.matchBase,this.maxDepth=typeof F.maxDepth==="number"?F.maxDepth:1/0,this.stat=!!F.stat,this.ignore=F.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof D==="string")D=[D];if(this.windowsPathsNoEscape=!!F.windowsPathsNoEscape||F.allowWindowsEscape===!1,this.windowsPathsNoEscape)D=D.map((C)=>C.replace(/\\/g,"/"));if(this.matchBase){if(F.noglobstar)throw new TypeError("base matching requires globstar");D=D.map((C)=>C.includes("/")?C:`./**/${C}`)}if(this.pattern=D,this.platform=F.platform||Dq,this.opts={...F,platform:this.platform},F.scurry){if(this.scurry=F.scurry,F.nocase!==void 0&&F.nocase!==F.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let C=F.platform==="win32"?_8:F.platform==="darwin"?h6:F.platform?O8:bB;this.scurry=new C(this.cwd,{nocase:F.nocase,fs:F.fs})}this.nocase=this.scurry.nocase;let Q=this.platform==="darwin"||this.platform==="win32",B={...F,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:Q,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},Y=this.pattern.map((C)=>new m0(C,B)),[J,X]=Y.reduce((C,W)=>{return C[0].push(...W.set),C[1].push(...W.globParts),C},[[],[]]);this.patterns=J.map((C,W)=>{let z=X[W];if(!z)throw new Error("invalid pattern object");return new M2(C,z,0,this.platform)})}async walk(){return[...await new m6(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walk()]}walkSync(){return[...new m6(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walkSync()]}stream(){return new l6(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).stream()}streamSync(){return new l6(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).streamSync()}iterateSync(){return this.streamSync()[Symbol.iterator]()}[Symbol.iterator](){return this.iterateSync()}iterate(){return this.stream()[Symbol.asyncIterator]()}[Symbol.asyncIterator](){return this.iterate()}}var F9=(D,F={})=>{if(!Array.isArray(D))D=[D];for(let Q of D)if(new m0(Q,F).hasMagic())return!0;return!1};function c6(D,F={}){return new KF(D,F).streamSync()}function yB(D,F={}){return new KF(D,F).stream()}function fB(D,F={}){return new KF(D,F).walkSync()}async function uB(D,F={}){return new KF(D,F).walk()}function p6(D,F={}){return new KF(D,F).iterateSync()}function gB(D,F={}){return new KF(D,F).iterate()}var Fq=c6,Bq=Object.assign(yB,{sync:c6}),Qq=p6,Xq=Object.assign(gB,{sync:p6}),Yq=Object.assign(fB,{stream:c6,iterate:p6}),d6=Object.assign(uB,{glob:uB,globSync:fB,sync:Yq,globStream:yB,stream:Bq,globStreamSync:c6,streamSync:Fq,globIterate:gB,iterate:Xq,globIterateSync:p6,iterateSync:Qq,Glob:KF,hasMagic:F9,escape:A2,unescape:DF});d6.glob=d6;E0();async function hB(D,F={}){let Q=CD.getInstance().getTrashDirectory();if(!$B(Q))Cq(Q,{recursive:!0});let B=Array.isArray(D)?D:[D];for(let Y of B){let J=await d6(Y),X=J.length>0?J:[Y];for(let C of X)try{if(!$B(C)){if(!F.force){console.error(`trash: ${C}: No such file or directory`);continue}continue}if(Wq(C).isDirectory()&&!F.recursive){if(!F.force){console.error(`trash: ${C}: is a directory`);continue}}let z=Gq(C),G=Date.now(),q=zq(Q,`${z}.${G}`);Jq(C,q),console.log(`Moved ${z} to trash`)}catch(W){if(!F.force){let z=W instanceof Error?W.message:String(W);console.error(`trash: ${C}: ${z}`)}}}}import{readdirSync as lB,statSync as dB}from"fs";import{join as cB}from"path";E0();function qq(D){let F=D.lastIndexOf(".");if(F===-1)return{name:D,timestamp:0};let Q=parseInt(D.substring(F+1));if(isNaN(Q))return{name:D,timestamp:0};return{name:D.substring(0,F),timestamp:Q}}function mB(D){if(D===0)return"0 B";let F=1024,Q=["B","KB","MB","GB"],B=Math.floor(Math.log(D)/Math.log(F));return parseFloat((D/Math.pow(F,B)).toFixed(2))+" "+Q[B]}function pB(D){let F=0,Q=lB(D);for(let B of Q){let Y=cB(D,B),J=dB(Y);if(J.isDirectory())F+=pB(Y);else F+=J.size}return F}async function nB(){let D=CD.getInstance().getTrashDirectory();try{let F=lB(D);if(F.length===0){K0.info("\uD83D\uDDD1️ Trash is empty");return}let Q=F.map((X)=>{let C=cB(D,X),W=dB(C),{name:z,timestamp:G}=qq(X),q=W.isDirectory()?pB(C):W.size;return{originalName:z,trashedName:X,size:q,trashedAt:new Date(G),isDirectory:W.isDirectory()}});Q.sort((X,C)=>C.trashedAt.getTime()-X.trashedAt.getTime()),console.log(`
470
470
  \uD83D\uDDD1️ Trash Contents
471
- `),console.log("─".repeat(80));let B=0,Y=0,J=0;for(let X of Q){if(B+=X.size,X.isDirectory)Y++;else J++;let C=X.isDirectory?"\uD83D\uDCC1":"\uD83D\uDCC4",z=X.trashedAt.toLocaleString(),W=mB(X.size);console.log(`${C} ${X.originalName}`),console.log(` Size: ${W} | Trashed: ${z}`),console.log(` ID: ${X.trashedName}`),console.log()}console.log("─".repeat(80)),console.log(`Total: ${Y} folders, ${J} files (${mB(B)})`),console.log(`
472
- To restore files: claude-mem restore`),console.log("To empty trash: claude-mem trash empty")}catch(F){if(F.code==="ENOENT")K0.info("\uD83D\uDDD1️ Trash is empty");else K0.error("Failed to read trash directory"),console.error(F)}}import{rmSync as Hq,readdirSync as Kq,existsSync as Uq,statSync as Eq}from"fs";import{join as iB}from"path";E0();async function aB(D={}){let F=CD.getInstance().getTrashDirectory();if(!Uq(F)){K0.info("\uD83D\uDDD1️ Trash is already empty");return}try{let Q=Kq(F);if(Q.length===0){K0.info("\uD83D\uDDD1️ Trash is already empty");return}let B=0,Y=0;for(let X of Q){let C=iB(F,X);if(Eq(C).isDirectory())B++;else Y++}if(!D.force){let X=await z2({message:`Permanently delete ${B} folders and ${Y} files from trash?`,initialValue:!1});if(y0(X)||!X){K0.info("Cancelled - trash not emptied");return}}let J=I3();J.start("Emptying trash...");for(let X of Q){let C=iB(F,X);Hq(C,{recursive:!0,force:!0})}J.stop(`\uD83D\uDDD1️ Trash emptied - permanently deleted ${B} folders and ${Y} files`)}catch(Q){K0.error("Failed to empty trash"),console.error(Q),process.exit(1)}}import{readdirSync as Aq,renameSync as Zq}from"fs";import{join as rB}from"path";E0();async function oB(){let D=CD.getInstance().getTrashDirectory(),F=Aq(D);if(F.length===0){console.log("Trash is empty");return}let Q=await s8({message:"Select file to restore:",options:F.map((B)=>({value:B,label:B}))});if(y0(Q))return;Zq(rB(D,Q),rB(process.cwd(),Q)),console.log(`Restored ${Q}`)}import{join as FQ}from"path";import{fileURLToPath as XH}from"url";import{setMaxListeners as YH}from"events";import{spawn as CH}from"child_process";import{createInterface as WH}from"readline";import*as WD from"fs";import{stat as zH,open as oM}from"fs/promises";var{create:Vq,getPrototypeOf:Lq,defineProperty:Q9,getOwnPropertyNames:Mq}=Object,Nq=Object.prototype.hasOwnProperty,jq=(D,F,Q)=>{Q=D!=null?Vq(Lq(D)):{};let B=F||!D||!D.__esModule?Q9(Q,"default",{value:D,enumerable:!0}):Q;for(let Y of Mq(D))if(!Nq.call(B,Y))Q9(B,Y,{get:()=>D[Y],enumerable:!0});return B},KD=(D,F)=>()=>(F||D((F={exports:{}}).exports,F),F.exports),Rq=(D,F)=>{for(var Q in F)Q9(D,Q,{get:F[Q],enumerable:!0,configurable:!0,set:(B)=>F[Q]=()=>B})},_q=KD((D,F)=>{(function(Q,B){typeof D==="object"&&typeof F!=="undefined"?B(D):typeof define==="function"&&define.amd?define(["exports"],B):B(Q.URI=Q.URI||{})})(D,function(Q){function B(){for(var P=arguments.length,M=Array(P),v=0;v<P;v++)M[v]=arguments[v];if(M.length>1){M[0]=M[0].slice(0,-1);var $=M.length-1;for(var m=1;m<$;++m)M[m]=M[m].slice(1,-1);return M[$]=M[$].slice(1),M.join("")}else return M[0]}function Y(P){return"(?:"+P+")"}function J(P){return P===void 0?"undefined":P===null?"null":Object.prototype.toString.call(P).split(" ").pop().split("]").shift().toLowerCase()}function X(P){return P.toUpperCase()}function C(P){return P!==void 0&&P!==null?P instanceof Array?P:typeof P.length!=="number"||P.split||P.setInterval||P.call?[P]:Array.prototype.slice.call(P):[]}function z(P,M){var v=P;if(M)for(var $ in M)v[$]=M[$];return v}function W(P){var M="[A-Za-z]",v="[\\x0D]",$="[0-9]",m="[\\x22]",s=B($,"[A-Fa-f]"),AD="[\\x0A]",jD="[\\x20]",ID=Y(Y("%[EFef]"+s+"%"+s+s+"%"+s+s)+"|"+Y("%[89A-Fa-f]"+s+"%"+s+s)+"|"+Y("%"+s+s)),aD="[\\:\\/\\?\\#\\[\\]\\@]",MD="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",yD=B(aD,MD),rD=P?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",kD=P?"[\\uE000-\\uF8FF]":"[]",_D=B(M,$,"[\\-\\.\\_\\~]",rD),fD=Y(M+B(M,$,"[\\+\\-\\.]")+"*"),wD=Y(Y(ID+"|"+B(_D,MD,"[\\:]"))+"*"),$F=Y(Y("25[0-5]")+"|"+Y("2[0-4]"+$)+"|"+Y("1"+$+$)+"|"+Y("[1-9]"+$)+"|"+$),_0=Y(Y("25[0-5]")+"|"+Y("2[0-4]"+$)+"|"+Y("1"+$+$)+"|"+Y("0?[1-9]"+$)+"|0?0?"+$),x0=Y(_0+"\\."+_0+"\\."+_0+"\\."+_0),TD=Y(s+"{1,4}"),O0=Y(Y(TD+"\\:"+TD)+"|"+x0),u0=Y(Y(TD+"\\:")+"{6}"+O0),WF=Y("\\:\\:"+Y(TD+"\\:")+"{5}"+O0),hF=Y(Y(TD)+"?\\:\\:"+Y(TD+"\\:")+"{4}"+O0),ZF=Y(Y(Y(TD+"\\:")+"{0,1}"+TD)+"?\\:\\:"+Y(TD+"\\:")+"{3}"+O0),m2=Y(Y(Y(TD+"\\:")+"{0,2}"+TD)+"?\\:\\:"+Y(TD+"\\:")+"{2}"+O0),$8=Y(Y(Y(TD+"\\:")+"{0,3}"+TD)+"?\\:\\:"+TD+"\\:"+O0),h8=Y(Y(Y(TD+"\\:")+"{0,4}"+TD)+"?\\:\\:"+O0),B2=Y(Y(Y(TD+"\\:")+"{0,5}"+TD)+"?\\:\\:"+TD),Q2=Y(Y(Y(TD+"\\:")+"{0,6}"+TD)+"?\\:\\:"),VF=Y([u0,WF,hF,ZF,m2,$8,h8,B2,Q2].join("|")),X2=Y(Y(_D+"|"+ID)+"+"),Q1=Y(VF+"\\%25"+X2),mF=Y(VF+Y("\\%25|\\%(?!"+s+"{2})")+X2),EX=Y("[vV]"+s+"+\\."+B(_D,MD,"[\\:]")+"+"),AX=Y("\\["+Y(mF+"|"+VF+"|"+EX)+"\\]"),w9=Y(Y(ID+"|"+B(_D,MD))+"*"),l2=Y(AX+"|"+x0+"(?!"+w9+")|"+w9),d2=Y($+"*"),T9=Y(Y(wD+"@")+"?"+l2+Y("\\:"+d2)+"?"),c2=Y(ID+"|"+B(_D,MD,"[\\:\\@]")),ZX=Y(c2+"*"),P9=Y(c2+"+"),VX=Y(Y(ID+"|"+B(_D,MD,"[\\@]"))+"+"),LF=Y(Y("\\/"+ZX)+"*"),Y2=Y("\\/"+Y(P9+LF)+"?"),X1=Y(VX+LF),m8=Y(P9+LF),J2="(?!"+c2+")",$U=Y(LF+"|"+Y2+"|"+X1+"|"+m8+"|"+J2),C2=Y(Y(c2+"|"+B("[\\/\\?]",kD))+"*"),p2=Y(Y(c2+"|[\\/\\?]")+"*"),S9=Y(Y("\\/\\/"+T9+LF)+"|"+Y2+"|"+m8+"|"+J2),LX=Y(fD+"\\:"+S9+Y("\\?"+C2)+"?"+Y("\\#"+p2)+"?"),MX=Y(Y("\\/\\/"+T9+LF)+"|"+Y2+"|"+X1+"|"+J2),NX=Y(MX+Y("\\?"+C2)+"?"+Y("\\#"+p2)+"?"),hU=Y(LX+"|"+NX),mU=Y(fD+"\\:"+S9+Y("\\?"+C2)+"?"),lU="^("+fD+")\\:"+Y(Y("\\/\\/("+Y("("+wD+")@")+"?("+l2+")"+Y("\\:("+d2+")")+"?)")+"?("+LF+"|"+Y2+"|"+m8+"|"+J2+")")+Y("\\?("+C2+")")+"?"+Y("\\#("+p2+")")+"?$",dU="^(){0}"+Y(Y("\\/\\/("+Y("("+wD+")@")+"?("+l2+")"+Y("\\:("+d2+")")+"?)")+"?("+LF+"|"+Y2+"|"+X1+"|"+J2+")")+Y("\\?("+C2+")")+"?"+Y("\\#("+p2+")")+"?$",cU="^("+fD+")\\:"+Y(Y("\\/\\/("+Y("("+wD+")@")+"?("+l2+")"+Y("\\:("+d2+")")+"?)")+"?("+LF+"|"+Y2+"|"+m8+"|"+J2+")")+Y("\\?("+C2+")")+"?$",pU="^"+Y("\\#("+p2+")")+"?$",nU="^"+Y("("+wD+")@")+"?("+l2+")"+Y("\\:("+d2+")")+"?$";return{NOT_SCHEME:new RegExp(B("[^]",M,$,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(B("[^\\%\\:]",_D,MD),"g"),NOT_HOST:new RegExp(B("[^\\%\\[\\]\\:]",_D,MD),"g"),NOT_PATH:new RegExp(B("[^\\%\\/\\:\\@]",_D,MD),"g"),NOT_PATH_NOSCHEME:new RegExp(B("[^\\%\\/\\@]",_D,MD),"g"),NOT_QUERY:new RegExp(B("[^\\%]",_D,MD,"[\\:\\@\\/\\?]",kD),"g"),NOT_FRAGMENT:new RegExp(B("[^\\%]",_D,MD,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(B("[^]",_D,MD),"g"),UNRESERVED:new RegExp(_D,"g"),OTHER_CHARS:new RegExp(B("[^\\%]",_D,yD),"g"),PCT_ENCODED:new RegExp(ID,"g"),IPV4ADDRESS:new RegExp("^("+x0+")$"),IPV6ADDRESS:new RegExp("^\\[?("+VF+")"+Y(Y("\\%25|\\%(?!"+s+"{2})")+"("+X2+")")+"?\\]?$")}}var G=W(!1),q=W(!0),A=function(){function P(M,v){var $=[],m=!0,s=!1,AD=void 0;try{for(var jD=M[Symbol.iterator](),ID;!(m=(ID=jD.next()).done);m=!0)if($.push(ID.value),v&&$.length===v)break}catch(aD){s=!0,AD=aD}finally{try{if(!m&&jD.return)jD.return()}finally{if(s)throw AD}}return $}return function(M,v){if(Array.isArray(M))return M;else if(Symbol.iterator in Object(M))return P(M,v);else throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),U=function(P){if(Array.isArray(P)){for(var M=0,v=Array(P.length);M<P.length;M++)v[M]=P[M];return v}else return Array.from(P)},Z=2147483647,H=36,V=1,N=26,L=38,R=700,k=72,b=128,I="-",u=/^xn--/,f=/[^\0-\x7E]/,O=/[\x2E\u3002\uFF0E\uFF61]/g,y={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},x=H-V,w=Math.floor,S=String.fromCharCode;function g(P){throw new RangeError(y[P])}function d(P,M){var v=[],$=P.length;while($--)v[$]=M(P[$]);return v}function n(P,M){var v=P.split("@"),$="";if(v.length>1)$=v[0]+"@",P=v[1];P=P.replace(O,".");var m=P.split("."),s=d(m,M).join(".");return $+s}function a(P){var M=[],v=0,$=P.length;while(v<$){var m=P.charCodeAt(v++);if(m>=55296&&m<=56319&&v<$){var s=P.charCodeAt(v++);if((s&64512)==56320)M.push(((m&1023)<<10)+(s&1023)+65536);else M.push(m),v--}else M.push(m)}return M}var DD=function P(M){return String.fromCodePoint.apply(String,U(M))},o=function P(M){if(M-48<10)return M-22;if(M-65<26)return M-65;if(M-97<26)return M-97;return H},XD=function P(M,v){return M+22+75*(M<26)-((v!=0)<<5)},YD=function P(M,v,$){var m=0;M=$?w(M/R):M>>1,M+=w(M/v);for(;M>x*N>>1;m+=H)M=w(M/x);return w(m+(x+1)*M/(M+L))},FD=function P(M){var v=[],$=M.length,m=0,s=b,AD=k,jD=M.lastIndexOf(I);if(jD<0)jD=0;for(var ID=0;ID<jD;++ID){if(M.charCodeAt(ID)>=128)g("not-basic");v.push(M.charCodeAt(ID))}for(var aD=jD>0?jD+1:0;aD<$;){var MD=m;for(var yD=1,rD=H;;rD+=H){if(aD>=$)g("invalid-input");var kD=o(M.charCodeAt(aD++));if(kD>=H||kD>w((Z-m)/yD))g("overflow");m+=kD*yD;var _D=rD<=AD?V:rD>=AD+N?N:rD-AD;if(kD<_D)break;var fD=H-_D;if(yD>w(Z/fD))g("overflow");yD*=fD}var wD=v.length+1;if(AD=YD(m-MD,wD,MD==0),w(m/wD)>Z-s)g("overflow");s+=w(m/wD),m%=wD,v.splice(m++,0,s)}return String.fromCodePoint.apply(String,v)},LD=function P(M){var v=[];M=a(M);var $=M.length,m=b,s=0,AD=k,jD=!0,ID=!1,aD=void 0;try{for(var MD=M[Symbol.iterator](),yD;!(jD=(yD=MD.next()).done);jD=!0){var rD=yD.value;if(rD<128)v.push(S(rD))}}catch(mF){ID=!0,aD=mF}finally{try{if(!jD&&MD.return)MD.return()}finally{if(ID)throw aD}}var kD=v.length,_D=kD;if(kD)v.push(I);while(_D<$){var fD=Z,wD=!0,$F=!1,_0=void 0;try{for(var x0=M[Symbol.iterator](),TD;!(wD=(TD=x0.next()).done);wD=!0){var O0=TD.value;if(O0>=m&&O0<fD)fD=O0}}catch(mF){$F=!0,_0=mF}finally{try{if(!wD&&x0.return)x0.return()}finally{if($F)throw _0}}var u0=_D+1;if(fD-m>w((Z-s)/u0))g("overflow");s+=(fD-m)*u0,m=fD;var WF=!0,hF=!1,ZF=void 0;try{for(var m2=M[Symbol.iterator](),$8;!(WF=($8=m2.next()).done);WF=!0){var h8=$8.value;if(h8<m&&++s>Z)g("overflow");if(h8==m){var B2=s;for(var Q2=H;;Q2+=H){var VF=Q2<=AD?V:Q2>=AD+N?N:Q2-AD;if(B2<VF)break;var X2=B2-VF,Q1=H-VF;v.push(S(XD(VF+X2%Q1,0))),B2=w(X2/Q1)}v.push(S(XD(B2,0))),AD=YD(s,u0,_D==kD),s=0,++_D}}}catch(mF){hF=!0,ZF=mF}finally{try{if(!WF&&m2.return)m2.return()}finally{if(hF)throw ZF}}++s,++m}return v.join("")},hD=function P(M){return n(M,function(v){return u.test(v)?FD(v.slice(4).toLowerCase()):v})},cD=function P(M){return n(M,function(v){return f.test(v)?"xn--"+LD(v):v})},j={version:"2.1.0",ucs2:{decode:a,encode:DD},decode:FD,encode:LD,toASCII:cD,toUnicode:hD},_={};function K(P){var M=P.charCodeAt(0),v=void 0;if(M<16)v="%0"+M.toString(16).toUpperCase();else if(M<128)v="%"+M.toString(16).toUpperCase();else if(M<2048)v="%"+(M>>6|192).toString(16).toUpperCase()+"%"+(M&63|128).toString(16).toUpperCase();else v="%"+(M>>12|224).toString(16).toUpperCase()+"%"+(M>>6&63|128).toString(16).toUpperCase()+"%"+(M&63|128).toString(16).toUpperCase();return v}function T(P){var M="",v=0,$=P.length;while(v<$){var m=parseInt(P.substr(v+1,2),16);if(m<128)M+=String.fromCharCode(m),v+=3;else if(m>=194&&m<224){if($-v>=6){var s=parseInt(P.substr(v+4,2),16);M+=String.fromCharCode((m&31)<<6|s&63)}else M+=P.substr(v,6);v+=6}else if(m>=224){if($-v>=9){var AD=parseInt(P.substr(v+4,2),16),jD=parseInt(P.substr(v+7,2),16);M+=String.fromCharCode((m&15)<<12|(AD&63)<<6|jD&63)}else M+=P.substr(v,9);v+=9}else M+=P.substr(v,3),v+=3}return M}function h(P,M){function v($){var m=T($);return!m.match(M.UNRESERVED)?$:m}if(P.scheme)P.scheme=String(P.scheme).replace(M.PCT_ENCODED,v).toLowerCase().replace(M.NOT_SCHEME,"");if(P.userinfo!==void 0)P.userinfo=String(P.userinfo).replace(M.PCT_ENCODED,v).replace(M.NOT_USERINFO,K).replace(M.PCT_ENCODED,X);if(P.host!==void 0)P.host=String(P.host).replace(M.PCT_ENCODED,v).toLowerCase().replace(M.NOT_HOST,K).replace(M.PCT_ENCODED,X);if(P.path!==void 0)P.path=String(P.path).replace(M.PCT_ENCODED,v).replace(P.scheme?M.NOT_PATH:M.NOT_PATH_NOSCHEME,K).replace(M.PCT_ENCODED,X);if(P.query!==void 0)P.query=String(P.query).replace(M.PCT_ENCODED,v).replace(M.NOT_QUERY,K).replace(M.PCT_ENCODED,X);if(P.fragment!==void 0)P.fragment=String(P.fragment).replace(M.PCT_ENCODED,v).replace(M.NOT_FRAGMENT,K).replace(M.PCT_ENCODED,X);return P}function c(P){return P.replace(/^0*(.*)/,"$1")||"0"}function l(P,M){var v=P.match(M.IPV4ADDRESS)||[],$=A(v,2),m=$[1];if(m)return m.split(".").map(c).join(".");else return P}function p(P,M){var v=P.match(M.IPV6ADDRESS)||[],$=A(v,3),m=$[1],s=$[2];if(m){var AD=m.toLowerCase().split("::").reverse(),jD=A(AD,2),ID=jD[0],aD=jD[1],MD=aD?aD.split(":").map(c):[],yD=ID.split(":").map(c),rD=M.IPV4ADDRESS.test(yD[yD.length-1]),kD=rD?7:8,_D=yD.length-kD,fD=Array(kD);for(var wD=0;wD<kD;++wD)fD[wD]=MD[wD]||yD[_D+wD]||"";if(rD)fD[kD-1]=l(fD[kD-1],M);var $F=fD.reduce(function(u0,WF,hF){if(!WF||WF==="0"){var ZF=u0[u0.length-1];if(ZF&&ZF.index+ZF.length===hF)ZF.length++;else u0.push({index:hF,length:1})}return u0},[]),_0=$F.sort(function(u0,WF){return WF.length-u0.length})[0],x0=void 0;if(_0&&_0.length>1){var TD=fD.slice(0,_0.index),O0=fD.slice(_0.index+_0.length);x0=TD.join(":")+"::"+O0.join(":")}else x0=fD.join(":");if(s)x0+="%"+s;return x0}else return P}var BD=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,qD="".match(/(){0}/)[1]===void 0;function JD(P){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},v={},$=M.iri!==!1?q:G;if(M.reference==="suffix")P=(M.scheme?M.scheme+":":"")+"//"+P;var m=P.match(BD);if(m){if(qD){if(v.scheme=m[1],v.userinfo=m[3],v.host=m[4],v.port=parseInt(m[5],10),v.path=m[6]||"",v.query=m[7],v.fragment=m[8],isNaN(v.port))v.port=m[5]}else if(v.scheme=m[1]||void 0,v.userinfo=P.indexOf("@")!==-1?m[3]:void 0,v.host=P.indexOf("//")!==-1?m[4]:void 0,v.port=parseInt(m[5],10),v.path=m[6]||"",v.query=P.indexOf("?")!==-1?m[7]:void 0,v.fragment=P.indexOf("#")!==-1?m[8]:void 0,isNaN(v.port))v.port=P.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?m[4]:void 0;if(v.host)v.host=p(l(v.host,$),$);if(v.scheme===void 0&&v.userinfo===void 0&&v.host===void 0&&v.port===void 0&&!v.path&&v.query===void 0)v.reference="same-document";else if(v.scheme===void 0)v.reference="relative";else if(v.fragment===void 0)v.reference="absolute";else v.reference="uri";if(M.reference&&M.reference!=="suffix"&&M.reference!==v.reference)v.error=v.error||"URI is not a "+M.reference+" reference.";var s=_[(M.scheme||v.scheme||"").toLowerCase()];if(!M.unicodeSupport&&(!s||!s.unicodeSupport)){if(v.host&&(M.domainHost||s&&s.domainHost))try{v.host=j.toASCII(v.host.replace($.PCT_ENCODED,T).toLowerCase())}catch(AD){v.error=v.error||"Host's domain name can not be converted to ASCII via punycode: "+AD}h(v,G)}else h(v,$);if(s&&s.parse)s.parse(v,M)}else v.error=v.error||"URI can not be parsed.";return v}function ZD(P,M){var v=M.iri!==!1?q:G,$=[];if(P.userinfo!==void 0)$.push(P.userinfo),$.push("@");if(P.host!==void 0)$.push(p(l(String(P.host),v),v).replace(v.IPV6ADDRESS,function(m,s,AD){return"["+s+(AD?"%25"+AD:"")+"]"}));if(typeof P.port==="number"||typeof P.port==="string")$.push(":"),$.push(String(P.port));return $.length?$.join(""):void 0}var PD=/^\.\.?\//,RD=/^\/\.(\/|$)/,Q0=/^\/\.\.(\/|$)/,mD=/^\/?(?:.|\n)*?(?=\/|$)/;function H0(P){var M=[];while(P.length)if(P.match(PD))P=P.replace(PD,"");else if(P.match(RD))P=P.replace(RD,"/");else if(P.match(Q0))P=P.replace(Q0,"/"),M.pop();else if(P==="."||P==="..")P="";else{var v=P.match(mD);if(v){var $=v[0];P=P.slice($.length),M.push($)}else throw new Error("Unexpected dot segment condition")}return M.join("")}function SD(P){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},v=M.iri?q:G,$=[],m=_[(M.scheme||P.scheme||"").toLowerCase()];if(m&&m.serialize)m.serialize(P,M);if(P.host){if(v.IPV6ADDRESS.test(P.host));else if(M.domainHost||m&&m.domainHost)try{P.host=!M.iri?j.toASCII(P.host.replace(v.PCT_ENCODED,T).toLowerCase()):j.toUnicode(P.host)}catch(jD){P.error=P.error||"Host's domain name can not be converted to "+(!M.iri?"ASCII":"Unicode")+" via punycode: "+jD}}if(h(P,v),M.reference!=="suffix"&&P.scheme)$.push(P.scheme),$.push(":");var s=ZD(P,M);if(s!==void 0){if(M.reference!=="suffix")$.push("//");if($.push(s),P.path&&P.path.charAt(0)!=="/")$.push("/")}if(P.path!==void 0){var AD=P.path;if(!M.absolutePath&&(!m||!m.absolutePath))AD=H0(AD);if(s===void 0)AD=AD.replace(/^\/\//,"/%2F");$.push(AD)}if(P.query!==void 0)$.push("?"),$.push(P.query);if(P.fragment!==void 0)$.push("#"),$.push(P.fragment);return $.join("")}function sD(P,M){var v=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},$=arguments[3],m={};if(!$)P=JD(SD(P,v),v),M=JD(SD(M,v),v);if(v=v||{},!v.tolerant&&M.scheme)m.scheme=M.scheme,m.userinfo=M.userinfo,m.host=M.host,m.port=M.port,m.path=H0(M.path||""),m.query=M.query;else{if(M.userinfo!==void 0||M.host!==void 0||M.port!==void 0)m.userinfo=M.userinfo,m.host=M.host,m.port=M.port,m.path=H0(M.path||""),m.query=M.query;else{if(!M.path)if(m.path=P.path,M.query!==void 0)m.query=M.query;else m.query=P.query;else{if(M.path.charAt(0)==="/")m.path=H0(M.path);else{if((P.userinfo!==void 0||P.host!==void 0||P.port!==void 0)&&!P.path)m.path="/"+M.path;else if(!P.path)m.path=M.path;else m.path=P.path.slice(0,P.path.lastIndexOf("/")+1)+M.path;m.path=H0(m.path)}m.query=M.query}m.userinfo=P.userinfo,m.host=P.host,m.port=P.port}m.scheme=P.scheme}return m.fragment=M.fragment,m}function v0(P,M,v){var $=z({scheme:"null"},v);return SD(sD(JD(P,$),JD(M,$),$,!0),$)}function R0(P,M){if(typeof P==="string")P=SD(JD(P,M),M);else if(J(P)==="object")P=JD(SD(P,M),M);return P}function g8(P,M,v){if(typeof P==="string")P=SD(JD(P,v),v);else if(J(P)==="object")P=SD(P,v);if(typeof M==="string")M=SD(JD(M,v),v);else if(J(M)==="object")M=SD(M,v);return P===M}function F1(P,M){return P&&P.toString().replace(!M||!M.iri?G.ESCAPE:q.ESCAPE,K)}function i0(P,M){return P&&P.toString().replace(!M||!M.iri?G.PCT_ENCODED:q.PCT_ENCODED,T)}var $2={scheme:"http",domainHost:!0,parse:function P(M,v){if(!M.host)M.error=M.error||"HTTP URIs must have a host.";return M},serialize:function P(M,v){var $=String(M.scheme).toLowerCase()==="https";if(M.port===($?443:80)||M.port==="")M.port=void 0;if(!M.path)M.path="/";return M}},L9={scheme:"https",domainHost:$2.domainHost,parse:$2.parse,serialize:$2.serialize};function M9(P){return typeof P.secure==="boolean"?P.secure:String(P.scheme).toLowerCase()==="wss"}var h2={scheme:"ws",domainHost:!0,parse:function P(M,v){var $=M;return $.secure=M9($),$.resourceName=($.path||"/")+($.query?"?"+$.query:""),$.path=void 0,$.query=void 0,$},serialize:function P(M,v){if(M.port===(M9(M)?443:80)||M.port==="")M.port=void 0;if(typeof M.secure==="boolean")M.scheme=M.secure?"wss":"ws",M.secure=void 0;if(M.resourceName){var $=M.resourceName.split("?"),m=A($,2),s=m[0],AD=m[1];M.path=s&&s!=="/"?s:void 0,M.query=AD,M.resourceName=void 0}return M.fragment=void 0,M}},N9={scheme:"wss",domainHost:h2.domainHost,parse:h2.parse,serialize:h2.serialize},QX={},XX=!0,j9="[A-Za-z0-9\\-\\.\\_\\~"+(XX?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",CF="[0-9A-Fa-f]",YX=Y(Y("%[EFef]"+CF+"%"+CF+CF+"%"+CF+CF)+"|"+Y("%[89A-Fa-f]"+CF+"%"+CF+CF)+"|"+Y("%"+CF+CF)),JX="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",CX="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",WX=B(CX,"[\\\"\\\\]"),zX="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",GX=new RegExp(j9,"g"),F2=new RegExp(YX,"g"),qX=new RegExp(B("[^]",JX,"[\\.]","[\\\"]",WX),"g"),R9=new RegExp(B("[^]",j9,zX),"g"),HX=R9;function B1(P){var M=T(P);return!M.match(GX)?P:M}var _9={scheme:"mailto",parse:function P(M,v){var $=M,m=$.to=$.path?$.path.split(","):[];if($.path=void 0,$.query){var s=!1,AD={},jD=$.query.split("&");for(var ID=0,aD=jD.length;ID<aD;++ID){var MD=jD[ID].split("=");switch(MD[0]){case"to":var yD=MD[1].split(",");for(var rD=0,kD=yD.length;rD<kD;++rD)m.push(yD[rD]);break;case"subject":$.subject=i0(MD[1],v);break;case"body":$.body=i0(MD[1],v);break;default:s=!0,AD[i0(MD[0],v)]=i0(MD[1],v);break}}if(s)$.headers=AD}$.query=void 0;for(var _D=0,fD=m.length;_D<fD;++_D){var wD=m[_D].split("@");if(wD[0]=i0(wD[0]),!v.unicodeSupport)try{wD[1]=j.toASCII(i0(wD[1],v).toLowerCase())}catch($F){$.error=$.error||"Email address's domain name can not be converted to ASCII via punycode: "+$F}else wD[1]=i0(wD[1],v).toLowerCase();m[_D]=wD.join("@")}return $},serialize:function P(M,v){var $=M,m=C(M.to);if(m){for(var s=0,AD=m.length;s<AD;++s){var jD=String(m[s]),ID=jD.lastIndexOf("@"),aD=jD.slice(0,ID).replace(F2,B1).replace(F2,X).replace(qX,K),MD=jD.slice(ID+1);try{MD=!v.iri?j.toASCII(i0(MD,v).toLowerCase()):j.toUnicode(MD)}catch(_D){$.error=$.error||"Email address's domain name can not be converted to "+(!v.iri?"ASCII":"Unicode")+" via punycode: "+_D}m[s]=aD+"@"+MD}$.path=m.join(",")}var yD=M.headers=M.headers||{};if(M.subject)yD.subject=M.subject;if(M.body)yD.body=M.body;var rD=[];for(var kD in yD)if(yD[kD]!==QX[kD])rD.push(kD.replace(F2,B1).replace(F2,X).replace(R9,K)+"="+yD[kD].replace(F2,B1).replace(F2,X).replace(HX,K));if(rD.length)$.query=rD.join("&");return $}},KX=/^([^\:]+)\:(.*)/,O9={scheme:"urn",parse:function P(M,v){var $=M.path&&M.path.match(KX),m=M;if($){var s=v.scheme||m.scheme||"urn",AD=$[1].toLowerCase(),jD=$[2],ID=s+":"+(v.nid||AD),aD=_[ID];if(m.nid=AD,m.nss=jD,m.path=void 0,aD)m=aD.parse(m,v)}else m.error=m.error||"URN can not be parsed.";return m},serialize:function P(M,v){var $=v.scheme||M.scheme||"urn",m=M.nid,s=$+":"+(v.nid||m),AD=_[s];if(AD)M=AD.serialize(M,v);var jD=M,ID=M.nss;return jD.path=(m||v.nid)+":"+ID,jD}},UX=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,I9={scheme:"urn:uuid",parse:function P(M,v){var $=M;if($.uuid=$.nss,$.nss=void 0,!v.tolerant&&(!$.uuid||!$.uuid.match(UX)))$.error=$.error||"UUID is not valid.";return $},serialize:function P(M,v){var $=M;return $.nss=(M.uuid||"").toLowerCase(),$}};_[$2.scheme]=$2,_[L9.scheme]=L9,_[h2.scheme]=h2,_[N9.scheme]=N9,_[_9.scheme]=_9,_[O9.scheme]=O9,_[I9.scheme]=I9,Q.SCHEMES=_,Q.pctEncChar=K,Q.pctDecChars=T,Q.parse=JD,Q.removeDotSegments=H0,Q.serialize=SD,Q.resolveComponents=sD,Q.resolve=v0,Q.normalize=R0,Q.equal=g8,Q.escapeComponent=F1,Q.unescapeComponent=i0,Object.defineProperty(Q,"__esModule",{value:!0})})}),G9=KD((D,F)=>{F.exports=function Q(B,Y){if(B===Y)return!0;if(B&&Y&&typeof B=="object"&&typeof Y=="object"){if(B.constructor!==Y.constructor)return!1;var J,X,C;if(Array.isArray(B)){if(J=B.length,J!=Y.length)return!1;for(X=J;X--!==0;)if(!Q(B[X],Y[X]))return!1;return!0}if(B.constructor===RegExp)return B.source===Y.source&&B.flags===Y.flags;if(B.valueOf!==Object.prototype.valueOf)return B.valueOf()===Y.valueOf();if(B.toString!==Object.prototype.toString)return B.toString()===Y.toString();if(C=Object.keys(B),J=C.length,J!==Object.keys(Y).length)return!1;for(X=J;X--!==0;)if(!Object.prototype.hasOwnProperty.call(Y,C[X]))return!1;for(X=J;X--!==0;){var z=C[X];if(!Q(B[z],Y[z]))return!1}return!0}return B!==B&&Y!==Y}}),Oq=KD((D,F)=>{F.exports=function Q(B){var Y=0,J=B.length,X=0,C;while(X<J)if(Y++,C=B.charCodeAt(X++),C>=55296&&C<=56319&&X<J){if(C=B.charCodeAt(X),(C&64512)==56320)X++}return Y}}),f2=KD((D,F)=>{F.exports={copy:Q,checkDataType:B,checkDataTypes:Y,coerceToTypes:X,toHash:C,getProperty:G,escapeQuotes:q,equal:G9(),ucs2length:Oq(),varOccurences:A,varReplace:U,schemaHasRules:Z,schemaHasRulesExcept:H,schemaUnknownRules:V,toQuotedString:N,getPathExpr:L,getPath:R,getData:I,unescapeFragment:f,unescapeJsonPointer:x,escapeFragment:O,escapeJsonPointer:y};function Q(w,S){S=S||{};for(var g in w)S[g]=w[g];return S}function B(w,S,g,d){var n=d?" !== ":" === ",a=d?" || ":" && ",DD=d?"!":"",o=d?"":"!";switch(w){case"null":return S+n+"null";case"array":return DD+"Array.isArray("+S+")";case"object":return"("+DD+S+a+"typeof "+S+n+'"object"'+a+o+"Array.isArray("+S+"))";case"integer":return"(typeof "+S+n+'"number"'+a+o+"("+S+" % 1)"+a+S+n+S+(g?a+DD+"isFinite("+S+")":"")+")";case"number":return"(typeof "+S+n+'"'+w+'"'+(g?a+DD+"isFinite("+S+")":"")+")";default:return"typeof "+S+n+'"'+w+'"'}}function Y(w,S,g){switch(w.length){case 1:return B(w[0],S,g,!0);default:var d="",n=C(w);if(n.array&&n.object)d=n.null?"(":"(!"+S+" || ",d+="typeof "+S+' !== "object")',delete n.null,delete n.array,delete n.object;if(n.number)delete n.integer;for(var a in n)d+=(d?" && ":"")+B(a,S,g,!0);return d}}var J=C(["string","number","integer","boolean","null"]);function X(w,S){if(Array.isArray(S)){var g=[];for(var d=0;d<S.length;d++){var n=S[d];if(J[n])g[g.length]=n;else if(w==="array"&&n==="array")g[g.length]=n}if(g.length)return g}else if(J[S])return[S];else if(w==="array"&&S==="array")return["array"]}function C(w){var S={};for(var g=0;g<w.length;g++)S[w[g]]=!0;return S}var z=/^[a-z$_][a-z$_0-9]*$/i,W=/'|\\/g;function G(w){return typeof w=="number"?"["+w+"]":z.test(w)?"."+w:"['"+q(w)+"']"}function q(w){return w.replace(W,"\\$&").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\f/g,"\\f").replace(/\t/g,"\\t")}function A(w,S){S+="[^0-9]";var g=w.match(new RegExp(S,"g"));return g?g.length:0}function U(w,S,g){return S+="([^0-9])",g=g.replace(/\$/g,"$$$$"),w.replace(new RegExp(S,"g"),g+"$1")}function Z(w,S){if(typeof w=="boolean")return!w;for(var g in w)if(S[g])return!0}function H(w,S,g){if(typeof w=="boolean")return!w&&g!="not";for(var d in w)if(d!=g&&S[d])return!0}function V(w,S){if(typeof w=="boolean")return;for(var g in w)if(!S[g])return g}function N(w){return"'"+q(w)+"'"}function L(w,S,g,d){var n=g?"'/' + "+S+(d?"":".replace(/~/g, '~0').replace(/\\//g, '~1')"):d?"'[' + "+S+" + ']'":"'[\\'' + "+S+" + '\\']'";return u(w,n)}function R(w,S,g){var d=g?N("/"+y(S)):N(G(S));return u(w,d)}var k=/^\/(?:[^~]|~0|~1)*$/,b=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function I(w,S,g){var d,n,a,DD;if(w==="")return"rootData";if(w[0]=="/"){if(!k.test(w))throw new Error("Invalid JSON-pointer: "+w);n=w,a="rootData"}else{if(DD=w.match(b),!DD)throw new Error("Invalid JSON-pointer: "+w);if(d=+DD[1],n=DD[2],n=="#"){if(d>=S)throw new Error("Cannot access property/index "+d+" levels up, current level is "+S);return g[S-d]}if(d>S)throw new Error("Cannot access data "+d+" levels up, current level is "+S);if(a="data"+(S-d||""),!n)return a}var o=a,XD=n.split("/");for(var YD=0;YD<XD.length;YD++){var FD=XD[YD];if(FD)a+=G(x(FD)),o+=" && "+a}return o}function u(w,S){if(w=='""')return S;return(w+" + "+S).replace(/([^\\])' \+ '/g,"$1")}function f(w){return x(decodeURIComponent(w))}function O(w){return encodeURIComponent(y(w))}function y(w){return w.replace(/~/g,"~0").replace(/\//g,"~1")}function x(w){return w.replace(/~1/g,"/").replace(/~0/g,"~")}}),CQ=KD((D,F)=>{var Q=f2();F.exports=B;function B(Y){Q.copy(Y,this)}}),Iq=KD((D,F)=>{var Q=F.exports=function(J,X,C){if(typeof X=="function")C=X,X={};C=X.cb||C;var z=typeof C=="function"?C:C.pre||function(){},W=C.post||function(){};B(X,z,W,J,"",J)};Q.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0},Q.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},Q.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},Q.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function B(J,X,C,z,W,G,q,A,U,Z){if(z&&typeof z=="object"&&!Array.isArray(z)){X(z,W,G,q,A,U,Z);for(var H in z){var V=z[H];if(Array.isArray(V)){if(H in Q.arrayKeywords)for(var N=0;N<V.length;N++)B(J,X,C,V[N],W+"/"+H+"/"+N,G,W,H,z,N)}else if(H in Q.propsKeywords){if(V&&typeof V=="object")for(var L in V)B(J,X,C,V[L],W+"/"+H+"/"+Y(L),G,W,H,z,L)}else if(H in Q.keywords||J.allKeys&&!(H in Q.skipKeywords))B(J,X,C,V,W+"/"+H,G,W,H,z)}C(z,W,G,q,A,U,Z)}}function Y(J){return J.replace(/~/g,"~0").replace(/\//g,"~1")}}),q9=KD((D,F)=>{var Q=_q(),B=G9(),Y=f2(),J=CQ(),X=Iq();F.exports=C,C.normalizeId=R,C.fullPath=V,C.url=k,C.ids=b,C.inlineRef=U,C.schema=z;function C(I,u,f){var O=this._refs[f];if(typeof O=="string")if(this._refs[O])O=this._refs[O];else return C.call(this,I,u,O);if(O=O||this._schemas[f],O instanceof J)return U(O.schema,this._opts.inlineRefs)?O.schema:O.validate||this._compile(O);var y=z.call(this,u,f),x,w,S;if(y)x=y.schema,u=y.root,S=y.baseId;if(x instanceof J)w=x.validate||I.call(this,x.schema,u,void 0,S);else if(x!==void 0)w=U(x,this._opts.inlineRefs)?x:I.call(this,x,u,void 0,S);return w}function z(I,u){var f=Q.parse(u),O=N(f),y=V(this._getId(I.schema));if(Object.keys(I.schema).length===0||O!==y){var x=R(O),w=this._refs[x];if(typeof w=="string")return W.call(this,I,w,f);else if(w instanceof J){if(!w.validate)this._compile(w);I=w}else if(w=this._schemas[x],w instanceof J){if(!w.validate)this._compile(w);if(x==R(u))return{schema:w,root:I,baseId:y};I=w}else return;if(!I.schema)return;y=V(this._getId(I.schema))}return q.call(this,f,y,I.schema,I)}function W(I,u,f){var O=z.call(this,I,u);if(O){var{schema:y,baseId:x}=O;I=O.root;var w=this._getId(y);if(w)x=k(x,w);return q.call(this,f,x,y,I)}}var G=Y.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function q(I,u,f,O){if(I.fragment=I.fragment||"",I.fragment.slice(0,1)!="/")return;var y=I.fragment.split("/");for(var x=1;x<y.length;x++){var w=y[x];if(w){if(w=Y.unescapeFragment(w),f=f[w],f===void 0)break;var S;if(!G[w]){if(S=this._getId(f),S)u=k(u,S);if(f.$ref){var g=k(u,f.$ref),d=z.call(this,O,g);if(d)f=d.schema,O=d.root,u=d.baseId}}}}if(f!==void 0&&f!==O.schema)return{schema:f,root:O,baseId:u}}var A=Y.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function U(I,u){if(u===!1)return!1;if(u===void 0||u===!0)return Z(I);else if(u)return H(I)<=u}function Z(I){var u;if(Array.isArray(I)){for(var f=0;f<I.length;f++)if(u=I[f],typeof u=="object"&&!Z(u))return!1}else for(var O in I){if(O=="$ref")return!1;if(u=I[O],typeof u=="object"&&!Z(u))return!1}return!0}function H(I){var u=0,f;if(Array.isArray(I))for(var O=0;O<I.length;O++){if(f=I[O],typeof f=="object")u+=H(f);if(u==1/0)return 1/0}else for(var y in I){if(y=="$ref")return 1/0;if(A[y])u++;else{if(f=I[y],typeof f=="object")u+=H(f)+1;if(u==1/0)return 1/0}}return u}function V(I,u){if(u!==!1)I=R(I);var f=Q.parse(I);return N(f)}function N(I){return Q.serialize(I).split("#")[0]+"#"}var L=/#\/?$/;function R(I){return I?I.replace(L,""):""}function k(I,u){return u=R(u),Q.resolve(I,u)}function b(I){var u=R(this._getId(I)),f={"":u},O={"":V(u,!1)},y={},x=this;return X(I,{allKeys:!0},function(w,S,g,d,n,a,DD){if(S==="")return;var o=x._getId(w),XD=f[d],YD=O[d]+"/"+n;if(DD!==void 0)YD+="/"+(typeof DD=="number"?DD:Y.escapeFragment(DD));if(typeof o=="string"){o=XD=R(XD?Q.resolve(XD,o):o);var FD=x._refs[o];if(typeof FD=="string")FD=x._refs[FD];if(FD&&FD.schema){if(!B(w,FD.schema))throw new Error('id "'+o+'" resolves to more than one schema')}else if(o!=R(YD))if(o[0]=="#"){if(y[o]&&!B(w,y[o]))throw new Error('id "'+o+'" resolves to more than one schema');y[o]=w}else x._refs[o]=YD}f[S]=XD,O[S]=YD}),y}}),H9=KD((D,F)=>{var Q=q9();F.exports={Validation:J(B),MissingRef:J(Y)};function B(X){this.message="validation failed",this.errors=X,this.ajv=this.validation=!0}Y.message=function(X,C){return"can't resolve reference "+C+" from id "+X};function Y(X,C,z){this.message=z||Y.message(X,C),this.missingRef=Q.url(X,C),this.missingSchema=Q.normalizeId(Q.fullPath(this.missingRef))}function J(X){return X.prototype=Object.create(Error.prototype),X.prototype.constructor=X,X}}),WQ=KD((D,F)=>{F.exports=function(Q,B){if(!B)B={};if(typeof B==="function")B={cmp:B};var Y=typeof B.cycles==="boolean"?B.cycles:!1,J=B.cmp&&function(C){return function(z){return function(W,G){var q={key:W,value:z[W]},A={key:G,value:z[G]};return C(q,A)}}}(B.cmp),X=[];return function C(z){if(z&&z.toJSON&&typeof z.toJSON==="function")z=z.toJSON();if(z===void 0)return;if(typeof z=="number")return isFinite(z)?""+z:"null";if(typeof z!=="object")return JSON.stringify(z);var W,G;if(Array.isArray(z)){G="[";for(W=0;W<z.length;W++){if(W)G+=",";G+=C(z[W])||"null"}return G+"]"}if(z===null)return"null";if(X.indexOf(z)!==-1){if(Y)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var q=X.push(z)-1,A=Object.keys(z).sort(J&&J(z));G="";for(W=0;W<A.length;W++){var U=A[W],Z=C(z[U]);if(!Z)continue;if(G)G+=",";G+=JSON.stringify(U)+":"+Z}return X.splice(q,1),"{"+G+"}"}(Q)}}),zQ=KD((D,F)=>{F.exports=function Q(B,Y,J){var X="",C=B.schema.$async===!0,z=B.util.schemaHasRulesExcept(B.schema,B.RULES.all,"$ref"),W=B.self._getId(B.schema);if(B.opts.strictKeywords){var G=B.util.schemaUnknownRules(B.schema,B.RULES.keywords);if(G){var q="unknown keyword: "+G;if(B.opts.strictKeywords==="log")B.logger.warn(q);else throw new Error(q)}}if(B.isTop){if(X+=" var validate = ",C)B.async=!0,X+="async ";if(X+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",W&&(B.opts.sourceCode||B.opts.processCode))X+=" "+("/*# sourceURL="+W+" */")+" "}if(typeof B.schema=="boolean"||!(z||B.schema.$ref)){var Y="false schema",A=B.level,U=B.dataLevel,Z=B.schema[Y],H=B.schemaPath+B.util.getProperty(Y),V=B.errSchemaPath+"/"+Y,u=!B.opts.allErrors,y,N="data"+(U||""),I="valid"+A;if(B.schema===!1){if(B.isTop)u=!0;else X+=" var "+I+" = false; ";var L=L||[];if(L.push(X),X="",B.createErrors!==!1){if(X+=" { keyword: '"+(y||"false schema")+"' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(V)+" , params: {} ",B.opts.messages!==!1)X+=" , message: 'boolean schema is false' ";if(B.opts.verbose)X+=" , schema: false , parentSchema: validate.schema"+B.schemaPath+" , data: "+N+" ";X+=" } "}else X+=" {} ";var R=X;if(X=L.pop(),!B.compositeRule&&u)if(B.async)X+=" throw new ValidationError(["+R+"]); ";else X+=" validate.errors = ["+R+"]; return false; ";else X+=" var err = "+R+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else if(B.isTop)if(C)X+=" return data; ";else X+=" validate.errors = null; return true; ";else X+=" var "+I+" = true; ";if(B.isTop)X+=" }; return validate; ";return X}if(B.isTop){var k=B.isTop,A=B.level=0,U=B.dataLevel=0,N="data";if(B.rootId=B.resolve.fullPath(B.self._getId(B.root.schema)),B.baseId=B.baseId||B.rootId,delete B.isTop,B.dataPathArr=[""],B.schema.default!==void 0&&B.opts.useDefaults&&B.opts.strictDefaults){var b="default is ignored in the schema root";if(B.opts.strictDefaults==="log")B.logger.warn(b);else throw new Error(b)}X+=" var vErrors = null; ",X+=" var errors = 0; ",X+=" if (rootData === undefined) rootData = data; "}else{var{level:A,dataLevel:U}=B,N="data"+(U||"");if(W)B.baseId=B.resolve.url(B.baseId,W);if(C&&!B.async)throw new Error("async schema in sync schema");X+=" var errs_"+A+" = errors;"}var I="valid"+A,u=!B.opts.allErrors,f="",O="",y,x=B.schema.type,w=Array.isArray(x);if(x&&B.opts.nullable&&B.schema.nullable===!0){if(w){if(x.indexOf("null")==-1)x=x.concat("null")}else if(x!="null")x=[x,"null"],w=!0}if(w&&x.length==1)x=x[0],w=!1;if(B.schema.$ref&&z){if(B.opts.extendRefs=="fail")throw new Error('$ref: validation keywords used in schema at path "'+B.errSchemaPath+'" (see option extendRefs)');else if(B.opts.extendRefs!==!0)z=!1,B.logger.warn('$ref: keywords ignored in schema at path "'+B.errSchemaPath+'"')}if(B.schema.$comment&&B.opts.$comment)X+=" "+B.RULES.all.$comment.code(B,"$comment");if(x){if(B.opts.coerceTypes)var S=B.util.coerceToTypes(B.opts.coerceTypes,x);var g=B.RULES.types[x];if(S||w||g===!0||g&&!mD(g)){var H=B.schemaPath+".type",V=B.errSchemaPath+"/type",H=B.schemaPath+".type",V=B.errSchemaPath+"/type",d=w?"checkDataTypes":"checkDataType";if(X+=" if ("+B.util[d](x,N,B.opts.strictNumbers,!0)+") { ",S){var n="dataType"+A,a="coerced"+A;if(X+=" var "+n+" = typeof "+N+"; var "+a+" = undefined; ",B.opts.coerceTypes=="array")X+=" if ("+n+" == 'object' && Array.isArray("+N+") && "+N+".length == 1) { "+N+" = "+N+"[0]; "+n+" = typeof "+N+"; if ("+B.util.checkDataType(B.schema.type,N,B.opts.strictNumbers)+") "+a+" = "+N+"; } ";X+=" if ("+a+" !== undefined) ; ";var DD=S;if(DD){var o,XD=-1,YD=DD.length-1;while(XD<YD)if(o=DD[XD+=1],o=="string")X+=" else if ("+n+" == 'number' || "+n+" == 'boolean') "+a+" = '' + "+N+"; else if ("+N+" === null) "+a+" = ''; ";else if(o=="number"||o=="integer"){if(X+=" else if ("+n+" == 'boolean' || "+N+" === null || ("+n+" == 'string' && "+N+" && "+N+" == +"+N+" ",o=="integer")X+=" && !("+N+" % 1)";X+=")) "+a+" = +"+N+"; "}else if(o=="boolean")X+=" else if ("+N+" === 'false' || "+N+" === 0 || "+N+" === null) "+a+" = false; else if ("+N+" === 'true' || "+N+" === 1) "+a+" = true; ";else if(o=="null")X+=" else if ("+N+" === '' || "+N+" === 0 || "+N+" === false) "+a+" = null; ";else if(B.opts.coerceTypes=="array"&&o=="array")X+=" else if ("+n+" == 'string' || "+n+" == 'number' || "+n+" == 'boolean' || "+N+" == null) "+a+" = ["+N+"]; "}X+=" else { ";var L=L||[];if(L.push(X),X="",B.createErrors!==!1){if(X+=" { keyword: '"+(y||"type")+"' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(V)+" , params: { type: '",w)X+=""+x.join(",");else X+=""+x;if(X+="' } ",B.opts.messages!==!1){if(X+=" , message: 'should be ",w)X+=""+x.join(",");else X+=""+x;X+="' "}if(B.opts.verbose)X+=" , schema: validate.schema"+H+" , parentSchema: validate.schema"+B.schemaPath+" , data: "+N+" ";X+=" } "}else X+=" {} ";var R=X;if(X=L.pop(),!B.compositeRule&&u)if(B.async)X+=" throw new ValidationError(["+R+"]); ";else X+=" validate.errors = ["+R+"]; return false; ";else X+=" var err = "+R+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";X+=" } if ("+a+" !== undefined) { ";var FD=U?"data"+(U-1||""):"parentData",LD=U?B.dataPathArr[U]:"parentDataProperty";if(X+=" "+N+" = "+a+"; ",!U)X+="if ("+FD+" !== undefined)";X+=" "+FD+"["+LD+"] = "+a+"; } "}else{var L=L||[];if(L.push(X),X="",B.createErrors!==!1){if(X+=" { keyword: '"+(y||"type")+"' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(V)+" , params: { type: '",w)X+=""+x.join(",");else X+=""+x;if(X+="' } ",B.opts.messages!==!1){if(X+=" , message: 'should be ",w)X+=""+x.join(",");else X+=""+x;X+="' "}if(B.opts.verbose)X+=" , schema: validate.schema"+H+" , parentSchema: validate.schema"+B.schemaPath+" , data: "+N+" ";X+=" } "}else X+=" {} ";var R=X;if(X=L.pop(),!B.compositeRule&&u)if(B.async)X+=" throw new ValidationError(["+R+"]); ";else X+=" validate.errors = ["+R+"]; return false; ";else X+=" var err = "+R+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}X+=" } "}}if(B.schema.$ref&&!z){if(X+=" "+B.RULES.all.$ref.code(B,"$ref")+" ",u){if(X+=" } if (errors === ",k)X+="0";else X+="errs_"+A;X+=") { ",O+="}"}}else{var hD=B.RULES;if(hD){var g,cD=-1,j=hD.length-1;while(cD<j)if(g=hD[cD+=1],mD(g)){if(g.type)X+=" if ("+B.util.checkDataType(g.type,N,B.opts.strictNumbers)+") { ";if(B.opts.useDefaults){if(g.type=="object"&&B.schema.properties){var Z=B.schema.properties,_=Object.keys(Z),K=_;if(K){var T,h=-1,c=K.length-1;while(h<c){T=K[h+=1];var l=Z[T];if(l.default!==void 0){var p=N+B.util.getProperty(T);if(B.compositeRule){if(B.opts.strictDefaults){var b="default is ignored for: "+p;if(B.opts.strictDefaults==="log")B.logger.warn(b);else throw new Error(b)}}else{if(X+=" if ("+p+" === undefined ",B.opts.useDefaults=="empty")X+=" || "+p+" === null || "+p+" === '' ";if(X+=" ) "+p+" = ",B.opts.useDefaults=="shared")X+=" "+B.useDefault(l.default)+" ";else X+=" "+JSON.stringify(l.default)+" ";X+="; "}}}}}else if(g.type=="array"&&Array.isArray(B.schema.items)){var BD=B.schema.items;if(BD){var l,XD=-1,qD=BD.length-1;while(XD<qD)if(l=BD[XD+=1],l.default!==void 0){var p=N+"["+XD+"]";if(B.compositeRule){if(B.opts.strictDefaults){var b="default is ignored for: "+p;if(B.opts.strictDefaults==="log")B.logger.warn(b);else throw new Error(b)}}else{if(X+=" if ("+p+" === undefined ",B.opts.useDefaults=="empty")X+=" || "+p+" === null || "+p+" === '' ";if(X+=" ) "+p+" = ",B.opts.useDefaults=="shared")X+=" "+B.useDefault(l.default)+" ";else X+=" "+JSON.stringify(l.default)+" ";X+="; "}}}}}var JD=g.rules;if(JD){var ZD,PD=-1,RD=JD.length-1;while(PD<RD)if(ZD=JD[PD+=1],H0(ZD)){var Q0=ZD.code(B,ZD.keyword,g.type);if(Q0){if(X+=" "+Q0+" ",u)f+="}"}}}if(u)X+=" "+f+" ",f="";if(g.type){if(X+=" } ",x&&x===g.type&&!S){X+=" else { ";var H=B.schemaPath+".type",V=B.errSchemaPath+"/type",L=L||[];if(L.push(X),X="",B.createErrors!==!1){if(X+=" { keyword: '"+(y||"type")+"' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(V)+" , params: { type: '",w)X+=""+x.join(",");else X+=""+x;if(X+="' } ",B.opts.messages!==!1){if(X+=" , message: 'should be ",w)X+=""+x.join(",");else X+=""+x;X+="' "}if(B.opts.verbose)X+=" , schema: validate.schema"+H+" , parentSchema: validate.schema"+B.schemaPath+" , data: "+N+" ";X+=" } "}else X+=" {} ";var R=X;if(X=L.pop(),!B.compositeRule&&u)if(B.async)X+=" throw new ValidationError(["+R+"]); ";else X+=" validate.errors = ["+R+"]; return false; ";else X+=" var err = "+R+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";X+=" } "}}if(u){if(X+=" if (errors === ",k)X+="0";else X+="errs_"+A;X+=") { ",O+="}"}}}}if(u)X+=" "+O+" ";if(k){if(C)X+=" if (errors === 0) return data; ",X+=" else throw new ValidationError(vErrors); ";else X+=" validate.errors = vErrors; ",X+=" return errors === 0; ";X+=" }; return validate;"}else X+=" var "+I+" = errors === errs_"+A+";";function mD(sD){var v0=sD.rules;for(var R0=0;R0<v0.length;R0++)if(H0(v0[R0]))return!0}function H0(sD){return B.schema[sD.keyword]!==void 0||sD.implements&&SD(sD)}function SD(sD){var v0=sD.implements;for(var R0=0;R0<v0.length;R0++)if(B.schema[v0[R0]]!==void 0)return!0}return X}}),wq=KD((D,F)=>{var Q=q9(),B=f2(),Y=H9(),J=WQ(),X=zQ(),C=B.ucs2length,z=G9(),W=Y.Validation;F.exports=G;function G(R,k,b,I){var u=this,f=this._opts,O=[void 0],y={},x=[],w={},S=[],g={},d=[];k=k||{schema:R,refVal:O,refs:y};var n=q.call(this,R,k,I),a=this._compilations[n.index];if(n.compiling)return a.callValidate=FD;var DD=this._formats,o=this.RULES;try{var XD=LD(R,k,b,I);a.validate=XD;var YD=a.callValidate;if(YD){if(YD.schema=XD.schema,YD.errors=null,YD.refs=XD.refs,YD.refVal=XD.refVal,YD.root=XD.root,YD.$async=XD.$async,f.sourceCode)YD.source=XD.source}return XD}finally{A.call(this,R,k,I)}function FD(){var l=a.validate,p=l.apply(this,arguments);return FD.errors=l.errors,p}function LD(l,p,BD,qD){var JD=!p||p&&p.schema==l;if(p.schema!=k.schema)return G.call(u,l,p,BD,qD);var ZD=l.$async===!0,PD=X({isTop:!0,schema:l,isRoot:JD,baseId:qD,root:p,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:Y.MissingRef,RULES:o,validate:X,util:B,resolve:Q,resolveRef:hD,usePattern:T,useDefault:h,useCustomRule:c,opts:f,formats:DD,logger:u.logger,self:u});if(PD=L(O,V)+L(x,Z)+L(S,H)+L(d,N)+PD,f.processCode)PD=f.processCode(PD,l);var RD;try{var Q0=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",PD);RD=Q0(u,o,DD,k,O,S,d,z,C,W),O[0]=RD}catch(mD){throw u.logger.error("Error compiling schema, function code:",PD),mD}if(RD.schema=l,RD.errors=null,RD.refs=y,RD.refVal=O,RD.root=JD?RD:p,ZD)RD.$async=!0;if(f.sourceCode===!0)RD.source={code:PD,patterns:x,defaults:S};return RD}function hD(l,p,BD){p=Q.url(l,p);var qD=y[p],JD,ZD;if(qD!==void 0)return JD=O[qD],ZD="refVal["+qD+"]",K(JD,ZD);if(!BD&&k.refs){var PD=k.refs[p];if(PD!==void 0)return JD=k.refVal[PD],ZD=cD(p,JD),K(JD,ZD)}ZD=cD(p);var RD=Q.call(u,LD,k,p);if(RD===void 0){var Q0=b&&b[p];if(Q0)RD=Q.inlineRef(Q0,f.inlineRefs)?Q0:G.call(u,Q0,k,b,l)}if(RD===void 0)j(p);else return _(p,RD),K(RD,ZD)}function cD(l,p){var BD=O.length;return O[BD]=p,y[l]=BD,"refVal"+BD}function j(l){delete y[l]}function _(l,p){var BD=y[l];O[BD]=p}function K(l,p){return typeof l=="object"||typeof l=="boolean"?{code:p,schema:l,inline:!0}:{code:p,$async:l&&!!l.$async}}function T(l){var p=w[l];if(p===void 0)p=w[l]=x.length,x[p]=l;return"pattern"+p}function h(l){switch(typeof l){case"boolean":case"number":return""+l;case"string":return B.toQuotedString(l);case"object":if(l===null)return"null";var p=J(l),BD=g[p];if(BD===void 0)BD=g[p]=S.length,S[BD]=l;return"default"+BD}}function c(l,p,BD,qD){if(u._opts.validateSchema!==!1){var JD=l.definition.dependencies;if(JD&&!JD.every(function(v0){return Object.prototype.hasOwnProperty.call(BD,v0)}))throw new Error("parent schema must have all required keywords: "+JD.join(","));var ZD=l.definition.validateSchema;if(ZD){var PD=ZD(p);if(!PD){var RD="keyword schema is invalid: "+u.errorsText(ZD.errors);if(u._opts.validateSchema=="log")u.logger.error(RD);else throw new Error(RD)}}}var Q0=l.definition.compile,mD=l.definition.inline,H0=l.definition.macro,SD;if(Q0)SD=Q0.call(u,p,BD,qD);else if(H0){if(SD=H0.call(u,p,BD,qD),f.validateSchema!==!1)u.validateSchema(SD,!0)}else if(mD)SD=mD.call(u,qD,l.keyword,p,BD);else if(SD=l.definition.validate,!SD)return;if(SD===void 0)throw new Error('custom keyword "'+l.keyword+'"failed to compile');var sD=d.length;return d[sD]=SD,{code:"customRule"+sD,validate:SD}}}function q(R,k,b){var I=U.call(this,R,k,b);if(I>=0)return{index:I,compiling:!0};return I=this._compilations.length,this._compilations[I]={schema:R,root:k,baseId:b},{index:I,compiling:!1}}function A(R,k,b){var I=U.call(this,R,k,b);if(I>=0)this._compilations.splice(I,1)}function U(R,k,b){for(var I=0;I<this._compilations.length;I++){var u=this._compilations[I];if(u.schema==R&&u.root==k&&u.baseId==b)return I}return-1}function Z(R,k){return"var pattern"+R+" = new RegExp("+B.toQuotedString(k[R])+");"}function H(R){return"var default"+R+" = defaults["+R+"];"}function V(R,k){return k[R]===void 0?"":"var refVal"+R+" = refVal["+R+"];"}function N(R){return"var customRule"+R+" = customRules["+R+"];"}function L(R,k){if(!R.length)return"";var b="";for(var I=0;I<R.length;I++)b+=k(I,R);return b}}),Tq=KD((D,F)=>{var Q=F.exports=function B(){this._cache={}};Q.prototype.put=function B(Y,J){this._cache[Y]=J},Q.prototype.get=function B(Y){return this._cache[Y]},Q.prototype.del=function B(Y){delete this._cache[Y]},Q.prototype.clear=function B(){this._cache={}}}),Pq=KD((D,F)=>{var Q=f2(),B=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,Y=[0,31,28,31,30,31,30,31,31,30,31,30,31],J=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,X=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,C=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,z=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,W=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,G=/^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i,q=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,A=/^(?:\/(?:[^~/]|~0|~1)*)*$/,U=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,Z=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;F.exports=H;function H(O){return O=O=="full"?"full":"fast",Q.copy(H[O])}H.fast={date:/^\d\d\d\d-[0-1]\d-[0-3]\d$/,time:/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,"date-time":/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,"uri-template":W,url:G,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,hostname:X,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:f,uuid:q,"json-pointer":A,"json-pointer-uri-fragment":U,"relative-json-pointer":Z},H.full={date:N,time:L,"date-time":k,uri:I,"uri-reference":z,"uri-template":W,url:G,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:X,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:f,uuid:q,"json-pointer":A,"json-pointer-uri-fragment":U,"relative-json-pointer":Z};function V(O){return O%4===0&&(O%100!==0||O%400===0)}function N(O){var y=O.match(B);if(!y)return!1;var x=+y[1],w=+y[2],S=+y[3];return w>=1&&w<=12&&S>=1&&S<=(w==2&&V(x)?29:Y[w])}function L(O,y){var x=O.match(J);if(!x)return!1;var w=x[1],S=x[2],g=x[3],d=x[5];return(w<=23&&S<=59&&g<=59||w==23&&S==59&&g==60)&&(!y||d)}var R=/t|\s/i;function k(O){var y=O.split(R);return y.length==2&&N(y[0])&&L(y[1],!0)}var b=/\/|:/;function I(O){return b.test(O)&&C.test(O)}var u=/[^\\]\\Z/;function f(O){if(u.test(O))return!1;try{return new RegExp(O),!0}catch(y){return!1}}}),Sq=KD((D,F)=>{F.exports=function Q(B,Y,J){var X=" ",C=B.level,z=B.dataLevel,W=B.schema[Y],G=B.errSchemaPath+"/"+Y,q=!B.opts.allErrors,A="data"+(z||""),U="valid"+C,Z,H;if(W=="#"||W=="#/")if(B.isRoot)Z=B.async,H="validate";else Z=B.root.schema.$async===!0,H="root.refVal[0]";else{var V=B.resolveRef(B.baseId,W,B.isRoot);if(V===void 0){var N=B.MissingRefError.message(B.baseId,W);if(B.opts.missingRefs=="fail"){B.logger.error(N);var L=L||[];if(L.push(X),X="",B.createErrors!==!1){if(X+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(G)+" , params: { ref: '"+B.util.escapeQuotes(W)+"' } ",B.opts.messages!==!1)X+=" , message: 'can\\'t resolve reference "+B.util.escapeQuotes(W)+"' ";if(B.opts.verbose)X+=" , schema: "+B.util.toQuotedString(W)+" , parentSchema: validate.schema"+B.schemaPath+" , data: "+A+" ";X+=" } "}else X+=" {} ";var R=X;if(X=L.pop(),!B.compositeRule&&q)if(B.async)X+=" throw new ValidationError(["+R+"]); ";else X+=" validate.errors = ["+R+"]; return false; ";else X+=" var err = "+R+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(q)X+=" if (false) { "}else if(B.opts.missingRefs=="ignore"){if(B.logger.warn(N),q)X+=" if (true) { "}else throw new B.MissingRefError(B.baseId,W,N)}else if(V.inline){var k=B.util.copy(B);k.level++;var b="valid"+k.level;k.schema=V.schema,k.schemaPath="",k.errSchemaPath=W;var I=B.validate(k).replace(/validate\.schema/g,V.code);if(X+=" "+I+" ",q)X+=" if ("+b+") { "}else Z=V.$async===!0||B.async&&V.$async!==!1,H=V.code}if(H){var L=L||[];if(L.push(X),X="",B.opts.passContext)X+=" "+H+".call(this, ";else X+=" "+H+"( ";if(X+=" "+A+", (dataPath || '')",B.errorPath!='""')X+=" + "+B.errorPath;var u=z?"data"+(z-1||""):"parentData",f=z?B.dataPathArr[z]:"parentDataProperty";X+=" , "+u+" , "+f+", rootData) ";var O=X;if(X=L.pop(),Z){if(!B.async)throw new Error("async schema referenced by sync schema");if(q)X+=" var "+U+"; ";if(X+=" try { await "+O+"; ",q)X+=" "+U+" = true; ";if(X+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",q)X+=" "+U+" = false; ";if(X+=" } ",q)X+=" if ("+U+") { "}else if(X+=" if (!"+O+") { if (vErrors === null) vErrors = "+H+".errors; else vErrors = vErrors.concat("+H+".errors); errors = vErrors.length; } ",q)X+=" else { "}return X}}),kq=KD((D,F)=>{F.exports=function Q(B,Y,J){var X=" ",C=B.schema[Y],z=B.schemaPath+B.util.getProperty(Y),W=B.errSchemaPath+"/"+Y,G=!B.opts.allErrors,q=B.util.copy(B),A="";q.level++;var U="valid"+q.level,Z=q.baseId,H=!0,V=C;if(V){var N,L=-1,R=V.length-1;while(L<R)if(N=V[L+=1],B.opts.strictKeywords?typeof N=="object"&&Object.keys(N).length>0||N===!1:B.util.schemaHasRules(N,B.RULES.all)){if(H=!1,q.schema=N,q.schemaPath=z+"["+L+"]",q.errSchemaPath=W+"/"+L,X+=" "+B.validate(q)+" ",q.baseId=Z,G)X+=" if ("+U+") { ",A+="}"}}if(G)if(H)X+=" if (true) { ";else X+=" "+A.slice(0,-1)+" ";return X}}),bq=KD((D,F)=>{F.exports=function Q(B,Y,J){var X=" ",C=B.level,z=B.dataLevel,W=B.schema[Y],G=B.schemaPath+B.util.getProperty(Y),q=B.errSchemaPath+"/"+Y,A=!B.opts.allErrors,U="data"+(z||""),Z="valid"+C,H="errs__"+C,V=B.util.copy(B),N="";V.level++;var L="valid"+V.level,R=W.every(function(y){return B.opts.strictKeywords?typeof y=="object"&&Object.keys(y).length>0||y===!1:B.util.schemaHasRules(y,B.RULES.all)});if(R){var k=V.baseId;X+=" var "+H+" = errors; var "+Z+" = false; ";var b=B.compositeRule;B.compositeRule=V.compositeRule=!0;var I=W;if(I){var u,f=-1,O=I.length-1;while(f<O)u=I[f+=1],V.schema=u,V.schemaPath=G+"["+f+"]",V.errSchemaPath=q+"/"+f,X+=" "+B.validate(V)+" ",V.baseId=k,X+=" "+Z+" = "+Z+" || "+L+"; if (!"+Z+") { ",N+="}"}if(B.compositeRule=V.compositeRule=b,X+=" "+N+" if (!"+Z+") { var err = ",B.createErrors!==!1){if(X+=" { keyword: 'anyOf' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(q)+" , params: {} ",B.opts.messages!==!1)X+=" , message: 'should match some schema in anyOf' ";if(B.opts.verbose)X+=" , schema: validate.schema"+G+" , parentSchema: validate.schema"+B.schemaPath+" , data: "+U+" ";X+=" } "}else X+=" {} ";if(X+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!B.compositeRule&&A)if(B.async)X+=" throw new ValidationError(vErrors); ";else X+=" validate.errors = vErrors; return false; ";if(X+=" } else { errors = "+H+"; if (vErrors !== null) { if ("+H+") vErrors.length = "+H+"; else vErrors = null; } ",B.opts.allErrors)X+=" } "}else if(A)X+=" if (true) { ";return X}}),vq=KD((D,F)=>{F.exports=function Q(B,Y,J){var X=" ",C=B.schema[Y],z=B.errSchemaPath+"/"+Y,W=!B.opts.allErrors,G=B.util.toQuotedString(C);if(B.opts.$comment===!0)X+=" console.log("+G+");";else if(typeof B.opts.$comment=="function")X+=" self._opts.$comment("+G+", "+B.util.toQuotedString(z)+", validate.root.schema);";return X}}),xq=KD((D,F)=>{F.exports=function Q(B,Y,J){var X=" ",C=B.level,z=B.dataLevel,W=B.schema[Y],G=B.schemaPath+B.util.getProperty(Y),q=B.errSchemaPath+"/"+Y,A=!B.opts.allErrors,U="data"+(z||""),Z="valid"+C,H=B.opts.$data&&W&&W.$data,V;if(H)X+=" var schema"+C+" = "+B.util.getData(W.$data,z,B.dataPathArr)+"; ",V="schema"+C;else V=W;if(!H)X+=" var schema"+C+" = validate.schema"+G+";";X+="var "+Z+" = equal("+U+", schema"+C+"); if (!"+Z+") { ";var N=N||[];if(N.push(X),X="",B.createErrors!==!1){if(X+=" { keyword: 'const' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(q)+" , params: { allowedValue: schema"+C+" } ",B.opts.messages!==!1)X+=" , message: 'should be equal to constant' ";if(B.opts.verbose)X+=" , schema: validate.schema"+G+" , parentSchema: validate.schema"+B.schemaPath+" , data: "+U+" ";X+=" } "}else X+=" {} ";var L=X;if(X=N.pop(),!B.compositeRule&&A)if(B.async)X+=" throw new ValidationError(["+L+"]); ";else X+=" validate.errors = ["+L+"]; return false; ";else X+=" var err = "+L+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(X+=" }",A)X+=" else { ";return X}}),uq=KD((D,F)=>{F.exports=function Q(B,Y,J){var X=" ",C=B.level,z=B.dataLevel,W=B.schema[Y],G=B.schemaPath+B.util.getProperty(Y),q=B.errSchemaPath+"/"+Y,A=!B.opts.allErrors,U="data"+(z||""),Z="valid"+C,H="errs__"+C,V=B.util.copy(B),N="";V.level++;var L="valid"+V.level,R="i"+C,k=V.dataLevel=B.dataLevel+1,b="data"+k,I=B.baseId,u=B.opts.strictKeywords?typeof W=="object"&&Object.keys(W).length>0||W===!1:B.util.schemaHasRules(W,B.RULES.all);if(X+="var "+H+" = errors;var "+Z+";",u){var f=B.compositeRule;B.compositeRule=V.compositeRule=!0,V.schema=W,V.schemaPath=G,V.errSchemaPath=q,X+=" var "+L+" = false; for (var "+R+" = 0; "+R+" < "+U+".length; "+R+"++) { ",V.errorPath=B.util.getPathExpr(B.errorPath,R,B.opts.jsonPointers,!0);var O=U+"["+R+"]";V.dataPathArr[k]=R;var y=B.validate(V);if(V.baseId=I,B.util.varOccurences(y,b)<2)X+=" "+B.util.varReplace(y,b,O)+" ";else X+=" var "+b+" = "+O+"; "+y+" ";X+=" if ("+L+") break; } ",B.compositeRule=V.compositeRule=f,X+=" "+N+" if (!"+L+") {"}else X+=" if ("+U+".length == 0) {";var x=x||[];if(x.push(X),X="",B.createErrors!==!1){if(X+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(q)+" , params: {} ",B.opts.messages!==!1)X+=" , message: 'should contain a valid item' ";if(B.opts.verbose)X+=" , schema: validate.schema"+G+" , parentSchema: validate.schema"+B.schemaPath+" , data: "+U+" ";X+=" } "}else X+=" {} ";var w=X;if(X=x.pop(),!B.compositeRule&&A)if(B.async)X+=" throw new ValidationError(["+w+"]); ";else X+=" validate.errors = ["+w+"]; return false; ";else X+=" var err = "+w+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(X+=" } else { ",u)X+=" errors = "+H+"; if (vErrors !== null) { if ("+H+") vErrors.length = "+H+"; else vErrors = null; } ";if(B.opts.allErrors)X+=" } ";return X}}),yq=KD((D,F)=>{F.exports=function Q(B,Y,J){var X=" ",C=B.level,z=B.dataLevel,W=B.schema[Y],G=B.schemaPath+B.util.getProperty(Y),q=B.errSchemaPath+"/"+Y,A=!B.opts.allErrors,U="data"+(z||""),Z="errs__"+C,H=B.util.copy(B),V="";H.level++;var N="valid"+H.level,L={},R={},k=B.opts.ownProperties;for(f in W){if(f=="__proto__")continue;var b=W[f],I=Array.isArray(b)?R:L;I[f]=b}X+="var "+Z+" = errors;";var u=B.errorPath;X+="var missing"+C+";";for(var f in R)if(I=R[f],I.length){if(X+=" if ( "+U+B.util.getProperty(f)+" !== undefined ",k)X+=" && Object.prototype.hasOwnProperty.call("+U+", '"+B.util.escapeQuotes(f)+"') ";if(A){X+=" && ( ";var O=I;if(O){var y,x=-1,w=O.length-1;while(x<w){if(y=O[x+=1],x)X+=" || ";var S=B.util.getProperty(y),g=U+S;if(X+=" ( ( "+g+" === undefined ",k)X+=" || ! Object.prototype.hasOwnProperty.call("+U+", '"+B.util.escapeQuotes(y)+"') ";X+=") && (missing"+C+" = "+B.util.toQuotedString(B.opts.jsonPointers?y:S)+") ) "}}X+=")) { ";var d="missing"+C,n="' + "+d+" + '";if(B.opts._errorDataPathProperty)B.errorPath=B.opts.jsonPointers?B.util.getPathExpr(u,d,!0):u+" + "+d;var a=a||[];if(a.push(X),X="",B.createErrors!==!1){if(X+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(q)+" , params: { property: '"+B.util.escapeQuotes(f)+"', missingProperty: '"+n+"', depsCount: "+I.length+", deps: '"+B.util.escapeQuotes(I.length==1?I[0]:I.join(", "))+"' } ",B.opts.messages!==!1){if(X+=" , message: 'should have ",I.length==1)X+="property "+B.util.escapeQuotes(I[0]);else X+="properties "+B.util.escapeQuotes(I.join(", "));X+=" when property "+B.util.escapeQuotes(f)+" is present' "}if(B.opts.verbose)X+=" , schema: validate.schema"+G+" , parentSchema: validate.schema"+B.schemaPath+" , data: "+U+" ";X+=" } "}else X+=" {} ";var DD=X;if(X=a.pop(),!B.compositeRule&&A)if(B.async)X+=" throw new ValidationError(["+DD+"]); ";else X+=" validate.errors = ["+DD+"]; return false; ";else X+=" var err = "+DD+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else{X+=" ) { ";var o=I;if(o){var y,XD=-1,YD=o.length-1;while(XD<YD){y=o[XD+=1];var S=B.util.getProperty(y),n=B.util.escapeQuotes(y),g=U+S;if(B.opts._errorDataPathProperty)B.errorPath=B.util.getPath(u,y,B.opts.jsonPointers);if(X+=" if ( "+g+" === undefined ",k)X+=" || ! Object.prototype.hasOwnProperty.call("+U+", '"+B.util.escapeQuotes(y)+"') ";if(X+=") { var err = ",B.createErrors!==!1){if(X+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(q)+" , params: { property: '"+B.util.escapeQuotes(f)+"', missingProperty: '"+n+"', depsCount: "+I.length+", deps: '"+B.util.escapeQuotes(I.length==1?I[0]:I.join(", "))+"' } ",B.opts.messages!==!1){if(X+=" , message: 'should have ",I.length==1)X+="property "+B.util.escapeQuotes(I[0]);else X+="properties "+B.util.escapeQuotes(I.join(", "));X+=" when property "+B.util.escapeQuotes(f)+" is present' "}if(B.opts.verbose)X+=" , schema: validate.schema"+G+" , parentSchema: validate.schema"+B.schemaPath+" , data: "+U+" ";X+=" } "}else X+=" {} ";X+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}}if(X+=" } ",A)V+="}",X+=" else { "}B.errorPath=u;var FD=H.baseId;for(var f in L){var b=L[f];if(B.opts.strictKeywords?typeof b=="object"&&Object.keys(b).length>0||b===!1:B.util.schemaHasRules(b,B.RULES.all)){if(X+=" "+N+" = true; if ( "+U+B.util.getProperty(f)+" !== undefined ",k)X+=" && Object.prototype.hasOwnProperty.call("+U+", '"+B.util.escapeQuotes(f)+"') ";if(X+=") { ",H.schema=b,H.schemaPath=G+B.util.getProperty(f),H.errSchemaPath=q+"/"+B.util.escapeFragment(f),X+=" "+B.validate(H)+" ",H.baseId=FD,X+=" } ",A)X+=" if ("+N+") { ",V+="}"}}if(A)X+=" "+V+" if ("+Z+" == errors) {";return X}}),fq=KD((D,F)=>{F.exports=function Q(B,Y,J){var X=" ",C=B.level,z=B.dataLevel,W=B.schema[Y],G=B.schemaPath+B.util.getProperty(Y),q=B.errSchemaPath+"/"+Y,A=!B.opts.allErrors,U="data"+(z||""),Z="valid"+C,H=B.opts.$data&&W&&W.$data,V;if(H)X+=" var schema"+C+" = "+B.util.getData(W.$data,z,B.dataPathArr)+"; ",V="schema"+C;else V=W;var N="i"+C,L="schema"+C;if(!H)X+=" var "+L+" = validate.schema"+G+";";if(X+="var "+Z+";",H)X+=" if (schema"+C+" === undefined) "+Z+" = true; else if (!Array.isArray(schema"+C+")) "+Z+" = false; else {";if(X+=""+Z+" = false;for (var "+N+"=0; "+N+"<"+L+".length; "+N+"++) if (equal("+U+", "+L+"["+N+"])) { "+Z+" = true; break; }",H)X+=" } ";X+=" if (!"+Z+") { ";var R=R||[];if(R.push(X),X="",B.createErrors!==!1){if(X+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(q)+" , params: { allowedValues: schema"+C+" } ",B.opts.messages!==!1)X+=" , message: 'should be equal to one of the allowed values' ";if(B.opts.verbose)X+=" , schema: validate.schema"+G+" , parentSchema: validate.schema"+B.schemaPath+" , data: "+U+" ";X+=" } "}else X+=" {} ";var k=X;if(X=R.pop(),!B.compositeRule&&A)if(B.async)X+=" throw new ValidationError(["+k+"]); ";else X+=" validate.errors = ["+k+"]; return false; ";else X+=" var err = "+k+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(X+=" }",A)X+=" else { ";return X}}),gq=KD((D,F)=>{F.exports=function Q(B,Y,J){var X=" ",C=B.level,z=B.dataLevel,W=B.schema[Y],G=B.schemaPath+B.util.getProperty(Y),q=B.errSchemaPath+"/"+Y,A=!B.opts.allErrors,U="data"+(z||"");if(B.opts.format===!1){if(A)X+=" if (true) { ";return X}var Z=B.opts.$data&&W&&W.$data,H;if(Z)X+=" var schema"+C+" = "+B.util.getData(W.$data,z,B.dataPathArr)+"; ",H="schema"+C;else H=W;var V=B.opts.unknownFormats,N=Array.isArray(V);if(Z){var L="format"+C,R="isObject"+C,k="formatType"+C;if(X+=" var "+L+" = formats["+H+"]; var "+R+" = typeof "+L+" == 'object' && !("+L+" instanceof RegExp) && "+L+".validate; var "+k+" = "+R+" && "+L+".type || 'string'; if ("+R+") { ",B.async)X+=" var async"+C+" = "+L+".async; ";if(X+=" "+L+" = "+L+".validate; } if ( ",Z)X+=" ("+H+" !== undefined && typeof "+H+" != 'string') || ";if(X+=" (",V!="ignore"){if(X+=" ("+H+" && !"+L+" ",N)X+=" && self._opts.unknownFormats.indexOf("+H+") == -1 ";X+=") || "}if(X+=" ("+L+" && "+k+" == '"+J+"' && !(typeof "+L+" == 'function' ? ",B.async)X+=" (async"+C+" ? await "+L+"("+U+") : "+L+"("+U+")) ";else X+=" "+L+"("+U+") ";X+=" : "+L+".test("+U+"))))) {"}else{var L=B.formats[W];if(!L)if(V=="ignore"){if(B.logger.warn('unknown format "'+W+'" ignored in schema at path "'+B.errSchemaPath+'"'),A)X+=" if (true) { ";return X}else if(N&&V.indexOf(W)>=0){if(A)X+=" if (true) { ";return X}else throw new Error('unknown format "'+W+'" is used in schema at path "'+B.errSchemaPath+'"');var R=typeof L=="object"&&!(L instanceof RegExp)&&L.validate,k=R&&L.type||"string";if(R){var b=L.async===!0;L=L.validate}if(k!=J){if(A)X+=" if (true) { ";return X}if(b){if(!B.async)throw new Error("async format in sync schema");var I="formats"+B.util.getProperty(W)+".validate";X+=" if (!(await "+I+"("+U+"))) { "}else{X+=" if (! ";var I="formats"+B.util.getProperty(W);if(R)I+=".validate";if(typeof L=="function")X+=" "+I+"("+U+") ";else X+=" "+I+".test("+U+") ";X+=") { "}}var u=u||[];if(u.push(X),X="",B.createErrors!==!1){if(X+=" { keyword: 'format' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(q)+" , params: { format: ",Z)X+=""+H;else X+=""+B.util.toQuotedString(W);if(X+=" } ",B.opts.messages!==!1){if(X+=` , message: 'should match format "`,Z)X+="' + "+H+" + '";else X+=""+B.util.escapeQuotes(W);X+=`"' `}if(B.opts.verbose){if(X+=" , schema: ",Z)X+="validate.schema"+G;else X+=""+B.util.toQuotedString(W);X+=" , parentSchema: validate.schema"+B.schemaPath+" , data: "+U+" "}X+=" } "}else X+=" {} ";var f=X;if(X=u.pop(),!B.compositeRule&&A)if(B.async)X+=" throw new ValidationError(["+f+"]); ";else X+=" validate.errors = ["+f+"]; return false; ";else X+=" var err = "+f+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(X+=" } ",A)X+=" else { ";return X}}),$q=KD((D,F)=>{F.exports=function Q(B,Y,J){var X=" ",C=B.level,z=B.dataLevel,W=B.schema[Y],G=B.schemaPath+B.util.getProperty(Y),q=B.errSchemaPath+"/"+Y,A=!B.opts.allErrors,U="data"+(z||""),Z="valid"+C,H="errs__"+C,V=B.util.copy(B);V.level++;var N="valid"+V.level,L=B.schema.then,R=B.schema.else,k=L!==void 0&&(B.opts.strictKeywords?typeof L=="object"&&Object.keys(L).length>0||L===!1:B.util.schemaHasRules(L,B.RULES.all)),b=R!==void 0&&(B.opts.strictKeywords?typeof R=="object"&&Object.keys(R).length>0||R===!1:B.util.schemaHasRules(R,B.RULES.all)),I=V.baseId;if(k||b){var u;V.createErrors=!1,V.schema=W,V.schemaPath=G,V.errSchemaPath=q,X+=" var "+H+" = errors; var "+Z+" = true; ";var f=B.compositeRule;if(B.compositeRule=V.compositeRule=!0,X+=" "+B.validate(V)+" ",V.baseId=I,V.createErrors=!0,X+=" errors = "+H+"; if (vErrors !== null) { if ("+H+") vErrors.length = "+H+"; else vErrors = null; } ",B.compositeRule=V.compositeRule=f,k){if(X+=" if ("+N+") { ",V.schema=B.schema.then,V.schemaPath=B.schemaPath+".then",V.errSchemaPath=B.errSchemaPath+"/then",X+=" "+B.validate(V)+" ",V.baseId=I,X+=" "+Z+" = "+N+"; ",k&&b)u="ifClause"+C,X+=" var "+u+" = 'then'; ";else u="'then'";if(X+=" } ",b)X+=" else { "}else X+=" if (!"+N+") { ";if(b){if(V.schema=B.schema.else,V.schemaPath=B.schemaPath+".else",V.errSchemaPath=B.errSchemaPath+"/else",X+=" "+B.validate(V)+" ",V.baseId=I,X+=" "+Z+" = "+N+"; ",k&&b)u="ifClause"+C,X+=" var "+u+" = 'else'; ";else u="'else'";X+=" } "}if(X+=" if (!"+Z+") { var err = ",B.createErrors!==!1){if(X+=" { keyword: 'if' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(q)+" , params: { failingKeyword: "+u+" } ",B.opts.messages!==!1)X+=` , message: 'should match "' + `+u+` + '" schema' `;if(B.opts.verbose)X+=" , schema: validate.schema"+G+" , parentSchema: validate.schema"+B.schemaPath+" , data: "+U+" ";X+=" } "}else X+=" {} ";if(X+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!B.compositeRule&&A)if(B.async)X+=" throw new ValidationError(vErrors); ";else X+=" validate.errors = vErrors; return false; ";if(X+=" } ",A)X+=" else { "}else if(A)X+=" if (true) { ";return X}}),hq=KD((D,F)=>{F.exports=function Q(B,Y,J){var X=" ",C=B.level,z=B.dataLevel,W=B.schema[Y],G=B.schemaPath+B.util.getProperty(Y),q=B.errSchemaPath+"/"+Y,A=!B.opts.allErrors,U="data"+(z||""),Z="valid"+C,H="errs__"+C,V=B.util.copy(B),N="";V.level++;var L="valid"+V.level,R="i"+C,k=V.dataLevel=B.dataLevel+1,b="data"+k,I=B.baseId;if(X+="var "+H+" = errors;var "+Z+";",Array.isArray(W)){var u=B.schema.additionalItems;if(u===!1){X+=" "+Z+" = "+U+".length <= "+W.length+"; ";var f=q;q=B.errSchemaPath+"/additionalItems",X+=" if (!"+Z+") { ";var O=O||[];if(O.push(X),X="",B.createErrors!==!1){if(X+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(q)+" , params: { limit: "+W.length+" } ",B.opts.messages!==!1)X+=" , message: 'should NOT have more than "+W.length+" items' ";if(B.opts.verbose)X+=" , schema: false , parentSchema: validate.schema"+B.schemaPath+" , data: "+U+" ";X+=" } "}else X+=" {} ";var y=X;if(X=O.pop(),!B.compositeRule&&A)if(B.async)X+=" throw new ValidationError(["+y+"]); ";else X+=" validate.errors = ["+y+"]; return false; ";else X+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(X+=" } ",q=f,A)N+="}",X+=" else { "}var x=W;if(x){var w,S=-1,g=x.length-1;while(S<g)if(w=x[S+=1],B.opts.strictKeywords?typeof w=="object"&&Object.keys(w).length>0||w===!1:B.util.schemaHasRules(w,B.RULES.all)){X+=" "+L+" = true; if ("+U+".length > "+S+") { ";var d=U+"["+S+"]";V.schema=w,V.schemaPath=G+"["+S+"]",V.errSchemaPath=q+"/"+S,V.errorPath=B.util.getPathExpr(B.errorPath,S,B.opts.jsonPointers,!0),V.dataPathArr[k]=S;var n=B.validate(V);if(V.baseId=I,B.util.varOccurences(n,b)<2)X+=" "+B.util.varReplace(n,b,d)+" ";else X+=" var "+b+" = "+d+"; "+n+" ";if(X+=" } ",A)X+=" if ("+L+") { ",N+="}"}}if(typeof u=="object"&&(B.opts.strictKeywords?typeof u=="object"&&Object.keys(u).length>0||u===!1:B.util.schemaHasRules(u,B.RULES.all))){V.schema=u,V.schemaPath=B.schemaPath+".additionalItems",V.errSchemaPath=B.errSchemaPath+"/additionalItems",X+=" "+L+" = true; if ("+U+".length > "+W.length+") { for (var "+R+" = "+W.length+"; "+R+" < "+U+".length; "+R+"++) { ",V.errorPath=B.util.getPathExpr(B.errorPath,R,B.opts.jsonPointers,!0);var d=U+"["+R+"]";V.dataPathArr[k]=R;var n=B.validate(V);if(V.baseId=I,B.util.varOccurences(n,b)<2)X+=" "+B.util.varReplace(n,b,d)+" ";else X+=" var "+b+" = "+d+"; "+n+" ";if(A)X+=" if (!"+L+") break; ";if(X+=" } } ",A)X+=" if ("+L+") { ",N+="}"}}else if(B.opts.strictKeywords?typeof W=="object"&&Object.keys(W).length>0||W===!1:B.util.schemaHasRules(W,B.RULES.all)){V.schema=W,V.schemaPath=G,V.errSchemaPath=q,X+=" for (var "+R+" = 0; "+R+" < "+U+".length; "+R+"++) { ",V.errorPath=B.util.getPathExpr(B.errorPath,R,B.opts.jsonPointers,!0);var d=U+"["+R+"]";V.dataPathArr[k]=R;var n=B.validate(V);if(V.baseId=I,B.util.varOccurences(n,b)<2)X+=" "+B.util.varReplace(n,b,d)+" ";else X+=" var "+b+" = "+d+"; "+n+" ";if(A)X+=" if (!"+L+") break; ";X+=" }"}if(A)X+=" "+N+" if ("+H+" == errors) {";return X}}),sB=KD((D,F)=>{F.exports=function Q(B,Y,J){var X=" ",C=B.level,z=B.dataLevel,W=B.schema[Y],G=B.schemaPath+B.util.getProperty(Y),q=B.errSchemaPath+"/"+Y,A=!B.opts.allErrors,I,U="data"+(z||""),Z=B.opts.$data&&W&&W.$data,H;if(Z)X+=" var schema"+C+" = "+B.util.getData(W.$data,z,B.dataPathArr)+"; ",H="schema"+C;else H=W;var V=Y=="maximum",N=V?"exclusiveMaximum":"exclusiveMinimum",L=B.schema[N],R=B.opts.$data&&L&&L.$data,k=V?"<":">",b=V?">":"<",I=void 0;if(!(Z||typeof W=="number"||W===void 0))throw new Error(Y+" must be number");if(!(R||L===void 0||typeof L=="number"||typeof L=="boolean"))throw new Error(N+" must be number or boolean");if(R){var u=B.util.getData(L.$data,z,B.dataPathArr),f="exclusive"+C,O="exclType"+C,y="exclIsNumber"+C,x="op"+C,w="' + "+x+" + '";X+=" var schemaExcl"+C+" = "+u+"; ",u="schemaExcl"+C,X+=" var "+f+"; var "+O+" = typeof "+u+"; if ("+O+" != 'boolean' && "+O+" != 'undefined' && "+O+" != 'number') { ";var I=N,S=S||[];if(S.push(X),X="",B.createErrors!==!1){if(X+=" { keyword: '"+(I||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(q)+" , params: {} ",B.opts.messages!==!1)X+=" , message: '"+N+" should be boolean' ";if(B.opts.verbose)X+=" , schema: validate.schema"+G+" , parentSchema: validate.schema"+B.schemaPath+" , data: "+U+" ";X+=" } "}else X+=" {} ";var g=X;if(X=S.pop(),!B.compositeRule&&A)if(B.async)X+=" throw new ValidationError(["+g+"]); ";else X+=" validate.errors = ["+g+"]; return false; ";else X+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(X+=" } else if ( ",Z)X+=" ("+H+" !== undefined && typeof "+H+" != 'number') || ";if(X+=" "+O+" == 'number' ? ( ("+f+" = "+H+" === undefined || "+u+" "+k+"= "+H+") ? "+U+" "+b+"= "+u+" : "+U+" "+b+" "+H+" ) : ( ("+f+" = "+u+" === true) ? "+U+" "+b+"= "+H+" : "+U+" "+b+" "+H+" ) || "+U+" !== "+U+") { var op"+C+" = "+f+" ? '"+k+"' : '"+k+"='; ",W===void 0)I=N,q=B.errSchemaPath+"/"+N,H=u,Z=R}else{var y=typeof L=="number",w=k;if(y&&Z){var x="'"+w+"'";if(X+=" if ( ",Z)X+=" ("+H+" !== undefined && typeof "+H+" != 'number') || ";X+=" ( "+H+" === undefined || "+L+" "+k+"= "+H+" ? "+U+" "+b+"= "+L+" : "+U+" "+b+" "+H+" ) || "+U+" !== "+U+") { "}else{if(y&&W===void 0)f=!0,I=N,q=B.errSchemaPath+"/"+N,H=L,b+="=";else{if(y)H=Math[V?"min":"max"](L,W);if(L===(y?H:!0))f=!0,I=N,q=B.errSchemaPath+"/"+N,b+="=";else f=!1,w+="="}var x="'"+w+"'";if(X+=" if ( ",Z)X+=" ("+H+" !== undefined && typeof "+H+" != 'number') || ";X+=" "+U+" "+b+" "+H+" || "+U+" !== "+U+") { "}}I=I||Y;var S=S||[];if(S.push(X),X="",B.createErrors!==!1){if(X+=" { keyword: '"+(I||"_limit")+"' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(q)+" , params: { comparison: "+x+", limit: "+H+", exclusive: "+f+" } ",B.opts.messages!==!1)if(X+=" , message: 'should be "+w+" ",Z)X+="' + "+H;else X+=""+H+"'";if(B.opts.verbose){if(X+=" , schema: ",Z)X+="validate.schema"+G;else X+=""+W;X+=" , parentSchema: validate.schema"+B.schemaPath+" , data: "+U+" "}X+=" } "}else X+=" {} ";var g=X;if(X=S.pop(),!B.compositeRule&&A)if(B.async)X+=" throw new ValidationError(["+g+"]); ";else X+=" validate.errors = ["+g+"]; return false; ";else X+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(X+=" } ",A)X+=" else { ";return X}}),tB=KD((D,F)=>{F.exports=function Q(B,Y,J){var X=" ",C=B.level,z=B.dataLevel,W=B.schema[Y],G=B.schemaPath+B.util.getProperty(Y),q=B.errSchemaPath+"/"+Y,A=!B.opts.allErrors,N,U="data"+(z||""),Z=B.opts.$data&&W&&W.$data,H;if(Z)X+=" var schema"+C+" = "+B.util.getData(W.$data,z,B.dataPathArr)+"; ",H="schema"+C;else H=W;if(!(Z||typeof W=="number"))throw new Error(Y+" must be number");var V=Y=="maxItems"?">":"<";if(X+="if ( ",Z)X+=" ("+H+" !== undefined && typeof "+H+" != 'number') || ";X+=" "+U+".length "+V+" "+H+") { ";var N=Y,L=L||[];if(L.push(X),X="",B.createErrors!==!1){if(X+=" { keyword: '"+(N||"_limitItems")+"' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(q)+" , params: { limit: "+H+" } ",B.opts.messages!==!1){if(X+=" , message: 'should NOT have ",Y=="maxItems")X+="more";else X+="fewer";if(X+=" than ",Z)X+="' + "+H+" + '";else X+=""+W;X+=" items' "}if(B.opts.verbose){if(X+=" , schema: ",Z)X+="validate.schema"+G;else X+=""+W;X+=" , parentSchema: validate.schema"+B.schemaPath+" , data: "+U+" "}X+=" } "}else X+=" {} ";var R=X;if(X=L.pop(),!B.compositeRule&&A)if(B.async)X+=" throw new ValidationError(["+R+"]); ";else X+=" validate.errors = ["+R+"]; return false; ";else X+=" var err = "+R+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(X+="} ",A)X+=" else { ";return X}}),eB=KD((D,F)=>{F.exports=function Q(B,Y,J){var X=" ",C=B.level,z=B.dataLevel,W=B.schema[Y],G=B.schemaPath+B.util.getProperty(Y),q=B.errSchemaPath+"/"+Y,A=!B.opts.allErrors,N,U="data"+(z||""),Z=B.opts.$data&&W&&W.$data,H;if(Z)X+=" var schema"+C+" = "+B.util.getData(W.$data,z,B.dataPathArr)+"; ",H="schema"+C;else H=W;if(!(Z||typeof W=="number"))throw new Error(Y+" must be number");var V=Y=="maxLength"?">":"<";if(X+="if ( ",Z)X+=" ("+H+" !== undefined && typeof "+H+" != 'number') || ";if(B.opts.unicode===!1)X+=" "+U+".length ";else X+=" ucs2length("+U+") ";X+=" "+V+" "+H+") { ";var N=Y,L=L||[];if(L.push(X),X="",B.createErrors!==!1){if(X+=" { keyword: '"+(N||"_limitLength")+"' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(q)+" , params: { limit: "+H+" } ",B.opts.messages!==!1){if(X+=" , message: 'should NOT be ",Y=="maxLength")X+="longer";else X+="shorter";if(X+=" than ",Z)X+="' + "+H+" + '";else X+=""+W;X+=" characters' "}if(B.opts.verbose){if(X+=" , schema: ",Z)X+="validate.schema"+G;else X+=""+W;X+=" , parentSchema: validate.schema"+B.schemaPath+" , data: "+U+" "}X+=" } "}else X+=" {} ";var R=X;if(X=L.pop(),!B.compositeRule&&A)if(B.async)X+=" throw new ValidationError(["+R+"]); ";else X+=" validate.errors = ["+R+"]; return false; ";else X+=" var err = "+R+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(X+="} ",A)X+=" else { ";return X}}),DQ=KD((D,F)=>{F.exports=function Q(B,Y,J){var X=" ",C=B.level,z=B.dataLevel,W=B.schema[Y],G=B.schemaPath+B.util.getProperty(Y),q=B.errSchemaPath+"/"+Y,A=!B.opts.allErrors,N,U="data"+(z||""),Z=B.opts.$data&&W&&W.$data,H;if(Z)X+=" var schema"+C+" = "+B.util.getData(W.$data,z,B.dataPathArr)+"; ",H="schema"+C;else H=W;if(!(Z||typeof W=="number"))throw new Error(Y+" must be number");var V=Y=="maxProperties"?">":"<";if(X+="if ( ",Z)X+=" ("+H+" !== undefined && typeof "+H+" != 'number') || ";X+=" Object.keys("+U+").length "+V+" "+H+") { ";var N=Y,L=L||[];if(L.push(X),X="",B.createErrors!==!1){if(X+=" { keyword: '"+(N||"_limitProperties")+"' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(q)+" , params: { limit: "+H+" } ",B.opts.messages!==!1){if(X+=" , message: 'should NOT have ",Y=="maxProperties")X+="more";else X+="fewer";if(X+=" than ",Z)X+="' + "+H+" + '";else X+=""+W;X+=" properties' "}if(B.opts.verbose){if(X+=" , schema: ",Z)X+="validate.schema"+G;else X+=""+W;X+=" , parentSchema: validate.schema"+B.schemaPath+" , data: "+U+" "}X+=" } "}else X+=" {} ";var R=X;if(X=L.pop(),!B.compositeRule&&A)if(B.async)X+=" throw new ValidationError(["+R+"]); ";else X+=" validate.errors = ["+R+"]; return false; ";else X+=" var err = "+R+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(X+="} ",A)X+=" else { ";return X}}),mq=KD((D,F)=>{F.exports=function Q(B,Y,J){var X=" ",C=B.level,z=B.dataLevel,W=B.schema[Y],G=B.schemaPath+B.util.getProperty(Y),q=B.errSchemaPath+"/"+Y,A=!B.opts.allErrors,U="data"+(z||""),Z=B.opts.$data&&W&&W.$data,H;if(Z)X+=" var schema"+C+" = "+B.util.getData(W.$data,z,B.dataPathArr)+"; ",H="schema"+C;else H=W;if(!(Z||typeof W=="number"))throw new Error(Y+" must be number");if(X+="var division"+C+";if (",Z)X+=" "+H+" !== undefined && ( typeof "+H+" != 'number' || ";if(X+=" (division"+C+" = "+U+" / "+H+", ",B.opts.multipleOfPrecision)X+=" Math.abs(Math.round(division"+C+") - division"+C+") > 1e-"+B.opts.multipleOfPrecision+" ";else X+=" division"+C+" !== parseInt(division"+C+") ";if(X+=" ) ",Z)X+=" ) ";X+=" ) { ";var V=V||[];if(V.push(X),X="",B.createErrors!==!1){if(X+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(q)+" , params: { multipleOf: "+H+" } ",B.opts.messages!==!1)if(X+=" , message: 'should be multiple of ",Z)X+="' + "+H;else X+=""+H+"'";if(B.opts.verbose){if(X+=" , schema: ",Z)X+="validate.schema"+G;else X+=""+W;X+=" , parentSchema: validate.schema"+B.schemaPath+" , data: "+U+" "}X+=" } "}else X+=" {} ";var N=X;if(X=V.pop(),!B.compositeRule&&A)if(B.async)X+=" throw new ValidationError(["+N+"]); ";else X+=" validate.errors = ["+N+"]; return false; ";else X+=" var err = "+N+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(X+="} ",A)X+=" else { ";return X}}),lq=KD((D,F)=>{F.exports=function Q(B,Y,J){var X=" ",C=B.level,z=B.dataLevel,W=B.schema[Y],G=B.schemaPath+B.util.getProperty(Y),q=B.errSchemaPath+"/"+Y,A=!B.opts.allErrors,U="data"+(z||""),Z="errs__"+C,H=B.util.copy(B);H.level++;var V="valid"+H.level;if(B.opts.strictKeywords?typeof W=="object"&&Object.keys(W).length>0||W===!1:B.util.schemaHasRules(W,B.RULES.all)){H.schema=W,H.schemaPath=G,H.errSchemaPath=q,X+=" var "+Z+" = errors; ";var N=B.compositeRule;B.compositeRule=H.compositeRule=!0,H.createErrors=!1;var L;if(H.opts.allErrors)L=H.opts.allErrors,H.opts.allErrors=!1;if(X+=" "+B.validate(H)+" ",H.createErrors=!0,L)H.opts.allErrors=L;B.compositeRule=H.compositeRule=N,X+=" if ("+V+") { ";var R=R||[];if(R.push(X),X="",B.createErrors!==!1){if(X+=" { keyword: 'not' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(q)+" , params: {} ",B.opts.messages!==!1)X+=" , message: 'should NOT be valid' ";if(B.opts.verbose)X+=" , schema: validate.schema"+G+" , parentSchema: validate.schema"+B.schemaPath+" , data: "+U+" ";X+=" } "}else X+=" {} ";var k=X;if(X=R.pop(),!B.compositeRule&&A)if(B.async)X+=" throw new ValidationError(["+k+"]); ";else X+=" validate.errors = ["+k+"]; return false; ";else X+=" var err = "+k+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(X+=" } else { errors = "+Z+"; if (vErrors !== null) { if ("+Z+") vErrors.length = "+Z+"; else vErrors = null; } ",B.opts.allErrors)X+=" } "}else{if(X+=" var err = ",B.createErrors!==!1){if(X+=" { keyword: 'not' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(q)+" , params: {} ",B.opts.messages!==!1)X+=" , message: 'should NOT be valid' ";if(B.opts.verbose)X+=" , schema: validate.schema"+G+" , parentSchema: validate.schema"+B.schemaPath+" , data: "+U+" ";X+=" } "}else X+=" {} ";if(X+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",A)X+=" if (false) { "}return X}}),dq=KD((D,F)=>{F.exports=function Q(B,Y,J){var X=" ",C=B.level,z=B.dataLevel,W=B.schema[Y],G=B.schemaPath+B.util.getProperty(Y),q=B.errSchemaPath+"/"+Y,A=!B.opts.allErrors,U="data"+(z||""),Z="valid"+C,H="errs__"+C,V=B.util.copy(B),N="";V.level++;var L="valid"+V.level,R=V.baseId,k="prevValid"+C,b="passingSchemas"+C;X+="var "+H+" = errors , "+k+" = false , "+Z+" = false , "+b+" = null; ";var I=B.compositeRule;B.compositeRule=V.compositeRule=!0;var u=W;if(u){var f,O=-1,y=u.length-1;while(O<y){if(f=u[O+=1],B.opts.strictKeywords?typeof f=="object"&&Object.keys(f).length>0||f===!1:B.util.schemaHasRules(f,B.RULES.all))V.schema=f,V.schemaPath=G+"["+O+"]",V.errSchemaPath=q+"/"+O,X+=" "+B.validate(V)+" ",V.baseId=R;else X+=" var "+L+" = true; ";if(O)X+=" if ("+L+" && "+k+") { "+Z+" = false; "+b+" = ["+b+", "+O+"]; } else { ",N+="}";X+=" if ("+L+") { "+Z+" = "+k+" = true; "+b+" = "+O+"; }"}}if(B.compositeRule=V.compositeRule=I,X+=""+N+"if (!"+Z+") { var err = ",B.createErrors!==!1){if(X+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(q)+" , params: { passingSchemas: "+b+" } ",B.opts.messages!==!1)X+=" , message: 'should match exactly one schema in oneOf' ";if(B.opts.verbose)X+=" , schema: validate.schema"+G+" , parentSchema: validate.schema"+B.schemaPath+" , data: "+U+" ";X+=" } "}else X+=" {} ";if(X+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!B.compositeRule&&A)if(B.async)X+=" throw new ValidationError(vErrors); ";else X+=" validate.errors = vErrors; return false; ";if(X+="} else { errors = "+H+"; if (vErrors !== null) { if ("+H+") vErrors.length = "+H+"; else vErrors = null; }",B.opts.allErrors)X+=" } ";return X}}),cq=KD((D,F)=>{F.exports=function Q(B,Y,J){var X=" ",C=B.level,z=B.dataLevel,W=B.schema[Y],G=B.schemaPath+B.util.getProperty(Y),q=B.errSchemaPath+"/"+Y,A=!B.opts.allErrors,U="data"+(z||""),Z=B.opts.$data&&W&&W.$data,H;if(Z)X+=" var schema"+C+" = "+B.util.getData(W.$data,z,B.dataPathArr)+"; ",H="schema"+C;else H=W;var V=Z?"(new RegExp("+H+"))":B.usePattern(W);if(X+="if ( ",Z)X+=" ("+H+" !== undefined && typeof "+H+" != 'string') || ";X+=" !"+V+".test("+U+") ) { ";var N=N||[];if(N.push(X),X="",B.createErrors!==!1){if(X+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(q)+" , params: { pattern: ",Z)X+=""+H;else X+=""+B.util.toQuotedString(W);if(X+=" } ",B.opts.messages!==!1){if(X+=` , message: 'should match pattern "`,Z)X+="' + "+H+" + '";else X+=""+B.util.escapeQuotes(W);X+=`"' `}if(B.opts.verbose){if(X+=" , schema: ",Z)X+="validate.schema"+G;else X+=""+B.util.toQuotedString(W);X+=" , parentSchema: validate.schema"+B.schemaPath+" , data: "+U+" "}X+=" } "}else X+=" {} ";var L=X;if(X=N.pop(),!B.compositeRule&&A)if(B.async)X+=" throw new ValidationError(["+L+"]); ";else X+=" validate.errors = ["+L+"]; return false; ";else X+=" var err = "+L+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(X+="} ",A)X+=" else { ";return X}}),pq=KD((D,F)=>{F.exports=function Q(B,Y,J){var X=" ",C=B.level,z=B.dataLevel,W=B.schema[Y],G=B.schemaPath+B.util.getProperty(Y),q=B.errSchemaPath+"/"+Y,A=!B.opts.allErrors,U="data"+(z||""),Z="errs__"+C,H=B.util.copy(B),V="";H.level++;var N="valid"+H.level,L="key"+C,R="idx"+C,k=H.dataLevel=B.dataLevel+1,b="data"+k,I="dataProperties"+C,u=Object.keys(W||{}).filter(XD),f=B.schema.patternProperties||{},O=Object.keys(f).filter(XD),y=B.schema.additionalProperties,x=u.length||O.length,w=y===!1,S=typeof y=="object"&&Object.keys(y).length,g=B.opts.removeAdditional,d=w||S||g,n=B.opts.ownProperties,a=B.baseId,DD=B.schema.required;if(DD&&!(B.opts.$data&&DD.$data)&&DD.length<B.opts.loopRequired)var o=B.util.toHash(DD);function XD(i0){return i0!=="__proto__"}if(X+="var "+Z+" = errors;var "+N+" = true;",n)X+=" var "+I+" = undefined;";if(d){if(n)X+=" "+I+" = "+I+" || Object.keys("+U+"); for (var "+R+"=0; "+R+"<"+I+".length; "+R+"++) { var "+L+" = "+I+"["+R+"]; ";else X+=" for (var "+L+" in "+U+") { ";if(x){if(X+=" var isAdditional"+C+" = !(false ",u.length)if(u.length>8)X+=" || validate.schema"+G+".hasOwnProperty("+L+") ";else{var YD=u;if(YD){var FD,LD=-1,hD=YD.length-1;while(LD<hD)FD=YD[LD+=1],X+=" || "+L+" == "+B.util.toQuotedString(FD)+" "}}if(O.length){var cD=O;if(cD){var j,_=-1,K=cD.length-1;while(_<K)j=cD[_+=1],X+=" || "+B.usePattern(j)+".test("+L+") "}}X+=" ); if (isAdditional"+C+") { "}if(g=="all")X+=" delete "+U+"["+L+"]; ";else{var T=B.errorPath,h="' + "+L+" + '";if(B.opts._errorDataPathProperty)B.errorPath=B.util.getPathExpr(B.errorPath,L,B.opts.jsonPointers);if(w)if(g)X+=" delete "+U+"["+L+"]; ";else{X+=" "+N+" = false; ";var c=q;q=B.errSchemaPath+"/additionalProperties";var l=l||[];if(l.push(X),X="",B.createErrors!==!1){if(X+=" { keyword: 'additionalProperties' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(q)+" , params: { additionalProperty: '"+h+"' } ",B.opts.messages!==!1){if(X+=" , message: '",B.opts._errorDataPathProperty)X+="is an invalid additional property";else X+="should NOT have additional properties";X+="' "}if(B.opts.verbose)X+=" , schema: false , parentSchema: validate.schema"+B.schemaPath+" , data: "+U+" ";X+=" } "}else X+=" {} ";var p=X;if(X=l.pop(),!B.compositeRule&&A)if(B.async)X+=" throw new ValidationError(["+p+"]); ";else X+=" validate.errors = ["+p+"]; return false; ";else X+=" var err = "+p+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(q=c,A)X+=" break; "}else if(S)if(g=="failing"){X+=" var "+Z+" = errors; ";var BD=B.compositeRule;B.compositeRule=H.compositeRule=!0,H.schema=y,H.schemaPath=B.schemaPath+".additionalProperties",H.errSchemaPath=B.errSchemaPath+"/additionalProperties",H.errorPath=B.opts._errorDataPathProperty?B.errorPath:B.util.getPathExpr(B.errorPath,L,B.opts.jsonPointers);var qD=U+"["+L+"]";H.dataPathArr[k]=L;var JD=B.validate(H);if(H.baseId=a,B.util.varOccurences(JD,b)<2)X+=" "+B.util.varReplace(JD,b,qD)+" ";else X+=" var "+b+" = "+qD+"; "+JD+" ";X+=" if (!"+N+") { errors = "+Z+"; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete "+U+"["+L+"]; } ",B.compositeRule=H.compositeRule=BD}else{H.schema=y,H.schemaPath=B.schemaPath+".additionalProperties",H.errSchemaPath=B.errSchemaPath+"/additionalProperties",H.errorPath=B.opts._errorDataPathProperty?B.errorPath:B.util.getPathExpr(B.errorPath,L,B.opts.jsonPointers);var qD=U+"["+L+"]";H.dataPathArr[k]=L;var JD=B.validate(H);if(H.baseId=a,B.util.varOccurences(JD,b)<2)X+=" "+B.util.varReplace(JD,b,qD)+" ";else X+=" var "+b+" = "+qD+"; "+JD+" ";if(A)X+=" if (!"+N+") break; "}B.errorPath=T}if(x)X+=" } ";if(X+=" } ",A)X+=" if ("+N+") { ",V+="}"}var ZD=B.opts.useDefaults&&!B.compositeRule;if(u.length){var PD=u;if(PD){var FD,RD=-1,Q0=PD.length-1;while(RD<Q0){FD=PD[RD+=1];var mD=W[FD];if(B.opts.strictKeywords?typeof mD=="object"&&Object.keys(mD).length>0||mD===!1:B.util.schemaHasRules(mD,B.RULES.all)){var H0=B.util.getProperty(FD),qD=U+H0,SD=ZD&&mD.default!==void 0;H.schema=mD,H.schemaPath=G+H0,H.errSchemaPath=q+"/"+B.util.escapeFragment(FD),H.errorPath=B.util.getPath(B.errorPath,FD,B.opts.jsonPointers),H.dataPathArr[k]=B.util.toQuotedString(FD);var JD=B.validate(H);if(H.baseId=a,B.util.varOccurences(JD,b)<2){JD=B.util.varReplace(JD,b,qD);var sD=qD}else{var sD=b;X+=" var "+b+" = "+qD+"; "}if(SD)X+=" "+JD+" ";else{if(o&&o[FD]){if(X+=" if ( "+sD+" === undefined ",n)X+=" || ! Object.prototype.hasOwnProperty.call("+U+", '"+B.util.escapeQuotes(FD)+"') ";X+=") { "+N+" = false; ";var T=B.errorPath,c=q,v0=B.util.escapeQuotes(FD);if(B.opts._errorDataPathProperty)B.errorPath=B.util.getPath(T,FD,B.opts.jsonPointers);q=B.errSchemaPath+"/required";var l=l||[];if(l.push(X),X="",B.createErrors!==!1){if(X+=" { keyword: 'required' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(q)+" , params: { missingProperty: '"+v0+"' } ",B.opts.messages!==!1){if(X+=" , message: '",B.opts._errorDataPathProperty)X+="is a required property";else X+="should have required property \\'"+v0+"\\'";X+="' "}if(B.opts.verbose)X+=" , schema: validate.schema"+G+" , parentSchema: validate.schema"+B.schemaPath+" , data: "+U+" ";X+=" } "}else X+=" {} ";var p=X;if(X=l.pop(),!B.compositeRule&&A)if(B.async)X+=" throw new ValidationError(["+p+"]); ";else X+=" validate.errors = ["+p+"]; return false; ";else X+=" var err = "+p+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";q=c,B.errorPath=T,X+=" } else { "}else if(A){if(X+=" if ( "+sD+" === undefined ",n)X+=" || ! Object.prototype.hasOwnProperty.call("+U+", '"+B.util.escapeQuotes(FD)+"') ";X+=") { "+N+" = true; } else { "}else{if(X+=" if ("+sD+" !== undefined ",n)X+=" && Object.prototype.hasOwnProperty.call("+U+", '"+B.util.escapeQuotes(FD)+"') ";X+=" ) { "}X+=" "+JD+" } "}}if(A)X+=" if ("+N+") { ",V+="}"}}}if(O.length){var R0=O;if(R0){var j,g8=-1,F1=R0.length-1;while(g8<F1){j=R0[g8+=1];var mD=f[j];if(B.opts.strictKeywords?typeof mD=="object"&&Object.keys(mD).length>0||mD===!1:B.util.schemaHasRules(mD,B.RULES.all)){if(H.schema=mD,H.schemaPath=B.schemaPath+".patternProperties"+B.util.getProperty(j),H.errSchemaPath=B.errSchemaPath+"/patternProperties/"+B.util.escapeFragment(j),n)X+=" "+I+" = "+I+" || Object.keys("+U+"); for (var "+R+"=0; "+R+"<"+I+".length; "+R+"++) { var "+L+" = "+I+"["+R+"]; ";else X+=" for (var "+L+" in "+U+") { ";X+=" if ("+B.usePattern(j)+".test("+L+")) { ",H.errorPath=B.util.getPathExpr(B.errorPath,L,B.opts.jsonPointers);var qD=U+"["+L+"]";H.dataPathArr[k]=L;var JD=B.validate(H);if(H.baseId=a,B.util.varOccurences(JD,b)<2)X+=" "+B.util.varReplace(JD,b,qD)+" ";else X+=" var "+b+" = "+qD+"; "+JD+" ";if(A)X+=" if (!"+N+") break; ";if(X+=" } ",A)X+=" else "+N+" = true; ";if(X+=" } ",A)X+=" if ("+N+") { ",V+="}"}}}}if(A)X+=" "+V+" if ("+Z+" == errors) {";return X}}),nq=KD((D,F)=>{F.exports=function Q(B,Y,J){var X=" ",C=B.level,z=B.dataLevel,W=B.schema[Y],G=B.schemaPath+B.util.getProperty(Y),q=B.errSchemaPath+"/"+Y,A=!B.opts.allErrors,U="data"+(z||""),Z="errs__"+C,H=B.util.copy(B),V="";H.level++;var N="valid"+H.level;if(X+="var "+Z+" = errors;",B.opts.strictKeywords?typeof W=="object"&&Object.keys(W).length>0||W===!1:B.util.schemaHasRules(W,B.RULES.all)){H.schema=W,H.schemaPath=G,H.errSchemaPath=q;var L="key"+C,R="idx"+C,k="i"+C,b="' + "+L+" + '",I=H.dataLevel=B.dataLevel+1,u="data"+I,f="dataProperties"+C,O=B.opts.ownProperties,y=B.baseId;if(O)X+=" var "+f+" = undefined; ";if(O)X+=" "+f+" = "+f+" || Object.keys("+U+"); for (var "+R+"=0; "+R+"<"+f+".length; "+R+"++) { var "+L+" = "+f+"["+R+"]; ";else X+=" for (var "+L+" in "+U+") { ";X+=" var startErrs"+C+" = errors; ";var x=L,w=B.compositeRule;B.compositeRule=H.compositeRule=!0;var S=B.validate(H);if(H.baseId=y,B.util.varOccurences(S,u)<2)X+=" "+B.util.varReplace(S,u,x)+" ";else X+=" var "+u+" = "+x+"; "+S+" ";if(B.compositeRule=H.compositeRule=w,X+=" if (!"+N+") { for (var "+k+"=startErrs"+C+"; "+k+"<errors; "+k+"++) { vErrors["+k+"].propertyName = "+L+"; } var err = ",B.createErrors!==!1){if(X+=" { keyword: 'propertyNames' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(q)+" , params: { propertyName: '"+b+"' } ",B.opts.messages!==!1)X+=" , message: 'property name \\'"+b+"\\' is invalid' ";if(B.opts.verbose)X+=" , schema: validate.schema"+G+" , parentSchema: validate.schema"+B.schemaPath+" , data: "+U+" ";X+=" } "}else X+=" {} ";if(X+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!B.compositeRule&&A)if(B.async)X+=" throw new ValidationError(vErrors); ";else X+=" validate.errors = vErrors; return false; ";if(A)X+=" break; ";X+=" } }"}if(A)X+=" "+V+" if ("+Z+" == errors) {";return X}}),iq=KD((D,F)=>{F.exports=function Q(B,Y,J){var X=" ",C=B.level,z=B.dataLevel,W=B.schema[Y],G=B.schemaPath+B.util.getProperty(Y),q=B.errSchemaPath+"/"+Y,A=!B.opts.allErrors,U="data"+(z||""),Z="valid"+C,H=B.opts.$data&&W&&W.$data,V;if(H)X+=" var schema"+C+" = "+B.util.getData(W.$data,z,B.dataPathArr)+"; ",V="schema"+C;else V=W;var N="schema"+C;if(!H)if(W.length<B.opts.loopRequired&&B.schema.properties&&Object.keys(B.schema.properties).length){var L=[],R=W;if(R){var k,b=-1,I=R.length-1;while(b<I){k=R[b+=1];var u=B.schema.properties[k];if(!(u&&(B.opts.strictKeywords?typeof u=="object"&&Object.keys(u).length>0||u===!1:B.util.schemaHasRules(u,B.RULES.all))))L[L.length]=k}}}else var L=W;if(H||L.length){var f=B.errorPath,O=H||L.length>=B.opts.loopRequired,y=B.opts.ownProperties;if(A)if(X+=" var missing"+C+"; ",O){if(!H)X+=" var "+N+" = validate.schema"+G+"; ";var x="i"+C,w="schema"+C+"["+x+"]",S="' + "+w+" + '";if(B.opts._errorDataPathProperty)B.errorPath=B.util.getPathExpr(f,w,B.opts.jsonPointers);if(X+=" var "+Z+" = true; ",H)X+=" if (schema"+C+" === undefined) "+Z+" = true; else if (!Array.isArray(schema"+C+")) "+Z+" = false; else {";if(X+=" for (var "+x+" = 0; "+x+" < "+N+".length; "+x+"++) { "+Z+" = "+U+"["+N+"["+x+"]] !== undefined ",y)X+=" && Object.prototype.hasOwnProperty.call("+U+", "+N+"["+x+"]) ";if(X+="; if (!"+Z+") break; } ",H)X+=" } ";X+=" if (!"+Z+") { ";var g=g||[];if(g.push(X),X="",B.createErrors!==!1){if(X+=" { keyword: 'required' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(q)+" , params: { missingProperty: '"+S+"' } ",B.opts.messages!==!1){if(X+=" , message: '",B.opts._errorDataPathProperty)X+="is a required property";else X+="should have required property \\'"+S+"\\'";X+="' "}if(B.opts.verbose)X+=" , schema: validate.schema"+G+" , parentSchema: validate.schema"+B.schemaPath+" , data: "+U+" ";X+=" } "}else X+=" {} ";var d=X;if(X=g.pop(),!B.compositeRule&&A)if(B.async)X+=" throw new ValidationError(["+d+"]); ";else X+=" validate.errors = ["+d+"]; return false; ";else X+=" var err = "+d+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";X+=" } else { "}else{X+=" if ( ";var n=L;if(n){var a,x=-1,DD=n.length-1;while(x<DD){if(a=n[x+=1],x)X+=" || ";var o=B.util.getProperty(a),XD=U+o;if(X+=" ( ( "+XD+" === undefined ",y)X+=" || ! Object.prototype.hasOwnProperty.call("+U+", '"+B.util.escapeQuotes(a)+"') ";X+=") && (missing"+C+" = "+B.util.toQuotedString(B.opts.jsonPointers?a:o)+") ) "}}X+=") { ";var w="missing"+C,S="' + "+w+" + '";if(B.opts._errorDataPathProperty)B.errorPath=B.opts.jsonPointers?B.util.getPathExpr(f,w,!0):f+" + "+w;var g=g||[];if(g.push(X),X="",B.createErrors!==!1){if(X+=" { keyword: 'required' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(q)+" , params: { missingProperty: '"+S+"' } ",B.opts.messages!==!1){if(X+=" , message: '",B.opts._errorDataPathProperty)X+="is a required property";else X+="should have required property \\'"+S+"\\'";X+="' "}if(B.opts.verbose)X+=" , schema: validate.schema"+G+" , parentSchema: validate.schema"+B.schemaPath+" , data: "+U+" ";X+=" } "}else X+=" {} ";var d=X;if(X=g.pop(),!B.compositeRule&&A)if(B.async)X+=" throw new ValidationError(["+d+"]); ";else X+=" validate.errors = ["+d+"]; return false; ";else X+=" var err = "+d+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";X+=" } else { "}else if(O){if(!H)X+=" var "+N+" = validate.schema"+G+"; ";var x="i"+C,w="schema"+C+"["+x+"]",S="' + "+w+" + '";if(B.opts._errorDataPathProperty)B.errorPath=B.util.getPathExpr(f,w,B.opts.jsonPointers);if(H){if(X+=" if ("+N+" && !Array.isArray("+N+")) { var err = ",B.createErrors!==!1){if(X+=" { keyword: 'required' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(q)+" , params: { missingProperty: '"+S+"' } ",B.opts.messages!==!1){if(X+=" , message: '",B.opts._errorDataPathProperty)X+="is a required property";else X+="should have required property \\'"+S+"\\'";X+="' "}if(B.opts.verbose)X+=" , schema: validate.schema"+G+" , parentSchema: validate.schema"+B.schemaPath+" , data: "+U+" ";X+=" } "}else X+=" {} ";X+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if ("+N+" !== undefined) { "}if(X+=" for (var "+x+" = 0; "+x+" < "+N+".length; "+x+"++) { if ("+U+"["+N+"["+x+"]] === undefined ",y)X+=" || ! Object.prototype.hasOwnProperty.call("+U+", "+N+"["+x+"]) ";if(X+=") { var err = ",B.createErrors!==!1){if(X+=" { keyword: 'required' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(q)+" , params: { missingProperty: '"+S+"' } ",B.opts.messages!==!1){if(X+=" , message: '",B.opts._errorDataPathProperty)X+="is a required property";else X+="should have required property \\'"+S+"\\'";X+="' "}if(B.opts.verbose)X+=" , schema: validate.schema"+G+" , parentSchema: validate.schema"+B.schemaPath+" , data: "+U+" ";X+=" } "}else X+=" {} ";if(X+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ",H)X+=" } "}else{var YD=L;if(YD){var a,FD=-1,LD=YD.length-1;while(FD<LD){a=YD[FD+=1];var o=B.util.getProperty(a),S=B.util.escapeQuotes(a),XD=U+o;if(B.opts._errorDataPathProperty)B.errorPath=B.util.getPath(f,a,B.opts.jsonPointers);if(X+=" if ( "+XD+" === undefined ",y)X+=" || ! Object.prototype.hasOwnProperty.call("+U+", '"+B.util.escapeQuotes(a)+"') ";if(X+=") { var err = ",B.createErrors!==!1){if(X+=" { keyword: 'required' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(q)+" , params: { missingProperty: '"+S+"' } ",B.opts.messages!==!1){if(X+=" , message: '",B.opts._errorDataPathProperty)X+="is a required property";else X+="should have required property \\'"+S+"\\'";X+="' "}if(B.opts.verbose)X+=" , schema: validate.schema"+G+" , parentSchema: validate.schema"+B.schemaPath+" , data: "+U+" ";X+=" } "}else X+=" {} ";X+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}}B.errorPath=f}else if(A)X+=" if (true) {";return X}}),aq=KD((D,F)=>{F.exports=function Q(B,Y,J){var X=" ",C=B.level,z=B.dataLevel,W=B.schema[Y],G=B.schemaPath+B.util.getProperty(Y),q=B.errSchemaPath+"/"+Y,A=!B.opts.allErrors,U="data"+(z||""),Z="valid"+C,H=B.opts.$data&&W&&W.$data,V;if(H)X+=" var schema"+C+" = "+B.util.getData(W.$data,z,B.dataPathArr)+"; ",V="schema"+C;else V=W;if((W||H)&&B.opts.uniqueItems!==!1){if(H)X+=" var "+Z+"; if ("+V+" === false || "+V+" === undefined) "+Z+" = true; else if (typeof "+V+" != 'boolean') "+Z+" = false; else { ";X+=" var i = "+U+".length , "+Z+" = true , j; if (i > 1) { ";var N=B.schema.items&&B.schema.items.type,L=Array.isArray(N);if(!N||N=="object"||N=="array"||L&&(N.indexOf("object")>=0||N.indexOf("array")>=0))X+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+U+"[i], "+U+"[j])) { "+Z+" = false; break outer; } } } ";else{X+=" var itemIndices = {}, item; for (;i--;) { var item = "+U+"[i]; ";var R="checkDataType"+(L?"s":"");if(X+=" if ("+B.util[R](N,"item",B.opts.strictNumbers,!0)+") continue; ",L)X+=` if (typeof item == 'string') item = '"' + item; `;X+=" if (typeof itemIndices[item] == 'number') { "+Z+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}if(X+=" } ",H)X+=" } ";X+=" if (!"+Z+") { ";var k=k||[];if(k.push(X),X="",B.createErrors!==!1){if(X+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(q)+" , params: { i: i, j: j } ",B.opts.messages!==!1)X+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' ";if(B.opts.verbose){if(X+=" , schema: ",H)X+="validate.schema"+G;else X+=""+W;X+=" , parentSchema: validate.schema"+B.schemaPath+" , data: "+U+" "}X+=" } "}else X+=" {} ";var b=X;if(X=k.pop(),!B.compositeRule&&A)if(B.async)X+=" throw new ValidationError(["+b+"]); ";else X+=" validate.errors = ["+b+"]; return false; ";else X+=" var err = "+b+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(X+=" } ",A)X+=" else { "}else if(A)X+=" if (true) { ";return X}}),rq=KD((D,F)=>{F.exports={$ref:Sq(),allOf:kq(),anyOf:bq(),$comment:vq(),const:xq(),contains:uq(),dependencies:yq(),enum:fq(),format:gq(),if:$q(),items:hq(),maximum:sB(),minimum:sB(),maxItems:tB(),minItems:tB(),maxLength:eB(),minLength:eB(),maxProperties:DQ(),minProperties:DQ(),multipleOf:mq(),not:lq(),oneOf:dq(),pattern:cq(),properties:pq(),propertyNames:nq(),required:iq(),uniqueItems:aq(),validate:zQ()}}),oq=KD((D,F)=>{var Q=rq(),B=f2().toHash;F.exports=function Y(){var J=[{type:"number",rules:[{maximum:["exclusiveMaximum"]},{minimum:["exclusiveMinimum"]},"multipleOf","format"]},{type:"string",rules:["maxLength","minLength","pattern","format"]},{type:"array",rules:["maxItems","minItems","items","contains","uniqueItems"]},{type:"object",rules:["maxProperties","minProperties","required","dependencies","propertyNames",{properties:["additionalProperties","patternProperties"]}]},{rules:["$ref","const","enum","not","anyOf","oneOf","allOf","if"]}],X=["type","$comment"],C=["$schema","$id","id","$data","$async","title","description","default","definitions","examples","readOnly","writeOnly","contentMediaType","contentEncoding","additionalItems","then","else"],z=["number","integer","string","array","object","boolean","null"];return J.all=B(X),J.types=B(z),J.forEach(function(W){if(W.rules=W.rules.map(function(G){var q;if(typeof G=="object"){var A=Object.keys(G)[0];q=G[A],G=A,q.forEach(function(Z){X.push(Z),J.all[Z]=!0})}X.push(G);var U=J.all[G]={keyword:G,code:Q[G],implements:q};return U}),J.all.$comment={keyword:"$comment",code:Q.$comment},W.type)J.types[W.type]=W}),J.keywords=B(X.concat(C)),J.custom={},J}}),sq=KD((D,F)=>{var Q=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];F.exports=function(B,Y){for(var J=0;J<Y.length;J++){B=JSON.parse(JSON.stringify(B));var X=Y[J].split("/"),C=B,z;for(z=1;z<X.length;z++)C=C[X[z]];for(z=0;z<Q.length;z++){var W=Q[z],G=C[W];if(G)C[W]={anyOf:[G,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]}}}return B}}),tq=KD((D,F)=>{var Q=H9().MissingRef;F.exports=B;function B(Y,J,X){var C=this;if(typeof this._opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");if(typeof J=="function")X=J,J=void 0;var z=W(Y).then(function(){var q=C._addSchema(Y,void 0,J);return q.validate||G(q)});if(X)z.then(function(q){X(null,q)},X);return z;function W(q){var A=q.$schema;return A&&!C.getSchema(A)?B.call(C,{$ref:A},!0):Promise.resolve()}function G(q){try{return C._compile(q)}catch(U){if(U instanceof Q)return A(U);throw U}function A(U){var Z=U.missingSchema;if(N(Z))throw new Error("Schema "+Z+" is loaded but "+U.missingRef+" cannot be resolved");var H=C._loadingSchemas[Z];if(!H)H=C._loadingSchemas[Z]=C._opts.loadSchema(Z),H.then(V,V);return H.then(function(L){if(!N(Z))return W(L).then(function(){if(!N(Z))C.addSchema(L,Z,void 0,J)})}).then(function(){return G(q)});function V(){delete C._loadingSchemas[Z]}function N(L){return C._refs[L]||C._schemas[L]}}}}}),eq=KD((D,F)=>{F.exports=function Q(B,Y,J){var X=" ",C=B.level,z=B.dataLevel,W=B.schema[Y],G=B.schemaPath+B.util.getProperty(Y),q=B.errSchemaPath+"/"+Y,A=!B.opts.allErrors,U,Z="data"+(z||""),H="valid"+C,V="errs__"+C,N=B.opts.$data&&W&&W.$data,L;if(N)X+=" var schema"+C+" = "+B.util.getData(W.$data,z,B.dataPathArr)+"; ",L="schema"+C;else L=W;var R=this,k="definition"+C,b=R.definition,I="",u,f,O,y,x;if(N&&b.$data){x="keywordValidate"+C;var w=b.validateSchema;X+=" var "+k+" = RULES.custom['"+Y+"'].definition; var "+x+" = "+k+".validate;"}else{if(y=B.useCustomRule(R,W,B.schema,B),!y)return;L="validate.schema"+G,x=y.code,u=b.compile,f=b.inline,O=b.macro}var S=x+".errors",g="i"+C,d="ruleErr"+C,n=b.async;if(n&&!B.async)throw new Error("async keyword in sync schema");if(!(f||O))X+=""+S+" = null;";if(X+="var "+V+" = errors;var "+H+";",N&&b.$data){if(I+="}",X+=" if ("+L+" === undefined) { "+H+" = true; } else { ",w)I+="}",X+=" "+H+" = "+k+".validateSchema("+L+"); if ("+H+") { "}if(f)if(b.statements)X+=" "+y.validate+" ";else X+=" "+H+" = "+y.validate+"; ";else if(O){var a=B.util.copy(B),I="";a.level++;var DD="valid"+a.level;a.schema=y.validate,a.schemaPath="";var o=B.compositeRule;B.compositeRule=a.compositeRule=!0;var XD=B.validate(a).replace(/validate\.schema/g,x);B.compositeRule=a.compositeRule=o,X+=" "+XD}else{var YD=YD||[];if(YD.push(X),X="",X+=" "+x+".call( ",B.opts.passContext)X+="this";else X+="self";if(u||b.schema===!1)X+=" , "+Z+" ";else X+=" , "+L+" , "+Z+" , validate.schema"+B.schemaPath+" ";if(X+=" , (dataPath || '')",B.errorPath!='""')X+=" + "+B.errorPath;var FD=z?"data"+(z-1||""):"parentData",LD=z?B.dataPathArr[z]:"parentDataProperty";X+=" , "+FD+" , "+LD+" , rootData ) ";var hD=X;if(X=YD.pop(),b.errors===!1){if(X+=" "+H+" = ",n)X+="await ";X+=""+hD+"; "}else if(n)S="customErrors"+C,X+=" var "+S+" = null; try { "+H+" = await "+hD+"; } catch (e) { "+H+" = false; if (e instanceof ValidationError) "+S+" = e.errors; else throw e; } ";else X+=" "+S+" = null; "+H+" = "+hD+"; "}if(b.modifying)X+=" if ("+FD+") "+Z+" = "+FD+"["+LD+"];";if(X+=""+I,b.valid){if(A)X+=" if (true) { "}else{if(X+=" if ( ",b.valid===void 0)if(X+=" !",O)X+=""+DD;else X+=""+H;else X+=" "+!b.valid+" ";X+=") { ",U=R.keyword;var YD=YD||[];YD.push(X),X="";var YD=YD||[];if(YD.push(X),X="",B.createErrors!==!1){if(X+=" { keyword: '"+(U||"custom")+"' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(q)+" , params: { keyword: '"+R.keyword+"' } ",B.opts.messages!==!1)X+=` , message: 'should pass "`+R.keyword+`" keyword validation' `;if(B.opts.verbose)X+=" , schema: validate.schema"+G+" , parentSchema: validate.schema"+B.schemaPath+" , data: "+Z+" ";X+=" } "}else X+=" {} ";var cD=X;if(X=YD.pop(),!B.compositeRule&&A)if(B.async)X+=" throw new ValidationError(["+cD+"]); ";else X+=" validate.errors = ["+cD+"]; return false; ";else X+=" var err = "+cD+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var j=X;if(X=YD.pop(),f)if(b.errors){if(b.errors!="full"){if(X+=" for (var "+g+"="+V+"; "+g+"<errors; "+g+"++) { var "+d+" = vErrors["+g+"]; if ("+d+".dataPath === undefined) "+d+".dataPath = (dataPath || '') + "+B.errorPath+"; if ("+d+".schemaPath === undefined) { "+d+'.schemaPath = "'+q+'"; } ',B.opts.verbose)X+=" "+d+".schema = "+L+"; "+d+".data = "+Z+"; ";X+=" } "}}else if(b.errors===!1)X+=" "+j+" ";else{if(X+=" if ("+V+" == errors) { "+j+" } else { for (var "+g+"="+V+"; "+g+"<errors; "+g+"++) { var "+d+" = vErrors["+g+"]; if ("+d+".dataPath === undefined) "+d+".dataPath = (dataPath || '') + "+B.errorPath+"; if ("+d+".schemaPath === undefined) { "+d+'.schemaPath = "'+q+'"; } ',B.opts.verbose)X+=" "+d+".schema = "+L+"; "+d+".data = "+Z+"; ";X+=" } } "}else if(O){if(X+=" var err = ",B.createErrors!==!1){if(X+=" { keyword: '"+(U||"custom")+"' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(q)+" , params: { keyword: '"+R.keyword+"' } ",B.opts.messages!==!1)X+=` , message: 'should pass "`+R.keyword+`" keyword validation' `;if(B.opts.verbose)X+=" , schema: validate.schema"+G+" , parentSchema: validate.schema"+B.schemaPath+" , data: "+Z+" ";X+=" } "}else X+=" {} ";if(X+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!B.compositeRule&&A)if(B.async)X+=" throw new ValidationError(vErrors); ";else X+=" validate.errors = vErrors; return false; "}else if(b.errors===!1)X+=" "+j+" ";else{if(X+=" if (Array.isArray("+S+")) { if (vErrors === null) vErrors = "+S+"; else vErrors = vErrors.concat("+S+"); errors = vErrors.length; for (var "+g+"="+V+"; "+g+"<errors; "+g+"++) { var "+d+" = vErrors["+g+"]; if ("+d+".dataPath === undefined) "+d+".dataPath = (dataPath || '') + "+B.errorPath+"; "+d+'.schemaPath = "'+q+'"; ',B.opts.verbose)X+=" "+d+".schema = "+L+"; "+d+".data = "+Z+"; ";X+=" } } else { "+j+" } "}if(X+=" } ",A)X+=" else { "}return X}}),GQ=KD((D,F)=>{F.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}}),DH=KD((D,F)=>{var Q=GQ();F.exports={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:Q.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:Q.properties.type,schema:{type:"boolean"},statements:{type:"boolean"},dependencies:{type:"array",items:{type:"string"}},metaSchema:{type:"object"},modifying:{type:"boolean"},valid:{type:"boolean"},$data:{type:"boolean"},async:{type:"boolean"},errors:{anyOf:[{type:"boolean"},{const:"full"}]}}}}),FH=KD((D,F)=>{var Q=/^[a-z_$][a-z0-9_$-]*$/i,B=eq(),Y=DH();F.exports={add:J,get:X,remove:C,validate:z};function J(W,G){var q=this.RULES;if(q.keywords[W])throw new Error("Keyword "+W+" is already defined");if(!Q.test(W))throw new Error("Keyword "+W+" is not a valid identifier");if(G){this.validateKeyword(G,!0);var A=G.type;if(Array.isArray(A))for(var U=0;U<A.length;U++)H(W,A[U],G);else H(W,A,G);var Z=G.metaSchema;if(Z){if(G.$data&&this._opts.$data)Z={anyOf:[Z,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]};G.validateSchema=this.compile(Z,!0)}}q.keywords[W]=q.all[W]=!0;function H(V,N,L){var R;for(var k=0;k<q.length;k++){var b=q[k];if(b.type==N){R=b;break}}if(!R)R={type:N,rules:[]},q.push(R);var I={keyword:V,definition:L,custom:!0,code:B,implements:L.implements};R.rules.push(I),q.custom[V]=I}return this}function X(W){var G=this.RULES.custom[W];return G?G.definition:this.RULES.keywords[W]||!1}function C(W){var G=this.RULES;delete G.keywords[W],delete G.all[W],delete G.custom[W];for(var q=0;q<G.length;q++){var A=G[q].rules;for(var U=0;U<A.length;U++)if(A[U].keyword==W){A.splice(U,1);break}}return this}function z(W,G){z.errors=null;var q=this._validateKeyword=this._validateKeyword||this.compile(Y,!0);if(q(W))return!0;if(z.errors=q.errors,G)throw new Error("custom keyword definition is invalid: "+this.errorsText(q.errors));else return!1}}),BH=KD((D,F)=>{F.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON Schema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}}),QH=KD((D,F)=>{var Q=wq(),B=q9(),Y=Tq(),J=CQ(),X=WQ(),C=Pq(),z=oq(),W=sq(),G=f2();F.exports=V,V.prototype.validate=N,V.prototype.compile=L,V.prototype.addSchema=R,V.prototype.addMetaSchema=k,V.prototype.validateSchema=b,V.prototype.getSchema=u,V.prototype.removeSchema=y,V.prototype.addFormat=o,V.prototype.errorsText=DD,V.prototype._addSchema=w,V.prototype._compile=S,V.prototype.compileAsync=tq();var q=FH();V.prototype.addKeyword=q.add,V.prototype.getKeyword=q.get,V.prototype.removeKeyword=q.remove,V.prototype.validateKeyword=q.validate;var A=H9();V.ValidationError=A.Validation,V.MissingRefError=A.MissingRef,V.$dataMetaSchema=W;var U="http://json-schema.org/draft-07/schema",Z=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],H=["/properties"];function V(K){if(!(this instanceof V))return new V(K);if(K=this._opts=G.copy(K)||{},j(this),this._schemas={},this._refs={},this._fragments={},this._formats=C(K.format),this._cache=K.cache||new Y,this._loadingSchemas={},this._compilations=[],this.RULES=z(),this._getId=g(K),K.loopRequired=K.loopRequired||1/0,K.errorDataPath=="property")K._errorDataPathProperty=!0;if(K.serialize===void 0)K.serialize=X;if(this._metaOpts=cD(this),K.formats)FD(this);if(K.keywords)LD(this);if(XD(this),typeof K.meta=="object")this.addMetaSchema(K.meta);if(K.nullable)this.addKeyword("nullable",{metaSchema:{type:"boolean"}});YD(this)}function N(K,T){var h;if(typeof K=="string"){if(h=this.getSchema(K),!h)throw new Error('no schema with key or ref "'+K+'"')}else{var c=this._addSchema(K);h=c.validate||this._compile(c)}var l=h(T);if(h.$async!==!0)this.errors=h.errors;return l}function L(K,T){var h=this._addSchema(K,void 0,T);return h.validate||this._compile(h)}function R(K,T,h,c){if(Array.isArray(K)){for(var l=0;l<K.length;l++)this.addSchema(K[l],void 0,h,c);return this}var p=this._getId(K);if(p!==void 0&&typeof p!="string")throw new Error("schema id must be string");return T=B.normalizeId(T||p),hD(this,T),this._schemas[T]=this._addSchema(K,h,c,!0),this}function k(K,T,h){return this.addSchema(K,T,h,!0),this}function b(K,T){var h=K.$schema;if(h!==void 0&&typeof h!="string")throw new Error("$schema must be a string");if(h=h||this._opts.defaultMeta||I(this),!h)return this.logger.warn("meta-schema not available"),this.errors=null,!0;var c=this.validate(h,K);if(!c&&T){var l="schema is invalid: "+this.errorsText();if(this._opts.validateSchema=="log")this.logger.error(l);else throw new Error(l)}return c}function I(K){var T=K._opts.meta;return K._opts.defaultMeta=typeof T=="object"?K._getId(T)||T:K.getSchema(U)?U:void 0,K._opts.defaultMeta}function u(K){var T=O(this,K);switch(typeof T){case"object":return T.validate||this._compile(T);case"string":return this.getSchema(T);case"undefined":return f(this,K)}}function f(K,T){var h=B.schema.call(K,{schema:{}},T);if(h){var{schema:c,root:l,baseId:p}=h,BD=Q.call(K,c,l,void 0,p);return K._fragments[T]=new J({ref:T,fragment:!0,schema:c,root:l,baseId:p,validate:BD}),BD}}function O(K,T){return T=B.normalizeId(T),K._schemas[T]||K._refs[T]||K._fragments[T]}function y(K){if(K instanceof RegExp)return x(this,this._schemas,K),x(this,this._refs,K),this;switch(typeof K){case"undefined":return x(this,this._schemas),x(this,this._refs),this._cache.clear(),this;case"string":var T=O(this,K);if(T)this._cache.del(T.cacheKey);return delete this._schemas[K],delete this._refs[K],this;case"object":var h=this._opts.serialize,c=h?h(K):K;this._cache.del(c);var l=this._getId(K);if(l)l=B.normalizeId(l),delete this._schemas[l],delete this._refs[l]}return this}function x(K,T,h){for(var c in T){var l=T[c];if(!l.meta&&(!h||h.test(c)))K._cache.del(l.cacheKey),delete T[c]}}function w(K,T,h,c){if(typeof K!="object"&&typeof K!="boolean")throw new Error("schema should be object or boolean");var l=this._opts.serialize,p=l?l(K):K,BD=this._cache.get(p);if(BD)return BD;c=c||this._opts.addUsedSchema!==!1;var qD=B.normalizeId(this._getId(K));if(qD&&c)hD(this,qD);var JD=this._opts.validateSchema!==!1&&!T,ZD;if(JD&&!(ZD=qD&&qD==B.normalizeId(K.$schema)))this.validateSchema(K,!0);var PD=B.ids.call(this,K),RD=new J({id:qD,schema:K,localRefs:PD,cacheKey:p,meta:h});if(qD[0]!="#"&&c)this._refs[qD]=RD;if(this._cache.put(p,RD),JD&&ZD)this.validateSchema(K,!0);return RD}function S(K,T){if(K.compiling){if(K.validate=l,l.schema=K.schema,l.errors=null,l.root=T?T:l,K.schema.$async===!0)l.$async=!0;return l}K.compiling=!0;var h;if(K.meta)h=this._opts,this._opts=this._metaOpts;var c;try{c=Q.call(this,K.schema,T,K.localRefs)}catch(p){throw delete K.validate,p}finally{if(K.compiling=!1,K.meta)this._opts=h}return K.validate=c,K.refs=c.refs,K.refVal=c.refVal,K.root=c.root,c;function l(){var p=K.validate,BD=p.apply(this,arguments);return l.errors=p.errors,BD}}function g(K){switch(K.schemaId){case"auto":return a;case"id":return d;default:return n}}function d(K){if(K.$id)this.logger.warn("schema $id ignored",K.$id);return K.id}function n(K){if(K.id)this.logger.warn("schema id ignored",K.id);return K.$id}function a(K){if(K.$id&&K.id&&K.$id!=K.id)throw new Error("schema $id is different from id");return K.$id||K.id}function DD(K,T){if(K=K||this.errors,!K)return"No errors";T=T||{};var h=T.separator===void 0?", ":T.separator,c=T.dataVar===void 0?"data":T.dataVar,l="";for(var p=0;p<K.length;p++){var BD=K[p];if(BD)l+=c+BD.dataPath+" "+BD.message+h}return l.slice(0,-h.length)}function o(K,T){if(typeof T=="string")T=new RegExp(T);return this._formats[K]=T,this}function XD(K){var T;if(K._opts.$data)T=BH(),K.addMetaSchema(T,T.$id,!0);if(K._opts.meta===!1)return;var h=GQ();if(K._opts.$data)h=W(h,H);K.addMetaSchema(h,U,!0),K._refs["http://json-schema.org/schema"]=U}function YD(K){var T=K._opts.schemas;if(!T)return;if(Array.isArray(T))K.addSchema(T);else for(var h in T)K.addSchema(T[h],h)}function FD(K){for(var T in K._opts.formats){var h=K._opts.formats[T];K.addFormat(T,h)}}function LD(K){for(var T in K._opts.keywords){var h=K._opts.keywords[T];K.addKeyword(T,h)}}function hD(K,T){if(K._schemas[T]||K._refs[T])throw new Error('schema with key or id "'+T+'" already exists')}function cD(K){var T=G.copy(K._opts);for(var h=0;h<Z.length;h++)delete T[Z[h]];return T}function j(K){var T=K._opts.logger;if(T===!1)K.logger={log:_,warn:_,error:_};else{if(T===void 0)T=console;if(!(typeof T=="object"&&T.log&&T.warn&&T.error))throw new Error("logger must implement log, warn and error methods");K.logger=T}}function _(){}}),JH=50;function qQ(D=JH){let F=new AbortController;return YH(D,F.signal),F}var GH={accessSync(D,F){WD.accessSync(D,F)},cwd(){return process.cwd()},chmodSync(D,F){WD.chmodSync(D,F)},existsSync(D){return WD.existsSync(D)},async stat(D){return zH(D)},statSync(D){return WD.statSync(D)},readFileSync(D,F){return WD.readFileSync(D,{encoding:F.encoding})},readFileBytesSync(D){return WD.readFileSync(D)},readSync(D,F){let Q=void 0;try{Q=WD.openSync(D,"r");let B=Buffer.alloc(F.length),Y=WD.readSync(Q,B,0,F.length,0);return{buffer:B,bytesRead:Y}}finally{if(Q)WD.closeSync(Q)}},writeFileSync(D,F,Q){if(!Q.flush){let Y={encoding:Q.encoding};if(Q.mode!==void 0)Y.mode=Q.mode;WD.writeFileSync(D,F,Y);return}let B;try{let Y=Q.mode!==void 0?Q.mode:void 0;B=WD.openSync(D,"w",Y),WD.writeFileSync(B,F,{encoding:Q.encoding}),WD.fsyncSync(B)}finally{if(B)WD.closeSync(B)}},appendFileSync(D,F){WD.appendFileSync(D,F)},copyFileSync(D,F){WD.copyFileSync(D,F)},unlinkSync(D){WD.unlinkSync(D)},renameSync(D,F){WD.renameSync(D,F)},linkSync(D,F){WD.linkSync(D,F)},symlinkSync(D,F){WD.symlinkSync(D,F)},readlinkSync(D){return WD.readlinkSync(D)},realpathSync(D){return WD.realpathSync(D)},mkdirSync(D){if(!WD.existsSync(D))WD.mkdirSync(D,{recursive:!0,mode:448})},readdirSync(D){return WD.readdirSync(D,{withFileTypes:!0})},readdirStringSync(D){return WD.readdirSync(D)},isDirEmptySync(D){return this.readdirSync(D).length===0},rmdirSync(D){WD.rmdirSync(D)},rmSync(D,F){WD.rmSync(D,F)},createWriteStream(D){return WD.createWriteStream(D)}},qH=GH;function HH(){return qH}class j2 extends Error{}function HQ(){return process.versions.bun!==void 0}class KQ{options;child;childStdin;childStdout;ready=!1;abortController;exitError;exitListeners=[];processExitHandler;abortHandler;constructor(D){this.options=D,this.abortController=D.abortController||qQ(),this.initialize()}initialize(){try{let{additionalDirectories:D=[],agents:F,cwd:Q,executable:B=HQ()?"bun":"node",executableArgs:Y=[],extraArgs:J={},pathToClaudeCodeExecutable:X,env:C={...process.env},stderr:z,customSystemPrompt:W,appendSystemPrompt:G,maxTurns:q,model:A,fallbackModel:U,permissionMode:Z,permissionPromptToolName:H,continueConversation:V,resume:N,settingSources:L,allowedTools:R=[],disallowedTools:k=[],mcpServers:b,strictMcpConfig:I,canUseTool:u,includePartialMessages:f}=this.options,O=["--output-format","stream-json","--verbose","--input-format","stream-json"];if(typeof W==="string")O.push("--system-prompt",W);if(G)O.push("--append-system-prompt",G);if(q)O.push("--max-turns",q.toString());if(A)O.push("--model",A);if(C.DEBUG)O.push("--debug-to-stderr");if(u){if(H)throw new Error("canUseTool callback cannot be used with permissionPromptToolName. Please use one or the other.");O.push("--permission-prompt-tool","stdio")}else if(H)O.push("--permission-prompt-tool",H);if(V)O.push("--continue");if(N)O.push("--resume",N);if(R.length>0)O.push("--allowedTools",R.join(","));if(k.length>0)O.push("--disallowedTools",k.join(","));if(b&&Object.keys(b).length>0)O.push("--mcp-config",JSON.stringify({mcpServers:b}));if(F&&Object.keys(F).length>0)O.push("--agents",JSON.stringify(F));if(L)O.push("--setting-sources",L.join(","));if(I)O.push("--strict-mcp-config");if(Z)O.push("--permission-mode",Z);if(U){if(A&&U===A)throw new Error("Fallback model cannot be the same as the main model. Please specify a different model for fallbackModel option.");O.push("--fallback-model",U)}if(f)O.push("--include-partial-messages");for(let n of D)O.push("--add-dir",n);if(this.options.forkSession)O.push("--fork-session");if(this.options.resumeSessionAt)O.push("--resume-session-at",this.options.resumeSessionAt);for(let[n,a]of Object.entries(J))if(a===null)O.push(`--${n}`);else O.push(`--${n}`,a);if(!C.CLAUDE_CODE_ENTRYPOINT)C.CLAUDE_CODE_ENTRYPOINT="sdk-ts";if(!HH().existsSync(X)){let n=BQ(X)?`Claude Code native binary not found at ${X}. Please ensure Claude Code is installed via native installer or specify a valid path with options.pathToClaudeCodeExecutable.`:`Claude Code executable not found at ${X}. Is options.pathToClaudeCodeExecutable set?`;throw new ReferenceError(n)}let x=BQ(X),w=x?X:B,S=x?O:[...Y,X,...O];this.logForDebugging(x?`Spawning Claude Code native binary: ${X} ${O.join(" ")}`:`Spawning Claude Code process: ${B} ${[...Y,X,...O].join(" ")}`);let g=C.DEBUG||z?"pipe":"ignore";if(this.child=CH(w,S,{cwd:Q,stdio:["pipe","pipe",g],signal:this.abortController.signal,env:C}),this.childStdin=this.child.stdin,this.childStdout=this.child.stdout,C.DEBUG||z)this.child.stderr.on("data",(n)=>{if(this.logForDebugging(`Claude Code stderr: ${n.toString()}`),z)z(n.toString())});let d=()=>{if(this.child&&!this.child.killed)this.child.kill("SIGTERM")};this.processExitHandler=d,this.abortHandler=d,process.on("exit",this.processExitHandler),this.abortController.signal.addEventListener("abort",this.abortHandler),this.child.on("error",(n)=>{if(this.ready=!1,this.abortController.signal.aborted)this.exitError=new j2("Claude Code process aborted by user");else this.exitError=new Error(`Failed to spawn Claude Code process: ${n.message}`),this.logForDebugging(this.exitError.message)}),this.child.on("close",(n,a)=>{if(this.ready=!1,this.abortController.signal.aborted)this.exitError=new j2("Claude Code process aborted by user");else{let DD=this.getProcessExitError(n,a);if(DD)this.exitError=DD,this.logForDebugging(DD.message)}}),this.ready=!0}catch(D){throw this.ready=!1,D}}getProcessExitError(D,F){if(D!==0&&D!==null)return new Error(`Claude Code process exited with code ${D}`);else if(F)return new Error(`Claude Code process terminated by signal ${F}`);return}logForDebugging(D){if(process.env.DEBUG)process.stderr.write(`${D}
471
+ `),console.log("─".repeat(80));let B=0,Y=0,J=0;for(let X of Q){if(B+=X.size,X.isDirectory)Y++;else J++;let C=X.isDirectory?"\uD83D\uDCC1":"\uD83D\uDCC4",W=X.trashedAt.toLocaleString(),z=mB(X.size);console.log(`${C} ${X.originalName}`),console.log(` Size: ${z} | Trashed: ${W}`),console.log(` ID: ${X.trashedName}`),console.log()}console.log("─".repeat(80)),console.log(`Total: ${Y} folders, ${J} files (${mB(B)})`),console.log(`
472
+ To restore files: claude-mem restore`),console.log("To empty trash: claude-mem trash empty")}catch(F){if(F.code==="ENOENT")K0.info("\uD83D\uDDD1️ Trash is empty");else K0.error("Failed to read trash directory"),console.error(F)}}import{rmSync as Hq,readdirSync as Kq,existsSync as Uq,statSync as Eq}from"fs";import{join as iB}from"path";E0();async function aB(D={}){let F=CD.getInstance().getTrashDirectory();if(!Uq(F)){K0.info("\uD83D\uDDD1️ Trash is already empty");return}try{let Q=Kq(F);if(Q.length===0){K0.info("\uD83D\uDDD1️ Trash is already empty");return}let B=0,Y=0;for(let X of Q){let C=iB(F,X);if(Eq(C).isDirectory())B++;else Y++}if(!D.force){let X=await z2({message:`Permanently delete ${B} folders and ${Y} files from trash?`,initialValue:!1});if(y0(X)||!X){K0.info("Cancelled - trash not emptied");return}}let J=I3();J.start("Emptying trash...");for(let X of Q){let C=iB(F,X);Hq(C,{recursive:!0,force:!0})}J.stop(`\uD83D\uDDD1️ Trash emptied - permanently deleted ${B} folders and ${Y} files`)}catch(Q){K0.error("Failed to empty trash"),console.error(Q),process.exit(1)}}import{readdirSync as Aq,renameSync as Zq}from"fs";import{join as rB}from"path";E0();async function oB(){let D=CD.getInstance().getTrashDirectory(),F=Aq(D);if(F.length===0){console.log("Trash is empty");return}let Q=await s8({message:"Select file to restore:",options:F.map((B)=>({value:B,label:B}))});if(y0(Q))return;Zq(rB(D,Q),rB(process.cwd(),Q)),console.log(`Restored ${Q}`)}import{join as FQ}from"path";import{fileURLToPath as XH}from"url";import{setMaxListeners as YH}from"events";import{spawn as CH}from"child_process";import{createInterface as WH}from"readline";import*as WD from"fs";import{stat as zH,open as oM}from"fs/promises";var{create:Vq,getPrototypeOf:Lq,defineProperty:Q9,getOwnPropertyNames:Mq}=Object,Nq=Object.prototype.hasOwnProperty,jq=(D,F,Q)=>{Q=D!=null?Vq(Lq(D)):{};let B=F||!D||!D.__esModule?Q9(Q,"default",{value:D,enumerable:!0}):Q;for(let Y of Mq(D))if(!Nq.call(B,Y))Q9(B,Y,{get:()=>D[Y],enumerable:!0});return B},KD=(D,F)=>()=>(F||D((F={exports:{}}).exports,F),F.exports),Rq=(D,F)=>{for(var Q in F)Q9(D,Q,{get:F[Q],enumerable:!0,configurable:!0,set:(B)=>F[Q]=()=>B})},_q=KD((D,F)=>{(function(Q,B){typeof D==="object"&&typeof F!=="undefined"?B(D):typeof define==="function"&&define.amd?define(["exports"],B):B(Q.URI=Q.URI||{})})(D,function(Q){function B(){for(var P=arguments.length,M=Array(P),v=0;v<P;v++)M[v]=arguments[v];if(M.length>1){M[0]=M[0].slice(0,-1);var $=M.length-1;for(var m=1;m<$;++m)M[m]=M[m].slice(1,-1);return M[$]=M[$].slice(1),M.join("")}else return M[0]}function Y(P){return"(?:"+P+")"}function J(P){return P===void 0?"undefined":P===null?"null":Object.prototype.toString.call(P).split(" ").pop().split("]").shift().toLowerCase()}function X(P){return P.toUpperCase()}function C(P){return P!==void 0&&P!==null?P instanceof Array?P:typeof P.length!=="number"||P.split||P.setInterval||P.call?[P]:Array.prototype.slice.call(P):[]}function W(P,M){var v=P;if(M)for(var $ in M)v[$]=M[$];return v}function z(P){var M="[A-Za-z]",v="[\\x0D]",$="[0-9]",m="[\\x22]",s=B($,"[A-Fa-f]"),AD="[\\x0A]",jD="[\\x20]",ID=Y(Y("%[EFef]"+s+"%"+s+s+"%"+s+s)+"|"+Y("%[89A-Fa-f]"+s+"%"+s+s)+"|"+Y("%"+s+s)),aD="[\\:\\/\\?\\#\\[\\]\\@]",MD="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",yD=B(aD,MD),rD=P?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",kD=P?"[\\uE000-\\uF8FF]":"[]",_D=B(M,$,"[\\-\\.\\_\\~]",rD),fD=Y(M+B(M,$,"[\\+\\-\\.]")+"*"),wD=Y(Y(ID+"|"+B(_D,MD,"[\\:]"))+"*"),$F=Y(Y("25[0-5]")+"|"+Y("2[0-4]"+$)+"|"+Y("1"+$+$)+"|"+Y("[1-9]"+$)+"|"+$),_0=Y(Y("25[0-5]")+"|"+Y("2[0-4]"+$)+"|"+Y("1"+$+$)+"|"+Y("0?[1-9]"+$)+"|0?0?"+$),x0=Y(_0+"\\."+_0+"\\."+_0+"\\."+_0),TD=Y(s+"{1,4}"),O0=Y(Y(TD+"\\:"+TD)+"|"+x0),u0=Y(Y(TD+"\\:")+"{6}"+O0),WF=Y("\\:\\:"+Y(TD+"\\:")+"{5}"+O0),hF=Y(Y(TD)+"?\\:\\:"+Y(TD+"\\:")+"{4}"+O0),ZF=Y(Y(Y(TD+"\\:")+"{0,1}"+TD)+"?\\:\\:"+Y(TD+"\\:")+"{3}"+O0),m2=Y(Y(Y(TD+"\\:")+"{0,2}"+TD)+"?\\:\\:"+Y(TD+"\\:")+"{2}"+O0),$8=Y(Y(Y(TD+"\\:")+"{0,3}"+TD)+"?\\:\\:"+TD+"\\:"+O0),h8=Y(Y(Y(TD+"\\:")+"{0,4}"+TD)+"?\\:\\:"+O0),B2=Y(Y(Y(TD+"\\:")+"{0,5}"+TD)+"?\\:\\:"+TD),Q2=Y(Y(Y(TD+"\\:")+"{0,6}"+TD)+"?\\:\\:"),VF=Y([u0,WF,hF,ZF,m2,$8,h8,B2,Q2].join("|")),X2=Y(Y(_D+"|"+ID)+"+"),Q1=Y(VF+"\\%25"+X2),mF=Y(VF+Y("\\%25|\\%(?!"+s+"{2})")+X2),EX=Y("[vV]"+s+"+\\."+B(_D,MD,"[\\:]")+"+"),AX=Y("\\["+Y(mF+"|"+VF+"|"+EX)+"\\]"),w9=Y(Y(ID+"|"+B(_D,MD))+"*"),l2=Y(AX+"|"+x0+"(?!"+w9+")|"+w9),d2=Y($+"*"),T9=Y(Y(wD+"@")+"?"+l2+Y("\\:"+d2)+"?"),c2=Y(ID+"|"+B(_D,MD,"[\\:\\@]")),ZX=Y(c2+"*"),P9=Y(c2+"+"),VX=Y(Y(ID+"|"+B(_D,MD,"[\\@]"))+"+"),LF=Y(Y("\\/"+ZX)+"*"),Y2=Y("\\/"+Y(P9+LF)+"?"),X1=Y(VX+LF),m8=Y(P9+LF),J2="(?!"+c2+")",$U=Y(LF+"|"+Y2+"|"+X1+"|"+m8+"|"+J2),C2=Y(Y(c2+"|"+B("[\\/\\?]",kD))+"*"),p2=Y(Y(c2+"|[\\/\\?]")+"*"),S9=Y(Y("\\/\\/"+T9+LF)+"|"+Y2+"|"+m8+"|"+J2),LX=Y(fD+"\\:"+S9+Y("\\?"+C2)+"?"+Y("\\#"+p2)+"?"),MX=Y(Y("\\/\\/"+T9+LF)+"|"+Y2+"|"+X1+"|"+J2),NX=Y(MX+Y("\\?"+C2)+"?"+Y("\\#"+p2)+"?"),hU=Y(LX+"|"+NX),mU=Y(fD+"\\:"+S9+Y("\\?"+C2)+"?"),lU="^("+fD+")\\:"+Y(Y("\\/\\/("+Y("("+wD+")@")+"?("+l2+")"+Y("\\:("+d2+")")+"?)")+"?("+LF+"|"+Y2+"|"+m8+"|"+J2+")")+Y("\\?("+C2+")")+"?"+Y("\\#("+p2+")")+"?$",dU="^(){0}"+Y(Y("\\/\\/("+Y("("+wD+")@")+"?("+l2+")"+Y("\\:("+d2+")")+"?)")+"?("+LF+"|"+Y2+"|"+X1+"|"+J2+")")+Y("\\?("+C2+")")+"?"+Y("\\#("+p2+")")+"?$",cU="^("+fD+")\\:"+Y(Y("\\/\\/("+Y("("+wD+")@")+"?("+l2+")"+Y("\\:("+d2+")")+"?)")+"?("+LF+"|"+Y2+"|"+m8+"|"+J2+")")+Y("\\?("+C2+")")+"?$",pU="^"+Y("\\#("+p2+")")+"?$",nU="^"+Y("("+wD+")@")+"?("+l2+")"+Y("\\:("+d2+")")+"?$";return{NOT_SCHEME:new RegExp(B("[^]",M,$,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(B("[^\\%\\:]",_D,MD),"g"),NOT_HOST:new RegExp(B("[^\\%\\[\\]\\:]",_D,MD),"g"),NOT_PATH:new RegExp(B("[^\\%\\/\\:\\@]",_D,MD),"g"),NOT_PATH_NOSCHEME:new RegExp(B("[^\\%\\/\\@]",_D,MD),"g"),NOT_QUERY:new RegExp(B("[^\\%]",_D,MD,"[\\:\\@\\/\\?]",kD),"g"),NOT_FRAGMENT:new RegExp(B("[^\\%]",_D,MD,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(B("[^]",_D,MD),"g"),UNRESERVED:new RegExp(_D,"g"),OTHER_CHARS:new RegExp(B("[^\\%]",_D,yD),"g"),PCT_ENCODED:new RegExp(ID,"g"),IPV4ADDRESS:new RegExp("^("+x0+")$"),IPV6ADDRESS:new RegExp("^\\[?("+VF+")"+Y(Y("\\%25|\\%(?!"+s+"{2})")+"("+X2+")")+"?\\]?$")}}var G=z(!1),q=z(!0),A=function(){function P(M,v){var $=[],m=!0,s=!1,AD=void 0;try{for(var jD=M[Symbol.iterator](),ID;!(m=(ID=jD.next()).done);m=!0)if($.push(ID.value),v&&$.length===v)break}catch(aD){s=!0,AD=aD}finally{try{if(!m&&jD.return)jD.return()}finally{if(s)throw AD}}return $}return function(M,v){if(Array.isArray(M))return M;else if(Symbol.iterator in Object(M))return P(M,v);else throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),U=function(P){if(Array.isArray(P)){for(var M=0,v=Array(P.length);M<P.length;M++)v[M]=P[M];return v}else return Array.from(P)},Z=2147483647,H=36,V=1,j=26,L=38,R=700,k=72,b=128,I="-",u=/^xn--/,f=/[^\0-\x7E]/,O=/[\x2E\u3002\uFF0E\uFF61]/g,y={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},x=H-V,w=Math.floor,S=String.fromCharCode;function g(P){throw new RangeError(y[P])}function d(P,M){var v=[],$=P.length;while($--)v[$]=M(P[$]);return v}function n(P,M){var v=P.split("@"),$="";if(v.length>1)$=v[0]+"@",P=v[1];P=P.replace(O,".");var m=P.split("."),s=d(m,M).join(".");return $+s}function a(P){var M=[],v=0,$=P.length;while(v<$){var m=P.charCodeAt(v++);if(m>=55296&&m<=56319&&v<$){var s=P.charCodeAt(v++);if((s&64512)==56320)M.push(((m&1023)<<10)+(s&1023)+65536);else M.push(m),v--}else M.push(m)}return M}var DD=function P(M){return String.fromCodePoint.apply(String,U(M))},o=function P(M){if(M-48<10)return M-22;if(M-65<26)return M-65;if(M-97<26)return M-97;return H},XD=function P(M,v){return M+22+75*(M<26)-((v!=0)<<5)},YD=function P(M,v,$){var m=0;M=$?w(M/R):M>>1,M+=w(M/v);for(;M>x*j>>1;m+=H)M=w(M/x);return w(m+(x+1)*M/(M+L))},FD=function P(M){var v=[],$=M.length,m=0,s=b,AD=k,jD=M.lastIndexOf(I);if(jD<0)jD=0;for(var ID=0;ID<jD;++ID){if(M.charCodeAt(ID)>=128)g("not-basic");v.push(M.charCodeAt(ID))}for(var aD=jD>0?jD+1:0;aD<$;){var MD=m;for(var yD=1,rD=H;;rD+=H){if(aD>=$)g("invalid-input");var kD=o(M.charCodeAt(aD++));if(kD>=H||kD>w((Z-m)/yD))g("overflow");m+=kD*yD;var _D=rD<=AD?V:rD>=AD+j?j:rD-AD;if(kD<_D)break;var fD=H-_D;if(yD>w(Z/fD))g("overflow");yD*=fD}var wD=v.length+1;if(AD=YD(m-MD,wD,MD==0),w(m/wD)>Z-s)g("overflow");s+=w(m/wD),m%=wD,v.splice(m++,0,s)}return String.fromCodePoint.apply(String,v)},LD=function P(M){var v=[];M=a(M);var $=M.length,m=b,s=0,AD=k,jD=!0,ID=!1,aD=void 0;try{for(var MD=M[Symbol.iterator](),yD;!(jD=(yD=MD.next()).done);jD=!0){var rD=yD.value;if(rD<128)v.push(S(rD))}}catch(mF){ID=!0,aD=mF}finally{try{if(!jD&&MD.return)MD.return()}finally{if(ID)throw aD}}var kD=v.length,_D=kD;if(kD)v.push(I);while(_D<$){var fD=Z,wD=!0,$F=!1,_0=void 0;try{for(var x0=M[Symbol.iterator](),TD;!(wD=(TD=x0.next()).done);wD=!0){var O0=TD.value;if(O0>=m&&O0<fD)fD=O0}}catch(mF){$F=!0,_0=mF}finally{try{if(!wD&&x0.return)x0.return()}finally{if($F)throw _0}}var u0=_D+1;if(fD-m>w((Z-s)/u0))g("overflow");s+=(fD-m)*u0,m=fD;var WF=!0,hF=!1,ZF=void 0;try{for(var m2=M[Symbol.iterator](),$8;!(WF=($8=m2.next()).done);WF=!0){var h8=$8.value;if(h8<m&&++s>Z)g("overflow");if(h8==m){var B2=s;for(var Q2=H;;Q2+=H){var VF=Q2<=AD?V:Q2>=AD+j?j:Q2-AD;if(B2<VF)break;var X2=B2-VF,Q1=H-VF;v.push(S(XD(VF+X2%Q1,0))),B2=w(X2/Q1)}v.push(S(XD(B2,0))),AD=YD(s,u0,_D==kD),s=0,++_D}}}catch(mF){hF=!0,ZF=mF}finally{try{if(!WF&&m2.return)m2.return()}finally{if(hF)throw ZF}}++s,++m}return v.join("")},hD=function P(M){return n(M,function(v){return u.test(v)?FD(v.slice(4).toLowerCase()):v})},cD=function P(M){return n(M,function(v){return f.test(v)?"xn--"+LD(v):v})},N={version:"2.1.0",ucs2:{decode:a,encode:DD},decode:FD,encode:LD,toASCII:cD,toUnicode:hD},_={};function K(P){var M=P.charCodeAt(0),v=void 0;if(M<16)v="%0"+M.toString(16).toUpperCase();else if(M<128)v="%"+M.toString(16).toUpperCase();else if(M<2048)v="%"+(M>>6|192).toString(16).toUpperCase()+"%"+(M&63|128).toString(16).toUpperCase();else v="%"+(M>>12|224).toString(16).toUpperCase()+"%"+(M>>6&63|128).toString(16).toUpperCase()+"%"+(M&63|128).toString(16).toUpperCase();return v}function T(P){var M="",v=0,$=P.length;while(v<$){var m=parseInt(P.substr(v+1,2),16);if(m<128)M+=String.fromCharCode(m),v+=3;else if(m>=194&&m<224){if($-v>=6){var s=parseInt(P.substr(v+4,2),16);M+=String.fromCharCode((m&31)<<6|s&63)}else M+=P.substr(v,6);v+=6}else if(m>=224){if($-v>=9){var AD=parseInt(P.substr(v+4,2),16),jD=parseInt(P.substr(v+7,2),16);M+=String.fromCharCode((m&15)<<12|(AD&63)<<6|jD&63)}else M+=P.substr(v,9);v+=9}else M+=P.substr(v,3),v+=3}return M}function h(P,M){function v($){var m=T($);return!m.match(M.UNRESERVED)?$:m}if(P.scheme)P.scheme=String(P.scheme).replace(M.PCT_ENCODED,v).toLowerCase().replace(M.NOT_SCHEME,"");if(P.userinfo!==void 0)P.userinfo=String(P.userinfo).replace(M.PCT_ENCODED,v).replace(M.NOT_USERINFO,K).replace(M.PCT_ENCODED,X);if(P.host!==void 0)P.host=String(P.host).replace(M.PCT_ENCODED,v).toLowerCase().replace(M.NOT_HOST,K).replace(M.PCT_ENCODED,X);if(P.path!==void 0)P.path=String(P.path).replace(M.PCT_ENCODED,v).replace(P.scheme?M.NOT_PATH:M.NOT_PATH_NOSCHEME,K).replace(M.PCT_ENCODED,X);if(P.query!==void 0)P.query=String(P.query).replace(M.PCT_ENCODED,v).replace(M.NOT_QUERY,K).replace(M.PCT_ENCODED,X);if(P.fragment!==void 0)P.fragment=String(P.fragment).replace(M.PCT_ENCODED,v).replace(M.NOT_FRAGMENT,K).replace(M.PCT_ENCODED,X);return P}function c(P){return P.replace(/^0*(.*)/,"$1")||"0"}function l(P,M){var v=P.match(M.IPV4ADDRESS)||[],$=A(v,2),m=$[1];if(m)return m.split(".").map(c).join(".");else return P}function p(P,M){var v=P.match(M.IPV6ADDRESS)||[],$=A(v,3),m=$[1],s=$[2];if(m){var AD=m.toLowerCase().split("::").reverse(),jD=A(AD,2),ID=jD[0],aD=jD[1],MD=aD?aD.split(":").map(c):[],yD=ID.split(":").map(c),rD=M.IPV4ADDRESS.test(yD[yD.length-1]),kD=rD?7:8,_D=yD.length-kD,fD=Array(kD);for(var wD=0;wD<kD;++wD)fD[wD]=MD[wD]||yD[_D+wD]||"";if(rD)fD[kD-1]=l(fD[kD-1],M);var $F=fD.reduce(function(u0,WF,hF){if(!WF||WF==="0"){var ZF=u0[u0.length-1];if(ZF&&ZF.index+ZF.length===hF)ZF.length++;else u0.push({index:hF,length:1})}return u0},[]),_0=$F.sort(function(u0,WF){return WF.length-u0.length})[0],x0=void 0;if(_0&&_0.length>1){var TD=fD.slice(0,_0.index),O0=fD.slice(_0.index+_0.length);x0=TD.join(":")+"::"+O0.join(":")}else x0=fD.join(":");if(s)x0+="%"+s;return x0}else return P}var BD=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,qD="".match(/(){0}/)[1]===void 0;function JD(P){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},v={},$=M.iri!==!1?q:G;if(M.reference==="suffix")P=(M.scheme?M.scheme+":":"")+"//"+P;var m=P.match(BD);if(m){if(qD){if(v.scheme=m[1],v.userinfo=m[3],v.host=m[4],v.port=parseInt(m[5],10),v.path=m[6]||"",v.query=m[7],v.fragment=m[8],isNaN(v.port))v.port=m[5]}else if(v.scheme=m[1]||void 0,v.userinfo=P.indexOf("@")!==-1?m[3]:void 0,v.host=P.indexOf("//")!==-1?m[4]:void 0,v.port=parseInt(m[5],10),v.path=m[6]||"",v.query=P.indexOf("?")!==-1?m[7]:void 0,v.fragment=P.indexOf("#")!==-1?m[8]:void 0,isNaN(v.port))v.port=P.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?m[4]:void 0;if(v.host)v.host=p(l(v.host,$),$);if(v.scheme===void 0&&v.userinfo===void 0&&v.host===void 0&&v.port===void 0&&!v.path&&v.query===void 0)v.reference="same-document";else if(v.scheme===void 0)v.reference="relative";else if(v.fragment===void 0)v.reference="absolute";else v.reference="uri";if(M.reference&&M.reference!=="suffix"&&M.reference!==v.reference)v.error=v.error||"URI is not a "+M.reference+" reference.";var s=_[(M.scheme||v.scheme||"").toLowerCase()];if(!M.unicodeSupport&&(!s||!s.unicodeSupport)){if(v.host&&(M.domainHost||s&&s.domainHost))try{v.host=N.toASCII(v.host.replace($.PCT_ENCODED,T).toLowerCase())}catch(AD){v.error=v.error||"Host's domain name can not be converted to ASCII via punycode: "+AD}h(v,G)}else h(v,$);if(s&&s.parse)s.parse(v,M)}else v.error=v.error||"URI can not be parsed.";return v}function ZD(P,M){var v=M.iri!==!1?q:G,$=[];if(P.userinfo!==void 0)$.push(P.userinfo),$.push("@");if(P.host!==void 0)$.push(p(l(String(P.host),v),v).replace(v.IPV6ADDRESS,function(m,s,AD){return"["+s+(AD?"%25"+AD:"")+"]"}));if(typeof P.port==="number"||typeof P.port==="string")$.push(":"),$.push(String(P.port));return $.length?$.join(""):void 0}var PD=/^\.\.?\//,RD=/^\/\.(\/|$)/,Q0=/^\/\.\.(\/|$)/,mD=/^\/?(?:.|\n)*?(?=\/|$)/;function H0(P){var M=[];while(P.length)if(P.match(PD))P=P.replace(PD,"");else if(P.match(RD))P=P.replace(RD,"/");else if(P.match(Q0))P=P.replace(Q0,"/"),M.pop();else if(P==="."||P==="..")P="";else{var v=P.match(mD);if(v){var $=v[0];P=P.slice($.length),M.push($)}else throw new Error("Unexpected dot segment condition")}return M.join("")}function SD(P){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},v=M.iri?q:G,$=[],m=_[(M.scheme||P.scheme||"").toLowerCase()];if(m&&m.serialize)m.serialize(P,M);if(P.host){if(v.IPV6ADDRESS.test(P.host));else if(M.domainHost||m&&m.domainHost)try{P.host=!M.iri?N.toASCII(P.host.replace(v.PCT_ENCODED,T).toLowerCase()):N.toUnicode(P.host)}catch(jD){P.error=P.error||"Host's domain name can not be converted to "+(!M.iri?"ASCII":"Unicode")+" via punycode: "+jD}}if(h(P,v),M.reference!=="suffix"&&P.scheme)$.push(P.scheme),$.push(":");var s=ZD(P,M);if(s!==void 0){if(M.reference!=="suffix")$.push("//");if($.push(s),P.path&&P.path.charAt(0)!=="/")$.push("/")}if(P.path!==void 0){var AD=P.path;if(!M.absolutePath&&(!m||!m.absolutePath))AD=H0(AD);if(s===void 0)AD=AD.replace(/^\/\//,"/%2F");$.push(AD)}if(P.query!==void 0)$.push("?"),$.push(P.query);if(P.fragment!==void 0)$.push("#"),$.push(P.fragment);return $.join("")}function sD(P,M){var v=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},$=arguments[3],m={};if(!$)P=JD(SD(P,v),v),M=JD(SD(M,v),v);if(v=v||{},!v.tolerant&&M.scheme)m.scheme=M.scheme,m.userinfo=M.userinfo,m.host=M.host,m.port=M.port,m.path=H0(M.path||""),m.query=M.query;else{if(M.userinfo!==void 0||M.host!==void 0||M.port!==void 0)m.userinfo=M.userinfo,m.host=M.host,m.port=M.port,m.path=H0(M.path||""),m.query=M.query;else{if(!M.path)if(m.path=P.path,M.query!==void 0)m.query=M.query;else m.query=P.query;else{if(M.path.charAt(0)==="/")m.path=H0(M.path);else{if((P.userinfo!==void 0||P.host!==void 0||P.port!==void 0)&&!P.path)m.path="/"+M.path;else if(!P.path)m.path=M.path;else m.path=P.path.slice(0,P.path.lastIndexOf("/")+1)+M.path;m.path=H0(m.path)}m.query=M.query}m.userinfo=P.userinfo,m.host=P.host,m.port=P.port}m.scheme=P.scheme}return m.fragment=M.fragment,m}function v0(P,M,v){var $=W({scheme:"null"},v);return SD(sD(JD(P,$),JD(M,$),$,!0),$)}function R0(P,M){if(typeof P==="string")P=SD(JD(P,M),M);else if(J(P)==="object")P=JD(SD(P,M),M);return P}function g8(P,M,v){if(typeof P==="string")P=SD(JD(P,v),v);else if(J(P)==="object")P=SD(P,v);if(typeof M==="string")M=SD(JD(M,v),v);else if(J(M)==="object")M=SD(M,v);return P===M}function F1(P,M){return P&&P.toString().replace(!M||!M.iri?G.ESCAPE:q.ESCAPE,K)}function i0(P,M){return P&&P.toString().replace(!M||!M.iri?G.PCT_ENCODED:q.PCT_ENCODED,T)}var $2={scheme:"http",domainHost:!0,parse:function P(M,v){if(!M.host)M.error=M.error||"HTTP URIs must have a host.";return M},serialize:function P(M,v){var $=String(M.scheme).toLowerCase()==="https";if(M.port===($?443:80)||M.port==="")M.port=void 0;if(!M.path)M.path="/";return M}},L9={scheme:"https",domainHost:$2.domainHost,parse:$2.parse,serialize:$2.serialize};function M9(P){return typeof P.secure==="boolean"?P.secure:String(P.scheme).toLowerCase()==="wss"}var h2={scheme:"ws",domainHost:!0,parse:function P(M,v){var $=M;return $.secure=M9($),$.resourceName=($.path||"/")+($.query?"?"+$.query:""),$.path=void 0,$.query=void 0,$},serialize:function P(M,v){if(M.port===(M9(M)?443:80)||M.port==="")M.port=void 0;if(typeof M.secure==="boolean")M.scheme=M.secure?"wss":"ws",M.secure=void 0;if(M.resourceName){var $=M.resourceName.split("?"),m=A($,2),s=m[0],AD=m[1];M.path=s&&s!=="/"?s:void 0,M.query=AD,M.resourceName=void 0}return M.fragment=void 0,M}},N9={scheme:"wss",domainHost:h2.domainHost,parse:h2.parse,serialize:h2.serialize},QX={},XX=!0,j9="[A-Za-z0-9\\-\\.\\_\\~"+(XX?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",CF="[0-9A-Fa-f]",YX=Y(Y("%[EFef]"+CF+"%"+CF+CF+"%"+CF+CF)+"|"+Y("%[89A-Fa-f]"+CF+"%"+CF+CF)+"|"+Y("%"+CF+CF)),JX="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",CX="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",WX=B(CX,"[\\\"\\\\]"),zX="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",GX=new RegExp(j9,"g"),F2=new RegExp(YX,"g"),qX=new RegExp(B("[^]",JX,"[\\.]","[\\\"]",WX),"g"),R9=new RegExp(B("[^]",j9,zX),"g"),HX=R9;function B1(P){var M=T(P);return!M.match(GX)?P:M}var _9={scheme:"mailto",parse:function P(M,v){var $=M,m=$.to=$.path?$.path.split(","):[];if($.path=void 0,$.query){var s=!1,AD={},jD=$.query.split("&");for(var ID=0,aD=jD.length;ID<aD;++ID){var MD=jD[ID].split("=");switch(MD[0]){case"to":var yD=MD[1].split(",");for(var rD=0,kD=yD.length;rD<kD;++rD)m.push(yD[rD]);break;case"subject":$.subject=i0(MD[1],v);break;case"body":$.body=i0(MD[1],v);break;default:s=!0,AD[i0(MD[0],v)]=i0(MD[1],v);break}}if(s)$.headers=AD}$.query=void 0;for(var _D=0,fD=m.length;_D<fD;++_D){var wD=m[_D].split("@");if(wD[0]=i0(wD[0]),!v.unicodeSupport)try{wD[1]=N.toASCII(i0(wD[1],v).toLowerCase())}catch($F){$.error=$.error||"Email address's domain name can not be converted to ASCII via punycode: "+$F}else wD[1]=i0(wD[1],v).toLowerCase();m[_D]=wD.join("@")}return $},serialize:function P(M,v){var $=M,m=C(M.to);if(m){for(var s=0,AD=m.length;s<AD;++s){var jD=String(m[s]),ID=jD.lastIndexOf("@"),aD=jD.slice(0,ID).replace(F2,B1).replace(F2,X).replace(qX,K),MD=jD.slice(ID+1);try{MD=!v.iri?N.toASCII(i0(MD,v).toLowerCase()):N.toUnicode(MD)}catch(_D){$.error=$.error||"Email address's domain name can not be converted to "+(!v.iri?"ASCII":"Unicode")+" via punycode: "+_D}m[s]=aD+"@"+MD}$.path=m.join(",")}var yD=M.headers=M.headers||{};if(M.subject)yD.subject=M.subject;if(M.body)yD.body=M.body;var rD=[];for(var kD in yD)if(yD[kD]!==QX[kD])rD.push(kD.replace(F2,B1).replace(F2,X).replace(R9,K)+"="+yD[kD].replace(F2,B1).replace(F2,X).replace(HX,K));if(rD.length)$.query=rD.join("&");return $}},KX=/^([^\:]+)\:(.*)/,O9={scheme:"urn",parse:function P(M,v){var $=M.path&&M.path.match(KX),m=M;if($){var s=v.scheme||m.scheme||"urn",AD=$[1].toLowerCase(),jD=$[2],ID=s+":"+(v.nid||AD),aD=_[ID];if(m.nid=AD,m.nss=jD,m.path=void 0,aD)m=aD.parse(m,v)}else m.error=m.error||"URN can not be parsed.";return m},serialize:function P(M,v){var $=v.scheme||M.scheme||"urn",m=M.nid,s=$+":"+(v.nid||m),AD=_[s];if(AD)M=AD.serialize(M,v);var jD=M,ID=M.nss;return jD.path=(m||v.nid)+":"+ID,jD}},UX=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,I9={scheme:"urn:uuid",parse:function P(M,v){var $=M;if($.uuid=$.nss,$.nss=void 0,!v.tolerant&&(!$.uuid||!$.uuid.match(UX)))$.error=$.error||"UUID is not valid.";return $},serialize:function P(M,v){var $=M;return $.nss=(M.uuid||"").toLowerCase(),$}};_[$2.scheme]=$2,_[L9.scheme]=L9,_[h2.scheme]=h2,_[N9.scheme]=N9,_[_9.scheme]=_9,_[O9.scheme]=O9,_[I9.scheme]=I9,Q.SCHEMES=_,Q.pctEncChar=K,Q.pctDecChars=T,Q.parse=JD,Q.removeDotSegments=H0,Q.serialize=SD,Q.resolveComponents=sD,Q.resolve=v0,Q.normalize=R0,Q.equal=g8,Q.escapeComponent=F1,Q.unescapeComponent=i0,Object.defineProperty(Q,"__esModule",{value:!0})})}),G9=KD((D,F)=>{F.exports=function Q(B,Y){if(B===Y)return!0;if(B&&Y&&typeof B=="object"&&typeof Y=="object"){if(B.constructor!==Y.constructor)return!1;var J,X,C;if(Array.isArray(B)){if(J=B.length,J!=Y.length)return!1;for(X=J;X--!==0;)if(!Q(B[X],Y[X]))return!1;return!0}if(B.constructor===RegExp)return B.source===Y.source&&B.flags===Y.flags;if(B.valueOf!==Object.prototype.valueOf)return B.valueOf()===Y.valueOf();if(B.toString!==Object.prototype.toString)return B.toString()===Y.toString();if(C=Object.keys(B),J=C.length,J!==Object.keys(Y).length)return!1;for(X=J;X--!==0;)if(!Object.prototype.hasOwnProperty.call(Y,C[X]))return!1;for(X=J;X--!==0;){var W=C[X];if(!Q(B[W],Y[W]))return!1}return!0}return B!==B&&Y!==Y}}),Oq=KD((D,F)=>{F.exports=function Q(B){var Y=0,J=B.length,X=0,C;while(X<J)if(Y++,C=B.charCodeAt(X++),C>=55296&&C<=56319&&X<J){if(C=B.charCodeAt(X),(C&64512)==56320)X++}return Y}}),f2=KD((D,F)=>{F.exports={copy:Q,checkDataType:B,checkDataTypes:Y,coerceToTypes:X,toHash:C,getProperty:G,escapeQuotes:q,equal:G9(),ucs2length:Oq(),varOccurences:A,varReplace:U,schemaHasRules:Z,schemaHasRulesExcept:H,schemaUnknownRules:V,toQuotedString:j,getPathExpr:L,getPath:R,getData:I,unescapeFragment:f,unescapeJsonPointer:x,escapeFragment:O,escapeJsonPointer:y};function Q(w,S){S=S||{};for(var g in w)S[g]=w[g];return S}function B(w,S,g,d){var n=d?" !== ":" === ",a=d?" || ":" && ",DD=d?"!":"",o=d?"":"!";switch(w){case"null":return S+n+"null";case"array":return DD+"Array.isArray("+S+")";case"object":return"("+DD+S+a+"typeof "+S+n+'"object"'+a+o+"Array.isArray("+S+"))";case"integer":return"(typeof "+S+n+'"number"'+a+o+"("+S+" % 1)"+a+S+n+S+(g?a+DD+"isFinite("+S+")":"")+")";case"number":return"(typeof "+S+n+'"'+w+'"'+(g?a+DD+"isFinite("+S+")":"")+")";default:return"typeof "+S+n+'"'+w+'"'}}function Y(w,S,g){switch(w.length){case 1:return B(w[0],S,g,!0);default:var d="",n=C(w);if(n.array&&n.object)d=n.null?"(":"(!"+S+" || ",d+="typeof "+S+' !== "object")',delete n.null,delete n.array,delete n.object;if(n.number)delete n.integer;for(var a in n)d+=(d?" && ":"")+B(a,S,g,!0);return d}}var J=C(["string","number","integer","boolean","null"]);function X(w,S){if(Array.isArray(S)){var g=[];for(var d=0;d<S.length;d++){var n=S[d];if(J[n])g[g.length]=n;else if(w==="array"&&n==="array")g[g.length]=n}if(g.length)return g}else if(J[S])return[S];else if(w==="array"&&S==="array")return["array"]}function C(w){var S={};for(var g=0;g<w.length;g++)S[w[g]]=!0;return S}var W=/^[a-z$_][a-z$_0-9]*$/i,z=/'|\\/g;function G(w){return typeof w=="number"?"["+w+"]":W.test(w)?"."+w:"['"+q(w)+"']"}function q(w){return w.replace(z,"\\$&").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\f/g,"\\f").replace(/\t/g,"\\t")}function A(w,S){S+="[^0-9]";var g=w.match(new RegExp(S,"g"));return g?g.length:0}function U(w,S,g){return S+="([^0-9])",g=g.replace(/\$/g,"$$$$"),w.replace(new RegExp(S,"g"),g+"$1")}function Z(w,S){if(typeof w=="boolean")return!w;for(var g in w)if(S[g])return!0}function H(w,S,g){if(typeof w=="boolean")return!w&&g!="not";for(var d in w)if(d!=g&&S[d])return!0}function V(w,S){if(typeof w=="boolean")return;for(var g in w)if(!S[g])return g}function j(w){return"'"+q(w)+"'"}function L(w,S,g,d){var n=g?"'/' + "+S+(d?"":".replace(/~/g, '~0').replace(/\\//g, '~1')"):d?"'[' + "+S+" + ']'":"'[\\'' + "+S+" + '\\']'";return u(w,n)}function R(w,S,g){var d=g?j("/"+y(S)):j(G(S));return u(w,d)}var k=/^\/(?:[^~]|~0|~1)*$/,b=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function I(w,S,g){var d,n,a,DD;if(w==="")return"rootData";if(w[0]=="/"){if(!k.test(w))throw new Error("Invalid JSON-pointer: "+w);n=w,a="rootData"}else{if(DD=w.match(b),!DD)throw new Error("Invalid JSON-pointer: "+w);if(d=+DD[1],n=DD[2],n=="#"){if(d>=S)throw new Error("Cannot access property/index "+d+" levels up, current level is "+S);return g[S-d]}if(d>S)throw new Error("Cannot access data "+d+" levels up, current level is "+S);if(a="data"+(S-d||""),!n)return a}var o=a,XD=n.split("/");for(var YD=0;YD<XD.length;YD++){var FD=XD[YD];if(FD)a+=G(x(FD)),o+=" && "+a}return o}function u(w,S){if(w=='""')return S;return(w+" + "+S).replace(/([^\\])' \+ '/g,"$1")}function f(w){return x(decodeURIComponent(w))}function O(w){return encodeURIComponent(y(w))}function y(w){return w.replace(/~/g,"~0").replace(/\//g,"~1")}function x(w){return w.replace(/~1/g,"/").replace(/~0/g,"~")}}),CQ=KD((D,F)=>{var Q=f2();F.exports=B;function B(Y){Q.copy(Y,this)}}),Iq=KD((D,F)=>{var Q=F.exports=function(J,X,C){if(typeof X=="function")C=X,X={};C=X.cb||C;var W=typeof C=="function"?C:C.pre||function(){},z=C.post||function(){};B(X,W,z,J,"",J)};Q.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0},Q.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},Q.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},Q.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function B(J,X,C,W,z,G,q,A,U,Z){if(W&&typeof W=="object"&&!Array.isArray(W)){X(W,z,G,q,A,U,Z);for(var H in W){var V=W[H];if(Array.isArray(V)){if(H in Q.arrayKeywords)for(var j=0;j<V.length;j++)B(J,X,C,V[j],z+"/"+H+"/"+j,G,z,H,W,j)}else if(H in Q.propsKeywords){if(V&&typeof V=="object")for(var L in V)B(J,X,C,V[L],z+"/"+H+"/"+Y(L),G,z,H,W,L)}else if(H in Q.keywords||J.allKeys&&!(H in Q.skipKeywords))B(J,X,C,V,z+"/"+H,G,z,H,W)}C(W,z,G,q,A,U,Z)}}function Y(J){return J.replace(/~/g,"~0").replace(/\//g,"~1")}}),q9=KD((D,F)=>{var Q=_q(),B=G9(),Y=f2(),J=CQ(),X=Iq();F.exports=C,C.normalizeId=R,C.fullPath=V,C.url=k,C.ids=b,C.inlineRef=U,C.schema=W;function C(I,u,f){var O=this._refs[f];if(typeof O=="string")if(this._refs[O])O=this._refs[O];else return C.call(this,I,u,O);if(O=O||this._schemas[f],O instanceof J)return U(O.schema,this._opts.inlineRefs)?O.schema:O.validate||this._compile(O);var y=W.call(this,u,f),x,w,S;if(y)x=y.schema,u=y.root,S=y.baseId;if(x instanceof J)w=x.validate||I.call(this,x.schema,u,void 0,S);else if(x!==void 0)w=U(x,this._opts.inlineRefs)?x:I.call(this,x,u,void 0,S);return w}function W(I,u){var f=Q.parse(u),O=j(f),y=V(this._getId(I.schema));if(Object.keys(I.schema).length===0||O!==y){var x=R(O),w=this._refs[x];if(typeof w=="string")return z.call(this,I,w,f);else if(w instanceof J){if(!w.validate)this._compile(w);I=w}else if(w=this._schemas[x],w instanceof J){if(!w.validate)this._compile(w);if(x==R(u))return{schema:w,root:I,baseId:y};I=w}else return;if(!I.schema)return;y=V(this._getId(I.schema))}return q.call(this,f,y,I.schema,I)}function z(I,u,f){var O=W.call(this,I,u);if(O){var{schema:y,baseId:x}=O;I=O.root;var w=this._getId(y);if(w)x=k(x,w);return q.call(this,f,x,y,I)}}var G=Y.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function q(I,u,f,O){if(I.fragment=I.fragment||"",I.fragment.slice(0,1)!="/")return;var y=I.fragment.split("/");for(var x=1;x<y.length;x++){var w=y[x];if(w){if(w=Y.unescapeFragment(w),f=f[w],f===void 0)break;var S;if(!G[w]){if(S=this._getId(f),S)u=k(u,S);if(f.$ref){var g=k(u,f.$ref),d=W.call(this,O,g);if(d)f=d.schema,O=d.root,u=d.baseId}}}}if(f!==void 0&&f!==O.schema)return{schema:f,root:O,baseId:u}}var A=Y.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function U(I,u){if(u===!1)return!1;if(u===void 0||u===!0)return Z(I);else if(u)return H(I)<=u}function Z(I){var u;if(Array.isArray(I)){for(var f=0;f<I.length;f++)if(u=I[f],typeof u=="object"&&!Z(u))return!1}else for(var O in I){if(O=="$ref")return!1;if(u=I[O],typeof u=="object"&&!Z(u))return!1}return!0}function H(I){var u=0,f;if(Array.isArray(I))for(var O=0;O<I.length;O++){if(f=I[O],typeof f=="object")u+=H(f);if(u==1/0)return 1/0}else for(var y in I){if(y=="$ref")return 1/0;if(A[y])u++;else{if(f=I[y],typeof f=="object")u+=H(f)+1;if(u==1/0)return 1/0}}return u}function V(I,u){if(u!==!1)I=R(I);var f=Q.parse(I);return j(f)}function j(I){return Q.serialize(I).split("#")[0]+"#"}var L=/#\/?$/;function R(I){return I?I.replace(L,""):""}function k(I,u){return u=R(u),Q.resolve(I,u)}function b(I){var u=R(this._getId(I)),f={"":u},O={"":V(u,!1)},y={},x=this;return X(I,{allKeys:!0},function(w,S,g,d,n,a,DD){if(S==="")return;var o=x._getId(w),XD=f[d],YD=O[d]+"/"+n;if(DD!==void 0)YD+="/"+(typeof DD=="number"?DD:Y.escapeFragment(DD));if(typeof o=="string"){o=XD=R(XD?Q.resolve(XD,o):o);var FD=x._refs[o];if(typeof FD=="string")FD=x._refs[FD];if(FD&&FD.schema){if(!B(w,FD.schema))throw new Error('id "'+o+'" resolves to more than one schema')}else if(o!=R(YD))if(o[0]=="#"){if(y[o]&&!B(w,y[o]))throw new Error('id "'+o+'" resolves to more than one schema');y[o]=w}else x._refs[o]=YD}f[S]=XD,O[S]=YD}),y}}),H9=KD((D,F)=>{var Q=q9();F.exports={Validation:J(B),MissingRef:J(Y)};function B(X){this.message="validation failed",this.errors=X,this.ajv=this.validation=!0}Y.message=function(X,C){return"can't resolve reference "+C+" from id "+X};function Y(X,C,W){this.message=W||Y.message(X,C),this.missingRef=Q.url(X,C),this.missingSchema=Q.normalizeId(Q.fullPath(this.missingRef))}function J(X){return X.prototype=Object.create(Error.prototype),X.prototype.constructor=X,X}}),WQ=KD((D,F)=>{F.exports=function(Q,B){if(!B)B={};if(typeof B==="function")B={cmp:B};var Y=typeof B.cycles==="boolean"?B.cycles:!1,J=B.cmp&&function(C){return function(W){return function(z,G){var q={key:z,value:W[z]},A={key:G,value:W[G]};return C(q,A)}}}(B.cmp),X=[];return function C(W){if(W&&W.toJSON&&typeof W.toJSON==="function")W=W.toJSON();if(W===void 0)return;if(typeof W=="number")return isFinite(W)?""+W:"null";if(typeof W!=="object")return JSON.stringify(W);var z,G;if(Array.isArray(W)){G="[";for(z=0;z<W.length;z++){if(z)G+=",";G+=C(W[z])||"null"}return G+"]"}if(W===null)return"null";if(X.indexOf(W)!==-1){if(Y)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var q=X.push(W)-1,A=Object.keys(W).sort(J&&J(W));G="";for(z=0;z<A.length;z++){var U=A[z],Z=C(W[U]);if(!Z)continue;if(G)G+=",";G+=JSON.stringify(U)+":"+Z}return X.splice(q,1),"{"+G+"}"}(Q)}}),zQ=KD((D,F)=>{F.exports=function Q(B,Y,J){var X="",C=B.schema.$async===!0,W=B.util.schemaHasRulesExcept(B.schema,B.RULES.all,"$ref"),z=B.self._getId(B.schema);if(B.opts.strictKeywords){var G=B.util.schemaUnknownRules(B.schema,B.RULES.keywords);if(G){var q="unknown keyword: "+G;if(B.opts.strictKeywords==="log")B.logger.warn(q);else throw new Error(q)}}if(B.isTop){if(X+=" var validate = ",C)B.async=!0,X+="async ";if(X+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",z&&(B.opts.sourceCode||B.opts.processCode))X+=" "+("/*# sourceURL="+z+" */")+" "}if(typeof B.schema=="boolean"||!(W||B.schema.$ref)){var Y="false schema",A=B.level,U=B.dataLevel,Z=B.schema[Y],H=B.schemaPath+B.util.getProperty(Y),V=B.errSchemaPath+"/"+Y,u=!B.opts.allErrors,y,j="data"+(U||""),I="valid"+A;if(B.schema===!1){if(B.isTop)u=!0;else X+=" var "+I+" = false; ";var L=L||[];if(L.push(X),X="",B.createErrors!==!1){if(X+=" { keyword: '"+(y||"false schema")+"' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(V)+" , params: {} ",B.opts.messages!==!1)X+=" , message: 'boolean schema is false' ";if(B.opts.verbose)X+=" , schema: false , parentSchema: validate.schema"+B.schemaPath+" , data: "+j+" ";X+=" } "}else X+=" {} ";var R=X;if(X=L.pop(),!B.compositeRule&&u)if(B.async)X+=" throw new ValidationError(["+R+"]); ";else X+=" validate.errors = ["+R+"]; return false; ";else X+=" var err = "+R+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else if(B.isTop)if(C)X+=" return data; ";else X+=" validate.errors = null; return true; ";else X+=" var "+I+" = true; ";if(B.isTop)X+=" }; return validate; ";return X}if(B.isTop){var k=B.isTop,A=B.level=0,U=B.dataLevel=0,j="data";if(B.rootId=B.resolve.fullPath(B.self._getId(B.root.schema)),B.baseId=B.baseId||B.rootId,delete B.isTop,B.dataPathArr=[""],B.schema.default!==void 0&&B.opts.useDefaults&&B.opts.strictDefaults){var b="default is ignored in the schema root";if(B.opts.strictDefaults==="log")B.logger.warn(b);else throw new Error(b)}X+=" var vErrors = null; ",X+=" var errors = 0; ",X+=" if (rootData === undefined) rootData = data; "}else{var{level:A,dataLevel:U}=B,j="data"+(U||"");if(z)B.baseId=B.resolve.url(B.baseId,z);if(C&&!B.async)throw new Error("async schema in sync schema");X+=" var errs_"+A+" = errors;"}var I="valid"+A,u=!B.opts.allErrors,f="",O="",y,x=B.schema.type,w=Array.isArray(x);if(x&&B.opts.nullable&&B.schema.nullable===!0){if(w){if(x.indexOf("null")==-1)x=x.concat("null")}else if(x!="null")x=[x,"null"],w=!0}if(w&&x.length==1)x=x[0],w=!1;if(B.schema.$ref&&W){if(B.opts.extendRefs=="fail")throw new Error('$ref: validation keywords used in schema at path "'+B.errSchemaPath+'" (see option extendRefs)');else if(B.opts.extendRefs!==!0)W=!1,B.logger.warn('$ref: keywords ignored in schema at path "'+B.errSchemaPath+'"')}if(B.schema.$comment&&B.opts.$comment)X+=" "+B.RULES.all.$comment.code(B,"$comment");if(x){if(B.opts.coerceTypes)var S=B.util.coerceToTypes(B.opts.coerceTypes,x);var g=B.RULES.types[x];if(S||w||g===!0||g&&!mD(g)){var H=B.schemaPath+".type",V=B.errSchemaPath+"/type",H=B.schemaPath+".type",V=B.errSchemaPath+"/type",d=w?"checkDataTypes":"checkDataType";if(X+=" if ("+B.util[d](x,j,B.opts.strictNumbers,!0)+") { ",S){var n="dataType"+A,a="coerced"+A;if(X+=" var "+n+" = typeof "+j+"; var "+a+" = undefined; ",B.opts.coerceTypes=="array")X+=" if ("+n+" == 'object' && Array.isArray("+j+") && "+j+".length == 1) { "+j+" = "+j+"[0]; "+n+" = typeof "+j+"; if ("+B.util.checkDataType(B.schema.type,j,B.opts.strictNumbers)+") "+a+" = "+j+"; } ";X+=" if ("+a+" !== undefined) ; ";var DD=S;if(DD){var o,XD=-1,YD=DD.length-1;while(XD<YD)if(o=DD[XD+=1],o=="string")X+=" else if ("+n+" == 'number' || "+n+" == 'boolean') "+a+" = '' + "+j+"; else if ("+j+" === null) "+a+" = ''; ";else if(o=="number"||o=="integer"){if(X+=" else if ("+n+" == 'boolean' || "+j+" === null || ("+n+" == 'string' && "+j+" && "+j+" == +"+j+" ",o=="integer")X+=" && !("+j+" % 1)";X+=")) "+a+" = +"+j+"; "}else if(o=="boolean")X+=" else if ("+j+" === 'false' || "+j+" === 0 || "+j+" === null) "+a+" = false; else if ("+j+" === 'true' || "+j+" === 1) "+a+" = true; ";else if(o=="null")X+=" else if ("+j+" === '' || "+j+" === 0 || "+j+" === false) "+a+" = null; ";else if(B.opts.coerceTypes=="array"&&o=="array")X+=" else if ("+n+" == 'string' || "+n+" == 'number' || "+n+" == 'boolean' || "+j+" == null) "+a+" = ["+j+"]; "}X+=" else { ";var L=L||[];if(L.push(X),X="",B.createErrors!==!1){if(X+=" { keyword: '"+(y||"type")+"' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(V)+" , params: { type: '",w)X+=""+x.join(",");else X+=""+x;if(X+="' } ",B.opts.messages!==!1){if(X+=" , message: 'should be ",w)X+=""+x.join(",");else X+=""+x;X+="' "}if(B.opts.verbose)X+=" , schema: validate.schema"+H+" , parentSchema: validate.schema"+B.schemaPath+" , data: "+j+" ";X+=" } "}else X+=" {} ";var R=X;if(X=L.pop(),!B.compositeRule&&u)if(B.async)X+=" throw new ValidationError(["+R+"]); ";else X+=" validate.errors = ["+R+"]; return false; ";else X+=" var err = "+R+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";X+=" } if ("+a+" !== undefined) { ";var FD=U?"data"+(U-1||""):"parentData",LD=U?B.dataPathArr[U]:"parentDataProperty";if(X+=" "+j+" = "+a+"; ",!U)X+="if ("+FD+" !== undefined)";X+=" "+FD+"["+LD+"] = "+a+"; } "}else{var L=L||[];if(L.push(X),X="",B.createErrors!==!1){if(X+=" { keyword: '"+(y||"type")+"' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(V)+" , params: { type: '",w)X+=""+x.join(",");else X+=""+x;if(X+="' } ",B.opts.messages!==!1){if(X+=" , message: 'should be ",w)X+=""+x.join(",");else X+=""+x;X+="' "}if(B.opts.verbose)X+=" , schema: validate.schema"+H+" , parentSchema: validate.schema"+B.schemaPath+" , data: "+j+" ";X+=" } "}else X+=" {} ";var R=X;if(X=L.pop(),!B.compositeRule&&u)if(B.async)X+=" throw new ValidationError(["+R+"]); ";else X+=" validate.errors = ["+R+"]; return false; ";else X+=" var err = "+R+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}X+=" } "}}if(B.schema.$ref&&!W){if(X+=" "+B.RULES.all.$ref.code(B,"$ref")+" ",u){if(X+=" } if (errors === ",k)X+="0";else X+="errs_"+A;X+=") { ",O+="}"}}else{var hD=B.RULES;if(hD){var g,cD=-1,N=hD.length-1;while(cD<N)if(g=hD[cD+=1],mD(g)){if(g.type)X+=" if ("+B.util.checkDataType(g.type,j,B.opts.strictNumbers)+") { ";if(B.opts.useDefaults){if(g.type=="object"&&B.schema.properties){var Z=B.schema.properties,_=Object.keys(Z),K=_;if(K){var T,h=-1,c=K.length-1;while(h<c){T=K[h+=1];var l=Z[T];if(l.default!==void 0){var p=j+B.util.getProperty(T);if(B.compositeRule){if(B.opts.strictDefaults){var b="default is ignored for: "+p;if(B.opts.strictDefaults==="log")B.logger.warn(b);else throw new Error(b)}}else{if(X+=" if ("+p+" === undefined ",B.opts.useDefaults=="empty")X+=" || "+p+" === null || "+p+" === '' ";if(X+=" ) "+p+" = ",B.opts.useDefaults=="shared")X+=" "+B.useDefault(l.default)+" ";else X+=" "+JSON.stringify(l.default)+" ";X+="; "}}}}}else if(g.type=="array"&&Array.isArray(B.schema.items)){var BD=B.schema.items;if(BD){var l,XD=-1,qD=BD.length-1;while(XD<qD)if(l=BD[XD+=1],l.default!==void 0){var p=j+"["+XD+"]";if(B.compositeRule){if(B.opts.strictDefaults){var b="default is ignored for: "+p;if(B.opts.strictDefaults==="log")B.logger.warn(b);else throw new Error(b)}}else{if(X+=" if ("+p+" === undefined ",B.opts.useDefaults=="empty")X+=" || "+p+" === null || "+p+" === '' ";if(X+=" ) "+p+" = ",B.opts.useDefaults=="shared")X+=" "+B.useDefault(l.default)+" ";else X+=" "+JSON.stringify(l.default)+" ";X+="; "}}}}}var JD=g.rules;if(JD){var ZD,PD=-1,RD=JD.length-1;while(PD<RD)if(ZD=JD[PD+=1],H0(ZD)){var Q0=ZD.code(B,ZD.keyword,g.type);if(Q0){if(X+=" "+Q0+" ",u)f+="}"}}}if(u)X+=" "+f+" ",f="";if(g.type){if(X+=" } ",x&&x===g.type&&!S){X+=" else { ";var H=B.schemaPath+".type",V=B.errSchemaPath+"/type",L=L||[];if(L.push(X),X="",B.createErrors!==!1){if(X+=" { keyword: '"+(y||"type")+"' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(V)+" , params: { type: '",w)X+=""+x.join(",");else X+=""+x;if(X+="' } ",B.opts.messages!==!1){if(X+=" , message: 'should be ",w)X+=""+x.join(",");else X+=""+x;X+="' "}if(B.opts.verbose)X+=" , schema: validate.schema"+H+" , parentSchema: validate.schema"+B.schemaPath+" , data: "+j+" ";X+=" } "}else X+=" {} ";var R=X;if(X=L.pop(),!B.compositeRule&&u)if(B.async)X+=" throw new ValidationError(["+R+"]); ";else X+=" validate.errors = ["+R+"]; return false; ";else X+=" var err = "+R+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";X+=" } "}}if(u){if(X+=" if (errors === ",k)X+="0";else X+="errs_"+A;X+=") { ",O+="}"}}}}if(u)X+=" "+O+" ";if(k){if(C)X+=" if (errors === 0) return data; ",X+=" else throw new ValidationError(vErrors); ";else X+=" validate.errors = vErrors; ",X+=" return errors === 0; ";X+=" }; return validate;"}else X+=" var "+I+" = errors === errs_"+A+";";function mD(sD){var v0=sD.rules;for(var R0=0;R0<v0.length;R0++)if(H0(v0[R0]))return!0}function H0(sD){return B.schema[sD.keyword]!==void 0||sD.implements&&SD(sD)}function SD(sD){var v0=sD.implements;for(var R0=0;R0<v0.length;R0++)if(B.schema[v0[R0]]!==void 0)return!0}return X}}),wq=KD((D,F)=>{var Q=q9(),B=f2(),Y=H9(),J=WQ(),X=zQ(),C=B.ucs2length,W=G9(),z=Y.Validation;F.exports=G;function G(R,k,b,I){var u=this,f=this._opts,O=[void 0],y={},x=[],w={},S=[],g={},d=[];k=k||{schema:R,refVal:O,refs:y};var n=q.call(this,R,k,I),a=this._compilations[n.index];if(n.compiling)return a.callValidate=FD;var DD=this._formats,o=this.RULES;try{var XD=LD(R,k,b,I);a.validate=XD;var YD=a.callValidate;if(YD){if(YD.schema=XD.schema,YD.errors=null,YD.refs=XD.refs,YD.refVal=XD.refVal,YD.root=XD.root,YD.$async=XD.$async,f.sourceCode)YD.source=XD.source}return XD}finally{A.call(this,R,k,I)}function FD(){var l=a.validate,p=l.apply(this,arguments);return FD.errors=l.errors,p}function LD(l,p,BD,qD){var JD=!p||p&&p.schema==l;if(p.schema!=k.schema)return G.call(u,l,p,BD,qD);var ZD=l.$async===!0,PD=X({isTop:!0,schema:l,isRoot:JD,baseId:qD,root:p,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:Y.MissingRef,RULES:o,validate:X,util:B,resolve:Q,resolveRef:hD,usePattern:T,useDefault:h,useCustomRule:c,opts:f,formats:DD,logger:u.logger,self:u});if(PD=L(O,V)+L(x,Z)+L(S,H)+L(d,j)+PD,f.processCode)PD=f.processCode(PD,l);var RD;try{var Q0=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",PD);RD=Q0(u,o,DD,k,O,S,d,W,C,z),O[0]=RD}catch(mD){throw u.logger.error("Error compiling schema, function code:",PD),mD}if(RD.schema=l,RD.errors=null,RD.refs=y,RD.refVal=O,RD.root=JD?RD:p,ZD)RD.$async=!0;if(f.sourceCode===!0)RD.source={code:PD,patterns:x,defaults:S};return RD}function hD(l,p,BD){p=Q.url(l,p);var qD=y[p],JD,ZD;if(qD!==void 0)return JD=O[qD],ZD="refVal["+qD+"]",K(JD,ZD);if(!BD&&k.refs){var PD=k.refs[p];if(PD!==void 0)return JD=k.refVal[PD],ZD=cD(p,JD),K(JD,ZD)}ZD=cD(p);var RD=Q.call(u,LD,k,p);if(RD===void 0){var Q0=b&&b[p];if(Q0)RD=Q.inlineRef(Q0,f.inlineRefs)?Q0:G.call(u,Q0,k,b,l)}if(RD===void 0)N(p);else return _(p,RD),K(RD,ZD)}function cD(l,p){var BD=O.length;return O[BD]=p,y[l]=BD,"refVal"+BD}function N(l){delete y[l]}function _(l,p){var BD=y[l];O[BD]=p}function K(l,p){return typeof l=="object"||typeof l=="boolean"?{code:p,schema:l,inline:!0}:{code:p,$async:l&&!!l.$async}}function T(l){var p=w[l];if(p===void 0)p=w[l]=x.length,x[p]=l;return"pattern"+p}function h(l){switch(typeof l){case"boolean":case"number":return""+l;case"string":return B.toQuotedString(l);case"object":if(l===null)return"null";var p=J(l),BD=g[p];if(BD===void 0)BD=g[p]=S.length,S[BD]=l;return"default"+BD}}function c(l,p,BD,qD){if(u._opts.validateSchema!==!1){var JD=l.definition.dependencies;if(JD&&!JD.every(function(v0){return Object.prototype.hasOwnProperty.call(BD,v0)}))throw new Error("parent schema must have all required keywords: "+JD.join(","));var ZD=l.definition.validateSchema;if(ZD){var PD=ZD(p);if(!PD){var RD="keyword schema is invalid: "+u.errorsText(ZD.errors);if(u._opts.validateSchema=="log")u.logger.error(RD);else throw new Error(RD)}}}var Q0=l.definition.compile,mD=l.definition.inline,H0=l.definition.macro,SD;if(Q0)SD=Q0.call(u,p,BD,qD);else if(H0){if(SD=H0.call(u,p,BD,qD),f.validateSchema!==!1)u.validateSchema(SD,!0)}else if(mD)SD=mD.call(u,qD,l.keyword,p,BD);else if(SD=l.definition.validate,!SD)return;if(SD===void 0)throw new Error('custom keyword "'+l.keyword+'"failed to compile');var sD=d.length;return d[sD]=SD,{code:"customRule"+sD,validate:SD}}}function q(R,k,b){var I=U.call(this,R,k,b);if(I>=0)return{index:I,compiling:!0};return I=this._compilations.length,this._compilations[I]={schema:R,root:k,baseId:b},{index:I,compiling:!1}}function A(R,k,b){var I=U.call(this,R,k,b);if(I>=0)this._compilations.splice(I,1)}function U(R,k,b){for(var I=0;I<this._compilations.length;I++){var u=this._compilations[I];if(u.schema==R&&u.root==k&&u.baseId==b)return I}return-1}function Z(R,k){return"var pattern"+R+" = new RegExp("+B.toQuotedString(k[R])+");"}function H(R){return"var default"+R+" = defaults["+R+"];"}function V(R,k){return k[R]===void 0?"":"var refVal"+R+" = refVal["+R+"];"}function j(R){return"var customRule"+R+" = customRules["+R+"];"}function L(R,k){if(!R.length)return"";var b="";for(var I=0;I<R.length;I++)b+=k(I,R);return b}}),Tq=KD((D,F)=>{var Q=F.exports=function B(){this._cache={}};Q.prototype.put=function B(Y,J){this._cache[Y]=J},Q.prototype.get=function B(Y){return this._cache[Y]},Q.prototype.del=function B(Y){delete this._cache[Y]},Q.prototype.clear=function B(){this._cache={}}}),Pq=KD((D,F)=>{var Q=f2(),B=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,Y=[0,31,28,31,30,31,30,31,31,30,31,30,31],J=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,X=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,C=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,W=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,z=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,G=/^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i,q=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,A=/^(?:\/(?:[^~/]|~0|~1)*)*$/,U=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,Z=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;F.exports=H;function H(O){return O=O=="full"?"full":"fast",Q.copy(H[O])}H.fast={date:/^\d\d\d\d-[0-1]\d-[0-3]\d$/,time:/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,"date-time":/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,"uri-template":z,url:G,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,hostname:X,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:f,uuid:q,"json-pointer":A,"json-pointer-uri-fragment":U,"relative-json-pointer":Z},H.full={date:j,time:L,"date-time":k,uri:I,"uri-reference":W,"uri-template":z,url:G,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:X,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:f,uuid:q,"json-pointer":A,"json-pointer-uri-fragment":U,"relative-json-pointer":Z};function V(O){return O%4===0&&(O%100!==0||O%400===0)}function j(O){var y=O.match(B);if(!y)return!1;var x=+y[1],w=+y[2],S=+y[3];return w>=1&&w<=12&&S>=1&&S<=(w==2&&V(x)?29:Y[w])}function L(O,y){var x=O.match(J);if(!x)return!1;var w=x[1],S=x[2],g=x[3],d=x[5];return(w<=23&&S<=59&&g<=59||w==23&&S==59&&g==60)&&(!y||d)}var R=/t|\s/i;function k(O){var y=O.split(R);return y.length==2&&j(y[0])&&L(y[1],!0)}var b=/\/|:/;function I(O){return b.test(O)&&C.test(O)}var u=/[^\\]\\Z/;function f(O){if(u.test(O))return!1;try{return new RegExp(O),!0}catch(y){return!1}}}),Sq=KD((D,F)=>{F.exports=function Q(B,Y,J){var X=" ",C=B.level,W=B.dataLevel,z=B.schema[Y],G=B.errSchemaPath+"/"+Y,q=!B.opts.allErrors,A="data"+(W||""),U="valid"+C,Z,H;if(z=="#"||z=="#/")if(B.isRoot)Z=B.async,H="validate";else Z=B.root.schema.$async===!0,H="root.refVal[0]";else{var V=B.resolveRef(B.baseId,z,B.isRoot);if(V===void 0){var j=B.MissingRefError.message(B.baseId,z);if(B.opts.missingRefs=="fail"){B.logger.error(j);var L=L||[];if(L.push(X),X="",B.createErrors!==!1){if(X+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(G)+" , params: { ref: '"+B.util.escapeQuotes(z)+"' } ",B.opts.messages!==!1)X+=" , message: 'can\\'t resolve reference "+B.util.escapeQuotes(z)+"' ";if(B.opts.verbose)X+=" , schema: "+B.util.toQuotedString(z)+" , parentSchema: validate.schema"+B.schemaPath+" , data: "+A+" ";X+=" } "}else X+=" {} ";var R=X;if(X=L.pop(),!B.compositeRule&&q)if(B.async)X+=" throw new ValidationError(["+R+"]); ";else X+=" validate.errors = ["+R+"]; return false; ";else X+=" var err = "+R+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(q)X+=" if (false) { "}else if(B.opts.missingRefs=="ignore"){if(B.logger.warn(j),q)X+=" if (true) { "}else throw new B.MissingRefError(B.baseId,z,j)}else if(V.inline){var k=B.util.copy(B);k.level++;var b="valid"+k.level;k.schema=V.schema,k.schemaPath="",k.errSchemaPath=z;var I=B.validate(k).replace(/validate\.schema/g,V.code);if(X+=" "+I+" ",q)X+=" if ("+b+") { "}else Z=V.$async===!0||B.async&&V.$async!==!1,H=V.code}if(H){var L=L||[];if(L.push(X),X="",B.opts.passContext)X+=" "+H+".call(this, ";else X+=" "+H+"( ";if(X+=" "+A+", (dataPath || '')",B.errorPath!='""')X+=" + "+B.errorPath;var u=W?"data"+(W-1||""):"parentData",f=W?B.dataPathArr[W]:"parentDataProperty";X+=" , "+u+" , "+f+", rootData) ";var O=X;if(X=L.pop(),Z){if(!B.async)throw new Error("async schema referenced by sync schema");if(q)X+=" var "+U+"; ";if(X+=" try { await "+O+"; ",q)X+=" "+U+" = true; ";if(X+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",q)X+=" "+U+" = false; ";if(X+=" } ",q)X+=" if ("+U+") { "}else if(X+=" if (!"+O+") { if (vErrors === null) vErrors = "+H+".errors; else vErrors = vErrors.concat("+H+".errors); errors = vErrors.length; } ",q)X+=" else { "}return X}}),kq=KD((D,F)=>{F.exports=function Q(B,Y,J){var X=" ",C=B.schema[Y],W=B.schemaPath+B.util.getProperty(Y),z=B.errSchemaPath+"/"+Y,G=!B.opts.allErrors,q=B.util.copy(B),A="";q.level++;var U="valid"+q.level,Z=q.baseId,H=!0,V=C;if(V){var j,L=-1,R=V.length-1;while(L<R)if(j=V[L+=1],B.opts.strictKeywords?typeof j=="object"&&Object.keys(j).length>0||j===!1:B.util.schemaHasRules(j,B.RULES.all)){if(H=!1,q.schema=j,q.schemaPath=W+"["+L+"]",q.errSchemaPath=z+"/"+L,X+=" "+B.validate(q)+" ",q.baseId=Z,G)X+=" if ("+U+") { ",A+="}"}}if(G)if(H)X+=" if (true) { ";else X+=" "+A.slice(0,-1)+" ";return X}}),bq=KD((D,F)=>{F.exports=function Q(B,Y,J){var X=" ",C=B.level,W=B.dataLevel,z=B.schema[Y],G=B.schemaPath+B.util.getProperty(Y),q=B.errSchemaPath+"/"+Y,A=!B.opts.allErrors,U="data"+(W||""),Z="valid"+C,H="errs__"+C,V=B.util.copy(B),j="";V.level++;var L="valid"+V.level,R=z.every(function(y){return B.opts.strictKeywords?typeof y=="object"&&Object.keys(y).length>0||y===!1:B.util.schemaHasRules(y,B.RULES.all)});if(R){var k=V.baseId;X+=" var "+H+" = errors; var "+Z+" = false; ";var b=B.compositeRule;B.compositeRule=V.compositeRule=!0;var I=z;if(I){var u,f=-1,O=I.length-1;while(f<O)u=I[f+=1],V.schema=u,V.schemaPath=G+"["+f+"]",V.errSchemaPath=q+"/"+f,X+=" "+B.validate(V)+" ",V.baseId=k,X+=" "+Z+" = "+Z+" || "+L+"; if (!"+Z+") { ",j+="}"}if(B.compositeRule=V.compositeRule=b,X+=" "+j+" if (!"+Z+") { var err = ",B.createErrors!==!1){if(X+=" { keyword: 'anyOf' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(q)+" , params: {} ",B.opts.messages!==!1)X+=" , message: 'should match some schema in anyOf' ";if(B.opts.verbose)X+=" , schema: validate.schema"+G+" , parentSchema: validate.schema"+B.schemaPath+" , data: "+U+" ";X+=" } "}else X+=" {} ";if(X+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!B.compositeRule&&A)if(B.async)X+=" throw new ValidationError(vErrors); ";else X+=" validate.errors = vErrors; return false; ";if(X+=" } else { errors = "+H+"; if (vErrors !== null) { if ("+H+") vErrors.length = "+H+"; else vErrors = null; } ",B.opts.allErrors)X+=" } "}else if(A)X+=" if (true) { ";return X}}),vq=KD((D,F)=>{F.exports=function Q(B,Y,J){var X=" ",C=B.schema[Y],W=B.errSchemaPath+"/"+Y,z=!B.opts.allErrors,G=B.util.toQuotedString(C);if(B.opts.$comment===!0)X+=" console.log("+G+");";else if(typeof B.opts.$comment=="function")X+=" self._opts.$comment("+G+", "+B.util.toQuotedString(W)+", validate.root.schema);";return X}}),xq=KD((D,F)=>{F.exports=function Q(B,Y,J){var X=" ",C=B.level,W=B.dataLevel,z=B.schema[Y],G=B.schemaPath+B.util.getProperty(Y),q=B.errSchemaPath+"/"+Y,A=!B.opts.allErrors,U="data"+(W||""),Z="valid"+C,H=B.opts.$data&&z&&z.$data,V;if(H)X+=" var schema"+C+" = "+B.util.getData(z.$data,W,B.dataPathArr)+"; ",V="schema"+C;else V=z;if(!H)X+=" var schema"+C+" = validate.schema"+G+";";X+="var "+Z+" = equal("+U+", schema"+C+"); if (!"+Z+") { ";var j=j||[];if(j.push(X),X="",B.createErrors!==!1){if(X+=" { keyword: 'const' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(q)+" , params: { allowedValue: schema"+C+" } ",B.opts.messages!==!1)X+=" , message: 'should be equal to constant' ";if(B.opts.verbose)X+=" , schema: validate.schema"+G+" , parentSchema: validate.schema"+B.schemaPath+" , data: "+U+" ";X+=" } "}else X+=" {} ";var L=X;if(X=j.pop(),!B.compositeRule&&A)if(B.async)X+=" throw new ValidationError(["+L+"]); ";else X+=" validate.errors = ["+L+"]; return false; ";else X+=" var err = "+L+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(X+=" }",A)X+=" else { ";return X}}),uq=KD((D,F)=>{F.exports=function Q(B,Y,J){var X=" ",C=B.level,W=B.dataLevel,z=B.schema[Y],G=B.schemaPath+B.util.getProperty(Y),q=B.errSchemaPath+"/"+Y,A=!B.opts.allErrors,U="data"+(W||""),Z="valid"+C,H="errs__"+C,V=B.util.copy(B),j="";V.level++;var L="valid"+V.level,R="i"+C,k=V.dataLevel=B.dataLevel+1,b="data"+k,I=B.baseId,u=B.opts.strictKeywords?typeof z=="object"&&Object.keys(z).length>0||z===!1:B.util.schemaHasRules(z,B.RULES.all);if(X+="var "+H+" = errors;var "+Z+";",u){var f=B.compositeRule;B.compositeRule=V.compositeRule=!0,V.schema=z,V.schemaPath=G,V.errSchemaPath=q,X+=" var "+L+" = false; for (var "+R+" = 0; "+R+" < "+U+".length; "+R+"++) { ",V.errorPath=B.util.getPathExpr(B.errorPath,R,B.opts.jsonPointers,!0);var O=U+"["+R+"]";V.dataPathArr[k]=R;var y=B.validate(V);if(V.baseId=I,B.util.varOccurences(y,b)<2)X+=" "+B.util.varReplace(y,b,O)+" ";else X+=" var "+b+" = "+O+"; "+y+" ";X+=" if ("+L+") break; } ",B.compositeRule=V.compositeRule=f,X+=" "+j+" if (!"+L+") {"}else X+=" if ("+U+".length == 0) {";var x=x||[];if(x.push(X),X="",B.createErrors!==!1){if(X+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(q)+" , params: {} ",B.opts.messages!==!1)X+=" , message: 'should contain a valid item' ";if(B.opts.verbose)X+=" , schema: validate.schema"+G+" , parentSchema: validate.schema"+B.schemaPath+" , data: "+U+" ";X+=" } "}else X+=" {} ";var w=X;if(X=x.pop(),!B.compositeRule&&A)if(B.async)X+=" throw new ValidationError(["+w+"]); ";else X+=" validate.errors = ["+w+"]; return false; ";else X+=" var err = "+w+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(X+=" } else { ",u)X+=" errors = "+H+"; if (vErrors !== null) { if ("+H+") vErrors.length = "+H+"; else vErrors = null; } ";if(B.opts.allErrors)X+=" } ";return X}}),yq=KD((D,F)=>{F.exports=function Q(B,Y,J){var X=" ",C=B.level,W=B.dataLevel,z=B.schema[Y],G=B.schemaPath+B.util.getProperty(Y),q=B.errSchemaPath+"/"+Y,A=!B.opts.allErrors,U="data"+(W||""),Z="errs__"+C,H=B.util.copy(B),V="";H.level++;var j="valid"+H.level,L={},R={},k=B.opts.ownProperties;for(f in z){if(f=="__proto__")continue;var b=z[f],I=Array.isArray(b)?R:L;I[f]=b}X+="var "+Z+" = errors;";var u=B.errorPath;X+="var missing"+C+";";for(var f in R)if(I=R[f],I.length){if(X+=" if ( "+U+B.util.getProperty(f)+" !== undefined ",k)X+=" && Object.prototype.hasOwnProperty.call("+U+", '"+B.util.escapeQuotes(f)+"') ";if(A){X+=" && ( ";var O=I;if(O){var y,x=-1,w=O.length-1;while(x<w){if(y=O[x+=1],x)X+=" || ";var S=B.util.getProperty(y),g=U+S;if(X+=" ( ( "+g+" === undefined ",k)X+=" || ! Object.prototype.hasOwnProperty.call("+U+", '"+B.util.escapeQuotes(y)+"') ";X+=") && (missing"+C+" = "+B.util.toQuotedString(B.opts.jsonPointers?y:S)+") ) "}}X+=")) { ";var d="missing"+C,n="' + "+d+" + '";if(B.opts._errorDataPathProperty)B.errorPath=B.opts.jsonPointers?B.util.getPathExpr(u,d,!0):u+" + "+d;var a=a||[];if(a.push(X),X="",B.createErrors!==!1){if(X+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(q)+" , params: { property: '"+B.util.escapeQuotes(f)+"', missingProperty: '"+n+"', depsCount: "+I.length+", deps: '"+B.util.escapeQuotes(I.length==1?I[0]:I.join(", "))+"' } ",B.opts.messages!==!1){if(X+=" , message: 'should have ",I.length==1)X+="property "+B.util.escapeQuotes(I[0]);else X+="properties "+B.util.escapeQuotes(I.join(", "));X+=" when property "+B.util.escapeQuotes(f)+" is present' "}if(B.opts.verbose)X+=" , schema: validate.schema"+G+" , parentSchema: validate.schema"+B.schemaPath+" , data: "+U+" ";X+=" } "}else X+=" {} ";var DD=X;if(X=a.pop(),!B.compositeRule&&A)if(B.async)X+=" throw new ValidationError(["+DD+"]); ";else X+=" validate.errors = ["+DD+"]; return false; ";else X+=" var err = "+DD+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else{X+=" ) { ";var o=I;if(o){var y,XD=-1,YD=o.length-1;while(XD<YD){y=o[XD+=1];var S=B.util.getProperty(y),n=B.util.escapeQuotes(y),g=U+S;if(B.opts._errorDataPathProperty)B.errorPath=B.util.getPath(u,y,B.opts.jsonPointers);if(X+=" if ( "+g+" === undefined ",k)X+=" || ! Object.prototype.hasOwnProperty.call("+U+", '"+B.util.escapeQuotes(y)+"') ";if(X+=") { var err = ",B.createErrors!==!1){if(X+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(q)+" , params: { property: '"+B.util.escapeQuotes(f)+"', missingProperty: '"+n+"', depsCount: "+I.length+", deps: '"+B.util.escapeQuotes(I.length==1?I[0]:I.join(", "))+"' } ",B.opts.messages!==!1){if(X+=" , message: 'should have ",I.length==1)X+="property "+B.util.escapeQuotes(I[0]);else X+="properties "+B.util.escapeQuotes(I.join(", "));X+=" when property "+B.util.escapeQuotes(f)+" is present' "}if(B.opts.verbose)X+=" , schema: validate.schema"+G+" , parentSchema: validate.schema"+B.schemaPath+" , data: "+U+" ";X+=" } "}else X+=" {} ";X+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}}if(X+=" } ",A)V+="}",X+=" else { "}B.errorPath=u;var FD=H.baseId;for(var f in L){var b=L[f];if(B.opts.strictKeywords?typeof b=="object"&&Object.keys(b).length>0||b===!1:B.util.schemaHasRules(b,B.RULES.all)){if(X+=" "+j+" = true; if ( "+U+B.util.getProperty(f)+" !== undefined ",k)X+=" && Object.prototype.hasOwnProperty.call("+U+", '"+B.util.escapeQuotes(f)+"') ";if(X+=") { ",H.schema=b,H.schemaPath=G+B.util.getProperty(f),H.errSchemaPath=q+"/"+B.util.escapeFragment(f),X+=" "+B.validate(H)+" ",H.baseId=FD,X+=" } ",A)X+=" if ("+j+") { ",V+="}"}}if(A)X+=" "+V+" if ("+Z+" == errors) {";return X}}),fq=KD((D,F)=>{F.exports=function Q(B,Y,J){var X=" ",C=B.level,W=B.dataLevel,z=B.schema[Y],G=B.schemaPath+B.util.getProperty(Y),q=B.errSchemaPath+"/"+Y,A=!B.opts.allErrors,U="data"+(W||""),Z="valid"+C,H=B.opts.$data&&z&&z.$data,V;if(H)X+=" var schema"+C+" = "+B.util.getData(z.$data,W,B.dataPathArr)+"; ",V="schema"+C;else V=z;var j="i"+C,L="schema"+C;if(!H)X+=" var "+L+" = validate.schema"+G+";";if(X+="var "+Z+";",H)X+=" if (schema"+C+" === undefined) "+Z+" = true; else if (!Array.isArray(schema"+C+")) "+Z+" = false; else {";if(X+=""+Z+" = false;for (var "+j+"=0; "+j+"<"+L+".length; "+j+"++) if (equal("+U+", "+L+"["+j+"])) { "+Z+" = true; break; }",H)X+=" } ";X+=" if (!"+Z+") { ";var R=R||[];if(R.push(X),X="",B.createErrors!==!1){if(X+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(q)+" , params: { allowedValues: schema"+C+" } ",B.opts.messages!==!1)X+=" , message: 'should be equal to one of the allowed values' ";if(B.opts.verbose)X+=" , schema: validate.schema"+G+" , parentSchema: validate.schema"+B.schemaPath+" , data: "+U+" ";X+=" } "}else X+=" {} ";var k=X;if(X=R.pop(),!B.compositeRule&&A)if(B.async)X+=" throw new ValidationError(["+k+"]); ";else X+=" validate.errors = ["+k+"]; return false; ";else X+=" var err = "+k+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(X+=" }",A)X+=" else { ";return X}}),gq=KD((D,F)=>{F.exports=function Q(B,Y,J){var X=" ",C=B.level,W=B.dataLevel,z=B.schema[Y],G=B.schemaPath+B.util.getProperty(Y),q=B.errSchemaPath+"/"+Y,A=!B.opts.allErrors,U="data"+(W||"");if(B.opts.format===!1){if(A)X+=" if (true) { ";return X}var Z=B.opts.$data&&z&&z.$data,H;if(Z)X+=" var schema"+C+" = "+B.util.getData(z.$data,W,B.dataPathArr)+"; ",H="schema"+C;else H=z;var V=B.opts.unknownFormats,j=Array.isArray(V);if(Z){var L="format"+C,R="isObject"+C,k="formatType"+C;if(X+=" var "+L+" = formats["+H+"]; var "+R+" = typeof "+L+" == 'object' && !("+L+" instanceof RegExp) && "+L+".validate; var "+k+" = "+R+" && "+L+".type || 'string'; if ("+R+") { ",B.async)X+=" var async"+C+" = "+L+".async; ";if(X+=" "+L+" = "+L+".validate; } if ( ",Z)X+=" ("+H+" !== undefined && typeof "+H+" != 'string') || ";if(X+=" (",V!="ignore"){if(X+=" ("+H+" && !"+L+" ",j)X+=" && self._opts.unknownFormats.indexOf("+H+") == -1 ";X+=") || "}if(X+=" ("+L+" && "+k+" == '"+J+"' && !(typeof "+L+" == 'function' ? ",B.async)X+=" (async"+C+" ? await "+L+"("+U+") : "+L+"("+U+")) ";else X+=" "+L+"("+U+") ";X+=" : "+L+".test("+U+"))))) {"}else{var L=B.formats[z];if(!L)if(V=="ignore"){if(B.logger.warn('unknown format "'+z+'" ignored in schema at path "'+B.errSchemaPath+'"'),A)X+=" if (true) { ";return X}else if(j&&V.indexOf(z)>=0){if(A)X+=" if (true) { ";return X}else throw new Error('unknown format "'+z+'" is used in schema at path "'+B.errSchemaPath+'"');var R=typeof L=="object"&&!(L instanceof RegExp)&&L.validate,k=R&&L.type||"string";if(R){var b=L.async===!0;L=L.validate}if(k!=J){if(A)X+=" if (true) { ";return X}if(b){if(!B.async)throw new Error("async format in sync schema");var I="formats"+B.util.getProperty(z)+".validate";X+=" if (!(await "+I+"("+U+"))) { "}else{X+=" if (! ";var I="formats"+B.util.getProperty(z);if(R)I+=".validate";if(typeof L=="function")X+=" "+I+"("+U+") ";else X+=" "+I+".test("+U+") ";X+=") { "}}var u=u||[];if(u.push(X),X="",B.createErrors!==!1){if(X+=" { keyword: 'format' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(q)+" , params: { format: ",Z)X+=""+H;else X+=""+B.util.toQuotedString(z);if(X+=" } ",B.opts.messages!==!1){if(X+=` , message: 'should match format "`,Z)X+="' + "+H+" + '";else X+=""+B.util.escapeQuotes(z);X+=`"' `}if(B.opts.verbose){if(X+=" , schema: ",Z)X+="validate.schema"+G;else X+=""+B.util.toQuotedString(z);X+=" , parentSchema: validate.schema"+B.schemaPath+" , data: "+U+" "}X+=" } "}else X+=" {} ";var f=X;if(X=u.pop(),!B.compositeRule&&A)if(B.async)X+=" throw new ValidationError(["+f+"]); ";else X+=" validate.errors = ["+f+"]; return false; ";else X+=" var err = "+f+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(X+=" } ",A)X+=" else { ";return X}}),$q=KD((D,F)=>{F.exports=function Q(B,Y,J){var X=" ",C=B.level,W=B.dataLevel,z=B.schema[Y],G=B.schemaPath+B.util.getProperty(Y),q=B.errSchemaPath+"/"+Y,A=!B.opts.allErrors,U="data"+(W||""),Z="valid"+C,H="errs__"+C,V=B.util.copy(B);V.level++;var j="valid"+V.level,L=B.schema.then,R=B.schema.else,k=L!==void 0&&(B.opts.strictKeywords?typeof L=="object"&&Object.keys(L).length>0||L===!1:B.util.schemaHasRules(L,B.RULES.all)),b=R!==void 0&&(B.opts.strictKeywords?typeof R=="object"&&Object.keys(R).length>0||R===!1:B.util.schemaHasRules(R,B.RULES.all)),I=V.baseId;if(k||b){var u;V.createErrors=!1,V.schema=z,V.schemaPath=G,V.errSchemaPath=q,X+=" var "+H+" = errors; var "+Z+" = true; ";var f=B.compositeRule;if(B.compositeRule=V.compositeRule=!0,X+=" "+B.validate(V)+" ",V.baseId=I,V.createErrors=!0,X+=" errors = "+H+"; if (vErrors !== null) { if ("+H+") vErrors.length = "+H+"; else vErrors = null; } ",B.compositeRule=V.compositeRule=f,k){if(X+=" if ("+j+") { ",V.schema=B.schema.then,V.schemaPath=B.schemaPath+".then",V.errSchemaPath=B.errSchemaPath+"/then",X+=" "+B.validate(V)+" ",V.baseId=I,X+=" "+Z+" = "+j+"; ",k&&b)u="ifClause"+C,X+=" var "+u+" = 'then'; ";else u="'then'";if(X+=" } ",b)X+=" else { "}else X+=" if (!"+j+") { ";if(b){if(V.schema=B.schema.else,V.schemaPath=B.schemaPath+".else",V.errSchemaPath=B.errSchemaPath+"/else",X+=" "+B.validate(V)+" ",V.baseId=I,X+=" "+Z+" = "+j+"; ",k&&b)u="ifClause"+C,X+=" var "+u+" = 'else'; ";else u="'else'";X+=" } "}if(X+=" if (!"+Z+") { var err = ",B.createErrors!==!1){if(X+=" { keyword: 'if' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(q)+" , params: { failingKeyword: "+u+" } ",B.opts.messages!==!1)X+=` , message: 'should match "' + `+u+` + '" schema' `;if(B.opts.verbose)X+=" , schema: validate.schema"+G+" , parentSchema: validate.schema"+B.schemaPath+" , data: "+U+" ";X+=" } "}else X+=" {} ";if(X+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!B.compositeRule&&A)if(B.async)X+=" throw new ValidationError(vErrors); ";else X+=" validate.errors = vErrors; return false; ";if(X+=" } ",A)X+=" else { "}else if(A)X+=" if (true) { ";return X}}),hq=KD((D,F)=>{F.exports=function Q(B,Y,J){var X=" ",C=B.level,W=B.dataLevel,z=B.schema[Y],G=B.schemaPath+B.util.getProperty(Y),q=B.errSchemaPath+"/"+Y,A=!B.opts.allErrors,U="data"+(W||""),Z="valid"+C,H="errs__"+C,V=B.util.copy(B),j="";V.level++;var L="valid"+V.level,R="i"+C,k=V.dataLevel=B.dataLevel+1,b="data"+k,I=B.baseId;if(X+="var "+H+" = errors;var "+Z+";",Array.isArray(z)){var u=B.schema.additionalItems;if(u===!1){X+=" "+Z+" = "+U+".length <= "+z.length+"; ";var f=q;q=B.errSchemaPath+"/additionalItems",X+=" if (!"+Z+") { ";var O=O||[];if(O.push(X),X="",B.createErrors!==!1){if(X+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(q)+" , params: { limit: "+z.length+" } ",B.opts.messages!==!1)X+=" , message: 'should NOT have more than "+z.length+" items' ";if(B.opts.verbose)X+=" , schema: false , parentSchema: validate.schema"+B.schemaPath+" , data: "+U+" ";X+=" } "}else X+=" {} ";var y=X;if(X=O.pop(),!B.compositeRule&&A)if(B.async)X+=" throw new ValidationError(["+y+"]); ";else X+=" validate.errors = ["+y+"]; return false; ";else X+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(X+=" } ",q=f,A)j+="}",X+=" else { "}var x=z;if(x){var w,S=-1,g=x.length-1;while(S<g)if(w=x[S+=1],B.opts.strictKeywords?typeof w=="object"&&Object.keys(w).length>0||w===!1:B.util.schemaHasRules(w,B.RULES.all)){X+=" "+L+" = true; if ("+U+".length > "+S+") { ";var d=U+"["+S+"]";V.schema=w,V.schemaPath=G+"["+S+"]",V.errSchemaPath=q+"/"+S,V.errorPath=B.util.getPathExpr(B.errorPath,S,B.opts.jsonPointers,!0),V.dataPathArr[k]=S;var n=B.validate(V);if(V.baseId=I,B.util.varOccurences(n,b)<2)X+=" "+B.util.varReplace(n,b,d)+" ";else X+=" var "+b+" = "+d+"; "+n+" ";if(X+=" } ",A)X+=" if ("+L+") { ",j+="}"}}if(typeof u=="object"&&(B.opts.strictKeywords?typeof u=="object"&&Object.keys(u).length>0||u===!1:B.util.schemaHasRules(u,B.RULES.all))){V.schema=u,V.schemaPath=B.schemaPath+".additionalItems",V.errSchemaPath=B.errSchemaPath+"/additionalItems",X+=" "+L+" = true; if ("+U+".length > "+z.length+") { for (var "+R+" = "+z.length+"; "+R+" < "+U+".length; "+R+"++) { ",V.errorPath=B.util.getPathExpr(B.errorPath,R,B.opts.jsonPointers,!0);var d=U+"["+R+"]";V.dataPathArr[k]=R;var n=B.validate(V);if(V.baseId=I,B.util.varOccurences(n,b)<2)X+=" "+B.util.varReplace(n,b,d)+" ";else X+=" var "+b+" = "+d+"; "+n+" ";if(A)X+=" if (!"+L+") break; ";if(X+=" } } ",A)X+=" if ("+L+") { ",j+="}"}}else if(B.opts.strictKeywords?typeof z=="object"&&Object.keys(z).length>0||z===!1:B.util.schemaHasRules(z,B.RULES.all)){V.schema=z,V.schemaPath=G,V.errSchemaPath=q,X+=" for (var "+R+" = 0; "+R+" < "+U+".length; "+R+"++) { ",V.errorPath=B.util.getPathExpr(B.errorPath,R,B.opts.jsonPointers,!0);var d=U+"["+R+"]";V.dataPathArr[k]=R;var n=B.validate(V);if(V.baseId=I,B.util.varOccurences(n,b)<2)X+=" "+B.util.varReplace(n,b,d)+" ";else X+=" var "+b+" = "+d+"; "+n+" ";if(A)X+=" if (!"+L+") break; ";X+=" }"}if(A)X+=" "+j+" if ("+H+" == errors) {";return X}}),sB=KD((D,F)=>{F.exports=function Q(B,Y,J){var X=" ",C=B.level,W=B.dataLevel,z=B.schema[Y],G=B.schemaPath+B.util.getProperty(Y),q=B.errSchemaPath+"/"+Y,A=!B.opts.allErrors,I,U="data"+(W||""),Z=B.opts.$data&&z&&z.$data,H;if(Z)X+=" var schema"+C+" = "+B.util.getData(z.$data,W,B.dataPathArr)+"; ",H="schema"+C;else H=z;var V=Y=="maximum",j=V?"exclusiveMaximum":"exclusiveMinimum",L=B.schema[j],R=B.opts.$data&&L&&L.$data,k=V?"<":">",b=V?">":"<",I=void 0;if(!(Z||typeof z=="number"||z===void 0))throw new Error(Y+" must be number");if(!(R||L===void 0||typeof L=="number"||typeof L=="boolean"))throw new Error(j+" must be number or boolean");if(R){var u=B.util.getData(L.$data,W,B.dataPathArr),f="exclusive"+C,O="exclType"+C,y="exclIsNumber"+C,x="op"+C,w="' + "+x+" + '";X+=" var schemaExcl"+C+" = "+u+"; ",u="schemaExcl"+C,X+=" var "+f+"; var "+O+" = typeof "+u+"; if ("+O+" != 'boolean' && "+O+" != 'undefined' && "+O+" != 'number') { ";var I=j,S=S||[];if(S.push(X),X="",B.createErrors!==!1){if(X+=" { keyword: '"+(I||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(q)+" , params: {} ",B.opts.messages!==!1)X+=" , message: '"+j+" should be boolean' ";if(B.opts.verbose)X+=" , schema: validate.schema"+G+" , parentSchema: validate.schema"+B.schemaPath+" , data: "+U+" ";X+=" } "}else X+=" {} ";var g=X;if(X=S.pop(),!B.compositeRule&&A)if(B.async)X+=" throw new ValidationError(["+g+"]); ";else X+=" validate.errors = ["+g+"]; return false; ";else X+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(X+=" } else if ( ",Z)X+=" ("+H+" !== undefined && typeof "+H+" != 'number') || ";if(X+=" "+O+" == 'number' ? ( ("+f+" = "+H+" === undefined || "+u+" "+k+"= "+H+") ? "+U+" "+b+"= "+u+" : "+U+" "+b+" "+H+" ) : ( ("+f+" = "+u+" === true) ? "+U+" "+b+"= "+H+" : "+U+" "+b+" "+H+" ) || "+U+" !== "+U+") { var op"+C+" = "+f+" ? '"+k+"' : '"+k+"='; ",z===void 0)I=j,q=B.errSchemaPath+"/"+j,H=u,Z=R}else{var y=typeof L=="number",w=k;if(y&&Z){var x="'"+w+"'";if(X+=" if ( ",Z)X+=" ("+H+" !== undefined && typeof "+H+" != 'number') || ";X+=" ( "+H+" === undefined || "+L+" "+k+"= "+H+" ? "+U+" "+b+"= "+L+" : "+U+" "+b+" "+H+" ) || "+U+" !== "+U+") { "}else{if(y&&z===void 0)f=!0,I=j,q=B.errSchemaPath+"/"+j,H=L,b+="=";else{if(y)H=Math[V?"min":"max"](L,z);if(L===(y?H:!0))f=!0,I=j,q=B.errSchemaPath+"/"+j,b+="=";else f=!1,w+="="}var x="'"+w+"'";if(X+=" if ( ",Z)X+=" ("+H+" !== undefined && typeof "+H+" != 'number') || ";X+=" "+U+" "+b+" "+H+" || "+U+" !== "+U+") { "}}I=I||Y;var S=S||[];if(S.push(X),X="",B.createErrors!==!1){if(X+=" { keyword: '"+(I||"_limit")+"' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(q)+" , params: { comparison: "+x+", limit: "+H+", exclusive: "+f+" } ",B.opts.messages!==!1)if(X+=" , message: 'should be "+w+" ",Z)X+="' + "+H;else X+=""+H+"'";if(B.opts.verbose){if(X+=" , schema: ",Z)X+="validate.schema"+G;else X+=""+z;X+=" , parentSchema: validate.schema"+B.schemaPath+" , data: "+U+" "}X+=" } "}else X+=" {} ";var g=X;if(X=S.pop(),!B.compositeRule&&A)if(B.async)X+=" throw new ValidationError(["+g+"]); ";else X+=" validate.errors = ["+g+"]; return false; ";else X+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(X+=" } ",A)X+=" else { ";return X}}),tB=KD((D,F)=>{F.exports=function Q(B,Y,J){var X=" ",C=B.level,W=B.dataLevel,z=B.schema[Y],G=B.schemaPath+B.util.getProperty(Y),q=B.errSchemaPath+"/"+Y,A=!B.opts.allErrors,j,U="data"+(W||""),Z=B.opts.$data&&z&&z.$data,H;if(Z)X+=" var schema"+C+" = "+B.util.getData(z.$data,W,B.dataPathArr)+"; ",H="schema"+C;else H=z;if(!(Z||typeof z=="number"))throw new Error(Y+" must be number");var V=Y=="maxItems"?">":"<";if(X+="if ( ",Z)X+=" ("+H+" !== undefined && typeof "+H+" != 'number') || ";X+=" "+U+".length "+V+" "+H+") { ";var j=Y,L=L||[];if(L.push(X),X="",B.createErrors!==!1){if(X+=" { keyword: '"+(j||"_limitItems")+"' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(q)+" , params: { limit: "+H+" } ",B.opts.messages!==!1){if(X+=" , message: 'should NOT have ",Y=="maxItems")X+="more";else X+="fewer";if(X+=" than ",Z)X+="' + "+H+" + '";else X+=""+z;X+=" items' "}if(B.opts.verbose){if(X+=" , schema: ",Z)X+="validate.schema"+G;else X+=""+z;X+=" , parentSchema: validate.schema"+B.schemaPath+" , data: "+U+" "}X+=" } "}else X+=" {} ";var R=X;if(X=L.pop(),!B.compositeRule&&A)if(B.async)X+=" throw new ValidationError(["+R+"]); ";else X+=" validate.errors = ["+R+"]; return false; ";else X+=" var err = "+R+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(X+="} ",A)X+=" else { ";return X}}),eB=KD((D,F)=>{F.exports=function Q(B,Y,J){var X=" ",C=B.level,W=B.dataLevel,z=B.schema[Y],G=B.schemaPath+B.util.getProperty(Y),q=B.errSchemaPath+"/"+Y,A=!B.opts.allErrors,j,U="data"+(W||""),Z=B.opts.$data&&z&&z.$data,H;if(Z)X+=" var schema"+C+" = "+B.util.getData(z.$data,W,B.dataPathArr)+"; ",H="schema"+C;else H=z;if(!(Z||typeof z=="number"))throw new Error(Y+" must be number");var V=Y=="maxLength"?">":"<";if(X+="if ( ",Z)X+=" ("+H+" !== undefined && typeof "+H+" != 'number') || ";if(B.opts.unicode===!1)X+=" "+U+".length ";else X+=" ucs2length("+U+") ";X+=" "+V+" "+H+") { ";var j=Y,L=L||[];if(L.push(X),X="",B.createErrors!==!1){if(X+=" { keyword: '"+(j||"_limitLength")+"' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(q)+" , params: { limit: "+H+" } ",B.opts.messages!==!1){if(X+=" , message: 'should NOT be ",Y=="maxLength")X+="longer";else X+="shorter";if(X+=" than ",Z)X+="' + "+H+" + '";else X+=""+z;X+=" characters' "}if(B.opts.verbose){if(X+=" , schema: ",Z)X+="validate.schema"+G;else X+=""+z;X+=" , parentSchema: validate.schema"+B.schemaPath+" , data: "+U+" "}X+=" } "}else X+=" {} ";var R=X;if(X=L.pop(),!B.compositeRule&&A)if(B.async)X+=" throw new ValidationError(["+R+"]); ";else X+=" validate.errors = ["+R+"]; return false; ";else X+=" var err = "+R+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(X+="} ",A)X+=" else { ";return X}}),DQ=KD((D,F)=>{F.exports=function Q(B,Y,J){var X=" ",C=B.level,W=B.dataLevel,z=B.schema[Y],G=B.schemaPath+B.util.getProperty(Y),q=B.errSchemaPath+"/"+Y,A=!B.opts.allErrors,j,U="data"+(W||""),Z=B.opts.$data&&z&&z.$data,H;if(Z)X+=" var schema"+C+" = "+B.util.getData(z.$data,W,B.dataPathArr)+"; ",H="schema"+C;else H=z;if(!(Z||typeof z=="number"))throw new Error(Y+" must be number");var V=Y=="maxProperties"?">":"<";if(X+="if ( ",Z)X+=" ("+H+" !== undefined && typeof "+H+" != 'number') || ";X+=" Object.keys("+U+").length "+V+" "+H+") { ";var j=Y,L=L||[];if(L.push(X),X="",B.createErrors!==!1){if(X+=" { keyword: '"+(j||"_limitProperties")+"' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(q)+" , params: { limit: "+H+" } ",B.opts.messages!==!1){if(X+=" , message: 'should NOT have ",Y=="maxProperties")X+="more";else X+="fewer";if(X+=" than ",Z)X+="' + "+H+" + '";else X+=""+z;X+=" properties' "}if(B.opts.verbose){if(X+=" , schema: ",Z)X+="validate.schema"+G;else X+=""+z;X+=" , parentSchema: validate.schema"+B.schemaPath+" , data: "+U+" "}X+=" } "}else X+=" {} ";var R=X;if(X=L.pop(),!B.compositeRule&&A)if(B.async)X+=" throw new ValidationError(["+R+"]); ";else X+=" validate.errors = ["+R+"]; return false; ";else X+=" var err = "+R+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(X+="} ",A)X+=" else { ";return X}}),mq=KD((D,F)=>{F.exports=function Q(B,Y,J){var X=" ",C=B.level,W=B.dataLevel,z=B.schema[Y],G=B.schemaPath+B.util.getProperty(Y),q=B.errSchemaPath+"/"+Y,A=!B.opts.allErrors,U="data"+(W||""),Z=B.opts.$data&&z&&z.$data,H;if(Z)X+=" var schema"+C+" = "+B.util.getData(z.$data,W,B.dataPathArr)+"; ",H="schema"+C;else H=z;if(!(Z||typeof z=="number"))throw new Error(Y+" must be number");if(X+="var division"+C+";if (",Z)X+=" "+H+" !== undefined && ( typeof "+H+" != 'number' || ";if(X+=" (division"+C+" = "+U+" / "+H+", ",B.opts.multipleOfPrecision)X+=" Math.abs(Math.round(division"+C+") - division"+C+") > 1e-"+B.opts.multipleOfPrecision+" ";else X+=" division"+C+" !== parseInt(division"+C+") ";if(X+=" ) ",Z)X+=" ) ";X+=" ) { ";var V=V||[];if(V.push(X),X="",B.createErrors!==!1){if(X+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(q)+" , params: { multipleOf: "+H+" } ",B.opts.messages!==!1)if(X+=" , message: 'should be multiple of ",Z)X+="' + "+H;else X+=""+H+"'";if(B.opts.verbose){if(X+=" , schema: ",Z)X+="validate.schema"+G;else X+=""+z;X+=" , parentSchema: validate.schema"+B.schemaPath+" , data: "+U+" "}X+=" } "}else X+=" {} ";var j=X;if(X=V.pop(),!B.compositeRule&&A)if(B.async)X+=" throw new ValidationError(["+j+"]); ";else X+=" validate.errors = ["+j+"]; return false; ";else X+=" var err = "+j+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(X+="} ",A)X+=" else { ";return X}}),lq=KD((D,F)=>{F.exports=function Q(B,Y,J){var X=" ",C=B.level,W=B.dataLevel,z=B.schema[Y],G=B.schemaPath+B.util.getProperty(Y),q=B.errSchemaPath+"/"+Y,A=!B.opts.allErrors,U="data"+(W||""),Z="errs__"+C,H=B.util.copy(B);H.level++;var V="valid"+H.level;if(B.opts.strictKeywords?typeof z=="object"&&Object.keys(z).length>0||z===!1:B.util.schemaHasRules(z,B.RULES.all)){H.schema=z,H.schemaPath=G,H.errSchemaPath=q,X+=" var "+Z+" = errors; ";var j=B.compositeRule;B.compositeRule=H.compositeRule=!0,H.createErrors=!1;var L;if(H.opts.allErrors)L=H.opts.allErrors,H.opts.allErrors=!1;if(X+=" "+B.validate(H)+" ",H.createErrors=!0,L)H.opts.allErrors=L;B.compositeRule=H.compositeRule=j,X+=" if ("+V+") { ";var R=R||[];if(R.push(X),X="",B.createErrors!==!1){if(X+=" { keyword: 'not' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(q)+" , params: {} ",B.opts.messages!==!1)X+=" , message: 'should NOT be valid' ";if(B.opts.verbose)X+=" , schema: validate.schema"+G+" , parentSchema: validate.schema"+B.schemaPath+" , data: "+U+" ";X+=" } "}else X+=" {} ";var k=X;if(X=R.pop(),!B.compositeRule&&A)if(B.async)X+=" throw new ValidationError(["+k+"]); ";else X+=" validate.errors = ["+k+"]; return false; ";else X+=" var err = "+k+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(X+=" } else { errors = "+Z+"; if (vErrors !== null) { if ("+Z+") vErrors.length = "+Z+"; else vErrors = null; } ",B.opts.allErrors)X+=" } "}else{if(X+=" var err = ",B.createErrors!==!1){if(X+=" { keyword: 'not' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(q)+" , params: {} ",B.opts.messages!==!1)X+=" , message: 'should NOT be valid' ";if(B.opts.verbose)X+=" , schema: validate.schema"+G+" , parentSchema: validate.schema"+B.schemaPath+" , data: "+U+" ";X+=" } "}else X+=" {} ";if(X+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",A)X+=" if (false) { "}return X}}),dq=KD((D,F)=>{F.exports=function Q(B,Y,J){var X=" ",C=B.level,W=B.dataLevel,z=B.schema[Y],G=B.schemaPath+B.util.getProperty(Y),q=B.errSchemaPath+"/"+Y,A=!B.opts.allErrors,U="data"+(W||""),Z="valid"+C,H="errs__"+C,V=B.util.copy(B),j="";V.level++;var L="valid"+V.level,R=V.baseId,k="prevValid"+C,b="passingSchemas"+C;X+="var "+H+" = errors , "+k+" = false , "+Z+" = false , "+b+" = null; ";var I=B.compositeRule;B.compositeRule=V.compositeRule=!0;var u=z;if(u){var f,O=-1,y=u.length-1;while(O<y){if(f=u[O+=1],B.opts.strictKeywords?typeof f=="object"&&Object.keys(f).length>0||f===!1:B.util.schemaHasRules(f,B.RULES.all))V.schema=f,V.schemaPath=G+"["+O+"]",V.errSchemaPath=q+"/"+O,X+=" "+B.validate(V)+" ",V.baseId=R;else X+=" var "+L+" = true; ";if(O)X+=" if ("+L+" && "+k+") { "+Z+" = false; "+b+" = ["+b+", "+O+"]; } else { ",j+="}";X+=" if ("+L+") { "+Z+" = "+k+" = true; "+b+" = "+O+"; }"}}if(B.compositeRule=V.compositeRule=I,X+=""+j+"if (!"+Z+") { var err = ",B.createErrors!==!1){if(X+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(q)+" , params: { passingSchemas: "+b+" } ",B.opts.messages!==!1)X+=" , message: 'should match exactly one schema in oneOf' ";if(B.opts.verbose)X+=" , schema: validate.schema"+G+" , parentSchema: validate.schema"+B.schemaPath+" , data: "+U+" ";X+=" } "}else X+=" {} ";if(X+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!B.compositeRule&&A)if(B.async)X+=" throw new ValidationError(vErrors); ";else X+=" validate.errors = vErrors; return false; ";if(X+="} else { errors = "+H+"; if (vErrors !== null) { if ("+H+") vErrors.length = "+H+"; else vErrors = null; }",B.opts.allErrors)X+=" } ";return X}}),cq=KD((D,F)=>{F.exports=function Q(B,Y,J){var X=" ",C=B.level,W=B.dataLevel,z=B.schema[Y],G=B.schemaPath+B.util.getProperty(Y),q=B.errSchemaPath+"/"+Y,A=!B.opts.allErrors,U="data"+(W||""),Z=B.opts.$data&&z&&z.$data,H;if(Z)X+=" var schema"+C+" = "+B.util.getData(z.$data,W,B.dataPathArr)+"; ",H="schema"+C;else H=z;var V=Z?"(new RegExp("+H+"))":B.usePattern(z);if(X+="if ( ",Z)X+=" ("+H+" !== undefined && typeof "+H+" != 'string') || ";X+=" !"+V+".test("+U+") ) { ";var j=j||[];if(j.push(X),X="",B.createErrors!==!1){if(X+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(q)+" , params: { pattern: ",Z)X+=""+H;else X+=""+B.util.toQuotedString(z);if(X+=" } ",B.opts.messages!==!1){if(X+=` , message: 'should match pattern "`,Z)X+="' + "+H+" + '";else X+=""+B.util.escapeQuotes(z);X+=`"' `}if(B.opts.verbose){if(X+=" , schema: ",Z)X+="validate.schema"+G;else X+=""+B.util.toQuotedString(z);X+=" , parentSchema: validate.schema"+B.schemaPath+" , data: "+U+" "}X+=" } "}else X+=" {} ";var L=X;if(X=j.pop(),!B.compositeRule&&A)if(B.async)X+=" throw new ValidationError(["+L+"]); ";else X+=" validate.errors = ["+L+"]; return false; ";else X+=" var err = "+L+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(X+="} ",A)X+=" else { ";return X}}),pq=KD((D,F)=>{F.exports=function Q(B,Y,J){var X=" ",C=B.level,W=B.dataLevel,z=B.schema[Y],G=B.schemaPath+B.util.getProperty(Y),q=B.errSchemaPath+"/"+Y,A=!B.opts.allErrors,U="data"+(W||""),Z="errs__"+C,H=B.util.copy(B),V="";H.level++;var j="valid"+H.level,L="key"+C,R="idx"+C,k=H.dataLevel=B.dataLevel+1,b="data"+k,I="dataProperties"+C,u=Object.keys(z||{}).filter(XD),f=B.schema.patternProperties||{},O=Object.keys(f).filter(XD),y=B.schema.additionalProperties,x=u.length||O.length,w=y===!1,S=typeof y=="object"&&Object.keys(y).length,g=B.opts.removeAdditional,d=w||S||g,n=B.opts.ownProperties,a=B.baseId,DD=B.schema.required;if(DD&&!(B.opts.$data&&DD.$data)&&DD.length<B.opts.loopRequired)var o=B.util.toHash(DD);function XD(i0){return i0!=="__proto__"}if(X+="var "+Z+" = errors;var "+j+" = true;",n)X+=" var "+I+" = undefined;";if(d){if(n)X+=" "+I+" = "+I+" || Object.keys("+U+"); for (var "+R+"=0; "+R+"<"+I+".length; "+R+"++) { var "+L+" = "+I+"["+R+"]; ";else X+=" for (var "+L+" in "+U+") { ";if(x){if(X+=" var isAdditional"+C+" = !(false ",u.length)if(u.length>8)X+=" || validate.schema"+G+".hasOwnProperty("+L+") ";else{var YD=u;if(YD){var FD,LD=-1,hD=YD.length-1;while(LD<hD)FD=YD[LD+=1],X+=" || "+L+" == "+B.util.toQuotedString(FD)+" "}}if(O.length){var cD=O;if(cD){var N,_=-1,K=cD.length-1;while(_<K)N=cD[_+=1],X+=" || "+B.usePattern(N)+".test("+L+") "}}X+=" ); if (isAdditional"+C+") { "}if(g=="all")X+=" delete "+U+"["+L+"]; ";else{var T=B.errorPath,h="' + "+L+" + '";if(B.opts._errorDataPathProperty)B.errorPath=B.util.getPathExpr(B.errorPath,L,B.opts.jsonPointers);if(w)if(g)X+=" delete "+U+"["+L+"]; ";else{X+=" "+j+" = false; ";var c=q;q=B.errSchemaPath+"/additionalProperties";var l=l||[];if(l.push(X),X="",B.createErrors!==!1){if(X+=" { keyword: 'additionalProperties' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(q)+" , params: { additionalProperty: '"+h+"' } ",B.opts.messages!==!1){if(X+=" , message: '",B.opts._errorDataPathProperty)X+="is an invalid additional property";else X+="should NOT have additional properties";X+="' "}if(B.opts.verbose)X+=" , schema: false , parentSchema: validate.schema"+B.schemaPath+" , data: "+U+" ";X+=" } "}else X+=" {} ";var p=X;if(X=l.pop(),!B.compositeRule&&A)if(B.async)X+=" throw new ValidationError(["+p+"]); ";else X+=" validate.errors = ["+p+"]; return false; ";else X+=" var err = "+p+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(q=c,A)X+=" break; "}else if(S)if(g=="failing"){X+=" var "+Z+" = errors; ";var BD=B.compositeRule;B.compositeRule=H.compositeRule=!0,H.schema=y,H.schemaPath=B.schemaPath+".additionalProperties",H.errSchemaPath=B.errSchemaPath+"/additionalProperties",H.errorPath=B.opts._errorDataPathProperty?B.errorPath:B.util.getPathExpr(B.errorPath,L,B.opts.jsonPointers);var qD=U+"["+L+"]";H.dataPathArr[k]=L;var JD=B.validate(H);if(H.baseId=a,B.util.varOccurences(JD,b)<2)X+=" "+B.util.varReplace(JD,b,qD)+" ";else X+=" var "+b+" = "+qD+"; "+JD+" ";X+=" if (!"+j+") { errors = "+Z+"; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete "+U+"["+L+"]; } ",B.compositeRule=H.compositeRule=BD}else{H.schema=y,H.schemaPath=B.schemaPath+".additionalProperties",H.errSchemaPath=B.errSchemaPath+"/additionalProperties",H.errorPath=B.opts._errorDataPathProperty?B.errorPath:B.util.getPathExpr(B.errorPath,L,B.opts.jsonPointers);var qD=U+"["+L+"]";H.dataPathArr[k]=L;var JD=B.validate(H);if(H.baseId=a,B.util.varOccurences(JD,b)<2)X+=" "+B.util.varReplace(JD,b,qD)+" ";else X+=" var "+b+" = "+qD+"; "+JD+" ";if(A)X+=" if (!"+j+") break; "}B.errorPath=T}if(x)X+=" } ";if(X+=" } ",A)X+=" if ("+j+") { ",V+="}"}var ZD=B.opts.useDefaults&&!B.compositeRule;if(u.length){var PD=u;if(PD){var FD,RD=-1,Q0=PD.length-1;while(RD<Q0){FD=PD[RD+=1];var mD=z[FD];if(B.opts.strictKeywords?typeof mD=="object"&&Object.keys(mD).length>0||mD===!1:B.util.schemaHasRules(mD,B.RULES.all)){var H0=B.util.getProperty(FD),qD=U+H0,SD=ZD&&mD.default!==void 0;H.schema=mD,H.schemaPath=G+H0,H.errSchemaPath=q+"/"+B.util.escapeFragment(FD),H.errorPath=B.util.getPath(B.errorPath,FD,B.opts.jsonPointers),H.dataPathArr[k]=B.util.toQuotedString(FD);var JD=B.validate(H);if(H.baseId=a,B.util.varOccurences(JD,b)<2){JD=B.util.varReplace(JD,b,qD);var sD=qD}else{var sD=b;X+=" var "+b+" = "+qD+"; "}if(SD)X+=" "+JD+" ";else{if(o&&o[FD]){if(X+=" if ( "+sD+" === undefined ",n)X+=" || ! Object.prototype.hasOwnProperty.call("+U+", '"+B.util.escapeQuotes(FD)+"') ";X+=") { "+j+" = false; ";var T=B.errorPath,c=q,v0=B.util.escapeQuotes(FD);if(B.opts._errorDataPathProperty)B.errorPath=B.util.getPath(T,FD,B.opts.jsonPointers);q=B.errSchemaPath+"/required";var l=l||[];if(l.push(X),X="",B.createErrors!==!1){if(X+=" { keyword: 'required' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(q)+" , params: { missingProperty: '"+v0+"' } ",B.opts.messages!==!1){if(X+=" , message: '",B.opts._errorDataPathProperty)X+="is a required property";else X+="should have required property \\'"+v0+"\\'";X+="' "}if(B.opts.verbose)X+=" , schema: validate.schema"+G+" , parentSchema: validate.schema"+B.schemaPath+" , data: "+U+" ";X+=" } "}else X+=" {} ";var p=X;if(X=l.pop(),!B.compositeRule&&A)if(B.async)X+=" throw new ValidationError(["+p+"]); ";else X+=" validate.errors = ["+p+"]; return false; ";else X+=" var err = "+p+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";q=c,B.errorPath=T,X+=" } else { "}else if(A){if(X+=" if ( "+sD+" === undefined ",n)X+=" || ! Object.prototype.hasOwnProperty.call("+U+", '"+B.util.escapeQuotes(FD)+"') ";X+=") { "+j+" = true; } else { "}else{if(X+=" if ("+sD+" !== undefined ",n)X+=" && Object.prototype.hasOwnProperty.call("+U+", '"+B.util.escapeQuotes(FD)+"') ";X+=" ) { "}X+=" "+JD+" } "}}if(A)X+=" if ("+j+") { ",V+="}"}}}if(O.length){var R0=O;if(R0){var N,g8=-1,F1=R0.length-1;while(g8<F1){N=R0[g8+=1];var mD=f[N];if(B.opts.strictKeywords?typeof mD=="object"&&Object.keys(mD).length>0||mD===!1:B.util.schemaHasRules(mD,B.RULES.all)){if(H.schema=mD,H.schemaPath=B.schemaPath+".patternProperties"+B.util.getProperty(N),H.errSchemaPath=B.errSchemaPath+"/patternProperties/"+B.util.escapeFragment(N),n)X+=" "+I+" = "+I+" || Object.keys("+U+"); for (var "+R+"=0; "+R+"<"+I+".length; "+R+"++) { var "+L+" = "+I+"["+R+"]; ";else X+=" for (var "+L+" in "+U+") { ";X+=" if ("+B.usePattern(N)+".test("+L+")) { ",H.errorPath=B.util.getPathExpr(B.errorPath,L,B.opts.jsonPointers);var qD=U+"["+L+"]";H.dataPathArr[k]=L;var JD=B.validate(H);if(H.baseId=a,B.util.varOccurences(JD,b)<2)X+=" "+B.util.varReplace(JD,b,qD)+" ";else X+=" var "+b+" = "+qD+"; "+JD+" ";if(A)X+=" if (!"+j+") break; ";if(X+=" } ",A)X+=" else "+j+" = true; ";if(X+=" } ",A)X+=" if ("+j+") { ",V+="}"}}}}if(A)X+=" "+V+" if ("+Z+" == errors) {";return X}}),nq=KD((D,F)=>{F.exports=function Q(B,Y,J){var X=" ",C=B.level,W=B.dataLevel,z=B.schema[Y],G=B.schemaPath+B.util.getProperty(Y),q=B.errSchemaPath+"/"+Y,A=!B.opts.allErrors,U="data"+(W||""),Z="errs__"+C,H=B.util.copy(B),V="";H.level++;var j="valid"+H.level;if(X+="var "+Z+" = errors;",B.opts.strictKeywords?typeof z=="object"&&Object.keys(z).length>0||z===!1:B.util.schemaHasRules(z,B.RULES.all)){H.schema=z,H.schemaPath=G,H.errSchemaPath=q;var L="key"+C,R="idx"+C,k="i"+C,b="' + "+L+" + '",I=H.dataLevel=B.dataLevel+1,u="data"+I,f="dataProperties"+C,O=B.opts.ownProperties,y=B.baseId;if(O)X+=" var "+f+" = undefined; ";if(O)X+=" "+f+" = "+f+" || Object.keys("+U+"); for (var "+R+"=0; "+R+"<"+f+".length; "+R+"++) { var "+L+" = "+f+"["+R+"]; ";else X+=" for (var "+L+" in "+U+") { ";X+=" var startErrs"+C+" = errors; ";var x=L,w=B.compositeRule;B.compositeRule=H.compositeRule=!0;var S=B.validate(H);if(H.baseId=y,B.util.varOccurences(S,u)<2)X+=" "+B.util.varReplace(S,u,x)+" ";else X+=" var "+u+" = "+x+"; "+S+" ";if(B.compositeRule=H.compositeRule=w,X+=" if (!"+j+") { for (var "+k+"=startErrs"+C+"; "+k+"<errors; "+k+"++) { vErrors["+k+"].propertyName = "+L+"; } var err = ",B.createErrors!==!1){if(X+=" { keyword: 'propertyNames' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(q)+" , params: { propertyName: '"+b+"' } ",B.opts.messages!==!1)X+=" , message: 'property name \\'"+b+"\\' is invalid' ";if(B.opts.verbose)X+=" , schema: validate.schema"+G+" , parentSchema: validate.schema"+B.schemaPath+" , data: "+U+" ";X+=" } "}else X+=" {} ";if(X+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!B.compositeRule&&A)if(B.async)X+=" throw new ValidationError(vErrors); ";else X+=" validate.errors = vErrors; return false; ";if(A)X+=" break; ";X+=" } }"}if(A)X+=" "+V+" if ("+Z+" == errors) {";return X}}),iq=KD((D,F)=>{F.exports=function Q(B,Y,J){var X=" ",C=B.level,W=B.dataLevel,z=B.schema[Y],G=B.schemaPath+B.util.getProperty(Y),q=B.errSchemaPath+"/"+Y,A=!B.opts.allErrors,U="data"+(W||""),Z="valid"+C,H=B.opts.$data&&z&&z.$data,V;if(H)X+=" var schema"+C+" = "+B.util.getData(z.$data,W,B.dataPathArr)+"; ",V="schema"+C;else V=z;var j="schema"+C;if(!H)if(z.length<B.opts.loopRequired&&B.schema.properties&&Object.keys(B.schema.properties).length){var L=[],R=z;if(R){var k,b=-1,I=R.length-1;while(b<I){k=R[b+=1];var u=B.schema.properties[k];if(!(u&&(B.opts.strictKeywords?typeof u=="object"&&Object.keys(u).length>0||u===!1:B.util.schemaHasRules(u,B.RULES.all))))L[L.length]=k}}}else var L=z;if(H||L.length){var f=B.errorPath,O=H||L.length>=B.opts.loopRequired,y=B.opts.ownProperties;if(A)if(X+=" var missing"+C+"; ",O){if(!H)X+=" var "+j+" = validate.schema"+G+"; ";var x="i"+C,w="schema"+C+"["+x+"]",S="' + "+w+" + '";if(B.opts._errorDataPathProperty)B.errorPath=B.util.getPathExpr(f,w,B.opts.jsonPointers);if(X+=" var "+Z+" = true; ",H)X+=" if (schema"+C+" === undefined) "+Z+" = true; else if (!Array.isArray(schema"+C+")) "+Z+" = false; else {";if(X+=" for (var "+x+" = 0; "+x+" < "+j+".length; "+x+"++) { "+Z+" = "+U+"["+j+"["+x+"]] !== undefined ",y)X+=" && Object.prototype.hasOwnProperty.call("+U+", "+j+"["+x+"]) ";if(X+="; if (!"+Z+") break; } ",H)X+=" } ";X+=" if (!"+Z+") { ";var g=g||[];if(g.push(X),X="",B.createErrors!==!1){if(X+=" { keyword: 'required' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(q)+" , params: { missingProperty: '"+S+"' } ",B.opts.messages!==!1){if(X+=" , message: '",B.opts._errorDataPathProperty)X+="is a required property";else X+="should have required property \\'"+S+"\\'";X+="' "}if(B.opts.verbose)X+=" , schema: validate.schema"+G+" , parentSchema: validate.schema"+B.schemaPath+" , data: "+U+" ";X+=" } "}else X+=" {} ";var d=X;if(X=g.pop(),!B.compositeRule&&A)if(B.async)X+=" throw new ValidationError(["+d+"]); ";else X+=" validate.errors = ["+d+"]; return false; ";else X+=" var err = "+d+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";X+=" } else { "}else{X+=" if ( ";var n=L;if(n){var a,x=-1,DD=n.length-1;while(x<DD){if(a=n[x+=1],x)X+=" || ";var o=B.util.getProperty(a),XD=U+o;if(X+=" ( ( "+XD+" === undefined ",y)X+=" || ! Object.prototype.hasOwnProperty.call("+U+", '"+B.util.escapeQuotes(a)+"') ";X+=") && (missing"+C+" = "+B.util.toQuotedString(B.opts.jsonPointers?a:o)+") ) "}}X+=") { ";var w="missing"+C,S="' + "+w+" + '";if(B.opts._errorDataPathProperty)B.errorPath=B.opts.jsonPointers?B.util.getPathExpr(f,w,!0):f+" + "+w;var g=g||[];if(g.push(X),X="",B.createErrors!==!1){if(X+=" { keyword: 'required' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(q)+" , params: { missingProperty: '"+S+"' } ",B.opts.messages!==!1){if(X+=" , message: '",B.opts._errorDataPathProperty)X+="is a required property";else X+="should have required property \\'"+S+"\\'";X+="' "}if(B.opts.verbose)X+=" , schema: validate.schema"+G+" , parentSchema: validate.schema"+B.schemaPath+" , data: "+U+" ";X+=" } "}else X+=" {} ";var d=X;if(X=g.pop(),!B.compositeRule&&A)if(B.async)X+=" throw new ValidationError(["+d+"]); ";else X+=" validate.errors = ["+d+"]; return false; ";else X+=" var err = "+d+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";X+=" } else { "}else if(O){if(!H)X+=" var "+j+" = validate.schema"+G+"; ";var x="i"+C,w="schema"+C+"["+x+"]",S="' + "+w+" + '";if(B.opts._errorDataPathProperty)B.errorPath=B.util.getPathExpr(f,w,B.opts.jsonPointers);if(H){if(X+=" if ("+j+" && !Array.isArray("+j+")) { var err = ",B.createErrors!==!1){if(X+=" { keyword: 'required' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(q)+" , params: { missingProperty: '"+S+"' } ",B.opts.messages!==!1){if(X+=" , message: '",B.opts._errorDataPathProperty)X+="is a required property";else X+="should have required property \\'"+S+"\\'";X+="' "}if(B.opts.verbose)X+=" , schema: validate.schema"+G+" , parentSchema: validate.schema"+B.schemaPath+" , data: "+U+" ";X+=" } "}else X+=" {} ";X+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if ("+j+" !== undefined) { "}if(X+=" for (var "+x+" = 0; "+x+" < "+j+".length; "+x+"++) { if ("+U+"["+j+"["+x+"]] === undefined ",y)X+=" || ! Object.prototype.hasOwnProperty.call("+U+", "+j+"["+x+"]) ";if(X+=") { var err = ",B.createErrors!==!1){if(X+=" { keyword: 'required' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(q)+" , params: { missingProperty: '"+S+"' } ",B.opts.messages!==!1){if(X+=" , message: '",B.opts._errorDataPathProperty)X+="is a required property";else X+="should have required property \\'"+S+"\\'";X+="' "}if(B.opts.verbose)X+=" , schema: validate.schema"+G+" , parentSchema: validate.schema"+B.schemaPath+" , data: "+U+" ";X+=" } "}else X+=" {} ";if(X+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ",H)X+=" } "}else{var YD=L;if(YD){var a,FD=-1,LD=YD.length-1;while(FD<LD){a=YD[FD+=1];var o=B.util.getProperty(a),S=B.util.escapeQuotes(a),XD=U+o;if(B.opts._errorDataPathProperty)B.errorPath=B.util.getPath(f,a,B.opts.jsonPointers);if(X+=" if ( "+XD+" === undefined ",y)X+=" || ! Object.prototype.hasOwnProperty.call("+U+", '"+B.util.escapeQuotes(a)+"') ";if(X+=") { var err = ",B.createErrors!==!1){if(X+=" { keyword: 'required' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(q)+" , params: { missingProperty: '"+S+"' } ",B.opts.messages!==!1){if(X+=" , message: '",B.opts._errorDataPathProperty)X+="is a required property";else X+="should have required property \\'"+S+"\\'";X+="' "}if(B.opts.verbose)X+=" , schema: validate.schema"+G+" , parentSchema: validate.schema"+B.schemaPath+" , data: "+U+" ";X+=" } "}else X+=" {} ";X+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}}B.errorPath=f}else if(A)X+=" if (true) {";return X}}),aq=KD((D,F)=>{F.exports=function Q(B,Y,J){var X=" ",C=B.level,W=B.dataLevel,z=B.schema[Y],G=B.schemaPath+B.util.getProperty(Y),q=B.errSchemaPath+"/"+Y,A=!B.opts.allErrors,U="data"+(W||""),Z="valid"+C,H=B.opts.$data&&z&&z.$data,V;if(H)X+=" var schema"+C+" = "+B.util.getData(z.$data,W,B.dataPathArr)+"; ",V="schema"+C;else V=z;if((z||H)&&B.opts.uniqueItems!==!1){if(H)X+=" var "+Z+"; if ("+V+" === false || "+V+" === undefined) "+Z+" = true; else if (typeof "+V+" != 'boolean') "+Z+" = false; else { ";X+=" var i = "+U+".length , "+Z+" = true , j; if (i > 1) { ";var j=B.schema.items&&B.schema.items.type,L=Array.isArray(j);if(!j||j=="object"||j=="array"||L&&(j.indexOf("object")>=0||j.indexOf("array")>=0))X+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+U+"[i], "+U+"[j])) { "+Z+" = false; break outer; } } } ";else{X+=" var itemIndices = {}, item; for (;i--;) { var item = "+U+"[i]; ";var R="checkDataType"+(L?"s":"");if(X+=" if ("+B.util[R](j,"item",B.opts.strictNumbers,!0)+") continue; ",L)X+=` if (typeof item == 'string') item = '"' + item; `;X+=" if (typeof itemIndices[item] == 'number') { "+Z+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}if(X+=" } ",H)X+=" } ";X+=" if (!"+Z+") { ";var k=k||[];if(k.push(X),X="",B.createErrors!==!1){if(X+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(q)+" , params: { i: i, j: j } ",B.opts.messages!==!1)X+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' ";if(B.opts.verbose){if(X+=" , schema: ",H)X+="validate.schema"+G;else X+=""+z;X+=" , parentSchema: validate.schema"+B.schemaPath+" , data: "+U+" "}X+=" } "}else X+=" {} ";var b=X;if(X=k.pop(),!B.compositeRule&&A)if(B.async)X+=" throw new ValidationError(["+b+"]); ";else X+=" validate.errors = ["+b+"]; return false; ";else X+=" var err = "+b+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(X+=" } ",A)X+=" else { "}else if(A)X+=" if (true) { ";return X}}),rq=KD((D,F)=>{F.exports={$ref:Sq(),allOf:kq(),anyOf:bq(),$comment:vq(),const:xq(),contains:uq(),dependencies:yq(),enum:fq(),format:gq(),if:$q(),items:hq(),maximum:sB(),minimum:sB(),maxItems:tB(),minItems:tB(),maxLength:eB(),minLength:eB(),maxProperties:DQ(),minProperties:DQ(),multipleOf:mq(),not:lq(),oneOf:dq(),pattern:cq(),properties:pq(),propertyNames:nq(),required:iq(),uniqueItems:aq(),validate:zQ()}}),oq=KD((D,F)=>{var Q=rq(),B=f2().toHash;F.exports=function Y(){var J=[{type:"number",rules:[{maximum:["exclusiveMaximum"]},{minimum:["exclusiveMinimum"]},"multipleOf","format"]},{type:"string",rules:["maxLength","minLength","pattern","format"]},{type:"array",rules:["maxItems","minItems","items","contains","uniqueItems"]},{type:"object",rules:["maxProperties","minProperties","required","dependencies","propertyNames",{properties:["additionalProperties","patternProperties"]}]},{rules:["$ref","const","enum","not","anyOf","oneOf","allOf","if"]}],X=["type","$comment"],C=["$schema","$id","id","$data","$async","title","description","default","definitions","examples","readOnly","writeOnly","contentMediaType","contentEncoding","additionalItems","then","else"],W=["number","integer","string","array","object","boolean","null"];return J.all=B(X),J.types=B(W),J.forEach(function(z){if(z.rules=z.rules.map(function(G){var q;if(typeof G=="object"){var A=Object.keys(G)[0];q=G[A],G=A,q.forEach(function(Z){X.push(Z),J.all[Z]=!0})}X.push(G);var U=J.all[G]={keyword:G,code:Q[G],implements:q};return U}),J.all.$comment={keyword:"$comment",code:Q.$comment},z.type)J.types[z.type]=z}),J.keywords=B(X.concat(C)),J.custom={},J}}),sq=KD((D,F)=>{var Q=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];F.exports=function(B,Y){for(var J=0;J<Y.length;J++){B=JSON.parse(JSON.stringify(B));var X=Y[J].split("/"),C=B,W;for(W=1;W<X.length;W++)C=C[X[W]];for(W=0;W<Q.length;W++){var z=Q[W],G=C[z];if(G)C[z]={anyOf:[G,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]}}}return B}}),tq=KD((D,F)=>{var Q=H9().MissingRef;F.exports=B;function B(Y,J,X){var C=this;if(typeof this._opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");if(typeof J=="function")X=J,J=void 0;var W=z(Y).then(function(){var q=C._addSchema(Y,void 0,J);return q.validate||G(q)});if(X)W.then(function(q){X(null,q)},X);return W;function z(q){var A=q.$schema;return A&&!C.getSchema(A)?B.call(C,{$ref:A},!0):Promise.resolve()}function G(q){try{return C._compile(q)}catch(U){if(U instanceof Q)return A(U);throw U}function A(U){var Z=U.missingSchema;if(j(Z))throw new Error("Schema "+Z+" is loaded but "+U.missingRef+" cannot be resolved");var H=C._loadingSchemas[Z];if(!H)H=C._loadingSchemas[Z]=C._opts.loadSchema(Z),H.then(V,V);return H.then(function(L){if(!j(Z))return z(L).then(function(){if(!j(Z))C.addSchema(L,Z,void 0,J)})}).then(function(){return G(q)});function V(){delete C._loadingSchemas[Z]}function j(L){return C._refs[L]||C._schemas[L]}}}}}),eq=KD((D,F)=>{F.exports=function Q(B,Y,J){var X=" ",C=B.level,W=B.dataLevel,z=B.schema[Y],G=B.schemaPath+B.util.getProperty(Y),q=B.errSchemaPath+"/"+Y,A=!B.opts.allErrors,U,Z="data"+(W||""),H="valid"+C,V="errs__"+C,j=B.opts.$data&&z&&z.$data,L;if(j)X+=" var schema"+C+" = "+B.util.getData(z.$data,W,B.dataPathArr)+"; ",L="schema"+C;else L=z;var R=this,k="definition"+C,b=R.definition,I="",u,f,O,y,x;if(j&&b.$data){x="keywordValidate"+C;var w=b.validateSchema;X+=" var "+k+" = RULES.custom['"+Y+"'].definition; var "+x+" = "+k+".validate;"}else{if(y=B.useCustomRule(R,z,B.schema,B),!y)return;L="validate.schema"+G,x=y.code,u=b.compile,f=b.inline,O=b.macro}var S=x+".errors",g="i"+C,d="ruleErr"+C,n=b.async;if(n&&!B.async)throw new Error("async keyword in sync schema");if(!(f||O))X+=""+S+" = null;";if(X+="var "+V+" = errors;var "+H+";",j&&b.$data){if(I+="}",X+=" if ("+L+" === undefined) { "+H+" = true; } else { ",w)I+="}",X+=" "+H+" = "+k+".validateSchema("+L+"); if ("+H+") { "}if(f)if(b.statements)X+=" "+y.validate+" ";else X+=" "+H+" = "+y.validate+"; ";else if(O){var a=B.util.copy(B),I="";a.level++;var DD="valid"+a.level;a.schema=y.validate,a.schemaPath="";var o=B.compositeRule;B.compositeRule=a.compositeRule=!0;var XD=B.validate(a).replace(/validate\.schema/g,x);B.compositeRule=a.compositeRule=o,X+=" "+XD}else{var YD=YD||[];if(YD.push(X),X="",X+=" "+x+".call( ",B.opts.passContext)X+="this";else X+="self";if(u||b.schema===!1)X+=" , "+Z+" ";else X+=" , "+L+" , "+Z+" , validate.schema"+B.schemaPath+" ";if(X+=" , (dataPath || '')",B.errorPath!='""')X+=" + "+B.errorPath;var FD=W?"data"+(W-1||""):"parentData",LD=W?B.dataPathArr[W]:"parentDataProperty";X+=" , "+FD+" , "+LD+" , rootData ) ";var hD=X;if(X=YD.pop(),b.errors===!1){if(X+=" "+H+" = ",n)X+="await ";X+=""+hD+"; "}else if(n)S="customErrors"+C,X+=" var "+S+" = null; try { "+H+" = await "+hD+"; } catch (e) { "+H+" = false; if (e instanceof ValidationError) "+S+" = e.errors; else throw e; } ";else X+=" "+S+" = null; "+H+" = "+hD+"; "}if(b.modifying)X+=" if ("+FD+") "+Z+" = "+FD+"["+LD+"];";if(X+=""+I,b.valid){if(A)X+=" if (true) { "}else{if(X+=" if ( ",b.valid===void 0)if(X+=" !",O)X+=""+DD;else X+=""+H;else X+=" "+!b.valid+" ";X+=") { ",U=R.keyword;var YD=YD||[];YD.push(X),X="";var YD=YD||[];if(YD.push(X),X="",B.createErrors!==!1){if(X+=" { keyword: '"+(U||"custom")+"' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(q)+" , params: { keyword: '"+R.keyword+"' } ",B.opts.messages!==!1)X+=` , message: 'should pass "`+R.keyword+`" keyword validation' `;if(B.opts.verbose)X+=" , schema: validate.schema"+G+" , parentSchema: validate.schema"+B.schemaPath+" , data: "+Z+" ";X+=" } "}else X+=" {} ";var cD=X;if(X=YD.pop(),!B.compositeRule&&A)if(B.async)X+=" throw new ValidationError(["+cD+"]); ";else X+=" validate.errors = ["+cD+"]; return false; ";else X+=" var err = "+cD+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var N=X;if(X=YD.pop(),f)if(b.errors){if(b.errors!="full"){if(X+=" for (var "+g+"="+V+"; "+g+"<errors; "+g+"++) { var "+d+" = vErrors["+g+"]; if ("+d+".dataPath === undefined) "+d+".dataPath = (dataPath || '') + "+B.errorPath+"; if ("+d+".schemaPath === undefined) { "+d+'.schemaPath = "'+q+'"; } ',B.opts.verbose)X+=" "+d+".schema = "+L+"; "+d+".data = "+Z+"; ";X+=" } "}}else if(b.errors===!1)X+=" "+N+" ";else{if(X+=" if ("+V+" == errors) { "+N+" } else { for (var "+g+"="+V+"; "+g+"<errors; "+g+"++) { var "+d+" = vErrors["+g+"]; if ("+d+".dataPath === undefined) "+d+".dataPath = (dataPath || '') + "+B.errorPath+"; if ("+d+".schemaPath === undefined) { "+d+'.schemaPath = "'+q+'"; } ',B.opts.verbose)X+=" "+d+".schema = "+L+"; "+d+".data = "+Z+"; ";X+=" } } "}else if(O){if(X+=" var err = ",B.createErrors!==!1){if(X+=" { keyword: '"+(U||"custom")+"' , dataPath: (dataPath || '') + "+B.errorPath+" , schemaPath: "+B.util.toQuotedString(q)+" , params: { keyword: '"+R.keyword+"' } ",B.opts.messages!==!1)X+=` , message: 'should pass "`+R.keyword+`" keyword validation' `;if(B.opts.verbose)X+=" , schema: validate.schema"+G+" , parentSchema: validate.schema"+B.schemaPath+" , data: "+Z+" ";X+=" } "}else X+=" {} ";if(X+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!B.compositeRule&&A)if(B.async)X+=" throw new ValidationError(vErrors); ";else X+=" validate.errors = vErrors; return false; "}else if(b.errors===!1)X+=" "+N+" ";else{if(X+=" if (Array.isArray("+S+")) { if (vErrors === null) vErrors = "+S+"; else vErrors = vErrors.concat("+S+"); errors = vErrors.length; for (var "+g+"="+V+"; "+g+"<errors; "+g+"++) { var "+d+" = vErrors["+g+"]; if ("+d+".dataPath === undefined) "+d+".dataPath = (dataPath || '') + "+B.errorPath+"; "+d+'.schemaPath = "'+q+'"; ',B.opts.verbose)X+=" "+d+".schema = "+L+"; "+d+".data = "+Z+"; ";X+=" } } else { "+N+" } "}if(X+=" } ",A)X+=" else { "}return X}}),GQ=KD((D,F)=>{F.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}}),DH=KD((D,F)=>{var Q=GQ();F.exports={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:Q.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:Q.properties.type,schema:{type:"boolean"},statements:{type:"boolean"},dependencies:{type:"array",items:{type:"string"}},metaSchema:{type:"object"},modifying:{type:"boolean"},valid:{type:"boolean"},$data:{type:"boolean"},async:{type:"boolean"},errors:{anyOf:[{type:"boolean"},{const:"full"}]}}}}),FH=KD((D,F)=>{var Q=/^[a-z_$][a-z0-9_$-]*$/i,B=eq(),Y=DH();F.exports={add:J,get:X,remove:C,validate:W};function J(z,G){var q=this.RULES;if(q.keywords[z])throw new Error("Keyword "+z+" is already defined");if(!Q.test(z))throw new Error("Keyword "+z+" is not a valid identifier");if(G){this.validateKeyword(G,!0);var A=G.type;if(Array.isArray(A))for(var U=0;U<A.length;U++)H(z,A[U],G);else H(z,A,G);var Z=G.metaSchema;if(Z){if(G.$data&&this._opts.$data)Z={anyOf:[Z,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]};G.validateSchema=this.compile(Z,!0)}}q.keywords[z]=q.all[z]=!0;function H(V,j,L){var R;for(var k=0;k<q.length;k++){var b=q[k];if(b.type==j){R=b;break}}if(!R)R={type:j,rules:[]},q.push(R);var I={keyword:V,definition:L,custom:!0,code:B,implements:L.implements};R.rules.push(I),q.custom[V]=I}return this}function X(z){var G=this.RULES.custom[z];return G?G.definition:this.RULES.keywords[z]||!1}function C(z){var G=this.RULES;delete G.keywords[z],delete G.all[z],delete G.custom[z];for(var q=0;q<G.length;q++){var A=G[q].rules;for(var U=0;U<A.length;U++)if(A[U].keyword==z){A.splice(U,1);break}}return this}function W(z,G){W.errors=null;var q=this._validateKeyword=this._validateKeyword||this.compile(Y,!0);if(q(z))return!0;if(W.errors=q.errors,G)throw new Error("custom keyword definition is invalid: "+this.errorsText(q.errors));else return!1}}),BH=KD((D,F)=>{F.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON Schema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}}),QH=KD((D,F)=>{var Q=wq(),B=q9(),Y=Tq(),J=CQ(),X=WQ(),C=Pq(),W=oq(),z=sq(),G=f2();F.exports=V,V.prototype.validate=j,V.prototype.compile=L,V.prototype.addSchema=R,V.prototype.addMetaSchema=k,V.prototype.validateSchema=b,V.prototype.getSchema=u,V.prototype.removeSchema=y,V.prototype.addFormat=o,V.prototype.errorsText=DD,V.prototype._addSchema=w,V.prototype._compile=S,V.prototype.compileAsync=tq();var q=FH();V.prototype.addKeyword=q.add,V.prototype.getKeyword=q.get,V.prototype.removeKeyword=q.remove,V.prototype.validateKeyword=q.validate;var A=H9();V.ValidationError=A.Validation,V.MissingRefError=A.MissingRef,V.$dataMetaSchema=z;var U="http://json-schema.org/draft-07/schema",Z=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],H=["/properties"];function V(K){if(!(this instanceof V))return new V(K);if(K=this._opts=G.copy(K)||{},N(this),this._schemas={},this._refs={},this._fragments={},this._formats=C(K.format),this._cache=K.cache||new Y,this._loadingSchemas={},this._compilations=[],this.RULES=W(),this._getId=g(K),K.loopRequired=K.loopRequired||1/0,K.errorDataPath=="property")K._errorDataPathProperty=!0;if(K.serialize===void 0)K.serialize=X;if(this._metaOpts=cD(this),K.formats)FD(this);if(K.keywords)LD(this);if(XD(this),typeof K.meta=="object")this.addMetaSchema(K.meta);if(K.nullable)this.addKeyword("nullable",{metaSchema:{type:"boolean"}});YD(this)}function j(K,T){var h;if(typeof K=="string"){if(h=this.getSchema(K),!h)throw new Error('no schema with key or ref "'+K+'"')}else{var c=this._addSchema(K);h=c.validate||this._compile(c)}var l=h(T);if(h.$async!==!0)this.errors=h.errors;return l}function L(K,T){var h=this._addSchema(K,void 0,T);return h.validate||this._compile(h)}function R(K,T,h,c){if(Array.isArray(K)){for(var l=0;l<K.length;l++)this.addSchema(K[l],void 0,h,c);return this}var p=this._getId(K);if(p!==void 0&&typeof p!="string")throw new Error("schema id must be string");return T=B.normalizeId(T||p),hD(this,T),this._schemas[T]=this._addSchema(K,h,c,!0),this}function k(K,T,h){return this.addSchema(K,T,h,!0),this}function b(K,T){var h=K.$schema;if(h!==void 0&&typeof h!="string")throw new Error("$schema must be a string");if(h=h||this._opts.defaultMeta||I(this),!h)return this.logger.warn("meta-schema not available"),this.errors=null,!0;var c=this.validate(h,K);if(!c&&T){var l="schema is invalid: "+this.errorsText();if(this._opts.validateSchema=="log")this.logger.error(l);else throw new Error(l)}return c}function I(K){var T=K._opts.meta;return K._opts.defaultMeta=typeof T=="object"?K._getId(T)||T:K.getSchema(U)?U:void 0,K._opts.defaultMeta}function u(K){var T=O(this,K);switch(typeof T){case"object":return T.validate||this._compile(T);case"string":return this.getSchema(T);case"undefined":return f(this,K)}}function f(K,T){var h=B.schema.call(K,{schema:{}},T);if(h){var{schema:c,root:l,baseId:p}=h,BD=Q.call(K,c,l,void 0,p);return K._fragments[T]=new J({ref:T,fragment:!0,schema:c,root:l,baseId:p,validate:BD}),BD}}function O(K,T){return T=B.normalizeId(T),K._schemas[T]||K._refs[T]||K._fragments[T]}function y(K){if(K instanceof RegExp)return x(this,this._schemas,K),x(this,this._refs,K),this;switch(typeof K){case"undefined":return x(this,this._schemas),x(this,this._refs),this._cache.clear(),this;case"string":var T=O(this,K);if(T)this._cache.del(T.cacheKey);return delete this._schemas[K],delete this._refs[K],this;case"object":var h=this._opts.serialize,c=h?h(K):K;this._cache.del(c);var l=this._getId(K);if(l)l=B.normalizeId(l),delete this._schemas[l],delete this._refs[l]}return this}function x(K,T,h){for(var c in T){var l=T[c];if(!l.meta&&(!h||h.test(c)))K._cache.del(l.cacheKey),delete T[c]}}function w(K,T,h,c){if(typeof K!="object"&&typeof K!="boolean")throw new Error("schema should be object or boolean");var l=this._opts.serialize,p=l?l(K):K,BD=this._cache.get(p);if(BD)return BD;c=c||this._opts.addUsedSchema!==!1;var qD=B.normalizeId(this._getId(K));if(qD&&c)hD(this,qD);var JD=this._opts.validateSchema!==!1&&!T,ZD;if(JD&&!(ZD=qD&&qD==B.normalizeId(K.$schema)))this.validateSchema(K,!0);var PD=B.ids.call(this,K),RD=new J({id:qD,schema:K,localRefs:PD,cacheKey:p,meta:h});if(qD[0]!="#"&&c)this._refs[qD]=RD;if(this._cache.put(p,RD),JD&&ZD)this.validateSchema(K,!0);return RD}function S(K,T){if(K.compiling){if(K.validate=l,l.schema=K.schema,l.errors=null,l.root=T?T:l,K.schema.$async===!0)l.$async=!0;return l}K.compiling=!0;var h;if(K.meta)h=this._opts,this._opts=this._metaOpts;var c;try{c=Q.call(this,K.schema,T,K.localRefs)}catch(p){throw delete K.validate,p}finally{if(K.compiling=!1,K.meta)this._opts=h}return K.validate=c,K.refs=c.refs,K.refVal=c.refVal,K.root=c.root,c;function l(){var p=K.validate,BD=p.apply(this,arguments);return l.errors=p.errors,BD}}function g(K){switch(K.schemaId){case"auto":return a;case"id":return d;default:return n}}function d(K){if(K.$id)this.logger.warn("schema $id ignored",K.$id);return K.id}function n(K){if(K.id)this.logger.warn("schema id ignored",K.id);return K.$id}function a(K){if(K.$id&&K.id&&K.$id!=K.id)throw new Error("schema $id is different from id");return K.$id||K.id}function DD(K,T){if(K=K||this.errors,!K)return"No errors";T=T||{};var h=T.separator===void 0?", ":T.separator,c=T.dataVar===void 0?"data":T.dataVar,l="";for(var p=0;p<K.length;p++){var BD=K[p];if(BD)l+=c+BD.dataPath+" "+BD.message+h}return l.slice(0,-h.length)}function o(K,T){if(typeof T=="string")T=new RegExp(T);return this._formats[K]=T,this}function XD(K){var T;if(K._opts.$data)T=BH(),K.addMetaSchema(T,T.$id,!0);if(K._opts.meta===!1)return;var h=GQ();if(K._opts.$data)h=z(h,H);K.addMetaSchema(h,U,!0),K._refs["http://json-schema.org/schema"]=U}function YD(K){var T=K._opts.schemas;if(!T)return;if(Array.isArray(T))K.addSchema(T);else for(var h in T)K.addSchema(T[h],h)}function FD(K){for(var T in K._opts.formats){var h=K._opts.formats[T];K.addFormat(T,h)}}function LD(K){for(var T in K._opts.keywords){var h=K._opts.keywords[T];K.addKeyword(T,h)}}function hD(K,T){if(K._schemas[T]||K._refs[T])throw new Error('schema with key or id "'+T+'" already exists')}function cD(K){var T=G.copy(K._opts);for(var h=0;h<Z.length;h++)delete T[Z[h]];return T}function N(K){var T=K._opts.logger;if(T===!1)K.logger={log:_,warn:_,error:_};else{if(T===void 0)T=console;if(!(typeof T=="object"&&T.log&&T.warn&&T.error))throw new Error("logger must implement log, warn and error methods");K.logger=T}}function _(){}}),JH=50;function qQ(D=JH){let F=new AbortController;return YH(D,F.signal),F}var GH={accessSync(D,F){WD.accessSync(D,F)},cwd(){return process.cwd()},chmodSync(D,F){WD.chmodSync(D,F)},existsSync(D){return WD.existsSync(D)},async stat(D){return zH(D)},statSync(D){return WD.statSync(D)},readFileSync(D,F){return WD.readFileSync(D,{encoding:F.encoding})},readFileBytesSync(D){return WD.readFileSync(D)},readSync(D,F){let Q=void 0;try{Q=WD.openSync(D,"r");let B=Buffer.alloc(F.length),Y=WD.readSync(Q,B,0,F.length,0);return{buffer:B,bytesRead:Y}}finally{if(Q)WD.closeSync(Q)}},writeFileSync(D,F,Q){if(!Q.flush){let Y={encoding:Q.encoding};if(Q.mode!==void 0)Y.mode=Q.mode;WD.writeFileSync(D,F,Y);return}let B;try{let Y=Q.mode!==void 0?Q.mode:void 0;B=WD.openSync(D,"w",Y),WD.writeFileSync(B,F,{encoding:Q.encoding}),WD.fsyncSync(B)}finally{if(B)WD.closeSync(B)}},appendFileSync(D,F){WD.appendFileSync(D,F)},copyFileSync(D,F){WD.copyFileSync(D,F)},unlinkSync(D){WD.unlinkSync(D)},renameSync(D,F){WD.renameSync(D,F)},linkSync(D,F){WD.linkSync(D,F)},symlinkSync(D,F){WD.symlinkSync(D,F)},readlinkSync(D){return WD.readlinkSync(D)},realpathSync(D){return WD.realpathSync(D)},mkdirSync(D){if(!WD.existsSync(D))WD.mkdirSync(D,{recursive:!0,mode:448})},readdirSync(D){return WD.readdirSync(D,{withFileTypes:!0})},readdirStringSync(D){return WD.readdirSync(D)},isDirEmptySync(D){return this.readdirSync(D).length===0},rmdirSync(D){WD.rmdirSync(D)},rmSync(D,F){WD.rmSync(D,F)},createWriteStream(D){return WD.createWriteStream(D)}},qH=GH;function HH(){return qH}class j2 extends Error{}function HQ(){return process.versions.bun!==void 0}class KQ{options;child;childStdin;childStdout;ready=!1;abortController;exitError;exitListeners=[];processExitHandler;abortHandler;constructor(D){this.options=D,this.abortController=D.abortController||qQ(),this.initialize()}initialize(){try{let{additionalDirectories:D=[],agents:F,cwd:Q,executable:B=HQ()?"bun":"node",executableArgs:Y=[],extraArgs:J={},pathToClaudeCodeExecutable:X,env:C={...process.env},stderr:W,customSystemPrompt:z,appendSystemPrompt:G,maxTurns:q,model:A,fallbackModel:U,permissionMode:Z,permissionPromptToolName:H,continueConversation:V,resume:j,settingSources:L,allowedTools:R=[],disallowedTools:k=[],mcpServers:b,strictMcpConfig:I,canUseTool:u,includePartialMessages:f}=this.options,O=["--output-format","stream-json","--verbose","--input-format","stream-json"];if(typeof z==="string")O.push("--system-prompt",z);if(G)O.push("--append-system-prompt",G);if(q)O.push("--max-turns",q.toString());if(A)O.push("--model",A);if(C.DEBUG)O.push("--debug-to-stderr");if(u){if(H)throw new Error("canUseTool callback cannot be used with permissionPromptToolName. Please use one or the other.");O.push("--permission-prompt-tool","stdio")}else if(H)O.push("--permission-prompt-tool",H);if(V)O.push("--continue");if(j)O.push("--resume",j);if(R.length>0)O.push("--allowedTools",R.join(","));if(k.length>0)O.push("--disallowedTools",k.join(","));if(b&&Object.keys(b).length>0)O.push("--mcp-config",JSON.stringify({mcpServers:b}));if(F&&Object.keys(F).length>0)O.push("--agents",JSON.stringify(F));if(L)O.push("--setting-sources",L.join(","));if(I)O.push("--strict-mcp-config");if(Z)O.push("--permission-mode",Z);if(U){if(A&&U===A)throw new Error("Fallback model cannot be the same as the main model. Please specify a different model for fallbackModel option.");O.push("--fallback-model",U)}if(f)O.push("--include-partial-messages");for(let n of D)O.push("--add-dir",n);if(this.options.forkSession)O.push("--fork-session");if(this.options.resumeSessionAt)O.push("--resume-session-at",this.options.resumeSessionAt);for(let[n,a]of Object.entries(J))if(a===null)O.push(`--${n}`);else O.push(`--${n}`,a);if(!C.CLAUDE_CODE_ENTRYPOINT)C.CLAUDE_CODE_ENTRYPOINT="sdk-ts";if(!HH().existsSync(X)){let n=BQ(X)?`Claude Code native binary not found at ${X}. Please ensure Claude Code is installed via native installer or specify a valid path with options.pathToClaudeCodeExecutable.`:`Claude Code executable not found at ${X}. Is options.pathToClaudeCodeExecutable set?`;throw new ReferenceError(n)}let x=BQ(X),w=x?X:B,S=x?O:[...Y,X,...O];this.logForDebugging(x?`Spawning Claude Code native binary: ${X} ${O.join(" ")}`:`Spawning Claude Code process: ${B} ${[...Y,X,...O].join(" ")}`);let g=C.DEBUG||W?"pipe":"ignore";if(this.child=CH(w,S,{cwd:Q,stdio:["pipe","pipe",g],signal:this.abortController.signal,env:C}),this.childStdin=this.child.stdin,this.childStdout=this.child.stdout,C.DEBUG||W)this.child.stderr.on("data",(n)=>{if(this.logForDebugging(`Claude Code stderr: ${n.toString()}`),W)W(n.toString())});let d=()=>{if(this.child&&!this.child.killed)this.child.kill("SIGTERM")};this.processExitHandler=d,this.abortHandler=d,process.on("exit",this.processExitHandler),this.abortController.signal.addEventListener("abort",this.abortHandler),this.child.on("error",(n)=>{if(this.ready=!1,this.abortController.signal.aborted)this.exitError=new j2("Claude Code process aborted by user");else this.exitError=new Error(`Failed to spawn Claude Code process: ${n.message}`),this.logForDebugging(this.exitError.message)}),this.child.on("close",(n,a)=>{if(this.ready=!1,this.abortController.signal.aborted)this.exitError=new j2("Claude Code process aborted by user");else{let DD=this.getProcessExitError(n,a);if(DD)this.exitError=DD,this.logForDebugging(DD.message)}}),this.ready=!0}catch(D){throw this.ready=!1,D}}getProcessExitError(D,F){if(D!==0&&D!==null)return new Error(`Claude Code process exited with code ${D}`);else if(F)return new Error(`Claude Code process terminated by signal ${F}`);return}logForDebugging(D){if(process.env.DEBUG)process.stderr.write(`${D}
473
473
  `);if(this.options.stderr)this.options.stderr(D)}write(D){if(this.abortController.signal.aborted)throw new j2("Operation aborted");if(!this.ready||!this.childStdin)throw new Error("ProcessTransport is not ready for writing");if(this.child?.killed||this.child?.exitCode!==null)throw new Error("Cannot write to terminated process");if(this.exitError)throw new Error(`Cannot write to process that exited with error: ${this.exitError.message}`);if(process.env.DEBUG_SDK)process.stderr.write(`[ProcessTransport] Writing to stdin: ${D.substring(0,100)}
474
- `);try{if(!this.childStdin.write(D)&&process.env.DEBUG_SDK)console.warn("[ProcessTransport] Write buffer full, data queued")}catch(F){throw this.ready=!1,new Error(`Failed to write to process stdin: ${F.message}`)}}close(){if(this.childStdin)this.childStdin.end(),this.childStdin=void 0;if(this.processExitHandler)process.off("exit",this.processExitHandler),this.processExitHandler=void 0;if(this.abortHandler)this.abortController.signal.removeEventListener("abort",this.abortHandler),this.abortHandler=void 0;for(let{handler:D}of this.exitListeners)this.child?.off("exit",D);if(this.exitListeners=[],this.child&&!this.child.killed)this.child.kill("SIGTERM"),setTimeout(()=>{if(this.child&&!this.child.killed)this.child.kill("SIGKILL")},5000);this.ready=!1}isReady(){return this.ready}async*readMessages(){if(!this.childStdout)throw new Error("ProcessTransport output stream not available");let D=WH({input:this.childStdout});try{for await(let F of D)if(F.trim())yield JSON.parse(F);await this.waitForExit()}catch(F){throw F}finally{D.close()}}endInput(){if(this.childStdin)this.childStdin.end()}getInputStream(){return this.childStdin}onExit(D){if(!this.child)return()=>{};let F=(Q,B)=>{let Y=this.getProcessExitError(Q,B);D(Y)};return this.child.on("exit",F),this.exitListeners.push({callback:D,handler:F}),()=>{if(this.child)this.child.off("exit",F);let Q=this.exitListeners.findIndex((B)=>B.handler===F);if(Q!==-1)this.exitListeners.splice(Q,1)}}async waitForExit(){if(!this.child){if(this.exitError)throw this.exitError;return}if(this.child.exitCode!==null||this.child.killed){if(this.exitError)throw this.exitError;return}return new Promise((D,F)=>{let Q=(Y,J)=>{if(this.abortController.signal.aborted){F(new j2("Operation aborted"));return}let X=this.getProcessExitError(Y,J);if(X)F(X);else D()};this.child.once("exit",Q);let B=(Y)=>{this.child.off("exit",Q),F(Y)};this.child.once("error",B),this.child.once("exit",()=>{this.child.off("error",B)})})}}function BQ(D){return![".js",".mjs",".tsx",".ts",".jsx"].some((Q)=>D.endsWith(Q))}class UQ{returned;queue=[];readResolve;readReject;isDone=!1;hasError;started=!1;constructor(D){this.returned=D}[Symbol.asyncIterator](){if(this.started)throw new Error("Stream can only be iterated once");return this.started=!0,this}next(){if(this.queue.length>0)return Promise.resolve({done:!1,value:this.queue.shift()});if(this.isDone)return Promise.resolve({done:!0,value:void 0});if(this.hasError)return Promise.reject(this.hasError);return new Promise((D,F)=>{this.readResolve=D,this.readReject=F})}enqueue(D){if(this.readResolve){let F=this.readResolve;this.readResolve=void 0,this.readReject=void 0,F({done:!1,value:D})}else this.queue.push(D)}done(){if(this.isDone=!0,this.readResolve){let D=this.readResolve;this.readResolve=void 0,this.readReject=void 0,D({done:!0,value:void 0})}}error(D){if(this.hasError=D,this.readReject){let F=this.readReject;this.readResolve=void 0,this.readReject=void 0,F(D)}}return(){if(this.isDone=!0,this.returned)this.returned();return Promise.resolve({done:!0,value:void 0})}}class EQ{sendMcpMessage;isClosed=!1;constructor(D){this.sendMcpMessage=D}onclose;onerror;onmessage;async start(){}async send(D){if(this.isClosed)throw new Error("Transport is closed");this.sendMcpMessage(D)}async close(){if(this.isClosed)return;this.isClosed=!0,this.onclose?.()}}class AQ{transport;isSingleUserTurn;canUseTool;hooks;abortController;pendingControlResponses=new Map;cleanupPerformed=!1;sdkMessages;inputStream=new UQ;initialization;cancelControllers=new Map;hookCallbacks=new Map;nextCallbackId=0;sdkMcpTransports=new Map;pendingMcpResponses=new Map;firstResultReceivedPromise;firstResultReceivedResolve;constructor(D,F,Q,B,Y,J=new Map){this.transport=D,this.isSingleUserTurn=F,this.canUseTool=Q,this.hooks=B,this.abortController=Y;for(let[X,C]of J){let z=new EQ((W)=>this.sendMcpServerMessageToCli(X,W));this.sdkMcpTransports.set(X,z),C.connect(z)}this.sdkMessages=this.readSdkMessages(),this.firstResultReceivedPromise=new Promise((X)=>{this.firstResultReceivedResolve=X}),this.readMessages(),this.initialization=this.initialize(),this.initialization.catch(()=>{})}setError(D){this.inputStream.error(D)}cleanup(D){if(this.cleanupPerformed)return;this.cleanupPerformed=!0;try{if(this.transport.close(),this.pendingControlResponses.clear(),this.pendingMcpResponses.clear(),D)this.inputStream.error(D);else this.inputStream.done()}catch(F){}}next(...[D]){return this.sdkMessages.next(...[D])}return(D){return this.sdkMessages.return(D)}throw(D){return this.sdkMessages.throw(D)}[Symbol.asyncIterator](){return this.sdkMessages}[Symbol.asyncDispose](){return this.sdkMessages[Symbol.asyncDispose]()}async readMessages(){try{for await(let D of this.transport.readMessages()){if(D.type==="control_response"){let F=this.pendingControlResponses.get(D.response.request_id);if(F)F(D.response);continue}else if(D.type==="control_request"){this.handleControlRequest(D);continue}else if(D.type==="control_cancel_request"){this.handleControlCancelRequest(D);continue}else if(D.type==="keep_alive")continue;if(D.type==="result"){if(this.firstResultReceivedResolve)this.firstResultReceivedResolve();if(this.isSingleUserTurn)this.transport.endInput()}this.inputStream.enqueue(D)}this.inputStream.done(),this.cleanup()}catch(D){this.inputStream.error(D),this.cleanup(D)}}async handleControlRequest(D){let F=new AbortController;this.cancelControllers.set(D.request_id,F);try{let Q=await this.processControlRequest(D,F.signal),B={type:"control_response",response:{subtype:"success",request_id:D.request_id,response:Q}};await Promise.resolve(this.transport.write(JSON.stringify(B)+`
474
+ `);try{if(!this.childStdin.write(D)&&process.env.DEBUG_SDK)console.warn("[ProcessTransport] Write buffer full, data queued")}catch(F){throw this.ready=!1,new Error(`Failed to write to process stdin: ${F.message}`)}}close(){if(this.childStdin)this.childStdin.end(),this.childStdin=void 0;if(this.processExitHandler)process.off("exit",this.processExitHandler),this.processExitHandler=void 0;if(this.abortHandler)this.abortController.signal.removeEventListener("abort",this.abortHandler),this.abortHandler=void 0;for(let{handler:D}of this.exitListeners)this.child?.off("exit",D);if(this.exitListeners=[],this.child&&!this.child.killed)this.child.kill("SIGTERM"),setTimeout(()=>{if(this.child&&!this.child.killed)this.child.kill("SIGKILL")},5000);this.ready=!1}isReady(){return this.ready}async*readMessages(){if(!this.childStdout)throw new Error("ProcessTransport output stream not available");let D=WH({input:this.childStdout});try{for await(let F of D)if(F.trim())yield JSON.parse(F);await this.waitForExit()}catch(F){throw F}finally{D.close()}}endInput(){if(this.childStdin)this.childStdin.end()}getInputStream(){return this.childStdin}onExit(D){if(!this.child)return()=>{};let F=(Q,B)=>{let Y=this.getProcessExitError(Q,B);D(Y)};return this.child.on("exit",F),this.exitListeners.push({callback:D,handler:F}),()=>{if(this.child)this.child.off("exit",F);let Q=this.exitListeners.findIndex((B)=>B.handler===F);if(Q!==-1)this.exitListeners.splice(Q,1)}}async waitForExit(){if(!this.child){if(this.exitError)throw this.exitError;return}if(this.child.exitCode!==null||this.child.killed){if(this.exitError)throw this.exitError;return}return new Promise((D,F)=>{let Q=(Y,J)=>{if(this.abortController.signal.aborted){F(new j2("Operation aborted"));return}let X=this.getProcessExitError(Y,J);if(X)F(X);else D()};this.child.once("exit",Q);let B=(Y)=>{this.child.off("exit",Q),F(Y)};this.child.once("error",B),this.child.once("exit",()=>{this.child.off("error",B)})})}}function BQ(D){return![".js",".mjs",".tsx",".ts",".jsx"].some((Q)=>D.endsWith(Q))}class UQ{returned;queue=[];readResolve;readReject;isDone=!1;hasError;started=!1;constructor(D){this.returned=D}[Symbol.asyncIterator](){if(this.started)throw new Error("Stream can only be iterated once");return this.started=!0,this}next(){if(this.queue.length>0)return Promise.resolve({done:!1,value:this.queue.shift()});if(this.isDone)return Promise.resolve({done:!0,value:void 0});if(this.hasError)return Promise.reject(this.hasError);return new Promise((D,F)=>{this.readResolve=D,this.readReject=F})}enqueue(D){if(this.readResolve){let F=this.readResolve;this.readResolve=void 0,this.readReject=void 0,F({done:!1,value:D})}else this.queue.push(D)}done(){if(this.isDone=!0,this.readResolve){let D=this.readResolve;this.readResolve=void 0,this.readReject=void 0,D({done:!0,value:void 0})}}error(D){if(this.hasError=D,this.readReject){let F=this.readReject;this.readResolve=void 0,this.readReject=void 0,F(D)}}return(){if(this.isDone=!0,this.returned)this.returned();return Promise.resolve({done:!0,value:void 0})}}class EQ{sendMcpMessage;isClosed=!1;constructor(D){this.sendMcpMessage=D}onclose;onerror;onmessage;async start(){}async send(D){if(this.isClosed)throw new Error("Transport is closed");this.sendMcpMessage(D)}async close(){if(this.isClosed)return;this.isClosed=!0,this.onclose?.()}}class AQ{transport;isSingleUserTurn;canUseTool;hooks;abortController;pendingControlResponses=new Map;cleanupPerformed=!1;sdkMessages;inputStream=new UQ;initialization;cancelControllers=new Map;hookCallbacks=new Map;nextCallbackId=0;sdkMcpTransports=new Map;pendingMcpResponses=new Map;firstResultReceivedPromise;firstResultReceivedResolve;constructor(D,F,Q,B,Y,J=new Map){this.transport=D,this.isSingleUserTurn=F,this.canUseTool=Q,this.hooks=B,this.abortController=Y;for(let[X,C]of J){let W=new EQ((z)=>this.sendMcpServerMessageToCli(X,z));this.sdkMcpTransports.set(X,W),C.connect(W)}this.sdkMessages=this.readSdkMessages(),this.firstResultReceivedPromise=new Promise((X)=>{this.firstResultReceivedResolve=X}),this.readMessages(),this.initialization=this.initialize(),this.initialization.catch(()=>{})}setError(D){this.inputStream.error(D)}cleanup(D){if(this.cleanupPerformed)return;this.cleanupPerformed=!0;try{if(this.transport.close(),this.pendingControlResponses.clear(),this.pendingMcpResponses.clear(),D)this.inputStream.error(D);else this.inputStream.done()}catch(F){}}next(...[D]){return this.sdkMessages.next(...[D])}return(D){return this.sdkMessages.return(D)}throw(D){return this.sdkMessages.throw(D)}[Symbol.asyncIterator](){return this.sdkMessages}[Symbol.asyncDispose](){return this.sdkMessages[Symbol.asyncDispose]()}async readMessages(){try{for await(let D of this.transport.readMessages()){if(D.type==="control_response"){let F=this.pendingControlResponses.get(D.response.request_id);if(F)F(D.response);continue}else if(D.type==="control_request"){this.handleControlRequest(D);continue}else if(D.type==="control_cancel_request"){this.handleControlCancelRequest(D);continue}else if(D.type==="keep_alive")continue;if(D.type==="result"){if(this.firstResultReceivedResolve)this.firstResultReceivedResolve();if(this.isSingleUserTurn)this.transport.endInput()}this.inputStream.enqueue(D)}this.inputStream.done(),this.cleanup()}catch(D){this.inputStream.error(D),this.cleanup(D)}}async handleControlRequest(D){let F=new AbortController;this.cancelControllers.set(D.request_id,F);try{let Q=await this.processControlRequest(D,F.signal),B={type:"control_response",response:{subtype:"success",request_id:D.request_id,response:Q}};await Promise.resolve(this.transport.write(JSON.stringify(B)+`
475
475
  `))}catch(Q){let B={type:"control_response",response:{subtype:"error",request_id:D.request_id,error:Q.message||String(Q)}};await Promise.resolve(this.transport.write(JSON.stringify(B)+`
476
- `))}finally{this.cancelControllers.delete(D.request_id)}}handleControlCancelRequest(D){let F=this.cancelControllers.get(D.request_id);if(F)F.abort(),this.cancelControllers.delete(D.request_id)}async processControlRequest(D,F){if(D.request.subtype==="can_use_tool"){if(!this.canUseTool)throw new Error("canUseTool callback is not provided.");return this.canUseTool(D.request.tool_name,D.request.input,{signal:F,suggestions:D.request.permission_suggestions})}else if(D.request.subtype==="hook_callback")return await this.handleHookCallbacks(D.request.callback_id,D.request.input,D.request.tool_use_id,F);else if(D.request.subtype==="mcp_message"){let Q=D.request,B=this.sdkMcpTransports.get(Q.server_name);if(!B)throw new Error(`SDK MCP server not found: ${Q.server_name}`);if("method"in Q.message&&"id"in Q.message&&Q.message.id!==null)return{mcp_response:await this.handleMcpControlRequest(Q.server_name,Q,B)};else{if(B.onmessage)B.onmessage(Q.message);return{mcp_response:{jsonrpc:"2.0",result:{},id:0}}}}throw new Error("Unsupported control request subtype: "+D.request.subtype)}async*readSdkMessages(){for await(let D of this.inputStream)yield D}async initialize(){let D;if(this.hooks){D={};for(let[Y,J]of Object.entries(this.hooks))if(J.length>0)D[Y]=J.map((X)=>{let C=[];for(let z of X.hooks){let W=`hook_${this.nextCallbackId++}`;this.hookCallbacks.set(W,z),C.push(W)}return{matcher:X.matcher,hookCallbackIds:C}})}let F=this.sdkMcpTransports.size>0?Array.from(this.sdkMcpTransports.keys()):void 0,Q={subtype:"initialize",hooks:D,sdkMcpServers:F};return(await this.request(Q)).response}async interrupt(){await this.request({subtype:"interrupt"})}async setPermissionMode(D){await this.request({subtype:"set_permission_mode",mode:D})}async setModel(D){await this.request({subtype:"set_model",model:D})}request(D){let F=Math.random().toString(36).substring(2,15),Q={request_id:F,type:"control_request",request:D};return new Promise((B,Y)=>{this.pendingControlResponses.set(F,(J)=>{if(J.subtype==="success")B(J);else Y(new Error(J.error))}),Promise.resolve(this.transport.write(JSON.stringify(Q)+`
476
+ `))}finally{this.cancelControllers.delete(D.request_id)}}handleControlCancelRequest(D){let F=this.cancelControllers.get(D.request_id);if(F)F.abort(),this.cancelControllers.delete(D.request_id)}async processControlRequest(D,F){if(D.request.subtype==="can_use_tool"){if(!this.canUseTool)throw new Error("canUseTool callback is not provided.");return this.canUseTool(D.request.tool_name,D.request.input,{signal:F,suggestions:D.request.permission_suggestions})}else if(D.request.subtype==="hook_callback")return await this.handleHookCallbacks(D.request.callback_id,D.request.input,D.request.tool_use_id,F);else if(D.request.subtype==="mcp_message"){let Q=D.request,B=this.sdkMcpTransports.get(Q.server_name);if(!B)throw new Error(`SDK MCP server not found: ${Q.server_name}`);if("method"in Q.message&&"id"in Q.message&&Q.message.id!==null)return{mcp_response:await this.handleMcpControlRequest(Q.server_name,Q,B)};else{if(B.onmessage)B.onmessage(Q.message);return{mcp_response:{jsonrpc:"2.0",result:{},id:0}}}}throw new Error("Unsupported control request subtype: "+D.request.subtype)}async*readSdkMessages(){for await(let D of this.inputStream)yield D}async initialize(){let D;if(this.hooks){D={};for(let[Y,J]of Object.entries(this.hooks))if(J.length>0)D[Y]=J.map((X)=>{let C=[];for(let W of X.hooks){let z=`hook_${this.nextCallbackId++}`;this.hookCallbacks.set(z,W),C.push(z)}return{matcher:X.matcher,hookCallbackIds:C}})}let F=this.sdkMcpTransports.size>0?Array.from(this.sdkMcpTransports.keys()):void 0,Q={subtype:"initialize",hooks:D,sdkMcpServers:F};return(await this.request(Q)).response}async interrupt(){await this.request({subtype:"interrupt"})}async setPermissionMode(D){await this.request({subtype:"set_permission_mode",mode:D})}async setModel(D){await this.request({subtype:"set_model",model:D})}request(D){let F=Math.random().toString(36).substring(2,15),Q={request_id:F,type:"control_request",request:D};return new Promise((B,Y)=>{this.pendingControlResponses.set(F,(J)=>{if(J.subtype==="success")B(J);else Y(new Error(J.error))}),Promise.resolve(this.transport.write(JSON.stringify(Q)+`
477
477
  `))})}async supportedCommands(){return(await this.initialization).commands}async supportedModels(){return(await this.initialization).models}async mcpServerStatus(){return(await this.request({subtype:"mcp_status"})).response.mcpServers}async streamInput(D){try{for await(let F of D){if(this.abortController?.signal.aborted)break;await Promise.resolve(this.transport.write(JSON.stringify(F)+`
478
- `))}if(this.sdkMcpTransports.size>0&&this.firstResultReceivedPromise){let Q;if(await Promise.race([this.firstResultReceivedPromise.then(()=>{if(Q)clearTimeout(Q)}),new Promise((B)=>{Q=setTimeout(()=>{B()},1e4)})]),Q)clearTimeout(Q)}this.transport.endInput()}catch(F){if(!(F instanceof j2))throw F}}handleHookCallbacks(D,F,Q,B){let Y=this.hookCallbacks.get(D);if(!Y)throw new Error(`No hook callback found for ID: ${D}`);return Y(F,Q,{signal:B})}sendMcpServerMessageToCli(D,F){if("id"in F&&F.id!==null&&F.id!==void 0){let Q=`${D}:${F.id}`,B=this.pendingMcpResponses.get(Q);if(B){B.resolve(F),this.pendingMcpResponses.delete(Q);return}}throw new Error("No pending request found")}handleMcpControlRequest(D,F,Q){let B="id"in F.message?F.message.id:null,Y=`${D}:${B}`;return new Promise((J,X)=>{let C=null,z=()=>{if(C)clearTimeout(C);this.pendingMcpResponses.delete(Y)},W=(q)=>{z(),J(q)},G=(q)=>{z(),X(q)};if(this.pendingMcpResponses.set(Y,{resolve:W,reject:G}),Q.onmessage)Q.onmessage(F.message);else{z(),X(new Error("No message handler registered"));return}C=setTimeout(()=>{if(this.pendingMcpResponses.has(Y))z(),X(new Error("Request timeout"))},30000)})}}function KH({prompt:D,options:{abortController:F=qQ(),additionalDirectories:Q=[],agents:B,allowedTools:Y=[],appendSystemPrompt:J,canUseTool:X,continue:C,customSystemPrompt:z,cwd:W,disallowedTools:G=[],env:q,executable:A=HQ()?"bun":"node",executableArgs:U=[],extraArgs:Z={},fallbackModel:H,forkSession:V,hooks:N,includePartialMessages:L,maxTurns:R,mcpServers:k,model:b,pathToClaudeCodeExecutable:I,permissionMode:u="default",permissionPromptToolName:f,resume:O,resumeSessionAt:y,settingSources:x,stderr:w,strictMcpConfig:S}={}}){if(!q)q={...process.env};if(!q.CLAUDE_CODE_ENTRYPOINT)q.CLAUDE_CODE_ENTRYPOINT="sdk-ts";if(!I)throw new Error("pathToClaudeCodeExecutable is required");let g={},d=new Map;if(k)for(let[o,XD]of Object.entries(k))if(XD.type==="sdk"&&"instance"in XD)d.set(o,XD.instance),g[o]={type:"sdk",name:o};else g[o]=XD;let n=typeof D==="string",a=new KQ({abortController:F,additionalDirectories:Q,agents:B,cwd:W,executable:A,executableArgs:U,extraArgs:Z,pathToClaudeCodeExecutable:I,env:q,forkSession:V,stderr:w,customSystemPrompt:z,appendSystemPrompt:J,maxTurns:R,model:b,fallbackModel:H,permissionMode:u,permissionPromptToolName:f,continueConversation:C,resume:O,resumeSessionAt:y,settingSources:x,allowedTools:Y,disallowedTools:G,mcpServers:g,strictMcpConfig:S,canUseTool:!!X,hooks:!!N,includePartialMessages:L}),DD=new AQ(a,n,X,N,F,d);if(typeof D==="string")a.write(JSON.stringify({type:"user",session_id:"",message:{role:"user",content:[{type:"text",text:D}]},parent_tool_use_id:null})+`
479
- `);else DD.streamInput(D);return DD}var E={};Rq(E,{void:()=>sH,util:()=>ND,unknown:()=>rH,union:()=>FK,undefined:()=>nH,tuple:()=>XK,transformer:()=>YQ,symbol:()=>pH,string:()=>RQ,strictObject:()=>DK,setErrorMap:()=>AH,set:()=>CK,record:()=>YK,quotelessJson:()=>UH,promise:()=>KK,preprocess:()=>AK,pipeline:()=>ZK,ostring:()=>VK,optional:()=>UK,onumber:()=>LK,oboolean:()=>MK,objectUtil:()=>X9,object:()=>eH,number:()=>_Q,nullable:()=>EK,null:()=>iH,never:()=>oH,nativeEnum:()=>HK,nan:()=>lH,map:()=>JK,makeIssue:()=>i6,literal:()=>GK,lazy:()=>zK,late:()=>hH,isValid:()=>oF,isDirty:()=>J9,isAsync:()=>T8,isAborted:()=>Y9,intersection:()=>QK,instanceof:()=>mH,getParsedType:()=>OF,getErrorMap:()=>n6,function:()=>WK,enum:()=>qK,effect:()=>YQ,discriminatedUnion:()=>BK,defaultErrorMap:()=>O2,datetimeRegex:()=>MQ,date:()=>cH,custom:()=>jQ,coerce:()=>NK,boolean:()=>OQ,bigint:()=>dH,array:()=>tH,any:()=>aH,addIssueToContext:()=>r,ZodVoid:()=>S8,ZodUnknown:()=>uF,ZodUnion:()=>P2,ZodUndefined:()=>w2,ZodType:()=>ED,ZodTuple:()=>EF,ZodTransformer:()=>c0,ZodSymbol:()=>P8,ZodString:()=>QF,ZodSet:()=>eF,ZodSchema:()=>ED,ZodRecord:()=>k8,ZodReadonly:()=>y2,ZodPromise:()=>D2,ZodPipeline:()=>x8,ZodParsedType:()=>t,ZodOptional:()=>YF,ZodObject:()=>$D,ZodNumber:()=>yF,ZodNullable:()=>IF,ZodNull:()=>T2,ZodNever:()=>UF,ZodNativeEnum:()=>v2,ZodNaN:()=>v8,ZodMap:()=>b8,ZodLiteral:()=>b2,ZodLazy:()=>k2,ZodIssueCode:()=>i,ZodIntersection:()=>S2,ZodFunction:()=>_2,ZodFirstPartyTypeKind:()=>GD,ZodError:()=>b0,ZodEnum:()=>gF,ZodEffects:()=>c0,ZodDiscriminatedUnion:()=>a6,ZodDefault:()=>x2,ZodDate:()=>sF,ZodCatch:()=>u2,ZodBranded:()=>r6,ZodBoolean:()=>I2,ZodBigInt:()=>fF,ZodArray:()=>XF,ZodAny:()=>tF,Schema:()=>ED,ParseStatus:()=>G0,OK:()=>M0,NEVER:()=>jK,INVALID:()=>zD,EMPTY_PATH:()=>ZH,DIRTY:()=>R2,BRAND:()=>$H});var ND;(function(D){D.assertEqual=(Y)=>{};function F(Y){}D.assertIs=F;function Q(Y){throw new Error}D.assertNever=Q,D.arrayToEnum=(Y)=>{let J={};for(let X of Y)J[X]=X;return J},D.getValidEnumValues=(Y)=>{let J=D.objectKeys(Y).filter((C)=>typeof Y[Y[C]]!=="number"),X={};for(let C of J)X[C]=Y[C];return D.objectValues(X)},D.objectValues=(Y)=>{return D.objectKeys(Y).map(function(J){return Y[J]})},D.objectKeys=typeof Object.keys==="function"?(Y)=>Object.keys(Y):(Y)=>{let J=[];for(let X in Y)if(Object.prototype.hasOwnProperty.call(Y,X))J.push(X);return J},D.find=(Y,J)=>{for(let X of Y)if(J(X))return X;return},D.isInteger=typeof Number.isInteger==="function"?(Y)=>Number.isInteger(Y):(Y)=>typeof Y==="number"&&Number.isFinite(Y)&&Math.floor(Y)===Y;function B(Y,J=" | "){return Y.map((X)=>typeof X==="string"?`'${X}'`:X).join(J)}D.joinValues=B,D.jsonStringifyReplacer=(Y,J)=>{if(typeof J==="bigint")return J.toString();return J}})(ND||(ND={}));var X9;(function(D){D.mergeShapes=(F,Q)=>{return{...F,...Q}}})(X9||(X9={}));var t=ND.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),OF=(D)=>{switch(typeof D){case"undefined":return t.undefined;case"string":return t.string;case"number":return Number.isNaN(D)?t.nan:t.number;case"boolean":return t.boolean;case"function":return t.function;case"bigint":return t.bigint;case"symbol":return t.symbol;case"object":if(Array.isArray(D))return t.array;if(D===null)return t.null;if(D.then&&typeof D.then==="function"&&D.catch&&typeof D.catch==="function")return t.promise;if(typeof Map!=="undefined"&&D instanceof Map)return t.map;if(typeof Set!=="undefined"&&D instanceof Set)return t.set;if(typeof Date!=="undefined"&&D instanceof Date)return t.date;return t.object;default:return t.unknown}},i=ND.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"]),UH=(D)=>{return JSON.stringify(D,null,2).replace(/"([^"]+)":/g,"$1:")};class b0 extends Error{get errors(){return this.issues}constructor(D){super();this.issues=[],this.addIssue=(Q)=>{this.issues=[...this.issues,Q]},this.addIssues=(Q=[])=>{this.issues=[...this.issues,...Q]};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(Y){return Y.message},Q={_errors:[]},B=(Y)=>{for(let J of Y.issues)if(J.code==="invalid_union")J.unionErrors.map(B);else if(J.code==="invalid_return_type")B(J.returnTypeError);else if(J.code==="invalid_arguments")B(J.argumentsError);else if(J.path.length===0)Q._errors.push(F(J));else{let X=Q,C=0;while(C<J.path.length){let z=J.path[C];if(C!==J.path.length-1)X[z]=X[z]||{_errors:[]};else X[z]=X[z]||{_errors:[]},X[z]._errors.push(F(J));X=X[z],C++}}};return B(this),Q}static assert(D){if(!(D instanceof b0))throw new Error(`Not a ZodError: ${D}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ND.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(D=(F)=>F.message){let F={},Q=[];for(let B of this.issues)if(B.path.length>0){let Y=B.path[0];F[Y]=F[Y]||[],F[Y].push(D(B))}else Q.push(D(B));return{formErrors:Q,fieldErrors:F}}get formErrors(){return this.flatten()}}b0.create=(D)=>{return new b0(D)};var EH=(D,F)=>{let Q;switch(D.code){case i.invalid_type:if(D.received===t.undefined)Q="Required";else Q=`Expected ${D.expected}, received ${D.received}`;break;case i.invalid_literal:Q=`Invalid literal value, expected ${JSON.stringify(D.expected,ND.jsonStringifyReplacer)}`;break;case i.unrecognized_keys:Q=`Unrecognized key(s) in object: ${ND.joinValues(D.keys,", ")}`;break;case i.invalid_union:Q="Invalid input";break;case i.invalid_union_discriminator:Q=`Invalid discriminator value. Expected ${ND.joinValues(D.options)}`;break;case i.invalid_enum_value:Q=`Invalid enum value. Expected ${ND.joinValues(D.options)}, received '${D.received}'`;break;case i.invalid_arguments:Q="Invalid function arguments";break;case i.invalid_return_type:Q="Invalid function return type";break;case i.invalid_date:Q="Invalid date";break;case i.invalid_string:if(typeof D.validation==="object")if("includes"in D.validation){if(Q=`Invalid input: must include "${D.validation.includes}"`,typeof D.validation.position==="number")Q=`${Q} at one or more positions greater than or equal to ${D.validation.position}`}else if("startsWith"in D.validation)Q=`Invalid input: must start with "${D.validation.startsWith}"`;else if("endsWith"in D.validation)Q=`Invalid input: must end with "${D.validation.endsWith}"`;else ND.assertNever(D.validation);else if(D.validation!=="regex")Q=`Invalid ${D.validation}`;else Q="Invalid";break;case i.too_small:if(D.type==="array")Q=`Array must contain ${D.exact?"exactly":D.inclusive?"at least":"more than"} ${D.minimum} element(s)`;else if(D.type==="string")Q=`String must contain ${D.exact?"exactly":D.inclusive?"at least":"over"} ${D.minimum} character(s)`;else if(D.type==="number")Q=`Number must be ${D.exact?"exactly equal to ":D.inclusive?"greater than or equal to ":"greater than "}${D.minimum}`;else if(D.type==="bigint")Q=`Number must be ${D.exact?"exactly equal to ":D.inclusive?"greater than or equal to ":"greater than "}${D.minimum}`;else if(D.type==="date")Q=`Date must be ${D.exact?"exactly equal to ":D.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(D.minimum))}`;else Q="Invalid input";break;case i.too_big:if(D.type==="array")Q=`Array must contain ${D.exact?"exactly":D.inclusive?"at most":"less than"} ${D.maximum} element(s)`;else if(D.type==="string")Q=`String must contain ${D.exact?"exactly":D.inclusive?"at most":"under"} ${D.maximum} character(s)`;else if(D.type==="number")Q=`Number must be ${D.exact?"exactly":D.inclusive?"less than or equal to":"less than"} ${D.maximum}`;else if(D.type==="bigint")Q=`BigInt must be ${D.exact?"exactly":D.inclusive?"less than or equal to":"less than"} ${D.maximum}`;else if(D.type==="date")Q=`Date must be ${D.exact?"exactly":D.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(D.maximum))}`;else Q="Invalid input";break;case i.custom:Q="Invalid input";break;case i.invalid_intersection_types:Q="Intersection results could not be merged";break;case i.not_multiple_of:Q=`Number must be a multiple of ${D.multipleOf}`;break;case i.not_finite:Q="Number must be finite";break;default:Q=F.defaultError,ND.assertNever(D)}return{message:Q}},O2=EH,ZQ=O2;function AH(D){ZQ=D}function n6(){return ZQ}var i6=(D)=>{let{data:F,path:Q,errorMaps:B,issueData:Y}=D,J=[...Q,...Y.path||[]],X={...Y,path:J};if(Y.message!==void 0)return{...Y,path:J,message:Y.message};let C="",z=B.filter((W)=>!!W).slice().reverse();for(let W of z)C=W(X,{data:F,defaultError:C}).message;return{...Y,path:J,message:C}},ZH=[];function r(D,F){let Q=n6(),B=i6({issueData:F,data:D.data,path:D.path,errorMaps:[D.common.contextualErrorMap,D.schemaErrorMap,Q,Q===O2?void 0:O2].filter((Y)=>!!Y)});D.common.issues.push(B)}class G0{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 Q=[];for(let B of F){if(B.status==="aborted")return zD;if(B.status==="dirty")D.dirty();Q.push(B.value)}return{status:D.value,value:Q}}static async mergeObjectAsync(D,F){let Q=[];for(let B of F){let Y=await B.key,J=await B.value;Q.push({key:Y,value:J})}return G0.mergeObjectSync(D,Q)}static mergeObjectSync(D,F){let Q={};for(let B of F){let{key:Y,value:J}=B;if(Y.status==="aborted")return zD;if(J.status==="aborted")return zD;if(Y.status==="dirty")D.dirty();if(J.status==="dirty")D.dirty();if(Y.value!=="__proto__"&&(typeof J.value!=="undefined"||B.alwaysSet))Q[Y.value]=J.value}return{status:D.value,value:Q}}}var zD=Object.freeze({status:"aborted"}),R2=(D)=>({status:"dirty",value:D}),M0=(D)=>({status:"valid",value:D}),Y9=(D)=>D.status==="aborted",J9=(D)=>D.status==="dirty",oF=(D)=>D.status==="valid",T8=(D)=>typeof Promise!=="undefined"&&D instanceof Promise,QD;(function(D){D.errToObj=(F)=>typeof F==="string"?{message:F}:F||{},D.toString=(F)=>typeof F==="string"?F:F?.message})(QD||(QD={}));class JF{constructor(D,F,Q,B){this._cachedPath=[],this.parent=D,this.data=F,this._path=Q,this._key=B}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}var QQ=(D,F)=>{if(oF(F))return{success:!0,data:F.value};else{if(!D.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let Q=new b0(D.common.issues);return this._error=Q,this._error}}}};function UD(D){if(!D)return{};let{errorMap:F,invalid_type_error:Q,required_error:B,description:Y}=D;if(F&&(Q||B))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(F)return{errorMap:F,description:Y};return{errorMap:(X,C)=>{let{message:z}=D;if(X.code==="invalid_enum_value")return{message:z??C.defaultError};if(typeof C.data==="undefined")return{message:z??B??C.defaultError};if(X.code!=="invalid_type")return{message:C.defaultError};return{message:z??Q??C.defaultError}},description:Y}}class ED{get description(){return this._def.description}_getType(D){return OF(D.data)}_getOrReturnCtx(D,F){return F||{common:D.parent.common,data:D.data,parsedType:OF(D.data),schemaErrorMap:this._def.errorMap,path:D.path,parent:D.parent}}_processInputParams(D){return{status:new G0,ctx:{common:D.parent.common,data:D.data,parsedType:OF(D.data),schemaErrorMap:this._def.errorMap,path:D.path,parent:D.parent}}}_parseSync(D){let F=this._parse(D);if(T8(F))throw new Error("Synchronous parse encountered promise.");return F}_parseAsync(D){let F=this._parse(D);return Promise.resolve(F)}parse(D,F){let Q=this.safeParse(D,F);if(Q.success)return Q.data;throw Q.error}safeParse(D,F){let Q={common:{issues:[],async:F?.async??!1,contextualErrorMap:F?.errorMap},path:F?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:D,parsedType:OF(D)},B=this._parseSync({data:D,path:Q.path,parent:Q});return QQ(Q,B)}"~validate"(D){let F={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:D,parsedType:OF(D)};if(!this["~standard"].async)try{let Q=this._parseSync({data:D,path:[],parent:F});return oF(Q)?{value:Q.value}:{issues:F.common.issues}}catch(Q){if(Q?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;F.common={issues:[],async:!0}}return this._parseAsync({data:D,path:[],parent:F}).then((Q)=>oF(Q)?{value:Q.value}:{issues:F.common.issues})}async parseAsync(D,F){let Q=await this.safeParseAsync(D,F);if(Q.success)return Q.data;throw Q.error}async safeParseAsync(D,F){let Q={common:{issues:[],contextualErrorMap:F?.errorMap,async:!0},path:F?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:D,parsedType:OF(D)},B=this._parse({data:D,path:Q.path,parent:Q}),Y=await(T8(B)?B:Promise.resolve(B));return QQ(Q,Y)}refine(D,F){let Q=(B)=>{if(typeof F==="string"||typeof F==="undefined")return{message:F};else if(typeof F==="function")return F(B);else return F};return this._refinement((B,Y)=>{let J=D(B),X=()=>Y.addIssue({code:i.custom,...Q(B)});if(typeof Promise!=="undefined"&&J instanceof Promise)return J.then((C)=>{if(!C)return X(),!1;else return!0});if(!J)return X(),!1;else return!0})}refinement(D,F){return this._refinement((Q,B)=>{if(!D(Q))return B.addIssue(typeof F==="function"?F(Q,B):F),!1;else return!0})}_refinement(D){return new c0({schema:this,typeName:GD.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 YF.create(this,this._def)}nullable(){return IF.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return XF.create(this)}promise(){return D2.create(this,this._def)}or(D){return P2.create([this,D],this._def)}and(D){return S2.create(this,D,this._def)}transform(D){return new c0({...UD(this._def),schema:this,typeName:GD.ZodEffects,effect:{type:"transform",transform:D}})}default(D){let F=typeof D==="function"?D:()=>D;return new x2({...UD(this._def),innerType:this,defaultValue:F,typeName:GD.ZodDefault})}brand(){return new r6({typeName:GD.ZodBranded,type:this,...UD(this._def)})}catch(D){let F=typeof D==="function"?D:()=>D;return new u2({...UD(this._def),innerType:this,catchValue:F,typeName:GD.ZodCatch})}describe(D){return new this.constructor({...this._def,description:D})}pipe(D){return x8.create(this,D)}readonly(){return y2.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var VH=/^c[^\s-]{8,}$/i,LH=/^[0-9a-z]+$/,MH=/^[0-9A-HJKMNP-TV-Z]{26}$/i,NH=/^[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,jH=/^[a-z0-9_-]{21}$/i,RH=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,_H=/^[-+]?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)?)??$/,OH=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,IH="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",B9,wH=/^(?:(?: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])$/,TH=/^(?:(?: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])$/,PH=/^(([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]))$/,SH=/^(([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])$/,kH=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,bH=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,VQ="((\\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])))",vH=new RegExp(`^${VQ}$`);function LQ(D){let F="[0-5]\\d";if(D.precision)F=`${F}\\.\\d{${D.precision}}`;else if(D.precision==null)F=`${F}(\\.\\d+)?`;let Q=D.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${F})${Q}`}function xH(D){return new RegExp(`^${LQ(D)}$`)}function MQ(D){let F=`${VQ}T${LQ(D)}`,Q=[];if(Q.push(D.local?"Z?":"Z"),D.offset)Q.push("([+-]\\d{2}:?\\d{2})");return F=`${F}(${Q.join("|")})`,new RegExp(`^${F}$`)}function uH(D,F){if((F==="v4"||!F)&&wH.test(D))return!0;if((F==="v6"||!F)&&PH.test(D))return!0;return!1}function yH(D,F){if(!RH.test(D))return!1;try{let[Q]=D.split(".");if(!Q)return!1;let B=Q.replace(/-/g,"+").replace(/_/g,"/").padEnd(Q.length+(4-Q.length%4)%4,"="),Y=JSON.parse(atob(B));if(typeof Y!=="object"||Y===null)return!1;if("typ"in Y&&Y?.typ!=="JWT")return!1;if(!Y.alg)return!1;if(F&&Y.alg!==F)return!1;return!0}catch{return!1}}function fH(D,F){if((F==="v4"||!F)&&TH.test(D))return!0;if((F==="v6"||!F)&&SH.test(D))return!0;return!1}class QF extends ED{_parse(D){if(this._def.coerce)D.data=String(D.data);if(this._getType(D)!==t.string){let Y=this._getOrReturnCtx(D);return r(Y,{code:i.invalid_type,expected:t.string,received:Y.parsedType}),zD}let Q=new G0,B=void 0;for(let Y of this._def.checks)if(Y.kind==="min"){if(D.data.length<Y.value)B=this._getOrReturnCtx(D,B),r(B,{code:i.too_small,minimum:Y.value,type:"string",inclusive:!0,exact:!1,message:Y.message}),Q.dirty()}else if(Y.kind==="max"){if(D.data.length>Y.value)B=this._getOrReturnCtx(D,B),r(B,{code:i.too_big,maximum:Y.value,type:"string",inclusive:!0,exact:!1,message:Y.message}),Q.dirty()}else if(Y.kind==="length"){let J=D.data.length>Y.value,X=D.data.length<Y.value;if(J||X){if(B=this._getOrReturnCtx(D,B),J)r(B,{code:i.too_big,maximum:Y.value,type:"string",inclusive:!0,exact:!0,message:Y.message});else if(X)r(B,{code:i.too_small,minimum:Y.value,type:"string",inclusive:!0,exact:!0,message:Y.message});Q.dirty()}}else if(Y.kind==="email"){if(!OH.test(D.data))B=this._getOrReturnCtx(D,B),r(B,{validation:"email",code:i.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="emoji"){if(!B9)B9=new RegExp(IH,"u");if(!B9.test(D.data))B=this._getOrReturnCtx(D,B),r(B,{validation:"emoji",code:i.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="uuid"){if(!NH.test(D.data))B=this._getOrReturnCtx(D,B),r(B,{validation:"uuid",code:i.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="nanoid"){if(!jH.test(D.data))B=this._getOrReturnCtx(D,B),r(B,{validation:"nanoid",code:i.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="cuid"){if(!VH.test(D.data))B=this._getOrReturnCtx(D,B),r(B,{validation:"cuid",code:i.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="cuid2"){if(!LH.test(D.data))B=this._getOrReturnCtx(D,B),r(B,{validation:"cuid2",code:i.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="ulid"){if(!MH.test(D.data))B=this._getOrReturnCtx(D,B),r(B,{validation:"ulid",code:i.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="url")try{new URL(D.data)}catch{B=this._getOrReturnCtx(D,B),r(B,{validation:"url",code:i.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="regex"){if(Y.regex.lastIndex=0,!Y.regex.test(D.data))B=this._getOrReturnCtx(D,B),r(B,{validation:"regex",code:i.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="trim")D.data=D.data.trim();else if(Y.kind==="includes"){if(!D.data.includes(Y.value,Y.position))B=this._getOrReturnCtx(D,B),r(B,{code:i.invalid_string,validation:{includes:Y.value,position:Y.position},message:Y.message}),Q.dirty()}else if(Y.kind==="toLowerCase")D.data=D.data.toLowerCase();else if(Y.kind==="toUpperCase")D.data=D.data.toUpperCase();else if(Y.kind==="startsWith"){if(!D.data.startsWith(Y.value))B=this._getOrReturnCtx(D,B),r(B,{code:i.invalid_string,validation:{startsWith:Y.value},message:Y.message}),Q.dirty()}else if(Y.kind==="endsWith"){if(!D.data.endsWith(Y.value))B=this._getOrReturnCtx(D,B),r(B,{code:i.invalid_string,validation:{endsWith:Y.value},message:Y.message}),Q.dirty()}else if(Y.kind==="datetime"){if(!MQ(Y).test(D.data))B=this._getOrReturnCtx(D,B),r(B,{code:i.invalid_string,validation:"datetime",message:Y.message}),Q.dirty()}else if(Y.kind==="date"){if(!vH.test(D.data))B=this._getOrReturnCtx(D,B),r(B,{code:i.invalid_string,validation:"date",message:Y.message}),Q.dirty()}else if(Y.kind==="time"){if(!xH(Y).test(D.data))B=this._getOrReturnCtx(D,B),r(B,{code:i.invalid_string,validation:"time",message:Y.message}),Q.dirty()}else if(Y.kind==="duration"){if(!_H.test(D.data))B=this._getOrReturnCtx(D,B),r(B,{validation:"duration",code:i.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="ip"){if(!uH(D.data,Y.version))B=this._getOrReturnCtx(D,B),r(B,{validation:"ip",code:i.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="jwt"){if(!yH(D.data,Y.alg))B=this._getOrReturnCtx(D,B),r(B,{validation:"jwt",code:i.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="cidr"){if(!fH(D.data,Y.version))B=this._getOrReturnCtx(D,B),r(B,{validation:"cidr",code:i.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="base64"){if(!kH.test(D.data))B=this._getOrReturnCtx(D,B),r(B,{validation:"base64",code:i.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="base64url"){if(!bH.test(D.data))B=this._getOrReturnCtx(D,B),r(B,{validation:"base64url",code:i.invalid_string,message:Y.message}),Q.dirty()}else ND.assertNever(Y);return{status:Q.value,value:D.data}}_regex(D,F,Q){return this.refinement((B)=>D.test(B),{validation:F,code:i.invalid_string,...QD.errToObj(Q)})}_addCheck(D){return new QF({...this._def,checks:[...this._def.checks,D]})}email(D){return this._addCheck({kind:"email",...QD.errToObj(D)})}url(D){return this._addCheck({kind:"url",...QD.errToObj(D)})}emoji(D){return this._addCheck({kind:"emoji",...QD.errToObj(D)})}uuid(D){return this._addCheck({kind:"uuid",...QD.errToObj(D)})}nanoid(D){return this._addCheck({kind:"nanoid",...QD.errToObj(D)})}cuid(D){return this._addCheck({kind:"cuid",...QD.errToObj(D)})}cuid2(D){return this._addCheck({kind:"cuid2",...QD.errToObj(D)})}ulid(D){return this._addCheck({kind:"ulid",...QD.errToObj(D)})}base64(D){return this._addCheck({kind:"base64",...QD.errToObj(D)})}base64url(D){return this._addCheck({kind:"base64url",...QD.errToObj(D)})}jwt(D){return this._addCheck({kind:"jwt",...QD.errToObj(D)})}ip(D){return this._addCheck({kind:"ip",...QD.errToObj(D)})}cidr(D){return this._addCheck({kind:"cidr",...QD.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==="undefined"?null:D?.precision,offset:D?.offset??!1,local:D?.local??!1,...QD.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==="undefined"?null:D?.precision,...QD.errToObj(D?.message)})}duration(D){return this._addCheck({kind:"duration",...QD.errToObj(D)})}regex(D,F){return this._addCheck({kind:"regex",regex:D,...QD.errToObj(F)})}includes(D,F){return this._addCheck({kind:"includes",value:D,position:F?.position,...QD.errToObj(F?.message)})}startsWith(D,F){return this._addCheck({kind:"startsWith",value:D,...QD.errToObj(F)})}endsWith(D,F){return this._addCheck({kind:"endsWith",value:D,...QD.errToObj(F)})}min(D,F){return this._addCheck({kind:"min",value:D,...QD.errToObj(F)})}max(D,F){return this._addCheck({kind:"max",value:D,...QD.errToObj(F)})}length(D,F){return this._addCheck({kind:"length",value:D,...QD.errToObj(F)})}nonempty(D){return this.min(1,QD.errToObj(D))}trim(){return new QF({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new QF({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new QF({...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}}QF.create=(D)=>{return new QF({checks:[],typeName:GD.ZodString,coerce:D?.coerce??!1,...UD(D)})};function gH(D,F){let Q=(D.toString().split(".")[1]||"").length,B=(F.toString().split(".")[1]||"").length,Y=Q>B?Q:B,J=Number.parseInt(D.toFixed(Y).replace(".","")),X=Number.parseInt(F.toFixed(Y).replace(".",""));return J%X/10**Y}class yF extends ED{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)!==t.number){let Y=this._getOrReturnCtx(D);return r(Y,{code:i.invalid_type,expected:t.number,received:Y.parsedType}),zD}let Q=void 0,B=new G0;for(let Y of this._def.checks)if(Y.kind==="int"){if(!ND.isInteger(D.data))Q=this._getOrReturnCtx(D,Q),r(Q,{code:i.invalid_type,expected:"integer",received:"float",message:Y.message}),B.dirty()}else if(Y.kind==="min"){if(Y.inclusive?D.data<Y.value:D.data<=Y.value)Q=this._getOrReturnCtx(D,Q),r(Q,{code:i.too_small,minimum:Y.value,type:"number",inclusive:Y.inclusive,exact:!1,message:Y.message}),B.dirty()}else if(Y.kind==="max"){if(Y.inclusive?D.data>Y.value:D.data>=Y.value)Q=this._getOrReturnCtx(D,Q),r(Q,{code:i.too_big,maximum:Y.value,type:"number",inclusive:Y.inclusive,exact:!1,message:Y.message}),B.dirty()}else if(Y.kind==="multipleOf"){if(gH(D.data,Y.value)!==0)Q=this._getOrReturnCtx(D,Q),r(Q,{code:i.not_multiple_of,multipleOf:Y.value,message:Y.message}),B.dirty()}else if(Y.kind==="finite"){if(!Number.isFinite(D.data))Q=this._getOrReturnCtx(D,Q),r(Q,{code:i.not_finite,message:Y.message}),B.dirty()}else ND.assertNever(Y);return{status:B.value,value:D.data}}gte(D,F){return this.setLimit("min",D,!0,QD.toString(F))}gt(D,F){return this.setLimit("min",D,!1,QD.toString(F))}lte(D,F){return this.setLimit("max",D,!0,QD.toString(F))}lt(D,F){return this.setLimit("max",D,!1,QD.toString(F))}setLimit(D,F,Q,B){return new yF({...this._def,checks:[...this._def.checks,{kind:D,value:F,inclusive:Q,message:QD.toString(B)}]})}_addCheck(D){return new yF({...this._def,checks:[...this._def.checks,D]})}int(D){return this._addCheck({kind:"int",message:QD.toString(D)})}positive(D){return this._addCheck({kind:"min",value:0,inclusive:!1,message:QD.toString(D)})}negative(D){return this._addCheck({kind:"max",value:0,inclusive:!1,message:QD.toString(D)})}nonpositive(D){return this._addCheck({kind:"max",value:0,inclusive:!0,message:QD.toString(D)})}nonnegative(D){return this._addCheck({kind:"min",value:0,inclusive:!0,message:QD.toString(D)})}multipleOf(D,F){return this._addCheck({kind:"multipleOf",value:D,message:QD.toString(F)})}finite(D){return this._addCheck({kind:"finite",message:QD.toString(D)})}safe(D){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:QD.toString(D)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:QD.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"&&ND.isInteger(D.value))}get isFinite(){let D=null,F=null;for(let Q of this._def.checks)if(Q.kind==="finite"||Q.kind==="int"||Q.kind==="multipleOf")return!0;else if(Q.kind==="min"){if(F===null||Q.value>F)F=Q.value}else if(Q.kind==="max"){if(D===null||Q.value<D)D=Q.value}return Number.isFinite(F)&&Number.isFinite(D)}}yF.create=(D)=>{return new yF({checks:[],typeName:GD.ZodNumber,coerce:D?.coerce||!1,...UD(D)})};class fF extends ED{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)!==t.bigint)return this._getInvalidInput(D);let Q=void 0,B=new G0;for(let Y of this._def.checks)if(Y.kind==="min"){if(Y.inclusive?D.data<Y.value:D.data<=Y.value)Q=this._getOrReturnCtx(D,Q),r(Q,{code:i.too_small,type:"bigint",minimum:Y.value,inclusive:Y.inclusive,message:Y.message}),B.dirty()}else if(Y.kind==="max"){if(Y.inclusive?D.data>Y.value:D.data>=Y.value)Q=this._getOrReturnCtx(D,Q),r(Q,{code:i.too_big,type:"bigint",maximum:Y.value,inclusive:Y.inclusive,message:Y.message}),B.dirty()}else if(Y.kind==="multipleOf"){if(D.data%Y.value!==BigInt(0))Q=this._getOrReturnCtx(D,Q),r(Q,{code:i.not_multiple_of,multipleOf:Y.value,message:Y.message}),B.dirty()}else ND.assertNever(Y);return{status:B.value,value:D.data}}_getInvalidInput(D){let F=this._getOrReturnCtx(D);return r(F,{code:i.invalid_type,expected:t.bigint,received:F.parsedType}),zD}gte(D,F){return this.setLimit("min",D,!0,QD.toString(F))}gt(D,F){return this.setLimit("min",D,!1,QD.toString(F))}lte(D,F){return this.setLimit("max",D,!0,QD.toString(F))}lt(D,F){return this.setLimit("max",D,!1,QD.toString(F))}setLimit(D,F,Q,B){return new fF({...this._def,checks:[...this._def.checks,{kind:D,value:F,inclusive:Q,message:QD.toString(B)}]})}_addCheck(D){return new fF({...this._def,checks:[...this._def.checks,D]})}positive(D){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:QD.toString(D)})}negative(D){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:QD.toString(D)})}nonpositive(D){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:QD.toString(D)})}nonnegative(D){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:QD.toString(D)})}multipleOf(D,F){return this._addCheck({kind:"multipleOf",value:D,message:QD.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}}fF.create=(D)=>{return new fF({checks:[],typeName:GD.ZodBigInt,coerce:D?.coerce??!1,...UD(D)})};class I2 extends ED{_parse(D){if(this._def.coerce)D.data=Boolean(D.data);if(this._getType(D)!==t.boolean){let Q=this._getOrReturnCtx(D);return r(Q,{code:i.invalid_type,expected:t.boolean,received:Q.parsedType}),zD}return M0(D.data)}}I2.create=(D)=>{return new I2({typeName:GD.ZodBoolean,coerce:D?.coerce||!1,...UD(D)})};class sF extends ED{_parse(D){if(this._def.coerce)D.data=new Date(D.data);if(this._getType(D)!==t.date){let Y=this._getOrReturnCtx(D);return r(Y,{code:i.invalid_type,expected:t.date,received:Y.parsedType}),zD}if(Number.isNaN(D.data.getTime())){let Y=this._getOrReturnCtx(D);return r(Y,{code:i.invalid_date}),zD}let Q=new G0,B=void 0;for(let Y of this._def.checks)if(Y.kind==="min"){if(D.data.getTime()<Y.value)B=this._getOrReturnCtx(D,B),r(B,{code:i.too_small,message:Y.message,inclusive:!0,exact:!1,minimum:Y.value,type:"date"}),Q.dirty()}else if(Y.kind==="max"){if(D.data.getTime()>Y.value)B=this._getOrReturnCtx(D,B),r(B,{code:i.too_big,message:Y.message,inclusive:!0,exact:!1,maximum:Y.value,type:"date"}),Q.dirty()}else ND.assertNever(Y);return{status:Q.value,value:new Date(D.data.getTime())}}_addCheck(D){return new sF({...this._def,checks:[...this._def.checks,D]})}min(D,F){return this._addCheck({kind:"min",value:D.getTime(),message:QD.toString(F)})}max(D,F){return this._addCheck({kind:"max",value:D.getTime(),message:QD.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}}sF.create=(D)=>{return new sF({checks:[],coerce:D?.coerce||!1,typeName:GD.ZodDate,...UD(D)})};class P8 extends ED{_parse(D){if(this._getType(D)!==t.symbol){let Q=this._getOrReturnCtx(D);return r(Q,{code:i.invalid_type,expected:t.symbol,received:Q.parsedType}),zD}return M0(D.data)}}P8.create=(D)=>{return new P8({typeName:GD.ZodSymbol,...UD(D)})};class w2 extends ED{_parse(D){if(this._getType(D)!==t.undefined){let Q=this._getOrReturnCtx(D);return r(Q,{code:i.invalid_type,expected:t.undefined,received:Q.parsedType}),zD}return M0(D.data)}}w2.create=(D)=>{return new w2({typeName:GD.ZodUndefined,...UD(D)})};class T2 extends ED{_parse(D){if(this._getType(D)!==t.null){let Q=this._getOrReturnCtx(D);return r(Q,{code:i.invalid_type,expected:t.null,received:Q.parsedType}),zD}return M0(D.data)}}T2.create=(D)=>{return new T2({typeName:GD.ZodNull,...UD(D)})};class tF extends ED{constructor(){super(...arguments);this._any=!0}_parse(D){return M0(D.data)}}tF.create=(D)=>{return new tF({typeName:GD.ZodAny,...UD(D)})};class uF extends ED{constructor(){super(...arguments);this._unknown=!0}_parse(D){return M0(D.data)}}uF.create=(D)=>{return new uF({typeName:GD.ZodUnknown,...UD(D)})};class UF extends ED{_parse(D){let F=this._getOrReturnCtx(D);return r(F,{code:i.invalid_type,expected:t.never,received:F.parsedType}),zD}}UF.create=(D)=>{return new UF({typeName:GD.ZodNever,...UD(D)})};class S8 extends ED{_parse(D){if(this._getType(D)!==t.undefined){let Q=this._getOrReturnCtx(D);return r(Q,{code:i.invalid_type,expected:t.void,received:Q.parsedType}),zD}return M0(D.data)}}S8.create=(D)=>{return new S8({typeName:GD.ZodVoid,...UD(D)})};class XF extends ED{_parse(D){let{ctx:F,status:Q}=this._processInputParams(D),B=this._def;if(F.parsedType!==t.array)return r(F,{code:i.invalid_type,expected:t.array,received:F.parsedType}),zD;if(B.exactLength!==null){let J=F.data.length>B.exactLength.value,X=F.data.length<B.exactLength.value;if(J||X)r(F,{code:J?i.too_big:i.too_small,minimum:X?B.exactLength.value:void 0,maximum:J?B.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:B.exactLength.message}),Q.dirty()}if(B.minLength!==null){if(F.data.length<B.minLength.value)r(F,{code:i.too_small,minimum:B.minLength.value,type:"array",inclusive:!0,exact:!1,message:B.minLength.message}),Q.dirty()}if(B.maxLength!==null){if(F.data.length>B.maxLength.value)r(F,{code:i.too_big,maximum:B.maxLength.value,type:"array",inclusive:!0,exact:!1,message:B.maxLength.message}),Q.dirty()}if(F.common.async)return Promise.all([...F.data].map((J,X)=>{return B.type._parseAsync(new JF(F,J,F.path,X))})).then((J)=>{return G0.mergeArray(Q,J)});let Y=[...F.data].map((J,X)=>{return B.type._parseSync(new JF(F,J,F.path,X))});return G0.mergeArray(Q,Y)}get element(){return this._def.type}min(D,F){return new XF({...this._def,minLength:{value:D,message:QD.toString(F)}})}max(D,F){return new XF({...this._def,maxLength:{value:D,message:QD.toString(F)}})}length(D,F){return new XF({...this._def,exactLength:{value:D,message:QD.toString(F)}})}nonempty(D){return this.min(1,D)}}XF.create=(D,F)=>{return new XF({type:D,minLength:null,maxLength:null,exactLength:null,typeName:GD.ZodArray,...UD(F)})};function N2(D){if(D instanceof $D){let F={};for(let Q in D.shape){let B=D.shape[Q];F[Q]=YF.create(N2(B))}return new $D({...D._def,shape:()=>F})}else if(D instanceof XF)return new XF({...D._def,type:N2(D.element)});else if(D instanceof YF)return YF.create(N2(D.unwrap()));else if(D instanceof IF)return IF.create(N2(D.unwrap()));else if(D instanceof EF)return EF.create(D.items.map((F)=>N2(F)));else return D}class $D extends ED{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=ND.objectKeys(D);return this._cached={shape:D,keys:F},this._cached}_parse(D){if(this._getType(D)!==t.object){let z=this._getOrReturnCtx(D);return r(z,{code:i.invalid_type,expected:t.object,received:z.parsedType}),zD}let{status:Q,ctx:B}=this._processInputParams(D),{shape:Y,keys:J}=this._getCached(),X=[];if(!(this._def.catchall instanceof UF&&this._def.unknownKeys==="strip")){for(let z in B.data)if(!J.includes(z))X.push(z)}let C=[];for(let z of J){let W=Y[z],G=B.data[z];C.push({key:{status:"valid",value:z},value:W._parse(new JF(B,G,B.path,z)),alwaysSet:z in B.data})}if(this._def.catchall instanceof UF){let z=this._def.unknownKeys;if(z==="passthrough")for(let W of X)C.push({key:{status:"valid",value:W},value:{status:"valid",value:B.data[W]}});else if(z==="strict"){if(X.length>0)r(B,{code:i.unrecognized_keys,keys:X}),Q.dirty()}else if(z==="strip");else throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let z=this._def.catchall;for(let W of X){let G=B.data[W];C.push({key:{status:"valid",value:W},value:z._parse(new JF(B,G,B.path,W)),alwaysSet:W in B.data})}}if(B.common.async)return Promise.resolve().then(async()=>{let z=[];for(let W of C){let G=await W.key,q=await W.value;z.push({key:G,value:q,alwaysSet:W.alwaysSet})}return z}).then((z)=>{return G0.mergeObjectSync(Q,z)});else return G0.mergeObjectSync(Q,C)}get shape(){return this._def.shape()}strict(D){return QD.errToObj,new $D({...this._def,unknownKeys:"strict",...D!==void 0?{errorMap:(F,Q)=>{let B=this._def.errorMap?.(F,Q).message??Q.defaultError;if(F.code==="unrecognized_keys")return{message:QD.errToObj(D).message??B};return{message:B}}}:{}})}strip(){return new $D({...this._def,unknownKeys:"strip"})}passthrough(){return new $D({...this._def,unknownKeys:"passthrough"})}extend(D){return new $D({...this._def,shape:()=>({...this._def.shape(),...D})})}merge(D){return new $D({unknownKeys:D._def.unknownKeys,catchall:D._def.catchall,shape:()=>({...this._def.shape(),...D._def.shape()}),typeName:GD.ZodObject})}setKey(D,F){return this.augment({[D]:F})}catchall(D){return new $D({...this._def,catchall:D})}pick(D){let F={};for(let Q of ND.objectKeys(D))if(D[Q]&&this.shape[Q])F[Q]=this.shape[Q];return new $D({...this._def,shape:()=>F})}omit(D){let F={};for(let Q of ND.objectKeys(this.shape))if(!D[Q])F[Q]=this.shape[Q];return new $D({...this._def,shape:()=>F})}deepPartial(){return N2(this)}partial(D){let F={};for(let Q of ND.objectKeys(this.shape)){let B=this.shape[Q];if(D&&!D[Q])F[Q]=B;else F[Q]=B.optional()}return new $D({...this._def,shape:()=>F})}required(D){let F={};for(let Q of ND.objectKeys(this.shape))if(D&&!D[Q])F[Q]=this.shape[Q];else{let Y=this.shape[Q];while(Y instanceof YF)Y=Y._def.innerType;F[Q]=Y}return new $D({...this._def,shape:()=>F})}keyof(){return NQ(ND.objectKeys(this.shape))}}$D.create=(D,F)=>{return new $D({shape:()=>D,unknownKeys:"strip",catchall:UF.create(),typeName:GD.ZodObject,...UD(F)})};$D.strictCreate=(D,F)=>{return new $D({shape:()=>D,unknownKeys:"strict",catchall:UF.create(),typeName:GD.ZodObject,...UD(F)})};$D.lazycreate=(D,F)=>{return new $D({shape:D,unknownKeys:"strip",catchall:UF.create(),typeName:GD.ZodObject,...UD(F)})};class P2 extends ED{_parse(D){let{ctx:F}=this._processInputParams(D),Q=this._def.options;function B(Y){for(let X of Y)if(X.result.status==="valid")return X.result;for(let X of Y)if(X.result.status==="dirty")return F.common.issues.push(...X.ctx.common.issues),X.result;let J=Y.map((X)=>new b0(X.ctx.common.issues));return r(F,{code:i.invalid_union,unionErrors:J}),zD}if(F.common.async)return Promise.all(Q.map(async(Y)=>{let J={...F,common:{...F.common,issues:[]},parent:null};return{result:await Y._parseAsync({data:F.data,path:F.path,parent:J}),ctx:J}})).then(B);else{let Y=void 0,J=[];for(let C of Q){let z={...F,common:{...F.common,issues:[]},parent:null},W=C._parseSync({data:F.data,path:F.path,parent:z});if(W.status==="valid")return W;else if(W.status==="dirty"&&!Y)Y={result:W,ctx:z};if(z.common.issues.length)J.push(z.common.issues)}if(Y)return F.common.issues.push(...Y.ctx.common.issues),Y.result;let X=J.map((C)=>new b0(C));return r(F,{code:i.invalid_union,unionErrors:X}),zD}}get options(){return this._def.options}}P2.create=(D,F)=>{return new P2({options:D,typeName:GD.ZodUnion,...UD(F)})};var _F=(D)=>{if(D instanceof k2)return _F(D.schema);else if(D instanceof c0)return _F(D.innerType());else if(D instanceof b2)return[D.value];else if(D instanceof gF)return D.options;else if(D instanceof v2)return ND.objectValues(D.enum);else if(D instanceof x2)return _F(D._def.innerType);else if(D instanceof w2)return[void 0];else if(D instanceof T2)return[null];else if(D instanceof YF)return[void 0,..._F(D.unwrap())];else if(D instanceof IF)return[null,..._F(D.unwrap())];else if(D instanceof r6)return _F(D.unwrap());else if(D instanceof y2)return _F(D.unwrap());else if(D instanceof u2)return _F(D._def.innerType);else return[]};class a6 extends ED{_parse(D){let{ctx:F}=this._processInputParams(D);if(F.parsedType!==t.object)return r(F,{code:i.invalid_type,expected:t.object,received:F.parsedType}),zD;let Q=this.discriminator,B=F.data[Q],Y=this.optionsMap.get(B);if(!Y)return r(F,{code:i.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[Q]}),zD;if(F.common.async)return Y._parseAsync({data:F.data,path:F.path,parent:F});else return Y._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,Q){let B=new Map;for(let Y of F){let J=_F(Y.shape[D]);if(!J.length)throw new Error(`A discriminator value for key \`${D}\` could not be extracted from all schema options`);for(let X of J){if(B.has(X))throw new Error(`Discriminator property ${String(D)} has duplicate value ${String(X)}`);B.set(X,Y)}}return new a6({typeName:GD.ZodDiscriminatedUnion,discriminator:D,options:F,optionsMap:B,...UD(Q)})}}function C9(D,F){let Q=OF(D),B=OF(F);if(D===F)return{valid:!0,data:D};else if(Q===t.object&&B===t.object){let Y=ND.objectKeys(F),J=ND.objectKeys(D).filter((C)=>Y.indexOf(C)!==-1),X={...D,...F};for(let C of J){let z=C9(D[C],F[C]);if(!z.valid)return{valid:!1};X[C]=z.data}return{valid:!0,data:X}}else if(Q===t.array&&B===t.array){if(D.length!==F.length)return{valid:!1};let Y=[];for(let J=0;J<D.length;J++){let X=D[J],C=F[J],z=C9(X,C);if(!z.valid)return{valid:!1};Y.push(z.data)}return{valid:!0,data:Y}}else if(Q===t.date&&B===t.date&&+D===+F)return{valid:!0,data:D};else return{valid:!1}}class S2 extends ED{_parse(D){let{status:F,ctx:Q}=this._processInputParams(D),B=(Y,J)=>{if(Y9(Y)||Y9(J))return zD;let X=C9(Y.value,J.value);if(!X.valid)return r(Q,{code:i.invalid_intersection_types}),zD;if(J9(Y)||J9(J))F.dirty();return{status:F.value,value:X.data}};if(Q.common.async)return Promise.all([this._def.left._parseAsync({data:Q.data,path:Q.path,parent:Q}),this._def.right._parseAsync({data:Q.data,path:Q.path,parent:Q})]).then(([Y,J])=>B(Y,J));else return B(this._def.left._parseSync({data:Q.data,path:Q.path,parent:Q}),this._def.right._parseSync({data:Q.data,path:Q.path,parent:Q}))}}S2.create=(D,F,Q)=>{return new S2({left:D,right:F,typeName:GD.ZodIntersection,...UD(Q)})};class EF extends ED{_parse(D){let{status:F,ctx:Q}=this._processInputParams(D);if(Q.parsedType!==t.array)return r(Q,{code:i.invalid_type,expected:t.array,received:Q.parsedType}),zD;if(Q.data.length<this._def.items.length)return r(Q,{code:i.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),zD;if(!this._def.rest&&Q.data.length>this._def.items.length)r(Q,{code:i.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),F.dirty();let Y=[...Q.data].map((J,X)=>{let C=this._def.items[X]||this._def.rest;if(!C)return null;return C._parse(new JF(Q,J,Q.path,X))}).filter((J)=>!!J);if(Q.common.async)return Promise.all(Y).then((J)=>{return G0.mergeArray(F,J)});else return G0.mergeArray(F,Y)}get items(){return this._def.items}rest(D){return new EF({...this._def,rest:D})}}EF.create=(D,F)=>{if(!Array.isArray(D))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new EF({items:D,typeName:GD.ZodTuple,rest:null,...UD(F)})};class k8 extends ED{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(D){let{status:F,ctx:Q}=this._processInputParams(D);if(Q.parsedType!==t.object)return r(Q,{code:i.invalid_type,expected:t.object,received:Q.parsedType}),zD;let B=[],Y=this._def.keyType,J=this._def.valueType;for(let X in Q.data)B.push({key:Y._parse(new JF(Q,X,Q.path,X)),value:J._parse(new JF(Q,Q.data[X],Q.path,X)),alwaysSet:X in Q.data});if(Q.common.async)return G0.mergeObjectAsync(F,B);else return G0.mergeObjectSync(F,B)}get element(){return this._def.valueType}static create(D,F,Q){if(F instanceof ED)return new k8({keyType:D,valueType:F,typeName:GD.ZodRecord,...UD(Q)});return new k8({keyType:QF.create(),valueType:D,typeName:GD.ZodRecord,...UD(F)})}}class b8 extends ED{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(D){let{status:F,ctx:Q}=this._processInputParams(D);if(Q.parsedType!==t.map)return r(Q,{code:i.invalid_type,expected:t.map,received:Q.parsedType}),zD;let B=this._def.keyType,Y=this._def.valueType,J=[...Q.data.entries()].map(([X,C],z)=>{return{key:B._parse(new JF(Q,X,Q.path,[z,"key"])),value:Y._parse(new JF(Q,C,Q.path,[z,"value"]))}});if(Q.common.async){let X=new Map;return Promise.resolve().then(async()=>{for(let C of J){let z=await C.key,W=await C.value;if(z.status==="aborted"||W.status==="aborted")return zD;if(z.status==="dirty"||W.status==="dirty")F.dirty();X.set(z.value,W.value)}return{status:F.value,value:X}})}else{let X=new Map;for(let C of J){let{key:z,value:W}=C;if(z.status==="aborted"||W.status==="aborted")return zD;if(z.status==="dirty"||W.status==="dirty")F.dirty();X.set(z.value,W.value)}return{status:F.value,value:X}}}}b8.create=(D,F,Q)=>{return new b8({valueType:F,keyType:D,typeName:GD.ZodMap,...UD(Q)})};class eF extends ED{_parse(D){let{status:F,ctx:Q}=this._processInputParams(D);if(Q.parsedType!==t.set)return r(Q,{code:i.invalid_type,expected:t.set,received:Q.parsedType}),zD;let B=this._def;if(B.minSize!==null){if(Q.data.size<B.minSize.value)r(Q,{code:i.too_small,minimum:B.minSize.value,type:"set",inclusive:!0,exact:!1,message:B.minSize.message}),F.dirty()}if(B.maxSize!==null){if(Q.data.size>B.maxSize.value)r(Q,{code:i.too_big,maximum:B.maxSize.value,type:"set",inclusive:!0,exact:!1,message:B.maxSize.message}),F.dirty()}let Y=this._def.valueType;function J(C){let z=new Set;for(let W of C){if(W.status==="aborted")return zD;if(W.status==="dirty")F.dirty();z.add(W.value)}return{status:F.value,value:z}}let X=[...Q.data.values()].map((C,z)=>Y._parse(new JF(Q,C,Q.path,z)));if(Q.common.async)return Promise.all(X).then((C)=>J(C));else return J(X)}min(D,F){return new eF({...this._def,minSize:{value:D,message:QD.toString(F)}})}max(D,F){return new eF({...this._def,maxSize:{value:D,message:QD.toString(F)}})}size(D,F){return this.min(D,F).max(D,F)}nonempty(D){return this.min(1,D)}}eF.create=(D,F)=>{return new eF({valueType:D,minSize:null,maxSize:null,typeName:GD.ZodSet,...UD(F)})};class _2 extends ED{constructor(){super(...arguments);this.validate=this.implement}_parse(D){let{ctx:F}=this._processInputParams(D);if(F.parsedType!==t.function)return r(F,{code:i.invalid_type,expected:t.function,received:F.parsedType}),zD;function Q(X,C){return i6({data:X,path:F.path,errorMaps:[F.common.contextualErrorMap,F.schemaErrorMap,n6(),O2].filter((z)=>!!z),issueData:{code:i.invalid_arguments,argumentsError:C}})}function B(X,C){return i6({data:X,path:F.path,errorMaps:[F.common.contextualErrorMap,F.schemaErrorMap,n6(),O2].filter((z)=>!!z),issueData:{code:i.invalid_return_type,returnTypeError:C}})}let Y={errorMap:F.common.contextualErrorMap},J=F.data;if(this._def.returns instanceof D2){let X=this;return M0(async function(...C){let z=new b0([]),W=await X._def.args.parseAsync(C,Y).catch((A)=>{throw z.addIssue(Q(C,A)),z}),G=await Reflect.apply(J,this,W);return await X._def.returns._def.type.parseAsync(G,Y).catch((A)=>{throw z.addIssue(B(G,A)),z})})}else{let X=this;return M0(function(...C){let z=X._def.args.safeParse(C,Y);if(!z.success)throw new b0([Q(C,z.error)]);let W=Reflect.apply(J,this,z.data),G=X._def.returns.safeParse(W,Y);if(!G.success)throw new b0([B(W,G.error)]);return G.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...D){return new _2({...this._def,args:EF.create(D).rest(uF.create())})}returns(D){return new _2({...this._def,returns:D})}implement(D){return this.parse(D)}strictImplement(D){return this.parse(D)}static create(D,F,Q){return new _2({args:D?D:EF.create([]).rest(uF.create()),returns:F||uF.create(),typeName:GD.ZodFunction,...UD(Q)})}}class k2 extends ED{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})}}k2.create=(D,F)=>{return new k2({getter:D,typeName:GD.ZodLazy,...UD(F)})};class b2 extends ED{_parse(D){if(D.data!==this._def.value){let F=this._getOrReturnCtx(D);return r(F,{received:F.data,code:i.invalid_literal,expected:this._def.value}),zD}return{status:"valid",value:D.data}}get value(){return this._def.value}}b2.create=(D,F)=>{return new b2({value:D,typeName:GD.ZodLiteral,...UD(F)})};function NQ(D,F){return new gF({values:D,typeName:GD.ZodEnum,...UD(F)})}class gF extends ED{_parse(D){if(typeof D.data!=="string"){let F=this._getOrReturnCtx(D),Q=this._def.values;return r(F,{expected:ND.joinValues(Q),received:F.parsedType,code:i.invalid_type}),zD}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(D.data)){let F=this._getOrReturnCtx(D),Q=this._def.values;return r(F,{received:F.data,code:i.invalid_enum_value,options:Q}),zD}return M0(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 gF.create(D,{...this._def,...F})}exclude(D,F=this._def){return gF.create(this.options.filter((Q)=>!D.includes(Q)),{...this._def,...F})}}gF.create=NQ;class v2 extends ED{_parse(D){let F=ND.getValidEnumValues(this._def.values),Q=this._getOrReturnCtx(D);if(Q.parsedType!==t.string&&Q.parsedType!==t.number){let B=ND.objectValues(F);return r(Q,{expected:ND.joinValues(B),received:Q.parsedType,code:i.invalid_type}),zD}if(!this._cache)this._cache=new Set(ND.getValidEnumValues(this._def.values));if(!this._cache.has(D.data)){let B=ND.objectValues(F);return r(Q,{received:Q.data,code:i.invalid_enum_value,options:B}),zD}return M0(D.data)}get enum(){return this._def.values}}v2.create=(D,F)=>{return new v2({values:D,typeName:GD.ZodNativeEnum,...UD(F)})};class D2 extends ED{unwrap(){return this._def.type}_parse(D){let{ctx:F}=this._processInputParams(D);if(F.parsedType!==t.promise&&F.common.async===!1)return r(F,{code:i.invalid_type,expected:t.promise,received:F.parsedType}),zD;let Q=F.parsedType===t.promise?F.data:Promise.resolve(F.data);return M0(Q.then((B)=>{return this._def.type.parseAsync(B,{path:F.path,errorMap:F.common.contextualErrorMap})}))}}D2.create=(D,F)=>{return new D2({type:D,typeName:GD.ZodPromise,...UD(F)})};class c0 extends ED{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===GD.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(D){let{status:F,ctx:Q}=this._processInputParams(D),B=this._def.effect||null,Y={addIssue:(J)=>{if(r(Q,J),J.fatal)F.abort();else F.dirty()},get path(){return Q.path}};if(Y.addIssue=Y.addIssue.bind(Y),B.type==="preprocess"){let J=B.transform(Q.data,Y);if(Q.common.async)return Promise.resolve(J).then(async(X)=>{if(F.value==="aborted")return zD;let C=await this._def.schema._parseAsync({data:X,path:Q.path,parent:Q});if(C.status==="aborted")return zD;if(C.status==="dirty")return R2(C.value);if(F.value==="dirty")return R2(C.value);return C});else{if(F.value==="aborted")return zD;let X=this._def.schema._parseSync({data:J,path:Q.path,parent:Q});if(X.status==="aborted")return zD;if(X.status==="dirty")return R2(X.value);if(F.value==="dirty")return R2(X.value);return X}}if(B.type==="refinement"){let J=(X)=>{let C=B.refinement(X,Y);if(Q.common.async)return Promise.resolve(C);if(C instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return X};if(Q.common.async===!1){let X=this._def.schema._parseSync({data:Q.data,path:Q.path,parent:Q});if(X.status==="aborted")return zD;if(X.status==="dirty")F.dirty();return J(X.value),{status:F.value,value:X.value}}else return this._def.schema._parseAsync({data:Q.data,path:Q.path,parent:Q}).then((X)=>{if(X.status==="aborted")return zD;if(X.status==="dirty")F.dirty();return J(X.value).then(()=>{return{status:F.value,value:X.value}})})}if(B.type==="transform")if(Q.common.async===!1){let J=this._def.schema._parseSync({data:Q.data,path:Q.path,parent:Q});if(!oF(J))return zD;let X=B.transform(J.value,Y);if(X instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:F.value,value:X}}else return this._def.schema._parseAsync({data:Q.data,path:Q.path,parent:Q}).then((J)=>{if(!oF(J))return zD;return Promise.resolve(B.transform(J.value,Y)).then((X)=>({status:F.value,value:X}))});ND.assertNever(B)}}c0.create=(D,F,Q)=>{return new c0({schema:D,typeName:GD.ZodEffects,effect:F,...UD(Q)})};c0.createWithPreprocess=(D,F,Q)=>{return new c0({schema:F,effect:{type:"preprocess",transform:D},typeName:GD.ZodEffects,...UD(Q)})};class YF extends ED{_parse(D){if(this._getType(D)===t.undefined)return M0(void 0);return this._def.innerType._parse(D)}unwrap(){return this._def.innerType}}YF.create=(D,F)=>{return new YF({innerType:D,typeName:GD.ZodOptional,...UD(F)})};class IF extends ED{_parse(D){if(this._getType(D)===t.null)return M0(null);return this._def.innerType._parse(D)}unwrap(){return this._def.innerType}}IF.create=(D,F)=>{return new IF({innerType:D,typeName:GD.ZodNullable,...UD(F)})};class x2 extends ED{_parse(D){let{ctx:F}=this._processInputParams(D),Q=F.data;if(F.parsedType===t.undefined)Q=this._def.defaultValue();return this._def.innerType._parse({data:Q,path:F.path,parent:F})}removeDefault(){return this._def.innerType}}x2.create=(D,F)=>{return new x2({innerType:D,typeName:GD.ZodDefault,defaultValue:typeof F.default==="function"?F.default:()=>F.default,...UD(F)})};class u2 extends ED{_parse(D){let{ctx:F}=this._processInputParams(D),Q={...F,common:{...F.common,issues:[]}},B=this._def.innerType._parse({data:Q.data,path:Q.path,parent:{...Q}});if(T8(B))return B.then((Y)=>{return{status:"valid",value:Y.status==="valid"?Y.value:this._def.catchValue({get error(){return new b0(Q.common.issues)},input:Q.data})}});else return{status:"valid",value:B.status==="valid"?B.value:this._def.catchValue({get error(){return new b0(Q.common.issues)},input:Q.data})}}removeCatch(){return this._def.innerType}}u2.create=(D,F)=>{return new u2({innerType:D,typeName:GD.ZodCatch,catchValue:typeof F.catch==="function"?F.catch:()=>F.catch,...UD(F)})};class v8 extends ED{_parse(D){if(this._getType(D)!==t.nan){let Q=this._getOrReturnCtx(D);return r(Q,{code:i.invalid_type,expected:t.nan,received:Q.parsedType}),zD}return{status:"valid",value:D.data}}}v8.create=(D)=>{return new v8({typeName:GD.ZodNaN,...UD(D)})};var $H=Symbol("zod_brand");class r6 extends ED{_parse(D){let{ctx:F}=this._processInputParams(D),Q=F.data;return this._def.type._parse({data:Q,path:F.path,parent:F})}unwrap(){return this._def.type}}class x8 extends ED{_parse(D){let{status:F,ctx:Q}=this._processInputParams(D);if(Q.common.async)return(async()=>{let Y=await this._def.in._parseAsync({data:Q.data,path:Q.path,parent:Q});if(Y.status==="aborted")return zD;if(Y.status==="dirty")return F.dirty(),R2(Y.value);else return this._def.out._parseAsync({data:Y.value,path:Q.path,parent:Q})})();else{let B=this._def.in._parseSync({data:Q.data,path:Q.path,parent:Q});if(B.status==="aborted")return zD;if(B.status==="dirty")return F.dirty(),{status:"dirty",value:B.value};else return this._def.out._parseSync({data:B.value,path:Q.path,parent:Q})}}static create(D,F){return new x8({in:D,out:F,typeName:GD.ZodPipeline})}}class y2 extends ED{_parse(D){let F=this._def.innerType._parse(D),Q=(B)=>{if(oF(B))B.value=Object.freeze(B.value);return B};return T8(F)?F.then((B)=>Q(B)):Q(F)}unwrap(){return this._def.innerType}}y2.create=(D,F)=>{return new y2({innerType:D,typeName:GD.ZodReadonly,...UD(F)})};function XQ(D,F){let Q=typeof D==="function"?D(F):typeof D==="string"?{message:D}:D;return typeof Q==="string"?{message:Q}:Q}function jQ(D,F={},Q){if(D)return tF.create().superRefine((B,Y)=>{let J=D(B);if(J instanceof Promise)return J.then((X)=>{if(!X){let C=XQ(F,B),z=C.fatal??Q??!0;Y.addIssue({code:"custom",...C,fatal:z})}});if(!J){let X=XQ(F,B),C=X.fatal??Q??!0;Y.addIssue({code:"custom",...X,fatal:C})}return});return tF.create()}var hH={object:$D.lazycreate},GD;(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"})(GD||(GD={}));var mH=(D,F={message:`Input not instance of ${D.name}`})=>jQ((Q)=>Q instanceof D,F),RQ=QF.create,_Q=yF.create,lH=v8.create,dH=fF.create,OQ=I2.create,cH=sF.create,pH=P8.create,nH=w2.create,iH=T2.create,aH=tF.create,rH=uF.create,oH=UF.create,sH=S8.create,tH=XF.create,eH=$D.create,DK=$D.strictCreate,FK=P2.create,BK=a6.create,QK=S2.create,XK=EF.create,YK=k8.create,JK=b8.create,CK=eF.create,WK=_2.create,zK=k2.create,GK=b2.create,qK=gF.create,HK=v2.create,KK=D2.create,YQ=c0.create,UK=YF.create,EK=IF.create,AK=c0.createWithPreprocess,ZK=x8.create,VK=()=>RQ().optional(),LK=()=>_Q().optional(),MK=()=>OQ().optional(),NK={string:(D)=>QF.create({...D,coerce:!0}),number:(D)=>yF.create({...D,coerce:!0}),boolean:(D)=>I2.create({...D,coerce:!0}),bigint:(D)=>fF.create({...D,coerce:!0}),date:(D)=>sF.create({...D,coerce:!0})},jK=zD;var o6="2.0",IQ=E.union([E.string(),E.number().int()]),wQ=E.string(),RK=E.object({progressToken:E.optional(IQ)}).passthrough(),p0=E.object({_meta:E.optional(RK)}).passthrough(),N0=E.object({method:E.string(),params:E.optional(p0)}),u8=E.object({_meta:E.optional(E.object({}).passthrough())}).passthrough(),AF=E.object({method:E.string(),params:E.optional(u8)}),n0=E.object({_meta:E.optional(E.object({}).passthrough())}).passthrough(),s6=E.union([E.string(),E.number().int()]),_K=E.object({jsonrpc:E.literal(o6),id:s6}).merge(N0).strict();var OK=E.object({jsonrpc:E.literal(o6)}).merge(AF).strict();var IK=E.object({jsonrpc:E.literal(o6),id:s6,result:n0}).strict();var JQ;(function(D){D[D.ConnectionClosed=-32000]="ConnectionClosed",D[D.RequestTimeout=-32001]="RequestTimeout",D[D.ParseError=-32700]="ParseError",D[D.InvalidRequest=-32600]="InvalidRequest",D[D.MethodNotFound=-32601]="MethodNotFound",D[D.InvalidParams=-32602]="InvalidParams",D[D.InternalError=-32603]="InternalError"})(JQ||(JQ={}));var wK=E.object({jsonrpc:E.literal(o6),id:s6,error:E.object({code:E.number().int(),message:E.string(),data:E.optional(E.unknown())})}).strict();var sM=E.union([_K,OK,IK,wK]),TQ=n0.strict(),PQ=AF.extend({method:E.literal("notifications/cancelled"),params:u8.extend({requestId:s6,reason:E.string().optional()})}),y8=E.object({name:E.string(),title:E.optional(E.string())}).passthrough(),SQ=y8.extend({version:E.string()}),TK=E.object({experimental:E.optional(E.object({}).passthrough()),sampling:E.optional(E.object({}).passthrough()),elicitation:E.optional(E.object({}).passthrough()),roots:E.optional(E.object({listChanged:E.optional(E.boolean())}).passthrough())}).passthrough(),PK=N0.extend({method:E.literal("initialize"),params:p0.extend({protocolVersion:E.string(),capabilities:TK,clientInfo:SQ})}),SK=E.object({experimental:E.optional(E.object({}).passthrough()),logging:E.optional(E.object({}).passthrough()),completions:E.optional(E.object({}).passthrough()),prompts:E.optional(E.object({listChanged:E.optional(E.boolean())}).passthrough()),resources:E.optional(E.object({subscribe:E.optional(E.boolean()),listChanged:E.optional(E.boolean())}).passthrough()),tools:E.optional(E.object({listChanged:E.optional(E.boolean())}).passthrough())}).passthrough(),kK=n0.extend({protocolVersion:E.string(),capabilities:SK,serverInfo:SQ,instructions:E.optional(E.string())}),bK=AF.extend({method:E.literal("notifications/initialized")}),kQ=N0.extend({method:E.literal("ping")}),vK=E.object({progress:E.number(),total:E.optional(E.number()),message:E.optional(E.string())}).passthrough(),bQ=AF.extend({method:E.literal("notifications/progress"),params:u8.merge(vK).extend({progressToken:IQ})}),t6=N0.extend({params:p0.extend({cursor:E.optional(wQ)}).optional()}),e6=n0.extend({nextCursor:E.optional(wQ)}),vQ=E.object({uri:E.string(),mimeType:E.optional(E.string()),_meta:E.optional(E.object({}).passthrough())}).passthrough(),xQ=vQ.extend({text:E.string()}),K9=E.string().refine((D)=>{try{return atob(D),!0}catch(F){return!1}},{message:"Invalid Base64 string"}),uQ=vQ.extend({blob:K9}),yQ=y8.extend({uri:E.string(),description:E.optional(E.string()),mimeType:E.optional(E.string()),_meta:E.optional(E.object({}).passthrough())}),xK=y8.extend({uriTemplate:E.string(),description:E.optional(E.string()),mimeType:E.optional(E.string()),_meta:E.optional(E.object({}).passthrough())}),uK=t6.extend({method:E.literal("resources/list")}),yK=e6.extend({resources:E.array(yQ)}),fK=t6.extend({method:E.literal("resources/templates/list")}),gK=e6.extend({resourceTemplates:E.array(xK)}),$K=N0.extend({method:E.literal("resources/read"),params:p0.extend({uri:E.string()})}),hK=n0.extend({contents:E.array(E.union([xQ,uQ]))}),mK=AF.extend({method:E.literal("notifications/resources/list_changed")}),lK=N0.extend({method:E.literal("resources/subscribe"),params:p0.extend({uri:E.string()})}),dK=N0.extend({method:E.literal("resources/unsubscribe"),params:p0.extend({uri:E.string()})}),cK=AF.extend({method:E.literal("notifications/resources/updated"),params:u8.extend({uri:E.string()})}),pK=E.object({name:E.string(),description:E.optional(E.string()),required:E.optional(E.boolean())}).passthrough(),nK=y8.extend({description:E.optional(E.string()),arguments:E.optional(E.array(pK)),_meta:E.optional(E.object({}).passthrough())}),iK=t6.extend({method:E.literal("prompts/list")}),aK=e6.extend({prompts:E.array(nK)}),rK=N0.extend({method:E.literal("prompts/get"),params:p0.extend({name:E.string(),arguments:E.optional(E.record(E.string()))})}),U9=E.object({type:E.literal("text"),text:E.string(),_meta:E.optional(E.object({}).passthrough())}).passthrough(),E9=E.object({type:E.literal("image"),data:K9,mimeType:E.string(),_meta:E.optional(E.object({}).passthrough())}).passthrough(),A9=E.object({type:E.literal("audio"),data:K9,mimeType:E.string(),_meta:E.optional(E.object({}).passthrough())}).passthrough(),oK=E.object({type:E.literal("resource"),resource:E.union([xQ,uQ]),_meta:E.optional(E.object({}).passthrough())}).passthrough(),sK=yQ.extend({type:E.literal("resource_link")}),fQ=E.union([U9,E9,A9,sK,oK]),tK=E.object({role:E.enum(["user","assistant"]),content:fQ}).passthrough(),eK=n0.extend({description:E.optional(E.string()),messages:E.array(tK)}),DU=AF.extend({method:E.literal("notifications/prompts/list_changed")}),FU=E.object({title:E.optional(E.string()),readOnlyHint:E.optional(E.boolean()),destructiveHint:E.optional(E.boolean()),idempotentHint:E.optional(E.boolean()),openWorldHint:E.optional(E.boolean())}).passthrough(),BU=y8.extend({description:E.optional(E.string()),inputSchema:E.object({type:E.literal("object"),properties:E.optional(E.object({}).passthrough()),required:E.optional(E.array(E.string()))}).passthrough(),outputSchema:E.optional(E.object({type:E.literal("object"),properties:E.optional(E.object({}).passthrough()),required:E.optional(E.array(E.string()))}).passthrough()),annotations:E.optional(FU),_meta:E.optional(E.object({}).passthrough())}),QU=t6.extend({method:E.literal("tools/list")}),XU=e6.extend({tools:E.array(BU)}),gQ=n0.extend({content:E.array(fQ).default([]),structuredContent:E.object({}).passthrough().optional(),isError:E.optional(E.boolean())}),tM=gQ.or(n0.extend({toolResult:E.unknown()})),YU=N0.extend({method:E.literal("tools/call"),params:p0.extend({name:E.string(),arguments:E.optional(E.record(E.unknown()))})}),JU=AF.extend({method:E.literal("notifications/tools/list_changed")}),$Q=E.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),CU=N0.extend({method:E.literal("logging/setLevel"),params:p0.extend({level:$Q})}),WU=AF.extend({method:E.literal("notifications/message"),params:u8.extend({level:$Q,logger:E.optional(E.string()),data:E.unknown()})}),zU=E.object({name:E.string().optional()}).passthrough(),GU=E.object({hints:E.optional(E.array(zU)),costPriority:E.optional(E.number().min(0).max(1)),speedPriority:E.optional(E.number().min(0).max(1)),intelligencePriority:E.optional(E.number().min(0).max(1))}).passthrough(),qU=E.object({role:E.enum(["user","assistant"]),content:E.union([U9,E9,A9])}).passthrough(),HU=N0.extend({method:E.literal("sampling/createMessage"),params:p0.extend({messages:E.array(qU),systemPrompt:E.optional(E.string()),includeContext:E.optional(E.enum(["none","thisServer","allServers"])),temperature:E.optional(E.number()),maxTokens:E.number().int(),stopSequences:E.optional(E.array(E.string())),metadata:E.optional(E.object({}).passthrough()),modelPreferences:E.optional(GU)})}),KU=n0.extend({model:E.string(),stopReason:E.optional(E.enum(["endTurn","stopSequence","maxTokens"]).or(E.string())),role:E.enum(["user","assistant"]),content:E.discriminatedUnion("type",[U9,E9,A9])}),UU=E.object({type:E.literal("boolean"),title:E.optional(E.string()),description:E.optional(E.string()),default:E.optional(E.boolean())}).passthrough(),EU=E.object({type:E.literal("string"),title:E.optional(E.string()),description:E.optional(E.string()),minLength:E.optional(E.number()),maxLength:E.optional(E.number()),format:E.optional(E.enum(["email","uri","date","date-time"]))}).passthrough(),AU=E.object({type:E.enum(["number","integer"]),title:E.optional(E.string()),description:E.optional(E.string()),minimum:E.optional(E.number()),maximum:E.optional(E.number())}).passthrough(),ZU=E.object({type:E.literal("string"),title:E.optional(E.string()),description:E.optional(E.string()),enum:E.array(E.string()),enumNames:E.optional(E.array(E.string()))}).passthrough(),VU=E.union([UU,EU,AU,ZU]),LU=N0.extend({method:E.literal("elicitation/create"),params:p0.extend({message:E.string(),requestedSchema:E.object({type:E.literal("object"),properties:E.record(E.string(),VU),required:E.optional(E.array(E.string()))}).passthrough()})}),MU=n0.extend({action:E.enum(["accept","decline","cancel"]),content:E.optional(E.record(E.string(),E.unknown()))}),NU=E.object({type:E.literal("ref/resource"),uri:E.string()}).passthrough(),jU=E.object({type:E.literal("ref/prompt"),name:E.string()}).passthrough(),RU=N0.extend({method:E.literal("completion/complete"),params:p0.extend({ref:E.union([jU,NU]),argument:E.object({name:E.string(),value:E.string()}).passthrough(),context:E.optional(E.object({arguments:E.optional(E.record(E.string(),E.string()))}))})}),_U=n0.extend({completion:E.object({values:E.array(E.string()).max(100),total:E.optional(E.number().int()),hasMore:E.optional(E.boolean())}).passthrough()}),OU=E.object({uri:E.string().startsWith("file://"),name:E.optional(E.string()),_meta:E.optional(E.object({}).passthrough())}).passthrough(),IU=N0.extend({method:E.literal("roots/list")}),wU=n0.extend({roots:E.array(OU)}),TU=AF.extend({method:E.literal("notifications/roots/list_changed")}),eM=E.union([kQ,PK,RU,CU,rK,iK,uK,fK,$K,lK,dK,YU,QU]),DN=E.union([PQ,bQ,bK,TU]),FN=E.union([TQ,KU,MU,wU]),BN=E.union([kQ,HU,LU,IU]),QN=E.union([PQ,bQ,WU,cK,mK,JU,DU]),XN=E.union([TQ,kK,_U,eK,aK,yK,gK,hK,gQ,XU]);var YN=jq(QH(),1);var JN=Symbol("Let zodToJsonSchema decide on which parser to use");var CN=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");var W9;(function(D){D.Completable="McpCompletable"})(W9||(W9={}));class z9 extends ED{_parse(D){let{ctx:F}=this._processInputParams(D),Q=F.data;return this._def.type._parse({data:Q,path:F.path,parent:F})}unwrap(){return this._def.type}}z9.create=(D,F)=>{return new z9({type:D,typeName:W9.Completable,complete:F.complete,...PU(F)})};function PU(D){if(!D)return{};let{errorMap:F,invalid_type_error:Q,required_error:B,description:Y}=D;if(F&&(Q||B))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(F)return{errorMap:F,description:Y};return{errorMap:(X,C)=>{var z,W;let{message:G}=D;if(X.code==="invalid_enum_value")return{message:G!==null&&G!==void 0?G:C.defaultError};if(typeof C.data==="undefined")return{message:(z=G!==null&&G!==void 0?G:B)!==null&&z!==void 0?z:C.defaultError};if(X.code!=="invalid_type")return{message:C.defaultError};return{message:(W=G!==null&&G!==void 0?G:Q)!==null&&W!==void 0?W:C.defaultError}},description:Y}}function f8({prompt:D,options:F}){let{systemPrompt:Q,settingSources:B,...Y}=F??{},J,X;if(Q===void 0)J="";else if(typeof Q==="string")J=Q;else if(Q.type==="preset")X=Q.append;let C=Y.pathToClaudeCodeExecutable;if(!C){let z=XH(import.meta.url),W=FQ(z,"..");C=FQ(W,"cli.js")}return process.env.CLAUDE_AGENT_SDK_VERSION="0.1.5",KH({prompt:D,options:{...Y,pathToClaudeCodeExecutable:C,customSystemPrompt:J,appendSystemPrompt:X,settingSources:B??[]}})}import dD from"fs";import j0 from"path";import{execSync as hQ}from"child_process";async function lQ(D){try{if(D.update){await mQ(D);return}let F=j0.join(process.cwd(),"package.json"),Q="unknown",B="unknown";if(dD.existsSync(F))try{let O=JSON.parse(dD.readFileSync(F,"utf-8"));Q=O.version||"unknown",B=O.name||j0.basename(process.cwd())}catch(O){B=j0.basename(process.cwd())}let Y=[],J=D.historical||1;if(D.generate)Y.push(D.generate),J=1,console.log(`\uD83C\uDFAF Generating changelog for specific version: ${D.generate}`);else if(Q!=="unknown"){let O=Q.split(".");if(O.length===3){let y=parseInt(O[0]),x=parseInt(O[1]),w=parseInt(O[2]);for(let S=0;S<J;S++)if(Y.push(`${y}.${x}.${w}`),w===0){if(x===0)break;x--,w=9}else w--}}if(Y.length===0)console.log("⚠️ Could not determine versions to search. Please check package.json"),process.exit(1);let X=j0.join(process.env.HOME||process.env.USERPROFILE||"",".claude-mem","projects"),C=j0.join(X,`${B}-changelog.jsonl`),z=!1;if(dD.existsSync(C)){let O=dD.readFileSync(C,"utf-8").split(`
480
- `).filter((y)=>y.trim());for(let y of O)try{if(JSON.parse(y).version===Q)z=!0}catch(x){}if(!D.historical&&!D.generate&&J===1){if(z)console.log(`❌ Version ${Q} already has changelog entries.`),console.log(`
478
+ `))}if(this.sdkMcpTransports.size>0&&this.firstResultReceivedPromise){let Q;if(await Promise.race([this.firstResultReceivedPromise.then(()=>{if(Q)clearTimeout(Q)}),new Promise((B)=>{Q=setTimeout(()=>{B()},1e4)})]),Q)clearTimeout(Q)}this.transport.endInput()}catch(F){if(!(F instanceof j2))throw F}}handleHookCallbacks(D,F,Q,B){let Y=this.hookCallbacks.get(D);if(!Y)throw new Error(`No hook callback found for ID: ${D}`);return Y(F,Q,{signal:B})}sendMcpServerMessageToCli(D,F){if("id"in F&&F.id!==null&&F.id!==void 0){let Q=`${D}:${F.id}`,B=this.pendingMcpResponses.get(Q);if(B){B.resolve(F),this.pendingMcpResponses.delete(Q);return}}throw new Error("No pending request found")}handleMcpControlRequest(D,F,Q){let B="id"in F.message?F.message.id:null,Y=`${D}:${B}`;return new Promise((J,X)=>{let C=null,W=()=>{if(C)clearTimeout(C);this.pendingMcpResponses.delete(Y)},z=(q)=>{W(),J(q)},G=(q)=>{W(),X(q)};if(this.pendingMcpResponses.set(Y,{resolve:z,reject:G}),Q.onmessage)Q.onmessage(F.message);else{W(),X(new Error("No message handler registered"));return}C=setTimeout(()=>{if(this.pendingMcpResponses.has(Y))W(),X(new Error("Request timeout"))},30000)})}}function KH({prompt:D,options:{abortController:F=qQ(),additionalDirectories:Q=[],agents:B,allowedTools:Y=[],appendSystemPrompt:J,canUseTool:X,continue:C,customSystemPrompt:W,cwd:z,disallowedTools:G=[],env:q,executable:A=HQ()?"bun":"node",executableArgs:U=[],extraArgs:Z={},fallbackModel:H,forkSession:V,hooks:j,includePartialMessages:L,maxTurns:R,mcpServers:k,model:b,pathToClaudeCodeExecutable:I,permissionMode:u="default",permissionPromptToolName:f,resume:O,resumeSessionAt:y,settingSources:x,stderr:w,strictMcpConfig:S}={}}){if(!q)q={...process.env};if(!q.CLAUDE_CODE_ENTRYPOINT)q.CLAUDE_CODE_ENTRYPOINT="sdk-ts";if(!I)throw new Error("pathToClaudeCodeExecutable is required");let g={},d=new Map;if(k)for(let[o,XD]of Object.entries(k))if(XD.type==="sdk"&&"instance"in XD)d.set(o,XD.instance),g[o]={type:"sdk",name:o};else g[o]=XD;let n=typeof D==="string",a=new KQ({abortController:F,additionalDirectories:Q,agents:B,cwd:z,executable:A,executableArgs:U,extraArgs:Z,pathToClaudeCodeExecutable:I,env:q,forkSession:V,stderr:w,customSystemPrompt:W,appendSystemPrompt:J,maxTurns:R,model:b,fallbackModel:H,permissionMode:u,permissionPromptToolName:f,continueConversation:C,resume:O,resumeSessionAt:y,settingSources:x,allowedTools:Y,disallowedTools:G,mcpServers:g,strictMcpConfig:S,canUseTool:!!X,hooks:!!j,includePartialMessages:L}),DD=new AQ(a,n,X,j,F,d);if(typeof D==="string")a.write(JSON.stringify({type:"user",session_id:"",message:{role:"user",content:[{type:"text",text:D}]},parent_tool_use_id:null})+`
479
+ `);else DD.streamInput(D);return DD}var E={};Rq(E,{void:()=>sH,util:()=>ND,unknown:()=>rH,union:()=>FK,undefined:()=>nH,tuple:()=>XK,transformer:()=>YQ,symbol:()=>pH,string:()=>RQ,strictObject:()=>DK,setErrorMap:()=>AH,set:()=>CK,record:()=>YK,quotelessJson:()=>UH,promise:()=>KK,preprocess:()=>AK,pipeline:()=>ZK,ostring:()=>VK,optional:()=>UK,onumber:()=>LK,oboolean:()=>MK,objectUtil:()=>X9,object:()=>eH,number:()=>_Q,nullable:()=>EK,null:()=>iH,never:()=>oH,nativeEnum:()=>HK,nan:()=>lH,map:()=>JK,makeIssue:()=>i6,literal:()=>GK,lazy:()=>zK,late:()=>hH,isValid:()=>oF,isDirty:()=>J9,isAsync:()=>T8,isAborted:()=>Y9,intersection:()=>QK,instanceof:()=>mH,getParsedType:()=>OF,getErrorMap:()=>n6,function:()=>WK,enum:()=>qK,effect:()=>YQ,discriminatedUnion:()=>BK,defaultErrorMap:()=>O2,datetimeRegex:()=>MQ,date:()=>cH,custom:()=>jQ,coerce:()=>NK,boolean:()=>OQ,bigint:()=>dH,array:()=>tH,any:()=>aH,addIssueToContext:()=>r,ZodVoid:()=>S8,ZodUnknown:()=>uF,ZodUnion:()=>P2,ZodUndefined:()=>w2,ZodType:()=>ED,ZodTuple:()=>EF,ZodTransformer:()=>c0,ZodSymbol:()=>P8,ZodString:()=>QF,ZodSet:()=>eF,ZodSchema:()=>ED,ZodRecord:()=>k8,ZodReadonly:()=>y2,ZodPromise:()=>D2,ZodPipeline:()=>x8,ZodParsedType:()=>t,ZodOptional:()=>YF,ZodObject:()=>$D,ZodNumber:()=>yF,ZodNullable:()=>IF,ZodNull:()=>T2,ZodNever:()=>UF,ZodNativeEnum:()=>v2,ZodNaN:()=>v8,ZodMap:()=>b8,ZodLiteral:()=>b2,ZodLazy:()=>k2,ZodIssueCode:()=>i,ZodIntersection:()=>S2,ZodFunction:()=>_2,ZodFirstPartyTypeKind:()=>GD,ZodError:()=>b0,ZodEnum:()=>gF,ZodEffects:()=>c0,ZodDiscriminatedUnion:()=>a6,ZodDefault:()=>x2,ZodDate:()=>sF,ZodCatch:()=>u2,ZodBranded:()=>r6,ZodBoolean:()=>I2,ZodBigInt:()=>fF,ZodArray:()=>XF,ZodAny:()=>tF,Schema:()=>ED,ParseStatus:()=>G0,OK:()=>M0,NEVER:()=>jK,INVALID:()=>zD,EMPTY_PATH:()=>ZH,DIRTY:()=>R2,BRAND:()=>$H});var ND;(function(D){D.assertEqual=(Y)=>{};function F(Y){}D.assertIs=F;function Q(Y){throw new Error}D.assertNever=Q,D.arrayToEnum=(Y)=>{let J={};for(let X of Y)J[X]=X;return J},D.getValidEnumValues=(Y)=>{let J=D.objectKeys(Y).filter((C)=>typeof Y[Y[C]]!=="number"),X={};for(let C of J)X[C]=Y[C];return D.objectValues(X)},D.objectValues=(Y)=>{return D.objectKeys(Y).map(function(J){return Y[J]})},D.objectKeys=typeof Object.keys==="function"?(Y)=>Object.keys(Y):(Y)=>{let J=[];for(let X in Y)if(Object.prototype.hasOwnProperty.call(Y,X))J.push(X);return J},D.find=(Y,J)=>{for(let X of Y)if(J(X))return X;return},D.isInteger=typeof Number.isInteger==="function"?(Y)=>Number.isInteger(Y):(Y)=>typeof Y==="number"&&Number.isFinite(Y)&&Math.floor(Y)===Y;function B(Y,J=" | "){return Y.map((X)=>typeof X==="string"?`'${X}'`:X).join(J)}D.joinValues=B,D.jsonStringifyReplacer=(Y,J)=>{if(typeof J==="bigint")return J.toString();return J}})(ND||(ND={}));var X9;(function(D){D.mergeShapes=(F,Q)=>{return{...F,...Q}}})(X9||(X9={}));var t=ND.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),OF=(D)=>{switch(typeof D){case"undefined":return t.undefined;case"string":return t.string;case"number":return Number.isNaN(D)?t.nan:t.number;case"boolean":return t.boolean;case"function":return t.function;case"bigint":return t.bigint;case"symbol":return t.symbol;case"object":if(Array.isArray(D))return t.array;if(D===null)return t.null;if(D.then&&typeof D.then==="function"&&D.catch&&typeof D.catch==="function")return t.promise;if(typeof Map!=="undefined"&&D instanceof Map)return t.map;if(typeof Set!=="undefined"&&D instanceof Set)return t.set;if(typeof Date!=="undefined"&&D instanceof Date)return t.date;return t.object;default:return t.unknown}},i=ND.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"]),UH=(D)=>{return JSON.stringify(D,null,2).replace(/"([^"]+)":/g,"$1:")};class b0 extends Error{get errors(){return this.issues}constructor(D){super();this.issues=[],this.addIssue=(Q)=>{this.issues=[...this.issues,Q]},this.addIssues=(Q=[])=>{this.issues=[...this.issues,...Q]};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(Y){return Y.message},Q={_errors:[]},B=(Y)=>{for(let J of Y.issues)if(J.code==="invalid_union")J.unionErrors.map(B);else if(J.code==="invalid_return_type")B(J.returnTypeError);else if(J.code==="invalid_arguments")B(J.argumentsError);else if(J.path.length===0)Q._errors.push(F(J));else{let X=Q,C=0;while(C<J.path.length){let W=J.path[C];if(C!==J.path.length-1)X[W]=X[W]||{_errors:[]};else X[W]=X[W]||{_errors:[]},X[W]._errors.push(F(J));X=X[W],C++}}};return B(this),Q}static assert(D){if(!(D instanceof b0))throw new Error(`Not a ZodError: ${D}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ND.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(D=(F)=>F.message){let F={},Q=[];for(let B of this.issues)if(B.path.length>0){let Y=B.path[0];F[Y]=F[Y]||[],F[Y].push(D(B))}else Q.push(D(B));return{formErrors:Q,fieldErrors:F}}get formErrors(){return this.flatten()}}b0.create=(D)=>{return new b0(D)};var EH=(D,F)=>{let Q;switch(D.code){case i.invalid_type:if(D.received===t.undefined)Q="Required";else Q=`Expected ${D.expected}, received ${D.received}`;break;case i.invalid_literal:Q=`Invalid literal value, expected ${JSON.stringify(D.expected,ND.jsonStringifyReplacer)}`;break;case i.unrecognized_keys:Q=`Unrecognized key(s) in object: ${ND.joinValues(D.keys,", ")}`;break;case i.invalid_union:Q="Invalid input";break;case i.invalid_union_discriminator:Q=`Invalid discriminator value. Expected ${ND.joinValues(D.options)}`;break;case i.invalid_enum_value:Q=`Invalid enum value. Expected ${ND.joinValues(D.options)}, received '${D.received}'`;break;case i.invalid_arguments:Q="Invalid function arguments";break;case i.invalid_return_type:Q="Invalid function return type";break;case i.invalid_date:Q="Invalid date";break;case i.invalid_string:if(typeof D.validation==="object")if("includes"in D.validation){if(Q=`Invalid input: must include "${D.validation.includes}"`,typeof D.validation.position==="number")Q=`${Q} at one or more positions greater than or equal to ${D.validation.position}`}else if("startsWith"in D.validation)Q=`Invalid input: must start with "${D.validation.startsWith}"`;else if("endsWith"in D.validation)Q=`Invalid input: must end with "${D.validation.endsWith}"`;else ND.assertNever(D.validation);else if(D.validation!=="regex")Q=`Invalid ${D.validation}`;else Q="Invalid";break;case i.too_small:if(D.type==="array")Q=`Array must contain ${D.exact?"exactly":D.inclusive?"at least":"more than"} ${D.minimum} element(s)`;else if(D.type==="string")Q=`String must contain ${D.exact?"exactly":D.inclusive?"at least":"over"} ${D.minimum} character(s)`;else if(D.type==="number")Q=`Number must be ${D.exact?"exactly equal to ":D.inclusive?"greater than or equal to ":"greater than "}${D.minimum}`;else if(D.type==="bigint")Q=`Number must be ${D.exact?"exactly equal to ":D.inclusive?"greater than or equal to ":"greater than "}${D.minimum}`;else if(D.type==="date")Q=`Date must be ${D.exact?"exactly equal to ":D.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(D.minimum))}`;else Q="Invalid input";break;case i.too_big:if(D.type==="array")Q=`Array must contain ${D.exact?"exactly":D.inclusive?"at most":"less than"} ${D.maximum} element(s)`;else if(D.type==="string")Q=`String must contain ${D.exact?"exactly":D.inclusive?"at most":"under"} ${D.maximum} character(s)`;else if(D.type==="number")Q=`Number must be ${D.exact?"exactly":D.inclusive?"less than or equal to":"less than"} ${D.maximum}`;else if(D.type==="bigint")Q=`BigInt must be ${D.exact?"exactly":D.inclusive?"less than or equal to":"less than"} ${D.maximum}`;else if(D.type==="date")Q=`Date must be ${D.exact?"exactly":D.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(D.maximum))}`;else Q="Invalid input";break;case i.custom:Q="Invalid input";break;case i.invalid_intersection_types:Q="Intersection results could not be merged";break;case i.not_multiple_of:Q=`Number must be a multiple of ${D.multipleOf}`;break;case i.not_finite:Q="Number must be finite";break;default:Q=F.defaultError,ND.assertNever(D)}return{message:Q}},O2=EH,ZQ=O2;function AH(D){ZQ=D}function n6(){return ZQ}var i6=(D)=>{let{data:F,path:Q,errorMaps:B,issueData:Y}=D,J=[...Q,...Y.path||[]],X={...Y,path:J};if(Y.message!==void 0)return{...Y,path:J,message:Y.message};let C="",W=B.filter((z)=>!!z).slice().reverse();for(let z of W)C=z(X,{data:F,defaultError:C}).message;return{...Y,path:J,message:C}},ZH=[];function r(D,F){let Q=n6(),B=i6({issueData:F,data:D.data,path:D.path,errorMaps:[D.common.contextualErrorMap,D.schemaErrorMap,Q,Q===O2?void 0:O2].filter((Y)=>!!Y)});D.common.issues.push(B)}class G0{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 Q=[];for(let B of F){if(B.status==="aborted")return zD;if(B.status==="dirty")D.dirty();Q.push(B.value)}return{status:D.value,value:Q}}static async mergeObjectAsync(D,F){let Q=[];for(let B of F){let Y=await B.key,J=await B.value;Q.push({key:Y,value:J})}return G0.mergeObjectSync(D,Q)}static mergeObjectSync(D,F){let Q={};for(let B of F){let{key:Y,value:J}=B;if(Y.status==="aborted")return zD;if(J.status==="aborted")return zD;if(Y.status==="dirty")D.dirty();if(J.status==="dirty")D.dirty();if(Y.value!=="__proto__"&&(typeof J.value!=="undefined"||B.alwaysSet))Q[Y.value]=J.value}return{status:D.value,value:Q}}}var zD=Object.freeze({status:"aborted"}),R2=(D)=>({status:"dirty",value:D}),M0=(D)=>({status:"valid",value:D}),Y9=(D)=>D.status==="aborted",J9=(D)=>D.status==="dirty",oF=(D)=>D.status==="valid",T8=(D)=>typeof Promise!=="undefined"&&D instanceof Promise,QD;(function(D){D.errToObj=(F)=>typeof F==="string"?{message:F}:F||{},D.toString=(F)=>typeof F==="string"?F:F?.message})(QD||(QD={}));class JF{constructor(D,F,Q,B){this._cachedPath=[],this.parent=D,this.data=F,this._path=Q,this._key=B}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}var QQ=(D,F)=>{if(oF(F))return{success:!0,data:F.value};else{if(!D.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let Q=new b0(D.common.issues);return this._error=Q,this._error}}}};function UD(D){if(!D)return{};let{errorMap:F,invalid_type_error:Q,required_error:B,description:Y}=D;if(F&&(Q||B))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(F)return{errorMap:F,description:Y};return{errorMap:(X,C)=>{let{message:W}=D;if(X.code==="invalid_enum_value")return{message:W??C.defaultError};if(typeof C.data==="undefined")return{message:W??B??C.defaultError};if(X.code!=="invalid_type")return{message:C.defaultError};return{message:W??Q??C.defaultError}},description:Y}}class ED{get description(){return this._def.description}_getType(D){return OF(D.data)}_getOrReturnCtx(D,F){return F||{common:D.parent.common,data:D.data,parsedType:OF(D.data),schemaErrorMap:this._def.errorMap,path:D.path,parent:D.parent}}_processInputParams(D){return{status:new G0,ctx:{common:D.parent.common,data:D.data,parsedType:OF(D.data),schemaErrorMap:this._def.errorMap,path:D.path,parent:D.parent}}}_parseSync(D){let F=this._parse(D);if(T8(F))throw new Error("Synchronous parse encountered promise.");return F}_parseAsync(D){let F=this._parse(D);return Promise.resolve(F)}parse(D,F){let Q=this.safeParse(D,F);if(Q.success)return Q.data;throw Q.error}safeParse(D,F){let Q={common:{issues:[],async:F?.async??!1,contextualErrorMap:F?.errorMap},path:F?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:D,parsedType:OF(D)},B=this._parseSync({data:D,path:Q.path,parent:Q});return QQ(Q,B)}"~validate"(D){let F={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:D,parsedType:OF(D)};if(!this["~standard"].async)try{let Q=this._parseSync({data:D,path:[],parent:F});return oF(Q)?{value:Q.value}:{issues:F.common.issues}}catch(Q){if(Q?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;F.common={issues:[],async:!0}}return this._parseAsync({data:D,path:[],parent:F}).then((Q)=>oF(Q)?{value:Q.value}:{issues:F.common.issues})}async parseAsync(D,F){let Q=await this.safeParseAsync(D,F);if(Q.success)return Q.data;throw Q.error}async safeParseAsync(D,F){let Q={common:{issues:[],contextualErrorMap:F?.errorMap,async:!0},path:F?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:D,parsedType:OF(D)},B=this._parse({data:D,path:Q.path,parent:Q}),Y=await(T8(B)?B:Promise.resolve(B));return QQ(Q,Y)}refine(D,F){let Q=(B)=>{if(typeof F==="string"||typeof F==="undefined")return{message:F};else if(typeof F==="function")return F(B);else return F};return this._refinement((B,Y)=>{let J=D(B),X=()=>Y.addIssue({code:i.custom,...Q(B)});if(typeof Promise!=="undefined"&&J instanceof Promise)return J.then((C)=>{if(!C)return X(),!1;else return!0});if(!J)return X(),!1;else return!0})}refinement(D,F){return this._refinement((Q,B)=>{if(!D(Q))return B.addIssue(typeof F==="function"?F(Q,B):F),!1;else return!0})}_refinement(D){return new c0({schema:this,typeName:GD.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 YF.create(this,this._def)}nullable(){return IF.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return XF.create(this)}promise(){return D2.create(this,this._def)}or(D){return P2.create([this,D],this._def)}and(D){return S2.create(this,D,this._def)}transform(D){return new c0({...UD(this._def),schema:this,typeName:GD.ZodEffects,effect:{type:"transform",transform:D}})}default(D){let F=typeof D==="function"?D:()=>D;return new x2({...UD(this._def),innerType:this,defaultValue:F,typeName:GD.ZodDefault})}brand(){return new r6({typeName:GD.ZodBranded,type:this,...UD(this._def)})}catch(D){let F=typeof D==="function"?D:()=>D;return new u2({...UD(this._def),innerType:this,catchValue:F,typeName:GD.ZodCatch})}describe(D){return new this.constructor({...this._def,description:D})}pipe(D){return x8.create(this,D)}readonly(){return y2.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var VH=/^c[^\s-]{8,}$/i,LH=/^[0-9a-z]+$/,MH=/^[0-9A-HJKMNP-TV-Z]{26}$/i,NH=/^[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,jH=/^[a-z0-9_-]{21}$/i,RH=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,_H=/^[-+]?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)?)??$/,OH=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,IH="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",B9,wH=/^(?:(?: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])$/,TH=/^(?:(?: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])$/,PH=/^(([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]))$/,SH=/^(([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])$/,kH=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,bH=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,VQ="((\\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])))",vH=new RegExp(`^${VQ}$`);function LQ(D){let F="[0-5]\\d";if(D.precision)F=`${F}\\.\\d{${D.precision}}`;else if(D.precision==null)F=`${F}(\\.\\d+)?`;let Q=D.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${F})${Q}`}function xH(D){return new RegExp(`^${LQ(D)}$`)}function MQ(D){let F=`${VQ}T${LQ(D)}`,Q=[];if(Q.push(D.local?"Z?":"Z"),D.offset)Q.push("([+-]\\d{2}:?\\d{2})");return F=`${F}(${Q.join("|")})`,new RegExp(`^${F}$`)}function uH(D,F){if((F==="v4"||!F)&&wH.test(D))return!0;if((F==="v6"||!F)&&PH.test(D))return!0;return!1}function yH(D,F){if(!RH.test(D))return!1;try{let[Q]=D.split(".");if(!Q)return!1;let B=Q.replace(/-/g,"+").replace(/_/g,"/").padEnd(Q.length+(4-Q.length%4)%4,"="),Y=JSON.parse(atob(B));if(typeof Y!=="object"||Y===null)return!1;if("typ"in Y&&Y?.typ!=="JWT")return!1;if(!Y.alg)return!1;if(F&&Y.alg!==F)return!1;return!0}catch{return!1}}function fH(D,F){if((F==="v4"||!F)&&TH.test(D))return!0;if((F==="v6"||!F)&&SH.test(D))return!0;return!1}class QF extends ED{_parse(D){if(this._def.coerce)D.data=String(D.data);if(this._getType(D)!==t.string){let Y=this._getOrReturnCtx(D);return r(Y,{code:i.invalid_type,expected:t.string,received:Y.parsedType}),zD}let Q=new G0,B=void 0;for(let Y of this._def.checks)if(Y.kind==="min"){if(D.data.length<Y.value)B=this._getOrReturnCtx(D,B),r(B,{code:i.too_small,minimum:Y.value,type:"string",inclusive:!0,exact:!1,message:Y.message}),Q.dirty()}else if(Y.kind==="max"){if(D.data.length>Y.value)B=this._getOrReturnCtx(D,B),r(B,{code:i.too_big,maximum:Y.value,type:"string",inclusive:!0,exact:!1,message:Y.message}),Q.dirty()}else if(Y.kind==="length"){let J=D.data.length>Y.value,X=D.data.length<Y.value;if(J||X){if(B=this._getOrReturnCtx(D,B),J)r(B,{code:i.too_big,maximum:Y.value,type:"string",inclusive:!0,exact:!0,message:Y.message});else if(X)r(B,{code:i.too_small,minimum:Y.value,type:"string",inclusive:!0,exact:!0,message:Y.message});Q.dirty()}}else if(Y.kind==="email"){if(!OH.test(D.data))B=this._getOrReturnCtx(D,B),r(B,{validation:"email",code:i.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="emoji"){if(!B9)B9=new RegExp(IH,"u");if(!B9.test(D.data))B=this._getOrReturnCtx(D,B),r(B,{validation:"emoji",code:i.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="uuid"){if(!NH.test(D.data))B=this._getOrReturnCtx(D,B),r(B,{validation:"uuid",code:i.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="nanoid"){if(!jH.test(D.data))B=this._getOrReturnCtx(D,B),r(B,{validation:"nanoid",code:i.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="cuid"){if(!VH.test(D.data))B=this._getOrReturnCtx(D,B),r(B,{validation:"cuid",code:i.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="cuid2"){if(!LH.test(D.data))B=this._getOrReturnCtx(D,B),r(B,{validation:"cuid2",code:i.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="ulid"){if(!MH.test(D.data))B=this._getOrReturnCtx(D,B),r(B,{validation:"ulid",code:i.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="url")try{new URL(D.data)}catch{B=this._getOrReturnCtx(D,B),r(B,{validation:"url",code:i.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="regex"){if(Y.regex.lastIndex=0,!Y.regex.test(D.data))B=this._getOrReturnCtx(D,B),r(B,{validation:"regex",code:i.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="trim")D.data=D.data.trim();else if(Y.kind==="includes"){if(!D.data.includes(Y.value,Y.position))B=this._getOrReturnCtx(D,B),r(B,{code:i.invalid_string,validation:{includes:Y.value,position:Y.position},message:Y.message}),Q.dirty()}else if(Y.kind==="toLowerCase")D.data=D.data.toLowerCase();else if(Y.kind==="toUpperCase")D.data=D.data.toUpperCase();else if(Y.kind==="startsWith"){if(!D.data.startsWith(Y.value))B=this._getOrReturnCtx(D,B),r(B,{code:i.invalid_string,validation:{startsWith:Y.value},message:Y.message}),Q.dirty()}else if(Y.kind==="endsWith"){if(!D.data.endsWith(Y.value))B=this._getOrReturnCtx(D,B),r(B,{code:i.invalid_string,validation:{endsWith:Y.value},message:Y.message}),Q.dirty()}else if(Y.kind==="datetime"){if(!MQ(Y).test(D.data))B=this._getOrReturnCtx(D,B),r(B,{code:i.invalid_string,validation:"datetime",message:Y.message}),Q.dirty()}else if(Y.kind==="date"){if(!vH.test(D.data))B=this._getOrReturnCtx(D,B),r(B,{code:i.invalid_string,validation:"date",message:Y.message}),Q.dirty()}else if(Y.kind==="time"){if(!xH(Y).test(D.data))B=this._getOrReturnCtx(D,B),r(B,{code:i.invalid_string,validation:"time",message:Y.message}),Q.dirty()}else if(Y.kind==="duration"){if(!_H.test(D.data))B=this._getOrReturnCtx(D,B),r(B,{validation:"duration",code:i.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="ip"){if(!uH(D.data,Y.version))B=this._getOrReturnCtx(D,B),r(B,{validation:"ip",code:i.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="jwt"){if(!yH(D.data,Y.alg))B=this._getOrReturnCtx(D,B),r(B,{validation:"jwt",code:i.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="cidr"){if(!fH(D.data,Y.version))B=this._getOrReturnCtx(D,B),r(B,{validation:"cidr",code:i.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="base64"){if(!kH.test(D.data))B=this._getOrReturnCtx(D,B),r(B,{validation:"base64",code:i.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="base64url"){if(!bH.test(D.data))B=this._getOrReturnCtx(D,B),r(B,{validation:"base64url",code:i.invalid_string,message:Y.message}),Q.dirty()}else ND.assertNever(Y);return{status:Q.value,value:D.data}}_regex(D,F,Q){return this.refinement((B)=>D.test(B),{validation:F,code:i.invalid_string,...QD.errToObj(Q)})}_addCheck(D){return new QF({...this._def,checks:[...this._def.checks,D]})}email(D){return this._addCheck({kind:"email",...QD.errToObj(D)})}url(D){return this._addCheck({kind:"url",...QD.errToObj(D)})}emoji(D){return this._addCheck({kind:"emoji",...QD.errToObj(D)})}uuid(D){return this._addCheck({kind:"uuid",...QD.errToObj(D)})}nanoid(D){return this._addCheck({kind:"nanoid",...QD.errToObj(D)})}cuid(D){return this._addCheck({kind:"cuid",...QD.errToObj(D)})}cuid2(D){return this._addCheck({kind:"cuid2",...QD.errToObj(D)})}ulid(D){return this._addCheck({kind:"ulid",...QD.errToObj(D)})}base64(D){return this._addCheck({kind:"base64",...QD.errToObj(D)})}base64url(D){return this._addCheck({kind:"base64url",...QD.errToObj(D)})}jwt(D){return this._addCheck({kind:"jwt",...QD.errToObj(D)})}ip(D){return this._addCheck({kind:"ip",...QD.errToObj(D)})}cidr(D){return this._addCheck({kind:"cidr",...QD.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==="undefined"?null:D?.precision,offset:D?.offset??!1,local:D?.local??!1,...QD.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==="undefined"?null:D?.precision,...QD.errToObj(D?.message)})}duration(D){return this._addCheck({kind:"duration",...QD.errToObj(D)})}regex(D,F){return this._addCheck({kind:"regex",regex:D,...QD.errToObj(F)})}includes(D,F){return this._addCheck({kind:"includes",value:D,position:F?.position,...QD.errToObj(F?.message)})}startsWith(D,F){return this._addCheck({kind:"startsWith",value:D,...QD.errToObj(F)})}endsWith(D,F){return this._addCheck({kind:"endsWith",value:D,...QD.errToObj(F)})}min(D,F){return this._addCheck({kind:"min",value:D,...QD.errToObj(F)})}max(D,F){return this._addCheck({kind:"max",value:D,...QD.errToObj(F)})}length(D,F){return this._addCheck({kind:"length",value:D,...QD.errToObj(F)})}nonempty(D){return this.min(1,QD.errToObj(D))}trim(){return new QF({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new QF({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new QF({...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}}QF.create=(D)=>{return new QF({checks:[],typeName:GD.ZodString,coerce:D?.coerce??!1,...UD(D)})};function gH(D,F){let Q=(D.toString().split(".")[1]||"").length,B=(F.toString().split(".")[1]||"").length,Y=Q>B?Q:B,J=Number.parseInt(D.toFixed(Y).replace(".","")),X=Number.parseInt(F.toFixed(Y).replace(".",""));return J%X/10**Y}class yF extends ED{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)!==t.number){let Y=this._getOrReturnCtx(D);return r(Y,{code:i.invalid_type,expected:t.number,received:Y.parsedType}),zD}let Q=void 0,B=new G0;for(let Y of this._def.checks)if(Y.kind==="int"){if(!ND.isInteger(D.data))Q=this._getOrReturnCtx(D,Q),r(Q,{code:i.invalid_type,expected:"integer",received:"float",message:Y.message}),B.dirty()}else if(Y.kind==="min"){if(Y.inclusive?D.data<Y.value:D.data<=Y.value)Q=this._getOrReturnCtx(D,Q),r(Q,{code:i.too_small,minimum:Y.value,type:"number",inclusive:Y.inclusive,exact:!1,message:Y.message}),B.dirty()}else if(Y.kind==="max"){if(Y.inclusive?D.data>Y.value:D.data>=Y.value)Q=this._getOrReturnCtx(D,Q),r(Q,{code:i.too_big,maximum:Y.value,type:"number",inclusive:Y.inclusive,exact:!1,message:Y.message}),B.dirty()}else if(Y.kind==="multipleOf"){if(gH(D.data,Y.value)!==0)Q=this._getOrReturnCtx(D,Q),r(Q,{code:i.not_multiple_of,multipleOf:Y.value,message:Y.message}),B.dirty()}else if(Y.kind==="finite"){if(!Number.isFinite(D.data))Q=this._getOrReturnCtx(D,Q),r(Q,{code:i.not_finite,message:Y.message}),B.dirty()}else ND.assertNever(Y);return{status:B.value,value:D.data}}gte(D,F){return this.setLimit("min",D,!0,QD.toString(F))}gt(D,F){return this.setLimit("min",D,!1,QD.toString(F))}lte(D,F){return this.setLimit("max",D,!0,QD.toString(F))}lt(D,F){return this.setLimit("max",D,!1,QD.toString(F))}setLimit(D,F,Q,B){return new yF({...this._def,checks:[...this._def.checks,{kind:D,value:F,inclusive:Q,message:QD.toString(B)}]})}_addCheck(D){return new yF({...this._def,checks:[...this._def.checks,D]})}int(D){return this._addCheck({kind:"int",message:QD.toString(D)})}positive(D){return this._addCheck({kind:"min",value:0,inclusive:!1,message:QD.toString(D)})}negative(D){return this._addCheck({kind:"max",value:0,inclusive:!1,message:QD.toString(D)})}nonpositive(D){return this._addCheck({kind:"max",value:0,inclusive:!0,message:QD.toString(D)})}nonnegative(D){return this._addCheck({kind:"min",value:0,inclusive:!0,message:QD.toString(D)})}multipleOf(D,F){return this._addCheck({kind:"multipleOf",value:D,message:QD.toString(F)})}finite(D){return this._addCheck({kind:"finite",message:QD.toString(D)})}safe(D){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:QD.toString(D)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:QD.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"&&ND.isInteger(D.value))}get isFinite(){let D=null,F=null;for(let Q of this._def.checks)if(Q.kind==="finite"||Q.kind==="int"||Q.kind==="multipleOf")return!0;else if(Q.kind==="min"){if(F===null||Q.value>F)F=Q.value}else if(Q.kind==="max"){if(D===null||Q.value<D)D=Q.value}return Number.isFinite(F)&&Number.isFinite(D)}}yF.create=(D)=>{return new yF({checks:[],typeName:GD.ZodNumber,coerce:D?.coerce||!1,...UD(D)})};class fF extends ED{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)!==t.bigint)return this._getInvalidInput(D);let Q=void 0,B=new G0;for(let Y of this._def.checks)if(Y.kind==="min"){if(Y.inclusive?D.data<Y.value:D.data<=Y.value)Q=this._getOrReturnCtx(D,Q),r(Q,{code:i.too_small,type:"bigint",minimum:Y.value,inclusive:Y.inclusive,message:Y.message}),B.dirty()}else if(Y.kind==="max"){if(Y.inclusive?D.data>Y.value:D.data>=Y.value)Q=this._getOrReturnCtx(D,Q),r(Q,{code:i.too_big,type:"bigint",maximum:Y.value,inclusive:Y.inclusive,message:Y.message}),B.dirty()}else if(Y.kind==="multipleOf"){if(D.data%Y.value!==BigInt(0))Q=this._getOrReturnCtx(D,Q),r(Q,{code:i.not_multiple_of,multipleOf:Y.value,message:Y.message}),B.dirty()}else ND.assertNever(Y);return{status:B.value,value:D.data}}_getInvalidInput(D){let F=this._getOrReturnCtx(D);return r(F,{code:i.invalid_type,expected:t.bigint,received:F.parsedType}),zD}gte(D,F){return this.setLimit("min",D,!0,QD.toString(F))}gt(D,F){return this.setLimit("min",D,!1,QD.toString(F))}lte(D,F){return this.setLimit("max",D,!0,QD.toString(F))}lt(D,F){return this.setLimit("max",D,!1,QD.toString(F))}setLimit(D,F,Q,B){return new fF({...this._def,checks:[...this._def.checks,{kind:D,value:F,inclusive:Q,message:QD.toString(B)}]})}_addCheck(D){return new fF({...this._def,checks:[...this._def.checks,D]})}positive(D){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:QD.toString(D)})}negative(D){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:QD.toString(D)})}nonpositive(D){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:QD.toString(D)})}nonnegative(D){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:QD.toString(D)})}multipleOf(D,F){return this._addCheck({kind:"multipleOf",value:D,message:QD.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}}fF.create=(D)=>{return new fF({checks:[],typeName:GD.ZodBigInt,coerce:D?.coerce??!1,...UD(D)})};class I2 extends ED{_parse(D){if(this._def.coerce)D.data=Boolean(D.data);if(this._getType(D)!==t.boolean){let Q=this._getOrReturnCtx(D);return r(Q,{code:i.invalid_type,expected:t.boolean,received:Q.parsedType}),zD}return M0(D.data)}}I2.create=(D)=>{return new I2({typeName:GD.ZodBoolean,coerce:D?.coerce||!1,...UD(D)})};class sF extends ED{_parse(D){if(this._def.coerce)D.data=new Date(D.data);if(this._getType(D)!==t.date){let Y=this._getOrReturnCtx(D);return r(Y,{code:i.invalid_type,expected:t.date,received:Y.parsedType}),zD}if(Number.isNaN(D.data.getTime())){let Y=this._getOrReturnCtx(D);return r(Y,{code:i.invalid_date}),zD}let Q=new G0,B=void 0;for(let Y of this._def.checks)if(Y.kind==="min"){if(D.data.getTime()<Y.value)B=this._getOrReturnCtx(D,B),r(B,{code:i.too_small,message:Y.message,inclusive:!0,exact:!1,minimum:Y.value,type:"date"}),Q.dirty()}else if(Y.kind==="max"){if(D.data.getTime()>Y.value)B=this._getOrReturnCtx(D,B),r(B,{code:i.too_big,message:Y.message,inclusive:!0,exact:!1,maximum:Y.value,type:"date"}),Q.dirty()}else ND.assertNever(Y);return{status:Q.value,value:new Date(D.data.getTime())}}_addCheck(D){return new sF({...this._def,checks:[...this._def.checks,D]})}min(D,F){return this._addCheck({kind:"min",value:D.getTime(),message:QD.toString(F)})}max(D,F){return this._addCheck({kind:"max",value:D.getTime(),message:QD.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}}sF.create=(D)=>{return new sF({checks:[],coerce:D?.coerce||!1,typeName:GD.ZodDate,...UD(D)})};class P8 extends ED{_parse(D){if(this._getType(D)!==t.symbol){let Q=this._getOrReturnCtx(D);return r(Q,{code:i.invalid_type,expected:t.symbol,received:Q.parsedType}),zD}return M0(D.data)}}P8.create=(D)=>{return new P8({typeName:GD.ZodSymbol,...UD(D)})};class w2 extends ED{_parse(D){if(this._getType(D)!==t.undefined){let Q=this._getOrReturnCtx(D);return r(Q,{code:i.invalid_type,expected:t.undefined,received:Q.parsedType}),zD}return M0(D.data)}}w2.create=(D)=>{return new w2({typeName:GD.ZodUndefined,...UD(D)})};class T2 extends ED{_parse(D){if(this._getType(D)!==t.null){let Q=this._getOrReturnCtx(D);return r(Q,{code:i.invalid_type,expected:t.null,received:Q.parsedType}),zD}return M0(D.data)}}T2.create=(D)=>{return new T2({typeName:GD.ZodNull,...UD(D)})};class tF extends ED{constructor(){super(...arguments);this._any=!0}_parse(D){return M0(D.data)}}tF.create=(D)=>{return new tF({typeName:GD.ZodAny,...UD(D)})};class uF extends ED{constructor(){super(...arguments);this._unknown=!0}_parse(D){return M0(D.data)}}uF.create=(D)=>{return new uF({typeName:GD.ZodUnknown,...UD(D)})};class UF extends ED{_parse(D){let F=this._getOrReturnCtx(D);return r(F,{code:i.invalid_type,expected:t.never,received:F.parsedType}),zD}}UF.create=(D)=>{return new UF({typeName:GD.ZodNever,...UD(D)})};class S8 extends ED{_parse(D){if(this._getType(D)!==t.undefined){let Q=this._getOrReturnCtx(D);return r(Q,{code:i.invalid_type,expected:t.void,received:Q.parsedType}),zD}return M0(D.data)}}S8.create=(D)=>{return new S8({typeName:GD.ZodVoid,...UD(D)})};class XF extends ED{_parse(D){let{ctx:F,status:Q}=this._processInputParams(D),B=this._def;if(F.parsedType!==t.array)return r(F,{code:i.invalid_type,expected:t.array,received:F.parsedType}),zD;if(B.exactLength!==null){let J=F.data.length>B.exactLength.value,X=F.data.length<B.exactLength.value;if(J||X)r(F,{code:J?i.too_big:i.too_small,minimum:X?B.exactLength.value:void 0,maximum:J?B.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:B.exactLength.message}),Q.dirty()}if(B.minLength!==null){if(F.data.length<B.minLength.value)r(F,{code:i.too_small,minimum:B.minLength.value,type:"array",inclusive:!0,exact:!1,message:B.minLength.message}),Q.dirty()}if(B.maxLength!==null){if(F.data.length>B.maxLength.value)r(F,{code:i.too_big,maximum:B.maxLength.value,type:"array",inclusive:!0,exact:!1,message:B.maxLength.message}),Q.dirty()}if(F.common.async)return Promise.all([...F.data].map((J,X)=>{return B.type._parseAsync(new JF(F,J,F.path,X))})).then((J)=>{return G0.mergeArray(Q,J)});let Y=[...F.data].map((J,X)=>{return B.type._parseSync(new JF(F,J,F.path,X))});return G0.mergeArray(Q,Y)}get element(){return this._def.type}min(D,F){return new XF({...this._def,minLength:{value:D,message:QD.toString(F)}})}max(D,F){return new XF({...this._def,maxLength:{value:D,message:QD.toString(F)}})}length(D,F){return new XF({...this._def,exactLength:{value:D,message:QD.toString(F)}})}nonempty(D){return this.min(1,D)}}XF.create=(D,F)=>{return new XF({type:D,minLength:null,maxLength:null,exactLength:null,typeName:GD.ZodArray,...UD(F)})};function N2(D){if(D instanceof $D){let F={};for(let Q in D.shape){let B=D.shape[Q];F[Q]=YF.create(N2(B))}return new $D({...D._def,shape:()=>F})}else if(D instanceof XF)return new XF({...D._def,type:N2(D.element)});else if(D instanceof YF)return YF.create(N2(D.unwrap()));else if(D instanceof IF)return IF.create(N2(D.unwrap()));else if(D instanceof EF)return EF.create(D.items.map((F)=>N2(F)));else return D}class $D extends ED{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=ND.objectKeys(D);return this._cached={shape:D,keys:F},this._cached}_parse(D){if(this._getType(D)!==t.object){let W=this._getOrReturnCtx(D);return r(W,{code:i.invalid_type,expected:t.object,received:W.parsedType}),zD}let{status:Q,ctx:B}=this._processInputParams(D),{shape:Y,keys:J}=this._getCached(),X=[];if(!(this._def.catchall instanceof UF&&this._def.unknownKeys==="strip")){for(let W in B.data)if(!J.includes(W))X.push(W)}let C=[];for(let W of J){let z=Y[W],G=B.data[W];C.push({key:{status:"valid",value:W},value:z._parse(new JF(B,G,B.path,W)),alwaysSet:W in B.data})}if(this._def.catchall instanceof UF){let W=this._def.unknownKeys;if(W==="passthrough")for(let z of X)C.push({key:{status:"valid",value:z},value:{status:"valid",value:B.data[z]}});else if(W==="strict"){if(X.length>0)r(B,{code:i.unrecognized_keys,keys:X}),Q.dirty()}else if(W==="strip");else throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let W=this._def.catchall;for(let z of X){let G=B.data[z];C.push({key:{status:"valid",value:z},value:W._parse(new JF(B,G,B.path,z)),alwaysSet:z in B.data})}}if(B.common.async)return Promise.resolve().then(async()=>{let W=[];for(let z of C){let G=await z.key,q=await z.value;W.push({key:G,value:q,alwaysSet:z.alwaysSet})}return W}).then((W)=>{return G0.mergeObjectSync(Q,W)});else return G0.mergeObjectSync(Q,C)}get shape(){return this._def.shape()}strict(D){return QD.errToObj,new $D({...this._def,unknownKeys:"strict",...D!==void 0?{errorMap:(F,Q)=>{let B=this._def.errorMap?.(F,Q).message??Q.defaultError;if(F.code==="unrecognized_keys")return{message:QD.errToObj(D).message??B};return{message:B}}}:{}})}strip(){return new $D({...this._def,unknownKeys:"strip"})}passthrough(){return new $D({...this._def,unknownKeys:"passthrough"})}extend(D){return new $D({...this._def,shape:()=>({...this._def.shape(),...D})})}merge(D){return new $D({unknownKeys:D._def.unknownKeys,catchall:D._def.catchall,shape:()=>({...this._def.shape(),...D._def.shape()}),typeName:GD.ZodObject})}setKey(D,F){return this.augment({[D]:F})}catchall(D){return new $D({...this._def,catchall:D})}pick(D){let F={};for(let Q of ND.objectKeys(D))if(D[Q]&&this.shape[Q])F[Q]=this.shape[Q];return new $D({...this._def,shape:()=>F})}omit(D){let F={};for(let Q of ND.objectKeys(this.shape))if(!D[Q])F[Q]=this.shape[Q];return new $D({...this._def,shape:()=>F})}deepPartial(){return N2(this)}partial(D){let F={};for(let Q of ND.objectKeys(this.shape)){let B=this.shape[Q];if(D&&!D[Q])F[Q]=B;else F[Q]=B.optional()}return new $D({...this._def,shape:()=>F})}required(D){let F={};for(let Q of ND.objectKeys(this.shape))if(D&&!D[Q])F[Q]=this.shape[Q];else{let Y=this.shape[Q];while(Y instanceof YF)Y=Y._def.innerType;F[Q]=Y}return new $D({...this._def,shape:()=>F})}keyof(){return NQ(ND.objectKeys(this.shape))}}$D.create=(D,F)=>{return new $D({shape:()=>D,unknownKeys:"strip",catchall:UF.create(),typeName:GD.ZodObject,...UD(F)})};$D.strictCreate=(D,F)=>{return new $D({shape:()=>D,unknownKeys:"strict",catchall:UF.create(),typeName:GD.ZodObject,...UD(F)})};$D.lazycreate=(D,F)=>{return new $D({shape:D,unknownKeys:"strip",catchall:UF.create(),typeName:GD.ZodObject,...UD(F)})};class P2 extends ED{_parse(D){let{ctx:F}=this._processInputParams(D),Q=this._def.options;function B(Y){for(let X of Y)if(X.result.status==="valid")return X.result;for(let X of Y)if(X.result.status==="dirty")return F.common.issues.push(...X.ctx.common.issues),X.result;let J=Y.map((X)=>new b0(X.ctx.common.issues));return r(F,{code:i.invalid_union,unionErrors:J}),zD}if(F.common.async)return Promise.all(Q.map(async(Y)=>{let J={...F,common:{...F.common,issues:[]},parent:null};return{result:await Y._parseAsync({data:F.data,path:F.path,parent:J}),ctx:J}})).then(B);else{let Y=void 0,J=[];for(let C of Q){let W={...F,common:{...F.common,issues:[]},parent:null},z=C._parseSync({data:F.data,path:F.path,parent:W});if(z.status==="valid")return z;else if(z.status==="dirty"&&!Y)Y={result:z,ctx:W};if(W.common.issues.length)J.push(W.common.issues)}if(Y)return F.common.issues.push(...Y.ctx.common.issues),Y.result;let X=J.map((C)=>new b0(C));return r(F,{code:i.invalid_union,unionErrors:X}),zD}}get options(){return this._def.options}}P2.create=(D,F)=>{return new P2({options:D,typeName:GD.ZodUnion,...UD(F)})};var _F=(D)=>{if(D instanceof k2)return _F(D.schema);else if(D instanceof c0)return _F(D.innerType());else if(D instanceof b2)return[D.value];else if(D instanceof gF)return D.options;else if(D instanceof v2)return ND.objectValues(D.enum);else if(D instanceof x2)return _F(D._def.innerType);else if(D instanceof w2)return[void 0];else if(D instanceof T2)return[null];else if(D instanceof YF)return[void 0,..._F(D.unwrap())];else if(D instanceof IF)return[null,..._F(D.unwrap())];else if(D instanceof r6)return _F(D.unwrap());else if(D instanceof y2)return _F(D.unwrap());else if(D instanceof u2)return _F(D._def.innerType);else return[]};class a6 extends ED{_parse(D){let{ctx:F}=this._processInputParams(D);if(F.parsedType!==t.object)return r(F,{code:i.invalid_type,expected:t.object,received:F.parsedType}),zD;let Q=this.discriminator,B=F.data[Q],Y=this.optionsMap.get(B);if(!Y)return r(F,{code:i.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[Q]}),zD;if(F.common.async)return Y._parseAsync({data:F.data,path:F.path,parent:F});else return Y._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,Q){let B=new Map;for(let Y of F){let J=_F(Y.shape[D]);if(!J.length)throw new Error(`A discriminator value for key \`${D}\` could not be extracted from all schema options`);for(let X of J){if(B.has(X))throw new Error(`Discriminator property ${String(D)} has duplicate value ${String(X)}`);B.set(X,Y)}}return new a6({typeName:GD.ZodDiscriminatedUnion,discriminator:D,options:F,optionsMap:B,...UD(Q)})}}function C9(D,F){let Q=OF(D),B=OF(F);if(D===F)return{valid:!0,data:D};else if(Q===t.object&&B===t.object){let Y=ND.objectKeys(F),J=ND.objectKeys(D).filter((C)=>Y.indexOf(C)!==-1),X={...D,...F};for(let C of J){let W=C9(D[C],F[C]);if(!W.valid)return{valid:!1};X[C]=W.data}return{valid:!0,data:X}}else if(Q===t.array&&B===t.array){if(D.length!==F.length)return{valid:!1};let Y=[];for(let J=0;J<D.length;J++){let X=D[J],C=F[J],W=C9(X,C);if(!W.valid)return{valid:!1};Y.push(W.data)}return{valid:!0,data:Y}}else if(Q===t.date&&B===t.date&&+D===+F)return{valid:!0,data:D};else return{valid:!1}}class S2 extends ED{_parse(D){let{status:F,ctx:Q}=this._processInputParams(D),B=(Y,J)=>{if(Y9(Y)||Y9(J))return zD;let X=C9(Y.value,J.value);if(!X.valid)return r(Q,{code:i.invalid_intersection_types}),zD;if(J9(Y)||J9(J))F.dirty();return{status:F.value,value:X.data}};if(Q.common.async)return Promise.all([this._def.left._parseAsync({data:Q.data,path:Q.path,parent:Q}),this._def.right._parseAsync({data:Q.data,path:Q.path,parent:Q})]).then(([Y,J])=>B(Y,J));else return B(this._def.left._parseSync({data:Q.data,path:Q.path,parent:Q}),this._def.right._parseSync({data:Q.data,path:Q.path,parent:Q}))}}S2.create=(D,F,Q)=>{return new S2({left:D,right:F,typeName:GD.ZodIntersection,...UD(Q)})};class EF extends ED{_parse(D){let{status:F,ctx:Q}=this._processInputParams(D);if(Q.parsedType!==t.array)return r(Q,{code:i.invalid_type,expected:t.array,received:Q.parsedType}),zD;if(Q.data.length<this._def.items.length)return r(Q,{code:i.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),zD;if(!this._def.rest&&Q.data.length>this._def.items.length)r(Q,{code:i.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),F.dirty();let Y=[...Q.data].map((J,X)=>{let C=this._def.items[X]||this._def.rest;if(!C)return null;return C._parse(new JF(Q,J,Q.path,X))}).filter((J)=>!!J);if(Q.common.async)return Promise.all(Y).then((J)=>{return G0.mergeArray(F,J)});else return G0.mergeArray(F,Y)}get items(){return this._def.items}rest(D){return new EF({...this._def,rest:D})}}EF.create=(D,F)=>{if(!Array.isArray(D))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new EF({items:D,typeName:GD.ZodTuple,rest:null,...UD(F)})};class k8 extends ED{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(D){let{status:F,ctx:Q}=this._processInputParams(D);if(Q.parsedType!==t.object)return r(Q,{code:i.invalid_type,expected:t.object,received:Q.parsedType}),zD;let B=[],Y=this._def.keyType,J=this._def.valueType;for(let X in Q.data)B.push({key:Y._parse(new JF(Q,X,Q.path,X)),value:J._parse(new JF(Q,Q.data[X],Q.path,X)),alwaysSet:X in Q.data});if(Q.common.async)return G0.mergeObjectAsync(F,B);else return G0.mergeObjectSync(F,B)}get element(){return this._def.valueType}static create(D,F,Q){if(F instanceof ED)return new k8({keyType:D,valueType:F,typeName:GD.ZodRecord,...UD(Q)});return new k8({keyType:QF.create(),valueType:D,typeName:GD.ZodRecord,...UD(F)})}}class b8 extends ED{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(D){let{status:F,ctx:Q}=this._processInputParams(D);if(Q.parsedType!==t.map)return r(Q,{code:i.invalid_type,expected:t.map,received:Q.parsedType}),zD;let B=this._def.keyType,Y=this._def.valueType,J=[...Q.data.entries()].map(([X,C],W)=>{return{key:B._parse(new JF(Q,X,Q.path,[W,"key"])),value:Y._parse(new JF(Q,C,Q.path,[W,"value"]))}});if(Q.common.async){let X=new Map;return Promise.resolve().then(async()=>{for(let C of J){let W=await C.key,z=await C.value;if(W.status==="aborted"||z.status==="aborted")return zD;if(W.status==="dirty"||z.status==="dirty")F.dirty();X.set(W.value,z.value)}return{status:F.value,value:X}})}else{let X=new Map;for(let C of J){let{key:W,value:z}=C;if(W.status==="aborted"||z.status==="aborted")return zD;if(W.status==="dirty"||z.status==="dirty")F.dirty();X.set(W.value,z.value)}return{status:F.value,value:X}}}}b8.create=(D,F,Q)=>{return new b8({valueType:F,keyType:D,typeName:GD.ZodMap,...UD(Q)})};class eF extends ED{_parse(D){let{status:F,ctx:Q}=this._processInputParams(D);if(Q.parsedType!==t.set)return r(Q,{code:i.invalid_type,expected:t.set,received:Q.parsedType}),zD;let B=this._def;if(B.minSize!==null){if(Q.data.size<B.minSize.value)r(Q,{code:i.too_small,minimum:B.minSize.value,type:"set",inclusive:!0,exact:!1,message:B.minSize.message}),F.dirty()}if(B.maxSize!==null){if(Q.data.size>B.maxSize.value)r(Q,{code:i.too_big,maximum:B.maxSize.value,type:"set",inclusive:!0,exact:!1,message:B.maxSize.message}),F.dirty()}let Y=this._def.valueType;function J(C){let W=new Set;for(let z of C){if(z.status==="aborted")return zD;if(z.status==="dirty")F.dirty();W.add(z.value)}return{status:F.value,value:W}}let X=[...Q.data.values()].map((C,W)=>Y._parse(new JF(Q,C,Q.path,W)));if(Q.common.async)return Promise.all(X).then((C)=>J(C));else return J(X)}min(D,F){return new eF({...this._def,minSize:{value:D,message:QD.toString(F)}})}max(D,F){return new eF({...this._def,maxSize:{value:D,message:QD.toString(F)}})}size(D,F){return this.min(D,F).max(D,F)}nonempty(D){return this.min(1,D)}}eF.create=(D,F)=>{return new eF({valueType:D,minSize:null,maxSize:null,typeName:GD.ZodSet,...UD(F)})};class _2 extends ED{constructor(){super(...arguments);this.validate=this.implement}_parse(D){let{ctx:F}=this._processInputParams(D);if(F.parsedType!==t.function)return r(F,{code:i.invalid_type,expected:t.function,received:F.parsedType}),zD;function Q(X,C){return i6({data:X,path:F.path,errorMaps:[F.common.contextualErrorMap,F.schemaErrorMap,n6(),O2].filter((W)=>!!W),issueData:{code:i.invalid_arguments,argumentsError:C}})}function B(X,C){return i6({data:X,path:F.path,errorMaps:[F.common.contextualErrorMap,F.schemaErrorMap,n6(),O2].filter((W)=>!!W),issueData:{code:i.invalid_return_type,returnTypeError:C}})}let Y={errorMap:F.common.contextualErrorMap},J=F.data;if(this._def.returns instanceof D2){let X=this;return M0(async function(...C){let W=new b0([]),z=await X._def.args.parseAsync(C,Y).catch((A)=>{throw W.addIssue(Q(C,A)),W}),G=await Reflect.apply(J,this,z);return await X._def.returns._def.type.parseAsync(G,Y).catch((A)=>{throw W.addIssue(B(G,A)),W})})}else{let X=this;return M0(function(...C){let W=X._def.args.safeParse(C,Y);if(!W.success)throw new b0([Q(C,W.error)]);let z=Reflect.apply(J,this,W.data),G=X._def.returns.safeParse(z,Y);if(!G.success)throw new b0([B(z,G.error)]);return G.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...D){return new _2({...this._def,args:EF.create(D).rest(uF.create())})}returns(D){return new _2({...this._def,returns:D})}implement(D){return this.parse(D)}strictImplement(D){return this.parse(D)}static create(D,F,Q){return new _2({args:D?D:EF.create([]).rest(uF.create()),returns:F||uF.create(),typeName:GD.ZodFunction,...UD(Q)})}}class k2 extends ED{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})}}k2.create=(D,F)=>{return new k2({getter:D,typeName:GD.ZodLazy,...UD(F)})};class b2 extends ED{_parse(D){if(D.data!==this._def.value){let F=this._getOrReturnCtx(D);return r(F,{received:F.data,code:i.invalid_literal,expected:this._def.value}),zD}return{status:"valid",value:D.data}}get value(){return this._def.value}}b2.create=(D,F)=>{return new b2({value:D,typeName:GD.ZodLiteral,...UD(F)})};function NQ(D,F){return new gF({values:D,typeName:GD.ZodEnum,...UD(F)})}class gF extends ED{_parse(D){if(typeof D.data!=="string"){let F=this._getOrReturnCtx(D),Q=this._def.values;return r(F,{expected:ND.joinValues(Q),received:F.parsedType,code:i.invalid_type}),zD}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(D.data)){let F=this._getOrReturnCtx(D),Q=this._def.values;return r(F,{received:F.data,code:i.invalid_enum_value,options:Q}),zD}return M0(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 gF.create(D,{...this._def,...F})}exclude(D,F=this._def){return gF.create(this.options.filter((Q)=>!D.includes(Q)),{...this._def,...F})}}gF.create=NQ;class v2 extends ED{_parse(D){let F=ND.getValidEnumValues(this._def.values),Q=this._getOrReturnCtx(D);if(Q.parsedType!==t.string&&Q.parsedType!==t.number){let B=ND.objectValues(F);return r(Q,{expected:ND.joinValues(B),received:Q.parsedType,code:i.invalid_type}),zD}if(!this._cache)this._cache=new Set(ND.getValidEnumValues(this._def.values));if(!this._cache.has(D.data)){let B=ND.objectValues(F);return r(Q,{received:Q.data,code:i.invalid_enum_value,options:B}),zD}return M0(D.data)}get enum(){return this._def.values}}v2.create=(D,F)=>{return new v2({values:D,typeName:GD.ZodNativeEnum,...UD(F)})};class D2 extends ED{unwrap(){return this._def.type}_parse(D){let{ctx:F}=this._processInputParams(D);if(F.parsedType!==t.promise&&F.common.async===!1)return r(F,{code:i.invalid_type,expected:t.promise,received:F.parsedType}),zD;let Q=F.parsedType===t.promise?F.data:Promise.resolve(F.data);return M0(Q.then((B)=>{return this._def.type.parseAsync(B,{path:F.path,errorMap:F.common.contextualErrorMap})}))}}D2.create=(D,F)=>{return new D2({type:D,typeName:GD.ZodPromise,...UD(F)})};class c0 extends ED{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===GD.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(D){let{status:F,ctx:Q}=this._processInputParams(D),B=this._def.effect||null,Y={addIssue:(J)=>{if(r(Q,J),J.fatal)F.abort();else F.dirty()},get path(){return Q.path}};if(Y.addIssue=Y.addIssue.bind(Y),B.type==="preprocess"){let J=B.transform(Q.data,Y);if(Q.common.async)return Promise.resolve(J).then(async(X)=>{if(F.value==="aborted")return zD;let C=await this._def.schema._parseAsync({data:X,path:Q.path,parent:Q});if(C.status==="aborted")return zD;if(C.status==="dirty")return R2(C.value);if(F.value==="dirty")return R2(C.value);return C});else{if(F.value==="aborted")return zD;let X=this._def.schema._parseSync({data:J,path:Q.path,parent:Q});if(X.status==="aborted")return zD;if(X.status==="dirty")return R2(X.value);if(F.value==="dirty")return R2(X.value);return X}}if(B.type==="refinement"){let J=(X)=>{let C=B.refinement(X,Y);if(Q.common.async)return Promise.resolve(C);if(C instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return X};if(Q.common.async===!1){let X=this._def.schema._parseSync({data:Q.data,path:Q.path,parent:Q});if(X.status==="aborted")return zD;if(X.status==="dirty")F.dirty();return J(X.value),{status:F.value,value:X.value}}else return this._def.schema._parseAsync({data:Q.data,path:Q.path,parent:Q}).then((X)=>{if(X.status==="aborted")return zD;if(X.status==="dirty")F.dirty();return J(X.value).then(()=>{return{status:F.value,value:X.value}})})}if(B.type==="transform")if(Q.common.async===!1){let J=this._def.schema._parseSync({data:Q.data,path:Q.path,parent:Q});if(!oF(J))return zD;let X=B.transform(J.value,Y);if(X instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:F.value,value:X}}else return this._def.schema._parseAsync({data:Q.data,path:Q.path,parent:Q}).then((J)=>{if(!oF(J))return zD;return Promise.resolve(B.transform(J.value,Y)).then((X)=>({status:F.value,value:X}))});ND.assertNever(B)}}c0.create=(D,F,Q)=>{return new c0({schema:D,typeName:GD.ZodEffects,effect:F,...UD(Q)})};c0.createWithPreprocess=(D,F,Q)=>{return new c0({schema:F,effect:{type:"preprocess",transform:D},typeName:GD.ZodEffects,...UD(Q)})};class YF extends ED{_parse(D){if(this._getType(D)===t.undefined)return M0(void 0);return this._def.innerType._parse(D)}unwrap(){return this._def.innerType}}YF.create=(D,F)=>{return new YF({innerType:D,typeName:GD.ZodOptional,...UD(F)})};class IF extends ED{_parse(D){if(this._getType(D)===t.null)return M0(null);return this._def.innerType._parse(D)}unwrap(){return this._def.innerType}}IF.create=(D,F)=>{return new IF({innerType:D,typeName:GD.ZodNullable,...UD(F)})};class x2 extends ED{_parse(D){let{ctx:F}=this._processInputParams(D),Q=F.data;if(F.parsedType===t.undefined)Q=this._def.defaultValue();return this._def.innerType._parse({data:Q,path:F.path,parent:F})}removeDefault(){return this._def.innerType}}x2.create=(D,F)=>{return new x2({innerType:D,typeName:GD.ZodDefault,defaultValue:typeof F.default==="function"?F.default:()=>F.default,...UD(F)})};class u2 extends ED{_parse(D){let{ctx:F}=this._processInputParams(D),Q={...F,common:{...F.common,issues:[]}},B=this._def.innerType._parse({data:Q.data,path:Q.path,parent:{...Q}});if(T8(B))return B.then((Y)=>{return{status:"valid",value:Y.status==="valid"?Y.value:this._def.catchValue({get error(){return new b0(Q.common.issues)},input:Q.data})}});else return{status:"valid",value:B.status==="valid"?B.value:this._def.catchValue({get error(){return new b0(Q.common.issues)},input:Q.data})}}removeCatch(){return this._def.innerType}}u2.create=(D,F)=>{return new u2({innerType:D,typeName:GD.ZodCatch,catchValue:typeof F.catch==="function"?F.catch:()=>F.catch,...UD(F)})};class v8 extends ED{_parse(D){if(this._getType(D)!==t.nan){let Q=this._getOrReturnCtx(D);return r(Q,{code:i.invalid_type,expected:t.nan,received:Q.parsedType}),zD}return{status:"valid",value:D.data}}}v8.create=(D)=>{return new v8({typeName:GD.ZodNaN,...UD(D)})};var $H=Symbol("zod_brand");class r6 extends ED{_parse(D){let{ctx:F}=this._processInputParams(D),Q=F.data;return this._def.type._parse({data:Q,path:F.path,parent:F})}unwrap(){return this._def.type}}class x8 extends ED{_parse(D){let{status:F,ctx:Q}=this._processInputParams(D);if(Q.common.async)return(async()=>{let Y=await this._def.in._parseAsync({data:Q.data,path:Q.path,parent:Q});if(Y.status==="aborted")return zD;if(Y.status==="dirty")return F.dirty(),R2(Y.value);else return this._def.out._parseAsync({data:Y.value,path:Q.path,parent:Q})})();else{let B=this._def.in._parseSync({data:Q.data,path:Q.path,parent:Q});if(B.status==="aborted")return zD;if(B.status==="dirty")return F.dirty(),{status:"dirty",value:B.value};else return this._def.out._parseSync({data:B.value,path:Q.path,parent:Q})}}static create(D,F){return new x8({in:D,out:F,typeName:GD.ZodPipeline})}}class y2 extends ED{_parse(D){let F=this._def.innerType._parse(D),Q=(B)=>{if(oF(B))B.value=Object.freeze(B.value);return B};return T8(F)?F.then((B)=>Q(B)):Q(F)}unwrap(){return this._def.innerType}}y2.create=(D,F)=>{return new y2({innerType:D,typeName:GD.ZodReadonly,...UD(F)})};function XQ(D,F){let Q=typeof D==="function"?D(F):typeof D==="string"?{message:D}:D;return typeof Q==="string"?{message:Q}:Q}function jQ(D,F={},Q){if(D)return tF.create().superRefine((B,Y)=>{let J=D(B);if(J instanceof Promise)return J.then((X)=>{if(!X){let C=XQ(F,B),W=C.fatal??Q??!0;Y.addIssue({code:"custom",...C,fatal:W})}});if(!J){let X=XQ(F,B),C=X.fatal??Q??!0;Y.addIssue({code:"custom",...X,fatal:C})}return});return tF.create()}var hH={object:$D.lazycreate},GD;(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"})(GD||(GD={}));var mH=(D,F={message:`Input not instance of ${D.name}`})=>jQ((Q)=>Q instanceof D,F),RQ=QF.create,_Q=yF.create,lH=v8.create,dH=fF.create,OQ=I2.create,cH=sF.create,pH=P8.create,nH=w2.create,iH=T2.create,aH=tF.create,rH=uF.create,oH=UF.create,sH=S8.create,tH=XF.create,eH=$D.create,DK=$D.strictCreate,FK=P2.create,BK=a6.create,QK=S2.create,XK=EF.create,YK=k8.create,JK=b8.create,CK=eF.create,WK=_2.create,zK=k2.create,GK=b2.create,qK=gF.create,HK=v2.create,KK=D2.create,YQ=c0.create,UK=YF.create,EK=IF.create,AK=c0.createWithPreprocess,ZK=x8.create,VK=()=>RQ().optional(),LK=()=>_Q().optional(),MK=()=>OQ().optional(),NK={string:(D)=>QF.create({...D,coerce:!0}),number:(D)=>yF.create({...D,coerce:!0}),boolean:(D)=>I2.create({...D,coerce:!0}),bigint:(D)=>fF.create({...D,coerce:!0}),date:(D)=>sF.create({...D,coerce:!0})},jK=zD;var o6="2.0",IQ=E.union([E.string(),E.number().int()]),wQ=E.string(),RK=E.object({progressToken:E.optional(IQ)}).passthrough(),p0=E.object({_meta:E.optional(RK)}).passthrough(),N0=E.object({method:E.string(),params:E.optional(p0)}),u8=E.object({_meta:E.optional(E.object({}).passthrough())}).passthrough(),AF=E.object({method:E.string(),params:E.optional(u8)}),n0=E.object({_meta:E.optional(E.object({}).passthrough())}).passthrough(),s6=E.union([E.string(),E.number().int()]),_K=E.object({jsonrpc:E.literal(o6),id:s6}).merge(N0).strict();var OK=E.object({jsonrpc:E.literal(o6)}).merge(AF).strict();var IK=E.object({jsonrpc:E.literal(o6),id:s6,result:n0}).strict();var JQ;(function(D){D[D.ConnectionClosed=-32000]="ConnectionClosed",D[D.RequestTimeout=-32001]="RequestTimeout",D[D.ParseError=-32700]="ParseError",D[D.InvalidRequest=-32600]="InvalidRequest",D[D.MethodNotFound=-32601]="MethodNotFound",D[D.InvalidParams=-32602]="InvalidParams",D[D.InternalError=-32603]="InternalError"})(JQ||(JQ={}));var wK=E.object({jsonrpc:E.literal(o6),id:s6,error:E.object({code:E.number().int(),message:E.string(),data:E.optional(E.unknown())})}).strict();var sM=E.union([_K,OK,IK,wK]),TQ=n0.strict(),PQ=AF.extend({method:E.literal("notifications/cancelled"),params:u8.extend({requestId:s6,reason:E.string().optional()})}),y8=E.object({name:E.string(),title:E.optional(E.string())}).passthrough(),SQ=y8.extend({version:E.string()}),TK=E.object({experimental:E.optional(E.object({}).passthrough()),sampling:E.optional(E.object({}).passthrough()),elicitation:E.optional(E.object({}).passthrough()),roots:E.optional(E.object({listChanged:E.optional(E.boolean())}).passthrough())}).passthrough(),PK=N0.extend({method:E.literal("initialize"),params:p0.extend({protocolVersion:E.string(),capabilities:TK,clientInfo:SQ})}),SK=E.object({experimental:E.optional(E.object({}).passthrough()),logging:E.optional(E.object({}).passthrough()),completions:E.optional(E.object({}).passthrough()),prompts:E.optional(E.object({listChanged:E.optional(E.boolean())}).passthrough()),resources:E.optional(E.object({subscribe:E.optional(E.boolean()),listChanged:E.optional(E.boolean())}).passthrough()),tools:E.optional(E.object({listChanged:E.optional(E.boolean())}).passthrough())}).passthrough(),kK=n0.extend({protocolVersion:E.string(),capabilities:SK,serverInfo:SQ,instructions:E.optional(E.string())}),bK=AF.extend({method:E.literal("notifications/initialized")}),kQ=N0.extend({method:E.literal("ping")}),vK=E.object({progress:E.number(),total:E.optional(E.number()),message:E.optional(E.string())}).passthrough(),bQ=AF.extend({method:E.literal("notifications/progress"),params:u8.merge(vK).extend({progressToken:IQ})}),t6=N0.extend({params:p0.extend({cursor:E.optional(wQ)}).optional()}),e6=n0.extend({nextCursor:E.optional(wQ)}),vQ=E.object({uri:E.string(),mimeType:E.optional(E.string()),_meta:E.optional(E.object({}).passthrough())}).passthrough(),xQ=vQ.extend({text:E.string()}),K9=E.string().refine((D)=>{try{return atob(D),!0}catch(F){return!1}},{message:"Invalid Base64 string"}),uQ=vQ.extend({blob:K9}),yQ=y8.extend({uri:E.string(),description:E.optional(E.string()),mimeType:E.optional(E.string()),_meta:E.optional(E.object({}).passthrough())}),xK=y8.extend({uriTemplate:E.string(),description:E.optional(E.string()),mimeType:E.optional(E.string()),_meta:E.optional(E.object({}).passthrough())}),uK=t6.extend({method:E.literal("resources/list")}),yK=e6.extend({resources:E.array(yQ)}),fK=t6.extend({method:E.literal("resources/templates/list")}),gK=e6.extend({resourceTemplates:E.array(xK)}),$K=N0.extend({method:E.literal("resources/read"),params:p0.extend({uri:E.string()})}),hK=n0.extend({contents:E.array(E.union([xQ,uQ]))}),mK=AF.extend({method:E.literal("notifications/resources/list_changed")}),lK=N0.extend({method:E.literal("resources/subscribe"),params:p0.extend({uri:E.string()})}),dK=N0.extend({method:E.literal("resources/unsubscribe"),params:p0.extend({uri:E.string()})}),cK=AF.extend({method:E.literal("notifications/resources/updated"),params:u8.extend({uri:E.string()})}),pK=E.object({name:E.string(),description:E.optional(E.string()),required:E.optional(E.boolean())}).passthrough(),nK=y8.extend({description:E.optional(E.string()),arguments:E.optional(E.array(pK)),_meta:E.optional(E.object({}).passthrough())}),iK=t6.extend({method:E.literal("prompts/list")}),aK=e6.extend({prompts:E.array(nK)}),rK=N0.extend({method:E.literal("prompts/get"),params:p0.extend({name:E.string(),arguments:E.optional(E.record(E.string()))})}),U9=E.object({type:E.literal("text"),text:E.string(),_meta:E.optional(E.object({}).passthrough())}).passthrough(),E9=E.object({type:E.literal("image"),data:K9,mimeType:E.string(),_meta:E.optional(E.object({}).passthrough())}).passthrough(),A9=E.object({type:E.literal("audio"),data:K9,mimeType:E.string(),_meta:E.optional(E.object({}).passthrough())}).passthrough(),oK=E.object({type:E.literal("resource"),resource:E.union([xQ,uQ]),_meta:E.optional(E.object({}).passthrough())}).passthrough(),sK=yQ.extend({type:E.literal("resource_link")}),fQ=E.union([U9,E9,A9,sK,oK]),tK=E.object({role:E.enum(["user","assistant"]),content:fQ}).passthrough(),eK=n0.extend({description:E.optional(E.string()),messages:E.array(tK)}),DU=AF.extend({method:E.literal("notifications/prompts/list_changed")}),FU=E.object({title:E.optional(E.string()),readOnlyHint:E.optional(E.boolean()),destructiveHint:E.optional(E.boolean()),idempotentHint:E.optional(E.boolean()),openWorldHint:E.optional(E.boolean())}).passthrough(),BU=y8.extend({description:E.optional(E.string()),inputSchema:E.object({type:E.literal("object"),properties:E.optional(E.object({}).passthrough()),required:E.optional(E.array(E.string()))}).passthrough(),outputSchema:E.optional(E.object({type:E.literal("object"),properties:E.optional(E.object({}).passthrough()),required:E.optional(E.array(E.string()))}).passthrough()),annotations:E.optional(FU),_meta:E.optional(E.object({}).passthrough())}),QU=t6.extend({method:E.literal("tools/list")}),XU=e6.extend({tools:E.array(BU)}),gQ=n0.extend({content:E.array(fQ).default([]),structuredContent:E.object({}).passthrough().optional(),isError:E.optional(E.boolean())}),tM=gQ.or(n0.extend({toolResult:E.unknown()})),YU=N0.extend({method:E.literal("tools/call"),params:p0.extend({name:E.string(),arguments:E.optional(E.record(E.unknown()))})}),JU=AF.extend({method:E.literal("notifications/tools/list_changed")}),$Q=E.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),CU=N0.extend({method:E.literal("logging/setLevel"),params:p0.extend({level:$Q})}),WU=AF.extend({method:E.literal("notifications/message"),params:u8.extend({level:$Q,logger:E.optional(E.string()),data:E.unknown()})}),zU=E.object({name:E.string().optional()}).passthrough(),GU=E.object({hints:E.optional(E.array(zU)),costPriority:E.optional(E.number().min(0).max(1)),speedPriority:E.optional(E.number().min(0).max(1)),intelligencePriority:E.optional(E.number().min(0).max(1))}).passthrough(),qU=E.object({role:E.enum(["user","assistant"]),content:E.union([U9,E9,A9])}).passthrough(),HU=N0.extend({method:E.literal("sampling/createMessage"),params:p0.extend({messages:E.array(qU),systemPrompt:E.optional(E.string()),includeContext:E.optional(E.enum(["none","thisServer","allServers"])),temperature:E.optional(E.number()),maxTokens:E.number().int(),stopSequences:E.optional(E.array(E.string())),metadata:E.optional(E.object({}).passthrough()),modelPreferences:E.optional(GU)})}),KU=n0.extend({model:E.string(),stopReason:E.optional(E.enum(["endTurn","stopSequence","maxTokens"]).or(E.string())),role:E.enum(["user","assistant"]),content:E.discriminatedUnion("type",[U9,E9,A9])}),UU=E.object({type:E.literal("boolean"),title:E.optional(E.string()),description:E.optional(E.string()),default:E.optional(E.boolean())}).passthrough(),EU=E.object({type:E.literal("string"),title:E.optional(E.string()),description:E.optional(E.string()),minLength:E.optional(E.number()),maxLength:E.optional(E.number()),format:E.optional(E.enum(["email","uri","date","date-time"]))}).passthrough(),AU=E.object({type:E.enum(["number","integer"]),title:E.optional(E.string()),description:E.optional(E.string()),minimum:E.optional(E.number()),maximum:E.optional(E.number())}).passthrough(),ZU=E.object({type:E.literal("string"),title:E.optional(E.string()),description:E.optional(E.string()),enum:E.array(E.string()),enumNames:E.optional(E.array(E.string()))}).passthrough(),VU=E.union([UU,EU,AU,ZU]),LU=N0.extend({method:E.literal("elicitation/create"),params:p0.extend({message:E.string(),requestedSchema:E.object({type:E.literal("object"),properties:E.record(E.string(),VU),required:E.optional(E.array(E.string()))}).passthrough()})}),MU=n0.extend({action:E.enum(["accept","decline","cancel"]),content:E.optional(E.record(E.string(),E.unknown()))}),NU=E.object({type:E.literal("ref/resource"),uri:E.string()}).passthrough(),jU=E.object({type:E.literal("ref/prompt"),name:E.string()}).passthrough(),RU=N0.extend({method:E.literal("completion/complete"),params:p0.extend({ref:E.union([jU,NU]),argument:E.object({name:E.string(),value:E.string()}).passthrough(),context:E.optional(E.object({arguments:E.optional(E.record(E.string(),E.string()))}))})}),_U=n0.extend({completion:E.object({values:E.array(E.string()).max(100),total:E.optional(E.number().int()),hasMore:E.optional(E.boolean())}).passthrough()}),OU=E.object({uri:E.string().startsWith("file://"),name:E.optional(E.string()),_meta:E.optional(E.object({}).passthrough())}).passthrough(),IU=N0.extend({method:E.literal("roots/list")}),wU=n0.extend({roots:E.array(OU)}),TU=AF.extend({method:E.literal("notifications/roots/list_changed")}),eM=E.union([kQ,PK,RU,CU,rK,iK,uK,fK,$K,lK,dK,YU,QU]),DN=E.union([PQ,bQ,bK,TU]),FN=E.union([TQ,KU,MU,wU]),BN=E.union([kQ,HU,LU,IU]),QN=E.union([PQ,bQ,WU,cK,mK,JU,DU]),XN=E.union([TQ,kK,_U,eK,aK,yK,gK,hK,gQ,XU]);var YN=jq(QH(),1);var JN=Symbol("Let zodToJsonSchema decide on which parser to use");var CN=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");var W9;(function(D){D.Completable="McpCompletable"})(W9||(W9={}));class z9 extends ED{_parse(D){let{ctx:F}=this._processInputParams(D),Q=F.data;return this._def.type._parse({data:Q,path:F.path,parent:F})}unwrap(){return this._def.type}}z9.create=(D,F)=>{return new z9({type:D,typeName:W9.Completable,complete:F.complete,...PU(F)})};function PU(D){if(!D)return{};let{errorMap:F,invalid_type_error:Q,required_error:B,description:Y}=D;if(F&&(Q||B))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(F)return{errorMap:F,description:Y};return{errorMap:(X,C)=>{var W,z;let{message:G}=D;if(X.code==="invalid_enum_value")return{message:G!==null&&G!==void 0?G:C.defaultError};if(typeof C.data==="undefined")return{message:(W=G!==null&&G!==void 0?G:B)!==null&&W!==void 0?W:C.defaultError};if(X.code!=="invalid_type")return{message:C.defaultError};return{message:(z=G!==null&&G!==void 0?G:Q)!==null&&z!==void 0?z:C.defaultError}},description:Y}}function f8({prompt:D,options:F}){let{systemPrompt:Q,settingSources:B,...Y}=F??{},J,X;if(Q===void 0)J="";else if(typeof Q==="string")J=Q;else if(Q.type==="preset")X=Q.append;let C=Y.pathToClaudeCodeExecutable;if(!C){let W=XH(import.meta.url),z=FQ(W,"..");C=FQ(z,"cli.js")}return process.env.CLAUDE_AGENT_SDK_VERSION="0.1.5",KH({prompt:D,options:{...Y,pathToClaudeCodeExecutable:C,customSystemPrompt:J,appendSystemPrompt:X,settingSources:B??[]}})}import dD from"fs";import j0 from"path";import{execSync as hQ}from"child_process";async function lQ(D){try{if(D.update){await mQ(D);return}let F=j0.join(process.cwd(),"package.json"),Q="unknown",B="unknown";if(dD.existsSync(F))try{let O=JSON.parse(dD.readFileSync(F,"utf-8"));Q=O.version||"unknown",B=O.name||j0.basename(process.cwd())}catch(O){B=j0.basename(process.cwd())}let Y=[],J=D.historical||1;if(D.generate)Y.push(D.generate),J=1,console.log(`\uD83C\uDFAF Generating changelog for specific version: ${D.generate}`);else if(Q!=="unknown"){let O=Q.split(".");if(O.length===3){let y=parseInt(O[0]),x=parseInt(O[1]),w=parseInt(O[2]);for(let S=0;S<J;S++)if(Y.push(`${y}.${x}.${w}`),w===0){if(x===0)break;x--,w=9}else w--}}if(Y.length===0)console.log("⚠️ Could not determine versions to search. Please check package.json"),process.exit(1);let X=j0.join(process.env.HOME||process.env.USERPROFILE||"",".claude-mem","projects"),C=j0.join(X,`${B}-changelog.jsonl`),W=!1;if(dD.existsSync(C)){let O=dD.readFileSync(C,"utf-8").split(`
480
+ `).filter((y)=>y.trim());for(let y of O)try{if(JSON.parse(y).version===Q)W=!0}catch(x){}if(!D.historical&&!D.generate&&J===1){if(W)console.log(`❌ Version ${Q} already has changelog entries.`),console.log(`
481
481
  \uD83D\uDCDD Workflow:`),console.log(" 1. Make your code updates"),console.log(" 2. Build and test: bun run build"),console.log(" 3. Bump version: npm version patch"),console.log(" 4. Generate changelog: claude-mem changelog"),console.log(` 5. Commit and push
482
- `),console.log("\uD83D\uDCA1 Or use --historical 1 to regenerate this version's changelog"),process.exit(1)}}let W=[];if(D.start&&D.end){let O=D.generate||Q;W.push({version:O,startTime:D.start,endTime:D.end}),console.log(`\uD83D\uDCC5 Using custom time range for ${O}:`),console.log(` Start: ${new Date(D.start).toLocaleString()}`),console.log(` End: ${new Date(D.end).toLocaleString()}`)}else try{let O=hQ(`npm view ${B} time --json`,{encoding:"utf-8",timeout:5000}),y=JSON.parse(O),x="";if(J>1){let S=Y[Y.length-1].split("."),g=parseInt(S[0]),d=parseInt(S[1]),n=parseInt(S[2]);if(n>0)x=`${g}.${d}.${n-1}`;else if(d>0){let a=`${g}.${d-1}.`,DD=Object.keys(y).filter((o)=>o.startsWith(a)).sort((o,XD)=>{let YD=parseInt(o.split(".")[2]||"0");return parseInt(XD.split(".")[2]||"0")-YD});if(DD.length>0)x=DD[0]}else if(g>0){let a=`${g-1}.`,DD=Object.keys(y).filter((o)=>o.startsWith(a)).sort((o,XD)=>{let[,YD,FD]=o.split(".").map(Number),[,LD,hD]=XD.split(".").map(Number);if(YD!==LD)return LD-YD;return hD-FD});if(DD.length>0)x=DD[0]}if(D.verbose&&x&&y[x])console.log(`\uD83D\uDCCD Using ${x} as start boundary for time ranges`)}for(let w=0;w<Y.length;w++){let S=Y[w],g="2000-01-01T00:00:00Z";if(w===0){let n=S.split("."),a=parseInt(n[0]),DD=parseInt(n[1]),o=parseInt(n[2]),XD="";if(o>0)XD=`${a}.${DD}.${o-1}`;else if(DD>0){let YD=`${a}.${DD-1}.`,FD=Object.keys(y).filter((LD)=>LD.startsWith(YD)).sort((LD,hD)=>{let cD=parseInt(LD.split(".")[2]||"0");return parseInt(hD.split(".")[2]||"0")-cD});if(FD.length>0)XD=FD[0]}if(y[XD])g=y[XD]}else if(w<Y.length-1){let n=Y[w+1];if(y[n])g=y[n]}else if(x&&y[x])g=y[x];let d=y[S]||new Date().toISOString();if(W.push({version:S,startTime:g,endTime:d}),D.verbose)console.log(`\uD83D\uDCC5 Version ${S}: ${new Date(g).toLocaleString()} - ${new Date(d).toLocaleString()}`)}if(J===1){let w=W[0];if(w)console.log(`\uD83D\uDCE6 Using npm time range for ${w.version}: ${new Date(w.startTime).toLocaleString()} - ${new Date(w.endTime).toLocaleString()}`)}}catch(O){console.log("❌ Could not fetch npm publish times. Cannot proceed without time ranges."),process.exit(1)}console.log(`\uD83D\uDD0D Searching memories for versions: ${Y.join(", ")}`),console.log(`\uD83D\uDCE6 Project: ${B}
483
- `);let G=W.length>0?`You are helping generate a changelog by searching for memories within specific time ranges for multiple versions.
482
+ `),console.log("\uD83D\uDCA1 Or use --historical 1 to regenerate this version's changelog"),process.exit(1)}}let z=[];if(D.start&&D.end){let O=D.generate||Q;z.push({version:O,startTime:D.start,endTime:D.end}),console.log(`\uD83D\uDCC5 Using custom time range for ${O}:`),console.log(` Start: ${new Date(D.start).toLocaleString()}`),console.log(` End: ${new Date(D.end).toLocaleString()}`)}else try{let O=hQ(`npm view ${B} time --json`,{encoding:"utf-8",timeout:5000}),y=JSON.parse(O),x="";if(J>1){let S=Y[Y.length-1].split("."),g=parseInt(S[0]),d=parseInt(S[1]),n=parseInt(S[2]);if(n>0)x=`${g}.${d}.${n-1}`;else if(d>0){let a=`${g}.${d-1}.`,DD=Object.keys(y).filter((o)=>o.startsWith(a)).sort((o,XD)=>{let YD=parseInt(o.split(".")[2]||"0");return parseInt(XD.split(".")[2]||"0")-YD});if(DD.length>0)x=DD[0]}else if(g>0){let a=`${g-1}.`,DD=Object.keys(y).filter((o)=>o.startsWith(a)).sort((o,XD)=>{let[,YD,FD]=o.split(".").map(Number),[,LD,hD]=XD.split(".").map(Number);if(YD!==LD)return LD-YD;return hD-FD});if(DD.length>0)x=DD[0]}if(D.verbose&&x&&y[x])console.log(`\uD83D\uDCCD Using ${x} as start boundary for time ranges`)}for(let w=0;w<Y.length;w++){let S=Y[w],g="2000-01-01T00:00:00Z";if(w===0){let n=S.split("."),a=parseInt(n[0]),DD=parseInt(n[1]),o=parseInt(n[2]),XD="";if(o>0)XD=`${a}.${DD}.${o-1}`;else if(DD>0){let YD=`${a}.${DD-1}.`,FD=Object.keys(y).filter((LD)=>LD.startsWith(YD)).sort((LD,hD)=>{let cD=parseInt(LD.split(".")[2]||"0");return parseInt(hD.split(".")[2]||"0")-cD});if(FD.length>0)XD=FD[0]}if(y[XD])g=y[XD]}else if(w<Y.length-1){let n=Y[w+1];if(y[n])g=y[n]}else if(x&&y[x])g=y[x];let d=y[S]||new Date().toISOString();if(z.push({version:S,startTime:g,endTime:d}),D.verbose)console.log(`\uD83D\uDCC5 Version ${S}: ${new Date(g).toLocaleString()} - ${new Date(d).toLocaleString()}`)}if(J===1){let w=z[0];if(w)console.log(`\uD83D\uDCE6 Using npm time range for ${w.version}: ${new Date(w.startTime).toLocaleString()} - ${new Date(w.endTime).toLocaleString()}`)}}catch(O){console.log("❌ Could not fetch npm publish times. Cannot proceed without time ranges."),process.exit(1)}console.log(`\uD83D\uDD0D Searching memories for versions: ${Y.join(", ")}`),console.log(`\uD83D\uDCE6 Project: ${B}
483
+ `);let G=z.length>0?`You are helping generate a changelog by searching for memories within specific time ranges for multiple versions.
484
484
 
485
485
  PROJECT: ${B}
486
486
  VERSION TIME RANGES:
487
- ${W.map((O)=>`- Version ${O.version}: ${new Date(O.startTime).toLocaleDateString()} to ${new Date(O.endTime).toLocaleDateString()}`).join(`
487
+ ${z.map((O)=>`- Version ${O.version}: ${new Date(O.startTime).toLocaleDateString()} to ${new Date(O.endTime).toLocaleDateString()}`).join(`
488
488
  `)}
489
489
 
490
490
  YOUR TASK:
491
491
  Use mcp__claude-mem__chroma_query_documents to search for memories for each version time range.
492
492
 
493
493
  SEARCH STRATEGY:
494
- ${W.map((O)=>{let y=new Date(O.startTime),x=new Date(O.endTime),w=[],S=new Date(y);while(S<=x){let g=S.toISOString().split("T")[0];w.push(g),S.setDate(S.getDate()+1)}return`
494
+ ${z.map((O)=>{let y=new Date(O.startTime),x=new Date(O.endTime),w=[],S=new Date(y);while(S<=x){let g=S.toISOString().split("T")[0];w.push(g),S.setDate(S.getDate()+1)}return`
495
495
  Version ${O.version} (${new Date(O.startTime).toLocaleDateString()} to ${new Date(O.endTime).toLocaleDateString()}):
496
496
  1. Search for memories from these dates: ${w.join(", ")}
497
497
  2. Make multiple calls to mcp__claude-mem__chroma_query_documents:
@@ -527,7 +527,7 @@ Return a JSON object with this structure:
527
527
  }
528
528
 
529
529
  Group memories by the version they belong to based on timestamp.
530
- Start searching now.`:"ERROR: No time ranges available. This should never happen.";if(W.length===0)console.log("❌ No time ranges available. Cannot search memories."),process.exit(1);if(D.verbose)console.log("\uD83D\uDCDD Calling Claude to search memories...");let q=await f8({prompt:G,options:{allowedTools:["mcp__claude-mem__chroma_query_documents","mcp__claude-mem__chroma_get_documents"],pathToClaudeCodeExecutable:z8()}}),A="";if(q&&typeof q==="object"&&Symbol.asyncIterator in q){for await(let O of q)if(O?.type==="assistant"&&O?.message?.content){let y=O.message.content;if(typeof y==="string")A+=y;else if(Array.isArray(y)){for(let x of y)if(x.type==="text"&&x.text)A+=x.text}}}let U=[];try{let O=A.match(/```json\n([\s\S]*?)\n```/)||A.match(/\{[\s\S]*\}/);if(O){let y=JSON.parse(O[1]||O[0]);if(y.memories&&Array.isArray(y.memories))U=y.memories}}catch(O){console.error("⚠️ Could not parse memory search results:",O)}if(U.length===0){console.log(`
530
+ Start searching now.`:"ERROR: No time ranges available. This should never happen.";if(z.length===0)console.log("❌ No time ranges available. Cannot search memories."),process.exit(1);if(D.verbose)console.log("\uD83D\uDCDD Calling Claude to search memories...");let q=await f8({prompt:G,options:{allowedTools:["mcp__claude-mem__chroma_query_documents","mcp__claude-mem__chroma_get_documents"],pathToClaudeCodeExecutable:z8()}}),A="";if(q&&typeof q==="object"&&Symbol.asyncIterator in q){for await(let O of q)if(O?.type==="assistant"&&O?.message?.content){let y=O.message.content;if(typeof y==="string")A+=y;else if(Array.isArray(y)){for(let x of y)if(x.type==="text"&&x.text)A+=x.text}}}let U=[];try{let O=A.match(/```json\n([\s\S]*?)\n```/)||A.match(/\{[\s\S]*\}/);if(O){let y=JSON.parse(O[1]||O[0]);if(y.memories&&Array.isArray(y.memories))U=y.memories}}catch(O){console.error("⚠️ Could not parse memory search results:",O)}if(U.length===0){console.log(`
531
531
  ⚠️ No version-related memories found for this version.`),console.log(" This is normal for the first release or when no changes were tracked."),console.log(" Creating a placeholder changelog entry...");let O={version:Y[0],date:H,type:"Changed",description:"Initial release or minor updates",timestamp:new Date().toISOString(),generatedAt:new Date().toISOString()};if(!dD.existsSync(X))dD.mkdirSync(X,{recursive:!0});let y=JSON.stringify(O)+`
532
532
  `;dD.appendFileSync(C,y),console.log(`✅ Created placeholder changelog entry for v${Y[0]}`),await mQ(D);return}console.log(`✅ Found ${U.length} version-related memories
533
533
  `);let H=hQ('date "+%Y-%m-%d %H:%M:%S %Z"').toString().trim().split(" ")[0],V=`Analyze these memories and generate changelog entries.
@@ -562,7 +562,7 @@ Return ONLY a JSON array with this structure:
562
562
  "type": "Fixed",
563
563
  "description": "Bug fix description"
564
564
  }
565
- ]`;console.log("\uD83D\uDD04 Generating changelog entries...");let N=await f8({prompt:V,options:{allowedTools:[],pathToClaudeCodeExecutable:z8()}}),L="";if(N&&typeof N==="object"&&Symbol.asyncIterator in N){for await(let O of N)if(O?.type==="assistant"&&O?.message?.content){let y=O.message.content;if(typeof y==="string")L+=y;else if(Array.isArray(y)){for(let x of y)if(x.type==="text"&&x.text)L+=x.text}}}let R=[];try{let O=L.match(/```json\n([\s\S]*?)\n```/)||L.match(/\[[\s\S]*\]/);if(O){let y=JSON.parse(O[1]||O[0]);if(Array.isArray(y)){let x=new Date().toISOString();R=y.map((w)=>({...w,date:H,timestamp:w.timestamp||x,generatedAt:x}))}}}catch(O){console.error("⚠️ Could not parse changelog entries:",O)}if(R.length===0)console.log("⚠️ No changelog entries generated."),process.exit(1);if(!dD.existsSync(X))dD.mkdirSync(X,{recursive:!0});if(console.log(`
565
+ ]`;console.log("\uD83D\uDD04 Generating changelog entries...");let j=await f8({prompt:V,options:{allowedTools:[],pathToClaudeCodeExecutable:z8()}}),L="";if(j&&typeof j==="object"&&Symbol.asyncIterator in j){for await(let O of j)if(O?.type==="assistant"&&O?.message?.content){let y=O.message.content;if(typeof y==="string")L+=y;else if(Array.isArray(y)){for(let x of y)if(x.type==="text"&&x.text)L+=x.text}}}let R=[];try{let O=L.match(/```json\n([\s\S]*?)\n```/)||L.match(/\[[\s\S]*\]/);if(O){let y=JSON.parse(O[1]||O[0]);if(Array.isArray(y)){let x=new Date().toISOString();R=y.map((w)=>({...w,date:H,timestamp:w.timestamp||x,generatedAt:x}))}}}catch(O){console.error("⚠️ Could not parse changelog entries:",O)}if(R.length===0)console.log("⚠️ No changelog entries generated."),process.exit(1);if(!dD.existsSync(X))dD.mkdirSync(X,{recursive:!0});if(console.log(`
566
566
  \uD83D\uDCBE Saving ${R.length} changelog entries to ${j0.basename(C)}`),D.historical&&J>1||D.generate){let O=[];if(dD.existsSync(C)){let w=dD.readFileSync(C,"utf-8").split(`
567
567
  `).filter((S)=>S.trim());for(let S of w)try{let g=JSON.parse(S);if(!Y.includes(g.version))O.push(g)}catch(g){}}let x=[...O,...R].map((w)=>JSON.stringify(w)).join(`
568
568
  `)+`
@@ -589,29 +589,29 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
589
589
  `)),I.split(`
590
590
  `).length>30)console.log(`
591
591
  ... (truncated for preview)`)}}catch(F){if(console.error("❌ Error generating changelog:",F instanceof Error?F.message:F),F instanceof Error&&F.stack)console.error("Stack:",F.stack);process.exit(1)}}async function mQ(D){try{let F=j0.join(process.cwd(),"package.json"),Q="unknown";if(dD.existsSync(F))try{Q=JSON.parse(dD.readFileSync(F,"utf-8")).name||j0.basename(process.cwd())}catch(q){Q=j0.basename(process.cwd())}let B=j0.join(process.env.HOME||process.env.USERPROFILE||"",".claude-mem","projects"),Y=j0.join(B,`${Q}-changelog.jsonl`);if(!dD.existsSync(Y))console.log("❌ No changelog entries found. Generate some first with: claude-mem changelog"),process.exit(1);console.log("\uD83D\uDCDD Updating CHANGELOG.md from JSONL entries...");let J=[],X=dD.readFileSync(Y,"utf-8").split(`
592
- `).filter((q)=>q.trim());for(let q of X)try{J.push(JSON.parse(q))}catch(A){}if(J.length===0)console.log("❌ No valid entries found in JSONL file"),process.exit(1);let C=new Map;for(let q of J){if(!C.has(q.version))C.set(q.version,[]);C.get(q.version).push(q)}let z=`# Changelog
592
+ `).filter((q)=>q.trim());for(let q of X)try{J.push(JSON.parse(q))}catch(A){}if(J.length===0)console.log("❌ No valid entries found in JSONL file"),process.exit(1);let C=new Map;for(let q of J){if(!C.has(q.version))C.set(q.version,[]);C.get(q.version).push(q)}let W=`# Changelog
593
593
 
594
594
  All notable changes to this project will be documented in this file.
595
595
 
596
596
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
597
597
 
598
- `,W=Array.from(C.keys()).sort((q,A)=>{let U=q.split(".").map(Number),Z=A.split(".").map(Number);for(let H=0;H<3;H++)if(U[H]!==Z[H])return Z[H]-U[H];return 0});for(let q of W){let A=C.get(q),U=A[0].date;z+=`
598
+ `,z=Array.from(C.keys()).sort((q,A)=>{let U=q.split(".").map(Number),Z=A.split(".").map(Number);for(let H=0;H<3;H++)if(U[H]!==Z[H])return Z[H]-U[H];return 0});for(let q of z){let A=C.get(q),U=A[0].date;W+=`
599
599
  ## [${q}] - ${U}
600
600
 
601
- `;let Z=["Added","Changed","Fixed","Removed","Deprecated","Security"];for(let H of Z){let V=A.filter((N)=>N.type===H);if(V.length>0){z+=`### ${H}
602
- `;for(let N of V)z+=`- ${N.description}
603
- `;z+=`
604
- `}}}let G=j0.join(process.cwd(),"CHANGELOG.md");if(dD.writeFileSync(G,z),console.log(`✅ Updated CHANGELOG.md with ${J.length} entries across ${C.size} versions!`),D.preview){if(console.log(`
601
+ `;let Z=["Added","Changed","Fixed","Removed","Deprecated","Security"];for(let H of Z){let V=A.filter((j)=>j.type===H);if(V.length>0){W+=`### ${H}
602
+ `;for(let j of V)W+=`- ${j.description}
603
+ `;W+=`
604
+ `}}}let G=j0.join(process.cwd(),"CHANGELOG.md");if(dD.writeFileSync(G,W),console.log(`✅ Updated CHANGELOG.md with ${J.length} entries across ${C.size} versions!`),D.preview){if(console.log(`
605
605
  \uD83D\uDCC4 Preview:
606
- `),console.log(z.split(`
606
+ `),console.log(W.split(`
607
607
  `).slice(0,30).join(`
608
- `)),z.split(`
608
+ `)),W.split(`
609
609
  `).length>30)console.log(`
610
- ... (truncated for preview)`)}}catch(F){console.error("❌ Error updating changelog:",F instanceof Error?F.message:F),process.exit(1)}}E0();import g2 from"fs";import SU from"path";function kU(D){let F=D.status==="pass"?"✅":D.status==="warn"?"⚠️ ":"❌",Q=D.details?`${D.name}: ${D.details}`:D.name;console.log(`${F} ${Q}`)}async function dQ(D={}){let F=CD.getInstance(),Q=[];try{let Y=F.getDataDirectory();if(!g2.existsSync(Y))g2.mkdirSync(Y,{recursive:!0}),Q.push({name:`Data directory created at ${Y}`,status:"warn"});else{let J=g2.statSync(Y),X=!1;try{g2.accessSync(Y,g2.constants.W_OK),X=!0}catch{}Q.push({name:`Data directory ${Y}`,status:J.isDirectory()&&X?"pass":"fail",details:J.isDirectory()&&X?"accessible":"not writable"})}}catch(Y){Q.push({name:"Data directory",status:"fail",details:Y?.message||String(Y)})}let B;try{B=await e0();let Y=B.sessions.count();Q.push({name:"SQLite database",status:"pass",details:`${Y} session${Y===1?"":"s"} present`})}catch(Y){Q.push({name:"SQLite database",status:"fail",details:Y?.message||String(Y)})}try{let Y=F.getChromaDirectory(),J=g2.existsSync(Y);Q.push({name:"Chroma vector store",status:J?"pass":"warn",details:J?`data dir ${SU.resolve(Y)}`:"Not yet initialized"})}catch(Y){Q.push({name:"Chroma vector store",status:"warn",details:Y?.message||"Unable to check Chroma directory"})}if(D.json)console.log(JSON.stringify({checks:Q},null,2));else console.log("claude-mem doctor"),console.log("================="),Q.forEach(kU);w6("info","doctor run completed",{status:Q.map((Y)=>Y.status)})}import{spawnSync as cQ}from"child_process";async function pQ(D){let{id:F,project:Q,session:B,date:Y,title:J,subtitle:X,facts:C,concepts:z,files:W}=D;if(!F||!Q||!B||!Y)console.error("Error: All fields required: --id, --project, --session, --date"),process.exit(1);if(!J||!X||!C)console.error("Error: Hierarchical format required: --title, --subtitle, --facts"),process.exit(1);try{let G=await e0(),q=new Date().toISOString();if(!await G.sessions.has(B))await G.sessions.create({session_id:B,project:Q,created_at:q,source:"save"});let U,Z,H;try{U=C?JSON.stringify(JSON.parse(C)):void 0}catch(N){U=C}try{Z=z?JSON.stringify(JSON.parse(z)):void 0}catch(N){Z=z}try{H=W?JSON.stringify(JSON.parse(W)):void 0}catch(N){H=W}if(!G.memories.hasDocumentId(F))G.memories.create({document_id:F,text:"",keywords:"",session_id:B,project:Q,created_at:q,origin:"streaming-sdk",title:J||void 0,subtitle:X||void 0,facts:U,concepts:Z,files_touched:H});if(U){let N=JSON.parse(U),L=Z?JSON.parse(Z):[],R=H?JSON.parse(H):[];N.forEach((k,b)=>{cQ("claude-mem",["chroma_add_documents","--collection_name","claude_memories","--documents",JSON.stringify([k]),"--ids",JSON.stringify([`${F}_fact_${String(b).padStart(3,"0")}`]),"--metadatas",JSON.stringify([{type:"fact",parent_id:F,fact_index:b,title:J,subtitle:X,project:Q,session_id:B,created_at:q,created_at_epoch:Date.parse(q),keywords:"",concepts:JSON.stringify(L),files_touched:JSON.stringify(R),origin:"streaming-sdk"}])])}),cQ("claude-mem",["chroma_add_documents","--collection_name","claude_memories","--documents",JSON.stringify([`${J}
610
+ ... (truncated for preview)`)}}catch(F){console.error("❌ Error updating changelog:",F instanceof Error?F.message:F),process.exit(1)}}E0();import g2 from"fs";import SU from"path";function kU(D){let F=D.status==="pass"?"✅":D.status==="warn"?"⚠️ ":"❌",Q=D.details?`${D.name}: ${D.details}`:D.name;console.log(`${F} ${Q}`)}async function dQ(D={}){let F=CD.getInstance(),Q=[];try{let Y=F.getDataDirectory();if(!g2.existsSync(Y))g2.mkdirSync(Y,{recursive:!0}),Q.push({name:`Data directory created at ${Y}`,status:"warn"});else{let J=g2.statSync(Y),X=!1;try{g2.accessSync(Y,g2.constants.W_OK),X=!0}catch{}Q.push({name:`Data directory ${Y}`,status:J.isDirectory()&&X?"pass":"fail",details:J.isDirectory()&&X?"accessible":"not writable"})}}catch(Y){Q.push({name:"Data directory",status:"fail",details:Y?.message||String(Y)})}let B;try{B=await e0();let Y=B.sessions.count();Q.push({name:"SQLite database",status:"pass",details:`${Y} session${Y===1?"":"s"} present`})}catch(Y){Q.push({name:"SQLite database",status:"fail",details:Y?.message||String(Y)})}try{let Y=F.getChromaDirectory(),J=g2.existsSync(Y);Q.push({name:"Chroma vector store",status:J?"pass":"warn",details:J?`data dir ${SU.resolve(Y)}`:"Not yet initialized"})}catch(Y){Q.push({name:"Chroma vector store",status:"warn",details:Y?.message||"Unable to check Chroma directory"})}if(D.json)console.log(JSON.stringify({checks:Q},null,2));else console.log("claude-mem doctor"),console.log("================="),Q.forEach(kU);w6("info","doctor run completed",{status:Q.map((Y)=>Y.status)})}import{spawnSync as cQ}from"child_process";async function pQ(D){let{id:F,project:Q,session:B,date:Y,title:J,subtitle:X,facts:C,concepts:W,files:z}=D;if(!F||!Q||!B||!Y)console.error("Error: All fields required: --id, --project, --session, --date"),process.exit(1);if(!J||!X||!C)console.error("Error: Hierarchical format required: --title, --subtitle, --facts"),process.exit(1);try{let G=await e0(),q=new Date().toISOString();if(!await G.sessions.has(B))await G.sessions.create({session_id:B,project:Q,created_at:q,source:"save"});let U,Z,H;try{U=C?JSON.stringify(JSON.parse(C)):void 0}catch(j){U=C}try{Z=W?JSON.stringify(JSON.parse(W)):void 0}catch(j){Z=W}try{H=z?JSON.stringify(JSON.parse(z)):void 0}catch(j){H=z}if(!G.memories.hasDocumentId(F))G.memories.create({document_id:F,text:"",keywords:"",session_id:B,project:Q,created_at:q,origin:"streaming-sdk",title:J||void 0,subtitle:X||void 0,facts:U,concepts:Z,files_touched:H});if(U){let j=JSON.parse(U),L=Z?JSON.parse(Z):[],R=H?JSON.parse(H):[];j.forEach((k,b)=>{cQ("claude-mem",["chroma_add_documents","--collection_name","claude_memories","--documents",JSON.stringify([k]),"--ids",JSON.stringify([`${F}_fact_${String(b).padStart(3,"0")}`]),"--metadatas",JSON.stringify([{type:"fact",parent_id:F,fact_index:b,title:J,subtitle:X,project:Q,session_id:B,created_at:q,created_at_epoch:Date.parse(q),keywords:"",concepts:JSON.stringify(L),files_touched:JSON.stringify(R),origin:"streaming-sdk"}])])}),cQ("claude-mem",["chroma_add_documents","--collection_name","claude_memories","--documents",JSON.stringify([`${J}
611
611
  ${X}
612
612
 
613
- ${N.join(`
614
- `)}`]),"--ids",JSON.stringify([F]),"--metadatas",JSON.stringify([{type:"narrative",title:J,subtitle:X,facts_count:N.length,project:Q,session_id:B,created_at:q,created_at_epoch:Date.parse(q),keywords:"",concepts:JSON.stringify(L),files_touched:JSON.stringify(R),origin:"streaming-sdk"}])])}console.log(JSON.stringify({success:!0,memory_id:F,project:Q,session:B,date:Y,timestamp:q,hierarchical:!!(J&&X&&C)}))}catch(G){console.error(JSON.stringify({success:!1,error:G.message||"Unknown error storing memory"})),process.exit(1)}}async function nQ(D){let{project:F,session:Q,content:B}=D;if(!F||!Q||!B)console.error("Error: All fields required: --project, --session, --content"),process.exit(1);try{let Y=await e0(),J=new Date().toISOString();Y.overviews.upsert({session_id:Q,content:B,created_at:J,project:F,origin:"streaming-sdk"}),console.log(JSON.stringify({success:!0,project:F,session:Q,timestamp:J}))}catch(Y){console.error(JSON.stringify({success:!1,error:Y.message||"Unknown error storing overview"})),process.exit(1)}}import iQ from"path";import Z9 from"fs";var bU=iQ.join(process.env.HOME||"",".claude-mem","sessions");async function aQ(D){let{project:F,session:Q,title:B,subtitle:Y}=D;if(!F||!Q)console.error(JSON.stringify({success:!1,error:"Missing required fields: --project, --session"})),process.exit(1);if(!B)console.error(JSON.stringify({success:!1,error:"Missing required field: --title"})),process.exit(1);try{let J=iQ.join(bU,`${F}_streaming.json`);if(!Z9.existsSync(J))console.error(JSON.stringify({success:!1,error:`Session file not found: ${J}`})),process.exit(1);let X={};try{X=JSON.parse(Z9.readFileSync(J,"utf8"))}catch(C){console.error(JSON.stringify({success:!1,error:"Failed to parse session file"})),process.exit(1)}if(X.promptTitle=B,Y)X.promptSubtitle=Y;X.updatedAt=new Date().toISOString(),Z9.writeFileSync(J,JSON.stringify(X,null,2)),console.log(JSON.stringify({success:!0,title:B,subtitle:Y||null,project:F,session:Q}))}catch(J){console.error(JSON.stringify({success:!1,error:J.message||"Unknown error updating session metadata"})),process.exit(1)}}t0();_6();O6();async function rQ(D,F){if(!D||D.trim().length===0)console.error(JSON.stringify({success:!1,error:"Prompt is required"})),process.exit(1);let Q=null,B=null;if(F.sessionId)try{let J=S0.getInstance();for(let C of W8)J.registerMigration(C);let X=await J.initialize();if(Q=new K2(X),B=Q.getByClaudeSessionId(F.sessionId),!B)console.error(JSON.stringify({success:!1,error:`Session not found: ${F.sessionId}`})),process.exit(1)}catch(J){console.error(JSON.stringify({success:!1,error:`Database error: ${J.message}`})),process.exit(1)}let Y=`You are a title and subtitle generator for claude-mem session metadata.
613
+ ${j.join(`
614
+ `)}`]),"--ids",JSON.stringify([F]),"--metadatas",JSON.stringify([{type:"narrative",title:J,subtitle:X,facts_count:j.length,project:Q,session_id:B,created_at:q,created_at_epoch:Date.parse(q),keywords:"",concepts:JSON.stringify(L),files_touched:JSON.stringify(R),origin:"streaming-sdk"}])])}console.log(JSON.stringify({success:!0,memory_id:F,project:Q,session:B,date:Y,timestamp:q,hierarchical:!!(J&&X&&C)}))}catch(G){console.error(JSON.stringify({success:!1,error:G.message||"Unknown error storing memory"})),process.exit(1)}}async function nQ(D){let{project:F,session:Q,content:B}=D;if(!F||!Q||!B)console.error("Error: All fields required: --project, --session, --content"),process.exit(1);try{let Y=await e0(),J=new Date().toISOString();Y.overviews.upsert({session_id:Q,content:B,created_at:J,project:F,origin:"streaming-sdk"}),console.log(JSON.stringify({success:!0,project:F,session:Q,timestamp:J}))}catch(Y){console.error(JSON.stringify({success:!1,error:Y.message||"Unknown error storing overview"})),process.exit(1)}}import iQ from"path";import Z9 from"fs";var bU=iQ.join(process.env.HOME||"",".claude-mem","sessions");async function aQ(D){let{project:F,session:Q,title:B,subtitle:Y}=D;if(!F||!Q)console.error(JSON.stringify({success:!1,error:"Missing required fields: --project, --session"})),process.exit(1);if(!B)console.error(JSON.stringify({success:!1,error:"Missing required field: --title"})),process.exit(1);try{let J=iQ.join(bU,`${F}_streaming.json`);if(!Z9.existsSync(J))console.error(JSON.stringify({success:!1,error:`Session file not found: ${J}`})),process.exit(1);let X={};try{X=JSON.parse(Z9.readFileSync(J,"utf8"))}catch(C){console.error(JSON.stringify({success:!1,error:"Failed to parse session file"})),process.exit(1)}if(X.promptTitle=B,Y)X.promptSubtitle=Y;X.updatedAt=new Date().toISOString(),Z9.writeFileSync(J,JSON.stringify(X,null,2)),console.log(JSON.stringify({success:!0,title:B,subtitle:Y||null,project:F,session:Q}))}catch(J){console.error(JSON.stringify({success:!1,error:J.message||"Unknown error updating session metadata"})),process.exit(1)}}t0();_6();O6();async function rQ(D,F){if(!D||D.trim().length===0)console.error(JSON.stringify({success:!1,error:"Prompt is required"})),process.exit(1);let Q=null,B=null;if(F.sessionId)try{let J=S0.getInstance();for(let C of W8)J.registerMigration(C);let X=await J.initialize();if(Q=new K2(X),B=Q.getByClaudeSessionId(F.sessionId),!B)console.error(JSON.stringify({success:!1,error:`Session not found: ${F.sessionId}`})),process.exit(1)}catch(J){console.error(JSON.stringify({success:!1,error:`Database error: ${J.message}`})),process.exit(1)}let Y=`You are a title and subtitle generator for claude-mem session metadata.
615
615
 
616
616
  Your job is to analyze a user's request and generate:
617
617
  1. A concise title (3-8 words)
@@ -655,8 +655,8 @@ USER REQUEST:
655
655
  ${D}
656
656
 
657
657
  Now generate the title and subtitle (two lines exactly):`;try{let J=await f8({prompt:Y,options:{allowedTools:[],pathToClaudeCodeExecutable:z8()}}),X="";if(J&&typeof J==="object"&&Symbol.asyncIterator in J){for await(let G of J)if(G?.type==="assistant"&&G?.message?.content){let q=G.message.content;if(typeof q==="string")X+=q;else if(Array.isArray(q)){for(let A of q)if(A.type==="text"&&A.text)X+=A.text}}}let C=X.trim().split(`
658
- `).filter((G)=>G.trim().length>0);if(C.length<2)console.error(JSON.stringify({success:!1,error:"Could not generate title and subtitle",response:X})),process.exit(1);let z=C[0].trim(),W=C[1].trim();if(F.save&&Q&&B)try{Q.update(B.id,{title:z,subtitle:W})}catch(G){console.error(JSON.stringify({success:!1,error:`Failed to save title: ${G.message}`})),process.exit(1)}if(F.json)console.log(JSON.stringify({success:!0,title:z,subtitle:W,sessionId:B?.claude_session_id},null,2));else if(F.oneline)console.log(`${z} - ${W}`);else console.log(z),console.log(W)}catch(J){console.error(JSON.stringify({success:!1,error:J.message||"Unknown error generating title"})),process.exit(1)}}import{spawn as vU}from"child_process";import{EventEmitter as xU}from"events";class oQ extends xU{command;args;process=null;requestId=0;pendingRequests=new Map;buffer="";initialized=!1;serverCapabilities={};constructor(D="uvx",F=["chroma-mcp","--client-type","persistent","--data-dir","/Users/alexnewman/.claude-mem/chroma"]){super();this.command=D;this.args=F}async connect(){if(this.process)throw new Error("Client already connected");this.process=vU(this.command,this.args,{stdio:["pipe","pipe","pipe"]}),this.process.stdout?.on("data",(D)=>{this.handleData(D)}),this.process.stderr?.on("data",(D)=>{let F=D.toString();if(F.includes("INFO")&&F.includes("telemetry"))return;if(F.includes("ERROR")||F.includes("Error:"))console.error("MCP Server Error:",F),this.emit("error",new Error(F))}),this.process.on("exit",(D)=>{if(D!==null&&D!==0&&D!==143)console.log(`MCP Server exited with code ${D}`);this.emit("exit",D),this.cleanup()}),await this.initialize()}handleData(D){this.buffer+=D.toString();let F=this.buffer.split(`
658
+ `).filter((G)=>G.trim().length>0);if(C.length<2)console.error(JSON.stringify({success:!1,error:"Could not generate title and subtitle",response:X})),process.exit(1);let W=C[0].trim(),z=C[1].trim();if(F.save&&Q&&B)try{Q.update(B.id,{title:W,subtitle:z})}catch(G){console.error(JSON.stringify({success:!1,error:`Failed to save title: ${G.message}`})),process.exit(1)}if(F.json)console.log(JSON.stringify({success:!0,title:W,subtitle:z,sessionId:B?.claude_session_id},null,2));else if(F.oneline)console.log(`${W} - ${z}`);else console.log(W),console.log(z)}catch(J){console.error(JSON.stringify({success:!1,error:J.message||"Unknown error generating title"})),process.exit(1)}}import{spawn as vU}from"child_process";import{EventEmitter as xU}from"events";class oQ extends xU{command;args;process=null;requestId=0;pendingRequests=new Map;buffer="";initialized=!1;serverCapabilities={};constructor(D="uvx",F=["chroma-mcp","--client-type","persistent","--data-dir","/Users/alexnewman/.claude-mem/chroma"]){super();this.command=D;this.args=F}async connect(){if(this.process)throw new Error("Client already connected");this.process=vU(this.command,this.args,{stdio:["pipe","pipe","pipe"]}),this.process.stdout?.on("data",(D)=>{this.handleData(D)}),this.process.stderr?.on("data",(D)=>{let F=D.toString();if(F.includes("INFO")&&F.includes("telemetry"))return;if(F.includes("ERROR")||F.includes("Error:"))console.error("MCP Server Error:",F),this.emit("error",new Error(F))}),this.process.on("exit",(D)=>{if(D!==null&&D!==0&&D!==143)console.log(`MCP Server exited with code ${D}`);this.emit("exit",D),this.cleanup()}),await this.initialize()}handleData(D){this.buffer+=D.toString();let F=this.buffer.split(`
659
659
  `);this.buffer=F.pop()||"";for(let Q of F)if(Q.trim())try{let B=JSON.parse(Q);this.handleMessage(B)}catch(B){console.error("Failed to parse message:",Q,B)}}handleMessage(D){if("id"in D){let F=this.pendingRequests.get(D.id);if(F)if(this.pendingRequests.delete(D.id),D.error)F.reject(new Error(D.error.message));else F.resolve(D.result)}else this.emit("notification",D)}async sendRequest(D,F){if(!this.process||!this.process.stdin)throw new Error("Not connected to MCP server");let Q=++this.requestId,B={jsonrpc:"2.0",id:Q,method:D,params:F};return new Promise((Y,J)=>{this.pendingRequests.set(Q,{resolve:Y,reject:J});let X=JSON.stringify(B)+`
660
660
  `;this.process.stdin.write(X,(C)=>{if(C)this.pendingRequests.delete(Q),J(C)}),setTimeout(()=>{if(this.pendingRequests.has(Q))this.pendingRequests.delete(Q),J(new Error(`Request timeout for method: ${D}`))},30000)})}async initialize(){let D=await this.sendRequest("initialize",{protocolVersion:"2024-11-05",capabilities:{roots:{listChanged:!0},sampling:{}},clientInfo:{name:"chroma-mcp-typescript-client",version:"1.0.0"}});this.serverCapabilities=D.capabilities||{},this.initialized=!0,await this.sendNotification("notifications/initialized"),this.emit("initialized",D)}async sendNotification(D,F){if(!this.process||!this.process.stdin)throw new Error("Not connected to MCP server");let B=JSON.stringify({jsonrpc:"2.0",method:D,params:F})+`
661
661
  `;this.process.stdin.write(B)}async listTools(){if(!this.initialized)throw new Error("Client not initialized");return(await this.sendRequest("tools/list")).tools||[]}async callTool(D,F){if(!this.initialized)throw new Error("Client not initialized");return await this.sendRequest("tools/call",{name:D,arguments:F||{}})}async listResources(){if(!this.initialized)throw new Error("Client not initialized");return(await this.sendRequest("resources/list")).resources||[]}async readResource(D){if(!this.initialized)throw new Error("Client not initialized");return await this.sendRequest("resources/read",{uri:D})}async listPrompts(){if(!this.initialized)throw new Error("Client not initialized");return(await this.sendRequest("prompts/list")).prompts||[]}async getPrompt(D,F){if(!this.initialized)throw new Error("Client not initialized");return await this.sendRequest("prompts/get",{name:D,arguments:F||{}})}async ping(){await this.sendRequest("ping")}getCapabilities(){return this.serverCapabilities}isInitialized(){return this.initialized}async disconnect(){if(this.process){for(let[D,F]of this.pendingRequests)F.reject(new Error("Client disconnected"));this.pendingRequests.clear(),this.process.kill("SIGTERM"),await new Promise((D)=>{let F=setTimeout(()=>{if(this.process&&!this.process.killed)this.process.kill("SIGKILL");D()},1000);this.process?.once("exit",()=>{clearTimeout(F),D()})}),this.cleanup()}}cleanup(){this.process=null,this.initialized=!1,this.buffer="",this.pendingRequests.clear()}}var sQ=oQ;import tQ from"fs";import D1 from"path";import{fileURLToPath as uU}from"url";var yU=uU(import.meta.url),eQ=D1.dirname(yU);async function DX(D,F){let Q=new sQ;try{await Q.connect();let B=gU(D,F),Y=await Q.callTool(D,B),J=fU(Y);console.log(J),await Q.disconnect(),process.exit(0)}catch(B){console.error(JSON.stringify({success:!1,error:B.message||"Unknown error calling MCP tool",tool:D},null,2)),await Q.disconnect(),process.exit(1)}}function fU(D){if(D?.content&&Array.isArray(D.content)){let F=D.content.filter((Q)=>Q.type==="text").map((Q)=>Q.text).join(`
662
- `);try{let Q=JSON.parse(F);return JSON.stringify(Q,null,2)}catch{return F}}if(typeof D==="object")return JSON.stringify(D,null,2);return String(D)}function gU(D,F){let Q={};for(let[B,Y]of Object.entries(F)){if(B.startsWith("_")||typeof Y==="function")continue;if(typeof Y==="string")try{Q[B]=JSON.parse(Y)}catch{Q[B]=Y}else Q[B]=Y}return Q}function FX(){let D=[D1.join(eQ,"../../chroma-mcp-tools/CHROMA_MCP_TOOLS.json"),D1.join(process.cwd(),"chroma-mcp-tools/CHROMA_MCP_TOOLS.json"),D1.join(eQ,"../chroma-mcp-tools/CHROMA_MCP_TOOLS.json")];for(let F of D)if(tQ.existsSync(F)){let Q=tQ.readFileSync(F,"utf-8");return JSON.parse(Q)}throw new Error("Could not find CHROMA_MCP_TOOLS.json")}function BX(D){let F=[];if(!D.properties)return F;let Q=D.required||[];for(let[B,Y]of Object.entries(D.properties)){let J=Y,X=Q.includes(B),C="string";if(J.type==="integer"||J.type==="number")C="number";else if(J.type==="array")C="array";else if(J.type==="object")C="json";else if(J.anyOf){let G=J.anyOf.find((q)=>q.type!=="null");if(G?.type==="integer"||G?.type==="number")C="number";else if(G?.type==="array")C="array";else if(G?.type==="object")C="json"}let z=X?`--${B} <${C}>`:`--${B} [${C}]`,W=J.title||B;if(J.default!==void 0)W+=` (default: ${JSON.stringify(J.default)})`;if(C==="array")W+=" (JSON array)";else if(C==="json")W+=" (JSON object)";F.push({flag:z,description:W,required:X,type:C})}return F}var q0=new a9;q0.name(W2).description(B3).version(F3);q0.command("install").description("Install Claude Code hooks for automatic compression").option("--user","Install for current user (default)").option("--project","Install for current project only").option("--local","Install to custom local directory").option("--path <path>","Custom installation path (with --local)").option("--timeout <ms>","Hook execution timeout in milliseconds","180000").option("--skip-mcp","Skip Chroma MCP server installation").option("--force","Force installation even if already installed").action(f4);q0.command("uninstall").description("Remove Claude Code hooks").option("--user","Remove from user settings (default)").option("--project","Remove from project settings").option("--all","Remove from both user and project settings").action(h4);q0.command("status").description("Check installation status of Claude Memory System").action(R5);q0.command("doctor").description("Run environment and pipeline diagnostics for rolling memory").option("--json","Output JSON instead of text").action(async(D)=>{try{await dQ(D)}catch(F){console.error(`doctor failed: ${F.message||F}`),process.exitCode=1}});q0.command("logs").description("View claude-mem operation logs").option("--debug","Show debug logs only").option("--error","Show error logs only").option("--tail [n]","Show last n lines","50").option("--follow","Follow log output").action(O5);q0.command("load-context").description("Load compressed memories for current session").option("--project <name>","Filter by project name").option("--count <n>","Number of memories to load","10").option("--raw","Output raw JSON instead of formatted text").option("--format <type>","Output format: json, session-start, or default").action(c5);var V9=q0.command("trash").description("Manage trash bin for safe file deletion").argument("[files...]","Files to move to trash").option("-r, --recursive","Remove directories recursively").option("-R","Remove directories recursively (same as -r)").option("-f, --force","Suppress errors for nonexistent files").action(async(D,F)=>{if(!D||D.length===0){V9.outputHelp();return}if(F.R)F.recursive=!0;await hB(D,{force:F.force,recursive:F.recursive})});V9.command("view").description("View contents of trash bin").action(nB);V9.command("empty").description("Permanently delete all files in trash").option("-f, --force","Skip confirmation prompt").action(aB);q0.command("restore").description("Restore files from trash interactively").action(oB);q0.command("store-memory").description("Store a memory to all storage layers (used by SDK)").requiredOption("--id <id>","Memory ID").requiredOption("--project <project>","Project name").requiredOption("--session <session>","Session ID").requiredOption("--date <date>","Date (YYYY-MM-DD)").requiredOption("--title <title>","Memory title (3-8 words)").requiredOption("--subtitle <subtitle>","Memory subtitle (max 24 words)").requiredOption("--facts <json>","Atomic facts as JSON array").option("--concepts <json>","Concept tags as JSON array").option("--files <json>","Files touched as JSON array").action(pQ);q0.command("store-overview").description("Store a session overview (used by SDK)").requiredOption("--project <project>","Project name").requiredOption("--session <session>","Session ID").requiredOption("--content <content>","Overview content").action(nQ);q0.command("update-session-metadata").description("Update session title and subtitle (used by SDK)").requiredOption("--project <project>","Project name").requiredOption("--session <session>","Session ID").requiredOption("--title <title>","Session title (3-6 words)").option("--subtitle <subtitle>","Session subtitle (max 20 words)").action(aQ);q0.command("changelog").description("Generate CHANGELOG.md from claude-mem memories").option("--historical <n>","Number of versions to search (default: current version only)").option("--generate <version>","Generate changelog for a specific version").option("--start <time>","Start time for memory search (ISO format)").option("--end <time>","End time for memory search (ISO format)").option("--update","Update CHANGELOG.md from JSONL entries").option("--preview","Preview the generated changelog").option("-v, --verbose","Show detailed output").action(lQ);q0.command("generate-title <prompt>").description("Generate a session title and subtitle from a prompt").option("--json","Output as JSON").option("--oneline","Output as single line (title - subtitle)").option("--session-id <id>","Claude session ID to update").option("--save","Save the generated title to the database (requires --session-id)").action(rQ);try{let D=FX();for(let F of D){let Q=q0.command(F.name).description(F.description||`Execute ${F.name} MCP tool`),B=BX(F.inputSchema);for(let Y of B)if(Y.required)Q.requiredOption(Y.flag,Y.description);else Q.option(Y.flag,Y.description);Q.action(async(Y)=>{await DX(F.name,Y)})}}catch(D){console.warn("Warning: Could not load Chroma MCP tools:",D)}q0.parse();export{W8 as migrations,A7 as initializeDatabase,A0 as getDatabase,K2 as StreamingSessionStore,S0 as DatabaseManager};
662
+ `);try{let Q=JSON.parse(F);return JSON.stringify(Q,null,2)}catch{return F}}if(typeof D==="object")return JSON.stringify(D,null,2);return String(D)}function gU(D,F){let Q={};for(let[B,Y]of Object.entries(F)){if(B.startsWith("_")||typeof Y==="function")continue;if(typeof Y==="string")try{Q[B]=JSON.parse(Y)}catch{Q[B]=Y}else Q[B]=Y}return Q}function FX(){let D=[D1.join(eQ,"../../chroma-mcp-tools/CHROMA_MCP_TOOLS.json"),D1.join(process.cwd(),"chroma-mcp-tools/CHROMA_MCP_TOOLS.json"),D1.join(eQ,"../chroma-mcp-tools/CHROMA_MCP_TOOLS.json")];for(let F of D)if(tQ.existsSync(F)){let Q=tQ.readFileSync(F,"utf-8");return JSON.parse(Q)}throw new Error("Could not find CHROMA_MCP_TOOLS.json")}function BX(D){let F=[];if(!D.properties)return F;let Q=D.required||[];for(let[B,Y]of Object.entries(D.properties)){let J=Y,X=Q.includes(B),C="string";if(J.type==="integer"||J.type==="number")C="number";else if(J.type==="array")C="array";else if(J.type==="object")C="json";else if(J.anyOf){let G=J.anyOf.find((q)=>q.type!=="null");if(G?.type==="integer"||G?.type==="number")C="number";else if(G?.type==="array")C="array";else if(G?.type==="object")C="json"}let W=X?`--${B} <${C}>`:`--${B} [${C}]`,z=J.title||B;if(J.default!==void 0)z+=` (default: ${JSON.stringify(J.default)})`;if(C==="array")z+=" (JSON array)";else if(C==="json")z+=" (JSON object)";F.push({flag:W,description:z,required:X,type:C})}return F}var q0=new a9;q0.name(W2).description(B3).version(F3);q0.command("install").description("Install Claude Code hooks for automatic compression").option("--user","Install for current user (default)").option("--project","Install for current project only").option("--local","Install to custom local directory").option("--path <path>","Custom installation path (with --local)").option("--timeout <ms>","Hook execution timeout in milliseconds","180000").option("--skip-mcp","Skip Chroma MCP server installation").option("--force","Force installation even if already installed").action(f4);q0.command("uninstall").description("Remove Claude Code hooks").option("--user","Remove from user settings (default)").option("--project","Remove from project settings").option("--all","Remove from both user and project settings").action(h4);q0.command("status").description("Check installation status of Claude Memory System").action(R5);q0.command("doctor").description("Run environment and pipeline diagnostics for rolling memory").option("--json","Output JSON instead of text").action(async(D)=>{try{await dQ(D)}catch(F){console.error(`doctor failed: ${F.message||F}`),process.exitCode=1}});q0.command("logs").description("View claude-mem operation logs").option("--debug","Show debug logs only").option("--error","Show error logs only").option("--tail [n]","Show last n lines","50").option("--follow","Follow log output").action(O5);q0.command("load-context").description("Load compressed memories for current session").option("--project <name>","Filter by project name").option("--count <n>","Number of memories to load","10").option("--raw","Output raw JSON instead of formatted text").option("--format <type>","Output format: json, session-start, or default").action(c5);var V9=q0.command("trash").description("Manage trash bin for safe file deletion").argument("[files...]","Files to move to trash").option("-r, --recursive","Remove directories recursively").option("-R","Remove directories recursively (same as -r)").option("-f, --force","Suppress errors for nonexistent files").action(async(D,F)=>{if(!D||D.length===0){V9.outputHelp();return}if(F.R)F.recursive=!0;await hB(D,{force:F.force,recursive:F.recursive})});V9.command("view").description("View contents of trash bin").action(nB);V9.command("empty").description("Permanently delete all files in trash").option("-f, --force","Skip confirmation prompt").action(aB);q0.command("restore").description("Restore files from trash interactively").action(oB);q0.command("store-memory").description("Store a memory to all storage layers (used by SDK)").requiredOption("--id <id>","Memory ID").requiredOption("--project <project>","Project name").requiredOption("--session <session>","Session ID").requiredOption("--date <date>","Date (YYYY-MM-DD)").requiredOption("--title <title>","Memory title (3-8 words)").requiredOption("--subtitle <subtitle>","Memory subtitle (max 24 words)").requiredOption("--facts <json>","Atomic facts as JSON array").option("--concepts <json>","Concept tags as JSON array").option("--files <json>","Files touched as JSON array").action(pQ);q0.command("store-overview").description("Store a session overview (used by SDK)").requiredOption("--project <project>","Project name").requiredOption("--session <session>","Session ID").requiredOption("--content <content>","Overview content").action(nQ);q0.command("update-session-metadata").description("Update session title and subtitle (used by SDK)").requiredOption("--project <project>","Project name").requiredOption("--session <session>","Session ID").requiredOption("--title <title>","Session title (3-6 words)").option("--subtitle <subtitle>","Session subtitle (max 20 words)").action(aQ);q0.command("changelog").description("Generate CHANGELOG.md from claude-mem memories").option("--historical <n>","Number of versions to search (default: current version only)").option("--generate <version>","Generate changelog for a specific version").option("--start <time>","Start time for memory search (ISO format)").option("--end <time>","End time for memory search (ISO format)").option("--update","Update CHANGELOG.md from JSONL entries").option("--preview","Preview the generated changelog").option("-v, --verbose","Show detailed output").action(lQ);q0.command("generate-title <prompt>").description("Generate a session title and subtitle from a prompt").option("--json","Output as JSON").option("--oneline","Output as single line (title - subtitle)").option("--session-id <id>","Claude session ID to update").option("--save","Save the generated title to the database (requires --session-id)").action(rQ);try{let D=FX();for(let F of D){let Q=q0.command(F.name).description(F.description||`Execute ${F.name} MCP tool`),B=BX(F.inputSchema);for(let Y of B)if(Y.required)Q.requiredOption(Y.flag,Y.description);else Q.option(Y.flag,Y.description);Q.action(async(Y)=>{await DX(F.name,Y)})}}catch(D){console.warn("Warning: Could not load Chroma MCP tools:",D)}q0.parse();export{W8 as migrations,A7 as initializeDatabase,A0 as getDatabase,K2 as StreamingSessionStore,S0 as DatabaseManager};