agentlogs 0.0.14 → 0.0.15

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.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/dist/index.js +75 -75
  3. package/package.json +2 -1
package/dist/index.js CHANGED
@@ -1,103 +1,103 @@
1
1
  #!/usr/bin/env node
2
- import{createRequire as rV}from"node:module";var cV=Object.create;var{getPrototypeOf:lV,defineProperty:_8,getOwnPropertyNames:pV}=Object;var dV=Object.prototype.hasOwnProperty;var z8=(_,z,A)=>{A=_!=null?cV(lV(_)):{};let b=z||!_||!_.__esModule?_8(A,"default",{value:_,enumerable:!0}):A;for(let G of pV(_))if(!dV.call(b,G))_8(b,G,{get:()=>_[G],enumerable:!0});return b};var I=(_,z)=>()=>(z||_((z={exports:{}}).exports,z),z.exports);var A8=(_,z)=>{for(var A in z)_8(_,A,{get:z[A],enumerable:!0,configurable:!0,set:(b)=>z[A]=()=>b})};var q4=rV(import.meta.url);var n1=I((nV)=>{class b8 extends Error{constructor(_,z,A){super(A);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=z,this.exitCode=_,this.nestedError=void 0}}class jb extends b8{constructor(_){super(1,"commander.invalidArgument",_);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}nV.CommanderError=b8;nV.InvalidArgumentError=jb});var R3=I((tV)=>{var{InvalidArgumentError:aV}=n1();class Rb{constructor(_,z){switch(this.description=z||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,_[0]){case"<":this.required=!0,this._name=_.slice(1,-1);break;case"[":this.required=!1,this._name=_.slice(1,-1);break;default:this.required=!0,this._name=_;break}if(this._name.endsWith("..."))this.variadic=!0,this._name=this._name.slice(0,-3)}name(){return this._name}_collectValue(_,z){if(z===this.defaultValue||!Array.isArray(z))return[_];return z.push(_),z}default(_,z){return this.defaultValue=_,this.defaultValueDescription=z,this}argParser(_){return this.parseArg=_,this}choices(_){return this.argChoices=_.slice(),this.parseArg=(z,A)=>{if(!this.argChoices.includes(z))throw new aV(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._collectValue(z,A);return z},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}}function sV(_){let z=_.name()+(_.variadic===!0?"...":"");return _.required?"<"+z+">":"["+z+"]"}tV.Argument=Rb;tV.humanReadableArgName=sV});var G8=I((AU)=>{var{humanReadableArgName:zU}=R3();class Pb{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(_){this.helpWidth=this.helpWidth??_.helpWidth??80}visibleCommands(_){let z=_.commands.filter((b)=>!b._hidden),A=_._getHelpCommand();if(A&&!A._hidden)z.push(A);if(this.sortSubcommands)z.sort((b,G)=>{return b.name().localeCompare(G.name())});return z}compareOptions(_,z){let A=(b)=>{return b.short?b.short.replace(/^-/,""):b.long.replace(/^--/,"")};return A(_).localeCompare(A(z))}visibleOptions(_){let z=_.options.filter((b)=>!b.hidden),A=_._getHelpOption();if(A&&!A.hidden){let b=A.short&&_._findOption(A.short),G=A.long&&_._findOption(A.long);if(!b&&!G)z.push(A);else if(A.long&&!G)z.push(_.createOption(A.long,A.description));else if(A.short&&!b)z.push(_.createOption(A.short,A.description))}if(this.sortOptions)z.sort(this.compareOptions);return z}visibleGlobalOptions(_){if(!this.showGlobalOptions)return[];let z=[];for(let A=_.parent;A;A=A.parent){let b=A.options.filter((G)=>!G.hidden);z.push(...b)}if(this.sortOptions)z.sort(this.compareOptions);return z}visibleArguments(_){if(_._argsDescription)_.registeredArguments.forEach((z)=>{z.description=z.description||_._argsDescription[z.name()]||""});if(_.registeredArguments.find((z)=>z.description))return _.registeredArguments;return[]}subcommandTerm(_){let z=_.registeredArguments.map((A)=>zU(A)).join(" ");return _._name+(_._aliases[0]?"|"+_._aliases[0]:"")+(_.options.length?" [options]":"")+(z?" "+z:"")}optionTerm(_){return _.flags}argumentTerm(_){return _.name()}longestSubcommandTermLength(_,z){return z.visibleCommands(_).reduce((A,b)=>{return Math.max(A,this.displayWidth(z.styleSubcommandTerm(z.subcommandTerm(b))))},0)}longestOptionTermLength(_,z){return z.visibleOptions(_).reduce((A,b)=>{return Math.max(A,this.displayWidth(z.styleOptionTerm(z.optionTerm(b))))},0)}longestGlobalOptionTermLength(_,z){return z.visibleGlobalOptions(_).reduce((A,b)=>{return Math.max(A,this.displayWidth(z.styleOptionTerm(z.optionTerm(b))))},0)}longestArgumentTermLength(_,z){return z.visibleArguments(_).reduce((A,b)=>{return Math.max(A,this.displayWidth(z.styleArgumentTerm(z.argumentTerm(b))))},0)}commandUsage(_){let z=_._name;if(_._aliases[0])z=z+"|"+_._aliases[0];let A="";for(let b=_.parent;b;b=b.parent)A=b.name()+" "+A;return A+z+" "+_.usage()}commandDescription(_){return _.description()}subcommandDescription(_){return _.summary()||_.description()}optionDescription(_){let z=[];if(_.argChoices)z.push(`choices: ${_.argChoices.map((A)=>JSON.stringify(A)).join(", ")}`);if(_.defaultValue!==void 0){if(_.required||_.optional||_.isBoolean()&&typeof _.defaultValue==="boolean")z.push(`default: ${_.defaultValueDescription||JSON.stringify(_.defaultValue)}`)}if(_.presetArg!==void 0&&_.optional)z.push(`preset: ${JSON.stringify(_.presetArg)}`);if(_.envVar!==void 0)z.push(`env: ${_.envVar}`);if(z.length>0){let A=`(${z.join(", ")})`;if(_.description)return`${_.description} ${A}`;return A}return _.description}argumentDescription(_){let z=[];if(_.argChoices)z.push(`choices: ${_.argChoices.map((A)=>JSON.stringify(A)).join(", ")}`);if(_.defaultValue!==void 0)z.push(`default: ${_.defaultValueDescription||JSON.stringify(_.defaultValue)}`);if(z.length>0){let A=`(${z.join(", ")})`;if(_.description)return`${_.description} ${A}`;return A}return _.description}formatItemList(_,z,A){if(z.length===0)return[];return[A.styleTitle(_),...z,""]}groupItems(_,z,A){let b=new Map;return _.forEach((G)=>{let J=A(G);if(!b.has(J))b.set(J,[])}),z.forEach((G)=>{let J=A(G);if(!b.has(J))b.set(J,[]);b.get(J).push(G)}),b}formatHelp(_,z){let A=z.padWidth(_,z),b=z.helpWidth??80;function G(H,B){return z.formatItem(H,A,B,z)}let J=[`${z.styleTitle("Usage:")} ${z.styleUsage(z.commandUsage(_))}`,""],Y=z.commandDescription(_);if(Y.length>0)J=J.concat([z.boxWrap(z.styleCommandDescription(Y),b),""]);let X=z.visibleArguments(_).map((H)=>{return G(z.styleArgumentTerm(z.argumentTerm(H)),z.styleArgumentDescription(z.argumentDescription(H)))});if(J=J.concat(this.formatItemList("Arguments:",X,z)),this.groupItems(_.options,z.visibleOptions(_),(H)=>H.helpGroupHeading??"Options:").forEach((H,B)=>{let Z=H.map((F)=>{return G(z.styleOptionTerm(z.optionTerm(F)),z.styleOptionDescription(z.optionDescription(F)))});J=J.concat(this.formatItemList(B,Z,z))}),z.showGlobalOptions){let H=z.visibleGlobalOptions(_).map((B)=>{return G(z.styleOptionTerm(z.optionTerm(B)),z.styleOptionDescription(z.optionDescription(B)))});J=J.concat(this.formatItemList("Global Options:",H,z))}return this.groupItems(_.commands,z.visibleCommands(_),(H)=>H.helpGroup()||"Commands:").forEach((H,B)=>{let Z=H.map((F)=>{return G(z.styleSubcommandTerm(z.subcommandTerm(F)),z.styleSubcommandDescription(z.subcommandDescription(F)))});J=J.concat(this.formatItemList(B,Z,z))}),J.join(`
3
- `)}displayWidth(_){return Sb(_).length}styleTitle(_){return _}styleUsage(_){return _.split(" ").map((z)=>{if(z==="[options]")return this.styleOptionText(z);if(z==="[command]")return this.styleSubcommandText(z);if(z[0]==="["||z[0]==="<")return this.styleArgumentText(z);return this.styleCommandText(z)}).join(" ")}styleCommandDescription(_){return this.styleDescriptionText(_)}styleOptionDescription(_){return this.styleDescriptionText(_)}styleSubcommandDescription(_){return this.styleDescriptionText(_)}styleArgumentDescription(_){return this.styleDescriptionText(_)}styleDescriptionText(_){return _}styleOptionTerm(_){return this.styleOptionText(_)}styleSubcommandTerm(_){return _.split(" ").map((z)=>{if(z==="[options]")return this.styleOptionText(z);if(z[0]==="["||z[0]==="<")return this.styleArgumentText(z);return this.styleSubcommandText(z)}).join(" ")}styleArgumentTerm(_){return this.styleArgumentText(_)}styleOptionText(_){return _}styleArgumentText(_){return _}styleSubcommandText(_){return _}styleCommandText(_){return _}padWidth(_,z){return Math.max(z.longestOptionTermLength(_,z),z.longestGlobalOptionTermLength(_,z),z.longestSubcommandTermLength(_,z),z.longestArgumentTermLength(_,z))}preformatted(_){return/\n[^\S\r\n]/.test(_)}formatItem(_,z,A,b){let J=" ".repeat(2);if(!A)return J+_;let Y=_.padEnd(z+_.length-b.displayWidth(_)),X=2,$=(this.helpWidth??80)-z-X-2,H;if($<this.minWidthToWrap||b.preformatted(A))H=A;else H=b.boxWrap(A,$).replace(/\n/g,`
2
+ import{createRequire as iV}from"node:module";var pV=Object.create;var{getPrototypeOf:dV,defineProperty:b8,getOwnPropertyNames:rV}=Object;var nV=Object.prototype.hasOwnProperty;var G8=(_,z,A)=>{A=_!=null?pV(dV(_)):{};let b=z||!_||!_.__esModule?b8(A,"default",{value:_,enumerable:!0}):A;for(let G of rV(_))if(!nV.call(b,G))b8(b,G,{get:()=>_[G],enumerable:!0});return b};var I=(_,z)=>()=>(z||_((z={exports:{}}).exports,z),z.exports);var J8=(_,z)=>{for(var A in z)b8(_,A,{get:z[A],enumerable:!0,configurable:!0,set:(b)=>z[A]=()=>b})};var q4=iV(import.meta.url);var o1=I((oV)=>{class Y8 extends Error{constructor(_,z,A){super(A);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=z,this.exitCode=_,this.nestedError=void 0}}class Pb extends Y8{constructor(_){super(1,"commander.invalidArgument",_);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}oV.CommanderError=Y8;oV.InvalidArgumentError=Pb});var S3=I((_U)=>{var{InvalidArgumentError:tV}=o1();class Sb{constructor(_,z){switch(this.description=z||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,_[0]){case"<":this.required=!0,this._name=_.slice(1,-1);break;case"[":this.required=!1,this._name=_.slice(1,-1);break;default:this.required=!0,this._name=_;break}if(this._name.endsWith("..."))this.variadic=!0,this._name=this._name.slice(0,-3)}name(){return this._name}_collectValue(_,z){if(z===this.defaultValue||!Array.isArray(z))return[_];return z.push(_),z}default(_,z){return this.defaultValue=_,this.defaultValueDescription=z,this}argParser(_){return this.parseArg=_,this}choices(_){return this.argChoices=_.slice(),this.parseArg=(z,A)=>{if(!this.argChoices.includes(z))throw new tV(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._collectValue(z,A);return z},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}}function eV(_){let z=_.name()+(_.variadic===!0?"...":"");return _.required?"<"+z+">":"["+z+"]"}_U.Argument=Sb;_U.humanReadableArgName=eV});var X8=I((GU)=>{var{humanReadableArgName:bU}=S3();class kb{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(_){this.helpWidth=this.helpWidth??_.helpWidth??80}visibleCommands(_){let z=_.commands.filter((b)=>!b._hidden),A=_._getHelpCommand();if(A&&!A._hidden)z.push(A);if(this.sortSubcommands)z.sort((b,G)=>{return b.name().localeCompare(G.name())});return z}compareOptions(_,z){let A=(b)=>{return b.short?b.short.replace(/^-/,""):b.long.replace(/^--/,"")};return A(_).localeCompare(A(z))}visibleOptions(_){let z=_.options.filter((b)=>!b.hidden),A=_._getHelpOption();if(A&&!A.hidden){let b=A.short&&_._findOption(A.short),G=A.long&&_._findOption(A.long);if(!b&&!G)z.push(A);else if(A.long&&!G)z.push(_.createOption(A.long,A.description));else if(A.short&&!b)z.push(_.createOption(A.short,A.description))}if(this.sortOptions)z.sort(this.compareOptions);return z}visibleGlobalOptions(_){if(!this.showGlobalOptions)return[];let z=[];for(let A=_.parent;A;A=A.parent){let b=A.options.filter((G)=>!G.hidden);z.push(...b)}if(this.sortOptions)z.sort(this.compareOptions);return z}visibleArguments(_){if(_._argsDescription)_.registeredArguments.forEach((z)=>{z.description=z.description||_._argsDescription[z.name()]||""});if(_.registeredArguments.find((z)=>z.description))return _.registeredArguments;return[]}subcommandTerm(_){let z=_.registeredArguments.map((A)=>bU(A)).join(" ");return _._name+(_._aliases[0]?"|"+_._aliases[0]:"")+(_.options.length?" [options]":"")+(z?" "+z:"")}optionTerm(_){return _.flags}argumentTerm(_){return _.name()}longestSubcommandTermLength(_,z){return z.visibleCommands(_).reduce((A,b)=>{return Math.max(A,this.displayWidth(z.styleSubcommandTerm(z.subcommandTerm(b))))},0)}longestOptionTermLength(_,z){return z.visibleOptions(_).reduce((A,b)=>{return Math.max(A,this.displayWidth(z.styleOptionTerm(z.optionTerm(b))))},0)}longestGlobalOptionTermLength(_,z){return z.visibleGlobalOptions(_).reduce((A,b)=>{return Math.max(A,this.displayWidth(z.styleOptionTerm(z.optionTerm(b))))},0)}longestArgumentTermLength(_,z){return z.visibleArguments(_).reduce((A,b)=>{return Math.max(A,this.displayWidth(z.styleArgumentTerm(z.argumentTerm(b))))},0)}commandUsage(_){let z=_._name;if(_._aliases[0])z=z+"|"+_._aliases[0];let A="";for(let b=_.parent;b;b=b.parent)A=b.name()+" "+A;return A+z+" "+_.usage()}commandDescription(_){return _.description()}subcommandDescription(_){return _.summary()||_.description()}optionDescription(_){let z=[];if(_.argChoices)z.push(`choices: ${_.argChoices.map((A)=>JSON.stringify(A)).join(", ")}`);if(_.defaultValue!==void 0){if(_.required||_.optional||_.isBoolean()&&typeof _.defaultValue==="boolean")z.push(`default: ${_.defaultValueDescription||JSON.stringify(_.defaultValue)}`)}if(_.presetArg!==void 0&&_.optional)z.push(`preset: ${JSON.stringify(_.presetArg)}`);if(_.envVar!==void 0)z.push(`env: ${_.envVar}`);if(z.length>0){let A=`(${z.join(", ")})`;if(_.description)return`${_.description} ${A}`;return A}return _.description}argumentDescription(_){let z=[];if(_.argChoices)z.push(`choices: ${_.argChoices.map((A)=>JSON.stringify(A)).join(", ")}`);if(_.defaultValue!==void 0)z.push(`default: ${_.defaultValueDescription||JSON.stringify(_.defaultValue)}`);if(z.length>0){let A=`(${z.join(", ")})`;if(_.description)return`${_.description} ${A}`;return A}return _.description}formatItemList(_,z,A){if(z.length===0)return[];return[A.styleTitle(_),...z,""]}groupItems(_,z,A){let b=new Map;return _.forEach((G)=>{let J=A(G);if(!b.has(J))b.set(J,[])}),z.forEach((G)=>{let J=A(G);if(!b.has(J))b.set(J,[]);b.get(J).push(G)}),b}formatHelp(_,z){let A=z.padWidth(_,z),b=z.helpWidth??80;function G(H,B){return z.formatItem(H,A,B,z)}let J=[`${z.styleTitle("Usage:")} ${z.styleUsage(z.commandUsage(_))}`,""],Y=z.commandDescription(_);if(Y.length>0)J=J.concat([z.boxWrap(z.styleCommandDescription(Y),b),""]);let X=z.visibleArguments(_).map((H)=>{return G(z.styleArgumentTerm(z.argumentTerm(H)),z.styleArgumentDescription(z.argumentDescription(H)))});if(J=J.concat(this.formatItemList("Arguments:",X,z)),this.groupItems(_.options,z.visibleOptions(_),(H)=>H.helpGroupHeading??"Options:").forEach((H,B)=>{let Z=H.map((F)=>{return G(z.styleOptionTerm(z.optionTerm(F)),z.styleOptionDescription(z.optionDescription(F)))});J=J.concat(this.formatItemList(B,Z,z))}),z.showGlobalOptions){let H=z.visibleGlobalOptions(_).map((B)=>{return G(z.styleOptionTerm(z.optionTerm(B)),z.styleOptionDescription(z.optionDescription(B)))});J=J.concat(this.formatItemList("Global Options:",H,z))}return this.groupItems(_.commands,z.visibleCommands(_),(H)=>H.helpGroup()||"Commands:").forEach((H,B)=>{let Z=H.map((F)=>{return G(z.styleSubcommandTerm(z.subcommandTerm(F)),z.styleSubcommandDescription(z.subcommandDescription(F)))});J=J.concat(this.formatItemList(B,Z,z))}),J.join(`
3
+ `)}displayWidth(_){return Ib(_).length}styleTitle(_){return _}styleUsage(_){return _.split(" ").map((z)=>{if(z==="[options]")return this.styleOptionText(z);if(z==="[command]")return this.styleSubcommandText(z);if(z[0]==="["||z[0]==="<")return this.styleArgumentText(z);return this.styleCommandText(z)}).join(" ")}styleCommandDescription(_){return this.styleDescriptionText(_)}styleOptionDescription(_){return this.styleDescriptionText(_)}styleSubcommandDescription(_){return this.styleDescriptionText(_)}styleArgumentDescription(_){return this.styleDescriptionText(_)}styleDescriptionText(_){return _}styleOptionTerm(_){return this.styleOptionText(_)}styleSubcommandTerm(_){return _.split(" ").map((z)=>{if(z==="[options]")return this.styleOptionText(z);if(z[0]==="["||z[0]==="<")return this.styleArgumentText(z);return this.styleSubcommandText(z)}).join(" ")}styleArgumentTerm(_){return this.styleArgumentText(_)}styleOptionText(_){return _}styleArgumentText(_){return _}styleSubcommandText(_){return _}styleCommandText(_){return _}padWidth(_,z){return Math.max(z.longestOptionTermLength(_,z),z.longestGlobalOptionTermLength(_,z),z.longestSubcommandTermLength(_,z),z.longestArgumentTermLength(_,z))}preformatted(_){return/\n[^\S\r\n]/.test(_)}formatItem(_,z,A,b){let J=" ".repeat(2);if(!A)return J+_;let Y=_.padEnd(z+_.length-b.displayWidth(_)),X=2,$=(this.helpWidth??80)-z-X-2,H;if($<this.minWidthToWrap||b.preformatted(A))H=A;else H=b.boxWrap(A,$).replace(/\n/g,`
4
4
  `+" ".repeat(z+X));return J+Y+" ".repeat(X)+H.replace(/\n/g,`
5
5
  ${J}`)}boxWrap(_,z){if(z<this.minWidthToWrap)return _;let A=_.split(/\r\n|\n/),b=/[\s]*[^\s]+/g,G=[];return A.forEach((J)=>{let Y=J.match(b);if(Y===null){G.push("");return}let X=[Y.shift()],Q=this.displayWidth(X[0]);Y.forEach(($)=>{let H=this.displayWidth($);if(Q+H<=z){X.push($),Q+=H;return}G.push(X.join(""));let B=$.trimStart();X=[B],Q=this.displayWidth(B)}),G.push(X.join(""))}),G.join(`
6
- `)}}function Sb(_){let z=/\x1b\[\d*(;\d*)*m/g;return _.replace(z,"")}AU.Help=Pb;AU.stripColor=Sb});var J8=I((XU)=>{var{InvalidArgumentError:JU}=n1();class Ib{constructor(_,z){this.flags=_,this.description=z||"",this.required=_.includes("<"),this.optional=_.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(_),this.mandatory=!1;let A=YU(_);if(this.short=A.shortFlag,this.long=A.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(_,z){return this.defaultValue=_,this.defaultValueDescription=z,this}preset(_){return this.presetArg=_,this}conflicts(_){return this.conflictsWith=this.conflictsWith.concat(_),this}implies(_){let z=_;if(typeof _==="string")z={[_]:!0};return this.implied=Object.assign(this.implied||{},z),this}env(_){return this.envVar=_,this}argParser(_){return this.parseArg=_,this}makeOptionMandatory(_=!0){return this.mandatory=!!_,this}hideHelp(_=!0){return this.hidden=!!_,this}_collectValue(_,z){if(z===this.defaultValue||!Array.isArray(z))return[_];return z.push(_),z}choices(_){return this.argChoices=_.slice(),this.parseArg=(z,A)=>{if(!this.argChoices.includes(z))throw new JU(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._collectValue(z,A);return z},this}name(){if(this.long)return this.long.replace(/^--/,"");return this.short.replace(/^-/,"")}attributeName(){if(this.negate)return kb(this.name().replace(/^no-/,""));return kb(this.name())}helpGroup(_){return this.helpGroupHeading=_,this}is(_){return this.short===_||this.long===_}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class xb{constructor(_){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,_.forEach((z)=>{if(z.negate)this.negativeOptions.set(z.attributeName(),z);else this.positiveOptions.set(z.attributeName(),z)}),this.negativeOptions.forEach((z,A)=>{if(this.positiveOptions.has(A))this.dualOptions.add(A)})}valueFromOption(_,z){let A=z.attributeName();if(!this.dualOptions.has(A))return!0;let b=this.negativeOptions.get(A).presetArg,G=b!==void 0?b:!1;return z.negate===(G===_)}}function kb(_){return _.split("-").reduce((z,A)=>{return z+A[0].toUpperCase()+A.slice(1)})}function YU(_){let z,A,b=/^-[^-]$/,G=/^--[^-]/,J=_.split(/[ |,]+/).concat("guard");if(b.test(J[0]))z=J.shift();if(G.test(J[0]))A=J.shift();if(!z&&b.test(J[0]))z=J.shift();if(!z&&G.test(J[0]))z=A,A=J.shift();if(J[0].startsWith("-")){let Y=J[0],X=`option creation failed due to '${Y}' in option flags '${_}'`;if(/^-[^-][^-]/.test(Y))throw Error(`${X}
6
+ `)}}function Ib(_){let z=/\x1b\[\d*(;\d*)*m/g;return _.replace(z,"")}GU.Help=kb;GU.stripColor=Ib});var Q8=I(($U)=>{var{InvalidArgumentError:XU}=o1();class Tb{constructor(_,z){this.flags=_,this.description=z||"",this.required=_.includes("<"),this.optional=_.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(_),this.mandatory=!1;let A=QU(_);if(this.short=A.shortFlag,this.long=A.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(_,z){return this.defaultValue=_,this.defaultValueDescription=z,this}preset(_){return this.presetArg=_,this}conflicts(_){return this.conflictsWith=this.conflictsWith.concat(_),this}implies(_){let z=_;if(typeof _==="string")z={[_]:!0};return this.implied=Object.assign(this.implied||{},z),this}env(_){return this.envVar=_,this}argParser(_){return this.parseArg=_,this}makeOptionMandatory(_=!0){return this.mandatory=!!_,this}hideHelp(_=!0){return this.hidden=!!_,this}_collectValue(_,z){if(z===this.defaultValue||!Array.isArray(z))return[_];return z.push(_),z}choices(_){return this.argChoices=_.slice(),this.parseArg=(z,A)=>{if(!this.argChoices.includes(z))throw new XU(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._collectValue(z,A);return z},this}name(){if(this.long)return this.long.replace(/^--/,"");return this.short.replace(/^-/,"")}attributeName(){if(this.negate)return xb(this.name().replace(/^no-/,""));return xb(this.name())}helpGroup(_){return this.helpGroupHeading=_,this}is(_){return this.short===_||this.long===_}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class Cb{constructor(_){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,_.forEach((z)=>{if(z.negate)this.negativeOptions.set(z.attributeName(),z);else this.positiveOptions.set(z.attributeName(),z)}),this.negativeOptions.forEach((z,A)=>{if(this.positiveOptions.has(A))this.dualOptions.add(A)})}valueFromOption(_,z){let A=z.attributeName();if(!this.dualOptions.has(A))return!0;let b=this.negativeOptions.get(A).presetArg,G=b!==void 0?b:!1;return z.negate===(G===_)}}function xb(_){return _.split("-").reduce((z,A)=>{return z+A[0].toUpperCase()+A.slice(1)})}function QU(_){let z,A,b=/^-[^-]$/,G=/^--[^-]/,J=_.split(/[ |,]+/).concat("guard");if(b.test(J[0]))z=J.shift();if(G.test(J[0]))A=J.shift();if(!z&&b.test(J[0]))z=J.shift();if(!z&&G.test(J[0]))z=A,A=J.shift();if(J[0].startsWith("-")){let Y=J[0],X=`option creation failed due to '${Y}' in option flags '${_}'`;if(/^-[^-][^-]/.test(Y))throw Error(`${X}
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(Y))throw Error(`${X}
10
10
  - too many short flags`);if(G.test(Y))throw Error(`${X}
11
11
  - too many long flags`);throw Error(`${X}
12
- - unrecognised flag format`)}if(z===void 0&&A===void 0)throw Error(`option creation failed due to no flags found in '${_}'.`);return{shortFlag:z,longFlag:A}}XU.Option=Ib;XU.DualOptions=xb});var Tb=I((ZU)=>{function HU(_,z){if(Math.abs(_.length-z.length)>3)return Math.max(_.length,z.length);let A=[];for(let b=0;b<=_.length;b++)A[b]=[b];for(let b=0;b<=z.length;b++)A[0][b]=b;for(let b=1;b<=z.length;b++)for(let G=1;G<=_.length;G++){let J=1;if(_[G-1]===z[b-1])J=0;else J=1;if(A[G][b]=Math.min(A[G-1][b]+1,A[G][b-1]+1,A[G-1][b-1]+J),G>1&&b>1&&_[G-1]===z[b-2]&&_[G-2]===z[b-1])A[G][b]=Math.min(A[G][b],A[G-2][b-2]+1)}return A[_.length][z.length]}function BU(_,z){if(!z||z.length===0)return"";z=Array.from(new Set(z));let A=_.startsWith("--");if(A)_=_.slice(2),z=z.map((Y)=>Y.slice(2));let b=[],G=3,J=0.4;if(z.forEach((Y)=>{if(Y.length<=1)return;let X=HU(_,Y),Q=Math.max(_.length,Y.length);if((Q-X)/Q>J){if(X<G)G=X,b=[Y];else if(X===G)b.push(Y)}}),b.sort((Y,X)=>Y.localeCompare(X)),A)b=b.map((Y)=>`--${Y}`);if(b.length>1)return`
12
+ - unrecognised flag format`)}if(z===void 0&&A===void 0)throw Error(`option creation failed due to no flags found in '${_}'.`);return{shortFlag:z,longFlag:A}}$U.Option=Tb;$U.DualOptions=Cb});var vb=I((KU)=>{function ZU(_,z){if(Math.abs(_.length-z.length)>3)return Math.max(_.length,z.length);let A=[];for(let b=0;b<=_.length;b++)A[b]=[b];for(let b=0;b<=z.length;b++)A[0][b]=b;for(let b=1;b<=z.length;b++)for(let G=1;G<=_.length;G++){let J=1;if(_[G-1]===z[b-1])J=0;else J=1;if(A[G][b]=Math.min(A[G-1][b]+1,A[G][b-1]+1,A[G-1][b-1]+J),G>1&&b>1&&_[G-1]===z[b-2]&&_[G-2]===z[b-1])A[G][b]=Math.min(A[G][b],A[G-2][b-2]+1)}return A[_.length][z.length]}function FU(_,z){if(!z||z.length===0)return"";z=Array.from(new Set(z));let A=_.startsWith("--");if(A)_=_.slice(2),z=z.map((Y)=>Y.slice(2));let b=[],G=3,J=0.4;if(z.forEach((Y)=>{if(Y.length<=1)return;let X=ZU(_,Y),Q=Math.max(_.length,Y.length);if((Q-X)/Q>J){if(X<G)G=X,b=[Y];else if(X===G)b.push(Y)}}),b.sort((Y,X)=>Y.localeCompare(X)),A)b=b.map((Y)=>`--${Y}`);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""}ZU.suggestSimilar=BU});var gb=I((MU)=>{var KU=q4("node:events").EventEmitter,Y8=q4("node:child_process"),W4=q4("node:path"),P3=q4("node:fs"),$0=q4("node:process"),{Argument:qU,humanReadableArgName:WU}=R3(),{CommanderError:X8}=n1(),{Help:VU,stripColor:UU}=G8(),{Option:Cb,DualOptions:DU}=J8(),{suggestSimilar:vb}=Tb();class $8 extends KU{constructor(_){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=_||"",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:(z)=>$0.stdout.write(z),writeErr:(z)=>$0.stderr.write(z),outputError:(z,A)=>A(z),getOutHelpWidth:()=>$0.stdout.isTTY?$0.stdout.columns:void 0,getErrHelpWidth:()=>$0.stderr.isTTY?$0.stderr.columns:void 0,getOutHasColors:()=>Q8()??($0.stdout.isTTY&&$0.stdout.hasColors?.()),getErrHasColors:()=>Q8()??($0.stderr.isTTY&&$0.stderr.hasColors?.()),stripColor:(z)=>UU(z)},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(_){return this._outputConfiguration=_._outputConfiguration,this._helpOption=_._helpOption,this._helpCommand=_._helpCommand,this._helpConfiguration=_._helpConfiguration,this._exitCallback=_._exitCallback,this._storeOptionsAsProperties=_._storeOptionsAsProperties,this._combineFlagAndOptionalValue=_._combineFlagAndOptionalValue,this._allowExcessArguments=_._allowExcessArguments,this._enablePositionalOptions=_._enablePositionalOptions,this._showHelpAfterError=_._showHelpAfterError,this._showSuggestionAfterError=_._showSuggestionAfterError,this}_getCommandAndAncestors(){let _=[];for(let z=this;z;z=z.parent)_.push(z);return _}command(_,z,A){let b=z,G=A;if(typeof b==="object"&&b!==null)G=b,b=null;G=G||{};let[,J,Y]=_.match(/([^ ]+) *(.*)/),X=this.createCommand(J);if(b)X.description(b),X._executableHandler=!0;if(G.isDefault)this._defaultCommandName=X._name;if(X._hidden=!!(G.noHelp||G.hidden),X._executableFile=G.executableFile||null,Y)X.arguments(Y);if(this._registerCommand(X),X.parent=this,X.copyInheritedSettings(this),b)return this;return X}createCommand(_){return new $8(_)}createHelp(){return Object.assign(new VU,this.configureHelp())}configureHelp(_){if(_===void 0)return this._helpConfiguration;return this._helpConfiguration=_,this}configureOutput(_){if(_===void 0)return this._outputConfiguration;return this._outputConfiguration={...this._outputConfiguration,..._},this}showHelpAfterError(_=!0){if(typeof _!=="string")_=!!_;return this._showHelpAfterError=_,this}showSuggestionAfterError(_=!0){return this._showSuggestionAfterError=!!_,this}addCommand(_,z){if(!_._name)throw Error(`Command passed to .addCommand() must have a name
15
- - specify the name in Command constructor or using .name()`);if(z=z||{},z.isDefault)this._defaultCommandName=_._name;if(z.noHelp||z.hidden)_._hidden=!0;return this._registerCommand(_),_.parent=this,_._checkForBrokenPassThrough(),this}createArgument(_,z){return new qU(_,z)}argument(_,z,A,b){let G=this.createArgument(_,z);if(typeof A==="function")G.default(b).argParser(A);else G.default(A);return this.addArgument(G),this}arguments(_){return _.trim().split(/ +/).forEach((z)=>{this.argument(z)}),this}addArgument(_){let z=this.registeredArguments.slice(-1)[0];if(z?.variadic)throw Error(`only the last argument can be variadic '${z.name()}'`);if(_.required&&_.defaultValue!==void 0&&_.parseArg===void 0)throw Error(`a default value for a required argument is never used: '${_.name()}'`);return this.registeredArguments.push(_),this}helpCommand(_,z){if(typeof _==="boolean"){if(this._addImplicitHelpCommand=_,_&&this._defaultCommandGroup)this._initCommandGroup(this._getHelpCommand());return this}let A=_??"help [command]",[,b,G]=A.match(/([^ ]+) *(.*)/),J=z??"display help for command",Y=this.createCommand(b);if(Y.helpOption(!1),G)Y.arguments(G);if(J)Y.description(J);if(this._addImplicitHelpCommand=!0,this._helpCommand=Y,_||z)this._initCommandGroup(Y);return this}addHelpCommand(_,z){if(typeof _!=="object")return this.helpCommand(_,z),this;return this._addImplicitHelpCommand=!0,this._helpCommand=_,this._initCommandGroup(_),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(_,z){let A=["preSubcommand","preAction","postAction"];if(!A.includes(_))throw Error(`Unexpected value for event passed to hook : '${_}'.
16
- Expecting one of '${A.join("', '")}'`);if(this._lifeCycleHooks[_])this._lifeCycleHooks[_].push(z);else this._lifeCycleHooks[_]=[z];return this}exitOverride(_){if(_)this._exitCallback=_;else this._exitCallback=(z)=>{if(z.code!=="commander.executeSubCommandAsync")throw z};return this}_exit(_,z,A){if(this._exitCallback)this._exitCallback(new X8(_,z,A));$0.exit(_)}action(_){let z=(A)=>{let b=this.registeredArguments.length,G=A.slice(0,b);if(this._storeOptionsAsProperties)G[b]=this;else G[b]=this.opts();return G.push(this),_.apply(this,G)};return this._actionHandler=z,this}createOption(_,z){return new Cb(_,z)}_callParseArg(_,z,A,b){try{return _.parseArg(z,A)}catch(G){if(G.code==="commander.invalidArgument"){let J=`${b} ${G.message}`;this.error(J,{exitCode:G.exitCode,code:G.code})}throw G}}_registerOption(_){let z=_.short&&this._findOption(_.short)||_.long&&this._findOption(_.long);if(z){let A=_.long&&this._findOption(_.long)?_.long:_.short;throw Error(`Cannot add option '${_.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${A}'
17
- - already used by option '${z.flags}'`)}this._initOptionGroup(_),this.options.push(_)}_registerCommand(_){let z=(b)=>{return[b.name()].concat(b.aliases())},A=z(_).find((b)=>this._findCommand(b));if(A){let b=z(this._findCommand(A)).join("|"),G=z(_).join("|");throw Error(`cannot add command '${G}' as already have command '${b}'`)}this._initCommandGroup(_),this.commands.push(_)}addOption(_){this._registerOption(_);let z=_.name(),A=_.attributeName();if(_.negate){let G=_.long.replace(/^--no-/,"--");if(!this._findOption(G))this.setOptionValueWithSource(A,_.defaultValue===void 0?!0:_.defaultValue,"default")}else if(_.defaultValue!==void 0)this.setOptionValueWithSource(A,_.defaultValue,"default");let b=(G,J,Y)=>{if(G==null&&_.presetArg!==void 0)G=_.presetArg;let X=this.getOptionValue(A);if(G!==null&&_.parseArg)G=this._callParseArg(_,G,X,J);else if(G!==null&&_.variadic)G=_._collectValue(G,X);if(G==null)if(_.negate)G=!1;else if(_.isBoolean()||_.optional)G=!0;else G="";this.setOptionValueWithSource(A,G,Y)};if(this.on("option:"+z,(G)=>{let J=`error: option '${_.flags}' argument '${G}' is invalid.`;b(G,J,"cli")}),_.envVar)this.on("optionEnv:"+z,(G)=>{let J=`error: option '${_.flags}' value '${G}' from env '${_.envVar}' is invalid.`;b(G,J,"env")});return this}_optionEx(_,z,A,b,G){if(typeof z==="object"&&z instanceof Cb)throw Error("To add an Option object use addOption() instead of option() or requiredOption()");let J=this.createOption(z,A);if(J.makeOptionMandatory(!!_.mandatory),typeof b==="function")J.default(G).argParser(b);else if(b instanceof RegExp){let Y=b;b=(X,Q)=>{let $=Y.exec(X);return $?$[0]:Q},J.default(G).argParser(b)}else J.default(b);return this.addOption(J)}option(_,z,A,b){return this._optionEx({},_,z,A,b)}requiredOption(_,z,A,b){return this._optionEx({mandatory:!0},_,z,A,b)}combineFlagAndOptionalValue(_=!0){return this._combineFlagAndOptionalValue=!!_,this}allowUnknownOption(_=!0){return this._allowUnknownOption=!!_,this}allowExcessArguments(_=!0){return this._allowExcessArguments=!!_,this}enablePositionalOptions(_=!0){return this._enablePositionalOptions=!!_,this}passThroughOptions(_=!0){return this._passThroughOptions=!!_,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(_=!0){if(this.options.length)throw Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!_,this}getOptionValue(_){if(this._storeOptionsAsProperties)return this[_];return this._optionValues[_]}setOptionValue(_,z){return this.setOptionValueWithSource(_,z,void 0)}setOptionValueWithSource(_,z,A){if(this._storeOptionsAsProperties)this[_]=z;else this._optionValues[_]=z;return this._optionValueSources[_]=A,this}getOptionValueSource(_){return this._optionValueSources[_]}getOptionValueSourceWithGlobals(_){let z;return this._getCommandAndAncestors().forEach((A)=>{if(A.getOptionValueSource(_)!==void 0)z=A.getOptionValueSource(_)}),z}_prepareUserArgs(_,z){if(_!==void 0&&!Array.isArray(_))throw Error("first parameter to parse must be array or undefined");if(z=z||{},_===void 0&&z.from===void 0){if($0.versions?.electron)z.from="electron";let b=$0.execArgv??[];if(b.includes("-e")||b.includes("--eval")||b.includes("-p")||b.includes("--print"))z.from="eval"}if(_===void 0)_=$0.argv;this.rawArgs=_.slice();let A;switch(z.from){case void 0:case"node":this._scriptPath=_[1],A=_.slice(2);break;case"electron":if($0.defaultApp)this._scriptPath=_[1],A=_.slice(2);else A=_.slice(1);break;case"user":A=_.slice(0);break;case"eval":A=_.slice(1);break;default:throw Error(`unexpected parse option { from: '${z.from}' }`)}if(!this._name&&this._scriptPath)this.nameFromFilename(this._scriptPath);return this._name=this._name||"program",A}parse(_,z){this._prepareForParse();let A=this._prepareUserArgs(_,z);return this._parseCommand([],A),this}async parseAsync(_,z){this._prepareForParse();let A=this._prepareUserArgs(_,z);return await this._parseCommand([],A),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 Error(`Can not call parse again when storeOptionsAsProperties is true.
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(_,z,A){if(P3.existsSync(_))return;let b=z?`searched for local subcommand relative to directory '${z}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",G=`'${_}' does not exist
14
+ (Did you mean ${b[0]}?)`;return""}KU.suggestSimilar=FU});var hb=I((wU)=>{var WU=q4("node:events").EventEmitter,$8=q4("node:child_process"),W4=q4("node:path"),k3=q4("node:fs"),$0=q4("node:process"),{Argument:VU,humanReadableArgName:UU}=S3(),{CommanderError:H8}=o1(),{Help:DU,stripColor:MU}=X8(),{Option:yb,DualOptions:NU}=Q8(),{suggestSimilar:gb}=vb();class Z8 extends WU{constructor(_){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=_||"",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:(z)=>$0.stdout.write(z),writeErr:(z)=>$0.stderr.write(z),outputError:(z,A)=>A(z),getOutHelpWidth:()=>$0.stdout.isTTY?$0.stdout.columns:void 0,getErrHelpWidth:()=>$0.stderr.isTTY?$0.stderr.columns:void 0,getOutHasColors:()=>B8()??($0.stdout.isTTY&&$0.stdout.hasColors?.()),getErrHasColors:()=>B8()??($0.stderr.isTTY&&$0.stderr.hasColors?.()),stripColor:(z)=>MU(z)},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(_){return this._outputConfiguration=_._outputConfiguration,this._helpOption=_._helpOption,this._helpCommand=_._helpCommand,this._helpConfiguration=_._helpConfiguration,this._exitCallback=_._exitCallback,this._storeOptionsAsProperties=_._storeOptionsAsProperties,this._combineFlagAndOptionalValue=_._combineFlagAndOptionalValue,this._allowExcessArguments=_._allowExcessArguments,this._enablePositionalOptions=_._enablePositionalOptions,this._showHelpAfterError=_._showHelpAfterError,this._showSuggestionAfterError=_._showSuggestionAfterError,this}_getCommandAndAncestors(){let _=[];for(let z=this;z;z=z.parent)_.push(z);return _}command(_,z,A){let b=z,G=A;if(typeof b==="object"&&b!==null)G=b,b=null;G=G||{};let[,J,Y]=_.match(/([^ ]+) *(.*)/),X=this.createCommand(J);if(b)X.description(b),X._executableHandler=!0;if(G.isDefault)this._defaultCommandName=X._name;if(X._hidden=!!(G.noHelp||G.hidden),X._executableFile=G.executableFile||null,Y)X.arguments(Y);if(this._registerCommand(X),X.parent=this,X.copyInheritedSettings(this),b)return this;return X}createCommand(_){return new Z8(_)}createHelp(){return Object.assign(new DU,this.configureHelp())}configureHelp(_){if(_===void 0)return this._helpConfiguration;return this._helpConfiguration=_,this}configureOutput(_){if(_===void 0)return this._outputConfiguration;return this._outputConfiguration={...this._outputConfiguration,..._},this}showHelpAfterError(_=!0){if(typeof _!=="string")_=!!_;return this._showHelpAfterError=_,this}showSuggestionAfterError(_=!0){return this._showSuggestionAfterError=!!_,this}addCommand(_,z){if(!_._name)throw Error(`Command passed to .addCommand() must have a name
15
+ - specify the name in Command constructor or using .name()`);if(z=z||{},z.isDefault)this._defaultCommandName=_._name;if(z.noHelp||z.hidden)_._hidden=!0;return this._registerCommand(_),_.parent=this,_._checkForBrokenPassThrough(),this}createArgument(_,z){return new VU(_,z)}argument(_,z,A,b){let G=this.createArgument(_,z);if(typeof A==="function")G.default(b).argParser(A);else G.default(A);return this.addArgument(G),this}arguments(_){return _.trim().split(/ +/).forEach((z)=>{this.argument(z)}),this}addArgument(_){let z=this.registeredArguments.slice(-1)[0];if(z?.variadic)throw Error(`only the last argument can be variadic '${z.name()}'`);if(_.required&&_.defaultValue!==void 0&&_.parseArg===void 0)throw Error(`a default value for a required argument is never used: '${_.name()}'`);return this.registeredArguments.push(_),this}helpCommand(_,z){if(typeof _==="boolean"){if(this._addImplicitHelpCommand=_,_&&this._defaultCommandGroup)this._initCommandGroup(this._getHelpCommand());return this}let A=_??"help [command]",[,b,G]=A.match(/([^ ]+) *(.*)/),J=z??"display help for command",Y=this.createCommand(b);if(Y.helpOption(!1),G)Y.arguments(G);if(J)Y.description(J);if(this._addImplicitHelpCommand=!0,this._helpCommand=Y,_||z)this._initCommandGroup(Y);return this}addHelpCommand(_,z){if(typeof _!=="object")return this.helpCommand(_,z),this;return this._addImplicitHelpCommand=!0,this._helpCommand=_,this._initCommandGroup(_),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(_,z){let A=["preSubcommand","preAction","postAction"];if(!A.includes(_))throw Error(`Unexpected value for event passed to hook : '${_}'.
16
+ Expecting one of '${A.join("', '")}'`);if(this._lifeCycleHooks[_])this._lifeCycleHooks[_].push(z);else this._lifeCycleHooks[_]=[z];return this}exitOverride(_){if(_)this._exitCallback=_;else this._exitCallback=(z)=>{if(z.code!=="commander.executeSubCommandAsync")throw z};return this}_exit(_,z,A){if(this._exitCallback)this._exitCallback(new H8(_,z,A));$0.exit(_)}action(_){let z=(A)=>{let b=this.registeredArguments.length,G=A.slice(0,b);if(this._storeOptionsAsProperties)G[b]=this;else G[b]=this.opts();return G.push(this),_.apply(this,G)};return this._actionHandler=z,this}createOption(_,z){return new yb(_,z)}_callParseArg(_,z,A,b){try{return _.parseArg(z,A)}catch(G){if(G.code==="commander.invalidArgument"){let J=`${b} ${G.message}`;this.error(J,{exitCode:G.exitCode,code:G.code})}throw G}}_registerOption(_){let z=_.short&&this._findOption(_.short)||_.long&&this._findOption(_.long);if(z){let A=_.long&&this._findOption(_.long)?_.long:_.short;throw Error(`Cannot add option '${_.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${A}'
17
+ - already used by option '${z.flags}'`)}this._initOptionGroup(_),this.options.push(_)}_registerCommand(_){let z=(b)=>{return[b.name()].concat(b.aliases())},A=z(_).find((b)=>this._findCommand(b));if(A){let b=z(this._findCommand(A)).join("|"),G=z(_).join("|");throw Error(`cannot add command '${G}' as already have command '${b}'`)}this._initCommandGroup(_),this.commands.push(_)}addOption(_){this._registerOption(_);let z=_.name(),A=_.attributeName();if(_.negate){let G=_.long.replace(/^--no-/,"--");if(!this._findOption(G))this.setOptionValueWithSource(A,_.defaultValue===void 0?!0:_.defaultValue,"default")}else if(_.defaultValue!==void 0)this.setOptionValueWithSource(A,_.defaultValue,"default");let b=(G,J,Y)=>{if(G==null&&_.presetArg!==void 0)G=_.presetArg;let X=this.getOptionValue(A);if(G!==null&&_.parseArg)G=this._callParseArg(_,G,X,J);else if(G!==null&&_.variadic)G=_._collectValue(G,X);if(G==null)if(_.negate)G=!1;else if(_.isBoolean()||_.optional)G=!0;else G="";this.setOptionValueWithSource(A,G,Y)};if(this.on("option:"+z,(G)=>{let J=`error: option '${_.flags}' argument '${G}' is invalid.`;b(G,J,"cli")}),_.envVar)this.on("optionEnv:"+z,(G)=>{let J=`error: option '${_.flags}' value '${G}' from env '${_.envVar}' is invalid.`;b(G,J,"env")});return this}_optionEx(_,z,A,b,G){if(typeof z==="object"&&z instanceof yb)throw Error("To add an Option object use addOption() instead of option() or requiredOption()");let J=this.createOption(z,A);if(J.makeOptionMandatory(!!_.mandatory),typeof b==="function")J.default(G).argParser(b);else if(b instanceof RegExp){let Y=b;b=(X,Q)=>{let $=Y.exec(X);return $?$[0]:Q},J.default(G).argParser(b)}else J.default(b);return this.addOption(J)}option(_,z,A,b){return this._optionEx({},_,z,A,b)}requiredOption(_,z,A,b){return this._optionEx({mandatory:!0},_,z,A,b)}combineFlagAndOptionalValue(_=!0){return this._combineFlagAndOptionalValue=!!_,this}allowUnknownOption(_=!0){return this._allowUnknownOption=!!_,this}allowExcessArguments(_=!0){return this._allowExcessArguments=!!_,this}enablePositionalOptions(_=!0){return this._enablePositionalOptions=!!_,this}passThroughOptions(_=!0){return this._passThroughOptions=!!_,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(_=!0){if(this.options.length)throw Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!_,this}getOptionValue(_){if(this._storeOptionsAsProperties)return this[_];return this._optionValues[_]}setOptionValue(_,z){return this.setOptionValueWithSource(_,z,void 0)}setOptionValueWithSource(_,z,A){if(this._storeOptionsAsProperties)this[_]=z;else this._optionValues[_]=z;return this._optionValueSources[_]=A,this}getOptionValueSource(_){return this._optionValueSources[_]}getOptionValueSourceWithGlobals(_){let z;return this._getCommandAndAncestors().forEach((A)=>{if(A.getOptionValueSource(_)!==void 0)z=A.getOptionValueSource(_)}),z}_prepareUserArgs(_,z){if(_!==void 0&&!Array.isArray(_))throw Error("first parameter to parse must be array or undefined");if(z=z||{},_===void 0&&z.from===void 0){if($0.versions?.electron)z.from="electron";let b=$0.execArgv??[];if(b.includes("-e")||b.includes("--eval")||b.includes("-p")||b.includes("--print"))z.from="eval"}if(_===void 0)_=$0.argv;this.rawArgs=_.slice();let A;switch(z.from){case void 0:case"node":this._scriptPath=_[1],A=_.slice(2);break;case"electron":if($0.defaultApp)this._scriptPath=_[1],A=_.slice(2);else A=_.slice(1);break;case"user":A=_.slice(0);break;case"eval":A=_.slice(1);break;default:throw Error(`unexpected parse option { from: '${z.from}' }`)}if(!this._name&&this._scriptPath)this.nameFromFilename(this._scriptPath);return this._name=this._name||"program",A}parse(_,z){this._prepareForParse();let A=this._prepareUserArgs(_,z);return this._parseCommand([],A),this}async parseAsync(_,z){this._prepareForParse();let A=this._prepareUserArgs(_,z);return await this._parseCommand([],A),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 Error(`Can not call parse again when storeOptionsAsProperties is true.
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(_,z,A){if(k3.existsSync(_))return;let b=z?`searched for local subcommand relative to directory '${z}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",G=`'${_}' does not exist
19
19
  - if '${A}' 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 Error(G)}_executeSubCommand(_,z){z=z.slice();let A=!1,b=[".js",".ts",".tsx",".mjs",".cjs"];function G($,H){let B=W4.resolve($,H);if(P3.existsSync(B))return B;if(b.includes(W4.extname(H)))return;let Z=b.find((F)=>P3.existsSync(`${B}${F}`));if(Z)return`${B}${Z}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let J=_._executableFile||`${this._name}-${_._name}`,Y=this._executableDir||"";if(this._scriptPath){let $;try{$=P3.realpathSync(this._scriptPath)}catch{$=this._scriptPath}Y=W4.resolve(W4.dirname($),Y)}if(Y){let $=G(Y,J);if(!$&&!_._executableFile&&this._scriptPath){let H=W4.basename(this._scriptPath,W4.extname(this._scriptPath));if(H!==this._name)$=G(Y,`${H}-${_._name}`)}J=$||J}A=b.includes(W4.extname(J));let X;if($0.platform!=="win32")if(A)z.unshift(J),z=yb($0.execArgv).concat(z),X=Y8.spawn($0.argv[0],z,{stdio:"inherit"});else X=Y8.spawn(J,z,{stdio:"inherit"});else this._checkForMissingExecutable(J,Y,_._name),z.unshift(J),z=yb($0.execArgv).concat(z),X=Y8.spawn($0.execPath,z,{stdio:"inherit"});if(!X.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((H)=>{$0.on(H,()=>{if(X.killed===!1&&X.exitCode===null)X.kill(H)})});let Q=this._exitCallback;X.on("close",($)=>{if($=$??1,!Q)$0.exit($);else Q(new X8($,"commander.executeSubCommandAsync","(close)"))}),X.on("error",($)=>{if($.code==="ENOENT")this._checkForMissingExecutable(J,Y,_._name);else if($.code==="EACCES")throw Error(`'${J}' not executable`);if(!Q)$0.exit(1);else{let H=new X8(1,"commander.executeSubCommandAsync","(error)");H.nestedError=$,Q(H)}}),this.runningCommand=X}_dispatchSubcommand(_,z,A){let b=this._findCommand(_);if(!b)this.help({error:!0});b._prepareForParse();let G;return G=this._chainOrCallSubCommandHook(G,b,"preSubcommand"),G=this._chainOrCall(G,()=>{if(b._executableHandler)this._executeSubCommand(b,z.concat(A));else return b._parseCommand(z,A)}),G}_dispatchHelpCommand(_){if(!_)this.help();let z=this._findCommand(_);if(z&&!z._executableHandler)z.help();return this._dispatchSubcommand(_,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){if(this.registeredArguments.forEach((_,z)=>{if(_.required&&this.args[z]==null)this.missingArgument(_.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 _=(A,b,G)=>{let J=b;if(b!==null&&A.parseArg){let Y=`error: command-argument value '${b}' is invalid for argument '${A.name()}'.`;J=this._callParseArg(A,b,G,Y)}return J};this._checkNumberOfArguments();let z=[];this.registeredArguments.forEach((A,b)=>{let G=A.defaultValue;if(A.variadic){if(b<this.args.length){if(G=this.args.slice(b),A.parseArg)G=G.reduce((J,Y)=>{return _(A,Y,J)},A.defaultValue)}else if(G===void 0)G=[]}else if(b<this.args.length){if(G=this.args[b],A.parseArg)G=_(A,G,A.defaultValue)}z[b]=G}),this.processedArgs=z}_chainOrCall(_,z){if(_?.then&&typeof _.then==="function")return _.then(()=>z());return z()}_chainOrCallHooks(_,z){let A=_,b=[];if(this._getCommandAndAncestors().reverse().filter((G)=>G._lifeCycleHooks[z]!==void 0).forEach((G)=>{G._lifeCycleHooks[z].forEach((J)=>{b.push({hookedCommand:G,callback:J})})}),z==="postAction")b.reverse();return b.forEach((G)=>{A=this._chainOrCall(A,()=>{return G.callback(G.hookedCommand,this)})}),A}_chainOrCallSubCommandHook(_,z,A){let b=_;if(this._lifeCycleHooks[A]!==void 0)this._lifeCycleHooks[A].forEach((G)=>{b=this._chainOrCall(b,()=>{return G(this,z)})});return b}_parseCommand(_,z){let A=this.parseOptions(z);if(this._parseOptionsEnv(),this._parseOptionsImplied(),_=_.concat(A.operands),z=A.unknown,this.args=_.concat(z),_&&this._findCommand(_[0]))return this._dispatchSubcommand(_[0],_.slice(1),z);if(this._getHelpCommand()&&_[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(_[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(z),this._dispatchSubcommand(this._defaultCommandName,_,z);if(this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName)this.help({error:!0});this._outputHelpIfRequested(A.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let b=()=>{if(A.unknown.length>0)this.unknownOption(A.unknown[0])},G=`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(G,_,z)});return J=this._chainOrCallHooks(J,"postAction"),J}if(this.parent?.listenerCount(G))b(),this._processArguments(),this.parent.emit(G,_,z);else if(_.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",_,z);if(this.listenerCount("command:*"))this.emit("command:*",_,z);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(_){if(!_)return;return this.commands.find((z)=>z._name===_||z._aliases.includes(_))}_findOption(_){return this.options.find((z)=>z.is(_))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach((_)=>{_.options.forEach((z)=>{if(z.mandatory&&_.getOptionValue(z.attributeName())===void 0)_.missingMandatoryOptionValue(z)})})}_checkForConflictingLocalOptions(){let _=this.options.filter((A)=>{let b=A.attributeName();if(this.getOptionValue(b)===void 0)return!1;return this.getOptionValueSource(b)!=="default"});_.filter((A)=>A.conflictsWith.length>0).forEach((A)=>{let b=_.find((G)=>A.conflictsWith.includes(G.attributeName()));if(b)this._conflictingOption(A,b)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach((_)=>{_._checkForConflictingLocalOptions()})}parseOptions(_){let z=[],A=[],b=z;function G($){return $.length>1&&$[0]==="-"}let J=($)=>{if(!/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test($))return!1;return!this._getCommandAndAncestors().some((H)=>H.options.map((B)=>B.short).some((B)=>/^-\d$/.test(B)))},Y=null,X=null,Q=0;while(Q<_.length||X){let $=X??_[Q++];if(X=null,$==="--"){if(b===A)b.push($);b.push(..._.slice(Q));break}if(Y&&(!G($)||J($))){this.emit(`option:${Y.name()}`,$);continue}if(Y=null,G($)){let H=this._findOption($);if(H){if(H.required){let B=_[Q++];if(B===void 0)this.optionMissingArgument(H);this.emit(`option:${H.name()}`,B)}else if(H.optional){let B=null;if(Q<_.length&&(!G(_[Q])||J(_[Q])))B=_[Q++];this.emit(`option:${H.name()}`,B)}else this.emit(`option:${H.name()}`);Y=H.variadic?H:null;continue}}if($.length>2&&$[0]==="-"&&$[1]!=="-"){let H=this._findOption(`-${$[1]}`);if(H){if(H.required||H.optional&&this._combineFlagAndOptionalValue)this.emit(`option:${H.name()}`,$.slice(2));else this.emit(`option:${H.name()}`),X=`-${$.slice(2)}`;continue}}if(/^--[^=]+=/.test($)){let H=$.indexOf("="),B=this._findOption($.slice(0,H));if(B&&(B.required||B.optional)){this.emit(`option:${B.name()}`,$.slice(H+1));continue}}if(b===z&&G($)&&!(this.commands.length===0&&J($)))b=A;if((this._enablePositionalOptions||this._passThroughOptions)&&z.length===0&&A.length===0){if(this._findCommand($)){z.push($),A.push(..._.slice(Q));break}else if(this._getHelpCommand()&&$===this._getHelpCommand().name()){z.push($,..._.slice(Q));break}else if(this._defaultCommandName){A.push($,..._.slice(Q));break}}if(this._passThroughOptions){b.push($,..._.slice(Q));break}b.push($)}return{operands:z,unknown:A}}opts(){if(this._storeOptionsAsProperties){let _={},z=this.options.length;for(let A=0;A<z;A++){let b=this.options[A].attributeName();_[b]=b===this._versionOptionName?this._version:this[b]}return _}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((_,z)=>Object.assign(_,z.opts()),{})}error(_,z){if(this._outputConfiguration.outputError(`${_}
21
+ - ${b}`;throw Error(G)}_executeSubCommand(_,z){z=z.slice();let A=!1,b=[".js",".ts",".tsx",".mjs",".cjs"];function G($,H){let B=W4.resolve($,H);if(k3.existsSync(B))return B;if(b.includes(W4.extname(H)))return;let Z=b.find((F)=>k3.existsSync(`${B}${F}`));if(Z)return`${B}${Z}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let J=_._executableFile||`${this._name}-${_._name}`,Y=this._executableDir||"";if(this._scriptPath){let $;try{$=k3.realpathSync(this._scriptPath)}catch{$=this._scriptPath}Y=W4.resolve(W4.dirname($),Y)}if(Y){let $=G(Y,J);if(!$&&!_._executableFile&&this._scriptPath){let H=W4.basename(this._scriptPath,W4.extname(this._scriptPath));if(H!==this._name)$=G(Y,`${H}-${_._name}`)}J=$||J}A=b.includes(W4.extname(J));let X;if($0.platform!=="win32")if(A)z.unshift(J),z=fb($0.execArgv).concat(z),X=$8.spawn($0.argv[0],z,{stdio:"inherit"});else X=$8.spawn(J,z,{stdio:"inherit"});else this._checkForMissingExecutable(J,Y,_._name),z.unshift(J),z=fb($0.execArgv).concat(z),X=$8.spawn($0.execPath,z,{stdio:"inherit"});if(!X.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((H)=>{$0.on(H,()=>{if(X.killed===!1&&X.exitCode===null)X.kill(H)})});let Q=this._exitCallback;X.on("close",($)=>{if($=$??1,!Q)$0.exit($);else Q(new H8($,"commander.executeSubCommandAsync","(close)"))}),X.on("error",($)=>{if($.code==="ENOENT")this._checkForMissingExecutable(J,Y,_._name);else if($.code==="EACCES")throw Error(`'${J}' not executable`);if(!Q)$0.exit(1);else{let H=new H8(1,"commander.executeSubCommandAsync","(error)");H.nestedError=$,Q(H)}}),this.runningCommand=X}_dispatchSubcommand(_,z,A){let b=this._findCommand(_);if(!b)this.help({error:!0});b._prepareForParse();let G;return G=this._chainOrCallSubCommandHook(G,b,"preSubcommand"),G=this._chainOrCall(G,()=>{if(b._executableHandler)this._executeSubCommand(b,z.concat(A));else return b._parseCommand(z,A)}),G}_dispatchHelpCommand(_){if(!_)this.help();let z=this._findCommand(_);if(z&&!z._executableHandler)z.help();return this._dispatchSubcommand(_,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){if(this.registeredArguments.forEach((_,z)=>{if(_.required&&this.args[z]==null)this.missingArgument(_.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 _=(A,b,G)=>{let J=b;if(b!==null&&A.parseArg){let Y=`error: command-argument value '${b}' is invalid for argument '${A.name()}'.`;J=this._callParseArg(A,b,G,Y)}return J};this._checkNumberOfArguments();let z=[];this.registeredArguments.forEach((A,b)=>{let G=A.defaultValue;if(A.variadic){if(b<this.args.length){if(G=this.args.slice(b),A.parseArg)G=G.reduce((J,Y)=>{return _(A,Y,J)},A.defaultValue)}else if(G===void 0)G=[]}else if(b<this.args.length){if(G=this.args[b],A.parseArg)G=_(A,G,A.defaultValue)}z[b]=G}),this.processedArgs=z}_chainOrCall(_,z){if(_?.then&&typeof _.then==="function")return _.then(()=>z());return z()}_chainOrCallHooks(_,z){let A=_,b=[];if(this._getCommandAndAncestors().reverse().filter((G)=>G._lifeCycleHooks[z]!==void 0).forEach((G)=>{G._lifeCycleHooks[z].forEach((J)=>{b.push({hookedCommand:G,callback:J})})}),z==="postAction")b.reverse();return b.forEach((G)=>{A=this._chainOrCall(A,()=>{return G.callback(G.hookedCommand,this)})}),A}_chainOrCallSubCommandHook(_,z,A){let b=_;if(this._lifeCycleHooks[A]!==void 0)this._lifeCycleHooks[A].forEach((G)=>{b=this._chainOrCall(b,()=>{return G(this,z)})});return b}_parseCommand(_,z){let A=this.parseOptions(z);if(this._parseOptionsEnv(),this._parseOptionsImplied(),_=_.concat(A.operands),z=A.unknown,this.args=_.concat(z),_&&this._findCommand(_[0]))return this._dispatchSubcommand(_[0],_.slice(1),z);if(this._getHelpCommand()&&_[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(_[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(z),this._dispatchSubcommand(this._defaultCommandName,_,z);if(this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName)this.help({error:!0});this._outputHelpIfRequested(A.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let b=()=>{if(A.unknown.length>0)this.unknownOption(A.unknown[0])},G=`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(G,_,z)});return J=this._chainOrCallHooks(J,"postAction"),J}if(this.parent?.listenerCount(G))b(),this._processArguments(),this.parent.emit(G,_,z);else if(_.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",_,z);if(this.listenerCount("command:*"))this.emit("command:*",_,z);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(_){if(!_)return;return this.commands.find((z)=>z._name===_||z._aliases.includes(_))}_findOption(_){return this.options.find((z)=>z.is(_))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach((_)=>{_.options.forEach((z)=>{if(z.mandatory&&_.getOptionValue(z.attributeName())===void 0)_.missingMandatoryOptionValue(z)})})}_checkForConflictingLocalOptions(){let _=this.options.filter((A)=>{let b=A.attributeName();if(this.getOptionValue(b)===void 0)return!1;return this.getOptionValueSource(b)!=="default"});_.filter((A)=>A.conflictsWith.length>0).forEach((A)=>{let b=_.find((G)=>A.conflictsWith.includes(G.attributeName()));if(b)this._conflictingOption(A,b)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach((_)=>{_._checkForConflictingLocalOptions()})}parseOptions(_){let z=[],A=[],b=z;function G($){return $.length>1&&$[0]==="-"}let J=($)=>{if(!/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test($))return!1;return!this._getCommandAndAncestors().some((H)=>H.options.map((B)=>B.short).some((B)=>/^-\d$/.test(B)))},Y=null,X=null,Q=0;while(Q<_.length||X){let $=X??_[Q++];if(X=null,$==="--"){if(b===A)b.push($);b.push(..._.slice(Q));break}if(Y&&(!G($)||J($))){this.emit(`option:${Y.name()}`,$);continue}if(Y=null,G($)){let H=this._findOption($);if(H){if(H.required){let B=_[Q++];if(B===void 0)this.optionMissingArgument(H);this.emit(`option:${H.name()}`,B)}else if(H.optional){let B=null;if(Q<_.length&&(!G(_[Q])||J(_[Q])))B=_[Q++];this.emit(`option:${H.name()}`,B)}else this.emit(`option:${H.name()}`);Y=H.variadic?H:null;continue}}if($.length>2&&$[0]==="-"&&$[1]!=="-"){let H=this._findOption(`-${$[1]}`);if(H){if(H.required||H.optional&&this._combineFlagAndOptionalValue)this.emit(`option:${H.name()}`,$.slice(2));else this.emit(`option:${H.name()}`),X=`-${$.slice(2)}`;continue}}if(/^--[^=]+=/.test($)){let H=$.indexOf("="),B=this._findOption($.slice(0,H));if(B&&(B.required||B.optional)){this.emit(`option:${B.name()}`,$.slice(H+1));continue}}if(b===z&&G($)&&!(this.commands.length===0&&J($)))b=A;if((this._enablePositionalOptions||this._passThroughOptions)&&z.length===0&&A.length===0){if(this._findCommand($)){z.push($),A.push(..._.slice(Q));break}else if(this._getHelpCommand()&&$===this._getHelpCommand().name()){z.push($,..._.slice(Q));break}else if(this._defaultCommandName){A.push($,..._.slice(Q));break}}if(this._passThroughOptions){b.push($,..._.slice(Q));break}b.push($)}return{operands:z,unknown:A}}opts(){if(this._storeOptionsAsProperties){let _={},z=this.options.length;for(let A=0;A<z;A++){let b=this.options[A].attributeName();_[b]=b===this._versionOptionName?this._version:this[b]}return _}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((_,z)=>Object.assign(_,z.opts()),{})}error(_,z){if(this._outputConfiguration.outputError(`${_}
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 A=z||{},b=A.exitCode||1,G=A.code||"commander.error";this._exit(b,G,_)}_parseOptionsEnv(){this.options.forEach((_)=>{if(_.envVar&&_.envVar in $0.env){let z=_.attributeName();if(this.getOptionValue(z)===void 0||["default","config","env"].includes(this.getOptionValueSource(z)))if(_.required||_.optional)this.emit(`optionEnv:${_.name()}`,$0.env[_.envVar]);else this.emit(`optionEnv:${_.name()}`)}})}_parseOptionsImplied(){let _=new DU(this.options),z=(A)=>{return this.getOptionValue(A)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(A))};this.options.filter((A)=>A.implied!==void 0&&z(A.attributeName())&&_.valueFromOption(this.getOptionValue(A.attributeName()),A)).forEach((A)=>{Object.keys(A.implied).filter((b)=>!z(b)).forEach((b)=>{this.setOptionValueWithSource(b,A.implied[b],"implied")})})}missingArgument(_){let z=`error: missing required argument '${_}'`;this.error(z,{code:"commander.missingArgument"})}optionMissingArgument(_){let z=`error: option '${_.flags}' argument missing`;this.error(z,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(_){let z=`error: required option '${_.flags}' not specified`;this.error(z,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(_,z){let A=(J)=>{let Y=J.attributeName(),X=this.getOptionValue(Y),Q=this.options.find((H)=>H.negate&&Y===H.attributeName()),$=this.options.find((H)=>!H.negate&&Y===H.attributeName());if(Q&&(Q.presetArg===void 0&&X===!1||Q.presetArg!==void 0&&X===Q.presetArg))return Q;return $||J},b=(J)=>{let Y=A(J),X=Y.attributeName();if(this.getOptionValueSource(X)==="env")return`environment variable '${Y.envVar}'`;return`option '${Y.flags}'`},G=`error: ${b(_)} cannot be used with ${b(z)}`;this.error(G,{code:"commander.conflictingOption"})}unknownOption(_){if(this._allowUnknownOption)return;let z="";if(_.startsWith("--")&&this._showSuggestionAfterError){let b=[],G=this;do{let J=G.createHelp().visibleOptions(G).filter((Y)=>Y.long).map((Y)=>Y.long);b=b.concat(J),G=G.parent}while(G&&!G._enablePositionalOptions);z=vb(_,b)}let A=`error: unknown option '${_}'${z}`;this.error(A,{code:"commander.unknownOption"})}_excessArguments(_){if(this._allowExcessArguments)return;let z=this.registeredArguments.length,A=z===1?"":"s",G=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${z} argument${A} but got ${_.length}.`;this.error(G,{code:"commander.excessArguments"})}unknownCommand(){let _=this.args[0],z="";if(this._showSuggestionAfterError){let b=[];this.createHelp().visibleCommands(this).forEach((G)=>{if(b.push(G.name()),G.alias())b.push(G.alias())}),z=vb(_,b)}let A=`error: unknown command '${_}'${z}`;this.error(A,{code:"commander.unknownCommand"})}version(_,z,A){if(_===void 0)return this._version;this._version=_,z=z||"-V, --version",A=A||"output the version number";let b=this.createOption(z,A);return this._versionOptionName=b.attributeName(),this._registerOption(b),this.on("option:"+b.name(),()=>{this._outputConfiguration.writeOut(`${_}
25
- `),this._exit(0,"commander.version",_)}),this}description(_,z){if(_===void 0&&z===void 0)return this._description;if(this._description=_,z)this._argsDescription=z;return this}summary(_){if(_===void 0)return this._summary;return this._summary=_,this}alias(_){if(_===void 0)return this._aliases[0];let z=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler)z=this.commands[this.commands.length-1];if(_===z._name)throw Error("Command alias can't be the same as its name");let A=this.parent?._findCommand(_);if(A){let b=[A.name()].concat(A.aliases()).join("|");throw Error(`cannot add alias '${_}' to command '${this.name()}' as already have command '${b}'`)}return z._aliases.push(_),this}aliases(_){if(_===void 0)return this._aliases;return _.forEach((z)=>this.alias(z)),this}usage(_){if(_===void 0){if(this._usage)return this._usage;let z=this.registeredArguments.map((A)=>{return WU(A)});return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?z:[]).join(" ")}return this._usage=_,this}name(_){if(_===void 0)return this._name;return this._name=_,this}helpGroup(_){if(_===void 0)return this._helpGroupHeading??"";return this._helpGroupHeading=_,this}commandsGroup(_){if(_===void 0)return this._defaultCommandGroup??"";return this._defaultCommandGroup=_,this}optionsGroup(_){if(_===void 0)return this._defaultOptionGroup??"";return this._defaultOptionGroup=_,this}_initOptionGroup(_){if(this._defaultOptionGroup&&!_.helpGroupHeading)_.helpGroup(this._defaultOptionGroup)}_initCommandGroup(_){if(this._defaultCommandGroup&&!_.helpGroup())_.helpGroup(this._defaultCommandGroup)}nameFromFilename(_){return this._name=W4.basename(_,W4.extname(_)),this}executableDir(_){if(_===void 0)return this._executableDir;return this._executableDir=_,this}helpInformation(_){let z=this.createHelp(),A=this._getOutputContext(_);z.prepareContext({error:A.error,helpWidth:A.helpWidth,outputHasColors:A.hasColors});let b=z.formatHelp(this,z);if(A.hasColors)return b;return this._outputConfiguration.stripColor(b)}_getOutputContext(_){_=_||{};let z=!!_.error,A,b,G;if(z)A=(Y)=>this._outputConfiguration.writeErr(Y),b=this._outputConfiguration.getErrHasColors(),G=this._outputConfiguration.getErrHelpWidth();else A=(Y)=>this._outputConfiguration.writeOut(Y),b=this._outputConfiguration.getOutHasColors(),G=this._outputConfiguration.getOutHelpWidth();return{error:z,write:(Y)=>{if(!b)Y=this._outputConfiguration.stripColor(Y);return A(Y)},hasColors:b,helpWidth:G}}outputHelp(_){let z;if(typeof _==="function")z=_,_=void 0;let A=this._getOutputContext(_),b={error:A.error,write:A.write,command:this};this._getCommandAndAncestors().reverse().forEach((J)=>J.emit("beforeAllHelp",b)),this.emit("beforeHelp",b);let G=this.helpInformation({error:A.error});if(z){if(G=z(G),typeof G!=="string"&&!Buffer.isBuffer(G))throw Error("outputHelp callback must return a string or a Buffer")}if(A.write(G),this._getHelpOption()?.long)this.emit(this._getHelpOption().long);this.emit("afterHelp",b),this._getCommandAndAncestors().forEach((J)=>J.emit("afterAllHelp",b))}helpOption(_,z){if(typeof _==="boolean"){if(_){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(_??"-h, --help",z??"display help for command"),_||z)this._initOptionGroup(this._helpOption);return this}_getHelpOption(){if(this._helpOption===void 0)this.helpOption(void 0,void 0);return this._helpOption}addHelpOption(_){return this._helpOption=_,this._initOptionGroup(_),this}help(_){this.outputHelp(_);let z=Number($0.exitCode??0);if(z===0&&_&&typeof _!=="function"&&_.error)z=1;this._exit(z,"commander.help","(outputHelp)")}addHelpText(_,z){let A=["beforeAll","before","after","afterAll"];if(!A.includes(_))throw Error(`Unexpected value for position to addHelpText.
24
+ `),this.outputHelp({error:!0});let A=z||{},b=A.exitCode||1,G=A.code||"commander.error";this._exit(b,G,_)}_parseOptionsEnv(){this.options.forEach((_)=>{if(_.envVar&&_.envVar in $0.env){let z=_.attributeName();if(this.getOptionValue(z)===void 0||["default","config","env"].includes(this.getOptionValueSource(z)))if(_.required||_.optional)this.emit(`optionEnv:${_.name()}`,$0.env[_.envVar]);else this.emit(`optionEnv:${_.name()}`)}})}_parseOptionsImplied(){let _=new NU(this.options),z=(A)=>{return this.getOptionValue(A)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(A))};this.options.filter((A)=>A.implied!==void 0&&z(A.attributeName())&&_.valueFromOption(this.getOptionValue(A.attributeName()),A)).forEach((A)=>{Object.keys(A.implied).filter((b)=>!z(b)).forEach((b)=>{this.setOptionValueWithSource(b,A.implied[b],"implied")})})}missingArgument(_){let z=`error: missing required argument '${_}'`;this.error(z,{code:"commander.missingArgument"})}optionMissingArgument(_){let z=`error: option '${_.flags}' argument missing`;this.error(z,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(_){let z=`error: required option '${_.flags}' not specified`;this.error(z,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(_,z){let A=(J)=>{let Y=J.attributeName(),X=this.getOptionValue(Y),Q=this.options.find((H)=>H.negate&&Y===H.attributeName()),$=this.options.find((H)=>!H.negate&&Y===H.attributeName());if(Q&&(Q.presetArg===void 0&&X===!1||Q.presetArg!==void 0&&X===Q.presetArg))return Q;return $||J},b=(J)=>{let Y=A(J),X=Y.attributeName();if(this.getOptionValueSource(X)==="env")return`environment variable '${Y.envVar}'`;return`option '${Y.flags}'`},G=`error: ${b(_)} cannot be used with ${b(z)}`;this.error(G,{code:"commander.conflictingOption"})}unknownOption(_){if(this._allowUnknownOption)return;let z="";if(_.startsWith("--")&&this._showSuggestionAfterError){let b=[],G=this;do{let J=G.createHelp().visibleOptions(G).filter((Y)=>Y.long).map((Y)=>Y.long);b=b.concat(J),G=G.parent}while(G&&!G._enablePositionalOptions);z=gb(_,b)}let A=`error: unknown option '${_}'${z}`;this.error(A,{code:"commander.unknownOption"})}_excessArguments(_){if(this._allowExcessArguments)return;let z=this.registeredArguments.length,A=z===1?"":"s",G=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${z} argument${A} but got ${_.length}.`;this.error(G,{code:"commander.excessArguments"})}unknownCommand(){let _=this.args[0],z="";if(this._showSuggestionAfterError){let b=[];this.createHelp().visibleCommands(this).forEach((G)=>{if(b.push(G.name()),G.alias())b.push(G.alias())}),z=gb(_,b)}let A=`error: unknown command '${_}'${z}`;this.error(A,{code:"commander.unknownCommand"})}version(_,z,A){if(_===void 0)return this._version;this._version=_,z=z||"-V, --version",A=A||"output the version number";let b=this.createOption(z,A);return this._versionOptionName=b.attributeName(),this._registerOption(b),this.on("option:"+b.name(),()=>{this._outputConfiguration.writeOut(`${_}
25
+ `),this._exit(0,"commander.version",_)}),this}description(_,z){if(_===void 0&&z===void 0)return this._description;if(this._description=_,z)this._argsDescription=z;return this}summary(_){if(_===void 0)return this._summary;return this._summary=_,this}alias(_){if(_===void 0)return this._aliases[0];let z=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler)z=this.commands[this.commands.length-1];if(_===z._name)throw Error("Command alias can't be the same as its name");let A=this.parent?._findCommand(_);if(A){let b=[A.name()].concat(A.aliases()).join("|");throw Error(`cannot add alias '${_}' to command '${this.name()}' as already have command '${b}'`)}return z._aliases.push(_),this}aliases(_){if(_===void 0)return this._aliases;return _.forEach((z)=>this.alias(z)),this}usage(_){if(_===void 0){if(this._usage)return this._usage;let z=this.registeredArguments.map((A)=>{return UU(A)});return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?z:[]).join(" ")}return this._usage=_,this}name(_){if(_===void 0)return this._name;return this._name=_,this}helpGroup(_){if(_===void 0)return this._helpGroupHeading??"";return this._helpGroupHeading=_,this}commandsGroup(_){if(_===void 0)return this._defaultCommandGroup??"";return this._defaultCommandGroup=_,this}optionsGroup(_){if(_===void 0)return this._defaultOptionGroup??"";return this._defaultOptionGroup=_,this}_initOptionGroup(_){if(this._defaultOptionGroup&&!_.helpGroupHeading)_.helpGroup(this._defaultOptionGroup)}_initCommandGroup(_){if(this._defaultCommandGroup&&!_.helpGroup())_.helpGroup(this._defaultCommandGroup)}nameFromFilename(_){return this._name=W4.basename(_,W4.extname(_)),this}executableDir(_){if(_===void 0)return this._executableDir;return this._executableDir=_,this}helpInformation(_){let z=this.createHelp(),A=this._getOutputContext(_);z.prepareContext({error:A.error,helpWidth:A.helpWidth,outputHasColors:A.hasColors});let b=z.formatHelp(this,z);if(A.hasColors)return b;return this._outputConfiguration.stripColor(b)}_getOutputContext(_){_=_||{};let z=!!_.error,A,b,G;if(z)A=(Y)=>this._outputConfiguration.writeErr(Y),b=this._outputConfiguration.getErrHasColors(),G=this._outputConfiguration.getErrHelpWidth();else A=(Y)=>this._outputConfiguration.writeOut(Y),b=this._outputConfiguration.getOutHasColors(),G=this._outputConfiguration.getOutHelpWidth();return{error:z,write:(Y)=>{if(!b)Y=this._outputConfiguration.stripColor(Y);return A(Y)},hasColors:b,helpWidth:G}}outputHelp(_){let z;if(typeof _==="function")z=_,_=void 0;let A=this._getOutputContext(_),b={error:A.error,write:A.write,command:this};this._getCommandAndAncestors().reverse().forEach((J)=>J.emit("beforeAllHelp",b)),this.emit("beforeHelp",b);let G=this.helpInformation({error:A.error});if(z){if(G=z(G),typeof G!=="string"&&!Buffer.isBuffer(G))throw Error("outputHelp callback must return a string or a Buffer")}if(A.write(G),this._getHelpOption()?.long)this.emit(this._getHelpOption().long);this.emit("afterHelp",b),this._getCommandAndAncestors().forEach((J)=>J.emit("afterAllHelp",b))}helpOption(_,z){if(typeof _==="boolean"){if(_){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(_??"-h, --help",z??"display help for command"),_||z)this._initOptionGroup(this._helpOption);return this}_getHelpOption(){if(this._helpOption===void 0)this.helpOption(void 0,void 0);return this._helpOption}addHelpOption(_){return this._helpOption=_,this._initOptionGroup(_),this}help(_){this.outputHelp(_);let z=Number($0.exitCode??0);if(z===0&&_&&typeof _!=="function"&&_.error)z=1;this._exit(z,"commander.help","(outputHelp)")}addHelpText(_,z){let A=["beforeAll","before","after","afterAll"];if(!A.includes(_))throw Error(`Unexpected value for position to addHelpText.
26
26
  Expecting one of '${A.join("', '")}'`);let b=`${_}Help`;return this.on(b,(G)=>{let J;if(typeof z==="function")J=z({error:G.error,command:G.command});else J=z;if(J)G.write(`${J}
27
- `)}),this}_outputHelpIfRequested(_){let z=this._getHelpOption();if(z&&_.find((b)=>z.is(b)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function yb(_){return _.map((z)=>{if(!z.startsWith("--inspect"))return z;let A,b="127.0.0.1",G="9229",J;if((J=z.match(/^(--inspect(-brk)?)$/))!==null)A=J[1];else if((J=z.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(A=J[1],/^\d+$/.test(J[3]))G=J[3];else b=J[3];else if((J=z.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)A=J[1],b=J[3],G=J[4];if(A&&G!=="0")return`${A}=${b}:${parseInt(G)+1}`;return z})}function Q8(){if($0.env.NO_COLOR||$0.env.FORCE_COLOR==="0"||$0.env.FORCE_COLOR==="false")return!1;if($0.env.FORCE_COLOR||$0.env.CLICOLOR_FORCE!==void 0)return!0;return}MU.Command=$8;MU.useColor=Q8});var ub=I((LU)=>{var{Argument:fb}=R3(),{Command:H8}=gb(),{CommanderError:EU,InvalidArgumentError:hb}=n1(),{Help:OU}=G8(),{Option:mb}=J8();LU.program=new H8;LU.createCommand=(_)=>new H8(_);LU.createOption=(_,z)=>new mb(_,z);LU.createArgument=(_,z)=>new fb(_,z);LU.Command=H8;LU.Option=mb;LU.Argument=fb;LU.Help=OU;LU.CommanderError=EU;LU.InvalidArgumentError=hb;LU.InvalidOptionArgumentError=hb});var RJ=I((LJ)=>{Object.defineProperty(LJ,"__esModule",{value:!0});LJ.toBig=LJ.shrSL=LJ.shrSH=LJ.rotrSL=LJ.rotrSH=LJ.rotrBL=LJ.rotrBH=LJ.rotr32L=LJ.rotr32H=LJ.rotlSL=LJ.rotlSH=LJ.rotlBL=LJ.rotlBH=LJ.add5L=LJ.add5H=LJ.add4L=LJ.add4H=LJ.add3L=LJ.add3H=void 0;LJ.add=UJ;LJ.fromBig=r8;LJ.split=GJ;var r3=BigInt(4294967295),d8=BigInt(32);function r8(_,z=!1){if(z)return{h:Number(_&r3),l:Number(_>>d8&r3)};return{h:Number(_>>d8&r3)|0,l:Number(_&r3)|0}}function GJ(_,z=!1){let A=_.length,b=new Uint32Array(A),G=new Uint32Array(A);for(let J=0;J<A;J++){let{h:Y,l:X}=r8(_[J],z);[b[J],G[J]]=[Y,X]}return[b,G]}var JJ=(_,z)=>BigInt(_>>>0)<<d8|BigInt(z>>>0);LJ.toBig=JJ;var YJ=(_,z,A)=>_>>>A;LJ.shrSH=YJ;var XJ=(_,z,A)=>_<<32-A|z>>>A;LJ.shrSL=XJ;var QJ=(_,z,A)=>_>>>A|z<<32-A;LJ.rotrSH=QJ;var $J=(_,z,A)=>_<<32-A|z>>>A;LJ.rotrSL=$J;var HJ=(_,z,A)=>_<<64-A|z>>>A-32;LJ.rotrBH=HJ;var BJ=(_,z,A)=>_>>>A-32|z<<64-A;LJ.rotrBL=BJ;var ZJ=(_,z)=>z;LJ.rotr32H=ZJ;var FJ=(_,z)=>_;LJ.rotr32L=FJ;var KJ=(_,z,A)=>_<<A|z>>>32-A;LJ.rotlSH=KJ;var qJ=(_,z,A)=>z<<A|_>>>32-A;LJ.rotlSL=qJ;var WJ=(_,z,A)=>z<<A-32|_>>>64-A;LJ.rotlBH=WJ;var VJ=(_,z,A)=>_<<A-32|z>>>64-A;LJ.rotlBL=VJ;function UJ(_,z,A,b){let G=(z>>>0)+(b>>>0);return{h:_+A+(G/4294967296|0)|0,l:G|0}}var DJ=(_,z,A)=>(_>>>0)+(z>>>0)+(A>>>0);LJ.add3L=DJ;var MJ=(_,z,A,b)=>z+A+b+(_/4294967296|0)|0;LJ.add3H=MJ;var NJ=(_,z,A,b)=>(_>>>0)+(z>>>0)+(A>>>0)+(b>>>0);LJ.add4L=NJ;var wJ=(_,z,A,b,G)=>z+A+b+G+(_/4294967296|0)|0;LJ.add4H=wJ;var EJ=(_,z,A,b,G)=>(_>>>0)+(z>>>0)+(A>>>0)+(b>>>0)+(G>>>0);LJ.add5L=EJ;var OJ=(_,z,A,b,G,J)=>z+A+b+G+J+(_/4294967296|0)|0;LJ.add5H=OJ;var jM={fromBig:r8,split:GJ,toBig:JJ,shrSH:YJ,shrSL:XJ,rotrSH:QJ,rotrSL:$J,rotrBH:HJ,rotrBL:BJ,rotr32H:ZJ,rotr32L:FJ,rotlSH:KJ,rotlSL:qJ,rotlBH:WJ,rotlBL:VJ,add:UJ,add3L:DJ,add3H:MJ,add4L:NJ,add4H:wJ,add5H:OJ,add5L:EJ};LJ.default=jM});var kJ=I((PJ)=>{Object.defineProperty(PJ,"__esModule",{value:!0});PJ.crypto=void 0;var u4=q4("node:crypto");PJ.crypto=u4&&typeof u4==="object"&&"webcrypto"in u4?u4.webcrypto:u4&&typeof u4==="object"&&("randomBytes"in u4)?u4:void 0});var lJ=I((hJ)=>{/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */Object.defineProperty(hJ,"__esModule",{value:!0});hJ.wrapXOFConstructorWithOpts=hJ.wrapConstructorWithOpts=hJ.wrapConstructor=hJ.Hash=hJ.nextTick=hJ.swap32IfBE=hJ.byteSwapIfBE=hJ.swap8IfBE=hJ.isLE=void 0;hJ.isBytes=xJ;hJ.anumber=n8;hJ.abytes=p_;hJ.ahash=oM;hJ.aexists=aM;hJ.aoutput=sM;hJ.u8=tM;hJ.u32=eM;hJ.clean=_N;hJ.createView=zN;hJ.rotr=AN;hJ.rotl=bN;hJ.byteSwap=i8;hJ.byteSwap32=TJ;hJ.bytesToHex=JN;hJ.hexToBytes=YN;hJ.asyncLoop=QN;hJ.utf8ToBytes=o8;hJ.bytesToUtf8=$N;hJ.toBytes=n3;hJ.kdfInputToBytes=HN;hJ.concatBytes=BN;hJ.checkOpts=ZN;hJ.createHasher=yJ;hJ.createOptHasher=gJ;hJ.createXOFer=fJ;hJ.randomBytes=FN;var l_=kJ();function xJ(_){return _ instanceof Uint8Array||ArrayBuffer.isView(_)&&_.constructor.name==="Uint8Array"}function n8(_){if(!Number.isSafeInteger(_)||_<0)throw Error("positive integer expected, got "+_)}function p_(_,...z){if(!xJ(_))throw Error("Uint8Array expected");if(z.length>0&&!z.includes(_.length))throw Error("Uint8Array expected of length "+z+", got length="+_.length)}function oM(_){if(typeof _!=="function"||typeof _.create!=="function")throw Error("Hash should be wrapped by utils.createHasher");n8(_.outputLen),n8(_.blockLen)}function aM(_,z=!0){if(_.destroyed)throw Error("Hash instance has been destroyed");if(z&&_.finished)throw Error("Hash#digest() has already been called")}function sM(_,z){p_(_);let A=z.outputLen;if(_.length<A)throw Error("digestInto() expects output buffer of length at least "+A)}function tM(_){return new Uint8Array(_.buffer,_.byteOffset,_.byteLength)}function eM(_){return new Uint32Array(_.buffer,_.byteOffset,Math.floor(_.byteLength/4))}function _N(..._){for(let z=0;z<_.length;z++)_[z].fill(0)}function zN(_){return new DataView(_.buffer,_.byteOffset,_.byteLength)}function AN(_,z){return _<<32-z|_>>>z}function bN(_,z){return _<<z|_>>>32-z>>>0}hJ.isLE=(()=>new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68)();function i8(_){return _<<24&4278190080|_<<8&16711680|_>>>8&65280|_>>>24&255}hJ.swap8IfBE=hJ.isLE?(_)=>_:(_)=>i8(_);hJ.byteSwapIfBE=hJ.swap8IfBE;function TJ(_){for(let z=0;z<_.length;z++)_[z]=i8(_[z]);return _}hJ.swap32IfBE=hJ.isLE?(_)=>_:TJ;var CJ=(()=>typeof Uint8Array.from([]).toHex==="function"&&typeof Uint8Array.fromHex==="function")(),GN=Array.from({length:256},(_,z)=>z.toString(16).padStart(2,"0"));function JN(_){if(p_(_),CJ)return _.toHex();let z="";for(let A=0;A<_.length;A++)z+=GN[_[A]];return z}var U4={_0:48,_9:57,A:65,F:70,a:97,f:102};function IJ(_){if(_>=U4._0&&_<=U4._9)return _-U4._0;if(_>=U4.A&&_<=U4.F)return _-(U4.A-10);if(_>=U4.a&&_<=U4.f)return _-(U4.a-10);return}function YN(_){if(typeof _!=="string")throw Error("hex string expected, got "+typeof _);if(CJ)return Uint8Array.fromHex(_);let z=_.length,A=z/2;if(z%2)throw Error("hex string expected, got unpadded hex of length "+z);let b=new Uint8Array(A);for(let G=0,J=0;G<A;G++,J+=2){let Y=IJ(_.charCodeAt(J)),X=IJ(_.charCodeAt(J+1));if(Y===void 0||X===void 0){let Q=_[J]+_[J+1];throw Error('hex string expected, got non-hex character "'+Q+'" at index '+J)}b[G]=Y*16+X}return b}var XN=async()=>{};hJ.nextTick=XN;async function QN(_,z,A){let b=Date.now();for(let G=0;G<_;G++){A(G);let J=Date.now()-b;if(J>=0&&J<z)continue;await hJ.nextTick(),b+=J}}function o8(_){if(typeof _!=="string")throw Error("string expected");return new Uint8Array(new TextEncoder().encode(_))}function $N(_){return new TextDecoder().decode(_)}function n3(_){if(typeof _==="string")_=o8(_);return p_(_),_}function HN(_){if(typeof _==="string")_=o8(_);return p_(_),_}function BN(..._){let z=0;for(let b=0;b<_.length;b++){let G=_[b];p_(G),z+=G.length}let A=new Uint8Array(z);for(let b=0,G=0;b<_.length;b++){let J=_[b];A.set(J,G),G+=J.length}return A}function ZN(_,z){if(z!==void 0&&{}.toString.call(z)!=="[object Object]")throw Error("options should be object or undefined");return Object.assign(_,z)}class vJ{}hJ.Hash=vJ;function yJ(_){let z=(b)=>_().update(n3(b)).digest(),A=_();return z.outputLen=A.outputLen,z.blockLen=A.blockLen,z.create=()=>_(),z}function gJ(_){let z=(b,G)=>_(G).update(n3(b)).digest(),A=_({});return z.outputLen=A.outputLen,z.blockLen=A.blockLen,z.create=(b)=>_(b),z}function fJ(_){let z=(b,G)=>_(G).update(n3(b)).digest(),A=_({});return z.outputLen=A.outputLen,z.blockLen=A.blockLen,z.create=(b)=>_(b),z}hJ.wrapConstructor=yJ;hJ.wrapConstructorWithOpts=gJ;hJ.wrapXOFConstructorWithOpts=fJ;function FN(_=32){if(l_.crypto&&typeof l_.crypto.getRandomValues==="function")return l_.crypto.getRandomValues(new Uint8Array(_));if(l_.crypto&&typeof l_.crypto.randomBytes==="function")return Uint8Array.from(l_.crypto.randomBytes(_));throw Error("crypto.getRandomValues must be defined")}});var _Y=I((tJ)=>{Object.defineProperty(tJ,"__esModule",{value:!0});tJ.shake256=tJ.shake128=tJ.keccak_512=tJ.keccak_384=tJ.keccak_256=tJ.keccak_224=tJ.sha3_512=tJ.sha3_384=tJ.sha3_256=tJ.sha3_224=tJ.Keccak=void 0;tJ.keccakP=aJ;var Gz=RJ(),p0=lJ(),rN=BigInt(0),bz=BigInt(1),nN=BigInt(2),iN=BigInt(7),oN=BigInt(256),aN=BigInt(113),rJ=[],nJ=[],iJ=[];for(let _=0,z=bz,A=1,b=0;_<24;_++){[A,b]=[b,(2*A+3*b)%5],rJ.push(2*(5*b+A)),nJ.push((_+1)*(_+2)/2%64);let G=rN;for(let J=0;J<7;J++)if(z=(z<<bz^(z>>iN)*aN)%oN,z&nN)G^=bz<<(bz<<BigInt(J))-bz;iJ.push(G)}var oJ=(0,Gz.split)(iJ,!0),sN=oJ[0],tN=oJ[1],pJ=(_,z,A)=>A>32?(0,Gz.rotlBH)(_,z,A):(0,Gz.rotlSH)(_,z,A),dJ=(_,z,A)=>A>32?(0,Gz.rotlBL)(_,z,A):(0,Gz.rotlSL)(_,z,A);function aJ(_,z=24){let A=new Uint32Array(10);for(let b=24-z;b<24;b++){for(let Y=0;Y<10;Y++)A[Y]=_[Y]^_[Y+10]^_[Y+20]^_[Y+30]^_[Y+40];for(let Y=0;Y<10;Y+=2){let X=(Y+8)%10,Q=(Y+2)%10,$=A[Q],H=A[Q+1],B=pJ($,H,1)^A[X],Z=dJ($,H,1)^A[X+1];for(let F=0;F<50;F+=10)_[Y+F]^=B,_[Y+F+1]^=Z}let G=_[2],J=_[3];for(let Y=0;Y<24;Y++){let X=nJ[Y],Q=pJ(G,J,X),$=dJ(G,J,X),H=rJ[Y];G=_[H],J=_[H+1],_[H]=Q,_[H+1]=$}for(let Y=0;Y<50;Y+=10){for(let X=0;X<10;X++)A[X]=_[Y+X];for(let X=0;X<10;X++)_[Y+X]^=~A[(X+2)%10]&A[(X+4)%10]}_[0]^=sN[b],_[1]^=tN[b]}(0,p0.clean)(A)}class Jz extends p0.Hash{constructor(_,z,A,b=!1,G=24){super();if(this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=_,this.suffix=z,this.outputLen=A,this.enableXOF=b,this.rounds=G,(0,p0.anumber)(A),!(0<_&&_<200))throw Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=(0,p0.u32)(this.state)}clone(){return this._cloneInto()}keccak(){(0,p0.swap32IfBE)(this.state32),aJ(this.state32,this.rounds),(0,p0.swap32IfBE)(this.state32),this.posOut=0,this.pos=0}update(_){(0,p0.aexists)(this),_=(0,p0.toBytes)(_),(0,p0.abytes)(_);let{blockLen:z,state:A}=this,b=_.length;for(let G=0;G<b;){let J=Math.min(z-this.pos,b-G);for(let Y=0;Y<J;Y++)A[this.pos++]^=_[G++];if(this.pos===z)this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:_,suffix:z,pos:A,blockLen:b}=this;if(_[A]^=z,(z&128)!==0&&A===b-1)this.keccak();_[b-1]^=128,this.keccak()}writeInto(_){(0,p0.aexists)(this,!1),(0,p0.abytes)(_),this.finish();let z=this.state,{blockLen:A}=this;for(let b=0,G=_.length;b<G;){if(this.posOut>=A)this.keccak();let J=Math.min(A-this.posOut,G-b);_.set(z.subarray(this.posOut,this.posOut+J),b),this.posOut+=J,b+=J}return _}xofInto(_){if(!this.enableXOF)throw Error("XOF is not possible for this instance");return this.writeInto(_)}xof(_){return(0,p0.anumber)(_),this.xofInto(new Uint8Array(_))}digestInto(_){if((0,p0.aoutput)(_,this),this.finished)throw Error("digest() was already called");return this.writeInto(_),this.destroy(),_}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,(0,p0.clean)(this.state)}_cloneInto(_){let{blockLen:z,suffix:A,outputLen:b,rounds:G,enableXOF:J}=this;return _||(_=new Jz(z,A,b,J,G)),_.state32.set(this.state32),_.pos=this.pos,_.posOut=this.posOut,_.finished=this.finished,_.rounds=G,_.suffix=A,_.outputLen=b,_.enableXOF=J,_.destroyed=this.destroyed,_}}tJ.Keccak=Jz;var c4=(_,z,A)=>(0,p0.createHasher)(()=>new Jz(z,_,A));tJ.sha3_224=(()=>c4(6,144,28))();tJ.sha3_256=(()=>c4(6,136,32))();tJ.sha3_384=(()=>c4(6,104,48))();tJ.sha3_512=(()=>c4(6,72,64))();tJ.keccak_224=(()=>c4(1,144,28))();tJ.keccak_256=(()=>c4(1,136,32))();tJ.keccak_384=(()=>c4(1,104,48))();tJ.keccak_512=(()=>c4(1,72,64))();var sJ=(_,z,A)=>(0,p0.createXOFer)((b={})=>new Jz(z,_,b.dkLen===void 0?A:b.dkLen,!0));tJ.shake128=(()=>sJ(31,168,16))();tJ.shake256=(()=>sJ(31,136,32))()});var XY=I((qw,l4)=>{var{sha3_512:Hw}=_Y(),s8=(_=4,z=Math.random)=>{let A="";while(A.length<_)A=A+Math.floor(z()*36).toString(36);return A};function AY(_){let z=8n,A=0n;for(let b of _.values()){let G=BigInt(b);A=(A<<z)+G}return A}var bY=(_="")=>{return AY(Hw(_)).toString(36).slice(1)},zY=Array.from({length:26},(_,z)=>String.fromCharCode(z+97)),Bw=(_)=>zY[Math.floor(_()*zY.length)],GY=({globalObj:_=typeof global<"u"?global:typeof window<"u"?window:{},random:z=Math.random}={})=>{let A=Object.keys(_).toString(),b=A.length?A+s8(32,z):s8(32,z);return bY(b).substring(0,32)},JY=(_)=>()=>{return _++},Zw=476782367,YY=({random:_=Math.random,counter:z=JY(Math.floor(_()*Zw)),length:A=24,fingerprint:b=GY({random:_})}={})=>{return function(){let J=Bw(_),Y=Date.now().toString(36),X=z().toString(36),Q=s8(A,_),$=`${Y+Q+X+b}`;return`${J+bY($).substring(1,A)}`}},Fw=YY(),Kw=(_,{minLength:z=2,maxLength:A=32}={})=>{let b=_.length,G=/^[0-9a-z]+$/;try{if(typeof _==="string"&&b>=z&&b<=A&&G.test(_))return!0}finally{}return!1};qw.getConstants=()=>({defaultLength:24,bigLength:32});qw.init=YY;qw.createId=Fw;qw.bufToBigInt=AY;qw.createCounter=JY;qw.createFingerprint=GY;qw.isCuid=Kw});var J3=I((bF)=>{Object.defineProperty(bF,"__esModule",{value:!0});bF.regexpCode=bF.getEsmExportName=bF.getProperty=bF.safeStringify=bF.stringify=bF.strConcat=bF.addCodeArg=bF.str=bF._=bF.nil=bF._Code=bF.Name=bF.IDENTIFIER=bF._CodeOrName=void 0;class qA{}bF._CodeOrName=qA;bF.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class y1 extends qA{constructor(_){super();if(!bF.IDENTIFIER.test(_))throw Error("CodeGen: name must be a valid identifier");this.str=_}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}bF.Name=y1;class p9 extends qA{constructor(_){super();this._items=typeof _==="string"?[_]:_}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let _=this._items[0];return _===""||_==='""'}get str(){var _;return(_=this._str)!==null&&_!==void 0?_:this._str=this._items.reduce((z,A)=>`${z}${A}`,"")}get names(){var _;return(_=this._names)!==null&&_!==void 0?_:this._names=this._items.reduce((z,A)=>{if(A instanceof y1)z[A.str]=(z[A.str]||0)+1;return z},{})}}bF._Code=p9;bF.nil=new p9("");function zF(_,...z){let A=[_[0]],b=0;while(b<z.length)W7(A,z[b]),A.push(_[++b]);return new p9(A)}bF._=zF;var q7=new p9("+");function AF(_,...z){let A=[G3(_[0])],b=0;while(b<z.length)A.push(q7),W7(A,z[b]),A.push(q7,G3(_[++b]));return WT(A),new p9(A)}bF.str=AF;function W7(_,z){if(z instanceof p9)_.push(...z._items);else if(z instanceof y1)_.push(z);else _.push(DT(z))}bF.addCodeArg=W7;function WT(_){let z=1;while(z<_.length-1){if(_[z]===q7){let A=VT(_[z-1],_[z+1]);if(A!==void 0){_.splice(z-1,3,A);continue}_[z++]="+"}z++}}function VT(_,z){if(z==='""')return _;if(_==='""')return z;if(typeof _=="string"){if(z instanceof y1||_[_.length-1]!=='"')return;if(typeof z!="string")return`${_.slice(0,-1)}${z}"`;if(z[0]==='"')return _.slice(0,-1)+z.slice(1);return}if(typeof z=="string"&&z[0]==='"'&&!(_ instanceof y1))return`"${_}${z.slice(1)}`;return}function UT(_,z){return z.emptyStr()?_:_.emptyStr()?z:AF`${_}${z}`}bF.strConcat=UT;function DT(_){return typeof _=="number"||typeof _=="boolean"||_===null?_:G3(Array.isArray(_)?_.join(","):_)}function MT(_){return new p9(G3(_))}bF.stringify=MT;function G3(_){return JSON.stringify(_).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}bF.safeStringify=G3;function NT(_){return typeof _=="string"&&bF.IDENTIFIER.test(_)?new p9(`.${_}`):zF`[${_}]`}bF.getProperty=NT;function wT(_){if(typeof _=="string"&&bF.IDENTIFIER.test(_))return new p9(`${_}`);throw Error(`CodeGen: invalid export name: ${_}, use explicit $id name mapping`)}bF.getEsmExportName=wT;function ET(_){return new p9(_.toString())}bF.regexpCode=ET});var M7=I((XF)=>{Object.defineProperty(XF,"__esModule",{value:!0});XF.ValueScope=XF.ValueScopeName=XF.Scope=XF.varKinds=XF.UsedValueState=void 0;var H9=J3();class JF extends Error{constructor(_){super(`CodeGen: "code" for ${_} not defined`);this.value=_.value}}var VA;(function(_){_[_.Started=0]="Started",_[_.Completed=1]="Completed"})(VA||(XF.UsedValueState=VA={}));XF.varKinds={const:new H9.Name("const"),let:new H9.Name("let"),var:new H9.Name("var")};class U7{constructor({prefixes:_,parent:z}={}){this._names={},this._prefixes=_,this._parent=z}toName(_){return _ instanceof H9.Name?_:this.name(_)}name(_){return new H9.Name(this._newName(_))}_newName(_){let z=this._names[_]||this._nameGroup(_);return`${_}${z.index++}`}_nameGroup(_){var z,A;if(((A=(z=this._parent)===null||z===void 0?void 0:z._prefixes)===null||A===void 0?void 0:A.has(_))||this._prefixes&&!this._prefixes.has(_))throw Error(`CodeGen: prefix "${_}" is not allowed in this scope`);return this._names[_]={prefix:_,index:0}}}XF.Scope=U7;class D7 extends H9.Name{constructor(_,z){super(z);this.prefix=_}setValue(_,{property:z,itemIndex:A}){this.value=_,this.scopePath=H9._`.${new H9.Name(z)}[${A}]`}}XF.ValueScopeName=D7;var yT=H9._`\n`;class YF extends U7{constructor(_){super(_);this._values={},this._scope=_.scope,this.opts={..._,_n:_.lines?yT:H9.nil}}get(){return this._scope}name(_){return new D7(_,this._newName(_))}value(_,z){var A;if(z.ref===void 0)throw Error("CodeGen: ref must be passed in value");let b=this.toName(_),{prefix:G}=b,J=(A=z.key)!==null&&A!==void 0?A:z.ref,Y=this._values[G];if(Y){let $=Y.get(J);if($)return $}else Y=this._values[G]=new Map;Y.set(J,b);let X=this._scope[G]||(this._scope[G]=[]),Q=X.length;return X[Q]=z.ref,b.setValue(z,{property:G,itemIndex:Q}),b}getValue(_,z){let A=this._values[_];if(!A)return;return A.get(z)}scopeRefs(_,z=this._values){return this._reduceValues(z,(A)=>{if(A.scopePath===void 0)throw Error(`CodeGen: name "${A}" has no value`);return H9._`${_}${A.scopePath}`})}scopeCode(_=this._values,z,A){return this._reduceValues(_,(b)=>{if(b.value===void 0)throw Error(`CodeGen: name "${b}" has no value`);return b.value.code},z,A)}_reduceValues(_,z,A={},b){let G=H9.nil;for(let J in _){let Y=_[J];if(!Y)continue;let X=A[J]=A[J]||new Map;Y.forEach((Q)=>{if(X.has(Q))return;X.set(Q,VA.Started);let $=z(Q);if($){let H=this.opts.es5?XF.varKinds.var:XF.varKinds.const;G=H9._`${G}${H} ${Q} = ${$};${this.opts._n}`}else if($=b===null||b===void 0?void 0:b(Q))G=H9._`${G}${$}${this.opts._n}`;else throw new JF(Q);X.set(Q,VA.Completed)})}return G}}XF.ValueScope=YF});var t=I((B9)=>{Object.defineProperty(B9,"__esModule",{value:!0});B9.or=B9.and=B9.not=B9.CodeGen=B9.operators=B9.varKinds=B9.ValueScopeName=B9.ValueScope=B9.Scope=B9.Name=B9.regexpCode=B9.stringify=B9.getProperty=B9.nil=B9.strConcat=B9.str=B9._=void 0;var G0=J3(),d9=M7(),Y_=J3();Object.defineProperty(B9,"_",{enumerable:!0,get:function(){return Y_._}});Object.defineProperty(B9,"str",{enumerable:!0,get:function(){return Y_.str}});Object.defineProperty(B9,"strConcat",{enumerable:!0,get:function(){return Y_.strConcat}});Object.defineProperty(B9,"nil",{enumerable:!0,get:function(){return Y_.nil}});Object.defineProperty(B9,"getProperty",{enumerable:!0,get:function(){return Y_.getProperty}});Object.defineProperty(B9,"stringify",{enumerable:!0,get:function(){return Y_.stringify}});Object.defineProperty(B9,"regexpCode",{enumerable:!0,get:function(){return Y_.regexpCode}});Object.defineProperty(B9,"Name",{enumerable:!0,get:function(){return Y_.Name}});var EA=M7();Object.defineProperty(B9,"Scope",{enumerable:!0,get:function(){return EA.Scope}});Object.defineProperty(B9,"ValueScope",{enumerable:!0,get:function(){return EA.ValueScope}});Object.defineProperty(B9,"ValueScopeName",{enumerable:!0,get:function(){return EA.ValueScopeName}});Object.defineProperty(B9,"varKinds",{enumerable:!0,get:function(){return EA.varKinds}});B9.operators={GT:new G0._Code(">"),GTE:new G0._Code(">="),LT:new G0._Code("<"),LTE:new G0._Code("<="),EQ:new G0._Code("==="),NEQ:new G0._Code("!=="),NOT:new G0._Code("!"),OR:new G0._Code("||"),AND:new G0._Code("&&"),ADD:new G0._Code("+")};class X_{optimizeNodes(){return this}optimizeNames(_,z){return this}}class $F extends X_{constructor(_,z,A){super();this.varKind=_,this.name=z,this.rhs=A}render({es5:_,_n:z}){let A=_?d9.varKinds.var:this.varKind,b=this.rhs===void 0?"":` = ${this.rhs}`;return`${A} ${this.name}${b};`+z}optimizeNames(_,z){if(!_[this.name.str])return;if(this.rhs)this.rhs=f1(this.rhs,_,z);return this}get names(){return this.rhs instanceof G0._CodeOrName?this.rhs.names:{}}}class E7 extends X_{constructor(_,z,A){super();this.lhs=_,this.rhs=z,this.sideEffects=A}render({_n:_}){return`${this.lhs} = ${this.rhs};`+_}optimizeNames(_,z){if(this.lhs instanceof G0.Name&&!_[this.lhs.str]&&!this.sideEffects)return;return this.rhs=f1(this.rhs,_,z),this}get names(){let _=this.lhs instanceof G0.Name?{}:{...this.lhs.names};return wA(_,this.rhs)}}class HF extends E7{constructor(_,z,A,b){super(_,A,b);this.op=z}render({_n:_}){return`${this.lhs} ${this.op}= ${this.rhs};`+_}}class BF extends X_{constructor(_){super();this.label=_,this.names={}}render({_n:_}){return`${this.label}:`+_}}class ZF extends X_{constructor(_){super();this.label=_,this.names={}}render({_n:_}){return`break${this.label?` ${this.label}`:""};`+_}}class FF extends X_{constructor(_){super();this.error=_}render({_n:_}){return`throw ${this.error};`+_}get names(){return this.error.names}}class KF extends X_{constructor(_){super();this.code=_}render({_n:_}){return`${this.code};`+_}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(_,z){return this.code=f1(this.code,_,z),this}get names(){return this.code instanceof G0._CodeOrName?this.code.names:{}}}class OA extends X_{constructor(_=[]){super();this.nodes=_}render(_){return this.nodes.reduce((z,A)=>z+A.render(_),"")}optimizeNodes(){let{nodes:_}=this,z=_.length;while(z--){let A=_[z].optimizeNodes();if(Array.isArray(A))_.splice(z,1,...A);else if(A)_[z]=A;else _.splice(z,1)}return _.length>0?this:void 0}optimizeNames(_,z){let{nodes:A}=this,b=A.length;while(b--){let G=A[b];if(G.optimizeNames(_,z))continue;mT(_,G.names),A.splice(b,1)}return A.length>0?this:void 0}get names(){return this.nodes.reduce((_,z)=>T_(_,z.names),{})}}class Q_ extends OA{render(_){return"{"+_._n+super.render(_)+"}"+_._n}}class qF extends OA{}class Y3 extends Q_{}Y3.kind="else";class C4 extends Q_{constructor(_,z){super(z);this.condition=_}render(_){let z=`if(${this.condition})`+super.render(_);if(this.else)z+="else "+this.else.render(_);return z}optimizeNodes(){super.optimizeNodes();let _=this.condition;if(_===!0)return this.nodes;let z=this.else;if(z){let A=z.optimizeNodes();z=this.else=Array.isArray(A)?new Y3(A):A}if(z){if(_===!1)return z instanceof C4?z:z.nodes;if(this.nodes.length)return this;return new C4(MF(_),z instanceof C4?[z]:z.nodes)}if(_===!1||!this.nodes.length)return;return this}optimizeNames(_,z){var A;if(this.else=(A=this.else)===null||A===void 0?void 0:A.optimizeNames(_,z),!(super.optimizeNames(_,z)||this.else))return;return this.condition=f1(this.condition,_,z),this}get names(){let _=super.names;if(wA(_,this.condition),this.else)T_(_,this.else.names);return _}}C4.kind="if";class g1 extends Q_{}g1.kind="for";class WF extends g1{constructor(_){super();this.iteration=_}render(_){return`for(${this.iteration})`+super.render(_)}optimizeNames(_,z){if(!super.optimizeNames(_,z))return;return this.iteration=f1(this.iteration,_,z),this}get names(){return T_(super.names,this.iteration.names)}}class VF extends g1{constructor(_,z,A,b){super();this.varKind=_,this.name=z,this.from=A,this.to=b}render(_){let z=_.es5?d9.varKinds.var:this.varKind,{name:A,from:b,to:G}=this;return`for(${z} ${A}=${b}; ${A}<${G}; ${A}++)`+super.render(_)}get names(){let _=wA(super.names,this.from);return wA(_,this.to)}}class N7 extends g1{constructor(_,z,A,b){super();this.loop=_,this.varKind=z,this.name=A,this.iterable=b}render(_){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(_)}optimizeNames(_,z){if(!super.optimizeNames(_,z))return;return this.iterable=f1(this.iterable,_,z),this}get names(){return T_(super.names,this.iterable.names)}}class UA extends Q_{constructor(_,z,A){super();this.name=_,this.args=z,this.async=A}render(_){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(_)}}UA.kind="func";class DA extends OA{render(_){return"return "+super.render(_)}}DA.kind="return";class UF extends Q_{render(_){let z="try"+super.render(_);if(this.catch)z+=this.catch.render(_);if(this.finally)z+=this.finally.render(_);return z}optimizeNodes(){var _,z;return super.optimizeNodes(),(_=this.catch)===null||_===void 0||_.optimizeNodes(),(z=this.finally)===null||z===void 0||z.optimizeNodes(),this}optimizeNames(_,z){var A,b;return super.optimizeNames(_,z),(A=this.catch)===null||A===void 0||A.optimizeNames(_,z),(b=this.finally)===null||b===void 0||b.optimizeNames(_,z),this}get names(){let _=super.names;if(this.catch)T_(_,this.catch.names);if(this.finally)T_(_,this.finally.names);return _}}class MA extends Q_{constructor(_){super();this.error=_}render(_){return`catch(${this.error})`+super.render(_)}}MA.kind="catch";class NA extends Q_{render(_){return"finally"+super.render(_)}}NA.kind="finally";class DF{constructor(_,z={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...z,_n:z.lines?`
28
- `:""},this._extScope=_,this._scope=new d9.Scope({parent:_}),this._nodes=[new qF]}toString(){return this._root.render(this.opts)}name(_){return this._scope.name(_)}scopeName(_){return this._extScope.name(_)}scopeValue(_,z){let A=this._extScope.value(_,z);return(this._values[A.prefix]||(this._values[A.prefix]=new Set)).add(A),A}getScopeValue(_,z){return this._extScope.getValue(_,z)}scopeRefs(_){return this._extScope.scopeRefs(_,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(_,z,A,b){let G=this._scope.toName(z);if(A!==void 0&&b)this._constants[G.str]=A;return this._leafNode(new $F(_,G,A)),G}const(_,z,A){return this._def(d9.varKinds.const,_,z,A)}let(_,z,A){return this._def(d9.varKinds.let,_,z,A)}var(_,z,A){return this._def(d9.varKinds.var,_,z,A)}assign(_,z,A){return this._leafNode(new E7(_,z,A))}add(_,z){return this._leafNode(new HF(_,B9.operators.ADD,z))}code(_){if(typeof _=="function")_();else if(_!==G0.nil)this._leafNode(new KF(_));return this}object(..._){let z=["{"];for(let[A,b]of _){if(z.length>1)z.push(",");if(z.push(A),A!==b||this.opts.es5)z.push(":"),(0,G0.addCodeArg)(z,b)}return z.push("}"),new G0._Code(z)}if(_,z,A){if(this._blockNode(new C4(_)),z&&A)this.code(z).else().code(A).endIf();else if(z)this.code(z).endIf();else if(A)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(_){return this._elseNode(new C4(_))}else(){return this._elseNode(new Y3)}endIf(){return this._endBlockNode(C4,Y3)}_for(_,z){if(this._blockNode(_),z)this.code(z).endFor();return this}for(_,z){return this._for(new WF(_),z)}forRange(_,z,A,b,G=this.opts.es5?d9.varKinds.var:d9.varKinds.let){let J=this._scope.toName(_);return this._for(new VF(G,J,z,A),()=>b(J))}forOf(_,z,A,b=d9.varKinds.const){let G=this._scope.toName(_);if(this.opts.es5){let J=z instanceof G0.Name?z:this.var("_arr",z);return this.forRange("_i",0,G0._`${J}.length`,(Y)=>{this.var(G,G0._`${J}[${Y}]`),A(G)})}return this._for(new N7("of",b,G,z),()=>A(G))}forIn(_,z,A,b=this.opts.es5?d9.varKinds.var:d9.varKinds.const){if(this.opts.ownProperties)return this.forOf(_,G0._`Object.keys(${z})`,A);let G=this._scope.toName(_);return this._for(new N7("in",b,G,z),()=>A(G))}endFor(){return this._endBlockNode(g1)}label(_){return this._leafNode(new BF(_))}break(_){return this._leafNode(new ZF(_))}return(_){let z=new DA;if(this._blockNode(z),this.code(_),z.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(DA)}try(_,z,A){if(!z&&!A)throw Error('CodeGen: "try" without "catch" and "finally"');let b=new UF;if(this._blockNode(b),this.code(_),z){let G=this.name("e");this._currNode=b.catch=new MA(G),z(G)}if(A)this._currNode=b.finally=new NA,this.code(A);return this._endBlockNode(MA,NA)}throw(_){return this._leafNode(new FF(_))}block(_,z){if(this._blockStarts.push(this._nodes.length),_)this.code(_).endBlock(z);return this}endBlock(_){let z=this._blockStarts.pop();if(z===void 0)throw Error("CodeGen: not in self-balancing block");let A=this._nodes.length-z;if(A<0||_!==void 0&&A!==_)throw Error(`CodeGen: wrong number of nodes: ${A} vs ${_} expected`);return this._nodes.length=z,this}func(_,z=G0.nil,A,b){if(this._blockNode(new UA(_,z,A)),b)this.code(b).endFunc();return this}endFunc(){return this._endBlockNode(UA)}optimize(_=1){while(_-- >0)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(_){return this._currNode.nodes.push(_),this}_blockNode(_){this._currNode.nodes.push(_),this._nodes.push(_)}_endBlockNode(_,z){let A=this._currNode;if(A instanceof _||z&&A instanceof z)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${z?`${_.kind}/${z.kind}`:_.kind}"`)}_elseNode(_){let z=this._currNode;if(!(z instanceof C4))throw Error('CodeGen: "else" without "if"');return this._currNode=z.else=_,this}get _root(){return this._nodes[0]}get _currNode(){let _=this._nodes;return _[_.length-1]}set _currNode(_){let z=this._nodes;z[z.length-1]=_}}B9.CodeGen=DF;function T_(_,z){for(let A in z)_[A]=(_[A]||0)+(z[A]||0);return _}function wA(_,z){return z instanceof G0._CodeOrName?T_(_,z.names):_}function f1(_,z,A){if(_ instanceof G0.Name)return b(_);if(!G(_))return _;return new G0._Code(_._items.reduce((J,Y)=>{if(Y instanceof G0.Name)Y=b(Y);if(Y instanceof G0._Code)J.push(...Y._items);else J.push(Y);return J},[]));function b(J){let Y=A[J.str];if(Y===void 0||z[J.str]!==1)return J;return delete z[J.str],Y}function G(J){return J instanceof G0._Code&&J._items.some((Y)=>Y instanceof G0.Name&&z[Y.str]===1&&A[Y.str]!==void 0)}}function mT(_,z){for(let A in z)_[A]=(_[A]||0)-(z[A]||0)}function MF(_){return typeof _=="boolean"||typeof _=="number"||_===null?!_:G0._`!${w7(_)}`}B9.not=MF;var uT=NF(B9.operators.AND);function cT(..._){return _.reduce(uT)}B9.and=cT;var lT=NF(B9.operators.OR);function pT(..._){return _.reduce(lT)}B9.or=pT;function NF(_){return(z,A)=>z===G0.nil?A:A===G0.nil?z:G0._`${w7(z)} ${_} ${w7(A)}`}function w7(_){return _ instanceof G0.Name?_:G0._`(${_})`}});var Q0=I((kF)=>{Object.defineProperty(kF,"__esModule",{value:!0});kF.checkStrictMode=kF.getErrorPath=kF.Type=kF.useFunc=kF.setEvaluated=kF.evaluatedPropsToName=kF.mergeEvaluated=kF.eachItem=kF.unescapeJsonPointer=kF.escapeJsonPointer=kF.escapeFragment=kF.unescapeFragment=kF.schemaRefOrVal=kF.schemaHasRulesButRef=kF.schemaHasRules=kF.checkUnknownRules=kF.alwaysValidSchema=kF.toHash=void 0;var V0=t(),iT=J3();function oT(_){let z={};for(let A of _)z[A]=!0;return z}kF.toHash=oT;function aT(_,z){if(typeof z=="boolean")return z;if(Object.keys(z).length===0)return!0;return LF(_,z),!jF(z,_.self.RULES.all)}kF.alwaysValidSchema=aT;function LF(_,z=_.schema){let{opts:A,self:b}=_;if(!A.strictSchema)return;if(typeof z==="boolean")return;let G=b.RULES.keywords;for(let J in z)if(!G[J])SF(_,`unknown keyword: "${J}"`)}kF.checkUnknownRules=LF;function jF(_,z){if(typeof _=="boolean")return!_;for(let A in _)if(z[A])return!0;return!1}kF.schemaHasRules=jF;function sT(_,z){if(typeof _=="boolean")return!_;for(let A in _)if(A!=="$ref"&&z.all[A])return!0;return!1}kF.schemaHasRulesButRef=sT;function tT({topSchemaRef:_,schemaPath:z},A,b,G){if(!G){if(typeof A=="number"||typeof A=="boolean")return A;if(typeof A=="string")return V0._`${A}`}return V0._`${_}${z}${(0,V0.getProperty)(b)}`}kF.schemaRefOrVal=tT;function eT(_){return RF(decodeURIComponent(_))}kF.unescapeFragment=eT;function _C(_){return encodeURIComponent(L7(_))}kF.escapeFragment=_C;function L7(_){if(typeof _=="number")return`${_}`;return _.replace(/~/g,"~0").replace(/\//g,"~1")}kF.escapeJsonPointer=L7;function RF(_){return _.replace(/~1/g,"/").replace(/~0/g,"~")}kF.unescapeJsonPointer=RF;function zC(_,z){if(Array.isArray(_))for(let A of _)z(A);else z(_)}kF.eachItem=zC;function EF({mergeNames:_,mergeToName:z,mergeValues:A,resultToName:b}){return(G,J,Y,X)=>{let Q=Y===void 0?J:Y instanceof V0.Name?(J instanceof V0.Name?_(G,J,Y):z(G,J,Y),Y):J instanceof V0.Name?(z(G,Y,J),J):A(J,Y);return X===V0.Name&&!(Q instanceof V0.Name)?b(G,Q):Q}}kF.mergeEvaluated={props:EF({mergeNames:(_,z,A)=>_.if(V0._`${A} !== true && ${z} !== undefined`,()=>{_.if(V0._`${z} === true`,()=>_.assign(A,!0),()=>_.assign(A,V0._`${A} || {}`).code(V0._`Object.assign(${A}, ${z})`))}),mergeToName:(_,z,A)=>_.if(V0._`${A} !== true`,()=>{if(z===!0)_.assign(A,!0);else _.assign(A,V0._`${A} || {}`),j7(_,A,z)}),mergeValues:(_,z)=>_===!0?!0:{..._,...z},resultToName:PF}),items:EF({mergeNames:(_,z,A)=>_.if(V0._`${A} !== true && ${z} !== undefined`,()=>_.assign(A,V0._`${z} === true ? true : ${A} > ${z} ? ${A} : ${z}`)),mergeToName:(_,z,A)=>_.if(V0._`${A} !== true`,()=>_.assign(A,z===!0?!0:V0._`${A} > ${z} ? ${A} : ${z}`)),mergeValues:(_,z)=>_===!0?!0:Math.max(_,z),resultToName:(_,z)=>_.var("items",z)})};function PF(_,z){if(z===!0)return _.var("props",!0);let A=_.var("props",V0._`{}`);if(z!==void 0)j7(_,A,z);return A}kF.evaluatedPropsToName=PF;function j7(_,z,A){Object.keys(A).forEach((b)=>_.assign(V0._`${z}${(0,V0.getProperty)(b)}`,!0))}kF.setEvaluated=j7;var OF={};function AC(_,z){return _.scopeValue("func",{ref:z,code:OF[z.code]||(OF[z.code]=new iT._Code(z.code))})}kF.useFunc=AC;var O7;(function(_){_[_.Num=0]="Num",_[_.Str=1]="Str"})(O7||(kF.Type=O7={}));function bC(_,z,A){if(_ instanceof V0.Name){let b=z===O7.Num;return A?b?V0._`"[" + ${_} + "]"`:V0._`"['" + ${_} + "']"`:b?V0._`"/" + ${_}`:V0._`"/" + ${_}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return A?(0,V0.getProperty)(_).toString():"/"+L7(_)}kF.getErrorPath=bC;function SF(_,z,A=_.opts.strictSchema){if(!A)return;if(z=`strict mode: ${z}`,A===!0)throw Error(z);_.self.logger.warn(z)}kF.checkStrictMode=SF});var v4=I((xF)=>{Object.defineProperty(xF,"__esModule",{value:!0});var i0=t(),NC={data:new i0.Name("data"),valCxt:new i0.Name("valCxt"),instancePath:new i0.Name("instancePath"),parentData:new i0.Name("parentData"),parentDataProperty:new i0.Name("parentDataProperty"),rootData:new i0.Name("rootData"),dynamicAnchors:new i0.Name("dynamicAnchors"),vErrors:new i0.Name("vErrors"),errors:new i0.Name("errors"),this:new i0.Name("this"),self:new i0.Name("self"),scope:new i0.Name("scope"),json:new i0.Name("json"),jsonPos:new i0.Name("jsonPos"),jsonLen:new i0.Name("jsonLen"),jsonPart:new i0.Name("jsonPart")};xF.default=NC});var X3=I((yF)=>{Object.defineProperty(yF,"__esModule",{value:!0});yF.extendErrors=yF.resetErrorsCount=yF.reportExtraError=yF.reportError=yF.keyword$DataError=yF.keywordError=void 0;var J0=t(),jA=Q0(),b9=v4();yF.keywordError={message:({keyword:_})=>J0.str`must pass "${_}" keyword validation`};yF.keyword$DataError={message:({keyword:_,schemaType:z})=>z?J0.str`"${_}" keyword must be ${z} ($data)`:J0.str`"${_}" keyword is invalid ($data)`};function EC(_,z=yF.keywordError,A,b){let{it:G}=_,{gen:J,compositeRule:Y,allErrors:X}=G,Q=vF(_,z,A);if(b!==null&&b!==void 0?b:Y||X)TF(J,Q);else CF(G,J0._`[${Q}]`)}yF.reportError=EC;function OC(_,z=yF.keywordError,A){let{it:b}=_,{gen:G,compositeRule:J,allErrors:Y}=b,X=vF(_,z,A);if(TF(G,X),!(J||Y))CF(b,b9.default.vErrors)}yF.reportExtraError=OC;function LC(_,z){_.assign(b9.default.errors,z),_.if(J0._`${b9.default.vErrors} !== null`,()=>_.if(z,()=>_.assign(J0._`${b9.default.vErrors}.length`,z),()=>_.assign(b9.default.vErrors,null)))}yF.resetErrorsCount=LC;function jC({gen:_,keyword:z,schemaValue:A,data:b,errsCount:G,it:J}){if(G===void 0)throw Error("ajv implementation error");let Y=_.name("err");_.forRange("i",G,b9.default.errors,(X)=>{if(_.const(Y,J0._`${b9.default.vErrors}[${X}]`),_.if(J0._`${Y}.instancePath === undefined`,()=>_.assign(J0._`${Y}.instancePath`,(0,J0.strConcat)(b9.default.instancePath,J.errorPath))),_.assign(J0._`${Y}.schemaPath`,J0.str`${J.errSchemaPath}/${z}`),J.opts.verbose)_.assign(J0._`${Y}.schema`,A),_.assign(J0._`${Y}.data`,b)})}yF.extendErrors=jC;function TF(_,z){let A=_.const("err",z);_.if(J0._`${b9.default.vErrors} === null`,()=>_.assign(b9.default.vErrors,J0._`[${A}]`),J0._`${b9.default.vErrors}.push(${A})`),_.code(J0._`${b9.default.errors}++`)}function CF(_,z){let{gen:A,validateName:b,schemaEnv:G}=_;if(G.$async)A.throw(J0._`new ${_.ValidationError}(${z})`);else A.assign(J0._`${b}.errors`,z),A.return(!1)}var C_={keyword:new J0.Name("keyword"),schemaPath:new J0.Name("schemaPath"),params:new J0.Name("params"),propertyName:new J0.Name("propertyName"),message:new J0.Name("message"),schema:new J0.Name("schema"),parentSchema:new J0.Name("parentSchema")};function vF(_,z,A){let{createErrors:b}=_.it;if(b===!1)return J0._`{}`;return RC(_,z,A)}function RC(_,z,A={}){let{gen:b,it:G}=_,J=[PC(G,A),SC(_,A)];return kC(_,z,J),b.object(...J)}function PC({errorPath:_},{instancePath:z}){let A=z?J0.str`${_}${(0,jA.getErrorPath)(z,jA.Type.Str)}`:_;return[b9.default.instancePath,(0,J0.strConcat)(b9.default.instancePath,A)]}function SC({keyword:_,it:{errSchemaPath:z}},{schemaPath:A,parentSchema:b}){let G=b?z:J0.str`${z}/${_}`;if(A)G=J0.str`${G}${(0,jA.getErrorPath)(A,jA.Type.Str)}`;return[C_.schemaPath,G]}function kC(_,{params:z,message:A},b){let{keyword:G,data:J,schemaValue:Y,it:X}=_,{opts:Q,propertyName:$,topSchemaRef:H,schemaPath:B}=X;if(b.push([C_.keyword,G],[C_.params,typeof z=="function"?z(_):z||J0._`{}`]),Q.messages)b.push([C_.message,typeof A=="function"?A(_):A]);if(Q.verbose)b.push([C_.schema,Y],[C_.parentSchema,J0._`${H}${B}`],[b9.default.data,J]);if($)b.push([C_.propertyName,$])}});var uF=I((hF)=>{Object.defineProperty(hF,"__esModule",{value:!0});hF.boolOrEmptySchema=hF.topBoolOrEmptySchema=void 0;var vC=X3(),yC=t(),gC=v4(),fC={message:"boolean schema is false"};function hC(_){let{gen:z,schema:A,validateName:b}=_;if(A===!1)fF(_,!1);else if(typeof A=="object"&&A.$async===!0)z.return(gC.default.data);else z.assign(yC._`${b}.errors`,null),z.return(!0)}hF.topBoolOrEmptySchema=hC;function mC(_,z){let{gen:A,schema:b}=_;if(b===!1)A.var(z,!1),fF(_);else A.var(z,!0)}hF.boolOrEmptySchema=mC;function fF(_,z){let{gen:A,data:b}=_,G={gen:A,keyword:"false schema",data:b,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:_};(0,vC.reportError)(G,fC,void 0,z)}});var P7=I((cF)=>{Object.defineProperty(cF,"__esModule",{value:!0});cF.getRules=cF.isJSONType=void 0;var cC=["string","number","integer","boolean","null","object","array"],lC=new Set(cC);function pC(_){return typeof _=="string"&&lC.has(_)}cF.isJSONType=pC;function dC(){let _={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{..._,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},_.number,_.string,_.array,_.object],post:{rules:[]},all:{},keywords:{}}}cF.getRules=dC});var S7=I((rF)=>{Object.defineProperty(rF,"__esModule",{value:!0});rF.shouldUseRule=rF.shouldUseGroup=rF.schemaHasRulesForType=void 0;function nC({schema:_,self:z},A){let b=z.RULES.types[A];return b&&b!==!0&&pF(_,b)}rF.schemaHasRulesForType=nC;function pF(_,z){return z.rules.some((A)=>dF(_,A))}rF.shouldUseGroup=pF;function dF(_,z){var A;return _[z.keyword]!==void 0||((A=z.definition.implements)===null||A===void 0?void 0:A.some((b)=>_[b]!==void 0))}rF.shouldUseRule=dF});var Q3=I((sF)=>{Object.defineProperty(sF,"__esModule",{value:!0});sF.reportTypeError=sF.checkDataTypes=sF.checkDataType=sF.coerceAndCheckDataType=sF.getJSONTypes=sF.getSchemaTypes=sF.DataType=void 0;var aC=P7(),sC=S7(),tC=X3(),a=t(),iF=Q0(),h1;(function(_){_[_.Correct=0]="Correct",_[_.Wrong=1]="Wrong"})(h1||(sF.DataType=h1={}));function eC(_){let z=oF(_.type);if(z.includes("null")){if(_.nullable===!1)throw Error("type: null contradicts nullable: false")}else{if(!z.length&&_.nullable!==void 0)throw Error('"nullable" cannot be used without "type"');if(_.nullable===!0)z.push("null")}return z}sF.getSchemaTypes=eC;function oF(_){let z=Array.isArray(_)?_:_?[_]:[];if(z.every(aC.isJSONType))return z;throw Error("type must be JSONType or JSONType[]: "+z.join(","))}sF.getJSONTypes=oF;function _v(_,z){let{gen:A,data:b,opts:G}=_,J=zv(z,G.coerceTypes),Y=z.length>0&&!(J.length===0&&z.length===1&&(0,sC.schemaHasRulesForType)(_,z[0]));if(Y){let X=I7(z,b,G.strictNumbers,h1.Wrong);A.if(X,()=>{if(J.length)Av(_,z,J);else x7(_)})}return Y}sF.coerceAndCheckDataType=_v;var aF=new Set(["string","number","integer","boolean","null"]);function zv(_,z){return z?_.filter((A)=>aF.has(A)||z==="array"&&A==="array"):[]}function Av(_,z,A){let{gen:b,data:G,opts:J}=_,Y=b.let("dataType",a._`typeof ${G}`),X=b.let("coerced",a._`undefined`);if(J.coerceTypes==="array")b.if(a._`${Y} == 'object' && Array.isArray(${G}) && ${G}.length == 1`,()=>b.assign(G,a._`${G}[0]`).assign(Y,a._`typeof ${G}`).if(I7(z,G,J.strictNumbers),()=>b.assign(X,G)));b.if(a._`${X} !== undefined`);for(let $ of A)if(aF.has($)||$==="array"&&J.coerceTypes==="array")Q($);b.else(),x7(_),b.endIf(),b.if(a._`${X} !== undefined`,()=>{b.assign(G,X),bv(_,X)});function Q($){switch($){case"string":b.elseIf(a._`${Y} == "number" || ${Y} == "boolean"`).assign(X,a._`"" + ${G}`).elseIf(a._`${G} === null`).assign(X,a._`""`);return;case"number":b.elseIf(a._`${Y} == "boolean" || ${G} === null
27
+ `)}),this}_outputHelpIfRequested(_){let z=this._getHelpOption();if(z&&_.find((b)=>z.is(b)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function fb(_){return _.map((z)=>{if(!z.startsWith("--inspect"))return z;let A,b="127.0.0.1",G="9229",J;if((J=z.match(/^(--inspect(-brk)?)$/))!==null)A=J[1];else if((J=z.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(A=J[1],/^\d+$/.test(J[3]))G=J[3];else b=J[3];else if((J=z.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)A=J[1],b=J[3],G=J[4];if(A&&G!=="0")return`${A}=${b}:${parseInt(G)+1}`;return z})}function B8(){if($0.env.NO_COLOR||$0.env.FORCE_COLOR==="0"||$0.env.FORCE_COLOR==="false")return!1;if($0.env.FORCE_COLOR||$0.env.CLICOLOR_FORCE!==void 0)return!0;return}wU.Command=Z8;wU.useColor=B8});var lb=I((RU)=>{var{Argument:mb}=S3(),{Command:F8}=hb(),{CommanderError:LU,InvalidArgumentError:ub}=o1(),{Help:jU}=X8(),{Option:cb}=Q8();RU.program=new F8;RU.createCommand=(_)=>new F8(_);RU.createOption=(_,z)=>new cb(_,z);RU.createArgument=(_,z)=>new mb(_,z);RU.Command=F8;RU.Option=cb;RU.Argument=mb;RU.Help=jU;RU.CommanderError=LU;RU.InvalidArgumentError=ub;RU.InvalidOptionArgumentError=ub});var RJ=I((LJ)=>{Object.defineProperty(LJ,"__esModule",{value:!0});LJ.toBig=LJ.shrSL=LJ.shrSH=LJ.rotrSL=LJ.rotrSH=LJ.rotrBL=LJ.rotrBH=LJ.rotr32L=LJ.rotr32H=LJ.rotlSL=LJ.rotlSH=LJ.rotlBL=LJ.rotlBH=LJ.add5L=LJ.add5H=LJ.add4L=LJ.add4H=LJ.add3L=LJ.add3H=void 0;LJ.add=UJ;LJ.fromBig=o8;LJ.split=GJ;var o3=BigInt(4294967295),i8=BigInt(32);function o8(_,z=!1){if(z)return{h:Number(_&o3),l:Number(_>>i8&o3)};return{h:Number(_>>i8&o3)|0,l:Number(_&o3)|0}}function GJ(_,z=!1){let A=_.length,b=new Uint32Array(A),G=new Uint32Array(A);for(let J=0;J<A;J++){let{h:Y,l:X}=o8(_[J],z);[b[J],G[J]]=[Y,X]}return[b,G]}var JJ=(_,z)=>BigInt(_>>>0)<<i8|BigInt(z>>>0);LJ.toBig=JJ;var YJ=(_,z,A)=>_>>>A;LJ.shrSH=YJ;var XJ=(_,z,A)=>_<<32-A|z>>>A;LJ.shrSL=XJ;var QJ=(_,z,A)=>_>>>A|z<<32-A;LJ.rotrSH=QJ;var $J=(_,z,A)=>_<<32-A|z>>>A;LJ.rotrSL=$J;var HJ=(_,z,A)=>_<<64-A|z>>>A-32;LJ.rotrBH=HJ;var BJ=(_,z,A)=>_>>>A-32|z<<64-A;LJ.rotrBL=BJ;var ZJ=(_,z)=>z;LJ.rotr32H=ZJ;var FJ=(_,z)=>_;LJ.rotr32L=FJ;var KJ=(_,z,A)=>_<<A|z>>>32-A;LJ.rotlSH=KJ;var qJ=(_,z,A)=>z<<A|_>>>32-A;LJ.rotlSL=qJ;var WJ=(_,z,A)=>z<<A-32|_>>>64-A;LJ.rotlBH=WJ;var VJ=(_,z,A)=>_<<A-32|z>>>64-A;LJ.rotlBL=VJ;function UJ(_,z,A,b){let G=(z>>>0)+(b>>>0);return{h:_+A+(G/4294967296|0)|0,l:G|0}}var DJ=(_,z,A)=>(_>>>0)+(z>>>0)+(A>>>0);LJ.add3L=DJ;var MJ=(_,z,A,b)=>z+A+b+(_/4294967296|0)|0;LJ.add3H=MJ;var NJ=(_,z,A,b)=>(_>>>0)+(z>>>0)+(A>>>0)+(b>>>0);LJ.add4L=NJ;var wJ=(_,z,A,b,G)=>z+A+b+G+(_/4294967296|0)|0;LJ.add4H=wJ;var EJ=(_,z,A,b,G)=>(_>>>0)+(z>>>0)+(A>>>0)+(b>>>0)+(G>>>0);LJ.add5L=EJ;var OJ=(_,z,A,b,G,J)=>z+A+b+G+J+(_/4294967296|0)|0;LJ.add5H=OJ;var SM={fromBig:o8,split:GJ,toBig:JJ,shrSH:YJ,shrSL:XJ,rotrSH:QJ,rotrSL:$J,rotrBH:HJ,rotrBL:BJ,rotr32H:ZJ,rotr32L:FJ,rotlSH:KJ,rotlSL:qJ,rotlBH:WJ,rotlBL:VJ,add:UJ,add3L:DJ,add3H:MJ,add4L:NJ,add4H:wJ,add5H:OJ,add5L:EJ};LJ.default=SM});var kJ=I((PJ)=>{Object.defineProperty(PJ,"__esModule",{value:!0});PJ.crypto=void 0;var u4=q4("node:crypto");PJ.crypto=u4&&typeof u4==="object"&&"webcrypto"in u4?u4.webcrypto:u4&&typeof u4==="object"&&("randomBytes"in u4)?u4:void 0});var lJ=I((hJ)=>{/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */Object.defineProperty(hJ,"__esModule",{value:!0});hJ.wrapXOFConstructorWithOpts=hJ.wrapConstructorWithOpts=hJ.wrapConstructor=hJ.Hash=hJ.nextTick=hJ.swap32IfBE=hJ.byteSwapIfBE=hJ.swap8IfBE=hJ.isLE=void 0;hJ.isBytes=xJ;hJ.anumber=a8;hJ.abytes=d_;hJ.ahash=tM;hJ.aexists=eM;hJ.aoutput=_N;hJ.u8=zN;hJ.u32=AN;hJ.clean=bN;hJ.createView=GN;hJ.rotr=JN;hJ.rotl=YN;hJ.byteSwap=s8;hJ.byteSwap32=TJ;hJ.bytesToHex=QN;hJ.hexToBytes=$N;hJ.asyncLoop=BN;hJ.utf8ToBytes=t8;hJ.bytesToUtf8=ZN;hJ.toBytes=a3;hJ.kdfInputToBytes=FN;hJ.concatBytes=KN;hJ.checkOpts=qN;hJ.createHasher=yJ;hJ.createOptHasher=gJ;hJ.createXOFer=fJ;hJ.randomBytes=WN;var p_=kJ();function xJ(_){return _ instanceof Uint8Array||ArrayBuffer.isView(_)&&_.constructor.name==="Uint8Array"}function a8(_){if(!Number.isSafeInteger(_)||_<0)throw Error("positive integer expected, got "+_)}function d_(_,...z){if(!xJ(_))throw Error("Uint8Array expected");if(z.length>0&&!z.includes(_.length))throw Error("Uint8Array expected of length "+z+", got length="+_.length)}function tM(_){if(typeof _!=="function"||typeof _.create!=="function")throw Error("Hash should be wrapped by utils.createHasher");a8(_.outputLen),a8(_.blockLen)}function eM(_,z=!0){if(_.destroyed)throw Error("Hash instance has been destroyed");if(z&&_.finished)throw Error("Hash#digest() has already been called")}function _N(_,z){d_(_);let A=z.outputLen;if(_.length<A)throw Error("digestInto() expects output buffer of length at least "+A)}function zN(_){return new Uint8Array(_.buffer,_.byteOffset,_.byteLength)}function AN(_){return new Uint32Array(_.buffer,_.byteOffset,Math.floor(_.byteLength/4))}function bN(..._){for(let z=0;z<_.length;z++)_[z].fill(0)}function GN(_){return new DataView(_.buffer,_.byteOffset,_.byteLength)}function JN(_,z){return _<<32-z|_>>>z}function YN(_,z){return _<<z|_>>>32-z>>>0}hJ.isLE=(()=>new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68)();function s8(_){return _<<24&4278190080|_<<8&16711680|_>>>8&65280|_>>>24&255}hJ.swap8IfBE=hJ.isLE?(_)=>_:(_)=>s8(_);hJ.byteSwapIfBE=hJ.swap8IfBE;function TJ(_){for(let z=0;z<_.length;z++)_[z]=s8(_[z]);return _}hJ.swap32IfBE=hJ.isLE?(_)=>_:TJ;var CJ=(()=>typeof Uint8Array.from([]).toHex==="function"&&typeof Uint8Array.fromHex==="function")(),XN=Array.from({length:256},(_,z)=>z.toString(16).padStart(2,"0"));function QN(_){if(d_(_),CJ)return _.toHex();let z="";for(let A=0;A<_.length;A++)z+=XN[_[A]];return z}var U4={_0:48,_9:57,A:65,F:70,a:97,f:102};function IJ(_){if(_>=U4._0&&_<=U4._9)return _-U4._0;if(_>=U4.A&&_<=U4.F)return _-(U4.A-10);if(_>=U4.a&&_<=U4.f)return _-(U4.a-10);return}function $N(_){if(typeof _!=="string")throw Error("hex string expected, got "+typeof _);if(CJ)return Uint8Array.fromHex(_);let z=_.length,A=z/2;if(z%2)throw Error("hex string expected, got unpadded hex of length "+z);let b=new Uint8Array(A);for(let G=0,J=0;G<A;G++,J+=2){let Y=IJ(_.charCodeAt(J)),X=IJ(_.charCodeAt(J+1));if(Y===void 0||X===void 0){let Q=_[J]+_[J+1];throw Error('hex string expected, got non-hex character "'+Q+'" at index '+J)}b[G]=Y*16+X}return b}var HN=async()=>{};hJ.nextTick=HN;async function BN(_,z,A){let b=Date.now();for(let G=0;G<_;G++){A(G);let J=Date.now()-b;if(J>=0&&J<z)continue;await hJ.nextTick(),b+=J}}function t8(_){if(typeof _!=="string")throw Error("string expected");return new Uint8Array(new TextEncoder().encode(_))}function ZN(_){return new TextDecoder().decode(_)}function a3(_){if(typeof _==="string")_=t8(_);return d_(_),_}function FN(_){if(typeof _==="string")_=t8(_);return d_(_),_}function KN(..._){let z=0;for(let b=0;b<_.length;b++){let G=_[b];d_(G),z+=G.length}let A=new Uint8Array(z);for(let b=0,G=0;b<_.length;b++){let J=_[b];A.set(J,G),G+=J.length}return A}function qN(_,z){if(z!==void 0&&{}.toString.call(z)!=="[object Object]")throw Error("options should be object or undefined");return Object.assign(_,z)}class vJ{}hJ.Hash=vJ;function yJ(_){let z=(b)=>_().update(a3(b)).digest(),A=_();return z.outputLen=A.outputLen,z.blockLen=A.blockLen,z.create=()=>_(),z}function gJ(_){let z=(b,G)=>_(G).update(a3(b)).digest(),A=_({});return z.outputLen=A.outputLen,z.blockLen=A.blockLen,z.create=(b)=>_(b),z}function fJ(_){let z=(b,G)=>_(G).update(a3(b)).digest(),A=_({});return z.outputLen=A.outputLen,z.blockLen=A.blockLen,z.create=(b)=>_(b),z}hJ.wrapConstructor=yJ;hJ.wrapConstructorWithOpts=gJ;hJ.wrapXOFConstructorWithOpts=fJ;function WN(_=32){if(p_.crypto&&typeof p_.crypto.getRandomValues==="function")return p_.crypto.getRandomValues(new Uint8Array(_));if(p_.crypto&&typeof p_.crypto.randomBytes==="function")return Uint8Array.from(p_.crypto.randomBytes(_));throw Error("crypto.getRandomValues must be defined")}});var _Y=I((tJ)=>{Object.defineProperty(tJ,"__esModule",{value:!0});tJ.shake256=tJ.shake128=tJ.keccak_512=tJ.keccak_384=tJ.keccak_256=tJ.keccak_224=tJ.sha3_512=tJ.sha3_384=tJ.sha3_256=tJ.sha3_224=tJ.Keccak=void 0;tJ.keccakP=aJ;var Yz=RJ(),p0=lJ(),oN=BigInt(0),Jz=BigInt(1),aN=BigInt(2),sN=BigInt(7),tN=BigInt(256),eN=BigInt(113),rJ=[],nJ=[],iJ=[];for(let _=0,z=Jz,A=1,b=0;_<24;_++){[A,b]=[b,(2*A+3*b)%5],rJ.push(2*(5*b+A)),nJ.push((_+1)*(_+2)/2%64);let G=oN;for(let J=0;J<7;J++)if(z=(z<<Jz^(z>>sN)*eN)%tN,z&aN)G^=Jz<<(Jz<<BigInt(J))-Jz;iJ.push(G)}var oJ=(0,Yz.split)(iJ,!0),_w=oJ[0],zw=oJ[1],pJ=(_,z,A)=>A>32?(0,Yz.rotlBH)(_,z,A):(0,Yz.rotlSH)(_,z,A),dJ=(_,z,A)=>A>32?(0,Yz.rotlBL)(_,z,A):(0,Yz.rotlSL)(_,z,A);function aJ(_,z=24){let A=new Uint32Array(10);for(let b=24-z;b<24;b++){for(let Y=0;Y<10;Y++)A[Y]=_[Y]^_[Y+10]^_[Y+20]^_[Y+30]^_[Y+40];for(let Y=0;Y<10;Y+=2){let X=(Y+8)%10,Q=(Y+2)%10,$=A[Q],H=A[Q+1],B=pJ($,H,1)^A[X],Z=dJ($,H,1)^A[X+1];for(let F=0;F<50;F+=10)_[Y+F]^=B,_[Y+F+1]^=Z}let G=_[2],J=_[3];for(let Y=0;Y<24;Y++){let X=nJ[Y],Q=pJ(G,J,X),$=dJ(G,J,X),H=rJ[Y];G=_[H],J=_[H+1],_[H]=Q,_[H+1]=$}for(let Y=0;Y<50;Y+=10){for(let X=0;X<10;X++)A[X]=_[Y+X];for(let X=0;X<10;X++)_[Y+X]^=~A[(X+2)%10]&A[(X+4)%10]}_[0]^=_w[b],_[1]^=zw[b]}(0,p0.clean)(A)}class Xz extends p0.Hash{constructor(_,z,A,b=!1,G=24){super();if(this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=_,this.suffix=z,this.outputLen=A,this.enableXOF=b,this.rounds=G,(0,p0.anumber)(A),!(0<_&&_<200))throw Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=(0,p0.u32)(this.state)}clone(){return this._cloneInto()}keccak(){(0,p0.swap32IfBE)(this.state32),aJ(this.state32,this.rounds),(0,p0.swap32IfBE)(this.state32),this.posOut=0,this.pos=0}update(_){(0,p0.aexists)(this),_=(0,p0.toBytes)(_),(0,p0.abytes)(_);let{blockLen:z,state:A}=this,b=_.length;for(let G=0;G<b;){let J=Math.min(z-this.pos,b-G);for(let Y=0;Y<J;Y++)A[this.pos++]^=_[G++];if(this.pos===z)this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:_,suffix:z,pos:A,blockLen:b}=this;if(_[A]^=z,(z&128)!==0&&A===b-1)this.keccak();_[b-1]^=128,this.keccak()}writeInto(_){(0,p0.aexists)(this,!1),(0,p0.abytes)(_),this.finish();let z=this.state,{blockLen:A}=this;for(let b=0,G=_.length;b<G;){if(this.posOut>=A)this.keccak();let J=Math.min(A-this.posOut,G-b);_.set(z.subarray(this.posOut,this.posOut+J),b),this.posOut+=J,b+=J}return _}xofInto(_){if(!this.enableXOF)throw Error("XOF is not possible for this instance");return this.writeInto(_)}xof(_){return(0,p0.anumber)(_),this.xofInto(new Uint8Array(_))}digestInto(_){if((0,p0.aoutput)(_,this),this.finished)throw Error("digest() was already called");return this.writeInto(_),this.destroy(),_}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,(0,p0.clean)(this.state)}_cloneInto(_){let{blockLen:z,suffix:A,outputLen:b,rounds:G,enableXOF:J}=this;return _||(_=new Xz(z,A,b,J,G)),_.state32.set(this.state32),_.pos=this.pos,_.posOut=this.posOut,_.finished=this.finished,_.rounds=G,_.suffix=A,_.outputLen=b,_.enableXOF=J,_.destroyed=this.destroyed,_}}tJ.Keccak=Xz;var c4=(_,z,A)=>(0,p0.createHasher)(()=>new Xz(z,_,A));tJ.sha3_224=(()=>c4(6,144,28))();tJ.sha3_256=(()=>c4(6,136,32))();tJ.sha3_384=(()=>c4(6,104,48))();tJ.sha3_512=(()=>c4(6,72,64))();tJ.keccak_224=(()=>c4(1,144,28))();tJ.keccak_256=(()=>c4(1,136,32))();tJ.keccak_384=(()=>c4(1,104,48))();tJ.keccak_512=(()=>c4(1,72,64))();var sJ=(_,z,A)=>(0,p0.createXOFer)((b={})=>new Xz(z,_,b.dkLen===void 0?A:b.dkLen,!0));tJ.shake128=(()=>sJ(31,168,16))();tJ.shake256=(()=>sJ(31,136,32))()});var XY=I((Uw,l4)=>{var{sha3_512:Fw}=_Y(),_5=(_=4,z=Math.random)=>{let A="";while(A.length<_)A=A+Math.floor(z()*36).toString(36);return A};function AY(_){let z=8n,A=0n;for(let b of _.values()){let G=BigInt(b);A=(A<<z)+G}return A}var bY=(_="")=>{return AY(Fw(_)).toString(36).slice(1)},zY=Array.from({length:26},(_,z)=>String.fromCharCode(z+97)),Kw=(_)=>zY[Math.floor(_()*zY.length)],GY=({globalObj:_=typeof global<"u"?global:typeof window<"u"?window:{},random:z=Math.random}={})=>{let A=Object.keys(_).toString(),b=A.length?A+_5(32,z):_5(32,z);return bY(b).substring(0,32)},JY=(_)=>()=>{return _++},qw=476782367,YY=({random:_=Math.random,counter:z=JY(Math.floor(_()*qw)),length:A=24,fingerprint:b=GY({random:_})}={})=>{return function(){let J=Kw(_),Y=Date.now().toString(36),X=z().toString(36),Q=_5(A,_),$=`${Y+Q+X+b}`;return`${J+bY($).substring(1,A)}`}},Ww=YY(),Vw=(_,{minLength:z=2,maxLength:A=32}={})=>{let b=_.length,G=/^[0-9a-z]+$/;try{if(typeof _==="string"&&b>=z&&b<=A&&G.test(_))return!0}finally{}return!1};Uw.getConstants=()=>({defaultLength:24,bigLength:32});Uw.init=YY;Uw.createId=Ww;Uw.bufToBigInt=AY;Uw.createCounter=JY;Uw.createFingerprint=GY;Uw.isCuid=Vw});var X3=I((JF)=>{Object.defineProperty(JF,"__esModule",{value:!0});JF.regexpCode=JF.getEsmExportName=JF.getProperty=JF.safeStringify=JF.stringify=JF.strConcat=JF.addCodeArg=JF.str=JF._=JF.nil=JF._Code=JF.Name=JF.IDENTIFIER=JF._CodeOrName=void 0;class UA{}JF._CodeOrName=UA;JF.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class f1 extends UA{constructor(_){super();if(!JF.IDENTIFIER.test(_))throw Error("CodeGen: name must be a valid identifier");this.str=_}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}JF.Name=f1;class d9 extends UA{constructor(_){super();this._items=typeof _==="string"?[_]:_}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let _=this._items[0];return _===""||_==='""'}get str(){var _;return(_=this._str)!==null&&_!==void 0?_:this._str=this._items.reduce((z,A)=>`${z}${A}`,"")}get names(){var _;return(_=this._names)!==null&&_!==void 0?_:this._names=this._items.reduce((z,A)=>{if(A instanceof f1)z[A.str]=(z[A.str]||0)+1;return z},{})}}JF._Code=d9;JF.nil=new d9("");function bF(_,...z){let A=[_[0]],b=0;while(b<z.length)U7(A,z[b]),A.push(_[++b]);return new d9(A)}JF._=bF;var V7=new d9("+");function GF(_,...z){let A=[Y3(_[0])],b=0;while(b<z.length)A.push(V7),U7(A,z[b]),A.push(V7,Y3(_[++b]));return LT(A),new d9(A)}JF.str=GF;function U7(_,z){if(z instanceof d9)_.push(...z._items);else if(z instanceof f1)_.push(z);else _.push(PT(z))}JF.addCodeArg=U7;function LT(_){let z=1;while(z<_.length-1){if(_[z]===V7){let A=jT(_[z-1],_[z+1]);if(A!==void 0){_.splice(z-1,3,A);continue}_[z++]="+"}z++}}function jT(_,z){if(z==='""')return _;if(_==='""')return z;if(typeof _=="string"){if(z instanceof f1||_[_.length-1]!=='"')return;if(typeof z!="string")return`${_.slice(0,-1)}${z}"`;if(z[0]==='"')return _.slice(0,-1)+z.slice(1);return}if(typeof z=="string"&&z[0]==='"'&&!(_ instanceof f1))return`"${_}${z.slice(1)}`;return}function RT(_,z){return z.emptyStr()?_:_.emptyStr()?z:GF`${_}${z}`}JF.strConcat=RT;function PT(_){return typeof _=="number"||typeof _=="boolean"||_===null?_:Y3(Array.isArray(_)?_.join(","):_)}function ST(_){return new d9(Y3(_))}JF.stringify=ST;function Y3(_){return JSON.stringify(_).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}JF.safeStringify=Y3;function kT(_){return typeof _=="string"&&JF.IDENTIFIER.test(_)?new d9(`.${_}`):bF`[${_}]`}JF.getProperty=kT;function IT(_){if(typeof _=="string"&&JF.IDENTIFIER.test(_))return new d9(`${_}`);throw Error(`CodeGen: invalid export name: ${_}, use explicit $id name mapping`)}JF.getEsmExportName=IT;function xT(_){return new d9(_.toString())}JF.regexpCode=xT});var w7=I(($F)=>{Object.defineProperty($F,"__esModule",{value:!0});$F.ValueScope=$F.ValueScopeName=$F.Scope=$F.varKinds=$F.UsedValueState=void 0;var H9=X3();class XF extends Error{constructor(_){super(`CodeGen: "code" for ${_} not defined`);this.value=_.value}}var MA;(function(_){_[_.Started=0]="Started",_[_.Completed=1]="Completed"})(MA||($F.UsedValueState=MA={}));$F.varKinds={const:new H9.Name("const"),let:new H9.Name("let"),var:new H9.Name("var")};class M7{constructor({prefixes:_,parent:z}={}){this._names={},this._prefixes=_,this._parent=z}toName(_){return _ instanceof H9.Name?_:this.name(_)}name(_){return new H9.Name(this._newName(_))}_newName(_){let z=this._names[_]||this._nameGroup(_);return`${_}${z.index++}`}_nameGroup(_){var z,A;if(((A=(z=this._parent)===null||z===void 0?void 0:z._prefixes)===null||A===void 0?void 0:A.has(_))||this._prefixes&&!this._prefixes.has(_))throw Error(`CodeGen: prefix "${_}" is not allowed in this scope`);return this._names[_]={prefix:_,index:0}}}$F.Scope=M7;class N7 extends H9.Name{constructor(_,z){super(z);this.prefix=_}setValue(_,{property:z,itemIndex:A}){this.value=_,this.scopePath=H9._`.${new H9.Name(z)}[${A}]`}}$F.ValueScopeName=N7;var dT=H9._`\n`;class QF extends M7{constructor(_){super(_);this._values={},this._scope=_.scope,this.opts={..._,_n:_.lines?dT:H9.nil}}get(){return this._scope}name(_){return new N7(_,this._newName(_))}value(_,z){var A;if(z.ref===void 0)throw Error("CodeGen: ref must be passed in value");let b=this.toName(_),{prefix:G}=b,J=(A=z.key)!==null&&A!==void 0?A:z.ref,Y=this._values[G];if(Y){let $=Y.get(J);if($)return $}else Y=this._values[G]=new Map;Y.set(J,b);let X=this._scope[G]||(this._scope[G]=[]),Q=X.length;return X[Q]=z.ref,b.setValue(z,{property:G,itemIndex:Q}),b}getValue(_,z){let A=this._values[_];if(!A)return;return A.get(z)}scopeRefs(_,z=this._values){return this._reduceValues(z,(A)=>{if(A.scopePath===void 0)throw Error(`CodeGen: name "${A}" has no value`);return H9._`${_}${A.scopePath}`})}scopeCode(_=this._values,z,A){return this._reduceValues(_,(b)=>{if(b.value===void 0)throw Error(`CodeGen: name "${b}" has no value`);return b.value.code},z,A)}_reduceValues(_,z,A={},b){let G=H9.nil;for(let J in _){let Y=_[J];if(!Y)continue;let X=A[J]=A[J]||new Map;Y.forEach((Q)=>{if(X.has(Q))return;X.set(Q,MA.Started);let $=z(Q);if($){let H=this.opts.es5?$F.varKinds.var:$F.varKinds.const;G=H9._`${G}${H} ${Q} = ${$};${this.opts._n}`}else if($=b===null||b===void 0?void 0:b(Q))G=H9._`${G}${$}${this.opts._n}`;else throw new XF(Q);X.set(Q,MA.Completed)})}return G}}$F.ValueScope=QF});var t=I((B9)=>{Object.defineProperty(B9,"__esModule",{value:!0});B9.or=B9.and=B9.not=B9.CodeGen=B9.operators=B9.varKinds=B9.ValueScopeName=B9.ValueScope=B9.Scope=B9.Name=B9.regexpCode=B9.stringify=B9.getProperty=B9.nil=B9.strConcat=B9.str=B9._=void 0;var G0=X3(),r9=w7(),Y_=X3();Object.defineProperty(B9,"_",{enumerable:!0,get:function(){return Y_._}});Object.defineProperty(B9,"str",{enumerable:!0,get:function(){return Y_.str}});Object.defineProperty(B9,"strConcat",{enumerable:!0,get:function(){return Y_.strConcat}});Object.defineProperty(B9,"nil",{enumerable:!0,get:function(){return Y_.nil}});Object.defineProperty(B9,"getProperty",{enumerable:!0,get:function(){return Y_.getProperty}});Object.defineProperty(B9,"stringify",{enumerable:!0,get:function(){return Y_.stringify}});Object.defineProperty(B9,"regexpCode",{enumerable:!0,get:function(){return Y_.regexpCode}});Object.defineProperty(B9,"Name",{enumerable:!0,get:function(){return Y_.Name}});var jA=w7();Object.defineProperty(B9,"Scope",{enumerable:!0,get:function(){return jA.Scope}});Object.defineProperty(B9,"ValueScope",{enumerable:!0,get:function(){return jA.ValueScope}});Object.defineProperty(B9,"ValueScopeName",{enumerable:!0,get:function(){return jA.ValueScopeName}});Object.defineProperty(B9,"varKinds",{enumerable:!0,get:function(){return jA.varKinds}});B9.operators={GT:new G0._Code(">"),GTE:new G0._Code(">="),LT:new G0._Code("<"),LTE:new G0._Code("<="),EQ:new G0._Code("==="),NEQ:new G0._Code("!=="),NOT:new G0._Code("!"),OR:new G0._Code("||"),AND:new G0._Code("&&"),ADD:new G0._Code("+")};class X_{optimizeNodes(){return this}optimizeNames(_,z){return this}}class BF extends X_{constructor(_,z,A){super();this.varKind=_,this.name=z,this.rhs=A}render({es5:_,_n:z}){let A=_?r9.varKinds.var:this.varKind,b=this.rhs===void 0?"":` = ${this.rhs}`;return`${A} ${this.name}${b};`+z}optimizeNames(_,z){if(!_[this.name.str])return;if(this.rhs)this.rhs=m1(this.rhs,_,z);return this}get names(){return this.rhs instanceof G0._CodeOrName?this.rhs.names:{}}}class L7 extends X_{constructor(_,z,A){super();this.lhs=_,this.rhs=z,this.sideEffects=A}render({_n:_}){return`${this.lhs} = ${this.rhs};`+_}optimizeNames(_,z){if(this.lhs instanceof G0.Name&&!_[this.lhs.str]&&!this.sideEffects)return;return this.rhs=m1(this.rhs,_,z),this}get names(){let _=this.lhs instanceof G0.Name?{}:{...this.lhs.names};return LA(_,this.rhs)}}class ZF extends L7{constructor(_,z,A,b){super(_,A,b);this.op=z}render({_n:_}){return`${this.lhs} ${this.op}= ${this.rhs};`+_}}class FF extends X_{constructor(_){super();this.label=_,this.names={}}render({_n:_}){return`${this.label}:`+_}}class KF extends X_{constructor(_){super();this.label=_,this.names={}}render({_n:_}){return`break${this.label?` ${this.label}`:""};`+_}}class qF extends X_{constructor(_){super();this.error=_}render({_n:_}){return`throw ${this.error};`+_}get names(){return this.error.names}}class WF extends X_{constructor(_){super();this.code=_}render({_n:_}){return`${this.code};`+_}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(_,z){return this.code=m1(this.code,_,z),this}get names(){return this.code instanceof G0._CodeOrName?this.code.names:{}}}class RA extends X_{constructor(_=[]){super();this.nodes=_}render(_){return this.nodes.reduce((z,A)=>z+A.render(_),"")}optimizeNodes(){let{nodes:_}=this,z=_.length;while(z--){let A=_[z].optimizeNodes();if(Array.isArray(A))_.splice(z,1,...A);else if(A)_[z]=A;else _.splice(z,1)}return _.length>0?this:void 0}optimizeNames(_,z){let{nodes:A}=this,b=A.length;while(b--){let G=A[b];if(G.optimizeNames(_,z))continue;oT(_,G.names),A.splice(b,1)}return A.length>0?this:void 0}get names(){return this.nodes.reduce((_,z)=>C_(_,z.names),{})}}class Q_ extends RA{render(_){return"{"+_._n+super.render(_)+"}"+_._n}}class VF extends RA{}class Q3 extends Q_{}Q3.kind="else";class C4 extends Q_{constructor(_,z){super(z);this.condition=_}render(_){let z=`if(${this.condition})`+super.render(_);if(this.else)z+="else "+this.else.render(_);return z}optimizeNodes(){super.optimizeNodes();let _=this.condition;if(_===!0)return this.nodes;let z=this.else;if(z){let A=z.optimizeNodes();z=this.else=Array.isArray(A)?new Q3(A):A}if(z){if(_===!1)return z instanceof C4?z:z.nodes;if(this.nodes.length)return this;return new C4(wF(_),z instanceof C4?[z]:z.nodes)}if(_===!1||!this.nodes.length)return;return this}optimizeNames(_,z){var A;if(this.else=(A=this.else)===null||A===void 0?void 0:A.optimizeNames(_,z),!(super.optimizeNames(_,z)||this.else))return;return this.condition=m1(this.condition,_,z),this}get names(){let _=super.names;if(LA(_,this.condition),this.else)C_(_,this.else.names);return _}}C4.kind="if";class h1 extends Q_{}h1.kind="for";class UF extends h1{constructor(_){super();this.iteration=_}render(_){return`for(${this.iteration})`+super.render(_)}optimizeNames(_,z){if(!super.optimizeNames(_,z))return;return this.iteration=m1(this.iteration,_,z),this}get names(){return C_(super.names,this.iteration.names)}}class DF extends h1{constructor(_,z,A,b){super();this.varKind=_,this.name=z,this.from=A,this.to=b}render(_){let z=_.es5?r9.varKinds.var:this.varKind,{name:A,from:b,to:G}=this;return`for(${z} ${A}=${b}; ${A}<${G}; ${A}++)`+super.render(_)}get names(){let _=LA(super.names,this.from);return LA(_,this.to)}}class E7 extends h1{constructor(_,z,A,b){super();this.loop=_,this.varKind=z,this.name=A,this.iterable=b}render(_){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(_)}optimizeNames(_,z){if(!super.optimizeNames(_,z))return;return this.iterable=m1(this.iterable,_,z),this}get names(){return C_(super.names,this.iterable.names)}}class NA extends Q_{constructor(_,z,A){super();this.name=_,this.args=z,this.async=A}render(_){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(_)}}NA.kind="func";class wA extends RA{render(_){return"return "+super.render(_)}}wA.kind="return";class MF extends Q_{render(_){let z="try"+super.render(_);if(this.catch)z+=this.catch.render(_);if(this.finally)z+=this.finally.render(_);return z}optimizeNodes(){var _,z;return super.optimizeNodes(),(_=this.catch)===null||_===void 0||_.optimizeNodes(),(z=this.finally)===null||z===void 0||z.optimizeNodes(),this}optimizeNames(_,z){var A,b;return super.optimizeNames(_,z),(A=this.catch)===null||A===void 0||A.optimizeNames(_,z),(b=this.finally)===null||b===void 0||b.optimizeNames(_,z),this}get names(){let _=super.names;if(this.catch)C_(_,this.catch.names);if(this.finally)C_(_,this.finally.names);return _}}class EA extends Q_{constructor(_){super();this.error=_}render(_){return`catch(${this.error})`+super.render(_)}}EA.kind="catch";class OA extends Q_{render(_){return"finally"+super.render(_)}}OA.kind="finally";class NF{constructor(_,z={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...z,_n:z.lines?`
28
+ `:""},this._extScope=_,this._scope=new r9.Scope({parent:_}),this._nodes=[new VF]}toString(){return this._root.render(this.opts)}name(_){return this._scope.name(_)}scopeName(_){return this._extScope.name(_)}scopeValue(_,z){let A=this._extScope.value(_,z);return(this._values[A.prefix]||(this._values[A.prefix]=new Set)).add(A),A}getScopeValue(_,z){return this._extScope.getValue(_,z)}scopeRefs(_){return this._extScope.scopeRefs(_,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(_,z,A,b){let G=this._scope.toName(z);if(A!==void 0&&b)this._constants[G.str]=A;return this._leafNode(new BF(_,G,A)),G}const(_,z,A){return this._def(r9.varKinds.const,_,z,A)}let(_,z,A){return this._def(r9.varKinds.let,_,z,A)}var(_,z,A){return this._def(r9.varKinds.var,_,z,A)}assign(_,z,A){return this._leafNode(new L7(_,z,A))}add(_,z){return this._leafNode(new ZF(_,B9.operators.ADD,z))}code(_){if(typeof _=="function")_();else if(_!==G0.nil)this._leafNode(new WF(_));return this}object(..._){let z=["{"];for(let[A,b]of _){if(z.length>1)z.push(",");if(z.push(A),A!==b||this.opts.es5)z.push(":"),(0,G0.addCodeArg)(z,b)}return z.push("}"),new G0._Code(z)}if(_,z,A){if(this._blockNode(new C4(_)),z&&A)this.code(z).else().code(A).endIf();else if(z)this.code(z).endIf();else if(A)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(_){return this._elseNode(new C4(_))}else(){return this._elseNode(new Q3)}endIf(){return this._endBlockNode(C4,Q3)}_for(_,z){if(this._blockNode(_),z)this.code(z).endFor();return this}for(_,z){return this._for(new UF(_),z)}forRange(_,z,A,b,G=this.opts.es5?r9.varKinds.var:r9.varKinds.let){let J=this._scope.toName(_);return this._for(new DF(G,J,z,A),()=>b(J))}forOf(_,z,A,b=r9.varKinds.const){let G=this._scope.toName(_);if(this.opts.es5){let J=z instanceof G0.Name?z:this.var("_arr",z);return this.forRange("_i",0,G0._`${J}.length`,(Y)=>{this.var(G,G0._`${J}[${Y}]`),A(G)})}return this._for(new E7("of",b,G,z),()=>A(G))}forIn(_,z,A,b=this.opts.es5?r9.varKinds.var:r9.varKinds.const){if(this.opts.ownProperties)return this.forOf(_,G0._`Object.keys(${z})`,A);let G=this._scope.toName(_);return this._for(new E7("in",b,G,z),()=>A(G))}endFor(){return this._endBlockNode(h1)}label(_){return this._leafNode(new FF(_))}break(_){return this._leafNode(new KF(_))}return(_){let z=new wA;if(this._blockNode(z),this.code(_),z.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(wA)}try(_,z,A){if(!z&&!A)throw Error('CodeGen: "try" without "catch" and "finally"');let b=new MF;if(this._blockNode(b),this.code(_),z){let G=this.name("e");this._currNode=b.catch=new EA(G),z(G)}if(A)this._currNode=b.finally=new OA,this.code(A);return this._endBlockNode(EA,OA)}throw(_){return this._leafNode(new qF(_))}block(_,z){if(this._blockStarts.push(this._nodes.length),_)this.code(_).endBlock(z);return this}endBlock(_){let z=this._blockStarts.pop();if(z===void 0)throw Error("CodeGen: not in self-balancing block");let A=this._nodes.length-z;if(A<0||_!==void 0&&A!==_)throw Error(`CodeGen: wrong number of nodes: ${A} vs ${_} expected`);return this._nodes.length=z,this}func(_,z=G0.nil,A,b){if(this._blockNode(new NA(_,z,A)),b)this.code(b).endFunc();return this}endFunc(){return this._endBlockNode(NA)}optimize(_=1){while(_-- >0)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(_){return this._currNode.nodes.push(_),this}_blockNode(_){this._currNode.nodes.push(_),this._nodes.push(_)}_endBlockNode(_,z){let A=this._currNode;if(A instanceof _||z&&A instanceof z)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${z?`${_.kind}/${z.kind}`:_.kind}"`)}_elseNode(_){let z=this._currNode;if(!(z instanceof C4))throw Error('CodeGen: "else" without "if"');return this._currNode=z.else=_,this}get _root(){return this._nodes[0]}get _currNode(){let _=this._nodes;return _[_.length-1]}set _currNode(_){let z=this._nodes;z[z.length-1]=_}}B9.CodeGen=NF;function C_(_,z){for(let A in z)_[A]=(_[A]||0)+(z[A]||0);return _}function LA(_,z){return z instanceof G0._CodeOrName?C_(_,z.names):_}function m1(_,z,A){if(_ instanceof G0.Name)return b(_);if(!G(_))return _;return new G0._Code(_._items.reduce((J,Y)=>{if(Y instanceof G0.Name)Y=b(Y);if(Y instanceof G0._Code)J.push(...Y._items);else J.push(Y);return J},[]));function b(J){let Y=A[J.str];if(Y===void 0||z[J.str]!==1)return J;return delete z[J.str],Y}function G(J){return J instanceof G0._Code&&J._items.some((Y)=>Y instanceof G0.Name&&z[Y.str]===1&&A[Y.str]!==void 0)}}function oT(_,z){for(let A in z)_[A]=(_[A]||0)-(z[A]||0)}function wF(_){return typeof _=="boolean"||typeof _=="number"||_===null?!_:G0._`!${O7(_)}`}B9.not=wF;var aT=EF(B9.operators.AND);function sT(..._){return _.reduce(aT)}B9.and=sT;var tT=EF(B9.operators.OR);function eT(..._){return _.reduce(tT)}B9.or=eT;function EF(_){return(z,A)=>z===G0.nil?A:A===G0.nil?z:G0._`${O7(z)} ${_} ${O7(A)}`}function O7(_){return _ instanceof G0.Name?_:G0._`(${_})`}});var Q0=I((xF)=>{Object.defineProperty(xF,"__esModule",{value:!0});xF.checkStrictMode=xF.getErrorPath=xF.Type=xF.useFunc=xF.setEvaluated=xF.evaluatedPropsToName=xF.mergeEvaluated=xF.eachItem=xF.unescapeJsonPointer=xF.escapeJsonPointer=xF.escapeFragment=xF.unescapeFragment=xF.schemaRefOrVal=xF.schemaHasRulesButRef=xF.schemaHasRules=xF.checkUnknownRules=xF.alwaysValidSchema=xF.toHash=void 0;var V0=t(),bC=X3();function GC(_){let z={};for(let A of _)z[A]=!0;return z}xF.toHash=GC;function JC(_,z){if(typeof z=="boolean")return z;if(Object.keys(z).length===0)return!0;return RF(_,z),!PF(z,_.self.RULES.all)}xF.alwaysValidSchema=JC;function RF(_,z=_.schema){let{opts:A,self:b}=_;if(!A.strictSchema)return;if(typeof z==="boolean")return;let G=b.RULES.keywords;for(let J in z)if(!G[J])IF(_,`unknown keyword: "${J}"`)}xF.checkUnknownRules=RF;function PF(_,z){if(typeof _=="boolean")return!_;for(let A in _)if(z[A])return!0;return!1}xF.schemaHasRules=PF;function YC(_,z){if(typeof _=="boolean")return!_;for(let A in _)if(A!=="$ref"&&z.all[A])return!0;return!1}xF.schemaHasRulesButRef=YC;function XC({topSchemaRef:_,schemaPath:z},A,b,G){if(!G){if(typeof A=="number"||typeof A=="boolean")return A;if(typeof A=="string")return V0._`${A}`}return V0._`${_}${z}${(0,V0.getProperty)(b)}`}xF.schemaRefOrVal=XC;function QC(_){return SF(decodeURIComponent(_))}xF.unescapeFragment=QC;function $C(_){return encodeURIComponent(R7(_))}xF.escapeFragment=$C;function R7(_){if(typeof _=="number")return`${_}`;return _.replace(/~/g,"~0").replace(/\//g,"~1")}xF.escapeJsonPointer=R7;function SF(_){return _.replace(/~1/g,"/").replace(/~0/g,"~")}xF.unescapeJsonPointer=SF;function HC(_,z){if(Array.isArray(_))for(let A of _)z(A);else z(_)}xF.eachItem=HC;function LF({mergeNames:_,mergeToName:z,mergeValues:A,resultToName:b}){return(G,J,Y,X)=>{let Q=Y===void 0?J:Y instanceof V0.Name?(J instanceof V0.Name?_(G,J,Y):z(G,J,Y),Y):J instanceof V0.Name?(z(G,Y,J),J):A(J,Y);return X===V0.Name&&!(Q instanceof V0.Name)?b(G,Q):Q}}xF.mergeEvaluated={props:LF({mergeNames:(_,z,A)=>_.if(V0._`${A} !== true && ${z} !== undefined`,()=>{_.if(V0._`${z} === true`,()=>_.assign(A,!0),()=>_.assign(A,V0._`${A} || {}`).code(V0._`Object.assign(${A}, ${z})`))}),mergeToName:(_,z,A)=>_.if(V0._`${A} !== true`,()=>{if(z===!0)_.assign(A,!0);else _.assign(A,V0._`${A} || {}`),P7(_,A,z)}),mergeValues:(_,z)=>_===!0?!0:{..._,...z},resultToName:kF}),items:LF({mergeNames:(_,z,A)=>_.if(V0._`${A} !== true && ${z} !== undefined`,()=>_.assign(A,V0._`${z} === true ? true : ${A} > ${z} ? ${A} : ${z}`)),mergeToName:(_,z,A)=>_.if(V0._`${A} !== true`,()=>_.assign(A,z===!0?!0:V0._`${A} > ${z} ? ${A} : ${z}`)),mergeValues:(_,z)=>_===!0?!0:Math.max(_,z),resultToName:(_,z)=>_.var("items",z)})};function kF(_,z){if(z===!0)return _.var("props",!0);let A=_.var("props",V0._`{}`);if(z!==void 0)P7(_,A,z);return A}xF.evaluatedPropsToName=kF;function P7(_,z,A){Object.keys(A).forEach((b)=>_.assign(V0._`${z}${(0,V0.getProperty)(b)}`,!0))}xF.setEvaluated=P7;var jF={};function BC(_,z){return _.scopeValue("func",{ref:z,code:jF[z.code]||(jF[z.code]=new bC._Code(z.code))})}xF.useFunc=BC;var j7;(function(_){_[_.Num=0]="Num",_[_.Str=1]="Str"})(j7||(xF.Type=j7={}));function ZC(_,z,A){if(_ instanceof V0.Name){let b=z===j7.Num;return A?b?V0._`"[" + ${_} + "]"`:V0._`"['" + ${_} + "']"`:b?V0._`"/" + ${_}`:V0._`"/" + ${_}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return A?(0,V0.getProperty)(_).toString():"/"+R7(_)}xF.getErrorPath=ZC;function IF(_,z,A=_.opts.strictSchema){if(!A)return;if(z=`strict mode: ${z}`,A===!0)throw Error(z);_.self.logger.warn(z)}xF.checkStrictMode=IF});var v4=I((CF)=>{Object.defineProperty(CF,"__esModule",{value:!0});var i0=t(),kC={data:new i0.Name("data"),valCxt:new i0.Name("valCxt"),instancePath:new i0.Name("instancePath"),parentData:new i0.Name("parentData"),parentDataProperty:new i0.Name("parentDataProperty"),rootData:new i0.Name("rootData"),dynamicAnchors:new i0.Name("dynamicAnchors"),vErrors:new i0.Name("vErrors"),errors:new i0.Name("errors"),this:new i0.Name("this"),self:new i0.Name("self"),scope:new i0.Name("scope"),json:new i0.Name("json"),jsonPos:new i0.Name("jsonPos"),jsonLen:new i0.Name("jsonLen"),jsonPart:new i0.Name("jsonPart")};CF.default=kC});var $3=I((fF)=>{Object.defineProperty(fF,"__esModule",{value:!0});fF.extendErrors=fF.resetErrorsCount=fF.reportExtraError=fF.reportError=fF.keyword$DataError=fF.keywordError=void 0;var J0=t(),SA=Q0(),b9=v4();fF.keywordError={message:({keyword:_})=>J0.str`must pass "${_}" keyword validation`};fF.keyword$DataError={message:({keyword:_,schemaType:z})=>z?J0.str`"${_}" keyword must be ${z} ($data)`:J0.str`"${_}" keyword is invalid ($data)`};function xC(_,z=fF.keywordError,A,b){let{it:G}=_,{gen:J,compositeRule:Y,allErrors:X}=G,Q=gF(_,z,A);if(b!==null&&b!==void 0?b:Y||X)vF(J,Q);else yF(G,J0._`[${Q}]`)}fF.reportError=xC;function TC(_,z=fF.keywordError,A){let{it:b}=_,{gen:G,compositeRule:J,allErrors:Y}=b,X=gF(_,z,A);if(vF(G,X),!(J||Y))yF(b,b9.default.vErrors)}fF.reportExtraError=TC;function CC(_,z){_.assign(b9.default.errors,z),_.if(J0._`${b9.default.vErrors} !== null`,()=>_.if(z,()=>_.assign(J0._`${b9.default.vErrors}.length`,z),()=>_.assign(b9.default.vErrors,null)))}fF.resetErrorsCount=CC;function vC({gen:_,keyword:z,schemaValue:A,data:b,errsCount:G,it:J}){if(G===void 0)throw Error("ajv implementation error");let Y=_.name("err");_.forRange("i",G,b9.default.errors,(X)=>{if(_.const(Y,J0._`${b9.default.vErrors}[${X}]`),_.if(J0._`${Y}.instancePath === undefined`,()=>_.assign(J0._`${Y}.instancePath`,(0,J0.strConcat)(b9.default.instancePath,J.errorPath))),_.assign(J0._`${Y}.schemaPath`,J0.str`${J.errSchemaPath}/${z}`),J.opts.verbose)_.assign(J0._`${Y}.schema`,A),_.assign(J0._`${Y}.data`,b)})}fF.extendErrors=vC;function vF(_,z){let A=_.const("err",z);_.if(J0._`${b9.default.vErrors} === null`,()=>_.assign(b9.default.vErrors,J0._`[${A}]`),J0._`${b9.default.vErrors}.push(${A})`),_.code(J0._`${b9.default.errors}++`)}function yF(_,z){let{gen:A,validateName:b,schemaEnv:G}=_;if(G.$async)A.throw(J0._`new ${_.ValidationError}(${z})`);else A.assign(J0._`${b}.errors`,z),A.return(!1)}var v_={keyword:new J0.Name("keyword"),schemaPath:new J0.Name("schemaPath"),params:new J0.Name("params"),propertyName:new J0.Name("propertyName"),message:new J0.Name("message"),schema:new J0.Name("schema"),parentSchema:new J0.Name("parentSchema")};function gF(_,z,A){let{createErrors:b}=_.it;if(b===!1)return J0._`{}`;return yC(_,z,A)}function yC(_,z,A={}){let{gen:b,it:G}=_,J=[gC(G,A),fC(_,A)];return hC(_,z,J),b.object(...J)}function gC({errorPath:_},{instancePath:z}){let A=z?J0.str`${_}${(0,SA.getErrorPath)(z,SA.Type.Str)}`:_;return[b9.default.instancePath,(0,J0.strConcat)(b9.default.instancePath,A)]}function fC({keyword:_,it:{errSchemaPath:z}},{schemaPath:A,parentSchema:b}){let G=b?z:J0.str`${z}/${_}`;if(A)G=J0.str`${G}${(0,SA.getErrorPath)(A,SA.Type.Str)}`;return[v_.schemaPath,G]}function hC(_,{params:z,message:A},b){let{keyword:G,data:J,schemaValue:Y,it:X}=_,{opts:Q,propertyName:$,topSchemaRef:H,schemaPath:B}=X;if(b.push([v_.keyword,G],[v_.params,typeof z=="function"?z(_):z||J0._`{}`]),Q.messages)b.push([v_.message,typeof A=="function"?A(_):A]);if(Q.verbose)b.push([v_.schema,Y],[v_.parentSchema,J0._`${H}${B}`],[b9.default.data,J]);if($)b.push([v_.propertyName,$])}});var lF=I((uF)=>{Object.defineProperty(uF,"__esModule",{value:!0});uF.boolOrEmptySchema=uF.topBoolOrEmptySchema=void 0;var pC=$3(),dC=t(),rC=v4(),nC={message:"boolean schema is false"};function iC(_){let{gen:z,schema:A,validateName:b}=_;if(A===!1)mF(_,!1);else if(typeof A=="object"&&A.$async===!0)z.return(rC.default.data);else z.assign(dC._`${b}.errors`,null),z.return(!0)}uF.topBoolOrEmptySchema=iC;function oC(_,z){let{gen:A,schema:b}=_;if(b===!1)A.var(z,!1),mF(_);else A.var(z,!0)}uF.boolOrEmptySchema=oC;function mF(_,z){let{gen:A,data:b}=_,G={gen:A,keyword:"false schema",data:b,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:_};(0,pC.reportError)(G,nC,void 0,z)}});var k7=I((pF)=>{Object.defineProperty(pF,"__esModule",{value:!0});pF.getRules=pF.isJSONType=void 0;var sC=["string","number","integer","boolean","null","object","array"],tC=new Set(sC);function eC(_){return typeof _=="string"&&tC.has(_)}pF.isJSONType=eC;function _v(){let _={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{..._,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},_.number,_.string,_.array,_.object],post:{rules:[]},all:{},keywords:{}}}pF.getRules=_v});var I7=I((iF)=>{Object.defineProperty(iF,"__esModule",{value:!0});iF.shouldUseRule=iF.shouldUseGroup=iF.schemaHasRulesForType=void 0;function Av({schema:_,self:z},A){let b=z.RULES.types[A];return b&&b!==!0&&rF(_,b)}iF.schemaHasRulesForType=Av;function rF(_,z){return z.rules.some((A)=>nF(_,A))}iF.shouldUseGroup=rF;function nF(_,z){var A;return _[z.keyword]!==void 0||((A=z.definition.implements)===null||A===void 0?void 0:A.some((b)=>_[b]!==void 0))}iF.shouldUseRule=nF});var H3=I((eF)=>{Object.defineProperty(eF,"__esModule",{value:!0});eF.reportTypeError=eF.checkDataTypes=eF.checkDataType=eF.coerceAndCheckDataType=eF.getJSONTypes=eF.getSchemaTypes=eF.DataType=void 0;var Jv=k7(),Yv=I7(),Xv=$3(),a=t(),aF=Q0(),u1;(function(_){_[_.Correct=0]="Correct",_[_.Wrong=1]="Wrong"})(u1||(eF.DataType=u1={}));function Qv(_){let z=sF(_.type);if(z.includes("null")){if(_.nullable===!1)throw Error("type: null contradicts nullable: false")}else{if(!z.length&&_.nullable!==void 0)throw Error('"nullable" cannot be used without "type"');if(_.nullable===!0)z.push("null")}return z}eF.getSchemaTypes=Qv;function sF(_){let z=Array.isArray(_)?_:_?[_]:[];if(z.every(Jv.isJSONType))return z;throw Error("type must be JSONType or JSONType[]: "+z.join(","))}eF.getJSONTypes=sF;function $v(_,z){let{gen:A,data:b,opts:G}=_,J=Hv(z,G.coerceTypes),Y=z.length>0&&!(J.length===0&&z.length===1&&(0,Yv.schemaHasRulesForType)(_,z[0]));if(Y){let X=T7(z,b,G.strictNumbers,u1.Wrong);A.if(X,()=>{if(J.length)Bv(_,z,J);else C7(_)})}return Y}eF.coerceAndCheckDataType=$v;var tF=new Set(["string","number","integer","boolean","null"]);function Hv(_,z){return z?_.filter((A)=>tF.has(A)||z==="array"&&A==="array"):[]}function Bv(_,z,A){let{gen:b,data:G,opts:J}=_,Y=b.let("dataType",a._`typeof ${G}`),X=b.let("coerced",a._`undefined`);if(J.coerceTypes==="array")b.if(a._`${Y} == 'object' && Array.isArray(${G}) && ${G}.length == 1`,()=>b.assign(G,a._`${G}[0]`).assign(Y,a._`typeof ${G}`).if(T7(z,G,J.strictNumbers),()=>b.assign(X,G)));b.if(a._`${X} !== undefined`);for(let $ of A)if(tF.has($)||$==="array"&&J.coerceTypes==="array")Q($);b.else(),C7(_),b.endIf(),b.if(a._`${X} !== undefined`,()=>{b.assign(G,X),Zv(_,X)});function Q($){switch($){case"string":b.elseIf(a._`${Y} == "number" || ${Y} == "boolean"`).assign(X,a._`"" + ${G}`).elseIf(a._`${G} === null`).assign(X,a._`""`);return;case"number":b.elseIf(a._`${Y} == "boolean" || ${G} === null
29
29
  || (${Y} == "string" && ${G} && ${G} == +${G})`).assign(X,a._`+${G}`);return;case"integer":b.elseIf(a._`${Y} === "boolean" || ${G} === null
30
30
  || (${Y} === "string" && ${G} && ${G} == +${G} && !(${G} % 1))`).assign(X,a._`+${G}`);return;case"boolean":b.elseIf(a._`${G} === "false" || ${G} === 0 || ${G} === null`).assign(X,!1).elseIf(a._`${G} === "true" || ${G} === 1`).assign(X,!0);return;case"null":b.elseIf(a._`${G} === "" || ${G} === 0 || ${G} === false`),b.assign(X,null);return;case"array":b.elseIf(a._`${Y} === "string" || ${Y} === "number"
31
- || ${Y} === "boolean" || ${G} === null`).assign(X,a._`[${G}]`)}}}function bv({gen:_,parentData:z,parentDataProperty:A},b){_.if(a._`${z} !== undefined`,()=>_.assign(a._`${z}[${A}]`,b))}function k7(_,z,A,b=h1.Correct){let G=b===h1.Correct?a.operators.EQ:a.operators.NEQ,J;switch(_){case"null":return a._`${z} ${G} null`;case"array":J=a._`Array.isArray(${z})`;break;case"object":J=a._`${z} && typeof ${z} == "object" && !Array.isArray(${z})`;break;case"integer":J=Y(a._`!(${z} % 1) && !isNaN(${z})`);break;case"number":J=Y();break;default:return a._`typeof ${z} ${G} ${_}`}return b===h1.Correct?J:(0,a.not)(J);function Y(X=a.nil){return(0,a.and)(a._`typeof ${z} == "number"`,X,A?a._`isFinite(${z})`:a.nil)}}sF.checkDataType=k7;function I7(_,z,A,b){if(_.length===1)return k7(_[0],z,A,b);let G,J=(0,iF.toHash)(_);if(J.array&&J.object){let Y=a._`typeof ${z} != "object"`;G=J.null?Y:a._`!${z} || ${Y}`,delete J.null,delete J.array,delete J.object}else G=a.nil;if(J.number)delete J.integer;for(let Y in J)G=(0,a.and)(G,k7(Y,z,A,b));return G}sF.checkDataTypes=I7;var Gv={message:({schema:_})=>`must be ${_}`,params:({schema:_,schemaValue:z})=>typeof _=="string"?a._`{type: ${_}}`:a._`{type: ${z}}`};function x7(_){let z=Jv(_);(0,tC.reportError)(z,Gv)}sF.reportTypeError=x7;function Jv(_){let{gen:z,data:A,schema:b}=_,G=(0,iF.schemaRefOrVal)(_,b,"type");return{gen:z,keyword:"type",data:A,schema:b.type,schemaCode:G,schemaValue:G,parentSchema:b,params:{},it:_}}});var AK=I((_K)=>{Object.defineProperty(_K,"__esModule",{value:!0});_K.assignDefaults=void 0;var m1=t(),Zv=Q0();function Fv(_,z){let{properties:A,items:b}=_.schema;if(z==="object"&&A)for(let G in A)eF(_,G,A[G].default);else if(z==="array"&&Array.isArray(b))b.forEach((G,J)=>eF(_,J,G.default))}_K.assignDefaults=Fv;function eF(_,z,A){let{gen:b,compositeRule:G,data:J,opts:Y}=_;if(A===void 0)return;let X=m1._`${J}${(0,m1.getProperty)(z)}`;if(G){(0,Zv.checkStrictMode)(_,`default is ignored for: ${X}`);return}let Q=m1._`${X} === undefined`;if(Y.useDefaults==="empty")Q=m1._`${Q} || ${X} === null || ${X} === ""`;b.if(Q,m1._`${X} = ${(0,m1.stringify)(A)}`)}});var R9=I((JK)=>{Object.defineProperty(JK,"__esModule",{value:!0});JK.validateUnion=JK.validateArray=JK.usePattern=JK.callValidateCode=JK.schemaProperties=JK.allSchemaProperties=JK.noPropertyInData=JK.propertyInData=JK.isOwnProperty=JK.hasPropFunc=JK.reportMissingProp=JK.checkMissingProp=JK.checkReportMissingProp=void 0;var w0=t(),T7=Q0(),$_=v4(),Kv=Q0();function qv(_,z){let{gen:A,data:b,it:G}=_;A.if(v7(A,b,z,G.opts.ownProperties),()=>{_.setParams({missingProperty:w0._`${z}`},!0),_.error()})}JK.checkReportMissingProp=qv;function Wv({gen:_,data:z,it:{opts:A}},b,G){return(0,w0.or)(...b.map((J)=>(0,w0.and)(v7(_,z,J,A.ownProperties),w0._`${G} = ${J}`)))}JK.checkMissingProp=Wv;function Vv(_,z){_.setParams({missingProperty:z},!0),_.error()}JK.reportMissingProp=Vv;function bK(_){return _.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:w0._`Object.prototype.hasOwnProperty`})}JK.hasPropFunc=bK;function C7(_,z,A){return w0._`${bK(_)}.call(${z}, ${A})`}JK.isOwnProperty=C7;function Uv(_,z,A,b){let G=w0._`${z}${(0,w0.getProperty)(A)} !== undefined`;return b?w0._`${G} && ${C7(_,z,A)}`:G}JK.propertyInData=Uv;function v7(_,z,A,b){let G=w0._`${z}${(0,w0.getProperty)(A)} === undefined`;return b?(0,w0.or)(G,(0,w0.not)(C7(_,z,A))):G}JK.noPropertyInData=v7;function GK(_){return _?Object.keys(_).filter((z)=>z!=="__proto__"):[]}JK.allSchemaProperties=GK;function Dv(_,z){return GK(z).filter((A)=>!(0,T7.alwaysValidSchema)(_,z[A]))}JK.schemaProperties=Dv;function Mv({schemaCode:_,data:z,it:{gen:A,topSchemaRef:b,schemaPath:G,errorPath:J},it:Y},X,Q,$){let H=$?w0._`${_}, ${z}, ${b}${G}`:z,B=[[$_.default.instancePath,(0,w0.strConcat)($_.default.instancePath,J)],[$_.default.parentData,Y.parentData],[$_.default.parentDataProperty,Y.parentDataProperty],[$_.default.rootData,$_.default.rootData]];if(Y.opts.dynamicRef)B.push([$_.default.dynamicAnchors,$_.default.dynamicAnchors]);let Z=w0._`${H}, ${A.object(...B)}`;return Q!==w0.nil?w0._`${X}.call(${Q}, ${Z})`:w0._`${X}(${Z})`}JK.callValidateCode=Mv;var Nv=w0._`new RegExp`;function wv({gen:_,it:{opts:z}},A){let b=z.unicodeRegExp?"u":"",{regExp:G}=z.code,J=G(A,b);return _.scopeValue("pattern",{key:J.toString(),ref:J,code:w0._`${G.code==="new RegExp"?Nv:(0,Kv.useFunc)(_,G)}(${A}, ${b})`})}JK.usePattern=wv;function Ev(_){let{gen:z,data:A,keyword:b,it:G}=_,J=z.name("valid");if(G.allErrors){let X=z.let("valid",!0);return Y(()=>z.assign(X,!1)),X}return z.var(J,!0),Y(()=>z.break()),J;function Y(X){let Q=z.const("len",w0._`${A}.length`);z.forRange("i",0,Q,($)=>{_.subschema({keyword:b,dataProp:$,dataPropType:T7.Type.Num},J),z.if((0,w0.not)(J),X)})}}JK.validateArray=Ev;function Ov(_){let{gen:z,schema:A,keyword:b,it:G}=_;if(!Array.isArray(A))throw Error("ajv implementation error");if(A.some((Q)=>(0,T7.alwaysValidSchema)(G,Q))&&!G.opts.unevaluated)return;let Y=z.let("valid",!1),X=z.name("_valid");z.block(()=>A.forEach((Q,$)=>{let H=_.subschema({keyword:b,schemaProp:$,compositeRule:!0},X);if(z.assign(Y,w0._`${Y} || ${X}`),!_.mergeValidEvaluated(H,X))z.if((0,w0.not)(Y))})),_.result(Y,()=>_.reset(),()=>_.error(!0))}JK.validateUnion=Ov});var BK=I(($K)=>{Object.defineProperty($K,"__esModule",{value:!0});$K.validateKeywordUsage=$K.validSchemaType=$K.funcKeywordCode=$K.macroKeywordCode=void 0;var G9=t(),v_=v4(),gv=R9(),fv=X3();function hv(_,z){let{gen:A,keyword:b,schema:G,parentSchema:J,it:Y}=_,X=z.macro.call(Y.self,G,J,Y),Q=QK(A,b,X);if(Y.opts.validateSchema!==!1)Y.self.validateSchema(X,!0);let $=A.name("valid");_.subschema({schema:X,schemaPath:G9.nil,errSchemaPath:`${Y.errSchemaPath}/${b}`,topSchemaRef:Q,compositeRule:!0},$),_.pass($,()=>_.error(!0))}$K.macroKeywordCode=hv;function mv(_,z){var A;let{gen:b,keyword:G,schema:J,parentSchema:Y,$data:X,it:Q}=_;cv(Q,z);let $=!X&&z.compile?z.compile.call(Q.self,J,Y,Q):z.validate,H=QK(b,G,$),B=b.let("valid");_.block$data(B,Z),_.ok((A=z.valid)!==null&&A!==void 0?A:B);function Z(){if(z.errors===!1){if(q(),z.modifying)XK(_);W(()=>_.error())}else{let V=z.async?F():K();if(z.modifying)XK(_);W(()=>uv(_,V))}}function F(){let V=b.let("ruleErrs",null);return b.try(()=>q(G9._`await `),(w)=>b.assign(B,!1).if(G9._`${w} instanceof ${Q.ValidationError}`,()=>b.assign(V,G9._`${w}.errors`),()=>b.throw(w))),V}function K(){let V=G9._`${H}.errors`;return b.assign(V,null),q(G9.nil),V}function q(V=z.async?G9._`await `:G9.nil){let w=Q.opts.passContext?v_.default.this:v_.default.self,O=!(("compile"in z)&&!X||z.schema===!1);b.assign(B,G9._`${V}${(0,gv.callValidateCode)(_,H,w,O)}`,z.modifying)}function W(V){var w;b.if((0,G9.not)((w=z.valid)!==null&&w!==void 0?w:B),V)}}$K.funcKeywordCode=mv;function XK(_){let{gen:z,data:A,it:b}=_;z.if(b.parentData,()=>z.assign(A,G9._`${b.parentData}[${b.parentDataProperty}]`))}function uv(_,z){let{gen:A}=_;A.if(G9._`Array.isArray(${z})`,()=>{A.assign(v_.default.vErrors,G9._`${v_.default.vErrors} === null ? ${z} : ${v_.default.vErrors}.concat(${z})`).assign(v_.default.errors,G9._`${v_.default.vErrors}.length`),(0,fv.extendErrors)(_)},()=>_.error())}function cv({schemaEnv:_},z){if(z.async&&!_.$async)throw Error("async keyword in sync schema")}function QK(_,z,A){if(A===void 0)throw Error(`keyword "${z}" failed to compile`);return _.scopeValue("keyword",typeof A=="function"?{ref:A}:{ref:A,code:(0,G9.stringify)(A)})}function lv(_,z,A=!1){return!z.length||z.some((b)=>b==="array"?Array.isArray(_):b==="object"?_&&typeof _=="object"&&!Array.isArray(_):typeof _==b||A&&typeof _>"u")}$K.validSchemaType=lv;function pv({schema:_,opts:z,self:A,errSchemaPath:b},G,J){if(Array.isArray(G.keyword)?!G.keyword.includes(J):G.keyword!==J)throw Error("ajv implementation error");let Y=G.dependencies;if(Y===null||Y===void 0?void 0:Y.some((X)=>!Object.prototype.hasOwnProperty.call(_,X)))throw Error(`parent schema must have dependencies of ${J}: ${Y.join(",")}`);if(G.validateSchema){if(!G.validateSchema(_[J])){let Q=`keyword "${J}" value is invalid at path "${b}": `+A.errorsText(G.validateSchema.errors);if(z.validateSchema==="log")A.logger.error(Q);else throw Error(Q)}}}$K.validateKeywordUsage=pv});var qK=I((FK)=>{Object.defineProperty(FK,"__esModule",{value:!0});FK.extendSubschemaMode=FK.extendSubschemaData=FK.getSubschema=void 0;var Z4=t(),ZK=Q0();function iv(_,{keyword:z,schemaProp:A,schema:b,schemaPath:G,errSchemaPath:J,topSchemaRef:Y}){if(z!==void 0&&b!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(z!==void 0){let X=_.schema[z];return A===void 0?{schema:X,schemaPath:Z4._`${_.schemaPath}${(0,Z4.getProperty)(z)}`,errSchemaPath:`${_.errSchemaPath}/${z}`}:{schema:X[A],schemaPath:Z4._`${_.schemaPath}${(0,Z4.getProperty)(z)}${(0,Z4.getProperty)(A)}`,errSchemaPath:`${_.errSchemaPath}/${z}/${(0,ZK.escapeFragment)(A)}`}}if(b!==void 0){if(G===void 0||J===void 0||Y===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:b,schemaPath:G,topSchemaRef:Y,errSchemaPath:J}}throw Error('either "keyword" or "schema" must be passed')}FK.getSubschema=iv;function ov(_,z,{dataProp:A,dataPropType:b,data:G,dataTypes:J,propertyName:Y}){if(G!==void 0&&A!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:X}=z;if(A!==void 0){let{errorPath:$,dataPathArr:H,opts:B}=z,Z=X.let("data",Z4._`${z.data}${(0,Z4.getProperty)(A)}`,!0);Q(Z),_.errorPath=Z4.str`${$}${(0,ZK.getErrorPath)(A,b,B.jsPropertySyntax)}`,_.parentDataProperty=Z4._`${A}`,_.dataPathArr=[...H,_.parentDataProperty]}if(G!==void 0){let $=G instanceof Z4.Name?G:X.let("data",G,!0);if(Q($),Y!==void 0)_.propertyName=Y}if(J)_.dataTypes=J;function Q($){_.data=$,_.dataLevel=z.dataLevel+1,_.dataTypes=[],z.definedProperties=new Set,_.parentData=z.data,_.dataNames=[...z.dataNames,$]}}FK.extendSubschemaData=ov;function av(_,{jtdDiscriminator:z,jtdMetadata:A,compositeRule:b,createErrors:G,allErrors:J}){if(b!==void 0)_.compositeRule=b;if(G!==void 0)_.createErrors=G;if(J!==void 0)_.allErrors=J;_.jtdDiscriminator=z,_.jtdMetadata=A}FK.extendSubschemaMode=av});var y7=I((O30,WK)=>{WK.exports=function _(z,A){if(z===A)return!0;if(z&&A&&typeof z=="object"&&typeof A=="object"){if(z.constructor!==A.constructor)return!1;var b,G,J;if(Array.isArray(z)){if(b=z.length,b!=A.length)return!1;for(G=b;G--!==0;)if(!_(z[G],A[G]))return!1;return!0}if(z.constructor===RegExp)return z.source===A.source&&z.flags===A.flags;if(z.valueOf!==Object.prototype.valueOf)return z.valueOf()===A.valueOf();if(z.toString!==Object.prototype.toString)return z.toString()===A.toString();if(J=Object.keys(z),b=J.length,b!==Object.keys(A).length)return!1;for(G=b;G--!==0;)if(!Object.prototype.hasOwnProperty.call(A,J[G]))return!1;for(G=b;G--!==0;){var Y=J[G];if(!_(z[Y],A[Y]))return!1}return!0}return z!==z&&A!==A}});var UK=I((L30,VK)=>{var H_=VK.exports=function(_,z,A){if(typeof z=="function")A=z,z={};A=z.cb||A;var b=typeof A=="function"?A:A.pre||function(){},G=A.post||function(){};RA(z,b,G,_,"",_)};H_.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};H_.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};H_.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};H_.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 RA(_,z,A,b,G,J,Y,X,Q,$){if(b&&typeof b=="object"&&!Array.isArray(b)){z(b,G,J,Y,X,Q,$);for(var H in b){var B=b[H];if(Array.isArray(B)){if(H in H_.arrayKeywords)for(var Z=0;Z<B.length;Z++)RA(_,z,A,B[Z],G+"/"+H+"/"+Z,J,G,H,b,Z)}else if(H in H_.propsKeywords){if(B&&typeof B=="object")for(var F in B)RA(_,z,A,B[F],G+"/"+H+"/"+ev(F),J,G,H,b,F)}else if(H in H_.keywords||_.allKeys&&!(H in H_.skipKeywords))RA(_,z,A,B,G+"/"+H,J,G,H,b)}A(b,G,J,Y,X,Q,$)}}function ev(_){return _.replace(/~/g,"~0").replace(/\//g,"~1")}});var $3=I((wK)=>{Object.defineProperty(wK,"__esModule",{value:!0});wK.getSchemaRefs=wK.resolveUrl=wK.normalizeId=wK._getFullPath=wK.getFullPath=wK.inlineRef=void 0;var _y=Q0(),zy=y7(),Ay=UK(),by=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function Gy(_,z=!0){if(typeof _=="boolean")return!0;if(z===!0)return!g7(_);if(!z)return!1;return DK(_)<=z}wK.inlineRef=Gy;var Jy=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function g7(_){for(let z in _){if(Jy.has(z))return!0;let A=_[z];if(Array.isArray(A)&&A.some(g7))return!0;if(typeof A=="object"&&g7(A))return!0}return!1}function DK(_){let z=0;for(let A in _){if(A==="$ref")return 1/0;if(z++,by.has(A))continue;if(typeof _[A]=="object")(0,_y.eachItem)(_[A],(b)=>z+=DK(b));if(z===1/0)return 1/0}return z}function MK(_,z="",A){if(A!==!1)z=u1(z);let b=_.parse(z);return NK(_,b)}wK.getFullPath=MK;function NK(_,z){return _.serialize(z).split("#")[0]+"#"}wK._getFullPath=NK;var Yy=/#\/?$/;function u1(_){return _?_.replace(Yy,""):""}wK.normalizeId=u1;function Xy(_,z,A){return A=u1(A),_.resolve(z,A)}wK.resolveUrl=Xy;var Qy=/^[a-z_][-a-z0-9._]*$/i;function $y(_,z){if(typeof _=="boolean")return{};let{schemaId:A,uriResolver:b}=this.opts,G=u1(_[A]||z),J={"":G},Y=MK(b,G,!1),X={},Q=new Set;return Ay(_,{allKeys:!0},(B,Z,F,K)=>{if(K===void 0)return;let q=Y+Z,W=J[K];if(typeof B[A]=="string")W=V.call(this,B[A]);w.call(this,B.$anchor),w.call(this,B.$dynamicAnchor),J[Z]=W;function V(O){let M=this.opts.uriResolver.resolve;if(O=u1(W?M(W,O):O),Q.has(O))throw H(O);Q.add(O);let P=this.refs[O];if(typeof P=="string")P=this.refs[P];if(typeof P=="object")$(B,P.schema,O);else if(O!==u1(q))if(O[0]==="#")$(B,X[O],O),X[O]=B;else this.refs[O]=q;return O}function w(O){if(typeof O=="string"){if(!Qy.test(O))throw Error(`invalid anchor "${O}"`);V.call(this,`#${O}`)}}}),X;function $(B,Z,F){if(Z!==void 0&&!zy(B,Z))throw H(F)}function H(B){return Error(`reference "${B}" resolves to more than one schema`)}}wK.getSchemaRefs=$y});var Z3=I((fK)=>{Object.defineProperty(fK,"__esModule",{value:!0});fK.getData=fK.KeywordCxt=fK.validateFunctionCode=void 0;var PK=uF(),OK=Q3(),h7=S7(),PA=Q3(),qy=AK(),B3=BK(),f7=qK(),h=t(),n=v4(),Wy=$3(),y4=Q0(),H3=X3();function Vy(_){if(IK(_)){if(xK(_),kK(_)){My(_);return}}SK(_,()=>(0,PK.topBoolOrEmptySchema)(_))}fK.validateFunctionCode=Vy;function SK({gen:_,validateName:z,schema:A,schemaEnv:b,opts:G},J){if(G.code.es5)_.func(z,h._`${n.default.data}, ${n.default.valCxt}`,b.$async,()=>{_.code(h._`"use strict"; ${LK(A,G)}`),Dy(_,G),_.code(J)});else _.func(z,h._`${n.default.data}, ${Uy(G)}`,b.$async,()=>_.code(LK(A,G)).code(J))}function Uy(_){return h._`{${n.default.instancePath}="", ${n.default.parentData}, ${n.default.parentDataProperty}, ${n.default.rootData}=${n.default.data}${_.dynamicRef?h._`, ${n.default.dynamicAnchors}={}`:h.nil}}={}`}function Dy(_,z){_.if(n.default.valCxt,()=>{if(_.var(n.default.instancePath,h._`${n.default.valCxt}.${n.default.instancePath}`),_.var(n.default.parentData,h._`${n.default.valCxt}.${n.default.parentData}`),_.var(n.default.parentDataProperty,h._`${n.default.valCxt}.${n.default.parentDataProperty}`),_.var(n.default.rootData,h._`${n.default.valCxt}.${n.default.rootData}`),z.dynamicRef)_.var(n.default.dynamicAnchors,h._`${n.default.valCxt}.${n.default.dynamicAnchors}`)},()=>{if(_.var(n.default.instancePath,h._`""`),_.var(n.default.parentData,h._`undefined`),_.var(n.default.parentDataProperty,h._`undefined`),_.var(n.default.rootData,n.default.data),z.dynamicRef)_.var(n.default.dynamicAnchors,h._`{}`)})}function My(_){let{schema:z,opts:A,gen:b}=_;SK(_,()=>{if(A.$comment&&z.$comment)CK(_);if(Ly(_),b.let(n.default.vErrors,null),b.let(n.default.errors,0),A.unevaluated)Ny(_);TK(_),Py(_)});return}function Ny(_){let{gen:z,validateName:A}=_;_.evaluated=z.const("evaluated",h._`${A}.evaluated`),z.if(h._`${_.evaluated}.dynamicProps`,()=>z.assign(h._`${_.evaluated}.props`,h._`undefined`)),z.if(h._`${_.evaluated}.dynamicItems`,()=>z.assign(h._`${_.evaluated}.items`,h._`undefined`))}function LK(_,z){let A=typeof _=="object"&&_[z.schemaId];return A&&(z.code.source||z.code.process)?h._`/*# sourceURL=${A} */`:h.nil}function wy(_,z){if(IK(_)){if(xK(_),kK(_)){Ey(_,z);return}}(0,PK.boolOrEmptySchema)(_,z)}function kK({schema:_,self:z}){if(typeof _=="boolean")return!_;for(let A in _)if(z.RULES.all[A])return!0;return!1}function IK(_){return typeof _.schema!="boolean"}function Ey(_,z){let{schema:A,gen:b,opts:G}=_;if(G.$comment&&A.$comment)CK(_);jy(_),Ry(_);let J=b.const("_errs",n.default.errors);TK(_,J),b.var(z,h._`${J} === ${n.default.errors}`)}function xK(_){(0,y4.checkUnknownRules)(_),Oy(_)}function TK(_,z){if(_.opts.jtd)return jK(_,[],!1,z);let A=(0,OK.getSchemaTypes)(_.schema),b=(0,OK.coerceAndCheckDataType)(_,A);jK(_,A,!b,z)}function Oy(_){let{schema:z,errSchemaPath:A,opts:b,self:G}=_;if(z.$ref&&b.ignoreKeywordsWithRef&&(0,y4.schemaHasRulesButRef)(z,G.RULES))G.logger.warn(`$ref: keywords ignored in schema at path "${A}"`)}function Ly(_){let{schema:z,opts:A}=_;if(z.default!==void 0&&A.useDefaults&&A.strictSchema)(0,y4.checkStrictMode)(_,"default is ignored in the schema root")}function jy(_){let z=_.schema[_.opts.schemaId];if(z)_.baseId=(0,Wy.resolveUrl)(_.opts.uriResolver,_.baseId,z)}function Ry(_){if(_.schema.$async&&!_.schemaEnv.$async)throw Error("async schema in sync schema")}function CK({gen:_,schemaEnv:z,schema:A,errSchemaPath:b,opts:G}){let J=A.$comment;if(G.$comment===!0)_.code(h._`${n.default.self}.logger.log(${J})`);else if(typeof G.$comment=="function"){let Y=h.str`${b}/$comment`,X=_.scopeValue("root",{ref:z.root});_.code(h._`${n.default.self}.opts.$comment(${J}, ${Y}, ${X}.schema)`)}}function Py(_){let{gen:z,schemaEnv:A,validateName:b,ValidationError:G,opts:J}=_;if(A.$async)z.if(h._`${n.default.errors} === 0`,()=>z.return(n.default.data),()=>z.throw(h._`new ${G}(${n.default.vErrors})`));else{if(z.assign(h._`${b}.errors`,n.default.vErrors),J.unevaluated)Sy(_);z.return(h._`${n.default.errors} === 0`)}}function Sy({gen:_,evaluated:z,props:A,items:b}){if(A instanceof h.Name)_.assign(h._`${z}.props`,A);if(b instanceof h.Name)_.assign(h._`${z}.items`,b)}function jK(_,z,A,b){let{gen:G,schema:J,data:Y,allErrors:X,opts:Q,self:$}=_,{RULES:H}=$;if(J.$ref&&(Q.ignoreKeywordsWithRef||!(0,y4.schemaHasRulesButRef)(J,H))){G.block(()=>yK(_,"$ref",H.all.$ref.definition));return}if(!Q.jtd)ky(_,z);G.block(()=>{for(let Z of H.rules)B(Z);B(H.post)});function B(Z){if(!(0,h7.shouldUseGroup)(J,Z))return;if(Z.type){if(G.if((0,PA.checkDataType)(Z.type,Y,Q.strictNumbers)),RK(_,Z),z.length===1&&z[0]===Z.type&&A)G.else(),(0,PA.reportTypeError)(_);G.endIf()}else RK(_,Z);if(!X)G.if(h._`${n.default.errors} === ${b||0}`)}}function RK(_,z){let{gen:A,schema:b,opts:{useDefaults:G}}=_;if(G)(0,qy.assignDefaults)(_,z.type);A.block(()=>{for(let J of z.rules)if((0,h7.shouldUseRule)(b,J))yK(_,J.keyword,J.definition,z.type)})}function ky(_,z){if(_.schemaEnv.meta||!_.opts.strictTypes)return;if(Iy(_,z),!_.opts.allowUnionTypes)xy(_,z);Ty(_,_.dataTypes)}function Iy(_,z){if(!z.length)return;if(!_.dataTypes.length){_.dataTypes=z;return}z.forEach((A)=>{if(!vK(_.dataTypes,A))m7(_,`type "${A}" not allowed by context "${_.dataTypes.join(",")}"`)}),vy(_,z)}function xy(_,z){if(z.length>1&&!(z.length===2&&z.includes("null")))m7(_,"use allowUnionTypes to allow union type keyword")}function Ty(_,z){let A=_.self.RULES.all;for(let b in A){let G=A[b];if(typeof G=="object"&&(0,h7.shouldUseRule)(_.schema,G)){let{type:J}=G.definition;if(J.length&&!J.some((Y)=>Cy(z,Y)))m7(_,`missing type "${J.join(",")}" for keyword "${b}"`)}}}function Cy(_,z){return _.includes(z)||z==="number"&&_.includes("integer")}function vK(_,z){return _.includes(z)||z==="integer"&&_.includes("number")}function vy(_,z){let A=[];for(let b of _.dataTypes)if(vK(z,b))A.push(b);else if(z.includes("integer")&&b==="number")A.push("integer");_.dataTypes=A}function m7(_,z){let A=_.schemaEnv.baseId+_.errSchemaPath;z+=` at "${A}" (strictTypes)`,(0,y4.checkStrictMode)(_,z,_.opts.strictTypes)}class u7{constructor(_,z,A){if((0,B3.validateKeywordUsage)(_,z,A),this.gen=_.gen,this.allErrors=_.allErrors,this.keyword=A,this.data=_.data,this.schema=_.schema[A],this.$data=z.$data&&_.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,y4.schemaRefOrVal)(_,this.schema,A,this.$data),this.schemaType=z.schemaType,this.parentSchema=_.schema,this.params={},this.it=_,this.def=z,this.$data)this.schemaCode=_.gen.const("vSchema",gK(this.$data,_));else if(this.schemaCode=this.schemaValue,!(0,B3.validSchemaType)(this.schema,z.schemaType,z.allowUndefined))throw Error(`${A} value must be ${JSON.stringify(z.schemaType)}`);if("code"in z?z.trackErrors:z.errors!==!1)this.errsCount=_.gen.const("_errs",n.default.errors)}result(_,z,A){this.failResult((0,h.not)(_),z,A)}failResult(_,z,A){if(this.gen.if(_),A)A();else this.error();if(z){if(this.gen.else(),z(),this.allErrors)this.gen.endIf()}else if(this.allErrors)this.gen.endIf();else this.gen.else()}pass(_,z){this.failResult((0,h.not)(_),void 0,z)}fail(_){if(_===void 0){if(this.error(),!this.allErrors)this.gen.if(!1);return}if(this.gen.if(_),this.error(),this.allErrors)this.gen.endIf();else this.gen.else()}fail$data(_){if(!this.$data)return this.fail(_);let{schemaCode:z}=this;this.fail(h._`${z} !== undefined && (${(0,h.or)(this.invalid$data(),_)})`)}error(_,z,A){if(z){this.setParams(z),this._error(_,A),this.setParams({});return}this._error(_,A)}_error(_,z){(_?H3.reportExtraError:H3.reportError)(this,this.def.error,z)}$dataError(){(0,H3.reportError)(this,this.def.$dataError||H3.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');(0,H3.resetErrorsCount)(this.gen,this.errsCount)}ok(_){if(!this.allErrors)this.gen.if(_)}setParams(_,z){if(z)Object.assign(this.params,_);else this.params=_}block$data(_,z,A=h.nil){this.gen.block(()=>{this.check$data(_,A),z()})}check$data(_=h.nil,z=h.nil){if(!this.$data)return;let{gen:A,schemaCode:b,schemaType:G,def:J}=this;if(A.if((0,h.or)(h._`${b} === undefined`,z)),_!==h.nil)A.assign(_,!0);if(G.length||J.validateSchema){if(A.elseIf(this.invalid$data()),this.$dataError(),_!==h.nil)A.assign(_,!1)}A.else()}invalid$data(){let{gen:_,schemaCode:z,schemaType:A,def:b,it:G}=this;return(0,h.or)(J(),Y());function J(){if(A.length){if(!(z instanceof h.Name))throw Error("ajv implementation error");let X=Array.isArray(A)?A:[A];return h._`${(0,PA.checkDataTypes)(X,z,G.opts.strictNumbers,PA.DataType.Wrong)}`}return h.nil}function Y(){if(b.validateSchema){let X=_.scopeValue("validate$data",{ref:b.validateSchema});return h._`!${X}(${z})`}return h.nil}}subschema(_,z){let A=(0,f7.getSubschema)(this.it,_);(0,f7.extendSubschemaData)(A,this.it,_),(0,f7.extendSubschemaMode)(A,_);let b={...this.it,...A,items:void 0,props:void 0};return wy(b,z),b}mergeEvaluated(_,z){let{it:A,gen:b}=this;if(!A.opts.unevaluated)return;if(A.props!==!0&&_.props!==void 0)A.props=y4.mergeEvaluated.props(b,_.props,A.props,z);if(A.items!==!0&&_.items!==void 0)A.items=y4.mergeEvaluated.items(b,_.items,A.items,z)}mergeValidEvaluated(_,z){let{it:A,gen:b}=this;if(A.opts.unevaluated&&(A.props!==!0||A.items!==!0))return b.if(z,()=>this.mergeEvaluated(_,h.Name)),!0}}fK.KeywordCxt=u7;function yK(_,z,A,b){let G=new u7(_,A,z);if("code"in A)A.code(G,b);else if(G.$data&&A.validate)(0,B3.funcKeywordCode)(G,A);else if("macro"in A)(0,B3.macroKeywordCode)(G,A);else if(A.compile||A.validate)(0,B3.funcKeywordCode)(G,A)}var yy=/^\/(?:[^~]|~0|~1)*$/,gy=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function gK(_,{dataLevel:z,dataNames:A,dataPathArr:b}){let G,J;if(_==="")return n.default.rootData;if(_[0]==="/"){if(!yy.test(_))throw Error(`Invalid JSON-pointer: ${_}`);G=_,J=n.default.rootData}else{let $=gy.exec(_);if(!$)throw Error(`Invalid JSON-pointer: ${_}`);let H=+$[1];if(G=$[2],G==="#"){if(H>=z)throw Error(Q("property/index",H));return b[z-H]}if(H>z)throw Error(Q("data",H));if(J=A[z-H],!G)return J}let Y=J,X=G.split("/");for(let $ of X)if($)J=h._`${J}${(0,h.getProperty)((0,y4.unescapeJsonPointer)($))}`,Y=h._`${Y} && ${J}`;return Y;function Q($,H){return`Cannot access ${$} ${H} levels up, current level is ${z}`}}fK.getData=gK});var SA=I((uK)=>{Object.defineProperty(uK,"__esModule",{value:!0});class mK extends Error{constructor(_){super("validation failed");this.errors=_,this.ajv=this.validation=!0}}uK.default=mK});var F3=I((lK)=>{Object.defineProperty(lK,"__esModule",{value:!0});var c7=$3();class cK extends Error{constructor(_,z,A,b){super(b||`can't resolve reference ${A} from id ${z}`);this.missingRef=(0,c7.resolveUrl)(_,z,A),this.missingSchema=(0,c7.normalizeId)((0,c7.getFullPath)(_,this.missingRef))}}lK.default=cK});var IA=I((rK)=>{Object.defineProperty(rK,"__esModule",{value:!0});rK.resolveSchema=rK.getCompilingSchema=rK.resolveRef=rK.compileSchema=rK.SchemaEnv=void 0;var r9=t(),cy=SA(),y_=v4(),n9=$3(),pK=Q0(),ly=Z3();class K3{constructor(_){var z;this.refs={},this.dynamicAnchors={};let A;if(typeof _.schema=="object")A=_.schema;this.schema=_.schema,this.schemaId=_.schemaId,this.root=_.root||this,this.baseId=(z=_.baseId)!==null&&z!==void 0?z:(0,n9.normalizeId)(A===null||A===void 0?void 0:A[_.schemaId||"$id"]),this.schemaPath=_.schemaPath,this.localRefs=_.localRefs,this.meta=_.meta,this.$async=A===null||A===void 0?void 0:A.$async,this.refs={}}}rK.SchemaEnv=K3;function p7(_){let z=dK.call(this,_);if(z)return z;let A=(0,n9.getFullPath)(this.opts.uriResolver,_.root.baseId),{es5:b,lines:G}=this.opts.code,{ownProperties:J}=this.opts,Y=new r9.CodeGen(this.scope,{es5:b,lines:G,ownProperties:J}),X;if(_.$async)X=Y.scopeValue("Error",{ref:cy.default,code:r9._`require("ajv/dist/runtime/validation_error").default`});let Q=Y.scopeName("validate");_.validateName=Q;let $={gen:Y,allErrors:this.opts.allErrors,data:y_.default.data,parentData:y_.default.parentData,parentDataProperty:y_.default.parentDataProperty,dataNames:[y_.default.data],dataPathArr:[r9.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:Y.scopeValue("schema",this.opts.code.source===!0?{ref:_.schema,code:(0,r9.stringify)(_.schema)}:{ref:_.schema}),validateName:Q,ValidationError:X,schema:_.schema,schemaEnv:_,rootId:A,baseId:_.baseId||A,schemaPath:r9.nil,errSchemaPath:_.schemaPath||(this.opts.jtd?"":"#"),errorPath:r9._`""`,opts:this.opts,self:this},H;try{this._compilations.add(_),(0,ly.validateFunctionCode)($),Y.optimize(this.opts.code.optimize);let B=Y.toString();if(H=`${Y.scopeRefs(y_.default.scope)}return ${B}`,this.opts.code.process)H=this.opts.code.process(H,_);let F=Function(`${y_.default.self}`,`${y_.default.scope}`,H)(this,this.scope.get());if(this.scope.value(Q,{ref:F}),F.errors=null,F.schema=_.schema,F.schemaEnv=_,_.$async)F.$async=!0;if(this.opts.code.source===!0)F.source={validateName:Q,validateCode:B,scopeValues:Y._values};if(this.opts.unevaluated){let{props:K,items:q}=$;if(F.evaluated={props:K instanceof r9.Name?void 0:K,items:q instanceof r9.Name?void 0:q,dynamicProps:K instanceof r9.Name,dynamicItems:q instanceof r9.Name},F.source)F.source.evaluated=(0,r9.stringify)(F.evaluated)}return _.validate=F,_}catch(B){if(delete _.validate,delete _.validateName,H)this.logger.error("Error compiling schema, function code:",H);throw B}finally{this._compilations.delete(_)}}rK.compileSchema=p7;function py(_,z,A){var b;A=(0,n9.resolveUrl)(this.opts.uriResolver,z,A);let G=_.refs[A];if(G)return G;let J=ny.call(this,_,A);if(J===void 0){let Y=(b=_.localRefs)===null||b===void 0?void 0:b[A],{schemaId:X}=this.opts;if(Y)J=new K3({schema:Y,schemaId:X,root:_,baseId:z})}if(J===void 0)return;return _.refs[A]=dy.call(this,J)}rK.resolveRef=py;function dy(_){if((0,n9.inlineRef)(_.schema,this.opts.inlineRefs))return _.schema;return _.validate?_:p7.call(this,_)}function dK(_){for(let z of this._compilations)if(ry(z,_))return z}rK.getCompilingSchema=dK;function ry(_,z){return _.schema===z.schema&&_.root===z.root&&_.baseId===z.baseId}function ny(_,z){let A;while(typeof(A=this.refs[z])=="string")z=A;return A||this.schemas[z]||kA.call(this,_,z)}function kA(_,z){let A=this.opts.uriResolver.parse(z),b=(0,n9._getFullPath)(this.opts.uriResolver,A),G=(0,n9.getFullPath)(this.opts.uriResolver,_.baseId,void 0);if(Object.keys(_.schema).length>0&&b===G)return l7.call(this,A,_);let J=(0,n9.normalizeId)(b),Y=this.refs[J]||this.schemas[J];if(typeof Y=="string"){let X=kA.call(this,_,Y);if(typeof(X===null||X===void 0?void 0:X.schema)!=="object")return;return l7.call(this,A,X)}if(typeof(Y===null||Y===void 0?void 0:Y.schema)!=="object")return;if(!Y.validate)p7.call(this,Y);if(J===(0,n9.normalizeId)(z)){let{schema:X}=Y,{schemaId:Q}=this.opts,$=X[Q];if($)G=(0,n9.resolveUrl)(this.opts.uriResolver,G,$);return new K3({schema:X,schemaId:Q,root:_,baseId:G})}return l7.call(this,A,Y)}rK.resolveSchema=kA;var iy=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function l7(_,{baseId:z,schema:A,root:b}){var G;if(((G=_.fragment)===null||G===void 0?void 0:G[0])!=="/")return;for(let X of _.fragment.slice(1).split("/")){if(typeof A==="boolean")return;let Q=A[(0,pK.unescapeFragment)(X)];if(Q===void 0)return;A=Q;let $=typeof A==="object"&&A[this.opts.schemaId];if(!iy.has(X)&&$)z=(0,n9.resolveUrl)(this.opts.uriResolver,z,$)}let J;if(typeof A!="boolean"&&A.$ref&&!(0,pK.schemaHasRulesButRef)(A,this.RULES)){let X=(0,n9.resolveUrl)(this.opts.uriResolver,z,A.$ref);J=kA.call(this,b,X)}let{schemaId:Y}=this.opts;if(J=J||new K3({schema:A,schemaId:Y,root:b,baseId:z}),J.schema!==J.root.schema)return J;return}});var iK=I((I30,ey)=>{ey.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var r7=I((x30,tK)=>{var _g=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),aK=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function d7(_){let z="",A=0,b=0;for(b=0;b<_.length;b++){if(A=_[b].charCodeAt(0),A===48)continue;if(!(A>=48&&A<=57||A>=65&&A<=70||A>=97&&A<=102))return"";z+=_[b];break}for(b+=1;b<_.length;b++){if(A=_[b].charCodeAt(0),!(A>=48&&A<=57||A>=65&&A<=70||A>=97&&A<=102))return"";z+=_[b]}return z}var zg=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function oK(_){return _.length=0,!0}function Ag(_,z,A){if(_.length){let b=d7(_);if(b!=="")z.push(b);else return A.error=!0,!1;_.length=0}return!0}function bg(_){let z=0,A={error:!1,address:"",zone:""},b=[],G=[],J=!1,Y=!1,X=Ag;for(let Q=0;Q<_.length;Q++){let $=_[Q];if($==="["||$==="]")continue;if($===":"){if(J===!0)Y=!0;if(!X(G,b,A))break;if(++z>7){A.error=!0;break}if(Q>0&&_[Q-1]===":")J=!0;b.push(":");continue}else if($==="%"){if(!X(G,b,A))break;X=oK}else{G.push($);continue}}if(G.length)if(X===oK)A.zone=G.join("");else if(Y)b.push(G.join(""));else b.push(d7(G));return A.address=b.join(""),A}function sK(_){if(Gg(_,":")<2)return{host:_,isIPV6:!1};let z=bg(_);if(!z.error){let{address:A,address:b}=z;if(z.zone)A+="%"+z.zone,b+="%25"+z.zone;return{host:A,isIPV6:!0,escapedHost:b}}else return{host:_,isIPV6:!1}}function Gg(_,z){let A=0;for(let b=0;b<_.length;b++)if(_[b]===z)A++;return A}function Jg(_){let z=_,A=[],b=-1,G=0;while(G=z.length){if(G===1)if(z===".")break;else if(z==="/"){A.push("/");break}else{A.push(z);break}else if(G===2){if(z[0]==="."){if(z[1]===".")break;else if(z[1]==="/"){z=z.slice(2);continue}}else if(z[0]==="/"){if(z[1]==="."||z[1]==="/"){A.push("/");break}}}else if(G===3){if(z==="/.."){if(A.length!==0)A.pop();A.push("/");break}}if(z[0]==="."){if(z[1]==="."){if(z[2]==="/"){z=z.slice(3);continue}}else if(z[1]==="/"){z=z.slice(2);continue}}else if(z[0]==="/"){if(z[1]==="."){if(z[2]==="/"){z=z.slice(2);continue}else if(z[2]==="."){if(z[3]==="/"){if(z=z.slice(3),A.length!==0)A.pop();continue}}}}if((b=z.indexOf("/",1))===-1){A.push(z);break}else A.push(z.slice(0,b)),z=z.slice(b)}return A.join("")}function Yg(_,z){let A=z!==!0?escape:unescape;if(_.scheme!==void 0)_.scheme=A(_.scheme);if(_.userinfo!==void 0)_.userinfo=A(_.userinfo);if(_.host!==void 0)_.host=A(_.host);if(_.path!==void 0)_.path=A(_.path);if(_.query!==void 0)_.query=A(_.query);if(_.fragment!==void 0)_.fragment=A(_.fragment);return _}function Xg(_){let z=[];if(_.userinfo!==void 0)z.push(_.userinfo),z.push("@");if(_.host!==void 0){let A=unescape(_.host);if(!aK(A)){let b=sK(A);if(b.isIPV6===!0)A=`[${b.escapedHost}]`;else A=_.host}z.push(A)}if(typeof _.port==="number"||typeof _.port==="string")z.push(":"),z.push(String(_.port));return z.length?z.join(""):void 0}tK.exports={nonSimpleDomain:zg,recomposeAuthority:Xg,normalizeComponentEncoding:Yg,removeDotSegments:Jg,isIPv4:aK,isUUID:_g,normalizeIPv6:sK,stringArrayToHexStripped:d7}});var bq=I((T30,Aq)=>{var{isUUID:Qg}=r7(),$g=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,Hg=["http","https","ws","wss","urn","urn:uuid"];function Bg(_){return Hg.indexOf(_)!==-1}function n7(_){if(_.secure===!0)return!0;else if(_.secure===!1)return!1;else if(_.scheme)return _.scheme.length===3&&(_.scheme[0]==="w"||_.scheme[0]==="W")&&(_.scheme[1]==="s"||_.scheme[1]==="S")&&(_.scheme[2]==="s"||_.scheme[2]==="S");else return!1}function eK(_){if(!_.host)_.error=_.error||"HTTP URIs must have a host.";return _}function _q(_){let z=String(_.scheme).toLowerCase()==="https";if(_.port===(z?443:80)||_.port==="")_.port=void 0;if(!_.path)_.path="/";return _}function Zg(_){return _.secure=n7(_),_.resourceName=(_.path||"/")+(_.query?"?"+_.query:""),_.path=void 0,_.query=void 0,_}function Fg(_){if(_.port===(n7(_)?443:80)||_.port==="")_.port=void 0;if(typeof _.secure==="boolean")_.scheme=_.secure?"wss":"ws",_.secure=void 0;if(_.resourceName){let[z,A]=_.resourceName.split("?");_.path=z&&z!=="/"?z:void 0,_.query=A,_.resourceName=void 0}return _.fragment=void 0,_}function Kg(_,z){if(!_.path)return _.error="URN can not be parsed",_;let A=_.path.match($g);if(A){let b=z.scheme||_.scheme||"urn";_.nid=A[1].toLowerCase(),_.nss=A[2];let G=`${b}:${z.nid||_.nid}`,J=i7(G);if(_.path=void 0,J)_=J.parse(_,z)}else _.error=_.error||"URN can not be parsed.";return _}function qg(_,z){if(_.nid===void 0)throw Error("URN without nid cannot be serialized");let A=z.scheme||_.scheme||"urn",b=_.nid.toLowerCase(),G=`${A}:${z.nid||b}`,J=i7(G);if(J)_=J.serialize(_,z);let Y=_,X=_.nss;return Y.path=`${b||z.nid}:${X}`,z.skipEscape=!0,Y}function Wg(_,z){let A=_;if(A.uuid=A.nss,A.nss=void 0,!z.tolerant&&(!A.uuid||!Qg(A.uuid)))A.error=A.error||"UUID is not valid.";return A}function Vg(_){let z=_;return z.nss=(_.uuid||"").toLowerCase(),z}var zq={scheme:"http",domainHost:!0,parse:eK,serialize:_q},Ug={scheme:"https",domainHost:zq.domainHost,parse:eK,serialize:_q},xA={scheme:"ws",domainHost:!0,parse:Zg,serialize:Fg},Dg={scheme:"wss",domainHost:xA.domainHost,parse:xA.parse,serialize:xA.serialize},Mg={scheme:"urn",parse:Kg,serialize:qg,skipNormalize:!0},Ng={scheme:"urn:uuid",parse:Wg,serialize:Vg,skipNormalize:!0},TA={http:zq,https:Ug,ws:xA,wss:Dg,urn:Mg,"urn:uuid":Ng};Object.setPrototypeOf(TA,null);function i7(_){return _&&(TA[_]||TA[_.toLowerCase()])||void 0}Aq.exports={wsIsSecure:n7,SCHEMES:TA,isValidSchemeName:Bg,getSchemeHandler:i7}});var Yq=I((C30,vA)=>{var{normalizeIPv6:wg,removeDotSegments:q3,recomposeAuthority:Eg,normalizeComponentEncoding:CA,isIPv4:Og,nonSimpleDomain:Lg}=r7(),{SCHEMES:jg,getSchemeHandler:Gq}=bq();function Rg(_,z){if(typeof _==="string")_=F4(g4(_,z),z);else if(typeof _==="object")_=g4(F4(_,z),z);return _}function Pg(_,z,A){let b=A?Object.assign({scheme:"null"},A):{scheme:"null"},G=Jq(g4(_,b),g4(z,b),b,!0);return b.skipEscape=!0,F4(G,b)}function Jq(_,z,A,b){let G={};if(!b)_=g4(F4(_,A),A),z=g4(F4(z,A),A);if(A=A||{},!A.tolerant&&z.scheme)G.scheme=z.scheme,G.userinfo=z.userinfo,G.host=z.host,G.port=z.port,G.path=q3(z.path||""),G.query=z.query;else{if(z.userinfo!==void 0||z.host!==void 0||z.port!==void 0)G.userinfo=z.userinfo,G.host=z.host,G.port=z.port,G.path=q3(z.path||""),G.query=z.query;else{if(!z.path)if(G.path=_.path,z.query!==void 0)G.query=z.query;else G.query=_.query;else{if(z.path[0]==="/")G.path=q3(z.path);else{if((_.userinfo!==void 0||_.host!==void 0||_.port!==void 0)&&!_.path)G.path="/"+z.path;else if(!_.path)G.path=z.path;else G.path=_.path.slice(0,_.path.lastIndexOf("/")+1)+z.path;G.path=q3(G.path)}G.query=z.query}G.userinfo=_.userinfo,G.host=_.host,G.port=_.port}G.scheme=_.scheme}return G.fragment=z.fragment,G}function Sg(_,z,A){if(typeof _==="string")_=unescape(_),_=F4(CA(g4(_,A),!0),{...A,skipEscape:!0});else if(typeof _==="object")_=F4(CA(_,!0),{...A,skipEscape:!0});if(typeof z==="string")z=unescape(z),z=F4(CA(g4(z,A),!0),{...A,skipEscape:!0});else if(typeof z==="object")z=F4(CA(z,!0),{...A,skipEscape:!0});return _.toLowerCase()===z.toLowerCase()}function F4(_,z){let A={host:_.host,scheme:_.scheme,userinfo:_.userinfo,port:_.port,path:_.path,query:_.query,nid:_.nid,nss:_.nss,uuid:_.uuid,fragment:_.fragment,reference:_.reference,resourceName:_.resourceName,secure:_.secure,error:""},b=Object.assign({},z),G=[],J=Gq(b.scheme||A.scheme);if(J&&J.serialize)J.serialize(A,b);if(A.path!==void 0)if(!b.skipEscape){if(A.path=escape(A.path),A.scheme!==void 0)A.path=A.path.split("%3A").join(":")}else A.path=unescape(A.path);if(b.reference!=="suffix"&&A.scheme)G.push(A.scheme,":");let Y=Eg(A);if(Y!==void 0){if(b.reference!=="suffix")G.push("//");if(G.push(Y),A.path&&A.path[0]!=="/")G.push("/")}if(A.path!==void 0){let X=A.path;if(!b.absolutePath&&(!J||!J.absolutePath))X=q3(X);if(Y===void 0&&X[0]==="/"&&X[1]==="/")X="/%2F"+X.slice(2);G.push(X)}if(A.query!==void 0)G.push("?",A.query);if(A.fragment!==void 0)G.push("#",A.fragment);return G.join("")}var kg=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function g4(_,z){let A=Object.assign({},z),b={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},G=!1;if(A.reference==="suffix")if(A.scheme)_=A.scheme+":"+_;else _="//"+_;let J=_.match(kg);if(J){if(b.scheme=J[1],b.userinfo=J[3],b.host=J[4],b.port=parseInt(J[5],10),b.path=J[6]||"",b.query=J[7],b.fragment=J[8],isNaN(b.port))b.port=J[5];if(b.host)if(Og(b.host)===!1){let Q=wg(b.host);b.host=Q.host.toLowerCase(),G=Q.isIPV6}else G=!0;if(b.scheme===void 0&&b.userinfo===void 0&&b.host===void 0&&b.port===void 0&&b.query===void 0&&!b.path)b.reference="same-document";else if(b.scheme===void 0)b.reference="relative";else if(b.fragment===void 0)b.reference="absolute";else b.reference="uri";if(A.reference&&A.reference!=="suffix"&&A.reference!==b.reference)b.error=b.error||"URI is not a "+A.reference+" reference.";let Y=Gq(A.scheme||b.scheme);if(!A.unicodeSupport&&(!Y||!Y.unicodeSupport)){if(b.host&&(A.domainHost||Y&&Y.domainHost)&&G===!1&&Lg(b.host))try{b.host=URL.domainToASCII(b.host.toLowerCase())}catch(X){b.error=b.error||"Host's domain name can not be converted to ASCII: "+X}}if(!Y||Y&&!Y.skipNormalize){if(_.indexOf("%")!==-1){if(b.scheme!==void 0)b.scheme=unescape(b.scheme);if(b.host!==void 0)b.host=unescape(b.host)}if(b.path)b.path=escape(unescape(b.path));if(b.fragment)b.fragment=encodeURI(decodeURIComponent(b.fragment))}if(Y&&Y.parse)Y.parse(b,A)}else b.error=b.error||"URI can not be parsed.";return b}var o7={SCHEMES:jg,normalize:Rg,resolve:Pg,resolveComponent:Jq,equal:Sg,serialize:F4,parse:g4};vA.exports=o7;vA.exports.default=o7;vA.exports.fastUri=o7});var $q=I((Qq)=>{Object.defineProperty(Qq,"__esModule",{value:!0});var Xq=Yq();Xq.code='require("ajv/dist/runtime/uri").default';Qq.default=Xq});var Vq=I((f4)=>{Object.defineProperty(f4,"__esModule",{value:!0});f4.CodeGen=f4.Name=f4.nil=f4.stringify=f4.str=f4._=f4.KeywordCxt=void 0;var xg=Z3();Object.defineProperty(f4,"KeywordCxt",{enumerable:!0,get:function(){return xg.KeywordCxt}});var c1=t();Object.defineProperty(f4,"_",{enumerable:!0,get:function(){return c1._}});Object.defineProperty(f4,"str",{enumerable:!0,get:function(){return c1.str}});Object.defineProperty(f4,"stringify",{enumerable:!0,get:function(){return c1.stringify}});Object.defineProperty(f4,"nil",{enumerable:!0,get:function(){return c1.nil}});Object.defineProperty(f4,"Name",{enumerable:!0,get:function(){return c1.Name}});Object.defineProperty(f4,"CodeGen",{enumerable:!0,get:function(){return c1.CodeGen}});var Tg=SA(),Kq=F3(),Cg=P7(),W3=IA(),vg=t(),V3=$3(),yA=Q3(),s7=Q0(),Hq=iK(),yg=$q(),qq=(_,z)=>new RegExp(_,z);qq.code="new RegExp";var gg=["removeAdditional","useDefaults","coerceTypes"],fg=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),hg={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},mg={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},Bq=200;function ug(_){var z,A,b,G,J,Y,X,Q,$,H,B,Z,F,K,q,W,V,w,O,M,P,D,L,R,S;let y=_.strict,e=(z=_.code)===null||z===void 0?void 0:z.optimize,u=e===!0||e===void 0?1:e||0,g=(b=(A=_.code)===null||A===void 0?void 0:A.regExp)!==null&&b!==void 0?b:qq,m=(G=_.uriResolver)!==null&&G!==void 0?G:yg.default;return{strictSchema:(Y=(J=_.strictSchema)!==null&&J!==void 0?J:y)!==null&&Y!==void 0?Y:!0,strictNumbers:(Q=(X=_.strictNumbers)!==null&&X!==void 0?X:y)!==null&&Q!==void 0?Q:!0,strictTypes:(H=($=_.strictTypes)!==null&&$!==void 0?$:y)!==null&&H!==void 0?H:"log",strictTuples:(Z=(B=_.strictTuples)!==null&&B!==void 0?B:y)!==null&&Z!==void 0?Z:"log",strictRequired:(K=(F=_.strictRequired)!==null&&F!==void 0?F:y)!==null&&K!==void 0?K:!1,code:_.code?{..._.code,optimize:u,regExp:g}:{optimize:u,regExp:g},loopRequired:(q=_.loopRequired)!==null&&q!==void 0?q:Bq,loopEnum:(W=_.loopEnum)!==null&&W!==void 0?W:Bq,meta:(V=_.meta)!==null&&V!==void 0?V:!0,messages:(w=_.messages)!==null&&w!==void 0?w:!0,inlineRefs:(O=_.inlineRefs)!==null&&O!==void 0?O:!0,schemaId:(M=_.schemaId)!==null&&M!==void 0?M:"$id",addUsedSchema:(P=_.addUsedSchema)!==null&&P!==void 0?P:!0,validateSchema:(D=_.validateSchema)!==null&&D!==void 0?D:!0,validateFormats:(L=_.validateFormats)!==null&&L!==void 0?L:!0,unicodeRegExp:(R=_.unicodeRegExp)!==null&&R!==void 0?R:!0,int32range:(S=_.int32range)!==null&&S!==void 0?S:!0,uriResolver:m}}class gA{constructor(_={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,_=this.opts={..._,...ug(_)};let{es5:z,lines:A}=this.opts.code;this.scope=new vg.ValueScope({scope:{},prefixes:fg,es5:z,lines:A}),this.logger=ng(_.logger);let b=_.validateFormats;if(_.validateFormats=!1,this.RULES=(0,Cg.getRules)(),Zq.call(this,hg,_,"NOT SUPPORTED"),Zq.call(this,mg,_,"DEPRECATED","warn"),this._metaOpts=dg.call(this),_.formats)lg.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),_.keywords)pg.call(this,_.keywords);if(typeof _.meta=="object")this.addMetaSchema(_.meta);cg.call(this),_.validateFormats=b}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:_,meta:z,schemaId:A}=this.opts,b=Hq;if(A==="id")b={...Hq},b.id=b.$id,delete b.$id;if(z&&_)this.addMetaSchema(b,b[A],!1)}defaultMeta(){let{meta:_,schemaId:z}=this.opts;return this.opts.defaultMeta=typeof _=="object"?_[z]||_:void 0}validate(_,z){let A;if(typeof _=="string"){if(A=this.getSchema(_),!A)throw Error(`no schema with key or ref "${_}"`)}else A=this.compile(_);let b=A(z);if(!("$async"in A))this.errors=A.errors;return b}compile(_,z){let A=this._addSchema(_,z);return A.validate||this._compileSchemaEnv(A)}compileAsync(_,z){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:A}=this.opts;return b.call(this,_,z);async function b($,H){await G.call(this,$.$schema);let B=this._addSchema($,H);return B.validate||J.call(this,B)}async function G($){if($&&!this.getSchema($))await b.call(this,{$ref:$},!0)}async function J($){try{return this._compileSchemaEnv($)}catch(H){if(!(H instanceof Kq.default))throw H;return Y.call(this,H),await X.call(this,H.missingSchema),J.call(this,$)}}function Y({missingSchema:$,missingRef:H}){if(this.refs[$])throw Error(`AnySchema ${$} is loaded but ${H} cannot be resolved`)}async function X($){let H=await Q.call(this,$);if(!this.refs[$])await G.call(this,H.$schema);if(!this.refs[$])this.addSchema(H,$,z)}async function Q($){let H=this._loading[$];if(H)return H;try{return await(this._loading[$]=A($))}finally{delete this._loading[$]}}}addSchema(_,z,A,b=this.opts.validateSchema){if(Array.isArray(_)){for(let J of _)this.addSchema(J,void 0,A,b);return this}let G;if(typeof _==="object"){let{schemaId:J}=this.opts;if(G=_[J],G!==void 0&&typeof G!="string")throw Error(`schema ${J} must be string`)}return z=(0,V3.normalizeId)(z||G),this._checkUnique(z),this.schemas[z]=this._addSchema(_,A,z,b,!0),this}addMetaSchema(_,z,A=this.opts.validateSchema){return this.addSchema(_,z,!0,A),this}validateSchema(_,z){if(typeof _=="boolean")return!0;let A;if(A=_.$schema,A!==void 0&&typeof A!="string")throw Error("$schema must be a string");if(A=A||this.opts.defaultMeta||this.defaultMeta(),!A)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let b=this.validate(A,_);if(!b&&z){let G="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(G);else throw Error(G)}return b}getSchema(_){let z;while(typeof(z=Fq.call(this,_))=="string")_=z;if(z===void 0){let{schemaId:A}=this.opts,b=new W3.SchemaEnv({schema:{},schemaId:A});if(z=W3.resolveSchema.call(this,b,_),!z)return;this.refs[_]=z}return z.validate||this._compileSchemaEnv(z)}removeSchema(_){if(_ instanceof RegExp)return this._removeAllSchemas(this.schemas,_),this._removeAllSchemas(this.refs,_),this;switch(typeof _){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let z=Fq.call(this,_);if(typeof z=="object")this._cache.delete(z.schema);return delete this.schemas[_],delete this.refs[_],this}case"object":{let z=_;this._cache.delete(z);let A=_[this.opts.schemaId];if(A)A=(0,V3.normalizeId)(A),delete this.schemas[A],delete this.refs[A];return this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(_){for(let z of _)this.addKeyword(z);return this}addKeyword(_,z){let A;if(typeof _=="string"){if(A=_,typeof z=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),z.keyword=A}else if(typeof _=="object"&&z===void 0){if(z=_,A=z.keyword,Array.isArray(A)&&!A.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(og.call(this,A,z),!z)return(0,s7.eachItem)(A,(G)=>a7.call(this,G)),this;sg.call(this,z);let b={...z,type:(0,yA.getJSONTypes)(z.type),schemaType:(0,yA.getJSONTypes)(z.schemaType)};return(0,s7.eachItem)(A,b.type.length===0?(G)=>a7.call(this,G,b):(G)=>b.type.forEach((J)=>a7.call(this,G,b,J))),this}getKeyword(_){let z=this.RULES.all[_];return typeof z=="object"?z.definition:!!z}removeKeyword(_){let{RULES:z}=this;delete z.keywords[_],delete z.all[_];for(let A of z.rules){let b=A.rules.findIndex((G)=>G.keyword===_);if(b>=0)A.rules.splice(b,1)}return this}addFormat(_,z){if(typeof z=="string")z=new RegExp(z);return this.formats[_]=z,this}errorsText(_=this.errors,{separator:z=", ",dataVar:A="data"}={}){if(!_||_.length===0)return"No errors";return _.map((b)=>`${A}${b.instancePath} ${b.message}`).reduce((b,G)=>b+z+G)}$dataMetaSchema(_,z){let A=this.RULES.all;_=JSON.parse(JSON.stringify(_));for(let b of z){let G=b.split("/").slice(1),J=_;for(let Y of G)J=J[Y];for(let Y in A){let X=A[Y];if(typeof X!="object")continue;let{$data:Q}=X.definition,$=J[Y];if(Q&&$)J[Y]=Wq($)}}return _}_removeAllSchemas(_,z){for(let A in _){let b=_[A];if(!z||z.test(A)){if(typeof b=="string")delete _[A];else if(b&&!b.meta)this._cache.delete(b.schema),delete _[A]}}}_addSchema(_,z,A,b=this.opts.validateSchema,G=this.opts.addUsedSchema){let J,{schemaId:Y}=this.opts;if(typeof _=="object")J=_[Y];else if(this.opts.jtd)throw Error("schema must be object");else if(typeof _!="boolean")throw Error("schema must be object or boolean");let X=this._cache.get(_);if(X!==void 0)return X;A=(0,V3.normalizeId)(J||A);let Q=V3.getSchemaRefs.call(this,_,A);if(X=new W3.SchemaEnv({schema:_,schemaId:Y,meta:z,baseId:A,localRefs:Q}),this._cache.set(X.schema,X),G&&!A.startsWith("#")){if(A)this._checkUnique(A);this.refs[A]=X}if(b)this.validateSchema(_,!0);return X}_checkUnique(_){if(this.schemas[_]||this.refs[_])throw Error(`schema with key or id "${_}" already exists`)}_compileSchemaEnv(_){if(_.meta)this._compileMetaSchema(_);else W3.compileSchema.call(this,_);if(!_.validate)throw Error("ajv implementation error");return _.validate}_compileMetaSchema(_){let z=this.opts;this.opts=this._metaOpts;try{W3.compileSchema.call(this,_)}finally{this.opts=z}}}gA.ValidationError=Tg.default;gA.MissingRefError=Kq.default;f4.default=gA;function Zq(_,z,A,b="error"){for(let G in _){let J=G;if(J in z)this.logger[b](`${A}: option ${G}. ${_[J]}`)}}function Fq(_){return _=(0,V3.normalizeId)(_),this.schemas[_]||this.refs[_]}function cg(){let _=this.opts.schemas;if(!_)return;if(Array.isArray(_))this.addSchema(_);else for(let z in _)this.addSchema(_[z],z)}function lg(){for(let _ in this.opts.formats){let z=this.opts.formats[_];if(z)this.addFormat(_,z)}}function pg(_){if(Array.isArray(_)){this.addVocabulary(_);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let z in _){let A=_[z];if(!A.keyword)A.keyword=z;this.addKeyword(A)}}function dg(){let _={...this.opts};for(let z of gg)delete _[z];return _}var rg={log(){},warn(){},error(){}};function ng(_){if(_===!1)return rg;if(_===void 0)return console;if(_.log&&_.warn&&_.error)return _;throw Error("logger must implement log, warn and error methods")}var ig=/^[a-z_$][a-z0-9_$:-]*$/i;function og(_,z){let{RULES:A}=this;if((0,s7.eachItem)(_,(b)=>{if(A.keywords[b])throw Error(`Keyword ${b} is already defined`);if(!ig.test(b))throw Error(`Keyword ${b} has invalid name`)}),!z)return;if(z.$data&&!(("code"in z)||("validate"in z)))throw Error('$data keyword must have "code" or "validate" function')}function a7(_,z,A){var b;let G=z===null||z===void 0?void 0:z.post;if(A&&G)throw Error('keyword with "post" flag cannot have "type"');let{RULES:J}=this,Y=G?J.post:J.rules.find(({type:Q})=>Q===A);if(!Y)Y={type:A,rules:[]},J.rules.push(Y);if(J.keywords[_]=!0,!z)return;let X={keyword:_,definition:{...z,type:(0,yA.getJSONTypes)(z.type),schemaType:(0,yA.getJSONTypes)(z.schemaType)}};if(z.before)ag.call(this,Y,X,z.before);else Y.rules.push(X);J.all[_]=X,(b=z.implements)===null||b===void 0||b.forEach((Q)=>this.addKeyword(Q))}function ag(_,z,A){let b=_.rules.findIndex((G)=>G.keyword===A);if(b>=0)_.rules.splice(b,0,z);else _.rules.push(z),this.logger.warn(`rule ${A} is not defined`)}function sg(_){let{metaSchema:z}=_;if(z===void 0)return;if(_.$data&&this.opts.$data)z=Wq(z);_.validateSchema=this.compile(z,!0)}var tg={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Wq(_){return{anyOf:[_,tg]}}});var Dq=I((Uq)=>{Object.defineProperty(Uq,"__esModule",{value:!0});var zf={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Uq.default=zf});var Lq=I((Eq)=>{Object.defineProperty(Eq,"__esModule",{value:!0});Eq.callRef=Eq.getValidate=void 0;var bf=F3(),Mq=R9(),Z9=t(),l1=v4(),Nq=IA(),fA=Q0(),Gf={keyword:"$ref",schemaType:"string",code(_){let{gen:z,schema:A,it:b}=_,{baseId:G,schemaEnv:J,validateName:Y,opts:X,self:Q}=b,{root:$}=J;if((A==="#"||A==="#/")&&G===$.baseId)return B();let H=Nq.resolveRef.call(Q,$,G,A);if(H===void 0)throw new bf.default(b.opts.uriResolver,G,A);if(H instanceof Nq.SchemaEnv)return Z(H);return F(H);function B(){if(J===$)return hA(_,Y,J,J.$async);let K=z.scopeValue("root",{ref:$});return hA(_,Z9._`${K}.validate`,$,$.$async)}function Z(K){let q=wq(_,K);hA(_,q,K,K.$async)}function F(K){let q=z.scopeValue("schema",X.code.source===!0?{ref:K,code:(0,Z9.stringify)(K)}:{ref:K}),W=z.name("valid"),V=_.subschema({schema:K,dataTypes:[],schemaPath:Z9.nil,topSchemaRef:q,errSchemaPath:A},W);_.mergeEvaluated(V),_.ok(W)}}};function wq(_,z){let{gen:A}=_;return z.validate?A.scopeValue("validate",{ref:z.validate}):Z9._`${A.scopeValue("wrapper",{ref:z})}.validate`}Eq.getValidate=wq;function hA(_,z,A,b){let{gen:G,it:J}=_,{allErrors:Y,schemaEnv:X,opts:Q}=J,$=Q.passContext?l1.default.this:Z9.nil;if(b)H();else B();function H(){if(!X.$async)throw Error("async schema referenced by sync schema");let K=G.let("valid");G.try(()=>{if(G.code(Z9._`await ${(0,Mq.callValidateCode)(_,z,$)}`),F(z),!Y)G.assign(K,!0)},(q)=>{if(G.if(Z9._`!(${q} instanceof ${J.ValidationError})`,()=>G.throw(q)),Z(q),!Y)G.assign(K,!1)}),_.ok(K)}function B(){_.result((0,Mq.callValidateCode)(_,z,$),()=>F(z),()=>Z(z))}function Z(K){let q=Z9._`${K}.errors`;G.assign(l1.default.vErrors,Z9._`${l1.default.vErrors} === null ? ${q} : ${l1.default.vErrors}.concat(${q})`),G.assign(l1.default.errors,Z9._`${l1.default.vErrors}.length`)}function F(K){var q;if(!J.opts.unevaluated)return;let W=(q=A===null||A===void 0?void 0:A.validate)===null||q===void 0?void 0:q.evaluated;if(J.props!==!0)if(W&&!W.dynamicProps){if(W.props!==void 0)J.props=fA.mergeEvaluated.props(G,W.props,J.props)}else{let V=G.var("props",Z9._`${K}.evaluated.props`);J.props=fA.mergeEvaluated.props(G,V,J.props,Z9.Name)}if(J.items!==!0)if(W&&!W.dynamicItems){if(W.items!==void 0)J.items=fA.mergeEvaluated.items(G,W.items,J.items)}else{let V=G.var("items",Z9._`${K}.evaluated.items`);J.items=fA.mergeEvaluated.items(G,V,J.items,Z9.Name)}}}Eq.callRef=hA;Eq.default=Gf});var Rq=I((jq)=>{Object.defineProperty(jq,"__esModule",{value:!0});var Xf=Dq(),Qf=Lq(),$f=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",Xf.default,Qf.default];jq.default=$f});var Sq=I((Pq)=>{Object.defineProperty(Pq,"__esModule",{value:!0});var mA=t(),B_=mA.operators,uA={maximum:{okStr:"<=",ok:B_.LTE,fail:B_.GT},minimum:{okStr:">=",ok:B_.GTE,fail:B_.LT},exclusiveMaximum:{okStr:"<",ok:B_.LT,fail:B_.GTE},exclusiveMinimum:{okStr:">",ok:B_.GT,fail:B_.LTE}},Bf={message:({keyword:_,schemaCode:z})=>mA.str`must be ${uA[_].okStr} ${z}`,params:({keyword:_,schemaCode:z})=>mA._`{comparison: ${uA[_].okStr}, limit: ${z}}`},Zf={keyword:Object.keys(uA),type:"number",schemaType:"number",$data:!0,error:Bf,code(_){let{keyword:z,data:A,schemaCode:b}=_;_.fail$data(mA._`${A} ${uA[z].fail} ${b} || isNaN(${A})`)}};Pq.default=Zf});var Iq=I((kq)=>{Object.defineProperty(kq,"__esModule",{value:!0});var U3=t(),Kf={message:({schemaCode:_})=>U3.str`must be multiple of ${_}`,params:({schemaCode:_})=>U3._`{multipleOf: ${_}}`},qf={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:Kf,code(_){let{gen:z,data:A,schemaCode:b,it:G}=_,J=G.opts.multipleOfPrecision,Y=z.let("res"),X=J?U3._`Math.abs(Math.round(${Y}) - ${Y}) > 1e-${J}`:U3._`${Y} !== parseInt(${Y})`;_.fail$data(U3._`(${b} === 0 || (${Y} = ${A}/${b}, ${X}))`)}};kq.default=qf});var Cq=I((Tq)=>{Object.defineProperty(Tq,"__esModule",{value:!0});function xq(_){let z=_.length,A=0,b=0,G;while(b<z)if(A++,G=_.charCodeAt(b++),G>=55296&&G<=56319&&b<z){if(G=_.charCodeAt(b),(G&64512)===56320)b++}return A}Tq.default=xq;xq.code='require("ajv/dist/runtime/ucs2length").default'});var yq=I((vq)=>{Object.defineProperty(vq,"__esModule",{value:!0});var g_=t(),Uf=Q0(),Df=Cq(),Mf={message({keyword:_,schemaCode:z}){let A=_==="maxLength"?"more":"fewer";return g_.str`must NOT have ${A} than ${z} characters`},params:({schemaCode:_})=>g_._`{limit: ${_}}`},Nf={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:Mf,code(_){let{keyword:z,data:A,schemaCode:b,it:G}=_,J=z==="maxLength"?g_.operators.GT:g_.operators.LT,Y=G.opts.unicode===!1?g_._`${A}.length`:g_._`${(0,Uf.useFunc)(_.gen,Df.default)}(${A})`;_.fail$data(g_._`${Y} ${J} ${b}`)}};vq.default=Nf});var fq=I((gq)=>{Object.defineProperty(gq,"__esModule",{value:!0});var Ef=R9(),cA=t(),Of={message:({schemaCode:_})=>cA.str`must match pattern "${_}"`,params:({schemaCode:_})=>cA._`{pattern: ${_}}`},Lf={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:Of,code(_){let{data:z,$data:A,schema:b,schemaCode:G,it:J}=_,Y=J.opts.unicodeRegExp?"u":"",X=A?cA._`(new RegExp(${G}, ${Y}))`:(0,Ef.usePattern)(_,b);_.fail$data(cA._`!${X}.test(${z})`)}};gq.default=Lf});var mq=I((hq)=>{Object.defineProperty(hq,"__esModule",{value:!0});var D3=t(),Rf={message({keyword:_,schemaCode:z}){let A=_==="maxProperties"?"more":"fewer";return D3.str`must NOT have ${A} than ${z} properties`},params:({schemaCode:_})=>D3._`{limit: ${_}}`},Pf={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:Rf,code(_){let{keyword:z,data:A,schemaCode:b}=_,G=z==="maxProperties"?D3.operators.GT:D3.operators.LT;_.fail$data(D3._`Object.keys(${A}).length ${G} ${b}`)}};hq.default=Pf});var cq=I((uq)=>{Object.defineProperty(uq,"__esModule",{value:!0});var M3=R9(),N3=t(),kf=Q0(),If={message:({params:{missingProperty:_}})=>N3.str`must have required property '${_}'`,params:({params:{missingProperty:_}})=>N3._`{missingProperty: ${_}}`},xf={keyword:"required",type:"object",schemaType:"array",$data:!0,error:If,code(_){let{gen:z,schema:A,schemaCode:b,data:G,$data:J,it:Y}=_,{opts:X}=Y;if(!J&&A.length===0)return;let Q=A.length>=X.loopRequired;if(Y.allErrors)$();else H();if(X.strictRequired){let F=_.parentSchema.properties,{definedProperties:K}=_.it;for(let q of A)if((F===null||F===void 0?void 0:F[q])===void 0&&!K.has(q)){let W=Y.schemaEnv.baseId+Y.errSchemaPath,V=`required property "${q}" is not defined at "${W}" (strictRequired)`;(0,kf.checkStrictMode)(Y,V,Y.opts.strictRequired)}}function $(){if(Q||J)_.block$data(N3.nil,B);else for(let F of A)(0,M3.checkReportMissingProp)(_,F)}function H(){let F=z.let("missing");if(Q||J){let K=z.let("valid",!0);_.block$data(K,()=>Z(F,K)),_.ok(K)}else z.if((0,M3.checkMissingProp)(_,A,F)),(0,M3.reportMissingProp)(_,F),z.else()}function B(){z.forOf("prop",b,(F)=>{_.setParams({missingProperty:F}),z.if((0,M3.noPropertyInData)(z,G,F,X.ownProperties),()=>_.error())})}function Z(F,K){_.setParams({missingProperty:F}),z.forOf(F,b,()=>{z.assign(K,(0,M3.propertyInData)(z,G,F,X.ownProperties)),z.if((0,N3.not)(K),()=>{_.error(),z.break()})},N3.nil)}}};uq.default=xf});var pq=I((lq)=>{Object.defineProperty(lq,"__esModule",{value:!0});var w3=t(),Cf={message({keyword:_,schemaCode:z}){let A=_==="maxItems"?"more":"fewer";return w3.str`must NOT have ${A} than ${z} items`},params:({schemaCode:_})=>w3._`{limit: ${_}}`},vf={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:Cf,code(_){let{keyword:z,data:A,schemaCode:b}=_,G=z==="maxItems"?w3.operators.GT:w3.operators.LT;_.fail$data(w3._`${A}.length ${G} ${b}`)}};lq.default=vf});var lA=I((rq)=>{Object.defineProperty(rq,"__esModule",{value:!0});var dq=y7();dq.code='require("ajv/dist/runtime/equal").default';rq.default=dq});var iq=I((nq)=>{Object.defineProperty(nq,"__esModule",{value:!0});var t7=Q3(),l0=t(),ff=Q0(),hf=lA(),mf={message:({params:{i:_,j:z}})=>l0.str`must NOT have duplicate items (items ## ${z} and ${_} are identical)`,params:({params:{i:_,j:z}})=>l0._`{i: ${_}, j: ${z}}`},uf={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:mf,code(_){let{gen:z,data:A,$data:b,schema:G,parentSchema:J,schemaCode:Y,it:X}=_;if(!b&&!G)return;let Q=z.let("valid"),$=J.items?(0,t7.getSchemaTypes)(J.items):[];_.block$data(Q,H,l0._`${Y} === false`),_.ok(Q);function H(){let K=z.let("i",l0._`${A}.length`),q=z.let("j");_.setParams({i:K,j:q}),z.assign(Q,!0),z.if(l0._`${K} > 1`,()=>(B()?Z:F)(K,q))}function B(){return $.length>0&&!$.some((K)=>K==="object"||K==="array")}function Z(K,q){let W=z.name("item"),V=(0,t7.checkDataTypes)($,W,X.opts.strictNumbers,t7.DataType.Wrong),w=z.const("indices",l0._`{}`);z.for(l0._`;${K}--;`,()=>{if(z.let(W,l0._`${A}[${K}]`),z.if(V,l0._`continue`),$.length>1)z.if(l0._`typeof ${W} == "string"`,l0._`${W} += "_"`);z.if(l0._`typeof ${w}[${W}] == "number"`,()=>{z.assign(q,l0._`${w}[${W}]`),_.error(),z.assign(Q,!1).break()}).code(l0._`${w}[${W}] = ${K}`)})}function F(K,q){let W=(0,ff.useFunc)(z,hf.default),V=z.name("outer");z.label(V).for(l0._`;${K}--;`,()=>z.for(l0._`${q} = ${K}; ${q}--;`,()=>z.if(l0._`${W}(${A}[${K}], ${A}[${q}])`,()=>{_.error(),z.assign(Q,!1).break(V)})))}}};nq.default=uf});var aq=I((oq)=>{Object.defineProperty(oq,"__esModule",{value:!0});var e7=t(),lf=Q0(),pf=lA(),df={message:"must be equal to constant",params:({schemaCode:_})=>e7._`{allowedValue: ${_}}`},rf={keyword:"const",$data:!0,error:df,code(_){let{gen:z,data:A,$data:b,schemaCode:G,schema:J}=_;if(b||J&&typeof J=="object")_.fail$data(e7._`!${(0,lf.useFunc)(z,pf.default)}(${A}, ${G})`);else _.fail(e7._`${J} !== ${A}`)}};oq.default=rf});var tq=I((sq)=>{Object.defineProperty(sq,"__esModule",{value:!0});var E3=t(),of=Q0(),af=lA(),sf={message:"must be equal to one of the allowed values",params:({schemaCode:_})=>E3._`{allowedValues: ${_}}`},tf={keyword:"enum",schemaType:"array",$data:!0,error:sf,code(_){let{gen:z,data:A,$data:b,schema:G,schemaCode:J,it:Y}=_;if(!b&&G.length===0)throw Error("enum must have non-empty array");let X=G.length>=Y.opts.loopEnum,Q,$=()=>Q!==null&&Q!==void 0?Q:Q=(0,of.useFunc)(z,af.default),H;if(X||b)H=z.let("valid"),_.block$data(H,B);else{if(!Array.isArray(G))throw Error("ajv implementation error");let F=z.const("vSchema",J);H=(0,E3.or)(...G.map((K,q)=>Z(F,q)))}_.pass(H);function B(){z.assign(H,!1),z.forOf("v",J,(F)=>z.if(E3._`${$()}(${A}, ${F})`,()=>z.assign(H,!0).break()))}function Z(F,K){let q=G[K];return typeof q==="object"&&q!==null?E3._`${$()}(${A}, ${F}[${K}])`:E3._`${A} === ${q}`}}};sq.default=tf});var _W=I((eq)=>{Object.defineProperty(eq,"__esModule",{value:!0});var _h=Sq(),zh=Iq(),Ah=yq(),bh=fq(),Gh=mq(),Jh=cq(),Yh=pq(),Xh=iq(),Qh=aq(),$h=tq(),Hh=[_h.default,zh.default,Ah.default,bh.default,Gh.default,Jh.default,Yh.default,Xh.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},Qh.default,$h.default];eq.default=Hh});var zb=I((AW)=>{Object.defineProperty(AW,"__esModule",{value:!0});AW.validateAdditionalItems=void 0;var f_=t(),_b=Q0(),Zh={message:({params:{len:_}})=>f_.str`must NOT have more than ${_} items`,params:({params:{len:_}})=>f_._`{limit: ${_}}`},Fh={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:Zh,code(_){let{parentSchema:z,it:A}=_,{items:b}=z;if(!Array.isArray(b)){(0,_b.checkStrictMode)(A,'"additionalItems" is ignored when "items" is not an array of schemas');return}zW(_,b)}};function zW(_,z){let{gen:A,schema:b,data:G,keyword:J,it:Y}=_;Y.items=!0;let X=A.const("len",f_._`${G}.length`);if(b===!1)_.setParams({len:z.length}),_.pass(f_._`${X} <= ${z.length}`);else if(typeof b=="object"&&!(0,_b.alwaysValidSchema)(Y,b)){let $=A.var("valid",f_._`${X} <= ${z.length}`);A.if((0,f_.not)($),()=>Q($)),_.ok($)}function Q($){A.forRange("i",z.length,X,(H)=>{if(_.subschema({keyword:J,dataProp:H,dataPropType:_b.Type.Num},$),!Y.allErrors)A.if((0,f_.not)($),()=>A.break())})}}AW.validateAdditionalItems=zW;AW.default=Fh});var Ab=I((YW)=>{Object.defineProperty(YW,"__esModule",{value:!0});YW.validateTuple=void 0;var GW=t(),pA=Q0(),qh=R9(),Wh={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(_){let{schema:z,it:A}=_;if(Array.isArray(z))return JW(_,"additionalItems",z);if(A.items=!0,(0,pA.alwaysValidSchema)(A,z))return;_.ok((0,qh.validateArray)(_))}};function JW(_,z,A=_.schema){let{gen:b,parentSchema:G,data:J,keyword:Y,it:X}=_;if(H(G),X.opts.unevaluated&&A.length&&X.items!==!0)X.items=pA.mergeEvaluated.items(b,A.length,X.items);let Q=b.name("valid"),$=b.const("len",GW._`${J}.length`);A.forEach((B,Z)=>{if((0,pA.alwaysValidSchema)(X,B))return;b.if(GW._`${$} > ${Z}`,()=>_.subschema({keyword:Y,schemaProp:Z,dataProp:Z},Q)),_.ok(Q)});function H(B){let{opts:Z,errSchemaPath:F}=X,K=A.length,q=K===B.minItems&&(K===B.maxItems||B[z]===!1);if(Z.strictTuples&&!q){let W=`"${Y}" is ${K}-tuple, but minItems or maxItems/${z} are not specified or different at path "${F}"`;(0,pA.checkStrictMode)(X,W,Z.strictTuples)}}}YW.validateTuple=JW;YW.default=Wh});var $W=I((QW)=>{Object.defineProperty(QW,"__esModule",{value:!0});var Uh=Ab(),Dh={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(_)=>(0,Uh.validateTuple)(_,"items")};QW.default=Dh});var ZW=I((BW)=>{Object.defineProperty(BW,"__esModule",{value:!0});var HW=t(),Nh=Q0(),wh=R9(),Eh=zb(),Oh={message:({params:{len:_}})=>HW.str`must NOT have more than ${_} items`,params:({params:{len:_}})=>HW._`{limit: ${_}}`},Lh={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:Oh,code(_){let{schema:z,parentSchema:A,it:b}=_,{prefixItems:G}=A;if(b.items=!0,(0,Nh.alwaysValidSchema)(b,z))return;if(G)(0,Eh.validateAdditionalItems)(_,G);else _.ok((0,wh.validateArray)(_))}};BW.default=Lh});var KW=I((FW)=>{Object.defineProperty(FW,"__esModule",{value:!0});var P9=t(),dA=Q0(),Rh={message:({params:{min:_,max:z}})=>z===void 0?P9.str`must contain at least ${_} valid item(s)`:P9.str`must contain at least ${_} and no more than ${z} valid item(s)`,params:({params:{min:_,max:z}})=>z===void 0?P9._`{minContains: ${_}}`:P9._`{minContains: ${_}, maxContains: ${z}}`},Ph={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:Rh,code(_){let{gen:z,schema:A,parentSchema:b,data:G,it:J}=_,Y,X,{minContains:Q,maxContains:$}=b;if(J.opts.next)Y=Q===void 0?1:Q,X=$;else Y=1;let H=z.const("len",P9._`${G}.length`);if(_.setParams({min:Y,max:X}),X===void 0&&Y===0){(0,dA.checkStrictMode)(J,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(X!==void 0&&Y>X){(0,dA.checkStrictMode)(J,'"minContains" > "maxContains" is always invalid'),_.fail();return}if((0,dA.alwaysValidSchema)(J,A)){let q=P9._`${H} >= ${Y}`;if(X!==void 0)q=P9._`${q} && ${H} <= ${X}`;_.pass(q);return}J.items=!0;let B=z.name("valid");if(X===void 0&&Y===1)F(B,()=>z.if(B,()=>z.break()));else if(Y===0){if(z.let(B,!0),X!==void 0)z.if(P9._`${G}.length > 0`,Z)}else z.let(B,!1),Z();_.result(B,()=>_.reset());function Z(){let q=z.name("_valid"),W=z.let("count",0);F(q,()=>z.if(q,()=>K(W)))}function F(q,W){z.forRange("i",0,H,(V)=>{_.subschema({keyword:"contains",dataProp:V,dataPropType:dA.Type.Num,compositeRule:!0},q),W()})}function K(q){if(z.code(P9._`${q}++`),X===void 0)z.if(P9._`${q} >= ${Y}`,()=>z.assign(B,!0).break());else if(z.if(P9._`${q} > ${X}`,()=>z.assign(B,!1).break()),Y===1)z.assign(B,!0);else z.if(P9._`${q} >= ${Y}`,()=>z.assign(B,!0))}}};FW.default=Ph});var MW=I((VW)=>{Object.defineProperty(VW,"__esModule",{value:!0});VW.validateSchemaDeps=VW.validatePropertyDeps=VW.error=void 0;var bb=t(),kh=Q0(),O3=R9();VW.error={message:({params:{property:_,depsCount:z,deps:A}})=>{let b=z===1?"property":"properties";return bb.str`must have ${b} ${A} when property ${_} is present`},params:({params:{property:_,depsCount:z,deps:A,missingProperty:b}})=>bb._`{property: ${_},
31
+ || ${Y} === "boolean" || ${G} === null`).assign(X,a._`[${G}]`)}}}function Zv({gen:_,parentData:z,parentDataProperty:A},b){_.if(a._`${z} !== undefined`,()=>_.assign(a._`${z}[${A}]`,b))}function x7(_,z,A,b=u1.Correct){let G=b===u1.Correct?a.operators.EQ:a.operators.NEQ,J;switch(_){case"null":return a._`${z} ${G} null`;case"array":J=a._`Array.isArray(${z})`;break;case"object":J=a._`${z} && typeof ${z} == "object" && !Array.isArray(${z})`;break;case"integer":J=Y(a._`!(${z} % 1) && !isNaN(${z})`);break;case"number":J=Y();break;default:return a._`typeof ${z} ${G} ${_}`}return b===u1.Correct?J:(0,a.not)(J);function Y(X=a.nil){return(0,a.and)(a._`typeof ${z} == "number"`,X,A?a._`isFinite(${z})`:a.nil)}}eF.checkDataType=x7;function T7(_,z,A,b){if(_.length===1)return x7(_[0],z,A,b);let G,J=(0,aF.toHash)(_);if(J.array&&J.object){let Y=a._`typeof ${z} != "object"`;G=J.null?Y:a._`!${z} || ${Y}`,delete J.null,delete J.array,delete J.object}else G=a.nil;if(J.number)delete J.integer;for(let Y in J)G=(0,a.and)(G,x7(Y,z,A,b));return G}eF.checkDataTypes=T7;var Fv={message:({schema:_})=>`must be ${_}`,params:({schema:_,schemaValue:z})=>typeof _=="string"?a._`{type: ${_}}`:a._`{type: ${z}}`};function C7(_){let z=Kv(_);(0,Xv.reportError)(z,Fv)}eF.reportTypeError=C7;function Kv(_){let{gen:z,data:A,schema:b}=_,G=(0,aF.schemaRefOrVal)(_,b,"type");return{gen:z,keyword:"type",data:A,schema:b.type,schemaCode:G,schemaValue:G,parentSchema:b,params:{},it:_}}});var GK=I((AK)=>{Object.defineProperty(AK,"__esModule",{value:!0});AK.assignDefaults=void 0;var c1=t(),Nv=Q0();function wv(_,z){let{properties:A,items:b}=_.schema;if(z==="object"&&A)for(let G in A)zK(_,G,A[G].default);else if(z==="array"&&Array.isArray(b))b.forEach((G,J)=>zK(_,J,G.default))}AK.assignDefaults=wv;function zK(_,z,A){let{gen:b,compositeRule:G,data:J,opts:Y}=_;if(A===void 0)return;let X=c1._`${J}${(0,c1.getProperty)(z)}`;if(G){(0,Nv.checkStrictMode)(_,`default is ignored for: ${X}`);return}let Q=c1._`${X} === undefined`;if(Y.useDefaults==="empty")Q=c1._`${Q} || ${X} === null || ${X} === ""`;b.if(Q,c1._`${X} = ${(0,c1.stringify)(A)}`)}});var R9=I((XK)=>{Object.defineProperty(XK,"__esModule",{value:!0});XK.validateUnion=XK.validateArray=XK.usePattern=XK.callValidateCode=XK.schemaProperties=XK.allSchemaProperties=XK.noPropertyInData=XK.propertyInData=XK.isOwnProperty=XK.hasPropFunc=XK.reportMissingProp=XK.checkMissingProp=XK.checkReportMissingProp=void 0;var w0=t(),v7=Q0(),$_=v4(),Ev=Q0();function Ov(_,z){let{gen:A,data:b,it:G}=_;A.if(g7(A,b,z,G.opts.ownProperties),()=>{_.setParams({missingProperty:w0._`${z}`},!0),_.error()})}XK.checkReportMissingProp=Ov;function Lv({gen:_,data:z,it:{opts:A}},b,G){return(0,w0.or)(...b.map((J)=>(0,w0.and)(g7(_,z,J,A.ownProperties),w0._`${G} = ${J}`)))}XK.checkMissingProp=Lv;function jv(_,z){_.setParams({missingProperty:z},!0),_.error()}XK.reportMissingProp=jv;function JK(_){return _.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:w0._`Object.prototype.hasOwnProperty`})}XK.hasPropFunc=JK;function y7(_,z,A){return w0._`${JK(_)}.call(${z}, ${A})`}XK.isOwnProperty=y7;function Rv(_,z,A,b){let G=w0._`${z}${(0,w0.getProperty)(A)} !== undefined`;return b?w0._`${G} && ${y7(_,z,A)}`:G}XK.propertyInData=Rv;function g7(_,z,A,b){let G=w0._`${z}${(0,w0.getProperty)(A)} === undefined`;return b?(0,w0.or)(G,(0,w0.not)(y7(_,z,A))):G}XK.noPropertyInData=g7;function YK(_){return _?Object.keys(_).filter((z)=>z!=="__proto__"):[]}XK.allSchemaProperties=YK;function Pv(_,z){return YK(z).filter((A)=>!(0,v7.alwaysValidSchema)(_,z[A]))}XK.schemaProperties=Pv;function Sv({schemaCode:_,data:z,it:{gen:A,topSchemaRef:b,schemaPath:G,errorPath:J},it:Y},X,Q,$){let H=$?w0._`${_}, ${z}, ${b}${G}`:z,B=[[$_.default.instancePath,(0,w0.strConcat)($_.default.instancePath,J)],[$_.default.parentData,Y.parentData],[$_.default.parentDataProperty,Y.parentDataProperty],[$_.default.rootData,$_.default.rootData]];if(Y.opts.dynamicRef)B.push([$_.default.dynamicAnchors,$_.default.dynamicAnchors]);let Z=w0._`${H}, ${A.object(...B)}`;return Q!==w0.nil?w0._`${X}.call(${Q}, ${Z})`:w0._`${X}(${Z})`}XK.callValidateCode=Sv;var kv=w0._`new RegExp`;function Iv({gen:_,it:{opts:z}},A){let b=z.unicodeRegExp?"u":"",{regExp:G}=z.code,J=G(A,b);return _.scopeValue("pattern",{key:J.toString(),ref:J,code:w0._`${G.code==="new RegExp"?kv:(0,Ev.useFunc)(_,G)}(${A}, ${b})`})}XK.usePattern=Iv;function xv(_){let{gen:z,data:A,keyword:b,it:G}=_,J=z.name("valid");if(G.allErrors){let X=z.let("valid",!0);return Y(()=>z.assign(X,!1)),X}return z.var(J,!0),Y(()=>z.break()),J;function Y(X){let Q=z.const("len",w0._`${A}.length`);z.forRange("i",0,Q,($)=>{_.subschema({keyword:b,dataProp:$,dataPropType:v7.Type.Num},J),z.if((0,w0.not)(J),X)})}}XK.validateArray=xv;function Tv(_){let{gen:z,schema:A,keyword:b,it:G}=_;if(!Array.isArray(A))throw Error("ajv implementation error");if(A.some((Q)=>(0,v7.alwaysValidSchema)(G,Q))&&!G.opts.unevaluated)return;let Y=z.let("valid",!1),X=z.name("_valid");z.block(()=>A.forEach((Q,$)=>{let H=_.subschema({keyword:b,schemaProp:$,compositeRule:!0},X);if(z.assign(Y,w0._`${Y} || ${X}`),!_.mergeValidEvaluated(H,X))z.if((0,w0.not)(Y))})),_.result(Y,()=>_.reset(),()=>_.error(!0))}XK.validateUnion=Tv});var FK=I((BK)=>{Object.defineProperty(BK,"__esModule",{value:!0});BK.validateKeywordUsage=BK.validSchemaType=BK.funcKeywordCode=BK.macroKeywordCode=void 0;var G9=t(),y_=v4(),rv=R9(),nv=$3();function iv(_,z){let{gen:A,keyword:b,schema:G,parentSchema:J,it:Y}=_,X=z.macro.call(Y.self,G,J,Y),Q=HK(A,b,X);if(Y.opts.validateSchema!==!1)Y.self.validateSchema(X,!0);let $=A.name("valid");_.subschema({schema:X,schemaPath:G9.nil,errSchemaPath:`${Y.errSchemaPath}/${b}`,topSchemaRef:Q,compositeRule:!0},$),_.pass($,()=>_.error(!0))}BK.macroKeywordCode=iv;function ov(_,z){var A;let{gen:b,keyword:G,schema:J,parentSchema:Y,$data:X,it:Q}=_;sv(Q,z);let $=!X&&z.compile?z.compile.call(Q.self,J,Y,Q):z.validate,H=HK(b,G,$),B=b.let("valid");_.block$data(B,Z),_.ok((A=z.valid)!==null&&A!==void 0?A:B);function Z(){if(z.errors===!1){if(q(),z.modifying)$K(_);W(()=>_.error())}else{let V=z.async?F():K();if(z.modifying)$K(_);W(()=>av(_,V))}}function F(){let V=b.let("ruleErrs",null);return b.try(()=>q(G9._`await `),(w)=>b.assign(B,!1).if(G9._`${w} instanceof ${Q.ValidationError}`,()=>b.assign(V,G9._`${w}.errors`),()=>b.throw(w))),V}function K(){let V=G9._`${H}.errors`;return b.assign(V,null),q(G9.nil),V}function q(V=z.async?G9._`await `:G9.nil){let w=Q.opts.passContext?y_.default.this:y_.default.self,O=!(("compile"in z)&&!X||z.schema===!1);b.assign(B,G9._`${V}${(0,rv.callValidateCode)(_,H,w,O)}`,z.modifying)}function W(V){var w;b.if((0,G9.not)((w=z.valid)!==null&&w!==void 0?w:B),V)}}BK.funcKeywordCode=ov;function $K(_){let{gen:z,data:A,it:b}=_;z.if(b.parentData,()=>z.assign(A,G9._`${b.parentData}[${b.parentDataProperty}]`))}function av(_,z){let{gen:A}=_;A.if(G9._`Array.isArray(${z})`,()=>{A.assign(y_.default.vErrors,G9._`${y_.default.vErrors} === null ? ${z} : ${y_.default.vErrors}.concat(${z})`).assign(y_.default.errors,G9._`${y_.default.vErrors}.length`),(0,nv.extendErrors)(_)},()=>_.error())}function sv({schemaEnv:_},z){if(z.async&&!_.$async)throw Error("async keyword in sync schema")}function HK(_,z,A){if(A===void 0)throw Error(`keyword "${z}" failed to compile`);return _.scopeValue("keyword",typeof A=="function"?{ref:A}:{ref:A,code:(0,G9.stringify)(A)})}function tv(_,z,A=!1){return!z.length||z.some((b)=>b==="array"?Array.isArray(_):b==="object"?_&&typeof _=="object"&&!Array.isArray(_):typeof _==b||A&&typeof _>"u")}BK.validSchemaType=tv;function ev({schema:_,opts:z,self:A,errSchemaPath:b},G,J){if(Array.isArray(G.keyword)?!G.keyword.includes(J):G.keyword!==J)throw Error("ajv implementation error");let Y=G.dependencies;if(Y===null||Y===void 0?void 0:Y.some((X)=>!Object.prototype.hasOwnProperty.call(_,X)))throw Error(`parent schema must have dependencies of ${J}: ${Y.join(",")}`);if(G.validateSchema){if(!G.validateSchema(_[J])){let Q=`keyword "${J}" value is invalid at path "${b}": `+A.errorsText(G.validateSchema.errors);if(z.validateSchema==="log")A.logger.error(Q);else throw Error(Q)}}}BK.validateKeywordUsage=ev});var VK=I((qK)=>{Object.defineProperty(qK,"__esModule",{value:!0});qK.extendSubschemaMode=qK.extendSubschemaData=qK.getSubschema=void 0;var Z4=t(),KK=Q0();function by(_,{keyword:z,schemaProp:A,schema:b,schemaPath:G,errSchemaPath:J,topSchemaRef:Y}){if(z!==void 0&&b!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(z!==void 0){let X=_.schema[z];return A===void 0?{schema:X,schemaPath:Z4._`${_.schemaPath}${(0,Z4.getProperty)(z)}`,errSchemaPath:`${_.errSchemaPath}/${z}`}:{schema:X[A],schemaPath:Z4._`${_.schemaPath}${(0,Z4.getProperty)(z)}${(0,Z4.getProperty)(A)}`,errSchemaPath:`${_.errSchemaPath}/${z}/${(0,KK.escapeFragment)(A)}`}}if(b!==void 0){if(G===void 0||J===void 0||Y===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:b,schemaPath:G,topSchemaRef:Y,errSchemaPath:J}}throw Error('either "keyword" or "schema" must be passed')}qK.getSubschema=by;function Gy(_,z,{dataProp:A,dataPropType:b,data:G,dataTypes:J,propertyName:Y}){if(G!==void 0&&A!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:X}=z;if(A!==void 0){let{errorPath:$,dataPathArr:H,opts:B}=z,Z=X.let("data",Z4._`${z.data}${(0,Z4.getProperty)(A)}`,!0);Q(Z),_.errorPath=Z4.str`${$}${(0,KK.getErrorPath)(A,b,B.jsPropertySyntax)}`,_.parentDataProperty=Z4._`${A}`,_.dataPathArr=[...H,_.parentDataProperty]}if(G!==void 0){let $=G instanceof Z4.Name?G:X.let("data",G,!0);if(Q($),Y!==void 0)_.propertyName=Y}if(J)_.dataTypes=J;function Q($){_.data=$,_.dataLevel=z.dataLevel+1,_.dataTypes=[],z.definedProperties=new Set,_.parentData=z.data,_.dataNames=[...z.dataNames,$]}}qK.extendSubschemaData=Gy;function Jy(_,{jtdDiscriminator:z,jtdMetadata:A,compositeRule:b,createErrors:G,allErrors:J}){if(b!==void 0)_.compositeRule=b;if(G!==void 0)_.createErrors=G;if(J!==void 0)_.allErrors=J;_.jtdDiscriminator=z,_.jtdMetadata=A}qK.extendSubschemaMode=Jy});var f7=I((C30,UK)=>{UK.exports=function _(z,A){if(z===A)return!0;if(z&&A&&typeof z=="object"&&typeof A=="object"){if(z.constructor!==A.constructor)return!1;var b,G,J;if(Array.isArray(z)){if(b=z.length,b!=A.length)return!1;for(G=b;G--!==0;)if(!_(z[G],A[G]))return!1;return!0}if(z.constructor===RegExp)return z.source===A.source&&z.flags===A.flags;if(z.valueOf!==Object.prototype.valueOf)return z.valueOf()===A.valueOf();if(z.toString!==Object.prototype.toString)return z.toString()===A.toString();if(J=Object.keys(z),b=J.length,b!==Object.keys(A).length)return!1;for(G=b;G--!==0;)if(!Object.prototype.hasOwnProperty.call(A,J[G]))return!1;for(G=b;G--!==0;){var Y=J[G];if(!_(z[Y],A[Y]))return!1}return!0}return z!==z&&A!==A}});var MK=I((v30,DK)=>{var H_=DK.exports=function(_,z,A){if(typeof z=="function")A=z,z={};A=z.cb||A;var b=typeof A=="function"?A:A.pre||function(){},G=A.post||function(){};kA(z,b,G,_,"",_)};H_.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};H_.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};H_.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};H_.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 kA(_,z,A,b,G,J,Y,X,Q,$){if(b&&typeof b=="object"&&!Array.isArray(b)){z(b,G,J,Y,X,Q,$);for(var H in b){var B=b[H];if(Array.isArray(B)){if(H in H_.arrayKeywords)for(var Z=0;Z<B.length;Z++)kA(_,z,A,B[Z],G+"/"+H+"/"+Z,J,G,H,b,Z)}else if(H in H_.propsKeywords){if(B&&typeof B=="object")for(var F in B)kA(_,z,A,B[F],G+"/"+H+"/"+Qy(F),J,G,H,b,F)}else if(H in H_.keywords||_.allKeys&&!(H in H_.skipKeywords))kA(_,z,A,B,G+"/"+H,J,G,H,b)}A(b,G,J,Y,X,Q,$)}}function Qy(_){return _.replace(/~/g,"~0").replace(/\//g,"~1")}});var B3=I((OK)=>{Object.defineProperty(OK,"__esModule",{value:!0});OK.getSchemaRefs=OK.resolveUrl=OK.normalizeId=OK._getFullPath=OK.getFullPath=OK.inlineRef=void 0;var $y=Q0(),Hy=f7(),By=MK(),Zy=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function Fy(_,z=!0){if(typeof _=="boolean")return!0;if(z===!0)return!h7(_);if(!z)return!1;return NK(_)<=z}OK.inlineRef=Fy;var Ky=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function h7(_){for(let z in _){if(Ky.has(z))return!0;let A=_[z];if(Array.isArray(A)&&A.some(h7))return!0;if(typeof A=="object"&&h7(A))return!0}return!1}function NK(_){let z=0;for(let A in _){if(A==="$ref")return 1/0;if(z++,Zy.has(A))continue;if(typeof _[A]=="object")(0,$y.eachItem)(_[A],(b)=>z+=NK(b));if(z===1/0)return 1/0}return z}function wK(_,z="",A){if(A!==!1)z=l1(z);let b=_.parse(z);return EK(_,b)}OK.getFullPath=wK;function EK(_,z){return _.serialize(z).split("#")[0]+"#"}OK._getFullPath=EK;var qy=/#\/?$/;function l1(_){return _?_.replace(qy,""):""}OK.normalizeId=l1;function Wy(_,z,A){return A=l1(A),_.resolve(z,A)}OK.resolveUrl=Wy;var Vy=/^[a-z_][-a-z0-9._]*$/i;function Uy(_,z){if(typeof _=="boolean")return{};let{schemaId:A,uriResolver:b}=this.opts,G=l1(_[A]||z),J={"":G},Y=wK(b,G,!1),X={},Q=new Set;return By(_,{allKeys:!0},(B,Z,F,K)=>{if(K===void 0)return;let q=Y+Z,W=J[K];if(typeof B[A]=="string")W=V.call(this,B[A]);w.call(this,B.$anchor),w.call(this,B.$dynamicAnchor),J[Z]=W;function V(O){let M=this.opts.uriResolver.resolve;if(O=l1(W?M(W,O):O),Q.has(O))throw H(O);Q.add(O);let P=this.refs[O];if(typeof P=="string")P=this.refs[P];if(typeof P=="object")$(B,P.schema,O);else if(O!==l1(q))if(O[0]==="#")$(B,X[O],O),X[O]=B;else this.refs[O]=q;return O}function w(O){if(typeof O=="string"){if(!Vy.test(O))throw Error(`invalid anchor "${O}"`);V.call(this,`#${O}`)}}}),X;function $(B,Z,F){if(Z!==void 0&&!Hy(B,Z))throw H(F)}function H(B){return Error(`reference "${B}" resolves to more than one schema`)}}OK.getSchemaRefs=Uy});var K3=I((mK)=>{Object.defineProperty(mK,"__esModule",{value:!0});mK.getData=mK.KeywordCxt=mK.validateFunctionCode=void 0;var kK=lF(),jK=H3(),u7=I7(),IA=H3(),Oy=GK(),F3=FK(),m7=VK(),h=t(),n=v4(),Ly=B3(),y4=Q0(),Z3=$3();function jy(_){if(TK(_)){if(CK(_),xK(_)){Sy(_);return}}IK(_,()=>(0,kK.topBoolOrEmptySchema)(_))}mK.validateFunctionCode=jy;function IK({gen:_,validateName:z,schema:A,schemaEnv:b,opts:G},J){if(G.code.es5)_.func(z,h._`${n.default.data}, ${n.default.valCxt}`,b.$async,()=>{_.code(h._`"use strict"; ${RK(A,G)}`),Py(_,G),_.code(J)});else _.func(z,h._`${n.default.data}, ${Ry(G)}`,b.$async,()=>_.code(RK(A,G)).code(J))}function Ry(_){return h._`{${n.default.instancePath}="", ${n.default.parentData}, ${n.default.parentDataProperty}, ${n.default.rootData}=${n.default.data}${_.dynamicRef?h._`, ${n.default.dynamicAnchors}={}`:h.nil}}={}`}function Py(_,z){_.if(n.default.valCxt,()=>{if(_.var(n.default.instancePath,h._`${n.default.valCxt}.${n.default.instancePath}`),_.var(n.default.parentData,h._`${n.default.valCxt}.${n.default.parentData}`),_.var(n.default.parentDataProperty,h._`${n.default.valCxt}.${n.default.parentDataProperty}`),_.var(n.default.rootData,h._`${n.default.valCxt}.${n.default.rootData}`),z.dynamicRef)_.var(n.default.dynamicAnchors,h._`${n.default.valCxt}.${n.default.dynamicAnchors}`)},()=>{if(_.var(n.default.instancePath,h._`""`),_.var(n.default.parentData,h._`undefined`),_.var(n.default.parentDataProperty,h._`undefined`),_.var(n.default.rootData,n.default.data),z.dynamicRef)_.var(n.default.dynamicAnchors,h._`{}`)})}function Sy(_){let{schema:z,opts:A,gen:b}=_;IK(_,()=>{if(A.$comment&&z.$comment)yK(_);if(Cy(_),b.let(n.default.vErrors,null),b.let(n.default.errors,0),A.unevaluated)ky(_);vK(_),gy(_)});return}function ky(_){let{gen:z,validateName:A}=_;_.evaluated=z.const("evaluated",h._`${A}.evaluated`),z.if(h._`${_.evaluated}.dynamicProps`,()=>z.assign(h._`${_.evaluated}.props`,h._`undefined`)),z.if(h._`${_.evaluated}.dynamicItems`,()=>z.assign(h._`${_.evaluated}.items`,h._`undefined`))}function RK(_,z){let A=typeof _=="object"&&_[z.schemaId];return A&&(z.code.source||z.code.process)?h._`/*# sourceURL=${A} */`:h.nil}function Iy(_,z){if(TK(_)){if(CK(_),xK(_)){xy(_,z);return}}(0,kK.boolOrEmptySchema)(_,z)}function xK({schema:_,self:z}){if(typeof _=="boolean")return!_;for(let A in _)if(z.RULES.all[A])return!0;return!1}function TK(_){return typeof _.schema!="boolean"}function xy(_,z){let{schema:A,gen:b,opts:G}=_;if(G.$comment&&A.$comment)yK(_);vy(_),yy(_);let J=b.const("_errs",n.default.errors);vK(_,J),b.var(z,h._`${J} === ${n.default.errors}`)}function CK(_){(0,y4.checkUnknownRules)(_),Ty(_)}function vK(_,z){if(_.opts.jtd)return PK(_,[],!1,z);let A=(0,jK.getSchemaTypes)(_.schema),b=(0,jK.coerceAndCheckDataType)(_,A);PK(_,A,!b,z)}function Ty(_){let{schema:z,errSchemaPath:A,opts:b,self:G}=_;if(z.$ref&&b.ignoreKeywordsWithRef&&(0,y4.schemaHasRulesButRef)(z,G.RULES))G.logger.warn(`$ref: keywords ignored in schema at path "${A}"`)}function Cy(_){let{schema:z,opts:A}=_;if(z.default!==void 0&&A.useDefaults&&A.strictSchema)(0,y4.checkStrictMode)(_,"default is ignored in the schema root")}function vy(_){let z=_.schema[_.opts.schemaId];if(z)_.baseId=(0,Ly.resolveUrl)(_.opts.uriResolver,_.baseId,z)}function yy(_){if(_.schema.$async&&!_.schemaEnv.$async)throw Error("async schema in sync schema")}function yK({gen:_,schemaEnv:z,schema:A,errSchemaPath:b,opts:G}){let J=A.$comment;if(G.$comment===!0)_.code(h._`${n.default.self}.logger.log(${J})`);else if(typeof G.$comment=="function"){let Y=h.str`${b}/$comment`,X=_.scopeValue("root",{ref:z.root});_.code(h._`${n.default.self}.opts.$comment(${J}, ${Y}, ${X}.schema)`)}}function gy(_){let{gen:z,schemaEnv:A,validateName:b,ValidationError:G,opts:J}=_;if(A.$async)z.if(h._`${n.default.errors} === 0`,()=>z.return(n.default.data),()=>z.throw(h._`new ${G}(${n.default.vErrors})`));else{if(z.assign(h._`${b}.errors`,n.default.vErrors),J.unevaluated)fy(_);z.return(h._`${n.default.errors} === 0`)}}function fy({gen:_,evaluated:z,props:A,items:b}){if(A instanceof h.Name)_.assign(h._`${z}.props`,A);if(b instanceof h.Name)_.assign(h._`${z}.items`,b)}function PK(_,z,A,b){let{gen:G,schema:J,data:Y,allErrors:X,opts:Q,self:$}=_,{RULES:H}=$;if(J.$ref&&(Q.ignoreKeywordsWithRef||!(0,y4.schemaHasRulesButRef)(J,H))){G.block(()=>fK(_,"$ref",H.all.$ref.definition));return}if(!Q.jtd)hy(_,z);G.block(()=>{for(let Z of H.rules)B(Z);B(H.post)});function B(Z){if(!(0,u7.shouldUseGroup)(J,Z))return;if(Z.type){if(G.if((0,IA.checkDataType)(Z.type,Y,Q.strictNumbers)),SK(_,Z),z.length===1&&z[0]===Z.type&&A)G.else(),(0,IA.reportTypeError)(_);G.endIf()}else SK(_,Z);if(!X)G.if(h._`${n.default.errors} === ${b||0}`)}}function SK(_,z){let{gen:A,schema:b,opts:{useDefaults:G}}=_;if(G)(0,Oy.assignDefaults)(_,z.type);A.block(()=>{for(let J of z.rules)if((0,u7.shouldUseRule)(b,J))fK(_,J.keyword,J.definition,z.type)})}function hy(_,z){if(_.schemaEnv.meta||!_.opts.strictTypes)return;if(my(_,z),!_.opts.allowUnionTypes)uy(_,z);cy(_,_.dataTypes)}function my(_,z){if(!z.length)return;if(!_.dataTypes.length){_.dataTypes=z;return}z.forEach((A)=>{if(!gK(_.dataTypes,A))c7(_,`type "${A}" not allowed by context "${_.dataTypes.join(",")}"`)}),py(_,z)}function uy(_,z){if(z.length>1&&!(z.length===2&&z.includes("null")))c7(_,"use allowUnionTypes to allow union type keyword")}function cy(_,z){let A=_.self.RULES.all;for(let b in A){let G=A[b];if(typeof G=="object"&&(0,u7.shouldUseRule)(_.schema,G)){let{type:J}=G.definition;if(J.length&&!J.some((Y)=>ly(z,Y)))c7(_,`missing type "${J.join(",")}" for keyword "${b}"`)}}}function ly(_,z){return _.includes(z)||z==="number"&&_.includes("integer")}function gK(_,z){return _.includes(z)||z==="integer"&&_.includes("number")}function py(_,z){let A=[];for(let b of _.dataTypes)if(gK(z,b))A.push(b);else if(z.includes("integer")&&b==="number")A.push("integer");_.dataTypes=A}function c7(_,z){let A=_.schemaEnv.baseId+_.errSchemaPath;z+=` at "${A}" (strictTypes)`,(0,y4.checkStrictMode)(_,z,_.opts.strictTypes)}class l7{constructor(_,z,A){if((0,F3.validateKeywordUsage)(_,z,A),this.gen=_.gen,this.allErrors=_.allErrors,this.keyword=A,this.data=_.data,this.schema=_.schema[A],this.$data=z.$data&&_.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,y4.schemaRefOrVal)(_,this.schema,A,this.$data),this.schemaType=z.schemaType,this.parentSchema=_.schema,this.params={},this.it=_,this.def=z,this.$data)this.schemaCode=_.gen.const("vSchema",hK(this.$data,_));else if(this.schemaCode=this.schemaValue,!(0,F3.validSchemaType)(this.schema,z.schemaType,z.allowUndefined))throw Error(`${A} value must be ${JSON.stringify(z.schemaType)}`);if("code"in z?z.trackErrors:z.errors!==!1)this.errsCount=_.gen.const("_errs",n.default.errors)}result(_,z,A){this.failResult((0,h.not)(_),z,A)}failResult(_,z,A){if(this.gen.if(_),A)A();else this.error();if(z){if(this.gen.else(),z(),this.allErrors)this.gen.endIf()}else if(this.allErrors)this.gen.endIf();else this.gen.else()}pass(_,z){this.failResult((0,h.not)(_),void 0,z)}fail(_){if(_===void 0){if(this.error(),!this.allErrors)this.gen.if(!1);return}if(this.gen.if(_),this.error(),this.allErrors)this.gen.endIf();else this.gen.else()}fail$data(_){if(!this.$data)return this.fail(_);let{schemaCode:z}=this;this.fail(h._`${z} !== undefined && (${(0,h.or)(this.invalid$data(),_)})`)}error(_,z,A){if(z){this.setParams(z),this._error(_,A),this.setParams({});return}this._error(_,A)}_error(_,z){(_?Z3.reportExtraError:Z3.reportError)(this,this.def.error,z)}$dataError(){(0,Z3.reportError)(this,this.def.$dataError||Z3.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');(0,Z3.resetErrorsCount)(this.gen,this.errsCount)}ok(_){if(!this.allErrors)this.gen.if(_)}setParams(_,z){if(z)Object.assign(this.params,_);else this.params=_}block$data(_,z,A=h.nil){this.gen.block(()=>{this.check$data(_,A),z()})}check$data(_=h.nil,z=h.nil){if(!this.$data)return;let{gen:A,schemaCode:b,schemaType:G,def:J}=this;if(A.if((0,h.or)(h._`${b} === undefined`,z)),_!==h.nil)A.assign(_,!0);if(G.length||J.validateSchema){if(A.elseIf(this.invalid$data()),this.$dataError(),_!==h.nil)A.assign(_,!1)}A.else()}invalid$data(){let{gen:_,schemaCode:z,schemaType:A,def:b,it:G}=this;return(0,h.or)(J(),Y());function J(){if(A.length){if(!(z instanceof h.Name))throw Error("ajv implementation error");let X=Array.isArray(A)?A:[A];return h._`${(0,IA.checkDataTypes)(X,z,G.opts.strictNumbers,IA.DataType.Wrong)}`}return h.nil}function Y(){if(b.validateSchema){let X=_.scopeValue("validate$data",{ref:b.validateSchema});return h._`!${X}(${z})`}return h.nil}}subschema(_,z){let A=(0,m7.getSubschema)(this.it,_);(0,m7.extendSubschemaData)(A,this.it,_),(0,m7.extendSubschemaMode)(A,_);let b={...this.it,...A,items:void 0,props:void 0};return Iy(b,z),b}mergeEvaluated(_,z){let{it:A,gen:b}=this;if(!A.opts.unevaluated)return;if(A.props!==!0&&_.props!==void 0)A.props=y4.mergeEvaluated.props(b,_.props,A.props,z);if(A.items!==!0&&_.items!==void 0)A.items=y4.mergeEvaluated.items(b,_.items,A.items,z)}mergeValidEvaluated(_,z){let{it:A,gen:b}=this;if(A.opts.unevaluated&&(A.props!==!0||A.items!==!0))return b.if(z,()=>this.mergeEvaluated(_,h.Name)),!0}}mK.KeywordCxt=l7;function fK(_,z,A,b){let G=new l7(_,A,z);if("code"in A)A.code(G,b);else if(G.$data&&A.validate)(0,F3.funcKeywordCode)(G,A);else if("macro"in A)(0,F3.macroKeywordCode)(G,A);else if(A.compile||A.validate)(0,F3.funcKeywordCode)(G,A)}var dy=/^\/(?:[^~]|~0|~1)*$/,ry=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function hK(_,{dataLevel:z,dataNames:A,dataPathArr:b}){let G,J;if(_==="")return n.default.rootData;if(_[0]==="/"){if(!dy.test(_))throw Error(`Invalid JSON-pointer: ${_}`);G=_,J=n.default.rootData}else{let $=ry.exec(_);if(!$)throw Error(`Invalid JSON-pointer: ${_}`);let H=+$[1];if(G=$[2],G==="#"){if(H>=z)throw Error(Q("property/index",H));return b[z-H]}if(H>z)throw Error(Q("data",H));if(J=A[z-H],!G)return J}let Y=J,X=G.split("/");for(let $ of X)if($)J=h._`${J}${(0,h.getProperty)((0,y4.unescapeJsonPointer)($))}`,Y=h._`${Y} && ${J}`;return Y;function Q($,H){return`Cannot access ${$} ${H} levels up, current level is ${z}`}}mK.getData=hK});var xA=I((lK)=>{Object.defineProperty(lK,"__esModule",{value:!0});class cK extends Error{constructor(_){super("validation failed");this.errors=_,this.ajv=this.validation=!0}}lK.default=cK});var q3=I((dK)=>{Object.defineProperty(dK,"__esModule",{value:!0});var p7=B3();class pK extends Error{constructor(_,z,A,b){super(b||`can't resolve reference ${A} from id ${z}`);this.missingRef=(0,p7.resolveUrl)(_,z,A),this.missingSchema=(0,p7.normalizeId)((0,p7.getFullPath)(_,this.missingRef))}}dK.default=pK});var CA=I((iK)=>{Object.defineProperty(iK,"__esModule",{value:!0});iK.resolveSchema=iK.getCompilingSchema=iK.resolveRef=iK.compileSchema=iK.SchemaEnv=void 0;var n9=t(),sy=xA(),g_=v4(),i9=B3(),rK=Q0(),ty=K3();class W3{constructor(_){var z;this.refs={},this.dynamicAnchors={};let A;if(typeof _.schema=="object")A=_.schema;this.schema=_.schema,this.schemaId=_.schemaId,this.root=_.root||this,this.baseId=(z=_.baseId)!==null&&z!==void 0?z:(0,i9.normalizeId)(A===null||A===void 0?void 0:A[_.schemaId||"$id"]),this.schemaPath=_.schemaPath,this.localRefs=_.localRefs,this.meta=_.meta,this.$async=A===null||A===void 0?void 0:A.$async,this.refs={}}}iK.SchemaEnv=W3;function r7(_){let z=nK.call(this,_);if(z)return z;let A=(0,i9.getFullPath)(this.opts.uriResolver,_.root.baseId),{es5:b,lines:G}=this.opts.code,{ownProperties:J}=this.opts,Y=new n9.CodeGen(this.scope,{es5:b,lines:G,ownProperties:J}),X;if(_.$async)X=Y.scopeValue("Error",{ref:sy.default,code:n9._`require("ajv/dist/runtime/validation_error").default`});let Q=Y.scopeName("validate");_.validateName=Q;let $={gen:Y,allErrors:this.opts.allErrors,data:g_.default.data,parentData:g_.default.parentData,parentDataProperty:g_.default.parentDataProperty,dataNames:[g_.default.data],dataPathArr:[n9.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:Y.scopeValue("schema",this.opts.code.source===!0?{ref:_.schema,code:(0,n9.stringify)(_.schema)}:{ref:_.schema}),validateName:Q,ValidationError:X,schema:_.schema,schemaEnv:_,rootId:A,baseId:_.baseId||A,schemaPath:n9.nil,errSchemaPath:_.schemaPath||(this.opts.jtd?"":"#"),errorPath:n9._`""`,opts:this.opts,self:this},H;try{this._compilations.add(_),(0,ty.validateFunctionCode)($),Y.optimize(this.opts.code.optimize);let B=Y.toString();if(H=`${Y.scopeRefs(g_.default.scope)}return ${B}`,this.opts.code.process)H=this.opts.code.process(H,_);let F=Function(`${g_.default.self}`,`${g_.default.scope}`,H)(this,this.scope.get());if(this.scope.value(Q,{ref:F}),F.errors=null,F.schema=_.schema,F.schemaEnv=_,_.$async)F.$async=!0;if(this.opts.code.source===!0)F.source={validateName:Q,validateCode:B,scopeValues:Y._values};if(this.opts.unevaluated){let{props:K,items:q}=$;if(F.evaluated={props:K instanceof n9.Name?void 0:K,items:q instanceof n9.Name?void 0:q,dynamicProps:K instanceof n9.Name,dynamicItems:q instanceof n9.Name},F.source)F.source.evaluated=(0,n9.stringify)(F.evaluated)}return _.validate=F,_}catch(B){if(delete _.validate,delete _.validateName,H)this.logger.error("Error compiling schema, function code:",H);throw B}finally{this._compilations.delete(_)}}iK.compileSchema=r7;function ey(_,z,A){var b;A=(0,i9.resolveUrl)(this.opts.uriResolver,z,A);let G=_.refs[A];if(G)return G;let J=Ag.call(this,_,A);if(J===void 0){let Y=(b=_.localRefs)===null||b===void 0?void 0:b[A],{schemaId:X}=this.opts;if(Y)J=new W3({schema:Y,schemaId:X,root:_,baseId:z})}if(J===void 0)return;return _.refs[A]=_g.call(this,J)}iK.resolveRef=ey;function _g(_){if((0,i9.inlineRef)(_.schema,this.opts.inlineRefs))return _.schema;return _.validate?_:r7.call(this,_)}function nK(_){for(let z of this._compilations)if(zg(z,_))return z}iK.getCompilingSchema=nK;function zg(_,z){return _.schema===z.schema&&_.root===z.root&&_.baseId===z.baseId}function Ag(_,z){let A;while(typeof(A=this.refs[z])=="string")z=A;return A||this.schemas[z]||TA.call(this,_,z)}function TA(_,z){let A=this.opts.uriResolver.parse(z),b=(0,i9._getFullPath)(this.opts.uriResolver,A),G=(0,i9.getFullPath)(this.opts.uriResolver,_.baseId,void 0);if(Object.keys(_.schema).length>0&&b===G)return d7.call(this,A,_);let J=(0,i9.normalizeId)(b),Y=this.refs[J]||this.schemas[J];if(typeof Y=="string"){let X=TA.call(this,_,Y);if(typeof(X===null||X===void 0?void 0:X.schema)!=="object")return;return d7.call(this,A,X)}if(typeof(Y===null||Y===void 0?void 0:Y.schema)!=="object")return;if(!Y.validate)r7.call(this,Y);if(J===(0,i9.normalizeId)(z)){let{schema:X}=Y,{schemaId:Q}=this.opts,$=X[Q];if($)G=(0,i9.resolveUrl)(this.opts.uriResolver,G,$);return new W3({schema:X,schemaId:Q,root:_,baseId:G})}return d7.call(this,A,Y)}iK.resolveSchema=TA;var bg=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function d7(_,{baseId:z,schema:A,root:b}){var G;if(((G=_.fragment)===null||G===void 0?void 0:G[0])!=="/")return;for(let X of _.fragment.slice(1).split("/")){if(typeof A==="boolean")return;let Q=A[(0,rK.unescapeFragment)(X)];if(Q===void 0)return;A=Q;let $=typeof A==="object"&&A[this.opts.schemaId];if(!bg.has(X)&&$)z=(0,i9.resolveUrl)(this.opts.uriResolver,z,$)}let J;if(typeof A!="boolean"&&A.$ref&&!(0,rK.schemaHasRulesButRef)(A,this.RULES)){let X=(0,i9.resolveUrl)(this.opts.uriResolver,z,A.$ref);J=TA.call(this,b,X)}let{schemaId:Y}=this.opts;if(J=J||new W3({schema:A,schemaId:Y,root:b,baseId:z}),J.schema!==J.root.schema)return J;return}});var aK=I((u30,Qg)=>{Qg.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var i7=I((c30,_q)=>{var $g=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),tK=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function n7(_){let z="",A=0,b=0;for(b=0;b<_.length;b++){if(A=_[b].charCodeAt(0),A===48)continue;if(!(A>=48&&A<=57||A>=65&&A<=70||A>=97&&A<=102))return"";z+=_[b];break}for(b+=1;b<_.length;b++){if(A=_[b].charCodeAt(0),!(A>=48&&A<=57||A>=65&&A<=70||A>=97&&A<=102))return"";z+=_[b]}return z}var Hg=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function sK(_){return _.length=0,!0}function Bg(_,z,A){if(_.length){let b=n7(_);if(b!=="")z.push(b);else return A.error=!0,!1;_.length=0}return!0}function Zg(_){let z=0,A={error:!1,address:"",zone:""},b=[],G=[],J=!1,Y=!1,X=Bg;for(let Q=0;Q<_.length;Q++){let $=_[Q];if($==="["||$==="]")continue;if($===":"){if(J===!0)Y=!0;if(!X(G,b,A))break;if(++z>7){A.error=!0;break}if(Q>0&&_[Q-1]===":")J=!0;b.push(":");continue}else if($==="%"){if(!X(G,b,A))break;X=sK}else{G.push($);continue}}if(G.length)if(X===sK)A.zone=G.join("");else if(Y)b.push(G.join(""));else b.push(n7(G));return A.address=b.join(""),A}function eK(_){if(Fg(_,":")<2)return{host:_,isIPV6:!1};let z=Zg(_);if(!z.error){let{address:A,address:b}=z;if(z.zone)A+="%"+z.zone,b+="%25"+z.zone;return{host:A,isIPV6:!0,escapedHost:b}}else return{host:_,isIPV6:!1}}function Fg(_,z){let A=0;for(let b=0;b<_.length;b++)if(_[b]===z)A++;return A}function Kg(_){let z=_,A=[],b=-1,G=0;while(G=z.length){if(G===1)if(z===".")break;else if(z==="/"){A.push("/");break}else{A.push(z);break}else if(G===2){if(z[0]==="."){if(z[1]===".")break;else if(z[1]==="/"){z=z.slice(2);continue}}else if(z[0]==="/"){if(z[1]==="."||z[1]==="/"){A.push("/");break}}}else if(G===3){if(z==="/.."){if(A.length!==0)A.pop();A.push("/");break}}if(z[0]==="."){if(z[1]==="."){if(z[2]==="/"){z=z.slice(3);continue}}else if(z[1]==="/"){z=z.slice(2);continue}}else if(z[0]==="/"){if(z[1]==="."){if(z[2]==="/"){z=z.slice(2);continue}else if(z[2]==="."){if(z[3]==="/"){if(z=z.slice(3),A.length!==0)A.pop();continue}}}}if((b=z.indexOf("/",1))===-1){A.push(z);break}else A.push(z.slice(0,b)),z=z.slice(b)}return A.join("")}function qg(_,z){let A=z!==!0?escape:unescape;if(_.scheme!==void 0)_.scheme=A(_.scheme);if(_.userinfo!==void 0)_.userinfo=A(_.userinfo);if(_.host!==void 0)_.host=A(_.host);if(_.path!==void 0)_.path=A(_.path);if(_.query!==void 0)_.query=A(_.query);if(_.fragment!==void 0)_.fragment=A(_.fragment);return _}function Wg(_){let z=[];if(_.userinfo!==void 0)z.push(_.userinfo),z.push("@");if(_.host!==void 0){let A=unescape(_.host);if(!tK(A)){let b=eK(A);if(b.isIPV6===!0)A=`[${b.escapedHost}]`;else A=_.host}z.push(A)}if(typeof _.port==="number"||typeof _.port==="string")z.push(":"),z.push(String(_.port));return z.length?z.join(""):void 0}_q.exports={nonSimpleDomain:Hg,recomposeAuthority:Wg,normalizeComponentEncoding:qg,removeDotSegments:Kg,isIPv4:tK,isUUID:$g,normalizeIPv6:eK,stringArrayToHexStripped:n7}});var Jq=I((l30,Gq)=>{var{isUUID:Vg}=i7(),Ug=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,Dg=["http","https","ws","wss","urn","urn:uuid"];function Mg(_){return Dg.indexOf(_)!==-1}function o7(_){if(_.secure===!0)return!0;else if(_.secure===!1)return!1;else if(_.scheme)return _.scheme.length===3&&(_.scheme[0]==="w"||_.scheme[0]==="W")&&(_.scheme[1]==="s"||_.scheme[1]==="S")&&(_.scheme[2]==="s"||_.scheme[2]==="S");else return!1}function zq(_){if(!_.host)_.error=_.error||"HTTP URIs must have a host.";return _}function Aq(_){let z=String(_.scheme).toLowerCase()==="https";if(_.port===(z?443:80)||_.port==="")_.port=void 0;if(!_.path)_.path="/";return _}function Ng(_){return _.secure=o7(_),_.resourceName=(_.path||"/")+(_.query?"?"+_.query:""),_.path=void 0,_.query=void 0,_}function wg(_){if(_.port===(o7(_)?443:80)||_.port==="")_.port=void 0;if(typeof _.secure==="boolean")_.scheme=_.secure?"wss":"ws",_.secure=void 0;if(_.resourceName){let[z,A]=_.resourceName.split("?");_.path=z&&z!=="/"?z:void 0,_.query=A,_.resourceName=void 0}return _.fragment=void 0,_}function Eg(_,z){if(!_.path)return _.error="URN can not be parsed",_;let A=_.path.match(Ug);if(A){let b=z.scheme||_.scheme||"urn";_.nid=A[1].toLowerCase(),_.nss=A[2];let G=`${b}:${z.nid||_.nid}`,J=a7(G);if(_.path=void 0,J)_=J.parse(_,z)}else _.error=_.error||"URN can not be parsed.";return _}function Og(_,z){if(_.nid===void 0)throw Error("URN without nid cannot be serialized");let A=z.scheme||_.scheme||"urn",b=_.nid.toLowerCase(),G=`${A}:${z.nid||b}`,J=a7(G);if(J)_=J.serialize(_,z);let Y=_,X=_.nss;return Y.path=`${b||z.nid}:${X}`,z.skipEscape=!0,Y}function Lg(_,z){let A=_;if(A.uuid=A.nss,A.nss=void 0,!z.tolerant&&(!A.uuid||!Vg(A.uuid)))A.error=A.error||"UUID is not valid.";return A}function jg(_){let z=_;return z.nss=(_.uuid||"").toLowerCase(),z}var bq={scheme:"http",domainHost:!0,parse:zq,serialize:Aq},Rg={scheme:"https",domainHost:bq.domainHost,parse:zq,serialize:Aq},vA={scheme:"ws",domainHost:!0,parse:Ng,serialize:wg},Pg={scheme:"wss",domainHost:vA.domainHost,parse:vA.parse,serialize:vA.serialize},Sg={scheme:"urn",parse:Eg,serialize:Og,skipNormalize:!0},kg={scheme:"urn:uuid",parse:Lg,serialize:jg,skipNormalize:!0},yA={http:bq,https:Rg,ws:vA,wss:Pg,urn:Sg,"urn:uuid":kg};Object.setPrototypeOf(yA,null);function a7(_){return _&&(yA[_]||yA[_.toLowerCase()])||void 0}Gq.exports={wsIsSecure:o7,SCHEMES:yA,isValidSchemeName:Mg,getSchemeHandler:a7}});var Qq=I((p30,fA)=>{var{normalizeIPv6:Ig,removeDotSegments:V3,recomposeAuthority:xg,normalizeComponentEncoding:gA,isIPv4:Tg,nonSimpleDomain:Cg}=i7(),{SCHEMES:vg,getSchemeHandler:Yq}=Jq();function yg(_,z){if(typeof _==="string")_=F4(g4(_,z),z);else if(typeof _==="object")_=g4(F4(_,z),z);return _}function gg(_,z,A){let b=A?Object.assign({scheme:"null"},A):{scheme:"null"},G=Xq(g4(_,b),g4(z,b),b,!0);return b.skipEscape=!0,F4(G,b)}function Xq(_,z,A,b){let G={};if(!b)_=g4(F4(_,A),A),z=g4(F4(z,A),A);if(A=A||{},!A.tolerant&&z.scheme)G.scheme=z.scheme,G.userinfo=z.userinfo,G.host=z.host,G.port=z.port,G.path=V3(z.path||""),G.query=z.query;else{if(z.userinfo!==void 0||z.host!==void 0||z.port!==void 0)G.userinfo=z.userinfo,G.host=z.host,G.port=z.port,G.path=V3(z.path||""),G.query=z.query;else{if(!z.path)if(G.path=_.path,z.query!==void 0)G.query=z.query;else G.query=_.query;else{if(z.path[0]==="/")G.path=V3(z.path);else{if((_.userinfo!==void 0||_.host!==void 0||_.port!==void 0)&&!_.path)G.path="/"+z.path;else if(!_.path)G.path=z.path;else G.path=_.path.slice(0,_.path.lastIndexOf("/")+1)+z.path;G.path=V3(G.path)}G.query=z.query}G.userinfo=_.userinfo,G.host=_.host,G.port=_.port}G.scheme=_.scheme}return G.fragment=z.fragment,G}function fg(_,z,A){if(typeof _==="string")_=unescape(_),_=F4(gA(g4(_,A),!0),{...A,skipEscape:!0});else if(typeof _==="object")_=F4(gA(_,!0),{...A,skipEscape:!0});if(typeof z==="string")z=unescape(z),z=F4(gA(g4(z,A),!0),{...A,skipEscape:!0});else if(typeof z==="object")z=F4(gA(z,!0),{...A,skipEscape:!0});return _.toLowerCase()===z.toLowerCase()}function F4(_,z){let A={host:_.host,scheme:_.scheme,userinfo:_.userinfo,port:_.port,path:_.path,query:_.query,nid:_.nid,nss:_.nss,uuid:_.uuid,fragment:_.fragment,reference:_.reference,resourceName:_.resourceName,secure:_.secure,error:""},b=Object.assign({},z),G=[],J=Yq(b.scheme||A.scheme);if(J&&J.serialize)J.serialize(A,b);if(A.path!==void 0)if(!b.skipEscape){if(A.path=escape(A.path),A.scheme!==void 0)A.path=A.path.split("%3A").join(":")}else A.path=unescape(A.path);if(b.reference!=="suffix"&&A.scheme)G.push(A.scheme,":");let Y=xg(A);if(Y!==void 0){if(b.reference!=="suffix")G.push("//");if(G.push(Y),A.path&&A.path[0]!=="/")G.push("/")}if(A.path!==void 0){let X=A.path;if(!b.absolutePath&&(!J||!J.absolutePath))X=V3(X);if(Y===void 0&&X[0]==="/"&&X[1]==="/")X="/%2F"+X.slice(2);G.push(X)}if(A.query!==void 0)G.push("?",A.query);if(A.fragment!==void 0)G.push("#",A.fragment);return G.join("")}var hg=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function g4(_,z){let A=Object.assign({},z),b={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},G=!1;if(A.reference==="suffix")if(A.scheme)_=A.scheme+":"+_;else _="//"+_;let J=_.match(hg);if(J){if(b.scheme=J[1],b.userinfo=J[3],b.host=J[4],b.port=parseInt(J[5],10),b.path=J[6]||"",b.query=J[7],b.fragment=J[8],isNaN(b.port))b.port=J[5];if(b.host)if(Tg(b.host)===!1){let Q=Ig(b.host);b.host=Q.host.toLowerCase(),G=Q.isIPV6}else G=!0;if(b.scheme===void 0&&b.userinfo===void 0&&b.host===void 0&&b.port===void 0&&b.query===void 0&&!b.path)b.reference="same-document";else if(b.scheme===void 0)b.reference="relative";else if(b.fragment===void 0)b.reference="absolute";else b.reference="uri";if(A.reference&&A.reference!=="suffix"&&A.reference!==b.reference)b.error=b.error||"URI is not a "+A.reference+" reference.";let Y=Yq(A.scheme||b.scheme);if(!A.unicodeSupport&&(!Y||!Y.unicodeSupport)){if(b.host&&(A.domainHost||Y&&Y.domainHost)&&G===!1&&Cg(b.host))try{b.host=URL.domainToASCII(b.host.toLowerCase())}catch(X){b.error=b.error||"Host's domain name can not be converted to ASCII: "+X}}if(!Y||Y&&!Y.skipNormalize){if(_.indexOf("%")!==-1){if(b.scheme!==void 0)b.scheme=unescape(b.scheme);if(b.host!==void 0)b.host=unescape(b.host)}if(b.path)b.path=escape(unescape(b.path));if(b.fragment)b.fragment=encodeURI(decodeURIComponent(b.fragment))}if(Y&&Y.parse)Y.parse(b,A)}else b.error=b.error||"URI can not be parsed.";return b}var s7={SCHEMES:vg,normalize:yg,resolve:gg,resolveComponent:Xq,equal:fg,serialize:F4,parse:g4};fA.exports=s7;fA.exports.default=s7;fA.exports.fastUri=s7});var Bq=I((Hq)=>{Object.defineProperty(Hq,"__esModule",{value:!0});var $q=Qq();$q.code='require("ajv/dist/runtime/uri").default';Hq.default=$q});var Dq=I((f4)=>{Object.defineProperty(f4,"__esModule",{value:!0});f4.CodeGen=f4.Name=f4.nil=f4.stringify=f4.str=f4._=f4.KeywordCxt=void 0;var ug=K3();Object.defineProperty(f4,"KeywordCxt",{enumerable:!0,get:function(){return ug.KeywordCxt}});var p1=t();Object.defineProperty(f4,"_",{enumerable:!0,get:function(){return p1._}});Object.defineProperty(f4,"str",{enumerable:!0,get:function(){return p1.str}});Object.defineProperty(f4,"stringify",{enumerable:!0,get:function(){return p1.stringify}});Object.defineProperty(f4,"nil",{enumerable:!0,get:function(){return p1.nil}});Object.defineProperty(f4,"Name",{enumerable:!0,get:function(){return p1.Name}});Object.defineProperty(f4,"CodeGen",{enumerable:!0,get:function(){return p1.CodeGen}});var cg=xA(),Wq=q3(),lg=k7(),U3=CA(),pg=t(),D3=B3(),hA=H3(),e7=Q0(),Zq=aK(),dg=Bq(),Vq=(_,z)=>new RegExp(_,z);Vq.code="new RegExp";var rg=["removeAdditional","useDefaults","coerceTypes"],ng=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),ig={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},og={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},Fq=200;function ag(_){var z,A,b,G,J,Y,X,Q,$,H,B,Z,F,K,q,W,V,w,O,M,P,D,L,R,S;let y=_.strict,e=(z=_.code)===null||z===void 0?void 0:z.optimize,u=e===!0||e===void 0?1:e||0,g=(b=(A=_.code)===null||A===void 0?void 0:A.regExp)!==null&&b!==void 0?b:Vq,m=(G=_.uriResolver)!==null&&G!==void 0?G:dg.default;return{strictSchema:(Y=(J=_.strictSchema)!==null&&J!==void 0?J:y)!==null&&Y!==void 0?Y:!0,strictNumbers:(Q=(X=_.strictNumbers)!==null&&X!==void 0?X:y)!==null&&Q!==void 0?Q:!0,strictTypes:(H=($=_.strictTypes)!==null&&$!==void 0?$:y)!==null&&H!==void 0?H:"log",strictTuples:(Z=(B=_.strictTuples)!==null&&B!==void 0?B:y)!==null&&Z!==void 0?Z:"log",strictRequired:(K=(F=_.strictRequired)!==null&&F!==void 0?F:y)!==null&&K!==void 0?K:!1,code:_.code?{..._.code,optimize:u,regExp:g}:{optimize:u,regExp:g},loopRequired:(q=_.loopRequired)!==null&&q!==void 0?q:Fq,loopEnum:(W=_.loopEnum)!==null&&W!==void 0?W:Fq,meta:(V=_.meta)!==null&&V!==void 0?V:!0,messages:(w=_.messages)!==null&&w!==void 0?w:!0,inlineRefs:(O=_.inlineRefs)!==null&&O!==void 0?O:!0,schemaId:(M=_.schemaId)!==null&&M!==void 0?M:"$id",addUsedSchema:(P=_.addUsedSchema)!==null&&P!==void 0?P:!0,validateSchema:(D=_.validateSchema)!==null&&D!==void 0?D:!0,validateFormats:(L=_.validateFormats)!==null&&L!==void 0?L:!0,unicodeRegExp:(R=_.unicodeRegExp)!==null&&R!==void 0?R:!0,int32range:(S=_.int32range)!==null&&S!==void 0?S:!0,uriResolver:m}}class mA{constructor(_={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,_=this.opts={..._,...ag(_)};let{es5:z,lines:A}=this.opts.code;this.scope=new pg.ValueScope({scope:{},prefixes:ng,es5:z,lines:A}),this.logger=Af(_.logger);let b=_.validateFormats;if(_.validateFormats=!1,this.RULES=(0,lg.getRules)(),Kq.call(this,ig,_,"NOT SUPPORTED"),Kq.call(this,og,_,"DEPRECATED","warn"),this._metaOpts=_f.call(this),_.formats)tg.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),_.keywords)eg.call(this,_.keywords);if(typeof _.meta=="object")this.addMetaSchema(_.meta);sg.call(this),_.validateFormats=b}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:_,meta:z,schemaId:A}=this.opts,b=Zq;if(A==="id")b={...Zq},b.id=b.$id,delete b.$id;if(z&&_)this.addMetaSchema(b,b[A],!1)}defaultMeta(){let{meta:_,schemaId:z}=this.opts;return this.opts.defaultMeta=typeof _=="object"?_[z]||_:void 0}validate(_,z){let A;if(typeof _=="string"){if(A=this.getSchema(_),!A)throw Error(`no schema with key or ref "${_}"`)}else A=this.compile(_);let b=A(z);if(!("$async"in A))this.errors=A.errors;return b}compile(_,z){let A=this._addSchema(_,z);return A.validate||this._compileSchemaEnv(A)}compileAsync(_,z){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:A}=this.opts;return b.call(this,_,z);async function b($,H){await G.call(this,$.$schema);let B=this._addSchema($,H);return B.validate||J.call(this,B)}async function G($){if($&&!this.getSchema($))await b.call(this,{$ref:$},!0)}async function J($){try{return this._compileSchemaEnv($)}catch(H){if(!(H instanceof Wq.default))throw H;return Y.call(this,H),await X.call(this,H.missingSchema),J.call(this,$)}}function Y({missingSchema:$,missingRef:H}){if(this.refs[$])throw Error(`AnySchema ${$} is loaded but ${H} cannot be resolved`)}async function X($){let H=await Q.call(this,$);if(!this.refs[$])await G.call(this,H.$schema);if(!this.refs[$])this.addSchema(H,$,z)}async function Q($){let H=this._loading[$];if(H)return H;try{return await(this._loading[$]=A($))}finally{delete this._loading[$]}}}addSchema(_,z,A,b=this.opts.validateSchema){if(Array.isArray(_)){for(let J of _)this.addSchema(J,void 0,A,b);return this}let G;if(typeof _==="object"){let{schemaId:J}=this.opts;if(G=_[J],G!==void 0&&typeof G!="string")throw Error(`schema ${J} must be string`)}return z=(0,D3.normalizeId)(z||G),this._checkUnique(z),this.schemas[z]=this._addSchema(_,A,z,b,!0),this}addMetaSchema(_,z,A=this.opts.validateSchema){return this.addSchema(_,z,!0,A),this}validateSchema(_,z){if(typeof _=="boolean")return!0;let A;if(A=_.$schema,A!==void 0&&typeof A!="string")throw Error("$schema must be a string");if(A=A||this.opts.defaultMeta||this.defaultMeta(),!A)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let b=this.validate(A,_);if(!b&&z){let G="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(G);else throw Error(G)}return b}getSchema(_){let z;while(typeof(z=qq.call(this,_))=="string")_=z;if(z===void 0){let{schemaId:A}=this.opts,b=new U3.SchemaEnv({schema:{},schemaId:A});if(z=U3.resolveSchema.call(this,b,_),!z)return;this.refs[_]=z}return z.validate||this._compileSchemaEnv(z)}removeSchema(_){if(_ instanceof RegExp)return this._removeAllSchemas(this.schemas,_),this._removeAllSchemas(this.refs,_),this;switch(typeof _){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let z=qq.call(this,_);if(typeof z=="object")this._cache.delete(z.schema);return delete this.schemas[_],delete this.refs[_],this}case"object":{let z=_;this._cache.delete(z);let A=_[this.opts.schemaId];if(A)A=(0,D3.normalizeId)(A),delete this.schemas[A],delete this.refs[A];return this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(_){for(let z of _)this.addKeyword(z);return this}addKeyword(_,z){let A;if(typeof _=="string"){if(A=_,typeof z=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),z.keyword=A}else if(typeof _=="object"&&z===void 0){if(z=_,A=z.keyword,Array.isArray(A)&&!A.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(Gf.call(this,A,z),!z)return(0,e7.eachItem)(A,(G)=>t7.call(this,G)),this;Yf.call(this,z);let b={...z,type:(0,hA.getJSONTypes)(z.type),schemaType:(0,hA.getJSONTypes)(z.schemaType)};return(0,e7.eachItem)(A,b.type.length===0?(G)=>t7.call(this,G,b):(G)=>b.type.forEach((J)=>t7.call(this,G,b,J))),this}getKeyword(_){let z=this.RULES.all[_];return typeof z=="object"?z.definition:!!z}removeKeyword(_){let{RULES:z}=this;delete z.keywords[_],delete z.all[_];for(let A of z.rules){let b=A.rules.findIndex((G)=>G.keyword===_);if(b>=0)A.rules.splice(b,1)}return this}addFormat(_,z){if(typeof z=="string")z=new RegExp(z);return this.formats[_]=z,this}errorsText(_=this.errors,{separator:z=", ",dataVar:A="data"}={}){if(!_||_.length===0)return"No errors";return _.map((b)=>`${A}${b.instancePath} ${b.message}`).reduce((b,G)=>b+z+G)}$dataMetaSchema(_,z){let A=this.RULES.all;_=JSON.parse(JSON.stringify(_));for(let b of z){let G=b.split("/").slice(1),J=_;for(let Y of G)J=J[Y];for(let Y in A){let X=A[Y];if(typeof X!="object")continue;let{$data:Q}=X.definition,$=J[Y];if(Q&&$)J[Y]=Uq($)}}return _}_removeAllSchemas(_,z){for(let A in _){let b=_[A];if(!z||z.test(A)){if(typeof b=="string")delete _[A];else if(b&&!b.meta)this._cache.delete(b.schema),delete _[A]}}}_addSchema(_,z,A,b=this.opts.validateSchema,G=this.opts.addUsedSchema){let J,{schemaId:Y}=this.opts;if(typeof _=="object")J=_[Y];else if(this.opts.jtd)throw Error("schema must be object");else if(typeof _!="boolean")throw Error("schema must be object or boolean");let X=this._cache.get(_);if(X!==void 0)return X;A=(0,D3.normalizeId)(J||A);let Q=D3.getSchemaRefs.call(this,_,A);if(X=new U3.SchemaEnv({schema:_,schemaId:Y,meta:z,baseId:A,localRefs:Q}),this._cache.set(X.schema,X),G&&!A.startsWith("#")){if(A)this._checkUnique(A);this.refs[A]=X}if(b)this.validateSchema(_,!0);return X}_checkUnique(_){if(this.schemas[_]||this.refs[_])throw Error(`schema with key or id "${_}" already exists`)}_compileSchemaEnv(_){if(_.meta)this._compileMetaSchema(_);else U3.compileSchema.call(this,_);if(!_.validate)throw Error("ajv implementation error");return _.validate}_compileMetaSchema(_){let z=this.opts;this.opts=this._metaOpts;try{U3.compileSchema.call(this,_)}finally{this.opts=z}}}mA.ValidationError=cg.default;mA.MissingRefError=Wq.default;f4.default=mA;function Kq(_,z,A,b="error"){for(let G in _){let J=G;if(J in z)this.logger[b](`${A}: option ${G}. ${_[J]}`)}}function qq(_){return _=(0,D3.normalizeId)(_),this.schemas[_]||this.refs[_]}function sg(){let _=this.opts.schemas;if(!_)return;if(Array.isArray(_))this.addSchema(_);else for(let z in _)this.addSchema(_[z],z)}function tg(){for(let _ in this.opts.formats){let z=this.opts.formats[_];if(z)this.addFormat(_,z)}}function eg(_){if(Array.isArray(_)){this.addVocabulary(_);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let z in _){let A=_[z];if(!A.keyword)A.keyword=z;this.addKeyword(A)}}function _f(){let _={...this.opts};for(let z of rg)delete _[z];return _}var zf={log(){},warn(){},error(){}};function Af(_){if(_===!1)return zf;if(_===void 0)return console;if(_.log&&_.warn&&_.error)return _;throw Error("logger must implement log, warn and error methods")}var bf=/^[a-z_$][a-z0-9_$:-]*$/i;function Gf(_,z){let{RULES:A}=this;if((0,e7.eachItem)(_,(b)=>{if(A.keywords[b])throw Error(`Keyword ${b} is already defined`);if(!bf.test(b))throw Error(`Keyword ${b} has invalid name`)}),!z)return;if(z.$data&&!(("code"in z)||("validate"in z)))throw Error('$data keyword must have "code" or "validate" function')}function t7(_,z,A){var b;let G=z===null||z===void 0?void 0:z.post;if(A&&G)throw Error('keyword with "post" flag cannot have "type"');let{RULES:J}=this,Y=G?J.post:J.rules.find(({type:Q})=>Q===A);if(!Y)Y={type:A,rules:[]},J.rules.push(Y);if(J.keywords[_]=!0,!z)return;let X={keyword:_,definition:{...z,type:(0,hA.getJSONTypes)(z.type),schemaType:(0,hA.getJSONTypes)(z.schemaType)}};if(z.before)Jf.call(this,Y,X,z.before);else Y.rules.push(X);J.all[_]=X,(b=z.implements)===null||b===void 0||b.forEach((Q)=>this.addKeyword(Q))}function Jf(_,z,A){let b=_.rules.findIndex((G)=>G.keyword===A);if(b>=0)_.rules.splice(b,0,z);else _.rules.push(z),this.logger.warn(`rule ${A} is not defined`)}function Yf(_){let{metaSchema:z}=_;if(z===void 0)return;if(_.$data&&this.opts.$data)z=Uq(z);_.validateSchema=this.compile(z,!0)}var Xf={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Uq(_){return{anyOf:[_,Xf]}}});var Nq=I((Mq)=>{Object.defineProperty(Mq,"__esModule",{value:!0});var Hf={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Mq.default=Hf});var Rq=I((Lq)=>{Object.defineProperty(Lq,"__esModule",{value:!0});Lq.callRef=Lq.getValidate=void 0;var Zf=q3(),wq=R9(),Z9=t(),d1=v4(),Eq=CA(),uA=Q0(),Ff={keyword:"$ref",schemaType:"string",code(_){let{gen:z,schema:A,it:b}=_,{baseId:G,schemaEnv:J,validateName:Y,opts:X,self:Q}=b,{root:$}=J;if((A==="#"||A==="#/")&&G===$.baseId)return B();let H=Eq.resolveRef.call(Q,$,G,A);if(H===void 0)throw new Zf.default(b.opts.uriResolver,G,A);if(H instanceof Eq.SchemaEnv)return Z(H);return F(H);function B(){if(J===$)return cA(_,Y,J,J.$async);let K=z.scopeValue("root",{ref:$});return cA(_,Z9._`${K}.validate`,$,$.$async)}function Z(K){let q=Oq(_,K);cA(_,q,K,K.$async)}function F(K){let q=z.scopeValue("schema",X.code.source===!0?{ref:K,code:(0,Z9.stringify)(K)}:{ref:K}),W=z.name("valid"),V=_.subschema({schema:K,dataTypes:[],schemaPath:Z9.nil,topSchemaRef:q,errSchemaPath:A},W);_.mergeEvaluated(V),_.ok(W)}}};function Oq(_,z){let{gen:A}=_;return z.validate?A.scopeValue("validate",{ref:z.validate}):Z9._`${A.scopeValue("wrapper",{ref:z})}.validate`}Lq.getValidate=Oq;function cA(_,z,A,b){let{gen:G,it:J}=_,{allErrors:Y,schemaEnv:X,opts:Q}=J,$=Q.passContext?d1.default.this:Z9.nil;if(b)H();else B();function H(){if(!X.$async)throw Error("async schema referenced by sync schema");let K=G.let("valid");G.try(()=>{if(G.code(Z9._`await ${(0,wq.callValidateCode)(_,z,$)}`),F(z),!Y)G.assign(K,!0)},(q)=>{if(G.if(Z9._`!(${q} instanceof ${J.ValidationError})`,()=>G.throw(q)),Z(q),!Y)G.assign(K,!1)}),_.ok(K)}function B(){_.result((0,wq.callValidateCode)(_,z,$),()=>F(z),()=>Z(z))}function Z(K){let q=Z9._`${K}.errors`;G.assign(d1.default.vErrors,Z9._`${d1.default.vErrors} === null ? ${q} : ${d1.default.vErrors}.concat(${q})`),G.assign(d1.default.errors,Z9._`${d1.default.vErrors}.length`)}function F(K){var q;if(!J.opts.unevaluated)return;let W=(q=A===null||A===void 0?void 0:A.validate)===null||q===void 0?void 0:q.evaluated;if(J.props!==!0)if(W&&!W.dynamicProps){if(W.props!==void 0)J.props=uA.mergeEvaluated.props(G,W.props,J.props)}else{let V=G.var("props",Z9._`${K}.evaluated.props`);J.props=uA.mergeEvaluated.props(G,V,J.props,Z9.Name)}if(J.items!==!0)if(W&&!W.dynamicItems){if(W.items!==void 0)J.items=uA.mergeEvaluated.items(G,W.items,J.items)}else{let V=G.var("items",Z9._`${K}.evaluated.items`);J.items=uA.mergeEvaluated.items(G,V,J.items,Z9.Name)}}}Lq.callRef=cA;Lq.default=Ff});var Sq=I((Pq)=>{Object.defineProperty(Pq,"__esModule",{value:!0});var Wf=Nq(),Vf=Rq(),Uf=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",Wf.default,Vf.default];Pq.default=Uf});var Iq=I((kq)=>{Object.defineProperty(kq,"__esModule",{value:!0});var lA=t(),B_=lA.operators,pA={maximum:{okStr:"<=",ok:B_.LTE,fail:B_.GT},minimum:{okStr:">=",ok:B_.GTE,fail:B_.LT},exclusiveMaximum:{okStr:"<",ok:B_.LT,fail:B_.GTE},exclusiveMinimum:{okStr:">",ok:B_.GT,fail:B_.LTE}},Mf={message:({keyword:_,schemaCode:z})=>lA.str`must be ${pA[_].okStr} ${z}`,params:({keyword:_,schemaCode:z})=>lA._`{comparison: ${pA[_].okStr}, limit: ${z}}`},Nf={keyword:Object.keys(pA),type:"number",schemaType:"number",$data:!0,error:Mf,code(_){let{keyword:z,data:A,schemaCode:b}=_;_.fail$data(lA._`${A} ${pA[z].fail} ${b} || isNaN(${A})`)}};kq.default=Nf});var Tq=I((xq)=>{Object.defineProperty(xq,"__esModule",{value:!0});var M3=t(),Ef={message:({schemaCode:_})=>M3.str`must be multiple of ${_}`,params:({schemaCode:_})=>M3._`{multipleOf: ${_}}`},Of={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:Ef,code(_){let{gen:z,data:A,schemaCode:b,it:G}=_,J=G.opts.multipleOfPrecision,Y=z.let("res"),X=J?M3._`Math.abs(Math.round(${Y}) - ${Y}) > 1e-${J}`:M3._`${Y} !== parseInt(${Y})`;_.fail$data(M3._`(${b} === 0 || (${Y} = ${A}/${b}, ${X}))`)}};xq.default=Of});var yq=I((vq)=>{Object.defineProperty(vq,"__esModule",{value:!0});function Cq(_){let z=_.length,A=0,b=0,G;while(b<z)if(A++,G=_.charCodeAt(b++),G>=55296&&G<=56319&&b<z){if(G=_.charCodeAt(b),(G&64512)===56320)b++}return A}vq.default=Cq;Cq.code='require("ajv/dist/runtime/ucs2length").default'});var fq=I((gq)=>{Object.defineProperty(gq,"__esModule",{value:!0});var f_=t(),Rf=Q0(),Pf=yq(),Sf={message({keyword:_,schemaCode:z}){let A=_==="maxLength"?"more":"fewer";return f_.str`must NOT have ${A} than ${z} characters`},params:({schemaCode:_})=>f_._`{limit: ${_}}`},kf={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:Sf,code(_){let{keyword:z,data:A,schemaCode:b,it:G}=_,J=z==="maxLength"?f_.operators.GT:f_.operators.LT,Y=G.opts.unicode===!1?f_._`${A}.length`:f_._`${(0,Rf.useFunc)(_.gen,Pf.default)}(${A})`;_.fail$data(f_._`${Y} ${J} ${b}`)}};gq.default=kf});var mq=I((hq)=>{Object.defineProperty(hq,"__esModule",{value:!0});var xf=R9(),dA=t(),Tf={message:({schemaCode:_})=>dA.str`must match pattern "${_}"`,params:({schemaCode:_})=>dA._`{pattern: ${_}}`},Cf={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:Tf,code(_){let{data:z,$data:A,schema:b,schemaCode:G,it:J}=_,Y=J.opts.unicodeRegExp?"u":"",X=A?dA._`(new RegExp(${G}, ${Y}))`:(0,xf.usePattern)(_,b);_.fail$data(dA._`!${X}.test(${z})`)}};hq.default=Cf});var cq=I((uq)=>{Object.defineProperty(uq,"__esModule",{value:!0});var N3=t(),yf={message({keyword:_,schemaCode:z}){let A=_==="maxProperties"?"more":"fewer";return N3.str`must NOT have ${A} than ${z} properties`},params:({schemaCode:_})=>N3._`{limit: ${_}}`},gf={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:yf,code(_){let{keyword:z,data:A,schemaCode:b}=_,G=z==="maxProperties"?N3.operators.GT:N3.operators.LT;_.fail$data(N3._`Object.keys(${A}).length ${G} ${b}`)}};uq.default=gf});var pq=I((lq)=>{Object.defineProperty(lq,"__esModule",{value:!0});var w3=R9(),E3=t(),hf=Q0(),mf={message:({params:{missingProperty:_}})=>E3.str`must have required property '${_}'`,params:({params:{missingProperty:_}})=>E3._`{missingProperty: ${_}}`},uf={keyword:"required",type:"object",schemaType:"array",$data:!0,error:mf,code(_){let{gen:z,schema:A,schemaCode:b,data:G,$data:J,it:Y}=_,{opts:X}=Y;if(!J&&A.length===0)return;let Q=A.length>=X.loopRequired;if(Y.allErrors)$();else H();if(X.strictRequired){let F=_.parentSchema.properties,{definedProperties:K}=_.it;for(let q of A)if((F===null||F===void 0?void 0:F[q])===void 0&&!K.has(q)){let W=Y.schemaEnv.baseId+Y.errSchemaPath,V=`required property "${q}" is not defined at "${W}" (strictRequired)`;(0,hf.checkStrictMode)(Y,V,Y.opts.strictRequired)}}function $(){if(Q||J)_.block$data(E3.nil,B);else for(let F of A)(0,w3.checkReportMissingProp)(_,F)}function H(){let F=z.let("missing");if(Q||J){let K=z.let("valid",!0);_.block$data(K,()=>Z(F,K)),_.ok(K)}else z.if((0,w3.checkMissingProp)(_,A,F)),(0,w3.reportMissingProp)(_,F),z.else()}function B(){z.forOf("prop",b,(F)=>{_.setParams({missingProperty:F}),z.if((0,w3.noPropertyInData)(z,G,F,X.ownProperties),()=>_.error())})}function Z(F,K){_.setParams({missingProperty:F}),z.forOf(F,b,()=>{z.assign(K,(0,w3.propertyInData)(z,G,F,X.ownProperties)),z.if((0,E3.not)(K),()=>{_.error(),z.break()})},E3.nil)}}};lq.default=uf});var rq=I((dq)=>{Object.defineProperty(dq,"__esModule",{value:!0});var O3=t(),lf={message({keyword:_,schemaCode:z}){let A=_==="maxItems"?"more":"fewer";return O3.str`must NOT have ${A} than ${z} items`},params:({schemaCode:_})=>O3._`{limit: ${_}}`},pf={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:lf,code(_){let{keyword:z,data:A,schemaCode:b}=_,G=z==="maxItems"?O3.operators.GT:O3.operators.LT;_.fail$data(O3._`${A}.length ${G} ${b}`)}};dq.default=pf});var rA=I((iq)=>{Object.defineProperty(iq,"__esModule",{value:!0});var nq=f7();nq.code='require("ajv/dist/runtime/equal").default';iq.default=nq});var aq=I((oq)=>{Object.defineProperty(oq,"__esModule",{value:!0});var _b=H3(),l0=t(),nf=Q0(),of=rA(),af={message:({params:{i:_,j:z}})=>l0.str`must NOT have duplicate items (items ## ${z} and ${_} are identical)`,params:({params:{i:_,j:z}})=>l0._`{i: ${_}, j: ${z}}`},sf={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:af,code(_){let{gen:z,data:A,$data:b,schema:G,parentSchema:J,schemaCode:Y,it:X}=_;if(!b&&!G)return;let Q=z.let("valid"),$=J.items?(0,_b.getSchemaTypes)(J.items):[];_.block$data(Q,H,l0._`${Y} === false`),_.ok(Q);function H(){let K=z.let("i",l0._`${A}.length`),q=z.let("j");_.setParams({i:K,j:q}),z.assign(Q,!0),z.if(l0._`${K} > 1`,()=>(B()?Z:F)(K,q))}function B(){return $.length>0&&!$.some((K)=>K==="object"||K==="array")}function Z(K,q){let W=z.name("item"),V=(0,_b.checkDataTypes)($,W,X.opts.strictNumbers,_b.DataType.Wrong),w=z.const("indices",l0._`{}`);z.for(l0._`;${K}--;`,()=>{if(z.let(W,l0._`${A}[${K}]`),z.if(V,l0._`continue`),$.length>1)z.if(l0._`typeof ${W} == "string"`,l0._`${W} += "_"`);z.if(l0._`typeof ${w}[${W}] == "number"`,()=>{z.assign(q,l0._`${w}[${W}]`),_.error(),z.assign(Q,!1).break()}).code(l0._`${w}[${W}] = ${K}`)})}function F(K,q){let W=(0,nf.useFunc)(z,of.default),V=z.name("outer");z.label(V).for(l0._`;${K}--;`,()=>z.for(l0._`${q} = ${K}; ${q}--;`,()=>z.if(l0._`${W}(${A}[${K}], ${A}[${q}])`,()=>{_.error(),z.assign(Q,!1).break(V)})))}}};oq.default=sf});var tq=I((sq)=>{Object.defineProperty(sq,"__esModule",{value:!0});var zb=t(),ef=Q0(),_h=rA(),zh={message:"must be equal to constant",params:({schemaCode:_})=>zb._`{allowedValue: ${_}}`},Ah={keyword:"const",$data:!0,error:zh,code(_){let{gen:z,data:A,$data:b,schemaCode:G,schema:J}=_;if(b||J&&typeof J=="object")_.fail$data(zb._`!${(0,ef.useFunc)(z,_h.default)}(${A}, ${G})`);else _.fail(zb._`${J} !== ${A}`)}};sq.default=Ah});var _W=I((eq)=>{Object.defineProperty(eq,"__esModule",{value:!0});var L3=t(),Gh=Q0(),Jh=rA(),Yh={message:"must be equal to one of the allowed values",params:({schemaCode:_})=>L3._`{allowedValues: ${_}}`},Xh={keyword:"enum",schemaType:"array",$data:!0,error:Yh,code(_){let{gen:z,data:A,$data:b,schema:G,schemaCode:J,it:Y}=_;if(!b&&G.length===0)throw Error("enum must have non-empty array");let X=G.length>=Y.opts.loopEnum,Q,$=()=>Q!==null&&Q!==void 0?Q:Q=(0,Gh.useFunc)(z,Jh.default),H;if(X||b)H=z.let("valid"),_.block$data(H,B);else{if(!Array.isArray(G))throw Error("ajv implementation error");let F=z.const("vSchema",J);H=(0,L3.or)(...G.map((K,q)=>Z(F,q)))}_.pass(H);function B(){z.assign(H,!1),z.forOf("v",J,(F)=>z.if(L3._`${$()}(${A}, ${F})`,()=>z.assign(H,!0).break()))}function Z(F,K){let q=G[K];return typeof q==="object"&&q!==null?L3._`${$()}(${A}, ${F}[${K}])`:L3._`${A} === ${q}`}}};eq.default=Xh});var AW=I((zW)=>{Object.defineProperty(zW,"__esModule",{value:!0});var $h=Iq(),Hh=Tq(),Bh=fq(),Zh=mq(),Fh=cq(),Kh=pq(),qh=rq(),Wh=aq(),Vh=tq(),Uh=_W(),Dh=[$h.default,Hh.default,Bh.default,Zh.default,Fh.default,Kh.default,qh.default,Wh.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},Vh.default,Uh.default];zW.default=Dh});var bb=I((GW)=>{Object.defineProperty(GW,"__esModule",{value:!0});GW.validateAdditionalItems=void 0;var h_=t(),Ab=Q0(),Nh={message:({params:{len:_}})=>h_.str`must NOT have more than ${_} items`,params:({params:{len:_}})=>h_._`{limit: ${_}}`},wh={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:Nh,code(_){let{parentSchema:z,it:A}=_,{items:b}=z;if(!Array.isArray(b)){(0,Ab.checkStrictMode)(A,'"additionalItems" is ignored when "items" is not an array of schemas');return}bW(_,b)}};function bW(_,z){let{gen:A,schema:b,data:G,keyword:J,it:Y}=_;Y.items=!0;let X=A.const("len",h_._`${G}.length`);if(b===!1)_.setParams({len:z.length}),_.pass(h_._`${X} <= ${z.length}`);else if(typeof b=="object"&&!(0,Ab.alwaysValidSchema)(Y,b)){let $=A.var("valid",h_._`${X} <= ${z.length}`);A.if((0,h_.not)($),()=>Q($)),_.ok($)}function Q($){A.forRange("i",z.length,X,(H)=>{if(_.subschema({keyword:J,dataProp:H,dataPropType:Ab.Type.Num},$),!Y.allErrors)A.if((0,h_.not)($),()=>A.break())})}}GW.validateAdditionalItems=bW;GW.default=wh});var Gb=I((QW)=>{Object.defineProperty(QW,"__esModule",{value:!0});QW.validateTuple=void 0;var YW=t(),nA=Q0(),Oh=R9(),Lh={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(_){let{schema:z,it:A}=_;if(Array.isArray(z))return XW(_,"additionalItems",z);if(A.items=!0,(0,nA.alwaysValidSchema)(A,z))return;_.ok((0,Oh.validateArray)(_))}};function XW(_,z,A=_.schema){let{gen:b,parentSchema:G,data:J,keyword:Y,it:X}=_;if(H(G),X.opts.unevaluated&&A.length&&X.items!==!0)X.items=nA.mergeEvaluated.items(b,A.length,X.items);let Q=b.name("valid"),$=b.const("len",YW._`${J}.length`);A.forEach((B,Z)=>{if((0,nA.alwaysValidSchema)(X,B))return;b.if(YW._`${$} > ${Z}`,()=>_.subschema({keyword:Y,schemaProp:Z,dataProp:Z},Q)),_.ok(Q)});function H(B){let{opts:Z,errSchemaPath:F}=X,K=A.length,q=K===B.minItems&&(K===B.maxItems||B[z]===!1);if(Z.strictTuples&&!q){let W=`"${Y}" is ${K}-tuple, but minItems or maxItems/${z} are not specified or different at path "${F}"`;(0,nA.checkStrictMode)(X,W,Z.strictTuples)}}}QW.validateTuple=XW;QW.default=Lh});var BW=I((HW)=>{Object.defineProperty(HW,"__esModule",{value:!0});var Rh=Gb(),Ph={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(_)=>(0,Rh.validateTuple)(_,"items")};HW.default=Ph});var KW=I((FW)=>{Object.defineProperty(FW,"__esModule",{value:!0});var ZW=t(),kh=Q0(),Ih=R9(),xh=bb(),Th={message:({params:{len:_}})=>ZW.str`must NOT have more than ${_} items`,params:({params:{len:_}})=>ZW._`{limit: ${_}}`},Ch={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:Th,code(_){let{schema:z,parentSchema:A,it:b}=_,{prefixItems:G}=A;if(b.items=!0,(0,kh.alwaysValidSchema)(b,z))return;if(G)(0,xh.validateAdditionalItems)(_,G);else _.ok((0,Ih.validateArray)(_))}};FW.default=Ch});var WW=I((qW)=>{Object.defineProperty(qW,"__esModule",{value:!0});var P9=t(),iA=Q0(),yh={message:({params:{min:_,max:z}})=>z===void 0?P9.str`must contain at least ${_} valid item(s)`:P9.str`must contain at least ${_} and no more than ${z} valid item(s)`,params:({params:{min:_,max:z}})=>z===void 0?P9._`{minContains: ${_}}`:P9._`{minContains: ${_}, maxContains: ${z}}`},gh={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:yh,code(_){let{gen:z,schema:A,parentSchema:b,data:G,it:J}=_,Y,X,{minContains:Q,maxContains:$}=b;if(J.opts.next)Y=Q===void 0?1:Q,X=$;else Y=1;let H=z.const("len",P9._`${G}.length`);if(_.setParams({min:Y,max:X}),X===void 0&&Y===0){(0,iA.checkStrictMode)(J,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(X!==void 0&&Y>X){(0,iA.checkStrictMode)(J,'"minContains" > "maxContains" is always invalid'),_.fail();return}if((0,iA.alwaysValidSchema)(J,A)){let q=P9._`${H} >= ${Y}`;if(X!==void 0)q=P9._`${q} && ${H} <= ${X}`;_.pass(q);return}J.items=!0;let B=z.name("valid");if(X===void 0&&Y===1)F(B,()=>z.if(B,()=>z.break()));else if(Y===0){if(z.let(B,!0),X!==void 0)z.if(P9._`${G}.length > 0`,Z)}else z.let(B,!1),Z();_.result(B,()=>_.reset());function Z(){let q=z.name("_valid"),W=z.let("count",0);F(q,()=>z.if(q,()=>K(W)))}function F(q,W){z.forRange("i",0,H,(V)=>{_.subschema({keyword:"contains",dataProp:V,dataPropType:iA.Type.Num,compositeRule:!0},q),W()})}function K(q){if(z.code(P9._`${q}++`),X===void 0)z.if(P9._`${q} >= ${Y}`,()=>z.assign(B,!0).break());else if(z.if(P9._`${q} > ${X}`,()=>z.assign(B,!1).break()),Y===1)z.assign(B,!0);else z.if(P9._`${q} >= ${Y}`,()=>z.assign(B,!0))}}};qW.default=gh});var wW=I((DW)=>{Object.defineProperty(DW,"__esModule",{value:!0});DW.validateSchemaDeps=DW.validatePropertyDeps=DW.error=void 0;var Jb=t(),hh=Q0(),j3=R9();DW.error={message:({params:{property:_,depsCount:z,deps:A}})=>{let b=z===1?"property":"properties";return Jb.str`must have ${b} ${A} when property ${_} is present`},params:({params:{property:_,depsCount:z,deps:A,missingProperty:b}})=>Jb._`{property: ${_},
32
32
  missingProperty: ${b},
33
33
  depsCount: ${z},
34
- deps: ${A}}`};var Ih={keyword:"dependencies",type:"object",schemaType:"object",error:VW.error,code(_){let[z,A]=xh(_);qW(_,z),WW(_,A)}};function xh({schema:_}){let z={},A={};for(let b in _){if(b==="__proto__")continue;let G=Array.isArray(_[b])?z:A;G[b]=_[b]}return[z,A]}function qW(_,z=_.schema){let{gen:A,data:b,it:G}=_;if(Object.keys(z).length===0)return;let J=A.let("missing");for(let Y in z){let X=z[Y];if(X.length===0)continue;let Q=(0,O3.propertyInData)(A,b,Y,G.opts.ownProperties);if(_.setParams({property:Y,depsCount:X.length,deps:X.join(", ")}),G.allErrors)A.if(Q,()=>{for(let $ of X)(0,O3.checkReportMissingProp)(_,$)});else A.if(bb._`${Q} && (${(0,O3.checkMissingProp)(_,X,J)})`),(0,O3.reportMissingProp)(_,J),A.else()}}VW.validatePropertyDeps=qW;function WW(_,z=_.schema){let{gen:A,data:b,keyword:G,it:J}=_,Y=A.name("valid");for(let X in z){if((0,kh.alwaysValidSchema)(J,z[X]))continue;A.if((0,O3.propertyInData)(A,b,X,J.opts.ownProperties),()=>{let Q=_.subschema({keyword:G,schemaProp:X},Y);_.mergeValidEvaluated(Q,Y)},()=>A.var(Y,!0)),_.ok(Y)}}VW.validateSchemaDeps=WW;VW.default=Ih});var EW=I((wW)=>{Object.defineProperty(wW,"__esModule",{value:!0});var NW=t(),vh=Q0(),yh={message:"property name must be valid",params:({params:_})=>NW._`{propertyName: ${_.propertyName}}`},gh={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:yh,code(_){let{gen:z,schema:A,data:b,it:G}=_;if((0,vh.alwaysValidSchema)(G,A))return;let J=z.name("valid");z.forIn("key",b,(Y)=>{_.setParams({propertyName:Y}),_.subschema({keyword:"propertyNames",data:Y,dataTypes:["string"],propertyName:Y,compositeRule:!0},J),z.if((0,NW.not)(J),()=>{if(_.error(!0),!G.allErrors)z.break()})}),_.ok(J)}};wW.default=gh});var Gb=I((OW)=>{Object.defineProperty(OW,"__esModule",{value:!0});var rA=R9(),i9=t(),hh=v4(),nA=Q0(),mh={message:"must NOT have additional properties",params:({params:_})=>i9._`{additionalProperty: ${_.additionalProperty}}`},uh={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:mh,code(_){let{gen:z,schema:A,parentSchema:b,data:G,errsCount:J,it:Y}=_;if(!J)throw Error("ajv implementation error");let{allErrors:X,opts:Q}=Y;if(Y.props=!0,Q.removeAdditional!=="all"&&(0,nA.alwaysValidSchema)(Y,A))return;let $=(0,rA.allSchemaProperties)(b.properties),H=(0,rA.allSchemaProperties)(b.patternProperties);B(),_.ok(i9._`${J} === ${hh.default.errors}`);function B(){z.forIn("key",G,(W)=>{if(!$.length&&!H.length)K(W);else z.if(Z(W),()=>K(W))})}function Z(W){let V;if($.length>8){let w=(0,nA.schemaRefOrVal)(Y,b.properties,"properties");V=(0,rA.isOwnProperty)(z,w,W)}else if($.length)V=(0,i9.or)(...$.map((w)=>i9._`${W} === ${w}`));else V=i9.nil;if(H.length)V=(0,i9.or)(V,...H.map((w)=>i9._`${(0,rA.usePattern)(_,w)}.test(${W})`));return(0,i9.not)(V)}function F(W){z.code(i9._`delete ${G}[${W}]`)}function K(W){if(Q.removeAdditional==="all"||Q.removeAdditional&&A===!1){F(W);return}if(A===!1){if(_.setParams({additionalProperty:W}),_.error(),!X)z.break();return}if(typeof A=="object"&&!(0,nA.alwaysValidSchema)(Y,A)){let V=z.name("valid");if(Q.removeAdditional==="failing")q(W,V,!1),z.if((0,i9.not)(V),()=>{_.reset(),F(W)});else if(q(W,V),!X)z.if((0,i9.not)(V),()=>z.break())}}function q(W,V,w){let O={keyword:"additionalProperties",dataProp:W,dataPropType:nA.Type.Str};if(w===!1)Object.assign(O,{compositeRule:!0,createErrors:!1,allErrors:!1});_.subschema(O,V)}}};OW.default=uh});var PW=I((RW)=>{Object.defineProperty(RW,"__esModule",{value:!0});var lh=Z3(),LW=R9(),Jb=Q0(),jW=Gb(),ph={keyword:"properties",type:"object",schemaType:"object",code(_){let{gen:z,schema:A,parentSchema:b,data:G,it:J}=_;if(J.opts.removeAdditional==="all"&&b.additionalProperties===void 0)jW.default.code(new lh.KeywordCxt(J,jW.default,"additionalProperties"));let Y=(0,LW.allSchemaProperties)(A);for(let B of Y)J.definedProperties.add(B);if(J.opts.unevaluated&&Y.length&&J.props!==!0)J.props=Jb.mergeEvaluated.props(z,(0,Jb.toHash)(Y),J.props);let X=Y.filter((B)=>!(0,Jb.alwaysValidSchema)(J,A[B]));if(X.length===0)return;let Q=z.name("valid");for(let B of X){if($(B))H(B);else{if(z.if((0,LW.propertyInData)(z,G,B,J.opts.ownProperties)),H(B),!J.allErrors)z.else().var(Q,!0);z.endIf()}_.it.definedProperties.add(B),_.ok(Q)}function $(B){return J.opts.useDefaults&&!J.compositeRule&&A[B].default!==void 0}function H(B){_.subschema({keyword:"properties",schemaProp:B,dataProp:B},Q)}}};RW.default=ph});var TW=I((xW)=>{Object.defineProperty(xW,"__esModule",{value:!0});var SW=R9(),iA=t(),kW=Q0(),IW=Q0(),rh={keyword:"patternProperties",type:"object",schemaType:"object",code(_){let{gen:z,schema:A,data:b,parentSchema:G,it:J}=_,{opts:Y}=J,X=(0,SW.allSchemaProperties)(A),Q=X.filter((q)=>(0,kW.alwaysValidSchema)(J,A[q]));if(X.length===0||Q.length===X.length&&(!J.opts.unevaluated||J.props===!0))return;let $=Y.strictSchema&&!Y.allowMatchingProperties&&G.properties,H=z.name("valid");if(J.props!==!0&&!(J.props instanceof iA.Name))J.props=(0,IW.evaluatedPropsToName)(z,J.props);let{props:B}=J;Z();function Z(){for(let q of X){if($)F(q);if(J.allErrors)K(q);else z.var(H,!0),K(q),z.if(H)}}function F(q){for(let W in $)if(new RegExp(q).test(W))(0,kW.checkStrictMode)(J,`property ${W} matches pattern ${q} (use allowMatchingProperties)`)}function K(q){z.forIn("key",b,(W)=>{z.if(iA._`${(0,SW.usePattern)(_,q)}.test(${W})`,()=>{let V=Q.includes(q);if(!V)_.subschema({keyword:"patternProperties",schemaProp:q,dataProp:W,dataPropType:IW.Type.Str},H);if(J.opts.unevaluated&&B!==!0)z.assign(iA._`${B}[${W}]`,!0);else if(!V&&!J.allErrors)z.if((0,iA.not)(H),()=>z.break())})})}}};xW.default=rh});var vW=I((CW)=>{Object.defineProperty(CW,"__esModule",{value:!0});var ih=Q0(),oh={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(_){let{gen:z,schema:A,it:b}=_;if((0,ih.alwaysValidSchema)(b,A)){_.fail();return}let G=z.name("valid");_.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},G),_.failResult(G,()=>_.reset(),()=>_.error())},error:{message:"must NOT be valid"}};CW.default=oh});var gW=I((yW)=>{Object.defineProperty(yW,"__esModule",{value:!0});var sh=R9(),th={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:sh.validateUnion,error:{message:"must match a schema in anyOf"}};yW.default=th});var hW=I((fW)=>{Object.defineProperty(fW,"__esModule",{value:!0});var oA=t(),_m=Q0(),zm={message:"must match exactly one schema in oneOf",params:({params:_})=>oA._`{passingSchemas: ${_.passing}}`},Am={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:zm,code(_){let{gen:z,schema:A,parentSchema:b,it:G}=_;if(!Array.isArray(A))throw Error("ajv implementation error");if(G.opts.discriminator&&b.discriminator)return;let J=A,Y=z.let("valid",!1),X=z.let("passing",null),Q=z.name("_valid");_.setParams({passing:X}),z.block($),_.result(Y,()=>_.reset(),()=>_.error(!0));function $(){J.forEach((H,B)=>{let Z;if((0,_m.alwaysValidSchema)(G,H))z.var(Q,!0);else Z=_.subschema({keyword:"oneOf",schemaProp:B,compositeRule:!0},Q);if(B>0)z.if(oA._`${Q} && ${Y}`).assign(Y,!1).assign(X,oA._`[${X}, ${B}]`).else();z.if(Q,()=>{if(z.assign(Y,!0),z.assign(X,B),Z)_.mergeEvaluated(Z,oA.Name)})})}}};fW.default=Am});var uW=I((mW)=>{Object.defineProperty(mW,"__esModule",{value:!0});var Gm=Q0(),Jm={keyword:"allOf",schemaType:"array",code(_){let{gen:z,schema:A,it:b}=_;if(!Array.isArray(A))throw Error("ajv implementation error");let G=z.name("valid");A.forEach((J,Y)=>{if((0,Gm.alwaysValidSchema)(b,J))return;let X=_.subschema({keyword:"allOf",schemaProp:Y},G);_.ok(G),_.mergeEvaluated(X)})}};mW.default=Jm});var dW=I((pW)=>{Object.defineProperty(pW,"__esModule",{value:!0});var aA=t(),lW=Q0(),Xm={message:({params:_})=>aA.str`must match "${_.ifClause}" schema`,params:({params:_})=>aA._`{failingKeyword: ${_.ifClause}}`},Qm={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:Xm,code(_){let{gen:z,parentSchema:A,it:b}=_;if(A.then===void 0&&A.else===void 0)(0,lW.checkStrictMode)(b,'"if" without "then" and "else" is ignored');let G=cW(b,"then"),J=cW(b,"else");if(!G&&!J)return;let Y=z.let("valid",!0),X=z.name("_valid");if(Q(),_.reset(),G&&J){let H=z.let("ifClause");_.setParams({ifClause:H}),z.if(X,$("then",H),$("else",H))}else if(G)z.if(X,$("then"));else z.if((0,aA.not)(X),$("else"));_.pass(Y,()=>_.error(!0));function Q(){let H=_.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},X);_.mergeEvaluated(H)}function $(H,B){return()=>{let Z=_.subschema({keyword:H},X);if(z.assign(Y,X),_.mergeValidEvaluated(Z,Y),B)z.assign(B,aA._`${H}`);else _.setParams({ifClause:H})}}}};function cW(_,z){let A=_.schema[z];return A!==void 0&&!(0,lW.alwaysValidSchema)(_,A)}pW.default=Qm});var nW=I((rW)=>{Object.defineProperty(rW,"__esModule",{value:!0});var Hm=Q0(),Bm={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:_,parentSchema:z,it:A}){if(z.if===void 0)(0,Hm.checkStrictMode)(A,`"${_}" without "if" is ignored`)}};rW.default=Bm});var oW=I((iW)=>{Object.defineProperty(iW,"__esModule",{value:!0});var Fm=zb(),Km=$W(),qm=Ab(),Wm=ZW(),Vm=KW(),Um=MW(),Dm=EW(),Mm=Gb(),Nm=PW(),wm=TW(),Em=vW(),Om=gW(),Lm=hW(),jm=uW(),Rm=dW(),Pm=nW();function Sm(_=!1){let z=[Em.default,Om.default,Lm.default,jm.default,Rm.default,Pm.default,Dm.default,Mm.default,Um.default,Nm.default,wm.default];if(_)z.push(Km.default,Wm.default);else z.push(Fm.default,qm.default);return z.push(Vm.default),z}iW.default=Sm});var sW=I((aW)=>{Object.defineProperty(aW,"__esModule",{value:!0});var x0=t(),Im={message:({schemaCode:_})=>x0.str`must match format "${_}"`,params:({schemaCode:_})=>x0._`{format: ${_}}`},xm={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:Im,code(_,z){let{gen:A,data:b,$data:G,schema:J,schemaCode:Y,it:X}=_,{opts:Q,errSchemaPath:$,schemaEnv:H,self:B}=X;if(!Q.validateFormats)return;if(G)Z();else F();function Z(){let K=A.scopeValue("formats",{ref:B.formats,code:Q.code.formats}),q=A.const("fDef",x0._`${K}[${Y}]`),W=A.let("fType"),V=A.let("format");A.if(x0._`typeof ${q} == "object" && !(${q} instanceof RegExp)`,()=>A.assign(W,x0._`${q}.type || "string"`).assign(V,x0._`${q}.validate`),()=>A.assign(W,x0._`"string"`).assign(V,q)),_.fail$data((0,x0.or)(w(),O()));function w(){if(Q.strictSchema===!1)return x0.nil;return x0._`${Y} && !${V}`}function O(){let M=H.$async?x0._`(${q}.async ? await ${V}(${b}) : ${V}(${b}))`:x0._`${V}(${b})`,P=x0._`(typeof ${V} == "function" ? ${M} : ${V}.test(${b}))`;return x0._`${V} && ${V} !== true && ${W} === ${z} && !${P}`}}function F(){let K=B.formats[J];if(!K){w();return}if(K===!0)return;let[q,W,V]=O(K);if(q===z)_.pass(M());function w(){if(Q.strictSchema===!1){B.logger.warn(P());return}throw Error(P());function P(){return`unknown format "${J}" ignored in schema at path "${$}"`}}function O(P){let D=P instanceof RegExp?(0,x0.regexpCode)(P):Q.code.formats?x0._`${Q.code.formats}${(0,x0.getProperty)(J)}`:void 0,L=A.scopeValue("formats",{key:J,ref:P,code:D});if(typeof P=="object"&&!(P instanceof RegExp))return[P.type||"string",P.validate,x0._`${L}.validate`];return["string",P,L]}function M(){if(typeof K=="object"&&!(K instanceof RegExp)&&K.async){if(!H.$async)throw Error("async format in sync schema");return x0._`await ${V}(${b})`}return typeof W=="function"?x0._`${V}(${b})`:x0._`${V}.test(${b})`}}}};aW.default=xm});var eW=I((tW)=>{Object.defineProperty(tW,"__esModule",{value:!0});var Cm=sW(),vm=[Cm.default];tW.default=vm});var AV=I((_V)=>{Object.defineProperty(_V,"__esModule",{value:!0});_V.contentVocabulary=_V.metadataVocabulary=void 0;_V.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];_V.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var JV=I((GV)=>{Object.defineProperty(GV,"__esModule",{value:!0});var fm=Rq(),hm=_W(),mm=oW(),um=eW(),bV=AV(),cm=[fm.default,hm.default,(0,mm.default)(),um.default,bV.metadataVocabulary,bV.contentVocabulary];GV.default=cm});var $V=I((XV)=>{Object.defineProperty(XV,"__esModule",{value:!0});XV.DiscrError=void 0;var YV;(function(_){_.Tag="tag",_.Mapping="mapping"})(YV||(XV.DiscrError=YV={}))});var ZV=I((BV)=>{Object.defineProperty(BV,"__esModule",{value:!0});var p1=t(),Yb=$V(),HV=IA(),pm=F3(),dm=Q0(),rm={message:({params:{discrError:_,tagName:z}})=>_===Yb.DiscrError.Tag?`tag "${z}" must be string`:`value of tag "${z}" must be in oneOf`,params:({params:{discrError:_,tag:z,tagName:A}})=>p1._`{error: ${_}, tag: ${A}, tagValue: ${z}}`},nm={keyword:"discriminator",type:"object",schemaType:"object",error:rm,code(_){let{gen:z,data:A,schema:b,parentSchema:G,it:J}=_,{oneOf:Y}=G;if(!J.opts.discriminator)throw Error("discriminator: requires discriminator option");let X=b.propertyName;if(typeof X!="string")throw Error("discriminator: requires propertyName");if(b.mapping)throw Error("discriminator: mapping is not supported");if(!Y)throw Error("discriminator: requires oneOf keyword");let Q=z.let("valid",!1),$=z.const("tag",p1._`${A}${(0,p1.getProperty)(X)}`);z.if(p1._`typeof ${$} == "string"`,()=>H(),()=>_.error(!1,{discrError:Yb.DiscrError.Tag,tag:$,tagName:X})),_.ok(Q);function H(){let F=Z();z.if(!1);for(let K in F)z.elseIf(p1._`${$} === ${K}`),z.assign(Q,B(F[K]));z.else(),_.error(!1,{discrError:Yb.DiscrError.Mapping,tag:$,tagName:X}),z.endIf()}function B(F){let K=z.name("valid"),q=_.subschema({keyword:"oneOf",schemaProp:F},K);return _.mergeEvaluated(q,p1.Name),K}function Z(){var F;let K={},q=V(G),W=!0;for(let M=0;M<Y.length;M++){let P=Y[M];if((P===null||P===void 0?void 0:P.$ref)&&!(0,dm.schemaHasRulesButRef)(P,J.self.RULES)){let L=P.$ref;if(P=HV.resolveRef.call(J.self,J.schemaEnv.root,J.baseId,L),P instanceof HV.SchemaEnv)P=P.schema;if(P===void 0)throw new pm.default(J.opts.uriResolver,J.baseId,L)}let D=(F=P===null||P===void 0?void 0:P.properties)===null||F===void 0?void 0:F[X];if(typeof D!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${X}"`);W=W&&(q||V(P)),w(D,M)}if(!W)throw Error(`discriminator: "${X}" must be required`);return K;function V({required:M}){return Array.isArray(M)&&M.includes(X)}function w(M,P){if(M.const)O(M.const,P);else if(M.enum)for(let D of M.enum)O(D,P);else throw Error(`discriminator: "properties/${X}" must have "const" or "enum"`)}function O(M,P){if(typeof M!="string"||M in K)throw Error(`discriminator: "${X}" values must be unique strings`);K[M]=P}}}};BV.default=nm});var FV=I((P60,om)=>{om.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}});var Qb=I((F9,Xb)=>{Object.defineProperty(F9,"__esModule",{value:!0});F9.MissingRefError=F9.ValidationError=F9.CodeGen=F9.Name=F9.nil=F9.stringify=F9.str=F9._=F9.KeywordCxt=F9.Ajv=void 0;var am=Vq(),sm=JV(),tm=ZV(),KV=FV(),em=["/properties"],sA="http://json-schema.org/draft-07/schema";class L3 extends am.default{_addVocabularies(){if(super._addVocabularies(),sm.default.forEach((_)=>this.addVocabulary(_)),this.opts.discriminator)this.addKeyword(tm.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let _=this.opts.$data?this.$dataMetaSchema(KV,em):KV;this.addMetaSchema(_,sA,!1),this.refs["http://json-schema.org/schema"]=sA}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(sA)?sA:void 0)}}F9.Ajv=L3;Xb.exports=F9=L3;Xb.exports.Ajv=L3;Object.defineProperty(F9,"__esModule",{value:!0});F9.default=L3;var _u=Z3();Object.defineProperty(F9,"KeywordCxt",{enumerable:!0,get:function(){return _u.KeywordCxt}});var d1=t();Object.defineProperty(F9,"_",{enumerable:!0,get:function(){return d1._}});Object.defineProperty(F9,"str",{enumerable:!0,get:function(){return d1.str}});Object.defineProperty(F9,"stringify",{enumerable:!0,get:function(){return d1.stringify}});Object.defineProperty(F9,"nil",{enumerable:!0,get:function(){return d1.nil}});Object.defineProperty(F9,"Name",{enumerable:!0,get:function(){return d1.Name}});Object.defineProperty(F9,"CodeGen",{enumerable:!0,get:function(){return d1.CodeGen}});var zu=SA();Object.defineProperty(F9,"ValidationError",{enumerable:!0,get:function(){return zu.default}});var Au=F3();Object.defineProperty(F9,"MissingRefError",{enumerable:!0,get:function(){return Au.default}})});var OV=I((wV)=>{Object.defineProperty(wV,"__esModule",{value:!0});wV.formatNames=wV.fastFormats=wV.fullFormats=void 0;function K4(_,z){return{validate:_,compare:z}}wV.fullFormats={date:K4(UV,Zb),time:K4(Hb(!0),Fb),"date-time":K4(qV(!0),MV),"iso-time":K4(Hb(),DV),"iso-date-time":K4(qV(),NV),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:Hu,"uri-reference":/^(?:[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,"uri-template":/^(?:(?:[^\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,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,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:/^(?=.{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,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([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}))|:)))$/i,regex:Vu,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:Bu,int32:{type:"number",validate:Ku},int64:{type:"number",validate:qu},float:{type:"number",validate:VV},double:{type:"number",validate:VV},password:!0,binary:!0};wV.fastFormats={...wV.fullFormats,date:K4(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,Zb),time:K4(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Fb),"date-time":K4(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,MV),"iso-time":K4(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,DV),"iso-date-time":K4(/^\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,NV),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,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};wV.formatNames=Object.keys(wV.fullFormats);function Ju(_){return _%4===0&&(_%100!==0||_%400===0)}var Yu=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,Xu=[0,31,28,31,30,31,30,31,31,30,31,30,31];function UV(_){let z=Yu.exec(_);if(!z)return!1;let A=+z[1],b=+z[2],G=+z[3];return b>=1&&b<=12&&G>=1&&G<=(b===2&&Ju(A)?29:Xu[b])}function Zb(_,z){if(!(_&&z))return;if(_>z)return 1;if(_<z)return-1;return 0}var $b=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function Hb(_){return function(A){let b=$b.exec(A);if(!b)return!1;let G=+b[1],J=+b[2],Y=+b[3],X=b[4],Q=b[5]==="-"?-1:1,$=+(b[6]||0),H=+(b[7]||0);if($>23||H>59||_&&!X)return!1;if(G<=23&&J<=59&&Y<60)return!0;let B=J-H*Q,Z=G-$*Q-(B<0?1:0);return(Z===23||Z===-1)&&(B===59||B===-1)&&Y<61}}function Fb(_,z){if(!(_&&z))return;let A=new Date("2020-01-01T"+_).valueOf(),b=new Date("2020-01-01T"+z).valueOf();if(!(A&&b))return;return A-b}function DV(_,z){if(!(_&&z))return;let A=$b.exec(_),b=$b.exec(z);if(!(A&&b))return;if(_=A[1]+A[2]+A[3],z=b[1]+b[2]+b[3],_>z)return 1;if(_<z)return-1;return 0}var Bb=/t|\s/i;function qV(_){let z=Hb(_);return function(b){let G=b.split(Bb);return G.length===2&&UV(G[0])&&z(G[1])}}function MV(_,z){if(!(_&&z))return;let A=new Date(_).valueOf(),b=new Date(z).valueOf();if(!(A&&b))return;return A-b}function NV(_,z){if(!(_&&z))return;let[A,b]=_.split(Bb),[G,J]=z.split(Bb),Y=Zb(A,G);if(Y===void 0)return;return Y||Fb(b,J)}var Qu=/\/|:/,$u=/^(?:[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;function Hu(_){return Qu.test(_)&&$u.test(_)}var WV=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function Bu(_){return WV.lastIndex=0,WV.test(_)}var Zu=-2147483648,Fu=2147483647;function Ku(_){return Number.isInteger(_)&&_<=Fu&&_>=Zu}function qu(_){return Number.isInteger(_)}function VV(){return!0}var Wu=/[^\\]\\Z/;function Vu(_){if(Wu.test(_))return!1;try{return new RegExp(_),!0}catch(z){return!1}}});var jV=I((LV)=>{Object.defineProperty(LV,"__esModule",{value:!0});LV.formatLimitDefinition=void 0;var Du=Qb(),o9=t(),Z_=o9.operators,tA={formatMaximum:{okStr:"<=",ok:Z_.LTE,fail:Z_.GT},formatMinimum:{okStr:">=",ok:Z_.GTE,fail:Z_.LT},formatExclusiveMaximum:{okStr:"<",ok:Z_.LT,fail:Z_.GTE},formatExclusiveMinimum:{okStr:">",ok:Z_.GT,fail:Z_.LTE}},Mu={message:({keyword:_,schemaCode:z})=>o9.str`should be ${tA[_].okStr} ${z}`,params:({keyword:_,schemaCode:z})=>o9._`{comparison: ${tA[_].okStr}, limit: ${z}}`};LV.formatLimitDefinition={keyword:Object.keys(tA),type:"string",schemaType:"string",$data:!0,error:Mu,code(_){let{gen:z,data:A,schemaCode:b,keyword:G,it:J}=_,{opts:Y,self:X}=J;if(!Y.validateFormats)return;let Q=new Du.KeywordCxt(J,X.RULES.all.format.definition,"format");if(Q.$data)$();else H();function $(){let Z=z.scopeValue("formats",{ref:X.formats,code:Y.code.formats}),F=z.const("fmt",o9._`${Z}[${Q.schemaCode}]`);_.fail$data((0,o9.or)(o9._`typeof ${F} != "object"`,o9._`${F} instanceof RegExp`,o9._`typeof ${F}.compare != "function"`,B(F)))}function H(){let Z=Q.schema,F=X.formats[Z];if(!F||F===!0)return;if(typeof F!="object"||F instanceof RegExp||typeof F.compare!="function")throw Error(`"${G}": format "${Z}" does not define "compare" function`);let K=z.scopeValue("formats",{key:Z,ref:F,code:Y.code.formats?o9._`${Y.code.formats}${(0,o9.getProperty)(Z)}`:void 0});_.fail$data(B(K))}function B(Z){return o9._`${Z}.compare(${A}, ${b}) ${tA[G].fail} 0`}},dependencies:["format"]};var Nu=(_)=>{return _.addKeyword(LV.formatLimitDefinition),_};LV.default=Nu});var kV=I((j3,SV)=>{Object.defineProperty(j3,"__esModule",{value:!0});var r1=OV(),Eu=jV(),Wb=t(),RV=new Wb.Name("fullFormats"),Ou=new Wb.Name("fastFormats"),Vb=(_,z={keywords:!0})=>{if(Array.isArray(z))return PV(_,z,r1.fullFormats,RV),_;let[A,b]=z.mode==="fast"?[r1.fastFormats,Ou]:[r1.fullFormats,RV],G=z.formats||r1.formatNames;if(PV(_,G,A,b),z.keywords)(0,Eu.default)(_);return _};Vb.get=(_,z="full")=>{let b=(z==="fast"?r1.fastFormats:r1.fullFormats)[_];if(!b)throw Error(`Unknown format "${_}"`);return b};function PV(_,z,A,b){var G,J;(G=(J=_.opts.code).formats)!==null&&G!==void 0||(J.formats=Wb._`require("ajv-formats/dist/formats").${b}`);for(let Y of z)_.addFormat(Y,A[Y])}SV.exports=j3=Vb;Object.defineProperty(j3,"__esModule",{value:!0});j3.default=Vb});var cb=z8(ub(),1),{program:nu,createCommand:iu,createArgument:ou,createOption:au,CommanderError:su,InvalidArgumentError:tu,InvalidOptionArgumentError:eu,Command:lb,Argument:_c,Option:zc,Help:Ac}=cb.default;import{existsSync as q8,mkdirSync as dU,readFileSync as tb,writeFileSync as ab}from"fs";import{homedir as rU}from"os";import{join as eb}from"path";import{applyEdits as gU,findNodeAtLocation as pb,getNodeValue as fU,modify as hU,parseTree as db}from"jsonc-parser";function mU(_,z){let A=db(_);if(!A)return null;let b=pb(A,z);if(!b||!b.parent)return null;return{node:b,propertyNode:b.parent,tree:A}}function uU(_,z){let A=z.offset;while(A>0&&_[A-1]!==`
35
- `)A--;let b=_.slice(A,z.offset).includes("{");return{lineStart:A,isSingleLine:b}}function cU(_,z,A){let b=z-1;while(b>=0&&(_[b]===" "||_[b]==="\t"))b--;if(b>=0&&_[b]===`
34
+ deps: ${A}}`};var mh={keyword:"dependencies",type:"object",schemaType:"object",error:DW.error,code(_){let[z,A]=uh(_);VW(_,z),UW(_,A)}};function uh({schema:_}){let z={},A={};for(let b in _){if(b==="__proto__")continue;let G=Array.isArray(_[b])?z:A;G[b]=_[b]}return[z,A]}function VW(_,z=_.schema){let{gen:A,data:b,it:G}=_;if(Object.keys(z).length===0)return;let J=A.let("missing");for(let Y in z){let X=z[Y];if(X.length===0)continue;let Q=(0,j3.propertyInData)(A,b,Y,G.opts.ownProperties);if(_.setParams({property:Y,depsCount:X.length,deps:X.join(", ")}),G.allErrors)A.if(Q,()=>{for(let $ of X)(0,j3.checkReportMissingProp)(_,$)});else A.if(Jb._`${Q} && (${(0,j3.checkMissingProp)(_,X,J)})`),(0,j3.reportMissingProp)(_,J),A.else()}}DW.validatePropertyDeps=VW;function UW(_,z=_.schema){let{gen:A,data:b,keyword:G,it:J}=_,Y=A.name("valid");for(let X in z){if((0,hh.alwaysValidSchema)(J,z[X]))continue;A.if((0,j3.propertyInData)(A,b,X,J.opts.ownProperties),()=>{let Q=_.subschema({keyword:G,schemaProp:X},Y);_.mergeValidEvaluated(Q,Y)},()=>A.var(Y,!0)),_.ok(Y)}}DW.validateSchemaDeps=UW;DW.default=mh});var LW=I((OW)=>{Object.defineProperty(OW,"__esModule",{value:!0});var EW=t(),ph=Q0(),dh={message:"property name must be valid",params:({params:_})=>EW._`{propertyName: ${_.propertyName}}`},rh={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:dh,code(_){let{gen:z,schema:A,data:b,it:G}=_;if((0,ph.alwaysValidSchema)(G,A))return;let J=z.name("valid");z.forIn("key",b,(Y)=>{_.setParams({propertyName:Y}),_.subschema({keyword:"propertyNames",data:Y,dataTypes:["string"],propertyName:Y,compositeRule:!0},J),z.if((0,EW.not)(J),()=>{if(_.error(!0),!G.allErrors)z.break()})}),_.ok(J)}};OW.default=rh});var Yb=I((jW)=>{Object.defineProperty(jW,"__esModule",{value:!0});var oA=R9(),o9=t(),ih=v4(),aA=Q0(),oh={message:"must NOT have additional properties",params:({params:_})=>o9._`{additionalProperty: ${_.additionalProperty}}`},ah={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:oh,code(_){let{gen:z,schema:A,parentSchema:b,data:G,errsCount:J,it:Y}=_;if(!J)throw Error("ajv implementation error");let{allErrors:X,opts:Q}=Y;if(Y.props=!0,Q.removeAdditional!=="all"&&(0,aA.alwaysValidSchema)(Y,A))return;let $=(0,oA.allSchemaProperties)(b.properties),H=(0,oA.allSchemaProperties)(b.patternProperties);B(),_.ok(o9._`${J} === ${ih.default.errors}`);function B(){z.forIn("key",G,(W)=>{if(!$.length&&!H.length)K(W);else z.if(Z(W),()=>K(W))})}function Z(W){let V;if($.length>8){let w=(0,aA.schemaRefOrVal)(Y,b.properties,"properties");V=(0,oA.isOwnProperty)(z,w,W)}else if($.length)V=(0,o9.or)(...$.map((w)=>o9._`${W} === ${w}`));else V=o9.nil;if(H.length)V=(0,o9.or)(V,...H.map((w)=>o9._`${(0,oA.usePattern)(_,w)}.test(${W})`));return(0,o9.not)(V)}function F(W){z.code(o9._`delete ${G}[${W}]`)}function K(W){if(Q.removeAdditional==="all"||Q.removeAdditional&&A===!1){F(W);return}if(A===!1){if(_.setParams({additionalProperty:W}),_.error(),!X)z.break();return}if(typeof A=="object"&&!(0,aA.alwaysValidSchema)(Y,A)){let V=z.name("valid");if(Q.removeAdditional==="failing")q(W,V,!1),z.if((0,o9.not)(V),()=>{_.reset(),F(W)});else if(q(W,V),!X)z.if((0,o9.not)(V),()=>z.break())}}function q(W,V,w){let O={keyword:"additionalProperties",dataProp:W,dataPropType:aA.Type.Str};if(w===!1)Object.assign(O,{compositeRule:!0,createErrors:!1,allErrors:!1});_.subschema(O,V)}}};jW.default=ah});var kW=I((SW)=>{Object.defineProperty(SW,"__esModule",{value:!0});var th=K3(),RW=R9(),Xb=Q0(),PW=Yb(),eh={keyword:"properties",type:"object",schemaType:"object",code(_){let{gen:z,schema:A,parentSchema:b,data:G,it:J}=_;if(J.opts.removeAdditional==="all"&&b.additionalProperties===void 0)PW.default.code(new th.KeywordCxt(J,PW.default,"additionalProperties"));let Y=(0,RW.allSchemaProperties)(A);for(let B of Y)J.definedProperties.add(B);if(J.opts.unevaluated&&Y.length&&J.props!==!0)J.props=Xb.mergeEvaluated.props(z,(0,Xb.toHash)(Y),J.props);let X=Y.filter((B)=>!(0,Xb.alwaysValidSchema)(J,A[B]));if(X.length===0)return;let Q=z.name("valid");for(let B of X){if($(B))H(B);else{if(z.if((0,RW.propertyInData)(z,G,B,J.opts.ownProperties)),H(B),!J.allErrors)z.else().var(Q,!0);z.endIf()}_.it.definedProperties.add(B),_.ok(Q)}function $(B){return J.opts.useDefaults&&!J.compositeRule&&A[B].default!==void 0}function H(B){_.subschema({keyword:"properties",schemaProp:B,dataProp:B},Q)}}};SW.default=eh});var vW=I((CW)=>{Object.defineProperty(CW,"__esModule",{value:!0});var IW=R9(),sA=t(),xW=Q0(),TW=Q0(),zm={keyword:"patternProperties",type:"object",schemaType:"object",code(_){let{gen:z,schema:A,data:b,parentSchema:G,it:J}=_,{opts:Y}=J,X=(0,IW.allSchemaProperties)(A),Q=X.filter((q)=>(0,xW.alwaysValidSchema)(J,A[q]));if(X.length===0||Q.length===X.length&&(!J.opts.unevaluated||J.props===!0))return;let $=Y.strictSchema&&!Y.allowMatchingProperties&&G.properties,H=z.name("valid");if(J.props!==!0&&!(J.props instanceof sA.Name))J.props=(0,TW.evaluatedPropsToName)(z,J.props);let{props:B}=J;Z();function Z(){for(let q of X){if($)F(q);if(J.allErrors)K(q);else z.var(H,!0),K(q),z.if(H)}}function F(q){for(let W in $)if(new RegExp(q).test(W))(0,xW.checkStrictMode)(J,`property ${W} matches pattern ${q} (use allowMatchingProperties)`)}function K(q){z.forIn("key",b,(W)=>{z.if(sA._`${(0,IW.usePattern)(_,q)}.test(${W})`,()=>{let V=Q.includes(q);if(!V)_.subschema({keyword:"patternProperties",schemaProp:q,dataProp:W,dataPropType:TW.Type.Str},H);if(J.opts.unevaluated&&B!==!0)z.assign(sA._`${B}[${W}]`,!0);else if(!V&&!J.allErrors)z.if((0,sA.not)(H),()=>z.break())})})}}};CW.default=zm});var gW=I((yW)=>{Object.defineProperty(yW,"__esModule",{value:!0});var bm=Q0(),Gm={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(_){let{gen:z,schema:A,it:b}=_;if((0,bm.alwaysValidSchema)(b,A)){_.fail();return}let G=z.name("valid");_.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},G),_.failResult(G,()=>_.reset(),()=>_.error())},error:{message:"must NOT be valid"}};yW.default=Gm});var hW=I((fW)=>{Object.defineProperty(fW,"__esModule",{value:!0});var Ym=R9(),Xm={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Ym.validateUnion,error:{message:"must match a schema in anyOf"}};fW.default=Xm});var uW=I((mW)=>{Object.defineProperty(mW,"__esModule",{value:!0});var tA=t(),$m=Q0(),Hm={message:"must match exactly one schema in oneOf",params:({params:_})=>tA._`{passingSchemas: ${_.passing}}`},Bm={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:Hm,code(_){let{gen:z,schema:A,parentSchema:b,it:G}=_;if(!Array.isArray(A))throw Error("ajv implementation error");if(G.opts.discriminator&&b.discriminator)return;let J=A,Y=z.let("valid",!1),X=z.let("passing",null),Q=z.name("_valid");_.setParams({passing:X}),z.block($),_.result(Y,()=>_.reset(),()=>_.error(!0));function $(){J.forEach((H,B)=>{let Z;if((0,$m.alwaysValidSchema)(G,H))z.var(Q,!0);else Z=_.subschema({keyword:"oneOf",schemaProp:B,compositeRule:!0},Q);if(B>0)z.if(tA._`${Q} && ${Y}`).assign(Y,!1).assign(X,tA._`[${X}, ${B}]`).else();z.if(Q,()=>{if(z.assign(Y,!0),z.assign(X,B),Z)_.mergeEvaluated(Z,tA.Name)})})}}};mW.default=Bm});var lW=I((cW)=>{Object.defineProperty(cW,"__esModule",{value:!0});var Fm=Q0(),Km={keyword:"allOf",schemaType:"array",code(_){let{gen:z,schema:A,it:b}=_;if(!Array.isArray(A))throw Error("ajv implementation error");let G=z.name("valid");A.forEach((J,Y)=>{if((0,Fm.alwaysValidSchema)(b,J))return;let X=_.subschema({keyword:"allOf",schemaProp:Y},G);_.ok(G),_.mergeEvaluated(X)})}};cW.default=Km});var nW=I((rW)=>{Object.defineProperty(rW,"__esModule",{value:!0});var eA=t(),dW=Q0(),Wm={message:({params:_})=>eA.str`must match "${_.ifClause}" schema`,params:({params:_})=>eA._`{failingKeyword: ${_.ifClause}}`},Vm={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:Wm,code(_){let{gen:z,parentSchema:A,it:b}=_;if(A.then===void 0&&A.else===void 0)(0,dW.checkStrictMode)(b,'"if" without "then" and "else" is ignored');let G=pW(b,"then"),J=pW(b,"else");if(!G&&!J)return;let Y=z.let("valid",!0),X=z.name("_valid");if(Q(),_.reset(),G&&J){let H=z.let("ifClause");_.setParams({ifClause:H}),z.if(X,$("then",H),$("else",H))}else if(G)z.if(X,$("then"));else z.if((0,eA.not)(X),$("else"));_.pass(Y,()=>_.error(!0));function Q(){let H=_.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},X);_.mergeEvaluated(H)}function $(H,B){return()=>{let Z=_.subschema({keyword:H},X);if(z.assign(Y,X),_.mergeValidEvaluated(Z,Y),B)z.assign(B,eA._`${H}`);else _.setParams({ifClause:H})}}}};function pW(_,z){let A=_.schema[z];return A!==void 0&&!(0,dW.alwaysValidSchema)(_,A)}rW.default=Vm});var oW=I((iW)=>{Object.defineProperty(iW,"__esModule",{value:!0});var Dm=Q0(),Mm={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:_,parentSchema:z,it:A}){if(z.if===void 0)(0,Dm.checkStrictMode)(A,`"${_}" without "if" is ignored`)}};iW.default=Mm});var sW=I((aW)=>{Object.defineProperty(aW,"__esModule",{value:!0});var wm=bb(),Em=BW(),Om=Gb(),Lm=KW(),jm=WW(),Rm=wW(),Pm=LW(),Sm=Yb(),km=kW(),Im=vW(),xm=gW(),Tm=hW(),Cm=uW(),vm=lW(),ym=nW(),gm=oW();function fm(_=!1){let z=[xm.default,Tm.default,Cm.default,vm.default,ym.default,gm.default,Pm.default,Sm.default,Rm.default,km.default,Im.default];if(_)z.push(Em.default,Lm.default);else z.push(wm.default,Om.default);return z.push(jm.default),z}aW.default=fm});var eW=I((tW)=>{Object.defineProperty(tW,"__esModule",{value:!0});var x0=t(),mm={message:({schemaCode:_})=>x0.str`must match format "${_}"`,params:({schemaCode:_})=>x0._`{format: ${_}}`},um={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:mm,code(_,z){let{gen:A,data:b,$data:G,schema:J,schemaCode:Y,it:X}=_,{opts:Q,errSchemaPath:$,schemaEnv:H,self:B}=X;if(!Q.validateFormats)return;if(G)Z();else F();function Z(){let K=A.scopeValue("formats",{ref:B.formats,code:Q.code.formats}),q=A.const("fDef",x0._`${K}[${Y}]`),W=A.let("fType"),V=A.let("format");A.if(x0._`typeof ${q} == "object" && !(${q} instanceof RegExp)`,()=>A.assign(W,x0._`${q}.type || "string"`).assign(V,x0._`${q}.validate`),()=>A.assign(W,x0._`"string"`).assign(V,q)),_.fail$data((0,x0.or)(w(),O()));function w(){if(Q.strictSchema===!1)return x0.nil;return x0._`${Y} && !${V}`}function O(){let M=H.$async?x0._`(${q}.async ? await ${V}(${b}) : ${V}(${b}))`:x0._`${V}(${b})`,P=x0._`(typeof ${V} == "function" ? ${M} : ${V}.test(${b}))`;return x0._`${V} && ${V} !== true && ${W} === ${z} && !${P}`}}function F(){let K=B.formats[J];if(!K){w();return}if(K===!0)return;let[q,W,V]=O(K);if(q===z)_.pass(M());function w(){if(Q.strictSchema===!1){B.logger.warn(P());return}throw Error(P());function P(){return`unknown format "${J}" ignored in schema at path "${$}"`}}function O(P){let D=P instanceof RegExp?(0,x0.regexpCode)(P):Q.code.formats?x0._`${Q.code.formats}${(0,x0.getProperty)(J)}`:void 0,L=A.scopeValue("formats",{key:J,ref:P,code:D});if(typeof P=="object"&&!(P instanceof RegExp))return[P.type||"string",P.validate,x0._`${L}.validate`];return["string",P,L]}function M(){if(typeof K=="object"&&!(K instanceof RegExp)&&K.async){if(!H.$async)throw Error("async format in sync schema");return x0._`await ${V}(${b})`}return typeof W=="function"?x0._`${V}(${b})`:x0._`${V}.test(${b})`}}}};tW.default=um});var zV=I((_V)=>{Object.defineProperty(_V,"__esModule",{value:!0});var lm=eW(),pm=[lm.default];_V.default=pm});var GV=I((AV)=>{Object.defineProperty(AV,"__esModule",{value:!0});AV.contentVocabulary=AV.metadataVocabulary=void 0;AV.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];AV.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var XV=I((YV)=>{Object.defineProperty(YV,"__esModule",{value:!0});var nm=Sq(),im=AW(),om=sW(),am=zV(),JV=GV(),sm=[nm.default,im.default,(0,om.default)(),am.default,JV.metadataVocabulary,JV.contentVocabulary];YV.default=sm});var BV=I(($V)=>{Object.defineProperty($V,"__esModule",{value:!0});$V.DiscrError=void 0;var QV;(function(_){_.Tag="tag",_.Mapping="mapping"})(QV||($V.DiscrError=QV={}))});var KV=I((FV)=>{Object.defineProperty(FV,"__esModule",{value:!0});var r1=t(),Qb=BV(),ZV=CA(),em=q3(),_u=Q0(),zu={message:({params:{discrError:_,tagName:z}})=>_===Qb.DiscrError.Tag?`tag "${z}" must be string`:`value of tag "${z}" must be in oneOf`,params:({params:{discrError:_,tag:z,tagName:A}})=>r1._`{error: ${_}, tag: ${A}, tagValue: ${z}}`},Au={keyword:"discriminator",type:"object",schemaType:"object",error:zu,code(_){let{gen:z,data:A,schema:b,parentSchema:G,it:J}=_,{oneOf:Y}=G;if(!J.opts.discriminator)throw Error("discriminator: requires discriminator option");let X=b.propertyName;if(typeof X!="string")throw Error("discriminator: requires propertyName");if(b.mapping)throw Error("discriminator: mapping is not supported");if(!Y)throw Error("discriminator: requires oneOf keyword");let Q=z.let("valid",!1),$=z.const("tag",r1._`${A}${(0,r1.getProperty)(X)}`);z.if(r1._`typeof ${$} == "string"`,()=>H(),()=>_.error(!1,{discrError:Qb.DiscrError.Tag,tag:$,tagName:X})),_.ok(Q);function H(){let F=Z();z.if(!1);for(let K in F)z.elseIf(r1._`${$} === ${K}`),z.assign(Q,B(F[K]));z.else(),_.error(!1,{discrError:Qb.DiscrError.Mapping,tag:$,tagName:X}),z.endIf()}function B(F){let K=z.name("valid"),q=_.subschema({keyword:"oneOf",schemaProp:F},K);return _.mergeEvaluated(q,r1.Name),K}function Z(){var F;let K={},q=V(G),W=!0;for(let M=0;M<Y.length;M++){let P=Y[M];if((P===null||P===void 0?void 0:P.$ref)&&!(0,_u.schemaHasRulesButRef)(P,J.self.RULES)){let L=P.$ref;if(P=ZV.resolveRef.call(J.self,J.schemaEnv.root,J.baseId,L),P instanceof ZV.SchemaEnv)P=P.schema;if(P===void 0)throw new em.default(J.opts.uriResolver,J.baseId,L)}let D=(F=P===null||P===void 0?void 0:P.properties)===null||F===void 0?void 0:F[X];if(typeof D!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${X}"`);W=W&&(q||V(P)),w(D,M)}if(!W)throw Error(`discriminator: "${X}" must be required`);return K;function V({required:M}){return Array.isArray(M)&&M.includes(X)}function w(M,P){if(M.const)O(M.const,P);else if(M.enum)for(let D of M.enum)O(D,P);else throw Error(`discriminator: "properties/${X}" must have "const" or "enum"`)}function O(M,P){if(typeof M!="string"||M in K)throw Error(`discriminator: "${X}" values must be unique strings`);K[M]=P}}}};FV.default=Au});var qV=I((f60,Gu)=>{Gu.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}});var Hb=I((F9,$b)=>{Object.defineProperty(F9,"__esModule",{value:!0});F9.MissingRefError=F9.ValidationError=F9.CodeGen=F9.Name=F9.nil=F9.stringify=F9.str=F9._=F9.KeywordCxt=F9.Ajv=void 0;var Ju=Dq(),Yu=XV(),Xu=KV(),WV=qV(),Qu=["/properties"],_8="http://json-schema.org/draft-07/schema";class R3 extends Ju.default{_addVocabularies(){if(super._addVocabularies(),Yu.default.forEach((_)=>this.addVocabulary(_)),this.opts.discriminator)this.addKeyword(Xu.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let _=this.opts.$data?this.$dataMetaSchema(WV,Qu):WV;this.addMetaSchema(_,_8,!1),this.refs["http://json-schema.org/schema"]=_8}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(_8)?_8:void 0)}}F9.Ajv=R3;$b.exports=F9=R3;$b.exports.Ajv=R3;Object.defineProperty(F9,"__esModule",{value:!0});F9.default=R3;var $u=K3();Object.defineProperty(F9,"KeywordCxt",{enumerable:!0,get:function(){return $u.KeywordCxt}});var n1=t();Object.defineProperty(F9,"_",{enumerable:!0,get:function(){return n1._}});Object.defineProperty(F9,"str",{enumerable:!0,get:function(){return n1.str}});Object.defineProperty(F9,"stringify",{enumerable:!0,get:function(){return n1.stringify}});Object.defineProperty(F9,"nil",{enumerable:!0,get:function(){return n1.nil}});Object.defineProperty(F9,"Name",{enumerable:!0,get:function(){return n1.Name}});Object.defineProperty(F9,"CodeGen",{enumerable:!0,get:function(){return n1.CodeGen}});var Hu=xA();Object.defineProperty(F9,"ValidationError",{enumerable:!0,get:function(){return Hu.default}});var Bu=q3();Object.defineProperty(F9,"MissingRefError",{enumerable:!0,get:function(){return Bu.default}})});var jV=I((OV)=>{Object.defineProperty(OV,"__esModule",{value:!0});OV.formatNames=OV.fastFormats=OV.fullFormats=void 0;function K4(_,z){return{validate:_,compare:z}}OV.fullFormats={date:K4(MV,Kb),time:K4(Zb(!0),qb),"date-time":K4(VV(!0),wV),"iso-time":K4(Zb(),NV),"iso-date-time":K4(VV(),EV),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:Du,"uri-reference":/^(?:[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,"uri-template":/^(?:(?:[^\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,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,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:/^(?=.{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,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([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}))|:)))$/i,regex:ju,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:Mu,int32:{type:"number",validate:Eu},int64:{type:"number",validate:Ou},float:{type:"number",validate:DV},double:{type:"number",validate:DV},password:!0,binary:!0};OV.fastFormats={...OV.fullFormats,date:K4(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,Kb),time:K4(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,qb),"date-time":K4(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,wV),"iso-time":K4(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,NV),"iso-date-time":K4(/^\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,EV),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,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};OV.formatNames=Object.keys(OV.fullFormats);function Ku(_){return _%4===0&&(_%100!==0||_%400===0)}var qu=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,Wu=[0,31,28,31,30,31,30,31,31,30,31,30,31];function MV(_){let z=qu.exec(_);if(!z)return!1;let A=+z[1],b=+z[2],G=+z[3];return b>=1&&b<=12&&G>=1&&G<=(b===2&&Ku(A)?29:Wu[b])}function Kb(_,z){if(!(_&&z))return;if(_>z)return 1;if(_<z)return-1;return 0}var Bb=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function Zb(_){return function(A){let b=Bb.exec(A);if(!b)return!1;let G=+b[1],J=+b[2],Y=+b[3],X=b[4],Q=b[5]==="-"?-1:1,$=+(b[6]||0),H=+(b[7]||0);if($>23||H>59||_&&!X)return!1;if(G<=23&&J<=59&&Y<60)return!0;let B=J-H*Q,Z=G-$*Q-(B<0?1:0);return(Z===23||Z===-1)&&(B===59||B===-1)&&Y<61}}function qb(_,z){if(!(_&&z))return;let A=new Date("2020-01-01T"+_).valueOf(),b=new Date("2020-01-01T"+z).valueOf();if(!(A&&b))return;return A-b}function NV(_,z){if(!(_&&z))return;let A=Bb.exec(_),b=Bb.exec(z);if(!(A&&b))return;if(_=A[1]+A[2]+A[3],z=b[1]+b[2]+b[3],_>z)return 1;if(_<z)return-1;return 0}var Fb=/t|\s/i;function VV(_){let z=Zb(_);return function(b){let G=b.split(Fb);return G.length===2&&MV(G[0])&&z(G[1])}}function wV(_,z){if(!(_&&z))return;let A=new Date(_).valueOf(),b=new Date(z).valueOf();if(!(A&&b))return;return A-b}function EV(_,z){if(!(_&&z))return;let[A,b]=_.split(Fb),[G,J]=z.split(Fb),Y=Kb(A,G);if(Y===void 0)return;return Y||qb(b,J)}var Vu=/\/|:/,Uu=/^(?:[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;function Du(_){return Vu.test(_)&&Uu.test(_)}var UV=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function Mu(_){return UV.lastIndex=0,UV.test(_)}var Nu=-2147483648,wu=2147483647;function Eu(_){return Number.isInteger(_)&&_<=wu&&_>=Nu}function Ou(_){return Number.isInteger(_)}function DV(){return!0}var Lu=/[^\\]\\Z/;function ju(_){if(Lu.test(_))return!1;try{return new RegExp(_),!0}catch(z){return!1}}});var PV=I((RV)=>{Object.defineProperty(RV,"__esModule",{value:!0});RV.formatLimitDefinition=void 0;var Pu=Hb(),a9=t(),Z_=a9.operators,z8={formatMaximum:{okStr:"<=",ok:Z_.LTE,fail:Z_.GT},formatMinimum:{okStr:">=",ok:Z_.GTE,fail:Z_.LT},formatExclusiveMaximum:{okStr:"<",ok:Z_.LT,fail:Z_.GTE},formatExclusiveMinimum:{okStr:">",ok:Z_.GT,fail:Z_.LTE}},Su={message:({keyword:_,schemaCode:z})=>a9.str`should be ${z8[_].okStr} ${z}`,params:({keyword:_,schemaCode:z})=>a9._`{comparison: ${z8[_].okStr}, limit: ${z}}`};RV.formatLimitDefinition={keyword:Object.keys(z8),type:"string",schemaType:"string",$data:!0,error:Su,code(_){let{gen:z,data:A,schemaCode:b,keyword:G,it:J}=_,{opts:Y,self:X}=J;if(!Y.validateFormats)return;let Q=new Pu.KeywordCxt(J,X.RULES.all.format.definition,"format");if(Q.$data)$();else H();function $(){let Z=z.scopeValue("formats",{ref:X.formats,code:Y.code.formats}),F=z.const("fmt",a9._`${Z}[${Q.schemaCode}]`);_.fail$data((0,a9.or)(a9._`typeof ${F} != "object"`,a9._`${F} instanceof RegExp`,a9._`typeof ${F}.compare != "function"`,B(F)))}function H(){let Z=Q.schema,F=X.formats[Z];if(!F||F===!0)return;if(typeof F!="object"||F instanceof RegExp||typeof F.compare!="function")throw Error(`"${G}": format "${Z}" does not define "compare" function`);let K=z.scopeValue("formats",{key:Z,ref:F,code:Y.code.formats?a9._`${Y.code.formats}${(0,a9.getProperty)(Z)}`:void 0});_.fail$data(B(K))}function B(Z){return a9._`${Z}.compare(${A}, ${b}) ${z8[G].fail} 0`}},dependencies:["format"]};var ku=(_)=>{return _.addKeyword(RV.formatLimitDefinition),_};RV.default=ku});var xV=I((P3,IV)=>{Object.defineProperty(P3,"__esModule",{value:!0});var i1=jV(),xu=PV(),Ub=t(),SV=new Ub.Name("fullFormats"),Tu=new Ub.Name("fastFormats"),Db=(_,z={keywords:!0})=>{if(Array.isArray(z))return kV(_,z,i1.fullFormats,SV),_;let[A,b]=z.mode==="fast"?[i1.fastFormats,Tu]:[i1.fullFormats,SV],G=z.formats||i1.formatNames;if(kV(_,G,A,b),z.keywords)(0,xu.default)(_);return _};Db.get=(_,z="full")=>{let b=(z==="fast"?i1.fastFormats:i1.fullFormats)[_];if(!b)throw Error(`Unknown format "${_}"`);return b};function kV(_,z,A,b){var G,J;(G=(J=_.opts.code).formats)!==null&&G!==void 0||(J.formats=Ub._`require("ajv-formats/dist/formats").${b}`);for(let Y of z)_.addFormat(Y,A[Y])}IV.exports=P3=Db;Object.defineProperty(P3,"__esModule",{value:!0});P3.default=Db});var pb=G8(lb(),1),{program:Ac,createCommand:bc,createArgument:Gc,createOption:Jc,CommanderError:Yc,InvalidArgumentError:Xc,InvalidOptionArgumentError:Qc,Command:db,Argument:$c,Option:Hc,Help:Bc}=pb.default;import{existsSync as U8,mkdirSync as nU,readFileSync as _G,writeFileSync as tb}from"fs";import{homedir as iU}from"os";import{join as zG}from"path";import{applyEdits as hU,findNodeAtLocation as rb,getNodeValue as mU,modify as uU,parseTree as nb}from"jsonc-parser";function cU(_,z){let A=nb(_);if(!A)return null;let b=rb(A,z);if(!b||!b.parent)return null;return{node:b,propertyNode:b.parent,tree:A}}function lU(_,z){let A=z.offset;while(A>0&&_[A-1]!==`
35
+ `)A--;let b=_.slice(A,z.offset).includes("{");return{lineStart:A,isSingleLine:b}}function pU(_,z,A){let b=z-1;while(b>=0&&(_[b]===" "||_[b]==="\t"))b--;if(b>=0&&_[b]===`
36
36
  `){if(b--,b>=0&&_[b]==="\r")b--}else return null;while(b>=0&&(_[b]===" "||_[b]==="\t"))b--;if(b<0)return null;if(b>=1&&_[b]==="/"&&_[b-1]==="*"){let X=b-2;while(X>=1){if(_[X-1]==="/"&&_[X]==="*"){if(_.slice(X+1,b-1).trim().startsWith(`${A}:`)){let Q=X-1;while(Q>0&&_[Q-1]!==`
37
37
  `)Q--;return Q}return null}X--}return null}let G=b;while(b>=0&&_[b]!==`
38
- `)b--;let J=b+1,Y=_.slice(J,G+1).trim();if(Y.startsWith("//")){if(Y.slice(2).trim().startsWith(`${A}:`))return J}return null}function rb(_,z=[]){let A=[];for(let[b,G]of Object.entries(_)){let J=[...z,b];if(G===void 0)A.push({path:J,value:void 0});else if(G!==null&&typeof G==="object"&&!Array.isArray(G))A.push(...rb(G,J));else A.push({path:J,value:G})}return A}function nb(_,z){let A=db(_);if(!A)return;let b=pb(A,z);if(!b)return;return fU(b)}function lU(_,z){let A=String(z[z.length-1]),b=mU(_,z);if(!b)return _;let{propertyNode:G}=b,{lineStart:J,isSingleLine:Y}=uU(_,G),X=!Y?cU(_,G.offset,A):null,Q;if(X!==null)Q=X;else if(Y)Q=G.offset;else Q=J;let $=G.offset+G.length;if($<_.length&&_[$]===",")$++;while($<_.length&&(_[$]===" "||_[$]==="\t"))$++;if(!Y){if($<_.length&&_[$]===`
38
+ `)b--;let J=b+1,Y=_.slice(J,G+1).trim();if(Y.startsWith("//")){if(Y.slice(2).trim().startsWith(`${A}:`))return J}return null}function ib(_,z=[]){let A=[];for(let[b,G]of Object.entries(_)){let J=[...z,b];if(G===void 0)A.push({path:J,value:void 0});else if(G!==null&&typeof G==="object"&&!Array.isArray(G))A.push(...ib(G,J));else A.push({path:J,value:G})}return A}function ob(_,z){let A=nb(_);if(!A)return;let b=rb(A,z);if(!b)return;return mU(b)}function dU(_,z){let A=String(z[z.length-1]),b=cU(_,z);if(!b)return _;let{propertyNode:G}=b,{lineStart:J,isSingleLine:Y}=lU(_,G),X=!Y?pU(_,G.offset,A):null,Q;if(X!==null)Q=X;else if(Y)Q=G.offset;else Q=J;let $=G.offset+G.length;if($<_.length&&_[$]===",")$++;while($<_.length&&(_[$]===" "||_[$]==="\t"))$++;if(!Y){if($<_.length&&_[$]===`
39
39
  `)$++;else if($<_.length&&_[$]==="\r"){if($++,$<_.length&&_[$]===`
40
- `)$++}}let H=_.slice(0,Q),B=_.slice($),Z=H+B,F=H.trimEnd(),K=B.trimStart();if(F.endsWith(",")&&K.startsWith("}")){let q=H.lastIndexOf(",");Z=H.slice(0,q)+H.slice(q+1)+B}return Z}function ib(_,z){let A=_,b=rb(z);for(let{path:G,value:J}of b)if(J===void 0)A=lU(A,G);else{let Y=hU(A,G,J,{});A=gU(A,Y)}return A}import*as i1 from"fs/promises";import*as a9 from"path";function B8(_){let z=_.match(/git@([^:]+):(.+?)(?:\.git)?$/);if(z)return`${z[1]}/${z[2]}`;let A=_.match(/https?:\/\/([^/]+)\/(.+?)(?:\.git)?$/);if(A)return`${A[1]}/${A[2]}`;return null}async function Z8(_){let z=a9.resolve(_),{root:A}=a9.parse(z);while(!0){let b=a9.join(z,".git");try{let J=await i1.stat(b);if(J.isDirectory()||J.isFile())return z}catch{}if(z===A)return null;let G=a9.dirname(z);if(G===z)return null;z=G}}async function pU(_){try{let z=a9.join(_,".git","config"),b=(await i1.readFile(z,"utf8")).match(/\[remote "origin"\]\s+url\s*=\s*(.+)/i);if(!b||!b[1])return null;return b[1].trim()}catch{return null}}async function F8(_){let z=await pU(_);if(!z)return null;return B8(z)}async function a0(_){let z=_??process.cwd(),A=await Z8(z);if(!A)return null;return F8(A)}async function ob(_,z){try{let A=a9.join(_,".git","HEAD"),G=(await i1.readFile(A,"utf8")).trim();if(G.startsWith("ref:")){let Y=G.slice(4).trim().split("/");return Y[Y.length-1]??z??null}return G||z||null}catch{return z??null}}var K8=eb(rU(),".config","agentlogs"),F_=eb(K8,"settings.json"),sb={allowMode:"denylist",repos:{}};function _G(){if(!q8(K8))dU(K8,{recursive:!0})}function s9(){if(_G(),!q8(F_))return{...sb};try{let _=tb(F_,"utf-8"),z=nb(_,[]);return{allowMode:z.allowMode==="allowlist"?"allowlist":"denylist",repos:typeof z.repos==="object"&&z.repos!==null?z.repos:{}}}catch{return{...sb}}}function W8(_){_G();try{if(q8(F_)){let z=tb(F_,"utf-8"),A=ib(z,_);ab(F_,A,"utf-8")}else ab(F_,JSON.stringify(_,null,2),"utf-8")}catch(z){throw console.error("Failed to write settings file:",z),z}}function t9(_){if(!_)return s9().allowMode==="denylist";let z=s9(),A=z.repos[_];if(z.allowMode==="denylist"){if(!A)return!0;return A.allow}else{if(!A)return!1;return A.allow}}function V8(_){if(!_)return;return s9().repos[_]?.visibility}function zG(_,z){let A=s9();A.repos[_]={allow:!0,...z&&{visibility:z}},W8(A)}function AG(_){let z=s9();z.repos[_]={allow:!1},W8(z)}function bG(_){let z=s9();z.allowMode=_,W8(z)}function GG(){return F_}async function JG(_={}){let z=await a0();if(!z)console.error("Could not detect repository."),console.error("Make sure you are in a git repository with a remote origin configured."),process.exit(1);let A;if(_.public)A="public";else if(_.team)A="team";else if(_.private)A="private";else if(_.visibility){let J=_.visibility.toLowerCase();if(J!=="public"&&J!=="team"&&J!=="private")console.error("Invalid visibility. Use 'public', 'team', or 'private'."),process.exit(1);A=J}zG(z,A);let G=s9().repos[z];if(console.log(`✓ Capture enabled for: ${z}`),G?.visibility)console.log(` Visibility: ${G.visibility}`);else console.log(" Visibility: (server default)");process.exit(0)}async function YG(){let _=await a0();if(!_)console.error("Could not detect repository."),console.error("Make sure you are in a git repository with a remote origin configured."),process.exit(1);AG(_),console.log(`✗ Capture disabled for: ${_}`),process.exit(0)}import k8 from"node:process";import OG from"node:path";import{fileURLToPath as OD}from"node:url";import LD from"node:child_process";import jD,{constants as RD}from"node:fs/promises";import{promisify as bD}from"node:util";import GD from"node:child_process";import w8,{constants as FG}from"node:fs/promises";import $G from"node:process";import sU from"node:os";import tU from"node:fs";import oU from"node:fs";import XG from"node:fs";var U8;function nU(){try{return XG.statSync("/.dockerenv"),!0}catch{return!1}}function iU(){try{return XG.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}function D8(){if(U8===void 0)U8=nU()||iU();return U8}var M8,aU=()=>{try{return oU.statSync("/run/.containerenv"),!0}catch{return!1}};function h_(){if(M8===void 0)M8=aU()||D8();return M8}var QG=()=>{if($G.platform!=="linux")return!1;if(sU.release().toLowerCase().includes("microsoft")){if(h_())return!1;return!0}try{return tU.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")?!h_():!1}catch{return!1}},V4=$G.env.__IS_WSL_TEST__?QG:QG();import HG from"node:process";import{Buffer as eU}from"node:buffer";import{promisify as _D}from"node:util";import zD from"node:child_process";var AD=_D(zD.execFile),N8=()=>`${HG.env.SYSTEMROOT||HG.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;var K9=async(_,z={})=>{let{powerShellPath:A,...b}=z,G=K9.encodeCommand(_);return AD(A??N8(),[...K9.argumentsPrefix,G],{encoding:"utf8",...b})};K9.argumentsPrefix=["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"];K9.encodeCommand=(_)=>eU.from(_,"utf16le").toString("base64");K9.escapeArgument=(_)=>`'${String(_).replaceAll("'","''")}'`;function BG(_){for(let z of _.split(`
41
- `)){if(/^\s*#/.test(z))continue;let A=/^\s*root\s*=\s*(?<mountPoint>"[^"]*"|'[^']*'|[^#]*)/.exec(z);if(!A)continue;return A.groups.mountPoint.trim().replaceAll(/^["']|["']$/g,"")}}var JD=bD(GD.execFile),YD=(()=>{let z;return async function(){if(z)return z;let A="/etc/wsl.conf",b=!1;try{await w8.access(A,FG.F_OK),b=!0}catch{}if(!b)return"/mnt/";let G=await w8.readFile(A,{encoding:"utf8"}),J=BG(G);if(J===void 0)return"/mnt/";return z=J,z=z.endsWith("/")?z:`${z}/`,z}})(),XD=async()=>{return`${await YD()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`},S3=V4?XD:N8,ZG,KG=async()=>{return ZG??=(async()=>{try{let _=await S3();return await w8.access(_,FG.X_OK),!0}catch{return!1}})(),ZG},qG=async()=>{let _=await S3(),z=String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`,{stdout:A}=await K9(z,{powerShellPath:_});return A.trim()},WG=async(_)=>{if(/^[a-z]+:\/\//i.test(_))return _;try{let{stdout:z}=await JD("wslpath",["-aw",_],{encoding:"utf8"});return z.trim()}catch{return _}};function K_(_,z,A){let b=(G)=>Object.defineProperty(_,z,{value:G,enumerable:!0,writable:!0});return Object.defineProperty(_,z,{configurable:!0,enumerable:!0,get(){let G=A();return b(G),G},set(G){b(G)}}),_}import{promisify as DD}from"node:util";import R8 from"node:process";import{execFile as MD}from"node:child_process";import{promisify as QD}from"node:util";import $D from"node:process";import{execFile as HD}from"node:child_process";var BD=QD(HD);async function E8(){if($D.platform!=="darwin")throw Error("macOS only");let{stdout:_}=await BD("defaults",["read","com.apple.LaunchServices/com.apple.launchservices.secure","LSHandlers"]),A=/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(_)?.groups.id??"com.apple.Safari";if(A==="com.apple.safari")return"com.apple.Safari";return A}import ZD from"node:process";import{promisify as FD}from"node:util";import{execFile as KD,execFileSync as oc}from"node:child_process";var qD=FD(KD);async function VG(_,{humanReadableOutput:z=!0,signal:A}={}){if(ZD.platform!=="darwin")throw Error("macOS only");let b=z?[]:["-ss"],G={};if(A)G.signal=A;let{stdout:J}=await qD("osascript",["-e",_,b],G);return J.trim()}async function O8(_){return VG(`tell application "Finder" to set app_path to application file id "${_}" as string
42
- tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}import{promisify as WD}from"node:util";import{execFile as VD}from"node:child_process";var UD=WD(VD),UG={MSEdgeHTM:{name:"Edge",id:"com.microsoft.edge"},MSEdgeBHTML:{name:"Edge Beta",id:"com.microsoft.edge.beta"},MSEdgeDHTML:{name:"Edge Dev",id:"com.microsoft.edge.dev"},AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:"Edge",id:"com.microsoft.edge.old"},ChromeHTML:{name:"Chrome",id:"com.google.chrome"},ChromeBHTML:{name:"Chrome Beta",id:"com.google.chrome.beta"},ChromeDHTML:{name:"Chrome Dev",id:"com.google.chrome.dev"},ChromiumHTM:{name:"Chromium",id:"org.chromium.Chromium"},BraveHTML:{name:"Brave",id:"com.brave.Browser"},BraveBHTML:{name:"Brave Beta",id:"com.brave.Browser.beta"},BraveDHTML:{name:"Brave Dev",id:"com.brave.Browser.dev"},BraveSSHTM:{name:"Brave Nightly",id:"com.brave.Browser.nightly"},FirefoxURL:{name:"Firefox",id:"org.mozilla.firefox"},OperaStable:{name:"Opera",id:"com.operasoftware.Opera"},VivaldiHTM:{name:"Vivaldi",id:"com.vivaldi.Vivaldi"},"IE.HTTP":{name:"Internet Explorer",id:"com.microsoft.ie"}},k3=new Map(Object.entries(UG));class L8 extends Error{}async function j8(_=UD){let{stdout:z}=await _("reg",["QUERY"," HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice","/v","ProgId"]),A=/ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(z);if(!A)throw new L8(`Cannot find Windows browser in stdout: ${JSON.stringify(z)}`);let{id:b}=A.groups,G=UG[b];if(!G)throw new L8(`Unknown browser ID: ${b}`);return G}var ND=DD(MD),wD=(_)=>_.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,(z)=>z.toUpperCase());async function P8(){if(R8.platform==="darwin"){let _=await E8();return{name:await O8(_),id:_}}if(R8.platform==="linux"){let{stdout:_}=await ND("xdg-mime",["query","default","x-scheme-handler/http"]),z=_.trim();return{name:wD(z.replace(/.desktop$/,"").replace("-"," ")),id:z}}if(R8.platform==="win32")return j8();throw Error("Only macOS, Linux, and Windows are supported")}import S8 from"node:process";var ED=Boolean(S8.env.SSH_CONNECTION||S8.env.SSH_CLIENT||S8.env.SSH_TTY),DG=ED;var I3=Symbol("fallbackAttempt"),I8=import.meta.url?OG.dirname(OD(import.meta.url)):"",MG=OG.join(I8,"xdg-open"),{platform:m_,arch:NG}=k8,wG=async(_,z)=>{if(_.length===0)return;let A=[];for(let b of _)try{return await z(b)}catch(G){A.push(G)}throw AggregateError(A,"Failed to open in all supported apps")},x3=async(_)=>{_={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,..._};let z=_[I3]===!0;if(delete _[I3],Array.isArray(_.app))return wG(_.app,($)=>x3({..._,app:$,[I3]:!0}));let{name:A,arguments:b=[]}=_.app??{};if(b=[...b],Array.isArray(A))return wG(A,($)=>x3({..._,app:{name:$,arguments:b},[I3]:!0}));if(A==="browser"||A==="browserPrivate"){let $={"com.google.chrome":"chrome","google-chrome.desktop":"chrome","com.brave.browser":"brave","org.mozilla.firefox":"firefox","firefox.desktop":"firefox","com.microsoft.msedge":"edge","com.microsoft.edge":"edge","com.microsoft.edgemac":"edge","microsoft-edge.desktop":"edge","com.apple.safari":"safari"},H={chrome:"--incognito",brave:"--incognito",firefox:"--private-window",edge:"--inPrivate"},B;if(V4){let Z=await qG();B=k3.get(Z)??{}}else B=await P8();if(B.id in $){let Z=$[B.id.toLowerCase()];if(A==="browserPrivate"){if(Z==="safari")throw Error("Safari doesn't support opening in private mode via command line");b.push(H[Z])}return x3({..._,app:{name:u_[Z],arguments:b}})}throw Error(`${B.name} is not supported as a default browser`)}let G,J=[],Y={},X=!1;if(V4&&!h_()&&!DG&&!A)X=await KG();if(m_==="darwin"){if(G="open",_.wait)J.push("--wait-apps");if(_.background)J.push("--background");if(_.newInstance)J.push("--new");if(A)J.push("-a",A)}else if(m_==="win32"||X){if(G=await S3(),J.push(...K9.argumentsPrefix),!V4)Y.windowsVerbatimArguments=!0;if(V4&&_.target)_.target=await WG(_.target);let $=["$ProgressPreference = 'SilentlyContinue';","Start"];if(_.wait)$.push("-Wait");if(A){if($.push(K9.escapeArgument(A)),_.target)b.push(_.target)}else if(_.target)$.push(K9.escapeArgument(_.target));if(b.length>0)b=b.map((H)=>K9.escapeArgument(H)),$.push("-ArgumentList",b.join(","));if(_.target=K9.encodeCommand($.join(" ")),!_.wait)Y.stdio="ignore"}else{if(A)G=A;else{let $=!I8||I8==="/",H=!1;try{await jD.access(MG,RD.X_OK),H=!0}catch{}G=k8.versions.electron??(m_==="android"||$||!H)?"xdg-open":MG}if(b.length>0)J.push(...b);if(!_.wait)Y.stdio="ignore",Y.detached=!0}if(m_==="darwin"&&b.length>0)J.push("--args",...b);if(_.target)J.push(_.target);let Q=LD.spawn(G,J,Y);if(_.wait)return new Promise(($,H)=>{Q.once("error",H),Q.once("close",(B)=>{if(!_.allowNonzeroExitCode&&B!==0){H(Error(`Exited with code ${B}`));return}$(Q)})});if(z)return new Promise(($,H)=>{Q.once("error",H),Q.once("spawn",()=>{Q.once("close",(B)=>{if(Q.off("error",H),B!==0){H(Error(`Exited with code ${B}`));return}Q.unref(),$(Q)})})});return Q.unref(),new Promise(($,H)=>{Q.once("error",H),Q.once("spawn",()=>{Q.off("error",H),$(Q)})})},PD=(_,z)=>{if(typeof _!=="string")throw TypeError("Expected a `target`");return x3({...z,target:_})};function EG(_){if(typeof _==="string"||Array.isArray(_))return _;let{[NG]:z}=_;if(!z)throw Error(`${NG} is not supported`);return z}function o1({[m_]:_},{wsl:z}={}){if(z&&V4)return EG(z);if(!_)throw Error(`${m_} is not supported`);return EG(_)}var u_={browser:"browser",browserPrivate:"browserPrivate"};K_(u_,"chrome",()=>o1({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium","chromium-browser"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]}}));K_(u_,"brave",()=>o1({darwin:"brave browser",win32:"brave",linux:["brave-browser","brave"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe",x64:["/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe","/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe"]}}));K_(u_,"firefox",()=>o1({darwin:"firefox",win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));K_(u_,"edge",()=>o1({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));K_(u_,"safari",()=>o1({darwin:"Safari"}));var LG=PD;var T3=Symbol.for("better-auth:broadcast-channel"),SD=()=>Math.floor(Date.now()/1000),kD=class{listeners=new Set;name;constructor(_="better-auth.message"){this.name=_}subscribe(_){return this.listeners.add(_),()=>{this.listeners.delete(_)}}post(_){if(typeof window>"u")return;try{localStorage.setItem(this.name,JSON.stringify({..._,timestamp:SD()}))}catch{}}setup(){if(typeof window>"u"||typeof window.addEventListener>"u")return()=>{};let _=(z)=>{if(z.key!==this.name)return;let A=JSON.parse(z.newValue??"{}");if(A?.event!=="session"||!A?.data)return;this.listeners.forEach((b)=>b(A))};return window.addEventListener("storage",_),()=>{window.removeEventListener("storage",_)}}};function a1(_="better-auth.message"){if(!globalThis[T3])globalThis[T3]=new kD(_);return globalThis[T3]}var C3=Symbol.for("better-auth:focus-manager"),ID=class{listeners=new Set;subscribe(_){return this.listeners.add(_),()=>{this.listeners.delete(_)}}setFocused(_){this.listeners.forEach((z)=>z(_))}setup(){if(typeof window>"u"||typeof document>"u"||typeof window.addEventListener>"u")return()=>{};let _=()=>{if(document.visibilityState==="visible")this.setFocused(!0)};return document.addEventListener("visibilitychange",_,!1),()=>{document.removeEventListener("visibilitychange",_,!1)}}};function x8(){if(!globalThis[C3])globalThis[C3]=new ID;return globalThis[C3]}var v3=Symbol.for("better-auth:online-manager"),xD=class{listeners=new Set;isOnline=typeof navigator<"u"?navigator.onLine:!0;subscribe(_){return this.listeners.add(_),()=>{this.listeners.delete(_)}}setOnline(_){this.isOnline=_,this.listeners.forEach((z)=>z(_))}setup(){if(typeof window>"u"||typeof window.addEventListener>"u")return()=>{};let _=()=>this.setOnline(!0),z=()=>this.setOnline(!1);return window.addEventListener("online",_,!1),window.addEventListener("offline",z,!1),()=>{window.removeEventListener("online",_,!1),window.removeEventListener("offline",z,!1)}}};function y3(){if(!globalThis[v3])globalThis[v3]=new xD;return globalThis[v3]}var k9=[],h4=0,g3=4,TD=0,s1=(_)=>{let z=[],A={get(){if(!A.lc)A.listen(()=>{})();return A.value},lc:0,listen(b){return A.lc=z.push(b),()=>{for(let J=h4+g3;J<k9.length;)if(k9[J]===b)k9.splice(J,g3);else J+=g3;let G=z.indexOf(b);if(~G){if(z.splice(G,1),!--A.lc)A.off()}}},notify(b,G){TD++;let J=!k9.length;for(let Y of z)k9.push(Y,A.value,b,G);if(J){for(h4=0;h4<k9.length;h4+=g3)k9[h4](k9[h4+1],k9[h4+2],k9[h4+3]);k9.length=0}},off(){},set(b){let G=A.value;if(G!==b)A.value=b,A.notify(G)},subscribe(b){let G=A.listen(b);return b(A.value),G},value:_};return A};var CD=5,f3=6,h3=10,vD=(_,z,A,b)=>{if(_.events=_.events||{},!_.events[A+h3])_.events[A+h3]=b((G)=>{_.events[A].reduceRight((J,Y)=>(Y(J),J),{shared:{},...G})});return _.events[A]=_.events[A]||[],_.events[A].push(z),()=>{let G=_.events[A],J=G.indexOf(z);if(G.splice(J,1),!G.length)delete _.events[A],_.events[A+h3](),delete _.events[A+h3]}};var jG=1000,t1=(_,z)=>{return vD(_,(b)=>{let G=z(b);if(G)_.events[f3].push(G)},CD,(b)=>{let G=_.listen;_.listen=(...Y)=>{if(!_.lc&&!_.active)_.active=!0,b();return G(...Y)};let J=_.off;return _.events[f3]=[],_.off=()=>{J(),setTimeout(()=>{if(_.active&&!_.lc){_.active=!1;for(let Y of _.events[f3])Y();_.events[f3]=[]}},jG)},()=>{_.listen=G,_.off=J}})};var yD=()=>typeof window>"u",m3=(_,z,A,b)=>{let G=s1({data:null,error:null,isPending:!0,isRefetching:!1,refetch:(X)=>J(X)}),J=async(X)=>{return new Promise((Q)=>{let $=typeof b==="function"?b({data:G.get().data,error:G.get().error,isPending:G.get().isPending}):b;A(z,{...$,query:{...$?.query,...X?.query},async onSuccess(H){G.set({data:H.data,error:null,isPending:!1,isRefetching:!1,refetch:G.value.refetch}),await $?.onSuccess?.(H)},async onError(H){let{request:B}=H,Z=typeof B.retry==="number"?B.retry:B.retry?.attempts,F=B.retryAttempt||0;if(Z&&F<Z)return;G.set({error:H.error,data:null,isPending:!1,isRefetching:!1,refetch:G.value.refetch}),await $?.onError?.(H)},async onRequest(H){let B=G.get();G.set({isPending:B.data===null,data:B.data,error:null,isRefetching:!0,refetch:G.value.refetch}),await $?.onRequest?.(H)}}).catch((H)=>{G.set({error:H,data:null,isPending:!1,isRefetching:!1,refetch:G.value.refetch})}).finally(()=>{Q(void 0)})})};_=Array.isArray(_)?_:[_];let Y=!1;for(let X of _)X.subscribe(async()=>{if(yD())return;if(Y)await J();else t1(G,()=>{let Q=setTimeout(async()=>{if(!Y)await J(),Y=!0},0);return()=>{G.off(),X.off(),clearTimeout(Q)}})});return G};var c_=()=>Math.floor(Date.now()/1000),gD=5;function T8(_){let{sessionAtom:z,sessionSignal:A,$fetch:b,options:G={}}=_,J=G.sessionOptions?.refetchInterval??0,Y=G.sessionOptions?.refetchOnWindowFocus??!0,X=G.sessionOptions?.refetchWhenOffline??!1,Q={lastSync:0,lastSessionRequest:0,cachedSession:void 0},$=()=>{return X||y3().isOnline},H=(w)=>{if(!$())return;if(w?.event==="storage"){Q.lastSync=c_(),A.set(!A.get());return}let O=z.get();if(w?.event==="poll"){Q.lastSessionRequest=c_(),b("/get-session").then((M)=>{if(M.error)z.set({...O,data:null,error:M.error});else z.set({...O,data:M.data,error:null});Q.lastSync=c_(),A.set(!A.get())}).catch(()=>{});return}if(w?.event==="visibilitychange"){if(c_()-Q.lastSessionRequest<gD)return;Q.lastSessionRequest=c_()}if(O?.data===null||O?.data===void 0||w?.event==="visibilitychange")Q.lastSync=c_(),A.set(!A.get())},B=(w)=>{a1().post({event:"session",data:{trigger:w},clientId:Math.random().toString(36).substring(7)})},Z=()=>{if(J&&J>0)Q.pollInterval=setInterval(()=>{if(z.get()?.data)H({event:"poll"})},J*1000)},F=()=>{Q.unsubscribeBroadcast=a1().subscribe(()=>{H({event:"storage"})})},K=()=>{if(!Y)return;Q.unsubscribeFocus=x8().subscribe(()=>{H({event:"visibilitychange"})})},q=()=>{Q.unsubscribeOnline=y3().subscribe((w)=>{if(w)H({event:"visibilitychange"})})};return{init:()=>{Z(),F(),K(),q(),a1().setup(),x8().setup(),y3().setup()},cleanup:()=>{if(Q.pollInterval)clearInterval(Q.pollInterval),Q.pollInterval=void 0;if(Q.unsubscribeBroadcast)Q.unsubscribeBroadcast(),Q.unsubscribeBroadcast=void 0;if(Q.unsubscribeFocus)Q.unsubscribeFocus(),Q.unsubscribeFocus=void 0;if(Q.unsubscribeOnline)Q.unsubscribeOnline(),Q.unsubscribeOnline=void 0;Q.lastSync=0,Q.lastSessionRequest=0,Q.cachedSession=void 0},triggerRefetch:H,broadcastSessionUpdate:B}}var u3=Object.create(null),e1=(_)=>globalThis.process?.env||globalThis.Deno?.env.toObject()||globalThis.__env__||(_?u3:globalThis),s0=new Proxy(u3,{get(_,z){return e1()[z]??u3[z]},has(_,z){return z in e1()||z in u3},set(_,z,A){let b=e1(!0);return b[z]=A,!0},deleteProperty(_,z){if(!z)return!1;let A=e1(!0);return delete A[z],!0},ownKeys(){let _=e1(!0);return Object.keys(_)}});var fD=typeof process<"u"&&process.env&&"production"||"";function F0(_,z){if(typeof process<"u"&&process.env)return process.env[_]??z;if(typeof Deno<"u")return Deno.env.get(_)??z;if(typeof Bun<"u")return Bun.env[_]??z;return z}var hD=Object.freeze({get BETTER_AUTH_SECRET(){return F0("BETTER_AUTH_SECRET")},get AUTH_SECRET(){return F0("AUTH_SECRET")},get BETTER_AUTH_TELEMETRY(){return F0("BETTER_AUTH_TELEMETRY")},get BETTER_AUTH_TELEMETRY_ID(){return F0("BETTER_AUTH_TELEMETRY_ID")},get NODE_ENV(){return F0("NODE_ENV","development")},get PACKAGE_VERSION(){return F0("PACKAGE_VERSION","0.0.0")},get BETTER_AUTH_TELEMETRY_ENDPOINT(){return F0("BETTER_AUTH_TELEMETRY_ENDPOINT","https://telemetry.better-auth.com/v1/track")}});var _z=1,v0=4,e9=8,q9=24,RG={eterm:v0,cons25:v0,console:v0,cygwin:v0,dtterm:v0,gnome:v0,hurd:v0,jfbterm:v0,konsole:v0,kterm:v0,mlterm:v0,mosh:q9,putty:v0,st:v0,"rxvt-unicode-24bit":q9,terminator:q9,"xterm-kitty":q9},mD=new Map(Object.entries({APPVEYOR:e9,BUILDKITE:e9,CIRCLECI:q9,DRONE:e9,GITEA_ACTIONS:q9,GITHUB_ACTIONS:q9,GITLAB_CI:e9,TRAVIS:e9})),uD=[/ansi/,/color/,/linux/,/direct/,/^con[0-9]*x[0-9]/,/^rxvt/,/^screen/,/^xterm/,/^vt100/,/^vt220/];function C8(){if(F0("FORCE_COLOR")!==void 0)switch(F0("FORCE_COLOR")){case"":case"1":case"true":return v0;case"2":return e9;case"3":return q9;default:return _z}if(F0("NODE_DISABLE_COLORS")!==void 0&&F0("NODE_DISABLE_COLORS")!==""||F0("NO_COLOR")!==void 0&&F0("NO_COLOR")!==""||F0("TERM")==="dumb")return _z;if(F0("TMUX"))return q9;if("TF_BUILD"in s0&&"AGENT_NAME"in s0)return v0;if("CI"in s0){for(let{0:_,1:z}of mD)if(_ in s0)return z;if(F0("CI_NAME")==="codeship")return e9;return _z}if("TEAMCITY_VERSION"in s0)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.exec(F0("TEAMCITY_VERSION"))!==null?v0:_z;switch(F0("TERM_PROGRAM")){case"iTerm.app":if(!F0("TERM_PROGRAM_VERSION")||/^[0-2]\./.exec(F0("TERM_PROGRAM_VERSION"))!==null)return e9;return q9;case"HyperTerm":case"MacTerm":return q9;case"Apple_Terminal":return e9}if(F0("COLORTERM")==="truecolor"||F0("COLORTERM")==="24bit")return q9;if(F0("TERM")){if(/truecolor/.exec(F0("TERM"))!==null)return q9;if(/^xterm-256/.exec(F0("TERM"))!==null)return e9;let _=F0("TERM").toLowerCase();if(RG[_])return RG[_];if(uD.some((z)=>z.exec(_)!==null))return v0}if(F0("COLORTERM"))return v0;return _z}var I9={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",undim:"\x1B[22m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",fg:{black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m"},bg:{black:"\x1B[40m",red:"\x1B[41m",green:"\x1B[42m",yellow:"\x1B[43m",blue:"\x1B[44m",magenta:"\x1B[45m",cyan:"\x1B[46m",white:"\x1B[47m"}},c3=["debug","info","success","warn","error"];function PG(_,z){return c3.indexOf(z)>=c3.indexOf(_)}var cD={info:I9.fg.blue,success:I9.fg.green,warn:I9.fg.yellow,error:I9.fg.red,debug:I9.fg.magenta},lD=(_,z,A)=>{let b=new Date().toISOString();if(A)return`${I9.dim}${b}${I9.reset} ${cD[_]}${_.toUpperCase()}${I9.reset} ${I9.bright}[Better Auth]:${I9.reset} ${z}`;return`${b} ${_.toUpperCase()} [Better Auth]: ${z}`},SG=(_)=>{let z=_?.disabled!==!0,A=_?.level??"error",b=_?.disableColors!==void 0?!_.disableColors:C8()!==1,G=(J,Y,X=[])=>{if(!z||!PG(A,J))return;let Q=lD(J,Y,b);if(!_||typeof _.log!=="function"){if(J==="error")console.error(Q,...X);else if(J==="warn")console.warn(Q,...X);else console.log(Q,...X);return}_.log(J==="success"?"info":J,Y,...X)};return{...Object.fromEntries(c3.map((J)=>[J,(...[Y,...X])=>G(J,Y,X)])),get level(){return A}}},kG=SG();function v8(_){return _}function y8(_){return _.charAt(0).toUpperCase()+_.slice(1)}var pD=v8({USER_NOT_FOUND:"User not found",FAILED_TO_CREATE_USER:"Failed to create user",FAILED_TO_CREATE_SESSION:"Failed to create session",FAILED_TO_UPDATE_USER:"Failed to update user",FAILED_TO_GET_SESSION:"Failed to get session",INVALID_PASSWORD:"Invalid password",INVALID_EMAIL:"Invalid email",INVALID_EMAIL_OR_PASSWORD:"Invalid email or password",SOCIAL_ACCOUNT_ALREADY_LINKED:"Social account already linked",PROVIDER_NOT_FOUND:"Provider not found",INVALID_TOKEN:"Invalid token",ID_TOKEN_NOT_SUPPORTED:"id_token not supported",FAILED_TO_GET_USER_INFO:"Failed to get user info",USER_EMAIL_NOT_FOUND:"User email not found",EMAIL_NOT_VERIFIED:"Email not verified",PASSWORD_TOO_SHORT:"Password too short",PASSWORD_TOO_LONG:"Password too long",USER_ALREADY_EXISTS:"User already exists.",USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL:"User already exists. Use another email.",EMAIL_CAN_NOT_BE_UPDATED:"Email can not be updated",CREDENTIAL_ACCOUNT_NOT_FOUND:"Credential account not found",SESSION_EXPIRED:"Session expired. Re-authenticate to perform this action.",FAILED_TO_UNLINK_LAST_ACCOUNT:"You can't unlink your last account",ACCOUNT_NOT_FOUND:"Account not found",USER_ALREADY_HAS_PASSWORD:"User already has a password. Provide that to delete the account.",CROSS_SITE_NAVIGATION_LOGIN_BLOCKED:"Cross-site navigation login blocked. This request appears to be a CSRF attack.",VERIFICATION_EMAIL_NOT_ENABLED:"Verification email isn't enabled",EMAIL_ALREADY_VERIFIED:"Email is already verified",EMAIL_MISMATCH:"Email mismatch",SESSION_NOT_FRESH:"Session is not fresh",LINKED_ACCOUNT_ALREADY_EXISTS:"Linked account already exists",INVALID_ORIGIN:"Invalid origin",INVALID_CALLBACK_URL:"Invalid callbackURL",INVALID_REDIRECT_URL:"Invalid redirectURL",INVALID_ERROR_CALLBACK_URL:"Invalid errorCallbackURL",INVALID_NEW_USER_CALLBACK_URL:"Invalid newUserCallbackURL",MISSING_OR_NULL_ORIGIN:"Missing or null Origin",CALLBACK_URL_REQUIRED:"callbackURL is required",FAILED_TO_CREATE_VERIFICATION:"Unable to create verification",FIELD_NOT_ALLOWED:"Field not allowed to be set",ASYNC_VALIDATION_NOT_SUPPORTED:"Async validation is not supported",VALIDATION_ERROR:"Validation Error",MISSING_FIELD:"Field is required"});var m4=class extends Error{constructor(_,z){super(_,z);this.name="BetterAuthError",this.message=_,this.stack=""}};function dD(_){try{return(new URL(_).pathname.replace(/\/+$/,"")||"/")!=="/"}catch{throw new m4(`Invalid base URL: ${_}. Please provide a valid base URL.`)}}function rD(_){try{let z=new URL(_);if(z.protocol!=="http:"&&z.protocol!=="https:")throw new m4(`Invalid base URL: ${_}. URL must include 'http://' or 'https://'`)}catch(z){if(z instanceof m4)throw z;throw new m4(`Invalid base URL: ${_}. Please provide a valid base URL.`,{cause:z})}}function zz(_,z="/api/auth"){if(rD(_),dD(_))return _;let A=_.replace(/\/+$/,"");if(!z||z==="/")return A;return z=z.startsWith("/")?z:`/${z}`,`${A}${z}`}function IG(_,z){if(!_||_.trim()==="")return!1;if(z==="proto")return _==="http"||_==="https";if(z==="host"){if([/\.\./,/\0/,/[\s]/,/^[.]/,/[<>'"]/,/javascript:/i,/file:/i,/data:/i].some((A)=>A.test(_)))return!1;return/^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*(:[0-9]{1,5})?$/.test(_)||/^(\d{1,3}\.){3}\d{1,3}(:[0-9]{1,5})?$/.test(_)||/^\[[0-9a-fA-F:]+\](:[0-9]{1,5})?$/.test(_)||/^localhost(:[0-9]{1,5})?$/i.test(_)}return!1}function xG(_,z,A,b,G){if(_)return zz(_,z);if(b!==!1){let X=s0.BETTER_AUTH_URL||s0.NEXT_PUBLIC_BETTER_AUTH_URL||s0.PUBLIC_BETTER_AUTH_URL||s0.NUXT_PUBLIC_BETTER_AUTH_URL||s0.NUXT_PUBLIC_AUTH_URL||(s0.BASE_URL!=="/"?s0.BASE_URL:void 0);if(X)return zz(X,z)}let J=A?.headers.get("x-forwarded-host"),Y=A?.headers.get("x-forwarded-proto");if(J&&Y&&G){if(IG(Y,"proto")&&IG(J,"host"))try{return zz(`${Y}://${J}`,z)}catch(X){}}if(A){let X=nD(A.url);if(!X)throw new m4("Could not get origin from request. Please provide a valid base URL.");return zz(X,z)}if(typeof window<"u"&&window.location)return zz(window.location.origin,z)}function nD(_){try{let z=new URL(_);return z.origin==="null"?null:z.origin}catch{return null}}var TG={id:"redirect",name:"Redirect",hooks:{onSuccess(_){if(_.data?.url&&_.data?.redirect){if(typeof window<"u"&&window.location){if(window.location)try{window.location.href=_.data.url}catch{}}}}}};var iD={proto:/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,constructor:/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,protoShort:/"__proto__"\s*:/,constructorShort:/"constructor"\s*:/},oD=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/,CG={true:!0,false:!1,null:null,undefined:void 0,nan:NaN,infinity:Number.POSITIVE_INFINITY,"-infinity":Number.NEGATIVE_INFINITY},aD=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,7}))?(?:Z|([+-])(\d{2}):(\d{2}))$/;function sD(_){return _ instanceof Date&&!isNaN(_.getTime())}function tD(_){let z=aD.exec(_);if(!z)return null;let[,A,b,G,J,Y,X,Q,$,H,B]=z,Z=new Date(Date.UTC(parseInt(A,10),parseInt(b,10)-1,parseInt(G,10),parseInt(J,10),parseInt(Y,10),parseInt(X,10),Q?parseInt(Q.padEnd(3,"0"),10):0));if($){let F=(parseInt(H,10)*60+parseInt(B,10))*($==="+"?-1:1);Z.setUTCMinutes(Z.getUTCMinutes()+F)}return sD(Z)?Z:null}function eD(_,z={}){let{strict:A=!1,warnings:b=!1,reviver:G,parseDates:J=!0}=z;if(typeof _!=="string")return _;let Y=_.trim();if(Y.length>0&&Y[0]==='"'&&Y.endsWith('"')&&!Y.slice(1,-1).includes('"'))return Y.slice(1,-1);let X=Y.toLowerCase();if(X.length<=9&&X in CG)return CG[X];if(!oD.test(Y)){if(A)throw SyntaxError("[better-json] Invalid JSON");return _}if(Object.entries(iD).some(([Q,$])=>{let H=$.test(Y);if(H&&b)console.warn(`[better-json] Detected potential prototype pollution attempt using ${Q} pattern`);return H})&&A)throw Error("[better-json] Potential prototype pollution attempt detected");try{return JSON.parse(Y,($,H)=>{if($==="__proto__"||$==="constructor"&&H&&typeof H==="object"&&"prototype"in H){if(b)console.warn(`[better-json] Dropping "${$}" key to prevent prototype pollution`);return}if(J&&typeof H==="string"){let B=tD(H);if(B)return B}return G?G($,H):H})}catch(Q){if(A)throw Q;return _}}function vG(_,z={strict:!0}){return eD(_,z)}function yG(_,z){let A=s1(!1),b=m3(A,"/get-session",_,{method:"GET"});return t1(b,()=>{let G=T8({sessionAtom:b,sessionSignal:A,$fetch:_,options:z});return G.init(),()=>{G.cleanup()}}),{session:b,$sessionSignal:A}}function g8(_){if(_===null||typeof _!=="object")return!1;let z=Object.getPrototypeOf(_);if(z!==null&&z!==Object.prototype&&Object.getPrototypeOf(z)!==null)return!1;if(Symbol.iterator in _)return!1;if(Symbol.toStringTag in _)return Object.prototype.toString.call(_)==="[object Module]";return!0}function f8(_,z,A=".",b){if(!g8(z))return f8(_,{},A,b);let G=Object.assign({},z);for(let J in _){if(J==="__proto__"||J==="constructor")continue;let Y=_[J];if(Y===null||Y===void 0)continue;if(b&&b(G,J,Y,A))continue;if(Array.isArray(Y)&&Array.isArray(G[J]))G[J]=[...Y,...G[J]];else if(g8(Y)&&g8(G[J]))G[J]=f8(Y,G[J],(A?`${A}.`:"")+J.toString(),b);else G[J]=Y}return G}function h8(_){return(...z)=>z.reduce((A,b)=>f8(A,b,"",_),{})}var gG=h8(),hp=h8((_,z,A)=>{if(_[z]!==void 0&&typeof A==="function")return _[z]=A(_[z]),!0}),mp=h8((_,z,A)=>{if(Array.isArray(_[z])&&typeof A==="function")return _[z]=A(_[z]),!0});var{defineProperty:_M,defineProperties:zM,getOwnPropertyDescriptors:AM,getOwnPropertySymbols:fG}=Object,bM=Object.prototype.hasOwnProperty,GM=Object.prototype.propertyIsEnumerable,hG=(_,z,A)=>(z in _)?_M(_,z,{enumerable:!0,configurable:!0,writable:!0,value:A}):_[z]=A,x9=(_,z)=>{for(var A in z||(z={}))if(bM.call(z,A))hG(_,A,z[A]);if(fG){for(var A of fG(z))if(GM.call(z,A))hG(_,A,z[A])}return _},_4=(_,z)=>zM(_,AM(z)),JM=class extends Error{constructor(_,z,A){super(z||_.toString(),{cause:A});this.status=_,this.statusText=z,this.error=A,Error.captureStackTrace(this,this.constructor)}},YM=async(_,z)=>{var A,b,G,J,Y,X;let Q=z||{},$={onRequest:[z==null?void 0:z.onRequest],onResponse:[z==null?void 0:z.onResponse],onSuccess:[z==null?void 0:z.onSuccess],onError:[z==null?void 0:z.onError],onRetry:[z==null?void 0:z.onRetry]};if(!z||!(z==null?void 0:z.plugins))return{url:_,options:Q,hooks:$};for(let H of(z==null?void 0:z.plugins)||[]){if(H.init){let B=await((A=H.init)==null?void 0:A.call(H,_.toString(),z));Q=B.options||Q,_=B.url}$.onRequest.push((b=H.hooks)==null?void 0:b.onRequest),$.onResponse.push((G=H.hooks)==null?void 0:G.onResponse),$.onSuccess.push((J=H.hooks)==null?void 0:J.onSuccess),$.onError.push((Y=H.hooks)==null?void 0:Y.onError),$.onRetry.push((X=H.hooks)==null?void 0:X.onRetry)}return{url:_,options:Q,hooks:$}},mG=class{constructor(_){this.options=_}shouldAttemptRetry(_,z){if(this.options.shouldRetry)return Promise.resolve(_<this.options.attempts&&this.options.shouldRetry(z));return Promise.resolve(_<this.options.attempts)}getDelay(){return this.options.delay}},XM=class{constructor(_){this.options=_}shouldAttemptRetry(_,z){if(this.options.shouldRetry)return Promise.resolve(_<this.options.attempts&&this.options.shouldRetry(z));return Promise.resolve(_<this.options.attempts)}getDelay(_){return Math.min(this.options.maxDelay,this.options.baseDelay*2**_)}};function QM(_){if(typeof _==="number")return new mG({type:"linear",attempts:_,delay:1000});switch(_.type){case"linear":return new mG(_);case"exponential":return new XM(_);default:throw Error("Invalid retry strategy")}}var $M=async(_)=>{let z={},A=async(b)=>typeof b==="function"?await b():b;if(_==null?void 0:_.auth){if(_.auth.type==="Bearer"){let b=await A(_.auth.token);if(!b)return z;z.authorization=`Bearer ${b}`}else if(_.auth.type==="Basic"){let[b,G]=await Promise.all([A(_.auth.username),A(_.auth.password)]);if(!b||!G)return z;z.authorization=`Basic ${btoa(`${b}:${G}`)}`}else if(_.auth.type==="Custom"){let[b,G]=await Promise.all([A(_.auth.prefix),A(_.auth.value)]);if(!G)return z;z.authorization=`${b!=null?b:""} ${G}`}}return z},HM=/^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;function BM(_){let z=_.headers.get("content-type"),A=new Set(["image/svg","application/xml","application/xhtml","application/html"]);if(!z)return"json";let b=z.split(";").shift()||"";if(HM.test(b))return"json";if(A.has(b)||b.startsWith("text/"))return"text";return"blob"}function ZM(_){try{return JSON.parse(_),!0}catch(z){return!1}}function m8(_){if(_===void 0)return!1;let z=typeof _;if(z==="string"||z==="number"||z==="boolean"||z===null)return!0;if(z!=="object")return!1;if(Array.isArray(_))return!0;if(_.buffer)return!1;return _.constructor&&_.constructor.name==="Object"||typeof _.toJSON==="function"}function uG(_){try{return JSON.parse(_)}catch(z){return _}}function cG(_){return typeof _==="function"}function FM(_){if(_==null?void 0:_.customFetchImpl)return _.customFetchImpl;if(typeof globalThis<"u"&&cG(globalThis.fetch))return globalThis.fetch;if(typeof window<"u"&&cG(window.fetch))return window.fetch;throw Error("No fetch implementation found")}async function KM(_){let z=new Headers(_==null?void 0:_.headers),A=await $M(_);for(let[b,G]of Object.entries(A||{}))z.set(b,G);if(!z.has("content-type")){let b=qM(_==null?void 0:_.body);if(b)z.set("content-type",b)}return z}function qM(_){if(m8(_))return"application/json";return null}function WM(_){if(!(_==null?void 0:_.body))return null;let z=new Headers(_==null?void 0:_.headers);if(m8(_.body)&&!z.has("content-type")){for(let[A,b]of Object.entries(_==null?void 0:_.body))if(b instanceof Date)_.body[A]=b.toISOString();return JSON.stringify(_.body)}if(z.has("content-type")&&z.get("content-type")==="application/x-www-form-urlencoded"){if(m8(_.body))return new URLSearchParams(_.body).toString();return _.body}return _.body}function VM(_,z){var A;if(z==null?void 0:z.method)return z.method.toUpperCase();if(_.startsWith("@")){let b=(A=_.split("@")[1])==null?void 0:A.split("/")[0];if(!lG.includes(b))return(z==null?void 0:z.body)?"POST":"GET";return b.toUpperCase()}return(z==null?void 0:z.body)?"POST":"GET"}function UM(_,z){let A;if(!(_==null?void 0:_.signal)&&(_==null?void 0:_.timeout))A=setTimeout(()=>z==null?void 0:z.abort(),_==null?void 0:_.timeout);return{abortTimeout:A,clearTimeout:()=>{if(A)clearTimeout(A)}}}var DM=class _ extends Error{constructor(z,A){super(A||JSON.stringify(z,null,2));this.issues=z,Object.setPrototypeOf(this,_.prototype)}};async function l3(_,z){let A=await _["~standard"].validate(z);if(A.issues)throw new DM(A.issues);return A.value}var lG=["get","post","put","patch","delete"];var MM=(_)=>({id:"apply-schema",name:"Apply Schema",version:"1.0.0",async init(z,A){var b,G,J,Y;let X=((G=(b=_.plugins)==null?void 0:b.find((Q)=>{var $;return(($=Q.schema)==null?void 0:$.config)?z.startsWith(Q.schema.config.baseURL||"")||z.startsWith(Q.schema.config.prefix||""):!1}))==null?void 0:G.schema)||_.schema;if(X){let Q=z;if((J=X.config)==null?void 0:J.prefix){if(Q.startsWith(X.config.prefix)){if(Q=Q.replace(X.config.prefix,""),X.config.baseURL)z=z.replace(X.config.prefix,X.config.baseURL)}}if((Y=X.config)==null?void 0:Y.baseURL){if(Q.startsWith(X.config.baseURL))Q=Q.replace(X.config.baseURL,"")}let $=X.schema[Q];if($){let H=_4(x9({},A),{method:$.method,output:$.output});if(!(A==null?void 0:A.disableValidation))H=_4(x9({},H),{body:$.input?await l3($.input,A==null?void 0:A.body):A==null?void 0:A.body,params:$.params?await l3($.params,A==null?void 0:A.params):A==null?void 0:A.params,query:$.query?await l3($.query,A==null?void 0:A.query):A==null?void 0:A.query});return{url:z,options:H}}}return{url:z,options:A}}}),pG=(_)=>{async function z(A,b){let G=_4(x9(x9({},_),b),{plugins:[...(_==null?void 0:_.plugins)||[],MM(_||{}),...(b==null?void 0:b.plugins)||[]]});if(_==null?void 0:_.catchAllError)try{return await u8(A,G)}catch(J){return{data:null,error:{status:500,statusText:"Fetch Error",message:"Fetch related error. Captured by catchAllError option. See error property for more details.",error:J}}}return await u8(A,G)}return z};function NM(_,z){let{baseURL:A,params:b,query:G}=z||{query:{},params:{},baseURL:""},J=_.startsWith("http")?_.split("/").slice(0,3).join("/"):A||"";if(_.startsWith("@")){let B=_.toString().split("@")[1].split("/")[0];if(lG.includes(B))_=_.replace(`@${B}/`,"/")}if(!J.endsWith("/"))J+="/";let[Y,X]=_.replace(J,"").split("?"),Q=new URLSearchParams(X);for(let[B,Z]of Object.entries(G||{})){if(Z==null)continue;let F;if(typeof Z==="string")F=Z;else if(Array.isArray(Z)){for(let K of Z)Q.append(B,K);continue}else F=JSON.stringify(Z);Q.set(B,F)}if(b)if(Array.isArray(b)){let B=Y.split("/").filter((Z)=>Z.startsWith(":"));for(let[Z,F]of B.entries()){let K=b[Z];Y=Y.replace(F,K)}}else for(let[B,Z]of Object.entries(b))Y=Y.replace(`:${B}`,String(Z));if(Y=Y.split("/").map(encodeURIComponent).join("/"),Y.startsWith("/"))Y=Y.slice(1);let $=Q.toString();if($=$.length>0?`?${$}`.replace(/\+/g,"%20"):"",!J.startsWith("http"))return`${J}${Y}${$}`;return new URL(`${Y}${$}`,J)}var u8=async(_,z)=>{var A,b,G,J,Y,X,Q,$;let{hooks:H,url:B,options:Z}=await YM(_,z),F=FM(Z),K=new AbortController,q=(A=Z.signal)!=null?A:K.signal,W=NM(B,Z),V=WM(Z),w=await KM(Z),O=VM(B,Z),M=_4(x9({},Z),{url:W,headers:w,body:V,method:O,signal:q});for(let g of H.onRequest)if(g){let m=await g(M);if(typeof m==="object"&&m!==null)M=m}if("pipeTo"in M&&typeof M.pipeTo==="function"||typeof((b=z==null?void 0:z.body)==null?void 0:b.pipe)==="function"){if(!("duplex"in M))M.duplex="half"}let{clearTimeout:P}=UM(Z,K),D=await F(M.url,M);P();let L={response:D,request:M};for(let g of H.onResponse)if(g){let m=await g(_4(x9({},L),{response:((G=z==null?void 0:z.hookOptions)==null?void 0:G.cloneResponse)?D.clone():D}));if(m instanceof Response)D=m;else if(typeof m==="object"&&m!==null)D=m.response}if(D.ok){if(M.method==="HEAD")return{data:"",error:null};let m=BM(D),d={data:null,response:D,request:M};if(m==="json"||m==="text"){let Z0=await D.text(),S9=(J=M.jsonParser)!=null?J:uG;d.data=await S9(Z0)}else d.data=await D[m]();if(M==null?void 0:M.output){if(M.output&&!M.disableValidation)d.data=await l3(M.output,d.data)}for(let Z0 of H.onSuccess)if(Z0)await Z0(_4(x9({},d),{response:((Y=z==null?void 0:z.hookOptions)==null?void 0:Y.cloneResponse)?D.clone():D}));if(z==null?void 0:z.throw)return d.data;return{data:d.data,error:null}}let R=(X=z==null?void 0:z.jsonParser)!=null?X:uG,S=await D.text(),y=ZM(S),e=y?await R(S):null,u={response:D,responseText:S,request:M,error:_4(x9({},e),{status:D.status,statusText:D.statusText})};for(let g of H.onError)if(g)await g(_4(x9({},u),{response:((Q=z==null?void 0:z.hookOptions)==null?void 0:Q.cloneResponse)?D.clone():D}));if(z==null?void 0:z.retry){let g=QM(z.retry),m=($=z.retryAttempt)!=null?$:0;if(await g.shouldAttemptRetry(m,D)){for(let Z0 of H.onRetry)if(Z0)await Z0(L);let d=g.getDelay(m);return await new Promise((Z0)=>setTimeout(Z0,d)),await u8(_,_4(x9({},z),{retryAttempt:m+1}))}}if(z==null?void 0:z.throw)throw new JM(D.status,D.statusText,y?e:S);return{data:null,error:_4(x9({},e),{status:D.status,statusText:D.statusText})}};var dG=(_,z)=>{let A="credentials"in Request.prototype,b=xG(_?.baseURL,_?.basePath,void 0,z)??"/api/auth",G=_?.plugins?.flatMap((M)=>M.fetchPlugins).filter((M)=>M!==void 0)||[],J={id:"lifecycle-hooks",name:"lifecycle-hooks",hooks:{onSuccess:_?.fetchOptions?.onSuccess,onError:_?.fetchOptions?.onError,onRequest:_?.fetchOptions?.onRequest,onResponse:_?.fetchOptions?.onResponse}},{onSuccess:Y,onError:X,onRequest:Q,onResponse:$,...H}=_?.fetchOptions||{},B=pG({baseURL:b,...A?{credentials:"include"}:{},method:"GET",jsonParser(M){if(!M)return null;return vG(M,{strict:!1})},customFetchImpl:fetch,...H,plugins:[J,...H.plugins||[],..._?.disableDefaultFetchPlugins?[]:[TG],...G]}),{$sessionSignal:Z,session:F}=yG(B,_),K=_?.plugins||[],q={},W={$sessionSignal:Z,session:F},V={"/sign-out":"POST","/revoke-sessions":"POST","/revoke-other-sessions":"POST","/delete-user":"POST"},w=[{signal:"$sessionSignal",matcher(M){return M==="/sign-out"||M==="/update-user"||M==="/sign-up/email"||M==="/sign-in/email"||M==="/delete-user"||M==="/verify-email"||M==="/revoke-sessions"||M==="/revoke-session"||M==="/change-email"}}];for(let M of K){if(M.getAtoms)Object.assign(W,M.getAtoms?.(B));if(M.pathMethods)Object.assign(V,M.pathMethods);if(M.atomListeners)w.push(...M.atomListeners)}let O={notify:(M)=>{W[M].set(!W[M].get())},listen:(M,P)=>{W[M].subscribe(P)},atoms:W};for(let M of K)if(M.getActions)q=gG(M.getActions?.(B,O,_)??{},q);return{get baseURL(){return b},pluginsActions:q,pluginsAtoms:W,pluginPathMethods:V,atomListeners:w,$fetch:B,$store:O}};function rG(_){return typeof _==="object"&&_!==null&&"get"in _&&typeof _.get==="function"&&"lc"in _&&typeof _.lc==="number"}function wM(_,z,A){let b=z[_],{fetchOptions:G,query:J,...Y}=A||{};if(b)return b;if(G?.method)return G.method;if(Y&&Object.keys(Y).length>0)return"POST";return"GET"}function nG(_,z,A,b,G){function J(Y=[]){return new Proxy(function(){},{get(X,Q){if(typeof Q!=="string")return;if(Q==="then"||Q==="catch"||Q==="finally")return;let $=[...Y,Q],H=_;for(let B of $)if(H&&typeof H==="object"&&B in H)H=H[B];else{H=void 0;break}if(typeof H==="function")return H;if(rG(H))return H;return J($)},apply:async(X,Q,$)=>{let H="/"+Y.map((w)=>w.replace(/[A-Z]/g,(O)=>`-${O.toLowerCase()}`)).join("/"),B=$[0]||{},Z=$[1]||{},{query:F,fetchOptions:K,...q}=B,W={...Z,...K},V=wM(H,A,B);return await z(H,{...W,body:V==="GET"?void 0:{...q,...W?.body||{}},query:F||W?.query,method:V,async onSuccess(w){if(await W?.onSuccess?.(w),!G||W.disableSignal)return;let O=G.filter((P)=>P.matcher(H));if(!O.length)return;let M=new Set;for(let P of O){let D=b[P.signal];if(!D)return;if(M.has(P.signal))continue;M.add(P.signal);let L=D.get();setTimeout(()=>{D.set(!L)},10)}}})}})}return J()}function c8(_){let{pluginPathMethods:z,pluginsActions:A,pluginsAtoms:b,$fetch:G,atomListeners:J,$store:Y}=dG(_),X={};for(let[Q,$]of Object.entries(b))X[`use${y8(Q)}`]=$;return nG({...A,...X,$fetch:G,$store:Y},G,z,b,J)}function iG(_){return{authorize(z,A="AND"){let b=!1;for(let[G,J]of Object.entries(z)){let Y=_[G];if(!Y)return{success:!1,error:`You are not allowed to access resource: ${G}`};if(Array.isArray(J))b=J.every((X)=>Y.includes(X));else if(typeof J==="object"){let X=J;if(X.connector==="OR")b=X.actions.some((Q)=>Y.includes(Q));else b=X.actions.every((Q)=>Y.includes(Q))}else throw new m4("Invalid access control request");if(b&&A==="OR")return{success:b};if(!b&&A==="AND")return{success:!1,error:`unauthorized to access resource "${G}"`}}if(b)return{success:b};return{success:!1,error:"Not authorized"}},statements:_}}function Az(_){return{newRole(z){return iG(z)},statements:_}}var oG={user:["create","list","set-role","ban","impersonate","delete","set-password","get","update"],session:["list","revoke","delete"]},l8=Az(oG),aG=l8.newRole({user:["create","list","set-role","ban","impersonate","delete","set-password","get","update"],session:["list","revoke","delete"]}),sG=l8.newRole({user:[],session:[]});var p8=()=>{return{id:"device-authorization",$InferServerPlugin:{},pathMethods:{"/device/code":"POST","/device/token":"POST","/device":"GET","/device/approve":"POST","/device/deny":"POST"}}};var tG={organization:["update","delete"],member:["create","update","delete"],invitation:["create","cancel"],team:["create","update","delete"],ac:["create","read","update","delete"]},p3=Az(tG),eG=p3.newRole({organization:["update"],invitation:["create","cancel"],member:["create","update","delete"],team:["create","update","delete"],ac:["create","read","update","delete"]}),_J=p3.newRole({organization:["update","delete"],member:["create","update","delete"],invitation:["create","cancel"],team:["create","update","delete"],ac:["create","read","update","delete"]}),zJ=p3.newRole({organization:[],member:[],invitation:[],team:[],ac:["read"]});var AJ="http://localhost:3000",bJ="https://agentlogs.ai";function d3(_){return c8({baseURL:_,plugins:[p8()]})}import{existsSync as HY,mkdirSync as Iw,readFileSync as xw,writeFileSync as Tw}from"fs";import{homedir as Cw}from"os";import{join as BY}from"path";import{existsSync as Lw,mkdirSync as jw}from"fs";import{homedir as Rw}from"os";import{join as $Y}from"path";var{createId:Yn,init:Ew,getConstants:Xn,isCuid:Qn}=XY();var t8=Ew;var _5=$Y(Rw(),".config","agentlogs"),QY=$Y(_5,"local.db"),Pw=typeof globalThis.Bun<"u",d_=null,e8=null;function Sw(){if(!e8)e8=t8();return e8}function kw(){if(!Lw(_5))jw(_5,{recursive:!0})}async function i3(){if(d_)return d_;if(kw(),Pw){let{Database:_}=await import("bun:sqlite"),z=new _(QY);d_={exec:(A)=>z.run(A),get:(A,...b)=>z.query(A).get(...b),run:(A,...b)=>z.run(A,b),all:(A,...b)=>z.query(A).all(...b)}}else{let{default:_}=await import("libsql"),z=new _(QY);d_={exec:(A)=>z.exec(A),get:(A,...b)=>z.prepare(A).get(...b),run:(A,...b)=>z.prepare(A).run(...b),all:(A,...b)=>z.prepare(A).all(...b)}}return d_.exec(`
40
+ `)$++}}let H=_.slice(0,Q),B=_.slice($),Z=H+B,F=H.trimEnd(),K=B.trimStart();if(F.endsWith(",")&&K.startsWith("}")){let q=H.lastIndexOf(",");Z=H.slice(0,q)+H.slice(q+1)+B}return Z}function ab(_,z){let A=_,b=ib(z);for(let{path:G,value:J}of b)if(J===void 0)A=dU(A,G);else{let Y=uU(A,G,J,{});A=hU(A,Y)}return A}import*as a1 from"fs/promises";import*as s9 from"path";function K8(_){let z=_.match(/git@([^:]+):(.+?)(?:\.git)?$/);if(z)return`${z[1]}/${z[2]}`;let A=_.match(/https?:\/\/([^/]+)\/(.+?)(?:\.git)?$/);if(A)return`${A[1]}/${A[2]}`;return null}async function q8(_){let z=s9.resolve(_),{root:A}=s9.parse(z);while(!0){let b=s9.join(z,".git");try{let J=await a1.stat(b);if(J.isDirectory()||J.isFile())return z}catch{}if(z===A)return null;let G=s9.dirname(z);if(G===z)return null;z=G}}async function rU(_){try{let z=s9.join(_,".git","config"),b=(await a1.readFile(z,"utf8")).match(/\[remote "origin"\]\s+url\s*=\s*(.+)/i);if(!b||!b[1])return null;return b[1].trim()}catch{return null}}async function W8(_){let z=await rU(_);if(!z)return null;return K8(z)}async function a0(_){let z=_??process.cwd(),A=await q8(z);if(!A)return null;return W8(A)}async function sb(_,z){try{let A=s9.join(_,".git","HEAD"),G=(await a1.readFile(A,"utf8")).trim();if(G.startsWith("ref:")){let Y=G.slice(4).trim().split("/");return Y[Y.length-1]??z??null}return G||z||null}catch{return z??null}}var V8=zG(iU(),".config","agentlogs"),F_=zG(V8,"settings.json"),eb={allowMode:"denylist",repos:{}};function AG(){if(!U8(V8))nU(V8,{recursive:!0})}function t9(){if(AG(),!U8(F_))return{...eb};try{let _=_G(F_,"utf-8"),z=ob(_,[]);return{allowMode:z.allowMode==="allowlist"?"allowlist":"denylist",repos:typeof z.repos==="object"&&z.repos!==null?z.repos:{}}}catch{return{...eb}}}function D8(_){AG();try{if(U8(F_)){let z=_G(F_,"utf-8"),A=ab(z,_);tb(F_,A,"utf-8")}else tb(F_,JSON.stringify(_,null,2),"utf-8")}catch(z){throw console.error("Failed to write settings file:",z),z}}function e9(_){if(!_)return t9().allowMode==="denylist";let z=t9(),A=z.repos[_];if(z.allowMode==="denylist"){if(!A)return!0;return A.allow}else{if(!A)return!1;return A.allow}}function M8(_){if(!_)return;return t9().repos[_]?.visibility}function bG(_,z){let A=t9();A.repos[_]={allow:!0,...z&&{visibility:z}},D8(A)}function GG(_){let z=t9();z.repos[_]={allow:!1},D8(z)}function JG(_){let z=t9();z.allowMode=_,D8(z)}function YG(){return F_}async function XG(_={}){let z=await a0();if(!z)console.error("Could not detect repository."),console.error("Make sure you are in a git repository with a remote origin configured."),process.exit(1);let A;if(_.public)A="public";else if(_.team)A="team";else if(_.private)A="private";else if(_.visibility){let J=_.visibility.toLowerCase();if(J!=="public"&&J!=="team"&&J!=="private")console.error("Invalid visibility. Use 'public', 'team', or 'private'."),process.exit(1);A=J}bG(z,A);let G=t9().repos[z];if(console.log(`✓ Capture enabled for: ${z}`),G?.visibility)console.log(` Visibility: ${G.visibility}`);else console.log(" Visibility: (server default)");process.exit(0)}async function QG(){let _=await a0();if(!_)console.error("Could not detect repository."),console.error("Make sure you are in a git repository with a remote origin configured."),process.exit(1);GG(_),console.log(`✗ Capture disabled for: ${_}`),process.exit(0)}import T8 from"node:process";import jG from"node:path";import{fileURLToPath as jD}from"node:url";import RD from"node:child_process";import PD,{constants as SD}from"node:fs/promises";import{promisify as JD}from"node:util";import YD from"node:child_process";import L8,{constants as qG}from"node:fs/promises";import BG from"node:process";import eU from"node:os";import _D from"node:fs";import sU from"node:fs";import $G from"node:fs";var N8;function oU(){try{return $G.statSync("/.dockerenv"),!0}catch{return!1}}function aU(){try{return $G.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}function w8(){if(N8===void 0)N8=oU()||aU();return N8}var E8,tU=()=>{try{return sU.statSync("/run/.containerenv"),!0}catch{return!1}};function m_(){if(E8===void 0)E8=tU()||w8();return E8}var HG=()=>{if(BG.platform!=="linux")return!1;if(eU.release().toLowerCase().includes("microsoft")){if(m_())return!1;return!0}try{return _D.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")?!m_():!1}catch{return!1}},V4=BG.env.__IS_WSL_TEST__?HG:HG();import ZG from"node:process";import{Buffer as zD}from"node:buffer";import{promisify as AD}from"node:util";import bD from"node:child_process";var GD=AD(bD.execFile),O8=()=>`${ZG.env.SYSTEMROOT||ZG.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;var K9=async(_,z={})=>{let{powerShellPath:A,...b}=z,G=K9.encodeCommand(_);return GD(A??O8(),[...K9.argumentsPrefix,G],{encoding:"utf8",...b})};K9.argumentsPrefix=["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"];K9.encodeCommand=(_)=>zD.from(_,"utf16le").toString("base64");K9.escapeArgument=(_)=>`'${String(_).replaceAll("'","''")}'`;function FG(_){for(let z of _.split(`
41
+ `)){if(/^\s*#/.test(z))continue;let A=/^\s*root\s*=\s*(?<mountPoint>"[^"]*"|'[^']*'|[^#]*)/.exec(z);if(!A)continue;return A.groups.mountPoint.trim().replaceAll(/^["']|["']$/g,"")}}var XD=JD(YD.execFile),QD=(()=>{let z;return async function(){if(z)return z;let A="/etc/wsl.conf",b=!1;try{await L8.access(A,qG.F_OK),b=!0}catch{}if(!b)return"/mnt/";let G=await L8.readFile(A,{encoding:"utf8"}),J=FG(G);if(J===void 0)return"/mnt/";return z=J,z=z.endsWith("/")?z:`${z}/`,z}})(),$D=async()=>{return`${await QD()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`},I3=V4?$D:O8,KG,WG=async()=>{return KG??=(async()=>{try{let _=await I3();return await L8.access(_,qG.X_OK),!0}catch{return!1}})(),KG},VG=async()=>{let _=await I3(),z=String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`,{stdout:A}=await K9(z,{powerShellPath:_});return A.trim()},UG=async(_)=>{if(/^[a-z]+:\/\//i.test(_))return _;try{let{stdout:z}=await XD("wslpath",["-aw",_],{encoding:"utf8"});return z.trim()}catch{return _}};function K_(_,z,A){let b=(G)=>Object.defineProperty(_,z,{value:G,enumerable:!0,writable:!0});return Object.defineProperty(_,z,{configurable:!0,enumerable:!0,get(){let G=A();return b(G),G},set(G){b(G)}}),_}import{promisify as ND}from"node:util";import k8 from"node:process";import{execFile as wD}from"node:child_process";import{promisify as HD}from"node:util";import BD from"node:process";import{execFile as ZD}from"node:child_process";var FD=HD(ZD);async function j8(){if(BD.platform!=="darwin")throw Error("macOS only");let{stdout:_}=await FD("defaults",["read","com.apple.LaunchServices/com.apple.launchservices.secure","LSHandlers"]),A=/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(_)?.groups.id??"com.apple.Safari";if(A==="com.apple.safari")return"com.apple.Safari";return A}import KD from"node:process";import{promisify as qD}from"node:util";import{execFile as WD,execFileSync as Gl}from"node:child_process";var VD=qD(WD);async function DG(_,{humanReadableOutput:z=!0,signal:A}={}){if(KD.platform!=="darwin")throw Error("macOS only");let b=z?[]:["-ss"],G={};if(A)G.signal=A;let{stdout:J}=await VD("osascript",["-e",_,b],G);return J.trim()}async function R8(_){return DG(`tell application "Finder" to set app_path to application file id "${_}" as string
42
+ tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}import{promisify as UD}from"node:util";import{execFile as DD}from"node:child_process";var MD=UD(DD),MG={MSEdgeHTM:{name:"Edge",id:"com.microsoft.edge"},MSEdgeBHTML:{name:"Edge Beta",id:"com.microsoft.edge.beta"},MSEdgeDHTML:{name:"Edge Dev",id:"com.microsoft.edge.dev"},AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:"Edge",id:"com.microsoft.edge.old"},ChromeHTML:{name:"Chrome",id:"com.google.chrome"},ChromeBHTML:{name:"Chrome Beta",id:"com.google.chrome.beta"},ChromeDHTML:{name:"Chrome Dev",id:"com.google.chrome.dev"},ChromiumHTM:{name:"Chromium",id:"org.chromium.Chromium"},BraveHTML:{name:"Brave",id:"com.brave.Browser"},BraveBHTML:{name:"Brave Beta",id:"com.brave.Browser.beta"},BraveDHTML:{name:"Brave Dev",id:"com.brave.Browser.dev"},BraveSSHTM:{name:"Brave Nightly",id:"com.brave.Browser.nightly"},FirefoxURL:{name:"Firefox",id:"org.mozilla.firefox"},OperaStable:{name:"Opera",id:"com.operasoftware.Opera"},VivaldiHTM:{name:"Vivaldi",id:"com.vivaldi.Vivaldi"},"IE.HTTP":{name:"Internet Explorer",id:"com.microsoft.ie"}},x3=new Map(Object.entries(MG));class P8 extends Error{}async function S8(_=MD){let{stdout:z}=await _("reg",["QUERY"," HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice","/v","ProgId"]),A=/ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(z);if(!A)throw new P8(`Cannot find Windows browser in stdout: ${JSON.stringify(z)}`);let{id:b}=A.groups,G=MG[b];if(!G)throw new P8(`Unknown browser ID: ${b}`);return G}var ED=ND(wD),OD=(_)=>_.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,(z)=>z.toUpperCase());async function I8(){if(k8.platform==="darwin"){let _=await j8();return{name:await R8(_),id:_}}if(k8.platform==="linux"){let{stdout:_}=await ED("xdg-mime",["query","default","x-scheme-handler/http"]),z=_.trim();return{name:OD(z.replace(/.desktop$/,"").replace("-"," ")),id:z}}if(k8.platform==="win32")return S8();throw Error("Only macOS, Linux, and Windows are supported")}import x8 from"node:process";var LD=Boolean(x8.env.SSH_CONNECTION||x8.env.SSH_CLIENT||x8.env.SSH_TTY),NG=LD;var T3=Symbol("fallbackAttempt"),C8=import.meta.url?jG.dirname(jD(import.meta.url)):"",wG=jG.join(C8,"xdg-open"),{platform:u_,arch:EG}=T8,OG=async(_,z)=>{if(_.length===0)return;let A=[];for(let b of _)try{return await z(b)}catch(G){A.push(G)}throw AggregateError(A,"Failed to open in all supported apps")},C3=async(_)=>{_={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,..._};let z=_[T3]===!0;if(delete _[T3],Array.isArray(_.app))return OG(_.app,($)=>C3({..._,app:$,[T3]:!0}));let{name:A,arguments:b=[]}=_.app??{};if(b=[...b],Array.isArray(A))return OG(A,($)=>C3({..._,app:{name:$,arguments:b},[T3]:!0}));if(A==="browser"||A==="browserPrivate"){let $={"com.google.chrome":"chrome","google-chrome.desktop":"chrome","com.brave.browser":"brave","org.mozilla.firefox":"firefox","firefox.desktop":"firefox","com.microsoft.msedge":"edge","com.microsoft.edge":"edge","com.microsoft.edgemac":"edge","microsoft-edge.desktop":"edge","com.apple.safari":"safari"},H={chrome:"--incognito",brave:"--incognito",firefox:"--private-window",edge:"--inPrivate"},B;if(V4){let Z=await VG();B=x3.get(Z)??{}}else B=await I8();if(B.id in $){let Z=$[B.id.toLowerCase()];if(A==="browserPrivate"){if(Z==="safari")throw Error("Safari doesn't support opening in private mode via command line");b.push(H[Z])}return C3({..._,app:{name:c_[Z],arguments:b}})}throw Error(`${B.name} is not supported as a default browser`)}let G,J=[],Y={},X=!1;if(V4&&!m_()&&!NG&&!A)X=await WG();if(u_==="darwin"){if(G="open",_.wait)J.push("--wait-apps");if(_.background)J.push("--background");if(_.newInstance)J.push("--new");if(A)J.push("-a",A)}else if(u_==="win32"||X){if(G=await I3(),J.push(...K9.argumentsPrefix),!V4)Y.windowsVerbatimArguments=!0;if(V4&&_.target)_.target=await UG(_.target);let $=["$ProgressPreference = 'SilentlyContinue';","Start"];if(_.wait)$.push("-Wait");if(A){if($.push(K9.escapeArgument(A)),_.target)b.push(_.target)}else if(_.target)$.push(K9.escapeArgument(_.target));if(b.length>0)b=b.map((H)=>K9.escapeArgument(H)),$.push("-ArgumentList",b.join(","));if(_.target=K9.encodeCommand($.join(" ")),!_.wait)Y.stdio="ignore"}else{if(A)G=A;else{let $=!C8||C8==="/",H=!1;try{await PD.access(wG,SD.X_OK),H=!0}catch{}G=T8.versions.electron??(u_==="android"||$||!H)?"xdg-open":wG}if(b.length>0)J.push(...b);if(!_.wait)Y.stdio="ignore",Y.detached=!0}if(u_==="darwin"&&b.length>0)J.push("--args",...b);if(_.target)J.push(_.target);let Q=RD.spawn(G,J,Y);if(_.wait)return new Promise(($,H)=>{Q.once("error",H),Q.once("close",(B)=>{if(!_.allowNonzeroExitCode&&B!==0){H(Error(`Exited with code ${B}`));return}$(Q)})});if(z)return new Promise(($,H)=>{Q.once("error",H),Q.once("spawn",()=>{Q.once("close",(B)=>{if(Q.off("error",H),B!==0){H(Error(`Exited with code ${B}`));return}Q.unref(),$(Q)})})});return Q.unref(),new Promise(($,H)=>{Q.once("error",H),Q.once("spawn",()=>{Q.off("error",H),$(Q)})})},kD=(_,z)=>{if(typeof _!=="string")throw TypeError("Expected a `target`");return C3({...z,target:_})};function LG(_){if(typeof _==="string"||Array.isArray(_))return _;let{[EG]:z}=_;if(!z)throw Error(`${EG} is not supported`);return z}function s1({[u_]:_},{wsl:z}={}){if(z&&V4)return LG(z);if(!_)throw Error(`${u_} is not supported`);return LG(_)}var c_={browser:"browser",browserPrivate:"browserPrivate"};K_(c_,"chrome",()=>s1({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium","chromium-browser"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]}}));K_(c_,"brave",()=>s1({darwin:"brave browser",win32:"brave",linux:["brave-browser","brave"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe",x64:["/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe","/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe"]}}));K_(c_,"firefox",()=>s1({darwin:"firefox",win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));K_(c_,"edge",()=>s1({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));K_(c_,"safari",()=>s1({darwin:"Safari"}));var RG=kD;var v3=Symbol.for("better-auth:broadcast-channel"),ID=()=>Math.floor(Date.now()/1000),xD=class{listeners=new Set;name;constructor(_="better-auth.message"){this.name=_}subscribe(_){return this.listeners.add(_),()=>{this.listeners.delete(_)}}post(_){if(typeof window>"u")return;try{localStorage.setItem(this.name,JSON.stringify({..._,timestamp:ID()}))}catch{}}setup(){if(typeof window>"u"||typeof window.addEventListener>"u")return()=>{};let _=(z)=>{if(z.key!==this.name)return;let A=JSON.parse(z.newValue??"{}");if(A?.event!=="session"||!A?.data)return;this.listeners.forEach((b)=>b(A))};return window.addEventListener("storage",_),()=>{window.removeEventListener("storage",_)}}};function t1(_="better-auth.message"){if(!globalThis[v3])globalThis[v3]=new xD(_);return globalThis[v3]}var y3=Symbol.for("better-auth:focus-manager"),TD=class{listeners=new Set;subscribe(_){return this.listeners.add(_),()=>{this.listeners.delete(_)}}setFocused(_){this.listeners.forEach((z)=>z(_))}setup(){if(typeof window>"u"||typeof document>"u"||typeof window.addEventListener>"u")return()=>{};let _=()=>{if(document.visibilityState==="visible")this.setFocused(!0)};return document.addEventListener("visibilitychange",_,!1),()=>{document.removeEventListener("visibilitychange",_,!1)}}};function v8(){if(!globalThis[y3])globalThis[y3]=new TD;return globalThis[y3]}var g3=Symbol.for("better-auth:online-manager"),CD=class{listeners=new Set;isOnline=typeof navigator<"u"?navigator.onLine:!0;subscribe(_){return this.listeners.add(_),()=>{this.listeners.delete(_)}}setOnline(_){this.isOnline=_,this.listeners.forEach((z)=>z(_))}setup(){if(typeof window>"u"||typeof window.addEventListener>"u")return()=>{};let _=()=>this.setOnline(!0),z=()=>this.setOnline(!1);return window.addEventListener("online",_,!1),window.addEventListener("offline",z,!1),()=>{window.removeEventListener("online",_,!1),window.removeEventListener("offline",z,!1)}}};function f3(){if(!globalThis[g3])globalThis[g3]=new CD;return globalThis[g3]}var k9=[],h4=0,h3=4,vD=0,e1=(_)=>{let z=[],A={get(){if(!A.lc)A.listen(()=>{})();return A.value},lc:0,listen(b){return A.lc=z.push(b),()=>{for(let J=h4+h3;J<k9.length;)if(k9[J]===b)k9.splice(J,h3);else J+=h3;let G=z.indexOf(b);if(~G){if(z.splice(G,1),!--A.lc)A.off()}}},notify(b,G){vD++;let J=!k9.length;for(let Y of z)k9.push(Y,A.value,b,G);if(J){for(h4=0;h4<k9.length;h4+=h3)k9[h4](k9[h4+1],k9[h4+2],k9[h4+3]);k9.length=0}},off(){},set(b){let G=A.value;if(G!==b)A.value=b,A.notify(G)},subscribe(b){let G=A.listen(b);return b(A.value),G},value:_};return A};var yD=5,m3=6,u3=10,gD=(_,z,A,b)=>{if(_.events=_.events||{},!_.events[A+u3])_.events[A+u3]=b((G)=>{_.events[A].reduceRight((J,Y)=>(Y(J),J),{shared:{},...G})});return _.events[A]=_.events[A]||[],_.events[A].push(z),()=>{let G=_.events[A],J=G.indexOf(z);if(G.splice(J,1),!G.length)delete _.events[A],_.events[A+u3](),delete _.events[A+u3]}};var PG=1000,_z=(_,z)=>{return gD(_,(b)=>{let G=z(b);if(G)_.events[m3].push(G)},yD,(b)=>{let G=_.listen;_.listen=(...Y)=>{if(!_.lc&&!_.active)_.active=!0,b();return G(...Y)};let J=_.off;return _.events[m3]=[],_.off=()=>{J(),setTimeout(()=>{if(_.active&&!_.lc){_.active=!1;for(let Y of _.events[m3])Y();_.events[m3]=[]}},PG)},()=>{_.listen=G,_.off=J}})};var fD=()=>typeof window>"u",c3=(_,z,A,b)=>{let G=e1({data:null,error:null,isPending:!0,isRefetching:!1,refetch:(X)=>J(X)}),J=async(X)=>{return new Promise((Q)=>{let $=typeof b==="function"?b({data:G.get().data,error:G.get().error,isPending:G.get().isPending}):b;A(z,{...$,query:{...$?.query,...X?.query},async onSuccess(H){G.set({data:H.data,error:null,isPending:!1,isRefetching:!1,refetch:G.value.refetch}),await $?.onSuccess?.(H)},async onError(H){let{request:B}=H,Z=typeof B.retry==="number"?B.retry:B.retry?.attempts,F=B.retryAttempt||0;if(Z&&F<Z)return;G.set({error:H.error,data:null,isPending:!1,isRefetching:!1,refetch:G.value.refetch}),await $?.onError?.(H)},async onRequest(H){let B=G.get();G.set({isPending:B.data===null,data:B.data,error:null,isRefetching:!0,refetch:G.value.refetch}),await $?.onRequest?.(H)}}).catch((H)=>{G.set({error:H,data:null,isPending:!1,isRefetching:!1,refetch:G.value.refetch})}).finally(()=>{Q(void 0)})})};_=Array.isArray(_)?_:[_];let Y=!1;for(let X of _)X.subscribe(async()=>{if(fD())return;if(Y)await J();else _z(G,()=>{let Q=setTimeout(async()=>{if(!Y)await J(),Y=!0},0);return()=>{G.off(),X.off(),clearTimeout(Q)}})});return G};var l_=()=>Math.floor(Date.now()/1000),hD=5;function y8(_){let{sessionAtom:z,sessionSignal:A,$fetch:b,options:G={}}=_,J=G.sessionOptions?.refetchInterval??0,Y=G.sessionOptions?.refetchOnWindowFocus??!0,X=G.sessionOptions?.refetchWhenOffline??!1,Q={lastSync:0,lastSessionRequest:0,cachedSession:void 0},$=()=>{return X||f3().isOnline},H=(w)=>{if(!$())return;if(w?.event==="storage"){Q.lastSync=l_(),A.set(!A.get());return}let O=z.get();if(w?.event==="poll"){Q.lastSessionRequest=l_(),b("/get-session").then((M)=>{if(M.error)z.set({...O,data:null,error:M.error});else z.set({...O,data:M.data,error:null});Q.lastSync=l_(),A.set(!A.get())}).catch(()=>{});return}if(w?.event==="visibilitychange"){if(l_()-Q.lastSessionRequest<hD)return;Q.lastSessionRequest=l_()}if(O?.data===null||O?.data===void 0||w?.event==="visibilitychange")Q.lastSync=l_(),A.set(!A.get())},B=(w)=>{t1().post({event:"session",data:{trigger:w},clientId:Math.random().toString(36).substring(7)})},Z=()=>{if(J&&J>0)Q.pollInterval=setInterval(()=>{if(z.get()?.data)H({event:"poll"})},J*1000)},F=()=>{Q.unsubscribeBroadcast=t1().subscribe(()=>{H({event:"storage"})})},K=()=>{if(!Y)return;Q.unsubscribeFocus=v8().subscribe(()=>{H({event:"visibilitychange"})})},q=()=>{Q.unsubscribeOnline=f3().subscribe((w)=>{if(w)H({event:"visibilitychange"})})};return{init:()=>{Z(),F(),K(),q(),t1().setup(),v8().setup(),f3().setup()},cleanup:()=>{if(Q.pollInterval)clearInterval(Q.pollInterval),Q.pollInterval=void 0;if(Q.unsubscribeBroadcast)Q.unsubscribeBroadcast(),Q.unsubscribeBroadcast=void 0;if(Q.unsubscribeFocus)Q.unsubscribeFocus(),Q.unsubscribeFocus=void 0;if(Q.unsubscribeOnline)Q.unsubscribeOnline(),Q.unsubscribeOnline=void 0;Q.lastSync=0,Q.lastSessionRequest=0,Q.cachedSession=void 0},triggerRefetch:H,broadcastSessionUpdate:B}}var l3=Object.create(null),zz=(_)=>globalThis.process?.env||globalThis.Deno?.env.toObject()||globalThis.__env__||(_?l3:globalThis),s0=new Proxy(l3,{get(_,z){return zz()[z]??l3[z]},has(_,z){return z in zz()||z in l3},set(_,z,A){let b=zz(!0);return b[z]=A,!0},deleteProperty(_,z){if(!z)return!1;let A=zz(!0);return delete A[z],!0},ownKeys(){let _=zz(!0);return Object.keys(_)}});var mD=typeof process<"u"&&process.env&&"production"||"";function F0(_,z){if(typeof process<"u"&&process.env)return process.env[_]??z;if(typeof Deno<"u")return Deno.env.get(_)??z;if(typeof Bun<"u")return Bun.env[_]??z;return z}var uD=Object.freeze({get BETTER_AUTH_SECRET(){return F0("BETTER_AUTH_SECRET")},get AUTH_SECRET(){return F0("AUTH_SECRET")},get BETTER_AUTH_TELEMETRY(){return F0("BETTER_AUTH_TELEMETRY")},get BETTER_AUTH_TELEMETRY_ID(){return F0("BETTER_AUTH_TELEMETRY_ID")},get NODE_ENV(){return F0("NODE_ENV","development")},get PACKAGE_VERSION(){return F0("PACKAGE_VERSION","0.0.0")},get BETTER_AUTH_TELEMETRY_ENDPOINT(){return F0("BETTER_AUTH_TELEMETRY_ENDPOINT","https://telemetry.better-auth.com/v1/track")}});var Az=1,v0=4,_4=8,q9=24,SG={eterm:v0,cons25:v0,console:v0,cygwin:v0,dtterm:v0,gnome:v0,hurd:v0,jfbterm:v0,konsole:v0,kterm:v0,mlterm:v0,mosh:q9,putty:v0,st:v0,"rxvt-unicode-24bit":q9,terminator:q9,"xterm-kitty":q9},cD=new Map(Object.entries({APPVEYOR:_4,BUILDKITE:_4,CIRCLECI:q9,DRONE:_4,GITEA_ACTIONS:q9,GITHUB_ACTIONS:q9,GITLAB_CI:_4,TRAVIS:_4})),lD=[/ansi/,/color/,/linux/,/direct/,/^con[0-9]*x[0-9]/,/^rxvt/,/^screen/,/^xterm/,/^vt100/,/^vt220/];function g8(){if(F0("FORCE_COLOR")!==void 0)switch(F0("FORCE_COLOR")){case"":case"1":case"true":return v0;case"2":return _4;case"3":return q9;default:return Az}if(F0("NODE_DISABLE_COLORS")!==void 0&&F0("NODE_DISABLE_COLORS")!==""||F0("NO_COLOR")!==void 0&&F0("NO_COLOR")!==""||F0("TERM")==="dumb")return Az;if(F0("TMUX"))return q9;if("TF_BUILD"in s0&&"AGENT_NAME"in s0)return v0;if("CI"in s0){for(let{0:_,1:z}of cD)if(_ in s0)return z;if(F0("CI_NAME")==="codeship")return _4;return Az}if("TEAMCITY_VERSION"in s0)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.exec(F0("TEAMCITY_VERSION"))!==null?v0:Az;switch(F0("TERM_PROGRAM")){case"iTerm.app":if(!F0("TERM_PROGRAM_VERSION")||/^[0-2]\./.exec(F0("TERM_PROGRAM_VERSION"))!==null)return _4;return q9;case"HyperTerm":case"MacTerm":return q9;case"Apple_Terminal":return _4}if(F0("COLORTERM")==="truecolor"||F0("COLORTERM")==="24bit")return q9;if(F0("TERM")){if(/truecolor/.exec(F0("TERM"))!==null)return q9;if(/^xterm-256/.exec(F0("TERM"))!==null)return _4;let _=F0("TERM").toLowerCase();if(SG[_])return SG[_];if(lD.some((z)=>z.exec(_)!==null))return v0}if(F0("COLORTERM"))return v0;return Az}var I9={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",undim:"\x1B[22m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",fg:{black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m"},bg:{black:"\x1B[40m",red:"\x1B[41m",green:"\x1B[42m",yellow:"\x1B[43m",blue:"\x1B[44m",magenta:"\x1B[45m",cyan:"\x1B[46m",white:"\x1B[47m"}},p3=["debug","info","success","warn","error"];function kG(_,z){return p3.indexOf(z)>=p3.indexOf(_)}var pD={info:I9.fg.blue,success:I9.fg.green,warn:I9.fg.yellow,error:I9.fg.red,debug:I9.fg.magenta},dD=(_,z,A)=>{let b=new Date().toISOString();if(A)return`${I9.dim}${b}${I9.reset} ${pD[_]}${_.toUpperCase()}${I9.reset} ${I9.bright}[Better Auth]:${I9.reset} ${z}`;return`${b} ${_.toUpperCase()} [Better Auth]: ${z}`},IG=(_)=>{let z=_?.disabled!==!0,A=_?.level??"error",b=_?.disableColors!==void 0?!_.disableColors:g8()!==1,G=(J,Y,X=[])=>{if(!z||!kG(A,J))return;let Q=dD(J,Y,b);if(!_||typeof _.log!=="function"){if(J==="error")console.error(Q,...X);else if(J==="warn")console.warn(Q,...X);else console.log(Q,...X);return}_.log(J==="success"?"info":J,Y,...X)};return{...Object.fromEntries(p3.map((J)=>[J,(...[Y,...X])=>G(J,Y,X)])),get level(){return A}}},xG=IG();function f8(_){return _}function h8(_){return _.charAt(0).toUpperCase()+_.slice(1)}var rD=f8({USER_NOT_FOUND:"User not found",FAILED_TO_CREATE_USER:"Failed to create user",FAILED_TO_CREATE_SESSION:"Failed to create session",FAILED_TO_UPDATE_USER:"Failed to update user",FAILED_TO_GET_SESSION:"Failed to get session",INVALID_PASSWORD:"Invalid password",INVALID_EMAIL:"Invalid email",INVALID_EMAIL_OR_PASSWORD:"Invalid email or password",SOCIAL_ACCOUNT_ALREADY_LINKED:"Social account already linked",PROVIDER_NOT_FOUND:"Provider not found",INVALID_TOKEN:"Invalid token",ID_TOKEN_NOT_SUPPORTED:"id_token not supported",FAILED_TO_GET_USER_INFO:"Failed to get user info",USER_EMAIL_NOT_FOUND:"User email not found",EMAIL_NOT_VERIFIED:"Email not verified",PASSWORD_TOO_SHORT:"Password too short",PASSWORD_TOO_LONG:"Password too long",USER_ALREADY_EXISTS:"User already exists.",USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL:"User already exists. Use another email.",EMAIL_CAN_NOT_BE_UPDATED:"Email can not be updated",CREDENTIAL_ACCOUNT_NOT_FOUND:"Credential account not found",SESSION_EXPIRED:"Session expired. Re-authenticate to perform this action.",FAILED_TO_UNLINK_LAST_ACCOUNT:"You can't unlink your last account",ACCOUNT_NOT_FOUND:"Account not found",USER_ALREADY_HAS_PASSWORD:"User already has a password. Provide that to delete the account.",CROSS_SITE_NAVIGATION_LOGIN_BLOCKED:"Cross-site navigation login blocked. This request appears to be a CSRF attack.",VERIFICATION_EMAIL_NOT_ENABLED:"Verification email isn't enabled",EMAIL_ALREADY_VERIFIED:"Email is already verified",EMAIL_MISMATCH:"Email mismatch",SESSION_NOT_FRESH:"Session is not fresh",LINKED_ACCOUNT_ALREADY_EXISTS:"Linked account already exists",INVALID_ORIGIN:"Invalid origin",INVALID_CALLBACK_URL:"Invalid callbackURL",INVALID_REDIRECT_URL:"Invalid redirectURL",INVALID_ERROR_CALLBACK_URL:"Invalid errorCallbackURL",INVALID_NEW_USER_CALLBACK_URL:"Invalid newUserCallbackURL",MISSING_OR_NULL_ORIGIN:"Missing or null Origin",CALLBACK_URL_REQUIRED:"callbackURL is required",FAILED_TO_CREATE_VERIFICATION:"Unable to create verification",FIELD_NOT_ALLOWED:"Field not allowed to be set",ASYNC_VALIDATION_NOT_SUPPORTED:"Async validation is not supported",VALIDATION_ERROR:"Validation Error",MISSING_FIELD:"Field is required"});var m4=class extends Error{constructor(_,z){super(_,z);this.name="BetterAuthError",this.message=_,this.stack=""}};function nD(_){try{return(new URL(_).pathname.replace(/\/+$/,"")||"/")!=="/"}catch{throw new m4(`Invalid base URL: ${_}. Please provide a valid base URL.`)}}function iD(_){try{let z=new URL(_);if(z.protocol!=="http:"&&z.protocol!=="https:")throw new m4(`Invalid base URL: ${_}. URL must include 'http://' or 'https://'`)}catch(z){if(z instanceof m4)throw z;throw new m4(`Invalid base URL: ${_}. Please provide a valid base URL.`,{cause:z})}}function bz(_,z="/api/auth"){if(iD(_),nD(_))return _;let A=_.replace(/\/+$/,"");if(!z||z==="/")return A;return z=z.startsWith("/")?z:`/${z}`,`${A}${z}`}function TG(_,z){if(!_||_.trim()==="")return!1;if(z==="proto")return _==="http"||_==="https";if(z==="host"){if([/\.\./,/\0/,/[\s]/,/^[.]/,/[<>'"]/,/javascript:/i,/file:/i,/data:/i].some((A)=>A.test(_)))return!1;return/^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*(:[0-9]{1,5})?$/.test(_)||/^(\d{1,3}\.){3}\d{1,3}(:[0-9]{1,5})?$/.test(_)||/^\[[0-9a-fA-F:]+\](:[0-9]{1,5})?$/.test(_)||/^localhost(:[0-9]{1,5})?$/i.test(_)}return!1}function CG(_,z,A,b,G){if(_)return bz(_,z);if(b!==!1){let X=s0.BETTER_AUTH_URL||s0.NEXT_PUBLIC_BETTER_AUTH_URL||s0.PUBLIC_BETTER_AUTH_URL||s0.NUXT_PUBLIC_BETTER_AUTH_URL||s0.NUXT_PUBLIC_AUTH_URL||(s0.BASE_URL!=="/"?s0.BASE_URL:void 0);if(X)return bz(X,z)}let J=A?.headers.get("x-forwarded-host"),Y=A?.headers.get("x-forwarded-proto");if(J&&Y&&G){if(TG(Y,"proto")&&TG(J,"host"))try{return bz(`${Y}://${J}`,z)}catch(X){}}if(A){let X=oD(A.url);if(!X)throw new m4("Could not get origin from request. Please provide a valid base URL.");return bz(X,z)}if(typeof window<"u"&&window.location)return bz(window.location.origin,z)}function oD(_){try{let z=new URL(_);return z.origin==="null"?null:z.origin}catch{return null}}var vG={id:"redirect",name:"Redirect",hooks:{onSuccess(_){if(_.data?.url&&_.data?.redirect){if(typeof window<"u"&&window.location){if(window.location)try{window.location.href=_.data.url}catch{}}}}}};var aD={proto:/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,constructor:/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,protoShort:/"__proto__"\s*:/,constructorShort:/"constructor"\s*:/},sD=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/,yG={true:!0,false:!1,null:null,undefined:void 0,nan:NaN,infinity:Number.POSITIVE_INFINITY,"-infinity":Number.NEGATIVE_INFINITY},tD=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,7}))?(?:Z|([+-])(\d{2}):(\d{2}))$/;function eD(_){return _ instanceof Date&&!isNaN(_.getTime())}function _M(_){let z=tD.exec(_);if(!z)return null;let[,A,b,G,J,Y,X,Q,$,H,B]=z,Z=new Date(Date.UTC(parseInt(A,10),parseInt(b,10)-1,parseInt(G,10),parseInt(J,10),parseInt(Y,10),parseInt(X,10),Q?parseInt(Q.padEnd(3,"0"),10):0));if($){let F=(parseInt(H,10)*60+parseInt(B,10))*($==="+"?-1:1);Z.setUTCMinutes(Z.getUTCMinutes()+F)}return eD(Z)?Z:null}function zM(_,z={}){let{strict:A=!1,warnings:b=!1,reviver:G,parseDates:J=!0}=z;if(typeof _!=="string")return _;let Y=_.trim();if(Y.length>0&&Y[0]==='"'&&Y.endsWith('"')&&!Y.slice(1,-1).includes('"'))return Y.slice(1,-1);let X=Y.toLowerCase();if(X.length<=9&&X in yG)return yG[X];if(!sD.test(Y)){if(A)throw SyntaxError("[better-json] Invalid JSON");return _}if(Object.entries(aD).some(([Q,$])=>{let H=$.test(Y);if(H&&b)console.warn(`[better-json] Detected potential prototype pollution attempt using ${Q} pattern`);return H})&&A)throw Error("[better-json] Potential prototype pollution attempt detected");try{return JSON.parse(Y,($,H)=>{if($==="__proto__"||$==="constructor"&&H&&typeof H==="object"&&"prototype"in H){if(b)console.warn(`[better-json] Dropping "${$}" key to prevent prototype pollution`);return}if(J&&typeof H==="string"){let B=_M(H);if(B)return B}return G?G($,H):H})}catch(Q){if(A)throw Q;return _}}function gG(_,z={strict:!0}){return zM(_,z)}function fG(_,z){let A=e1(!1),b=c3(A,"/get-session",_,{method:"GET"});return _z(b,()=>{let G=y8({sessionAtom:b,sessionSignal:A,$fetch:_,options:z});return G.init(),()=>{G.cleanup()}}),{session:b,$sessionSignal:A}}function m8(_){if(_===null||typeof _!=="object")return!1;let z=Object.getPrototypeOf(_);if(z!==null&&z!==Object.prototype&&Object.getPrototypeOf(z)!==null)return!1;if(Symbol.iterator in _)return!1;if(Symbol.toStringTag in _)return Object.prototype.toString.call(_)==="[object Module]";return!0}function u8(_,z,A=".",b){if(!m8(z))return u8(_,{},A,b);let G=Object.assign({},z);for(let J in _){if(J==="__proto__"||J==="constructor")continue;let Y=_[J];if(Y===null||Y===void 0)continue;if(b&&b(G,J,Y,A))continue;if(Array.isArray(Y)&&Array.isArray(G[J]))G[J]=[...Y,...G[J]];else if(m8(Y)&&m8(G[J]))G[J]=u8(Y,G[J],(A?`${A}.`:"")+J.toString(),b);else G[J]=Y}return G}function c8(_){return(...z)=>z.reduce((A,b)=>u8(A,b,"",_),{})}var hG=c8(),ip=c8((_,z,A)=>{if(_[z]!==void 0&&typeof A==="function")return _[z]=A(_[z]),!0}),op=c8((_,z,A)=>{if(Array.isArray(_[z])&&typeof A==="function")return _[z]=A(_[z]),!0});var{defineProperty:AM,defineProperties:bM,getOwnPropertyDescriptors:GM,getOwnPropertySymbols:mG}=Object,JM=Object.prototype.hasOwnProperty,YM=Object.prototype.propertyIsEnumerable,uG=(_,z,A)=>(z in _)?AM(_,z,{enumerable:!0,configurable:!0,writable:!0,value:A}):_[z]=A,x9=(_,z)=>{for(var A in z||(z={}))if(JM.call(z,A))uG(_,A,z[A]);if(mG){for(var A of mG(z))if(YM.call(z,A))uG(_,A,z[A])}return _},z4=(_,z)=>bM(_,GM(z)),XM=class extends Error{constructor(_,z,A){super(z||_.toString(),{cause:A});this.status=_,this.statusText=z,this.error=A,Error.captureStackTrace(this,this.constructor)}},QM=async(_,z)=>{var A,b,G,J,Y,X;let Q=z||{},$={onRequest:[z==null?void 0:z.onRequest],onResponse:[z==null?void 0:z.onResponse],onSuccess:[z==null?void 0:z.onSuccess],onError:[z==null?void 0:z.onError],onRetry:[z==null?void 0:z.onRetry]};if(!z||!(z==null?void 0:z.plugins))return{url:_,options:Q,hooks:$};for(let H of(z==null?void 0:z.plugins)||[]){if(H.init){let B=await((A=H.init)==null?void 0:A.call(H,_.toString(),z));Q=B.options||Q,_=B.url}$.onRequest.push((b=H.hooks)==null?void 0:b.onRequest),$.onResponse.push((G=H.hooks)==null?void 0:G.onResponse),$.onSuccess.push((J=H.hooks)==null?void 0:J.onSuccess),$.onError.push((Y=H.hooks)==null?void 0:Y.onError),$.onRetry.push((X=H.hooks)==null?void 0:X.onRetry)}return{url:_,options:Q,hooks:$}},cG=class{constructor(_){this.options=_}shouldAttemptRetry(_,z){if(this.options.shouldRetry)return Promise.resolve(_<this.options.attempts&&this.options.shouldRetry(z));return Promise.resolve(_<this.options.attempts)}getDelay(){return this.options.delay}},$M=class{constructor(_){this.options=_}shouldAttemptRetry(_,z){if(this.options.shouldRetry)return Promise.resolve(_<this.options.attempts&&this.options.shouldRetry(z));return Promise.resolve(_<this.options.attempts)}getDelay(_){return Math.min(this.options.maxDelay,this.options.baseDelay*2**_)}};function HM(_){if(typeof _==="number")return new cG({type:"linear",attempts:_,delay:1000});switch(_.type){case"linear":return new cG(_);case"exponential":return new $M(_);default:throw Error("Invalid retry strategy")}}var BM=async(_)=>{let z={},A=async(b)=>typeof b==="function"?await b():b;if(_==null?void 0:_.auth){if(_.auth.type==="Bearer"){let b=await A(_.auth.token);if(!b)return z;z.authorization=`Bearer ${b}`}else if(_.auth.type==="Basic"){let[b,G]=await Promise.all([A(_.auth.username),A(_.auth.password)]);if(!b||!G)return z;z.authorization=`Basic ${btoa(`${b}:${G}`)}`}else if(_.auth.type==="Custom"){let[b,G]=await Promise.all([A(_.auth.prefix),A(_.auth.value)]);if(!G)return z;z.authorization=`${b!=null?b:""} ${G}`}}return z},ZM=/^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;function FM(_){let z=_.headers.get("content-type"),A=new Set(["image/svg","application/xml","application/xhtml","application/html"]);if(!z)return"json";let b=z.split(";").shift()||"";if(ZM.test(b))return"json";if(A.has(b)||b.startsWith("text/"))return"text";return"blob"}function KM(_){try{return JSON.parse(_),!0}catch(z){return!1}}function l8(_){if(_===void 0)return!1;let z=typeof _;if(z==="string"||z==="number"||z==="boolean"||z===null)return!0;if(z!=="object")return!1;if(Array.isArray(_))return!0;if(_.buffer)return!1;return _.constructor&&_.constructor.name==="Object"||typeof _.toJSON==="function"}function lG(_){try{return JSON.parse(_)}catch(z){return _}}function pG(_){return typeof _==="function"}function qM(_){if(_==null?void 0:_.customFetchImpl)return _.customFetchImpl;if(typeof globalThis<"u"&&pG(globalThis.fetch))return globalThis.fetch;if(typeof window<"u"&&pG(window.fetch))return window.fetch;throw Error("No fetch implementation found")}async function WM(_){let z=new Headers(_==null?void 0:_.headers),A=await BM(_);for(let[b,G]of Object.entries(A||{}))z.set(b,G);if(!z.has("content-type")){let b=VM(_==null?void 0:_.body);if(b)z.set("content-type",b)}return z}function VM(_){if(l8(_))return"application/json";return null}function UM(_){if(!(_==null?void 0:_.body))return null;let z=new Headers(_==null?void 0:_.headers);if(l8(_.body)&&!z.has("content-type")){for(let[A,b]of Object.entries(_==null?void 0:_.body))if(b instanceof Date)_.body[A]=b.toISOString();return JSON.stringify(_.body)}if(z.has("content-type")&&z.get("content-type")==="application/x-www-form-urlencoded"){if(l8(_.body))return new URLSearchParams(_.body).toString();return _.body}return _.body}function DM(_,z){var A;if(z==null?void 0:z.method)return z.method.toUpperCase();if(_.startsWith("@")){let b=(A=_.split("@")[1])==null?void 0:A.split("/")[0];if(!dG.includes(b))return(z==null?void 0:z.body)?"POST":"GET";return b.toUpperCase()}return(z==null?void 0:z.body)?"POST":"GET"}function MM(_,z){let A;if(!(_==null?void 0:_.signal)&&(_==null?void 0:_.timeout))A=setTimeout(()=>z==null?void 0:z.abort(),_==null?void 0:_.timeout);return{abortTimeout:A,clearTimeout:()=>{if(A)clearTimeout(A)}}}var NM=class _ extends Error{constructor(z,A){super(A||JSON.stringify(z,null,2));this.issues=z,Object.setPrototypeOf(this,_.prototype)}};async function d3(_,z){let A=await _["~standard"].validate(z);if(A.issues)throw new NM(A.issues);return A.value}var dG=["get","post","put","patch","delete"];var wM=(_)=>({id:"apply-schema",name:"Apply Schema",version:"1.0.0",async init(z,A){var b,G,J,Y;let X=((G=(b=_.plugins)==null?void 0:b.find((Q)=>{var $;return(($=Q.schema)==null?void 0:$.config)?z.startsWith(Q.schema.config.baseURL||"")||z.startsWith(Q.schema.config.prefix||""):!1}))==null?void 0:G.schema)||_.schema;if(X){let Q=z;if((J=X.config)==null?void 0:J.prefix){if(Q.startsWith(X.config.prefix)){if(Q=Q.replace(X.config.prefix,""),X.config.baseURL)z=z.replace(X.config.prefix,X.config.baseURL)}}if((Y=X.config)==null?void 0:Y.baseURL){if(Q.startsWith(X.config.baseURL))Q=Q.replace(X.config.baseURL,"")}let $=X.schema[Q];if($){let H=z4(x9({},A),{method:$.method,output:$.output});if(!(A==null?void 0:A.disableValidation))H=z4(x9({},H),{body:$.input?await d3($.input,A==null?void 0:A.body):A==null?void 0:A.body,params:$.params?await d3($.params,A==null?void 0:A.params):A==null?void 0:A.params,query:$.query?await d3($.query,A==null?void 0:A.query):A==null?void 0:A.query});return{url:z,options:H}}}return{url:z,options:A}}}),rG=(_)=>{async function z(A,b){let G=z4(x9(x9({},_),b),{plugins:[...(_==null?void 0:_.plugins)||[],wM(_||{}),...(b==null?void 0:b.plugins)||[]]});if(_==null?void 0:_.catchAllError)try{return await p8(A,G)}catch(J){return{data:null,error:{status:500,statusText:"Fetch Error",message:"Fetch related error. Captured by catchAllError option. See error property for more details.",error:J}}}return await p8(A,G)}return z};function EM(_,z){let{baseURL:A,params:b,query:G}=z||{query:{},params:{},baseURL:""},J=_.startsWith("http")?_.split("/").slice(0,3).join("/"):A||"";if(_.startsWith("@")){let B=_.toString().split("@")[1].split("/")[0];if(dG.includes(B))_=_.replace(`@${B}/`,"/")}if(!J.endsWith("/"))J+="/";let[Y,X]=_.replace(J,"").split("?"),Q=new URLSearchParams(X);for(let[B,Z]of Object.entries(G||{})){if(Z==null)continue;let F;if(typeof Z==="string")F=Z;else if(Array.isArray(Z)){for(let K of Z)Q.append(B,K);continue}else F=JSON.stringify(Z);Q.set(B,F)}if(b)if(Array.isArray(b)){let B=Y.split("/").filter((Z)=>Z.startsWith(":"));for(let[Z,F]of B.entries()){let K=b[Z];Y=Y.replace(F,K)}}else for(let[B,Z]of Object.entries(b))Y=Y.replace(`:${B}`,String(Z));if(Y=Y.split("/").map(encodeURIComponent).join("/"),Y.startsWith("/"))Y=Y.slice(1);let $=Q.toString();if($=$.length>0?`?${$}`.replace(/\+/g,"%20"):"",!J.startsWith("http"))return`${J}${Y}${$}`;return new URL(`${Y}${$}`,J)}var p8=async(_,z)=>{var A,b,G,J,Y,X,Q,$;let{hooks:H,url:B,options:Z}=await QM(_,z),F=qM(Z),K=new AbortController,q=(A=Z.signal)!=null?A:K.signal,W=EM(B,Z),V=UM(Z),w=await WM(Z),O=DM(B,Z),M=z4(x9({},Z),{url:W,headers:w,body:V,method:O,signal:q});for(let g of H.onRequest)if(g){let m=await g(M);if(typeof m==="object"&&m!==null)M=m}if("pipeTo"in M&&typeof M.pipeTo==="function"||typeof((b=z==null?void 0:z.body)==null?void 0:b.pipe)==="function"){if(!("duplex"in M))M.duplex="half"}let{clearTimeout:P}=MM(Z,K),D=await F(M.url,M);P();let L={response:D,request:M};for(let g of H.onResponse)if(g){let m=await g(z4(x9({},L),{response:((G=z==null?void 0:z.hookOptions)==null?void 0:G.cloneResponse)?D.clone():D}));if(m instanceof Response)D=m;else if(typeof m==="object"&&m!==null)D=m.response}if(D.ok){if(M.method==="HEAD")return{data:"",error:null};let m=FM(D),d={data:null,response:D,request:M};if(m==="json"||m==="text"){let Z0=await D.text(),S9=(J=M.jsonParser)!=null?J:lG;d.data=await S9(Z0)}else d.data=await D[m]();if(M==null?void 0:M.output){if(M.output&&!M.disableValidation)d.data=await d3(M.output,d.data)}for(let Z0 of H.onSuccess)if(Z0)await Z0(z4(x9({},d),{response:((Y=z==null?void 0:z.hookOptions)==null?void 0:Y.cloneResponse)?D.clone():D}));if(z==null?void 0:z.throw)return d.data;return{data:d.data,error:null}}let R=(X=z==null?void 0:z.jsonParser)!=null?X:lG,S=await D.text(),y=KM(S),e=y?await R(S):null,u={response:D,responseText:S,request:M,error:z4(x9({},e),{status:D.status,statusText:D.statusText})};for(let g of H.onError)if(g)await g(z4(x9({},u),{response:((Q=z==null?void 0:z.hookOptions)==null?void 0:Q.cloneResponse)?D.clone():D}));if(z==null?void 0:z.retry){let g=HM(z.retry),m=($=z.retryAttempt)!=null?$:0;if(await g.shouldAttemptRetry(m,D)){for(let Z0 of H.onRetry)if(Z0)await Z0(L);let d=g.getDelay(m);return await new Promise((Z0)=>setTimeout(Z0,d)),await p8(_,z4(x9({},z),{retryAttempt:m+1}))}}if(z==null?void 0:z.throw)throw new XM(D.status,D.statusText,y?e:S);return{data:null,error:z4(x9({},e),{status:D.status,statusText:D.statusText})}};var nG=(_,z)=>{let A="credentials"in Request.prototype,b=CG(_?.baseURL,_?.basePath,void 0,z)??"/api/auth",G=_?.plugins?.flatMap((M)=>M.fetchPlugins).filter((M)=>M!==void 0)||[],J={id:"lifecycle-hooks",name:"lifecycle-hooks",hooks:{onSuccess:_?.fetchOptions?.onSuccess,onError:_?.fetchOptions?.onError,onRequest:_?.fetchOptions?.onRequest,onResponse:_?.fetchOptions?.onResponse}},{onSuccess:Y,onError:X,onRequest:Q,onResponse:$,...H}=_?.fetchOptions||{},B=rG({baseURL:b,...A?{credentials:"include"}:{},method:"GET",jsonParser(M){if(!M)return null;return gG(M,{strict:!1})},customFetchImpl:fetch,...H,plugins:[J,...H.plugins||[],..._?.disableDefaultFetchPlugins?[]:[vG],...G]}),{$sessionSignal:Z,session:F}=fG(B,_),K=_?.plugins||[],q={},W={$sessionSignal:Z,session:F},V={"/sign-out":"POST","/revoke-sessions":"POST","/revoke-other-sessions":"POST","/delete-user":"POST"},w=[{signal:"$sessionSignal",matcher(M){return M==="/sign-out"||M==="/update-user"||M==="/sign-up/email"||M==="/sign-in/email"||M==="/delete-user"||M==="/verify-email"||M==="/revoke-sessions"||M==="/revoke-session"||M==="/change-email"}}];for(let M of K){if(M.getAtoms)Object.assign(W,M.getAtoms?.(B));if(M.pathMethods)Object.assign(V,M.pathMethods);if(M.atomListeners)w.push(...M.atomListeners)}let O={notify:(M)=>{W[M].set(!W[M].get())},listen:(M,P)=>{W[M].subscribe(P)},atoms:W};for(let M of K)if(M.getActions)q=hG(M.getActions?.(B,O,_)??{},q);return{get baseURL(){return b},pluginsActions:q,pluginsAtoms:W,pluginPathMethods:V,atomListeners:w,$fetch:B,$store:O}};function iG(_){return typeof _==="object"&&_!==null&&"get"in _&&typeof _.get==="function"&&"lc"in _&&typeof _.lc==="number"}function OM(_,z,A){let b=z[_],{fetchOptions:G,query:J,...Y}=A||{};if(b)return b;if(G?.method)return G.method;if(Y&&Object.keys(Y).length>0)return"POST";return"GET"}function oG(_,z,A,b,G){function J(Y=[]){return new Proxy(function(){},{get(X,Q){if(typeof Q!=="string")return;if(Q==="then"||Q==="catch"||Q==="finally")return;let $=[...Y,Q],H=_;for(let B of $)if(H&&typeof H==="object"&&B in H)H=H[B];else{H=void 0;break}if(typeof H==="function")return H;if(iG(H))return H;return J($)},apply:async(X,Q,$)=>{let H="/"+Y.map((w)=>w.replace(/[A-Z]/g,(O)=>`-${O.toLowerCase()}`)).join("/"),B=$[0]||{},Z=$[1]||{},{query:F,fetchOptions:K,...q}=B,W={...Z,...K},V=OM(H,A,B);return await z(H,{...W,body:V==="GET"?void 0:{...q,...W?.body||{}},query:F||W?.query,method:V,async onSuccess(w){if(await W?.onSuccess?.(w),!G||W.disableSignal)return;let O=G.filter((P)=>P.matcher(H));if(!O.length)return;let M=new Set;for(let P of O){let D=b[P.signal];if(!D)return;if(M.has(P.signal))continue;M.add(P.signal);let L=D.get();setTimeout(()=>{D.set(!L)},10)}}})}})}return J()}function d8(_){let{pluginPathMethods:z,pluginsActions:A,pluginsAtoms:b,$fetch:G,atomListeners:J,$store:Y}=nG(_),X={};for(let[Q,$]of Object.entries(b))X[`use${h8(Q)}`]=$;return oG({...A,...X,$fetch:G,$store:Y},G,z,b,J)}function aG(_){return{authorize(z,A="AND"){let b=!1;for(let[G,J]of Object.entries(z)){let Y=_[G];if(!Y)return{success:!1,error:`You are not allowed to access resource: ${G}`};if(Array.isArray(J))b=J.every((X)=>Y.includes(X));else if(typeof J==="object"){let X=J;if(X.connector==="OR")b=X.actions.some((Q)=>Y.includes(Q));else b=X.actions.every((Q)=>Y.includes(Q))}else throw new m4("Invalid access control request");if(b&&A==="OR")return{success:b};if(!b&&A==="AND")return{success:!1,error:`unauthorized to access resource "${G}"`}}if(b)return{success:b};return{success:!1,error:"Not authorized"}},statements:_}}function Gz(_){return{newRole(z){return aG(z)},statements:_}}var sG={user:["create","list","set-role","ban","impersonate","delete","set-password","get","update"],session:["list","revoke","delete"]},r8=Gz(sG),tG=r8.newRole({user:["create","list","set-role","ban","impersonate","delete","set-password","get","update"],session:["list","revoke","delete"]}),eG=r8.newRole({user:[],session:[]});var n8=()=>{return{id:"device-authorization",$InferServerPlugin:{},pathMethods:{"/device/code":"POST","/device/token":"POST","/device":"GET","/device/approve":"POST","/device/deny":"POST"}}};var _J={organization:["update","delete"],member:["create","update","delete"],invitation:["create","cancel"],team:["create","update","delete"],ac:["create","read","update","delete"]},r3=Gz(_J),zJ=r3.newRole({organization:["update"],invitation:["create","cancel"],member:["create","update","delete"],team:["create","update","delete"],ac:["create","read","update","delete"]}),AJ=r3.newRole({organization:["update","delete"],member:["create","update","delete"],invitation:["create","cancel"],team:["create","update","delete"],ac:["create","read","update","delete"]}),bJ=r3.newRole({organization:[],member:[],invitation:[],team:[],ac:["read"]});function PM(_){let z=_.toLowerCase();return z==="localhost"||z.startsWith("localhost:")||z==="127.0.0.1"||z.startsWith("127.0.0.1:")||z==="[::1]"||z.startsWith("[::1]:")}function n3(_){let z=_.trim();if(!z)throw Error("Hostname is required.");let b=/^[a-zA-Z][a-zA-Z\d+.-]*:\/\//.test(z)?z:`${PM(z)?"http":"https"}://${z}`,G;try{G=new URL(b)}catch{throw Error(`Invalid hostname: ${_}`)}if(!G.hostname)throw Error(`Invalid hostname: ${_}`);if(G.pathname!=="/"||G.search||G.hash)throw Error("Hostname must not include a path, query, or fragment.");return{host:G.host.toLowerCase(),baseURL:`${G.protocol}//${G.host.toLowerCase()}`}}function i3(_){return d8({baseURL:_,plugins:[n8()]})}import{existsSync as HY,mkdirSync as Cw,readFileSync as vw,writeFileSync as yw}from"fs";import{homedir as gw}from"os";import{join as BY}from"path";import{existsSync as Pw,mkdirSync as Sw}from"fs";import{homedir as kw}from"os";import{join as $Y}from"path";var{createId:qn,init:jw,getConstants:Wn,isCuid:Vn}=XY();var z5=jw;var b5=$Y(kw(),".config","agentlogs"),QY=$Y(b5,"local.db"),Iw=typeof globalThis.Bun<"u",r_=null,A5=null;function xw(){if(!A5)A5=z5();return A5}function Tw(){if(!Pw(b5))Sw(b5,{recursive:!0})}async function s3(){if(r_)return r_;if(Tw(),Iw){let{Database:_}=await import("bun:sqlite"),z=new _(QY);r_={exec:(A)=>z.run(A),get:(A,...b)=>z.query(A).get(...b),run:(A,...b)=>z.run(A,b),all:(A,...b)=>z.query(A).all(...b)}}else{let{default:_}=await import("libsql"),z=new _(QY);r_={exec:(A)=>z.exec(A),get:(A,...b)=>z.prepare(A).get(...b),run:(A,...b)=>z.prepare(A).run(...b),all:(A,...b)=>z.prepare(A).all(...b)}}return r_.exec(`
43
43
  CREATE TABLE IF NOT EXISTS kv (
44
44
  key TEXT PRIMARY KEY,
45
45
  value TEXT NOT NULL
46
46
  )
47
- `),d_}function D4(){return{async get(_,z){let b=(await i3()).get("SELECT value FROM kv WHERE key = ?",_);if(!b)return z;try{return JSON.parse(b.value)}catch{return z}},async set(_,z){let A=await i3(),b=JSON.stringify(z);A.run("INSERT OR REPLACE INTO kv (key, value) VALUES (?, ?)",_,b)},async delete(_){(await i3()).run("DELETE FROM kv WHERE key = ?",_)},async keys(_){let z=await i3();if(_)return z.all("SELECT key FROM kv WHERE key LIKE ?",`${_}%`).map((G)=>G.key);return z.all("SELECT key FROM kv").map((b)=>b.key)}}}async function z4(_){let z=D4(),A=`transcript.${_}.id`,b=await z.get(A);if(b)return b;let G=Sw()();return await z.set(A,G),G}async function z5(_,z){let A=D4(),b=`transcript.${_}.id`;await A.set(b,z)}async function Yz(_,z){let A=D4(),b=`call.${_}.transcriptId`;await A.set(b,z)}async function Xz(_){let z=D4(),A=`call.${_}.transcriptId`;return z.get(A)}async function Qz(_){let z=D4(),A=`call.${_}.transcriptId`;await z.delete(A)}var A5=BY(Cw(),".config","agentlogs"),b5=BY(A5,"config.json");function ZY(){if(!HY(A5))Iw(A5,{recursive:!0})}function G5(){if(ZY(),!HY(b5))return{environments:[]};try{let _=xw(b5,"utf-8"),z=JSON.parse(_);return{environments:Array.isArray(z.environments)?z.environments:[]}}catch{return{environments:[]}}}function FY(_){ZY();try{Tw(b5,JSON.stringify(_,null,2),"utf-8")}catch(z){throw console.error("Failed to write config file:",z),z}}function o3(){return G5().environments}function J5(_){return o3().find((z)=>z.name===_)}function Y5(_){return`auth.token.${_}`}async function X5(_){let z=process.env.AGENTLOGS_AUTH_TOKEN?.trim();if(z)return z;try{if(!J5(_)?.user?.email)return null;return await D4().get(Y5(_))??null}catch{return null}}async function KY(_,z,A){try{await D4().set(Y5(_),A)}catch(b){throw console.error("Failed to store token:",b),b}}async function qY(_){try{await D4().delete(Y5(_))}catch{}}function WY(_){let z=G5(),A=z.environments.findIndex((b)=>b.name===_.name);if(A>=0)z.environments[A]=_;else z.environments.push(_);FY(z)}function VY(_){let z=G5();z.environments=z.environments.filter((A)=>A.name!==_),FY(z)}async function A4(){let _=o3(),z=[];for(let A of _){let b=await X5(A.name);if(b)z.push({...A,token:b})}if(z.length===0){let A=process.env.AGENTLOGS_AUTH_TOKEN?.trim();if(A){let b=process.env.AGENTLOGS_SERVER_URL?.trim()||"https://agentlogs.ai"?.trim()||"https://agentlogs.ai";z.push({name:"prod",baseURL:b,user:{id:"ci",email:"ci@agentlogs.ai",name:"CI"},lastLoginTime:new Date().toISOString(),token:A})}}return z}async function UY(_={}){let z=_.dev??!1,A=z?"dev":"prod",b=z?AJ:bJ;console.log(`\uD83D\uDD10 AgentLogs Device Authorization (${z?"development":"production"})`),console.log(`\uD83C\uDF10 Server: ${b}`),console.log("⏳ Requesting device authorization...");let J=d3(b);try{let{data:Y,error:X}=await J.device.code({client_id:"agentlogs-cli",scope:"openid profile email"});if(X||!Y)console.error("❌ Error:",X?.error_description||"Failed to request device code"),process.exit(1);let{device_code:Q,user_code:$,verification_uri:H,verification_uri_complete:B,interval:Z=5}=Y;console.log(`
48
- \uD83D\uDCF1 Device Authorization in Progress`),console.log(`Please visit: ${H}`),console.log(`Enter code: ${$}
49
- `);let F=B||H;if(F)console.log("\uD83C\uDF10 Opening browser..."),await LG(F);console.log(`⏳ Waiting for authorization... (polling every ${Z}s)`),await vw(J,Q,Z,A,b)}catch(Y){console.error("❌ Error:",Y instanceof Error?Y.message:"Unknown error"),process.exit(1)}}async function vw(_,z,A,b,G){let J=A;return new Promise((Y)=>{let X=async()=>{try{let{data:Q,error:$}=await _.device.token({grant_type:"urn:ietf:params:oauth:grant-type:device_code",device_code:z,client_id:"agentlogs-cli"});if(Q?.access_token){console.log(`
50
- ✅ Authorization Successful!`),console.log("\uD83D\uDD11 Access token received!");let{data:H}=await _.getSession({fetchOptions:{headers:{Authorization:`Bearer ${Q.access_token}`}}});if(H?.user)await KY(b,H.user.email,Q.access_token),WY({name:b,baseURL:G,user:{id:H.user.id,email:H.user.email,name:H.user.name},lastLoginTime:new Date().toISOString()}),console.log(`\uD83D\uDC4B Hello, ${H.user.name}!`),console.log(`\uD83D\uDCE7 Logged in as: ${H.user.email}`),console.log(`\uD83C\uDF10 Environment: ${b}`);else console.log("⚠️ Warning: Could not retrieve user session");Y(),process.exit(0)}else if($)switch($.error){case"authorization_pending":break;case"slow_down":J+=5,console.log(`⚠️ Slowing down polling to ${J}s`);break;case"access_denied":console.error("❌ Access was denied by the user"),process.exit(1);break;case"expired_token":console.error("❌ The device code has expired. Please try again."),process.exit(1);break;default:console.error("❌ Error:",$.error_description||$.error),process.exit(1)}}catch(Q){console.error("❌ Error:",Q instanceof Error?Q.message:"Unknown error"),process.exit(1)}setTimeout(X,J*1000)};setTimeout(X,J*1000)})}async function DY(_={}){let z=_.dev??!1,A=z?"dev":"prod",b=J5(A);if(!b){console.log(`ℹ️ Not currently logged in to ${z?"development":"production"}`);return}try{await qY(A),VY(A),console.log(`✅ Logged out from ${z?"development":"production"} successfully`),console.log(`\uD83D\uDCE7 Was logged in as: ${b.user.email}`)}catch(G){console.error("⚠️ Warning: Could not completely clear credentials:",G instanceof Error?G.message:"Unknown error")}}async function MY(_={}){if(_.allowMode){let b=_.allowMode.toLowerCase();if(b!=="allowlist"&&b!=="denylist")console.error("Invalid allowMode. Use 'allowlist' or 'denylist'."),process.exit(1);bG(b),console.log(`Allow mode set to: ${b}`),console.log()}let z=s9();console.log("AgentLogs Settings"),console.log("──────────────────"),console.log(`Mode: ${z.allowMode}`),console.log(`Config: ${GG()}`),console.log();let A=Object.keys(z.repos);if(A.length===0)console.log("Repos: (none configured)");else{console.log("Repos:");for(let b of A){let G=z.repos[b];if(G.allow){let J=G.visibility??"(server default)";console.log(` ✓ ${b} ${J}`)}else console.log(` ✗ ${b} (denied)`)}}process.exit(0)}async function NY(){let _=o3();if(_.length===0)console.log("❌ Not logged in"),console.log("Run `agentlogs login` to authenticate"),process.exit(1);console.log(`\uD83D\uDD10 AgentLogs Authentication Status
51
- `);let z=!1;for(let A of _){let b=await X5(A.name),G=A.name==="dev"?"Development":"Production";if(!b){console.log(`${G} (${A.baseURL})`),console.log(" ❌ Token not found"),console.log(` \uD83D\uDCE7 Was: ${A.user.email}`),console.log("");continue}try{let J=d3(A.baseURL),{data:Y,error:X}=await J.getSession({fetchOptions:{headers:{Authorization:`Bearer ${b}`}}});if(X||!Y?.user){console.log(`${G} (${A.baseURL})`),console.log(" ⚠️ Token invalid or expired"),console.log(` \uD83D\uDCE7 Was: ${A.user.email}`),console.log(` Run \`agentlogs login${A.name==="dev"?" --dev":""}\` to re-authenticate`),console.log("");continue}if(z=!0,console.log(`${G} (${A.baseURL})`),console.log(" ✅ Logged in"),console.log(` \uD83D\uDC64 ${Y.user.name}`),console.log(` \uD83D\uDCE7 ${Y.user.email}`),A.lastLoginTime){let Q=new Date(A.lastLoginTime);console.log(` \uD83D\uDD50 Last login: ${Q.toLocaleString()}`)}console.log("")}catch(J){console.log(`${G} (${A.baseURL})`),console.log(` ❌ Error verifying session: ${J instanceof Error?J.message:"Unknown error"}`),console.log("")}}if(!z)process.exit(1)}import{resolve as rP}from"path";import{spawnSync as nP}from"child_process";import{existsSync as iP,readFileSync as oP}from"fs";var U={};A8(U,{void:()=>DE,util:()=>z0,unknown:()=>VE,union:()=>EE,undefined:()=>KE,tuple:()=>jE,transformer:()=>yE,symbol:()=>FE,string:()=>kY,strictObject:()=>wE,setErrorMap:()=>fw,set:()=>SE,record:()=>RE,quotelessJson:()=>yw,promise:()=>vE,preprocess:()=>hE,pipeline:()=>mE,ostring:()=>uE,optional:()=>gE,onumber:()=>cE,oboolean:()=>lE,objectUtil:()=>Q5,object:()=>NE,number:()=>IY,nullable:()=>fE,null:()=>qE,never:()=>UE,nativeEnum:()=>CE,nan:()=>HE,map:()=>PE,makeIssue:()=>$z,literal:()=>xE,lazy:()=>IE,late:()=>QE,isValid:()=>p4,isDirty:()=>s3,isAsync:()=>n_,isAborted:()=>a3,intersection:()=>LE,instanceof:()=>$E,getParsedType:()=>b4,getErrorMap:()=>r_,function:()=>kE,enum:()=>TE,effect:()=>yE,discriminatedUnion:()=>OE,defaultErrorMap:()=>M4,datetimeRegex:()=>RY,date:()=>ZE,custom:()=>SY,coerce:()=>pE,boolean:()=>xY,bigint:()=>BE,array:()=>ME,any:()=>WE,addIssueToContext:()=>T,ZodVoid:()=>Bz,ZodUnknown:()=>d4,ZodUnion:()=>e_,ZodUndefined:()=>s_,ZodType:()=>_0,ZodTuple:()=>J4,ZodTransformer:()=>g9,ZodSymbol:()=>Hz,ZodString:()=>T9,ZodSet:()=>U_,ZodSchema:()=>_0,ZodRecord:()=>Zz,ZodReadonly:()=>Y1,ZodPromise:()=>D_,ZodPipeline:()=>qz,ZodParsedType:()=>k,ZodOptional:()=>v9,ZodObject:()=>S0,ZodNumber:()=>r4,ZodNullable:()=>w4,ZodNull:()=>t_,ZodNever:()=>G4,ZodNativeEnum:()=>b1,ZodNaN:()=>Kz,ZodMap:()=>Fz,ZodLiteral:()=>A1,ZodLazy:()=>z1,ZodIssueCode:()=>j,ZodIntersection:()=>_1,ZodFunction:()=>o_,ZodFirstPartyTypeKind:()=>p,ZodError:()=>J9,ZodEnum:()=>i4,ZodEffects:()=>g9,ZodDiscriminatedUnion:()=>t3,ZodDefault:()=>G1,ZodDate:()=>W_,ZodCatch:()=>J1,ZodBranded:()=>e3,ZodBoolean:()=>a_,ZodBigInt:()=>n4,ZodArray:()=>C9,ZodAny:()=>V_,Schema:()=>_0,ParseStatus:()=>g0,OK:()=>d0,NEVER:()=>dE,INVALID:()=>l,EMPTY_PATH:()=>hw,DIRTY:()=>q_,BRAND:()=>XE});var z0;(function(_){_.assertEqual=(G)=>{};function z(G){}_.assertIs=z;function A(G){throw Error()}_.assertNever=A,_.arrayToEnum=(G)=>{let J={};for(let Y of G)J[Y]=Y;return J},_.getValidEnumValues=(G)=>{let J=_.objectKeys(G).filter((X)=>typeof G[G[X]]!=="number"),Y={};for(let X of J)Y[X]=G[X];return _.objectValues(Y)},_.objectValues=(G)=>{return _.objectKeys(G).map(function(J){return G[J]})},_.objectKeys=typeof Object.keys==="function"?(G)=>Object.keys(G):(G)=>{let J=[];for(let Y in G)if(Object.prototype.hasOwnProperty.call(G,Y))J.push(Y);return J},_.find=(G,J)=>{for(let Y of G)if(J(Y))return Y;return},_.isInteger=typeof Number.isInteger==="function"?(G)=>Number.isInteger(G):(G)=>typeof G==="number"&&Number.isFinite(G)&&Math.floor(G)===G;function b(G,J=" | "){return G.map((Y)=>typeof Y==="string"?`'${Y}'`:Y).join(J)}_.joinValues=b,_.jsonStringifyReplacer=(G,J)=>{if(typeof J==="bigint")return J.toString();return J}})(z0||(z0={}));var Q5;(function(_){_.mergeShapes=(z,A)=>{return{...z,...A}}})(Q5||(Q5={}));var k=z0.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),b4=(_)=>{switch(typeof _){case"undefined":return k.undefined;case"string":return k.string;case"number":return Number.isNaN(_)?k.nan:k.number;case"boolean":return k.boolean;case"function":return k.function;case"bigint":return k.bigint;case"symbol":return k.symbol;case"object":if(Array.isArray(_))return k.array;if(_===null)return k.null;if(_.then&&typeof _.then==="function"&&_.catch&&typeof _.catch==="function")return k.promise;if(typeof Map<"u"&&_ instanceof Map)return k.map;if(typeof Set<"u"&&_ instanceof Set)return k.set;if(typeof Date<"u"&&_ instanceof Date)return k.date;return k.object;default:return k.unknown}};var j=z0.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"]),yw=(_)=>{return JSON.stringify(_,null,2).replace(/"([^"]+)":/g,"$1:")};class J9 extends Error{get errors(){return this.issues}constructor(_){super();this.issues=[],this.addIssue=(A)=>{this.issues=[...this.issues,A]},this.addIssues=(A=[])=>{this.issues=[...this.issues,...A]};let z=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,z);else this.__proto__=z;this.name="ZodError",this.issues=_}format(_){let z=_||function(G){return G.message},A={_errors:[]},b=(G)=>{for(let J of G.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)A._errors.push(z(J));else{let Y=A,X=0;while(X<J.path.length){let Q=J.path[X];if(X!==J.path.length-1)Y[Q]=Y[Q]||{_errors:[]};else Y[Q]=Y[Q]||{_errors:[]},Y[Q]._errors.push(z(J));Y=Y[Q],X++}}};return b(this),A}static assert(_){if(!(_ instanceof J9))throw Error(`Not a ZodError: ${_}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,z0.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(_=(z)=>z.message){let z={},A=[];for(let b of this.issues)if(b.path.length>0){let G=b.path[0];z[G]=z[G]||[],z[G].push(_(b))}else A.push(_(b));return{formErrors:A,fieldErrors:z}}get formErrors(){return this.flatten()}}J9.create=(_)=>{return new J9(_)};var gw=(_,z)=>{let A;switch(_.code){case j.invalid_type:if(_.received===k.undefined)A="Required";else A=`Expected ${_.expected}, received ${_.received}`;break;case j.invalid_literal:A=`Invalid literal value, expected ${JSON.stringify(_.expected,z0.jsonStringifyReplacer)}`;break;case j.unrecognized_keys:A=`Unrecognized key(s) in object: ${z0.joinValues(_.keys,", ")}`;break;case j.invalid_union:A="Invalid input";break;case j.invalid_union_discriminator:A=`Invalid discriminator value. Expected ${z0.joinValues(_.options)}`;break;case j.invalid_enum_value:A=`Invalid enum value. Expected ${z0.joinValues(_.options)}, received '${_.received}'`;break;case j.invalid_arguments:A="Invalid function arguments";break;case j.invalid_return_type:A="Invalid function return type";break;case j.invalid_date:A="Invalid date";break;case j.invalid_string:if(typeof _.validation==="object")if("includes"in _.validation){if(A=`Invalid input: must include "${_.validation.includes}"`,typeof _.validation.position==="number")A=`${A} at one or more positions greater than or equal to ${_.validation.position}`}else if("startsWith"in _.validation)A=`Invalid input: must start with "${_.validation.startsWith}"`;else if("endsWith"in _.validation)A=`Invalid input: must end with "${_.validation.endsWith}"`;else z0.assertNever(_.validation);else if(_.validation!=="regex")A=`Invalid ${_.validation}`;else A="Invalid";break;case j.too_small:if(_.type==="array")A=`Array must contain ${_.exact?"exactly":_.inclusive?"at least":"more than"} ${_.minimum} element(s)`;else if(_.type==="string")A=`String must contain ${_.exact?"exactly":_.inclusive?"at least":"over"} ${_.minimum} character(s)`;else if(_.type==="number")A=`Number must be ${_.exact?"exactly equal to ":_.inclusive?"greater than or equal to ":"greater than "}${_.minimum}`;else if(_.type==="bigint")A=`Number must be ${_.exact?"exactly equal to ":_.inclusive?"greater than or equal to ":"greater than "}${_.minimum}`;else if(_.type==="date")A=`Date must be ${_.exact?"exactly equal to ":_.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(_.minimum))}`;else A="Invalid input";break;case j.too_big:if(_.type==="array")A=`Array must contain ${_.exact?"exactly":_.inclusive?"at most":"less than"} ${_.maximum} element(s)`;else if(_.type==="string")A=`String must contain ${_.exact?"exactly":_.inclusive?"at most":"under"} ${_.maximum} character(s)`;else if(_.type==="number")A=`Number must be ${_.exact?"exactly":_.inclusive?"less than or equal to":"less than"} ${_.maximum}`;else if(_.type==="bigint")A=`BigInt must be ${_.exact?"exactly":_.inclusive?"less than or equal to":"less than"} ${_.maximum}`;else if(_.type==="date")A=`Date must be ${_.exact?"exactly":_.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(_.maximum))}`;else A="Invalid input";break;case j.custom:A="Invalid input";break;case j.invalid_intersection_types:A="Intersection results could not be merged";break;case j.not_multiple_of:A=`Number must be a multiple of ${_.multipleOf}`;break;case j.not_finite:A="Number must be finite";break;default:A=z.defaultError,z0.assertNever(_)}return{message:A}},M4=gw;var wY=M4;function fw(_){wY=_}function r_(){return wY}var $z=(_)=>{let{data:z,path:A,errorMaps:b,issueData:G}=_,J=[...A,...G.path||[]],Y={...G,path:J};if(G.message!==void 0)return{...G,path:J,message:G.message};let X="",Q=b.filter(($)=>!!$).slice().reverse();for(let $ of Q)X=$(Y,{data:z,defaultError:X}).message;return{...G,path:J,message:X}},hw=[];function T(_,z){let A=r_(),b=$z({issueData:z,data:_.data,path:_.path,errorMaps:[_.common.contextualErrorMap,_.schemaErrorMap,A,A===M4?void 0:M4].filter((G)=>!!G)});_.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(_,z){let A=[];for(let b of z){if(b.status==="aborted")return l;if(b.status==="dirty")_.dirty();A.push(b.value)}return{status:_.value,value:A}}static async mergeObjectAsync(_,z){let A=[];for(let b of z){let G=await b.key,J=await b.value;A.push({key:G,value:J})}return g0.mergeObjectSync(_,A)}static mergeObjectSync(_,z){let A={};for(let b of z){let{key:G,value:J}=b;if(G.status==="aborted")return l;if(J.status==="aborted")return l;if(G.status==="dirty")_.dirty();if(J.status==="dirty")_.dirty();if(G.value!=="__proto__"&&(typeof J.value<"u"||b.alwaysSet))A[G.value]=J.value}return{status:_.value,value:A}}}var l=Object.freeze({status:"aborted"}),q_=(_)=>({status:"dirty",value:_}),d0=(_)=>({status:"valid",value:_}),a3=(_)=>_.status==="aborted",s3=(_)=>_.status==="dirty",p4=(_)=>_.status==="valid",n_=(_)=>typeof Promise<"u"&&_ instanceof Promise;var v;(function(_){_.errToObj=(z)=>typeof z==="string"?{message:z}:z||{},_.toString=(z)=>typeof z==="string"?z:z?.message})(v||(v={}));class y9{constructor(_,z,A,b){this._cachedPath=[],this.parent=_,this.data=z,this._path=A,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 EY=(_,z)=>{if(p4(z))return{success:!0,data:z.value};else{if(!_.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let A=new J9(_.common.issues);return this._error=A,this._error}}}};function o(_){if(!_)return{};let{errorMap:z,invalid_type_error:A,required_error:b,description:G}=_;if(z&&(A||b))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(z)return{errorMap:z,description:G};return{errorMap:(Y,X)=>{let{message:Q}=_;if(Y.code==="invalid_enum_value")return{message:Q??X.defaultError};if(typeof X.data>"u")return{message:Q??b??X.defaultError};if(Y.code!=="invalid_type")return{message:X.defaultError};return{message:Q??A??X.defaultError}},description:G}}class _0{get description(){return this._def.description}_getType(_){return b4(_.data)}_getOrReturnCtx(_,z){return z||{common:_.parent.common,data:_.data,parsedType:b4(_.data),schemaErrorMap:this._def.errorMap,path:_.path,parent:_.parent}}_processInputParams(_){return{status:new g0,ctx:{common:_.parent.common,data:_.data,parsedType:b4(_.data),schemaErrorMap:this._def.errorMap,path:_.path,parent:_.parent}}}_parseSync(_){let z=this._parse(_);if(n_(z))throw Error("Synchronous parse encountered promise.");return z}_parseAsync(_){let z=this._parse(_);return Promise.resolve(z)}parse(_,z){let A=this.safeParse(_,z);if(A.success)return A.data;throw A.error}safeParse(_,z){let A={common:{issues:[],async:z?.async??!1,contextualErrorMap:z?.errorMap},path:z?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:_,parsedType:b4(_)},b=this._parseSync({data:_,path:A.path,parent:A});return EY(A,b)}"~validate"(_){let z={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:_,parsedType:b4(_)};if(!this["~standard"].async)try{let A=this._parseSync({data:_,path:[],parent:z});return p4(A)?{value:A.value}:{issues:z.common.issues}}catch(A){if(A?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;z.common={issues:[],async:!0}}return this._parseAsync({data:_,path:[],parent:z}).then((A)=>p4(A)?{value:A.value}:{issues:z.common.issues})}async parseAsync(_,z){let A=await this.safeParseAsync(_,z);if(A.success)return A.data;throw A.error}async safeParseAsync(_,z){let A={common:{issues:[],contextualErrorMap:z?.errorMap,async:!0},path:z?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:_,parsedType:b4(_)},b=this._parse({data:_,path:A.path,parent:A}),G=await(n_(b)?b:Promise.resolve(b));return EY(A,G)}refine(_,z){let A=(b)=>{if(typeof z==="string"||typeof z>"u")return{message:z};else if(typeof z==="function")return z(b);else return z};return this._refinement((b,G)=>{let J=_(b),Y=()=>G.addIssue({code:j.custom,...A(b)});if(typeof Promise<"u"&&J instanceof Promise)return J.then((X)=>{if(!X)return Y(),!1;else return!0});if(!J)return Y(),!1;else return!0})}refinement(_,z){return this._refinement((A,b)=>{if(!_(A))return b.addIssue(typeof z==="function"?z(A,b):z),!1;else return!0})}_refinement(_){return new g9({schema:this,typeName:p.ZodEffects,effect:{type:"refinement",refinement:_}})}superRefine(_){return this._refinement(_)}constructor(_){this.spa=this.safeParseAsync,this._def=_,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:(z)=>this["~validate"](z)}}optional(){return v9.create(this,this._def)}nullable(){return w4.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return C9.create(this)}promise(){return D_.create(this,this._def)}or(_){return e_.create([this,_],this._def)}and(_){return _1.create(this,_,this._def)}transform(_){return new g9({...o(this._def),schema:this,typeName:p.ZodEffects,effect:{type:"transform",transform:_}})}default(_){let z=typeof _==="function"?_:()=>_;return new G1({...o(this._def),innerType:this,defaultValue:z,typeName:p.ZodDefault})}brand(){return new e3({typeName:p.ZodBranded,type:this,...o(this._def)})}catch(_){let z=typeof _==="function"?_:()=>_;return new J1({...o(this._def),innerType:this,catchValue:z,typeName:p.ZodCatch})}describe(_){return new this.constructor({...this._def,description:_})}pipe(_){return qz.create(this,_)}readonly(){return Y1.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var mw=/^c[^\s-]{8,}$/i,uw=/^[0-9a-z]+$/,cw=/^[0-9A-HJKMNP-TV-Z]{26}$/i,lw=/^[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,pw=/^[a-z0-9_-]{21}$/i,dw=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,rw=/^[-+]?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)?)??$/,nw=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,iw="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",$5,ow=/^(?:(?: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])$/,aw=/^(?:(?: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])$/,sw=/^(([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]))$/,tw=/^(([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])$/,ew=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,_E=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,LY="((\\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])))",zE=new RegExp(`^${LY}$`);function jY(_){let z="[0-5]\\d";if(_.precision)z=`${z}\\.\\d{${_.precision}}`;else if(_.precision==null)z=`${z}(\\.\\d+)?`;let A=_.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${z})${A}`}function AE(_){return new RegExp(`^${jY(_)}$`)}function RY(_){let z=`${LY}T${jY(_)}`,A=[];if(A.push(_.local?"Z?":"Z"),_.offset)A.push("([+-]\\d{2}:?\\d{2})");return z=`${z}(${A.join("|")})`,new RegExp(`^${z}$`)}function bE(_,z){if((z==="v4"||!z)&&ow.test(_))return!0;if((z==="v6"||!z)&&sw.test(_))return!0;return!1}function GE(_,z){if(!dw.test(_))return!1;try{let[A]=_.split(".");if(!A)return!1;let b=A.replace(/-/g,"+").replace(/_/g,"/").padEnd(A.length+(4-A.length%4)%4,"="),G=JSON.parse(atob(b));if(typeof G!=="object"||G===null)return!1;if("typ"in G&&G?.typ!=="JWT")return!1;if(!G.alg)return!1;if(z&&G.alg!==z)return!1;return!0}catch{return!1}}function JE(_,z){if((z==="v4"||!z)&&aw.test(_))return!0;if((z==="v6"||!z)&&tw.test(_))return!0;return!1}class T9 extends _0{_parse(_){if(this._def.coerce)_.data=String(_.data);if(this._getType(_)!==k.string){let G=this._getOrReturnCtx(_);return T(G,{code:j.invalid_type,expected:k.string,received:G.parsedType}),l}let A=new g0,b=void 0;for(let G of this._def.checks)if(G.kind==="min"){if(_.data.length<G.value)b=this._getOrReturnCtx(_,b),T(b,{code:j.too_small,minimum:G.value,type:"string",inclusive:!0,exact:!1,message:G.message}),A.dirty()}else if(G.kind==="max"){if(_.data.length>G.value)b=this._getOrReturnCtx(_,b),T(b,{code:j.too_big,maximum:G.value,type:"string",inclusive:!0,exact:!1,message:G.message}),A.dirty()}else if(G.kind==="length"){let J=_.data.length>G.value,Y=_.data.length<G.value;if(J||Y){if(b=this._getOrReturnCtx(_,b),J)T(b,{code:j.too_big,maximum:G.value,type:"string",inclusive:!0,exact:!0,message:G.message});else if(Y)T(b,{code:j.too_small,minimum:G.value,type:"string",inclusive:!0,exact:!0,message:G.message});A.dirty()}}else if(G.kind==="email"){if(!nw.test(_.data))b=this._getOrReturnCtx(_,b),T(b,{validation:"email",code:j.invalid_string,message:G.message}),A.dirty()}else if(G.kind==="emoji"){if(!$5)$5=new RegExp(iw,"u");if(!$5.test(_.data))b=this._getOrReturnCtx(_,b),T(b,{validation:"emoji",code:j.invalid_string,message:G.message}),A.dirty()}else if(G.kind==="uuid"){if(!lw.test(_.data))b=this._getOrReturnCtx(_,b),T(b,{validation:"uuid",code:j.invalid_string,message:G.message}),A.dirty()}else if(G.kind==="nanoid"){if(!pw.test(_.data))b=this._getOrReturnCtx(_,b),T(b,{validation:"nanoid",code:j.invalid_string,message:G.message}),A.dirty()}else if(G.kind==="cuid"){if(!mw.test(_.data))b=this._getOrReturnCtx(_,b),T(b,{validation:"cuid",code:j.invalid_string,message:G.message}),A.dirty()}else if(G.kind==="cuid2"){if(!uw.test(_.data))b=this._getOrReturnCtx(_,b),T(b,{validation:"cuid2",code:j.invalid_string,message:G.message}),A.dirty()}else if(G.kind==="ulid"){if(!cw.test(_.data))b=this._getOrReturnCtx(_,b),T(b,{validation:"ulid",code:j.invalid_string,message:G.message}),A.dirty()}else if(G.kind==="url")try{new URL(_.data)}catch{b=this._getOrReturnCtx(_,b),T(b,{validation:"url",code:j.invalid_string,message:G.message}),A.dirty()}else if(G.kind==="regex"){if(G.regex.lastIndex=0,!G.regex.test(_.data))b=this._getOrReturnCtx(_,b),T(b,{validation:"regex",code:j.invalid_string,message:G.message}),A.dirty()}else if(G.kind==="trim")_.data=_.data.trim();else if(G.kind==="includes"){if(!_.data.includes(G.value,G.position))b=this._getOrReturnCtx(_,b),T(b,{code:j.invalid_string,validation:{includes:G.value,position:G.position},message:G.message}),A.dirty()}else if(G.kind==="toLowerCase")_.data=_.data.toLowerCase();else if(G.kind==="toUpperCase")_.data=_.data.toUpperCase();else if(G.kind==="startsWith"){if(!_.data.startsWith(G.value))b=this._getOrReturnCtx(_,b),T(b,{code:j.invalid_string,validation:{startsWith:G.value},message:G.message}),A.dirty()}else if(G.kind==="endsWith"){if(!_.data.endsWith(G.value))b=this._getOrReturnCtx(_,b),T(b,{code:j.invalid_string,validation:{endsWith:G.value},message:G.message}),A.dirty()}else if(G.kind==="datetime"){if(!RY(G).test(_.data))b=this._getOrReturnCtx(_,b),T(b,{code:j.invalid_string,validation:"datetime",message:G.message}),A.dirty()}else if(G.kind==="date"){if(!zE.test(_.data))b=this._getOrReturnCtx(_,b),T(b,{code:j.invalid_string,validation:"date",message:G.message}),A.dirty()}else if(G.kind==="time"){if(!AE(G).test(_.data))b=this._getOrReturnCtx(_,b),T(b,{code:j.invalid_string,validation:"time",message:G.message}),A.dirty()}else if(G.kind==="duration"){if(!rw.test(_.data))b=this._getOrReturnCtx(_,b),T(b,{validation:"duration",code:j.invalid_string,message:G.message}),A.dirty()}else if(G.kind==="ip"){if(!bE(_.data,G.version))b=this._getOrReturnCtx(_,b),T(b,{validation:"ip",code:j.invalid_string,message:G.message}),A.dirty()}else if(G.kind==="jwt"){if(!GE(_.data,G.alg))b=this._getOrReturnCtx(_,b),T(b,{validation:"jwt",code:j.invalid_string,message:G.message}),A.dirty()}else if(G.kind==="cidr"){if(!JE(_.data,G.version))b=this._getOrReturnCtx(_,b),T(b,{validation:"cidr",code:j.invalid_string,message:G.message}),A.dirty()}else if(G.kind==="base64"){if(!ew.test(_.data))b=this._getOrReturnCtx(_,b),T(b,{validation:"base64",code:j.invalid_string,message:G.message}),A.dirty()}else if(G.kind==="base64url"){if(!_E.test(_.data))b=this._getOrReturnCtx(_,b),T(b,{validation:"base64url",code:j.invalid_string,message:G.message}),A.dirty()}else z0.assertNever(G);return{status:A.value,value:_.data}}_regex(_,z,A){return this.refinement((b)=>_.test(b),{validation:z,code:j.invalid_string,...v.errToObj(A)})}_addCheck(_){return new T9({...this._def,checks:[...this._def.checks,_]})}email(_){return this._addCheck({kind:"email",...v.errToObj(_)})}url(_){return this._addCheck({kind:"url",...v.errToObj(_)})}emoji(_){return this._addCheck({kind:"emoji",...v.errToObj(_)})}uuid(_){return this._addCheck({kind:"uuid",...v.errToObj(_)})}nanoid(_){return this._addCheck({kind:"nanoid",...v.errToObj(_)})}cuid(_){return this._addCheck({kind:"cuid",...v.errToObj(_)})}cuid2(_){return this._addCheck({kind:"cuid2",...v.errToObj(_)})}ulid(_){return this._addCheck({kind:"ulid",...v.errToObj(_)})}base64(_){return this._addCheck({kind:"base64",...v.errToObj(_)})}base64url(_){return this._addCheck({kind:"base64url",...v.errToObj(_)})}jwt(_){return this._addCheck({kind:"jwt",...v.errToObj(_)})}ip(_){return this._addCheck({kind:"ip",...v.errToObj(_)})}cidr(_){return this._addCheck({kind:"cidr",...v.errToObj(_)})}datetime(_){if(typeof _==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:_});return this._addCheck({kind:"datetime",precision:typeof _?.precision>"u"?null:_?.precision,offset:_?.offset??!1,local:_?.local??!1,...v.errToObj(_?.message)})}date(_){return this._addCheck({kind:"date",message:_})}time(_){if(typeof _==="string")return this._addCheck({kind:"time",precision:null,message:_});return this._addCheck({kind:"time",precision:typeof _?.precision>"u"?null:_?.precision,...v.errToObj(_?.message)})}duration(_){return this._addCheck({kind:"duration",...v.errToObj(_)})}regex(_,z){return this._addCheck({kind:"regex",regex:_,...v.errToObj(z)})}includes(_,z){return this._addCheck({kind:"includes",value:_,position:z?.position,...v.errToObj(z?.message)})}startsWith(_,z){return this._addCheck({kind:"startsWith",value:_,...v.errToObj(z)})}endsWith(_,z){return this._addCheck({kind:"endsWith",value:_,...v.errToObj(z)})}min(_,z){return this._addCheck({kind:"min",value:_,...v.errToObj(z)})}max(_,z){return this._addCheck({kind:"max",value:_,...v.errToObj(z)})}length(_,z){return this._addCheck({kind:"length",value:_,...v.errToObj(z)})}nonempty(_){return this.min(1,v.errToObj(_))}trim(){return new T9({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new T9({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new T9({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((_)=>_.kind==="datetime")}get isDate(){return!!this._def.checks.find((_)=>_.kind==="date")}get isTime(){return!!this._def.checks.find((_)=>_.kind==="time")}get isDuration(){return!!this._def.checks.find((_)=>_.kind==="duration")}get isEmail(){return!!this._def.checks.find((_)=>_.kind==="email")}get isURL(){return!!this._def.checks.find((_)=>_.kind==="url")}get isEmoji(){return!!this._def.checks.find((_)=>_.kind==="emoji")}get isUUID(){return!!this._def.checks.find((_)=>_.kind==="uuid")}get isNANOID(){return!!this._def.checks.find((_)=>_.kind==="nanoid")}get isCUID(){return!!this._def.checks.find((_)=>_.kind==="cuid")}get isCUID2(){return!!this._def.checks.find((_)=>_.kind==="cuid2")}get isULID(){return!!this._def.checks.find((_)=>_.kind==="ulid")}get isIP(){return!!this._def.checks.find((_)=>_.kind==="ip")}get isCIDR(){return!!this._def.checks.find((_)=>_.kind==="cidr")}get isBase64(){return!!this._def.checks.find((_)=>_.kind==="base64")}get isBase64url(){return!!this._def.checks.find((_)=>_.kind==="base64url")}get minLength(){let _=null;for(let z of this._def.checks)if(z.kind==="min"){if(_===null||z.value>_)_=z.value}return _}get maxLength(){let _=null;for(let z of this._def.checks)if(z.kind==="max"){if(_===null||z.value<_)_=z.value}return _}}T9.create=(_)=>{return new T9({checks:[],typeName:p.ZodString,coerce:_?.coerce??!1,...o(_)})};function YE(_,z){let A=(_.toString().split(".")[1]||"").length,b=(z.toString().split(".")[1]||"").length,G=A>b?A:b,J=Number.parseInt(_.toFixed(G).replace(".","")),Y=Number.parseInt(z.toFixed(G).replace(".",""));return J%Y/10**G}class r4 extends _0{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(_){if(this._def.coerce)_.data=Number(_.data);if(this._getType(_)!==k.number){let G=this._getOrReturnCtx(_);return T(G,{code:j.invalid_type,expected:k.number,received:G.parsedType}),l}let A=void 0,b=new g0;for(let G of this._def.checks)if(G.kind==="int"){if(!z0.isInteger(_.data))A=this._getOrReturnCtx(_,A),T(A,{code:j.invalid_type,expected:"integer",received:"float",message:G.message}),b.dirty()}else if(G.kind==="min"){if(G.inclusive?_.data<G.value:_.data<=G.value)A=this._getOrReturnCtx(_,A),T(A,{code:j.too_small,minimum:G.value,type:"number",inclusive:G.inclusive,exact:!1,message:G.message}),b.dirty()}else if(G.kind==="max"){if(G.inclusive?_.data>G.value:_.data>=G.value)A=this._getOrReturnCtx(_,A),T(A,{code:j.too_big,maximum:G.value,type:"number",inclusive:G.inclusive,exact:!1,message:G.message}),b.dirty()}else if(G.kind==="multipleOf"){if(YE(_.data,G.value)!==0)A=this._getOrReturnCtx(_,A),T(A,{code:j.not_multiple_of,multipleOf:G.value,message:G.message}),b.dirty()}else if(G.kind==="finite"){if(!Number.isFinite(_.data))A=this._getOrReturnCtx(_,A),T(A,{code:j.not_finite,message:G.message}),b.dirty()}else z0.assertNever(G);return{status:b.value,value:_.data}}gte(_,z){return this.setLimit("min",_,!0,v.toString(z))}gt(_,z){return this.setLimit("min",_,!1,v.toString(z))}lte(_,z){return this.setLimit("max",_,!0,v.toString(z))}lt(_,z){return this.setLimit("max",_,!1,v.toString(z))}setLimit(_,z,A,b){return new r4({...this._def,checks:[...this._def.checks,{kind:_,value:z,inclusive:A,message:v.toString(b)}]})}_addCheck(_){return new r4({...this._def,checks:[...this._def.checks,_]})}int(_){return this._addCheck({kind:"int",message:v.toString(_)})}positive(_){return this._addCheck({kind:"min",value:0,inclusive:!1,message:v.toString(_)})}negative(_){return this._addCheck({kind:"max",value:0,inclusive:!1,message:v.toString(_)})}nonpositive(_){return this._addCheck({kind:"max",value:0,inclusive:!0,message:v.toString(_)})}nonnegative(_){return this._addCheck({kind:"min",value:0,inclusive:!0,message:v.toString(_)})}multipleOf(_,z){return this._addCheck({kind:"multipleOf",value:_,message:v.toString(z)})}finite(_){return this._addCheck({kind:"finite",message:v.toString(_)})}safe(_){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:v.toString(_)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:v.toString(_)})}get minValue(){let _=null;for(let z of this._def.checks)if(z.kind==="min"){if(_===null||z.value>_)_=z.value}return _}get maxValue(){let _=null;for(let z of this._def.checks)if(z.kind==="max"){if(_===null||z.value<_)_=z.value}return _}get isInt(){return!!this._def.checks.find((_)=>_.kind==="int"||_.kind==="multipleOf"&&z0.isInteger(_.value))}get isFinite(){let _=null,z=null;for(let A of this._def.checks)if(A.kind==="finite"||A.kind==="int"||A.kind==="multipleOf")return!0;else if(A.kind==="min"){if(z===null||A.value>z)z=A.value}else if(A.kind==="max"){if(_===null||A.value<_)_=A.value}return Number.isFinite(z)&&Number.isFinite(_)}}r4.create=(_)=>{return new r4({checks:[],typeName:p.ZodNumber,coerce:_?.coerce||!1,...o(_)})};class n4 extends _0{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse(_){if(this._def.coerce)try{_.data=BigInt(_.data)}catch{return this._getInvalidInput(_)}if(this._getType(_)!==k.bigint)return this._getInvalidInput(_);let A=void 0,b=new g0;for(let G of this._def.checks)if(G.kind==="min"){if(G.inclusive?_.data<G.value:_.data<=G.value)A=this._getOrReturnCtx(_,A),T(A,{code:j.too_small,type:"bigint",minimum:G.value,inclusive:G.inclusive,message:G.message}),b.dirty()}else if(G.kind==="max"){if(G.inclusive?_.data>G.value:_.data>=G.value)A=this._getOrReturnCtx(_,A),T(A,{code:j.too_big,type:"bigint",maximum:G.value,inclusive:G.inclusive,message:G.message}),b.dirty()}else if(G.kind==="multipleOf"){if(_.data%G.value!==BigInt(0))A=this._getOrReturnCtx(_,A),T(A,{code:j.not_multiple_of,multipleOf:G.value,message:G.message}),b.dirty()}else z0.assertNever(G);return{status:b.value,value:_.data}}_getInvalidInput(_){let z=this._getOrReturnCtx(_);return T(z,{code:j.invalid_type,expected:k.bigint,received:z.parsedType}),l}gte(_,z){return this.setLimit("min",_,!0,v.toString(z))}gt(_,z){return this.setLimit("min",_,!1,v.toString(z))}lte(_,z){return this.setLimit("max",_,!0,v.toString(z))}lt(_,z){return this.setLimit("max",_,!1,v.toString(z))}setLimit(_,z,A,b){return new n4({...this._def,checks:[...this._def.checks,{kind:_,value:z,inclusive:A,message:v.toString(b)}]})}_addCheck(_){return new n4({...this._def,checks:[...this._def.checks,_]})}positive(_){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:v.toString(_)})}negative(_){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:v.toString(_)})}nonpositive(_){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:v.toString(_)})}nonnegative(_){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:v.toString(_)})}multipleOf(_,z){return this._addCheck({kind:"multipleOf",value:_,message:v.toString(z)})}get minValue(){let _=null;for(let z of this._def.checks)if(z.kind==="min"){if(_===null||z.value>_)_=z.value}return _}get maxValue(){let _=null;for(let z of this._def.checks)if(z.kind==="max"){if(_===null||z.value<_)_=z.value}return _}}n4.create=(_)=>{return new n4({checks:[],typeName:p.ZodBigInt,coerce:_?.coerce??!1,...o(_)})};class a_ extends _0{_parse(_){if(this._def.coerce)_.data=Boolean(_.data);if(this._getType(_)!==k.boolean){let A=this._getOrReturnCtx(_);return T(A,{code:j.invalid_type,expected:k.boolean,received:A.parsedType}),l}return d0(_.data)}}a_.create=(_)=>{return new a_({typeName:p.ZodBoolean,coerce:_?.coerce||!1,...o(_)})};class W_ extends _0{_parse(_){if(this._def.coerce)_.data=new Date(_.data);if(this._getType(_)!==k.date){let G=this._getOrReturnCtx(_);return T(G,{code:j.invalid_type,expected:k.date,received:G.parsedType}),l}if(Number.isNaN(_.data.getTime())){let G=this._getOrReturnCtx(_);return T(G,{code:j.invalid_date}),l}let A=new g0,b=void 0;for(let G of this._def.checks)if(G.kind==="min"){if(_.data.getTime()<G.value)b=this._getOrReturnCtx(_,b),T(b,{code:j.too_small,message:G.message,inclusive:!0,exact:!1,minimum:G.value,type:"date"}),A.dirty()}else if(G.kind==="max"){if(_.data.getTime()>G.value)b=this._getOrReturnCtx(_,b),T(b,{code:j.too_big,message:G.message,inclusive:!0,exact:!1,maximum:G.value,type:"date"}),A.dirty()}else z0.assertNever(G);return{status:A.value,value:new Date(_.data.getTime())}}_addCheck(_){return new W_({...this._def,checks:[...this._def.checks,_]})}min(_,z){return this._addCheck({kind:"min",value:_.getTime(),message:v.toString(z)})}max(_,z){return this._addCheck({kind:"max",value:_.getTime(),message:v.toString(z)})}get minDate(){let _=null;for(let z of this._def.checks)if(z.kind==="min"){if(_===null||z.value>_)_=z.value}return _!=null?new Date(_):null}get maxDate(){let _=null;for(let z of this._def.checks)if(z.kind==="max"){if(_===null||z.value<_)_=z.value}return _!=null?new Date(_):null}}W_.create=(_)=>{return new W_({checks:[],coerce:_?.coerce||!1,typeName:p.ZodDate,...o(_)})};class Hz extends _0{_parse(_){if(this._getType(_)!==k.symbol){let A=this._getOrReturnCtx(_);return T(A,{code:j.invalid_type,expected:k.symbol,received:A.parsedType}),l}return d0(_.data)}}Hz.create=(_)=>{return new Hz({typeName:p.ZodSymbol,...o(_)})};class s_ extends _0{_parse(_){if(this._getType(_)!==k.undefined){let A=this._getOrReturnCtx(_);return T(A,{code:j.invalid_type,expected:k.undefined,received:A.parsedType}),l}return d0(_.data)}}s_.create=(_)=>{return new s_({typeName:p.ZodUndefined,...o(_)})};class t_ extends _0{_parse(_){if(this._getType(_)!==k.null){let A=this._getOrReturnCtx(_);return T(A,{code:j.invalid_type,expected:k.null,received:A.parsedType}),l}return d0(_.data)}}t_.create=(_)=>{return new t_({typeName:p.ZodNull,...o(_)})};class V_ extends _0{constructor(){super(...arguments);this._any=!0}_parse(_){return d0(_.data)}}V_.create=(_)=>{return new V_({typeName:p.ZodAny,...o(_)})};class d4 extends _0{constructor(){super(...arguments);this._unknown=!0}_parse(_){return d0(_.data)}}d4.create=(_)=>{return new d4({typeName:p.ZodUnknown,...o(_)})};class G4 extends _0{_parse(_){let z=this._getOrReturnCtx(_);return T(z,{code:j.invalid_type,expected:k.never,received:z.parsedType}),l}}G4.create=(_)=>{return new G4({typeName:p.ZodNever,...o(_)})};class Bz extends _0{_parse(_){if(this._getType(_)!==k.undefined){let A=this._getOrReturnCtx(_);return T(A,{code:j.invalid_type,expected:k.void,received:A.parsedType}),l}return d0(_.data)}}Bz.create=(_)=>{return new Bz({typeName:p.ZodVoid,...o(_)})};class C9 extends _0{_parse(_){let{ctx:z,status:A}=this._processInputParams(_),b=this._def;if(z.parsedType!==k.array)return T(z,{code:j.invalid_type,expected:k.array,received:z.parsedType}),l;if(b.exactLength!==null){let J=z.data.length>b.exactLength.value,Y=z.data.length<b.exactLength.value;if(J||Y)T(z,{code:J?j.too_big:j.too_small,minimum:Y?b.exactLength.value:void 0,maximum:J?b.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:b.exactLength.message}),A.dirty()}if(b.minLength!==null){if(z.data.length<b.minLength.value)T(z,{code:j.too_small,minimum:b.minLength.value,type:"array",inclusive:!0,exact:!1,message:b.minLength.message}),A.dirty()}if(b.maxLength!==null){if(z.data.length>b.maxLength.value)T(z,{code:j.too_big,maximum:b.maxLength.value,type:"array",inclusive:!0,exact:!1,message:b.maxLength.message}),A.dirty()}if(z.common.async)return Promise.all([...z.data].map((J,Y)=>{return b.type._parseAsync(new y9(z,J,z.path,Y))})).then((J)=>{return g0.mergeArray(A,J)});let G=[...z.data].map((J,Y)=>{return b.type._parseSync(new y9(z,J,z.path,Y))});return g0.mergeArray(A,G)}get element(){return this._def.type}min(_,z){return new C9({...this._def,minLength:{value:_,message:v.toString(z)}})}max(_,z){return new C9({...this._def,maxLength:{value:_,message:v.toString(z)}})}length(_,z){return new C9({...this._def,exactLength:{value:_,message:v.toString(z)}})}nonempty(_){return this.min(1,_)}}C9.create=(_,z)=>{return new C9({type:_,minLength:null,maxLength:null,exactLength:null,typeName:p.ZodArray,...o(z)})};function i_(_){if(_ instanceof S0){let z={};for(let A in _.shape){let b=_.shape[A];z[A]=v9.create(i_(b))}return new S0({..._._def,shape:()=>z})}else if(_ instanceof C9)return new C9({..._._def,type:i_(_.element)});else if(_ instanceof v9)return v9.create(i_(_.unwrap()));else if(_ instanceof w4)return w4.create(i_(_.unwrap()));else if(_ instanceof J4)return J4.create(_.items.map((z)=>i_(z)));else return _}class S0 extends _0{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let _=this._def.shape(),z=z0.objectKeys(_);return this._cached={shape:_,keys:z},this._cached}_parse(_){if(this._getType(_)!==k.object){let Q=this._getOrReturnCtx(_);return T(Q,{code:j.invalid_type,expected:k.object,received:Q.parsedType}),l}let{status:A,ctx:b}=this._processInputParams(_),{shape:G,keys:J}=this._getCached(),Y=[];if(!(this._def.catchall instanceof G4&&this._def.unknownKeys==="strip")){for(let Q in b.data)if(!J.includes(Q))Y.push(Q)}let X=[];for(let Q of J){let $=G[Q],H=b.data[Q];X.push({key:{status:"valid",value:Q},value:$._parse(new y9(b,H,b.path,Q)),alwaysSet:Q in b.data})}if(this._def.catchall instanceof G4){let Q=this._def.unknownKeys;if(Q==="passthrough")for(let $ of Y)X.push({key:{status:"valid",value:$},value:{status:"valid",value:b.data[$]}});else if(Q==="strict"){if(Y.length>0)T(b,{code:j.unrecognized_keys,keys:Y}),A.dirty()}else if(Q==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let Q=this._def.catchall;for(let $ of Y){let H=b.data[$];X.push({key:{status:"valid",value:$},value:Q._parse(new y9(b,H,b.path,$)),alwaysSet:$ in b.data})}}if(b.common.async)return Promise.resolve().then(async()=>{let Q=[];for(let $ of X){let H=await $.key,B=await $.value;Q.push({key:H,value:B,alwaysSet:$.alwaysSet})}return Q}).then((Q)=>{return g0.mergeObjectSync(A,Q)});else return g0.mergeObjectSync(A,X)}get shape(){return this._def.shape()}strict(_){return v.errToObj,new S0({...this._def,unknownKeys:"strict",..._!==void 0?{errorMap:(z,A)=>{let b=this._def.errorMap?.(z,A).message??A.defaultError;if(z.code==="unrecognized_keys")return{message:v.errToObj(_).message??b};return{message:b}}}:{}})}strip(){return new S0({...this._def,unknownKeys:"strip"})}passthrough(){return new S0({...this._def,unknownKeys:"passthrough"})}extend(_){return new S0({...this._def,shape:()=>({...this._def.shape(),..._})})}merge(_){return new S0({unknownKeys:_._def.unknownKeys,catchall:_._def.catchall,shape:()=>({...this._def.shape(),..._._def.shape()}),typeName:p.ZodObject})}setKey(_,z){return this.augment({[_]:z})}catchall(_){return new S0({...this._def,catchall:_})}pick(_){let z={};for(let A of z0.objectKeys(_))if(_[A]&&this.shape[A])z[A]=this.shape[A];return new S0({...this._def,shape:()=>z})}omit(_){let z={};for(let A of z0.objectKeys(this.shape))if(!_[A])z[A]=this.shape[A];return new S0({...this._def,shape:()=>z})}deepPartial(){return i_(this)}partial(_){let z={};for(let A of z0.objectKeys(this.shape)){let b=this.shape[A];if(_&&!_[A])z[A]=b;else z[A]=b.optional()}return new S0({...this._def,shape:()=>z})}required(_){let z={};for(let A of z0.objectKeys(this.shape))if(_&&!_[A])z[A]=this.shape[A];else{let G=this.shape[A];while(G instanceof v9)G=G._def.innerType;z[A]=G}return new S0({...this._def,shape:()=>z})}keyof(){return PY(z0.objectKeys(this.shape))}}S0.create=(_,z)=>{return new S0({shape:()=>_,unknownKeys:"strip",catchall:G4.create(),typeName:p.ZodObject,...o(z)})};S0.strictCreate=(_,z)=>{return new S0({shape:()=>_,unknownKeys:"strict",catchall:G4.create(),typeName:p.ZodObject,...o(z)})};S0.lazycreate=(_,z)=>{return new S0({shape:_,unknownKeys:"strip",catchall:G4.create(),typeName:p.ZodObject,...o(z)})};class e_ extends _0{_parse(_){let{ctx:z}=this._processInputParams(_),A=this._def.options;function b(G){for(let Y of G)if(Y.result.status==="valid")return Y.result;for(let Y of G)if(Y.result.status==="dirty")return z.common.issues.push(...Y.ctx.common.issues),Y.result;let J=G.map((Y)=>new J9(Y.ctx.common.issues));return T(z,{code:j.invalid_union,unionErrors:J}),l}if(z.common.async)return Promise.all(A.map(async(G)=>{let J={...z,common:{...z.common,issues:[]},parent:null};return{result:await G._parseAsync({data:z.data,path:z.path,parent:J}),ctx:J}})).then(b);else{let G=void 0,J=[];for(let X of A){let Q={...z,common:{...z.common,issues:[]},parent:null},$=X._parseSync({data:z.data,path:z.path,parent:Q});if($.status==="valid")return $;else if($.status==="dirty"&&!G)G={result:$,ctx:Q};if(Q.common.issues.length)J.push(Q.common.issues)}if(G)return z.common.issues.push(...G.ctx.common.issues),G.result;let Y=J.map((X)=>new J9(X));return T(z,{code:j.invalid_union,unionErrors:Y}),l}}get options(){return this._def.options}}e_.create=(_,z)=>{return new e_({options:_,typeName:p.ZodUnion,...o(z)})};var N4=(_)=>{if(_ instanceof z1)return N4(_.schema);else if(_ instanceof g9)return N4(_.innerType());else if(_ instanceof A1)return[_.value];else if(_ instanceof i4)return _.options;else if(_ instanceof b1)return z0.objectValues(_.enum);else if(_ instanceof G1)return N4(_._def.innerType);else if(_ instanceof s_)return[void 0];else if(_ instanceof t_)return[null];else if(_ instanceof v9)return[void 0,...N4(_.unwrap())];else if(_ instanceof w4)return[null,...N4(_.unwrap())];else if(_ instanceof e3)return N4(_.unwrap());else if(_ instanceof Y1)return N4(_.unwrap());else if(_ instanceof J1)return N4(_._def.innerType);else return[]};class t3 extends _0{_parse(_){let{ctx:z}=this._processInputParams(_);if(z.parsedType!==k.object)return T(z,{code:j.invalid_type,expected:k.object,received:z.parsedType}),l;let A=this.discriminator,b=z.data[A],G=this.optionsMap.get(b);if(!G)return T(z,{code:j.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[A]}),l;if(z.common.async)return G._parseAsync({data:z.data,path:z.path,parent:z});else return G._parseSync({data:z.data,path:z.path,parent:z})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(_,z,A){let b=new Map;for(let G of z){let J=N4(G.shape[_]);if(!J.length)throw Error(`A discriminator value for key \`${_}\` could not be extracted from all schema options`);for(let Y of J){if(b.has(Y))throw Error(`Discriminator property ${String(_)} has duplicate value ${String(Y)}`);b.set(Y,G)}}return new t3({typeName:p.ZodDiscriminatedUnion,discriminator:_,options:z,optionsMap:b,...o(A)})}}function H5(_,z){let A=b4(_),b=b4(z);if(_===z)return{valid:!0,data:_};else if(A===k.object&&b===k.object){let G=z0.objectKeys(z),J=z0.objectKeys(_).filter((X)=>G.indexOf(X)!==-1),Y={..._,...z};for(let X of J){let Q=H5(_[X],z[X]);if(!Q.valid)return{valid:!1};Y[X]=Q.data}return{valid:!0,data:Y}}else if(A===k.array&&b===k.array){if(_.length!==z.length)return{valid:!1};let G=[];for(let J=0;J<_.length;J++){let Y=_[J],X=z[J],Q=H5(Y,X);if(!Q.valid)return{valid:!1};G.push(Q.data)}return{valid:!0,data:G}}else if(A===k.date&&b===k.date&&+_===+z)return{valid:!0,data:_};else return{valid:!1}}class _1 extends _0{_parse(_){let{status:z,ctx:A}=this._processInputParams(_),b=(G,J)=>{if(a3(G)||a3(J))return l;let Y=H5(G.value,J.value);if(!Y.valid)return T(A,{code:j.invalid_intersection_types}),l;if(s3(G)||s3(J))z.dirty();return{status:z.value,value:Y.data}};if(A.common.async)return Promise.all([this._def.left._parseAsync({data:A.data,path:A.path,parent:A}),this._def.right._parseAsync({data:A.data,path:A.path,parent:A})]).then(([G,J])=>b(G,J));else return b(this._def.left._parseSync({data:A.data,path:A.path,parent:A}),this._def.right._parseSync({data:A.data,path:A.path,parent:A}))}}_1.create=(_,z,A)=>{return new _1({left:_,right:z,typeName:p.ZodIntersection,...o(A)})};class J4 extends _0{_parse(_){let{status:z,ctx:A}=this._processInputParams(_);if(A.parsedType!==k.array)return T(A,{code:j.invalid_type,expected:k.array,received:A.parsedType}),l;if(A.data.length<this._def.items.length)return T(A,{code:j.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),l;if(!this._def.rest&&A.data.length>this._def.items.length)T(A,{code:j.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),z.dirty();let G=[...A.data].map((J,Y)=>{let X=this._def.items[Y]||this._def.rest;if(!X)return null;return X._parse(new y9(A,J,A.path,Y))}).filter((J)=>!!J);if(A.common.async)return Promise.all(G).then((J)=>{return g0.mergeArray(z,J)});else return g0.mergeArray(z,G)}get items(){return this._def.items}rest(_){return new J4({...this._def,rest:_})}}J4.create=(_,z)=>{if(!Array.isArray(_))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new J4({items:_,typeName:p.ZodTuple,rest:null,...o(z)})};class Zz extends _0{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(_){let{status:z,ctx:A}=this._processInputParams(_);if(A.parsedType!==k.object)return T(A,{code:j.invalid_type,expected:k.object,received:A.parsedType}),l;let b=[],G=this._def.keyType,J=this._def.valueType;for(let Y in A.data)b.push({key:G._parse(new y9(A,Y,A.path,Y)),value:J._parse(new y9(A,A.data[Y],A.path,Y)),alwaysSet:Y in A.data});if(A.common.async)return g0.mergeObjectAsync(z,b);else return g0.mergeObjectSync(z,b)}get element(){return this._def.valueType}static create(_,z,A){if(z instanceof _0)return new Zz({keyType:_,valueType:z,typeName:p.ZodRecord,...o(A)});return new Zz({keyType:T9.create(),valueType:_,typeName:p.ZodRecord,...o(z)})}}class Fz extends _0{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(_){let{status:z,ctx:A}=this._processInputParams(_);if(A.parsedType!==k.map)return T(A,{code:j.invalid_type,expected:k.map,received:A.parsedType}),l;let b=this._def.keyType,G=this._def.valueType,J=[...A.data.entries()].map(([Y,X],Q)=>{return{key:b._parse(new y9(A,Y,A.path,[Q,"key"])),value:G._parse(new y9(A,X,A.path,[Q,"value"]))}});if(A.common.async){let Y=new Map;return Promise.resolve().then(async()=>{for(let X of J){let Q=await X.key,$=await X.value;if(Q.status==="aborted"||$.status==="aborted")return l;if(Q.status==="dirty"||$.status==="dirty")z.dirty();Y.set(Q.value,$.value)}return{status:z.value,value:Y}})}else{let Y=new Map;for(let X of J){let{key:Q,value:$}=X;if(Q.status==="aborted"||$.status==="aborted")return l;if(Q.status==="dirty"||$.status==="dirty")z.dirty();Y.set(Q.value,$.value)}return{status:z.value,value:Y}}}}Fz.create=(_,z,A)=>{return new Fz({valueType:z,keyType:_,typeName:p.ZodMap,...o(A)})};class U_ extends _0{_parse(_){let{status:z,ctx:A}=this._processInputParams(_);if(A.parsedType!==k.set)return T(A,{code:j.invalid_type,expected:k.set,received:A.parsedType}),l;let b=this._def;if(b.minSize!==null){if(A.data.size<b.minSize.value)T(A,{code:j.too_small,minimum:b.minSize.value,type:"set",inclusive:!0,exact:!1,message:b.minSize.message}),z.dirty()}if(b.maxSize!==null){if(A.data.size>b.maxSize.value)T(A,{code:j.too_big,maximum:b.maxSize.value,type:"set",inclusive:!0,exact:!1,message:b.maxSize.message}),z.dirty()}let G=this._def.valueType;function J(X){let Q=new Set;for(let $ of X){if($.status==="aborted")return l;if($.status==="dirty")z.dirty();Q.add($.value)}return{status:z.value,value:Q}}let Y=[...A.data.values()].map((X,Q)=>G._parse(new y9(A,X,A.path,Q)));if(A.common.async)return Promise.all(Y).then((X)=>J(X));else return J(Y)}min(_,z){return new U_({...this._def,minSize:{value:_,message:v.toString(z)}})}max(_,z){return new U_({...this._def,maxSize:{value:_,message:v.toString(z)}})}size(_,z){return this.min(_,z).max(_,z)}nonempty(_){return this.min(1,_)}}U_.create=(_,z)=>{return new U_({valueType:_,minSize:null,maxSize:null,typeName:p.ZodSet,...o(z)})};class o_ extends _0{constructor(){super(...arguments);this.validate=this.implement}_parse(_){let{ctx:z}=this._processInputParams(_);if(z.parsedType!==k.function)return T(z,{code:j.invalid_type,expected:k.function,received:z.parsedType}),l;function A(Y,X){return $z({data:Y,path:z.path,errorMaps:[z.common.contextualErrorMap,z.schemaErrorMap,r_(),M4].filter((Q)=>!!Q),issueData:{code:j.invalid_arguments,argumentsError:X}})}function b(Y,X){return $z({data:Y,path:z.path,errorMaps:[z.common.contextualErrorMap,z.schemaErrorMap,r_(),M4].filter((Q)=>!!Q),issueData:{code:j.invalid_return_type,returnTypeError:X}})}let G={errorMap:z.common.contextualErrorMap},J=z.data;if(this._def.returns instanceof D_){let Y=this;return d0(async function(...X){let Q=new J9([]),$=await Y._def.args.parseAsync(X,G).catch((Z)=>{throw Q.addIssue(A(X,Z)),Q}),H=await Reflect.apply(J,this,$);return await Y._def.returns._def.type.parseAsync(H,G).catch((Z)=>{throw Q.addIssue(b(H,Z)),Q})})}else{let Y=this;return d0(function(...X){let Q=Y._def.args.safeParse(X,G);if(!Q.success)throw new J9([A(X,Q.error)]);let $=Reflect.apply(J,this,Q.data),H=Y._def.returns.safeParse($,G);if(!H.success)throw new J9([b($,H.error)]);return H.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(..._){return new o_({...this._def,args:J4.create(_).rest(d4.create())})}returns(_){return new o_({...this._def,returns:_})}implement(_){return this.parse(_)}strictImplement(_){return this.parse(_)}static create(_,z,A){return new o_({args:_?_:J4.create([]).rest(d4.create()),returns:z||d4.create(),typeName:p.ZodFunction,...o(A)})}}class z1 extends _0{get schema(){return this._def.getter()}_parse(_){let{ctx:z}=this._processInputParams(_);return this._def.getter()._parse({data:z.data,path:z.path,parent:z})}}z1.create=(_,z)=>{return new z1({getter:_,typeName:p.ZodLazy,...o(z)})};class A1 extends _0{_parse(_){if(_.data!==this._def.value){let z=this._getOrReturnCtx(_);return T(z,{received:z.data,code:j.invalid_literal,expected:this._def.value}),l}return{status:"valid",value:_.data}}get value(){return this._def.value}}A1.create=(_,z)=>{return new A1({value:_,typeName:p.ZodLiteral,...o(z)})};function PY(_,z){return new i4({values:_,typeName:p.ZodEnum,...o(z)})}class i4 extends _0{_parse(_){if(typeof _.data!=="string"){let z=this._getOrReturnCtx(_),A=this._def.values;return T(z,{expected:z0.joinValues(A),received:z.parsedType,code:j.invalid_type}),l}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(_.data)){let z=this._getOrReturnCtx(_),A=this._def.values;return T(z,{received:z.data,code:j.invalid_enum_value,options:A}),l}return d0(_.data)}get options(){return this._def.values}get enum(){let _={};for(let z of this._def.values)_[z]=z;return _}get Values(){let _={};for(let z of this._def.values)_[z]=z;return _}get Enum(){let _={};for(let z of this._def.values)_[z]=z;return _}extract(_,z=this._def){return i4.create(_,{...this._def,...z})}exclude(_,z=this._def){return i4.create(this.options.filter((A)=>!_.includes(A)),{...this._def,...z})}}i4.create=PY;class b1 extends _0{_parse(_){let z=z0.getValidEnumValues(this._def.values),A=this._getOrReturnCtx(_);if(A.parsedType!==k.string&&A.parsedType!==k.number){let b=z0.objectValues(z);return T(A,{expected:z0.joinValues(b),received:A.parsedType,code:j.invalid_type}),l}if(!this._cache)this._cache=new Set(z0.getValidEnumValues(this._def.values));if(!this._cache.has(_.data)){let b=z0.objectValues(z);return T(A,{received:A.data,code:j.invalid_enum_value,options:b}),l}return d0(_.data)}get enum(){return this._def.values}}b1.create=(_,z)=>{return new b1({values:_,typeName:p.ZodNativeEnum,...o(z)})};class D_ extends _0{unwrap(){return this._def.type}_parse(_){let{ctx:z}=this._processInputParams(_);if(z.parsedType!==k.promise&&z.common.async===!1)return T(z,{code:j.invalid_type,expected:k.promise,received:z.parsedType}),l;let A=z.parsedType===k.promise?z.data:Promise.resolve(z.data);return d0(A.then((b)=>{return this._def.type.parseAsync(b,{path:z.path,errorMap:z.common.contextualErrorMap})}))}}D_.create=(_,z)=>{return new D_({type:_,typeName:p.ZodPromise,...o(z)})};class g9 extends _0{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===p.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(_){let{status:z,ctx:A}=this._processInputParams(_),b=this._def.effect||null,G={addIssue:(J)=>{if(T(A,J),J.fatal)z.abort();else z.dirty()},get path(){return A.path}};if(G.addIssue=G.addIssue.bind(G),b.type==="preprocess"){let J=b.transform(A.data,G);if(A.common.async)return Promise.resolve(J).then(async(Y)=>{if(z.value==="aborted")return l;let X=await this._def.schema._parseAsync({data:Y,path:A.path,parent:A});if(X.status==="aborted")return l;if(X.status==="dirty")return q_(X.value);if(z.value==="dirty")return q_(X.value);return X});else{if(z.value==="aborted")return l;let Y=this._def.schema._parseSync({data:J,path:A.path,parent:A});if(Y.status==="aborted")return l;if(Y.status==="dirty")return q_(Y.value);if(z.value==="dirty")return q_(Y.value);return Y}}if(b.type==="refinement"){let J=(Y)=>{let X=b.refinement(Y,G);if(A.common.async)return Promise.resolve(X);if(X instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return Y};if(A.common.async===!1){let Y=this._def.schema._parseSync({data:A.data,path:A.path,parent:A});if(Y.status==="aborted")return l;if(Y.status==="dirty")z.dirty();return J(Y.value),{status:z.value,value:Y.value}}else return this._def.schema._parseAsync({data:A.data,path:A.path,parent:A}).then((Y)=>{if(Y.status==="aborted")return l;if(Y.status==="dirty")z.dirty();return J(Y.value).then(()=>{return{status:z.value,value:Y.value}})})}if(b.type==="transform")if(A.common.async===!1){let J=this._def.schema._parseSync({data:A.data,path:A.path,parent:A});if(!p4(J))return l;let Y=b.transform(J.value,G);if(Y instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:z.value,value:Y}}else return this._def.schema._parseAsync({data:A.data,path:A.path,parent:A}).then((J)=>{if(!p4(J))return l;return Promise.resolve(b.transform(J.value,G)).then((Y)=>({status:z.value,value:Y}))});z0.assertNever(b)}}g9.create=(_,z,A)=>{return new g9({schema:_,typeName:p.ZodEffects,effect:z,...o(A)})};g9.createWithPreprocess=(_,z,A)=>{return new g9({schema:z,effect:{type:"preprocess",transform:_},typeName:p.ZodEffects,...o(A)})};class v9 extends _0{_parse(_){if(this._getType(_)===k.undefined)return d0(void 0);return this._def.innerType._parse(_)}unwrap(){return this._def.innerType}}v9.create=(_,z)=>{return new v9({innerType:_,typeName:p.ZodOptional,...o(z)})};class w4 extends _0{_parse(_){if(this._getType(_)===k.null)return d0(null);return this._def.innerType._parse(_)}unwrap(){return this._def.innerType}}w4.create=(_,z)=>{return new w4({innerType:_,typeName:p.ZodNullable,...o(z)})};class G1 extends _0{_parse(_){let{ctx:z}=this._processInputParams(_),A=z.data;if(z.parsedType===k.undefined)A=this._def.defaultValue();return this._def.innerType._parse({data:A,path:z.path,parent:z})}removeDefault(){return this._def.innerType}}G1.create=(_,z)=>{return new G1({innerType:_,typeName:p.ZodDefault,defaultValue:typeof z.default==="function"?z.default:()=>z.default,...o(z)})};class J1 extends _0{_parse(_){let{ctx:z}=this._processInputParams(_),A={...z,common:{...z.common,issues:[]}},b=this._def.innerType._parse({data:A.data,path:A.path,parent:{...A}});if(n_(b))return b.then((G)=>{return{status:"valid",value:G.status==="valid"?G.value:this._def.catchValue({get error(){return new J9(A.common.issues)},input:A.data})}});else return{status:"valid",value:b.status==="valid"?b.value:this._def.catchValue({get error(){return new J9(A.common.issues)},input:A.data})}}removeCatch(){return this._def.innerType}}J1.create=(_,z)=>{return new J1({innerType:_,typeName:p.ZodCatch,catchValue:typeof z.catch==="function"?z.catch:()=>z.catch,...o(z)})};class Kz extends _0{_parse(_){if(this._getType(_)!==k.nan){let A=this._getOrReturnCtx(_);return T(A,{code:j.invalid_type,expected:k.nan,received:A.parsedType}),l}return{status:"valid",value:_.data}}}Kz.create=(_)=>{return new Kz({typeName:p.ZodNaN,...o(_)})};var XE=Symbol("zod_brand");class e3 extends _0{_parse(_){let{ctx:z}=this._processInputParams(_),A=z.data;return this._def.type._parse({data:A,path:z.path,parent:z})}unwrap(){return this._def.type}}class qz extends _0{_parse(_){let{status:z,ctx:A}=this._processInputParams(_);if(A.common.async)return(async()=>{let G=await this._def.in._parseAsync({data:A.data,path:A.path,parent:A});if(G.status==="aborted")return l;if(G.status==="dirty")return z.dirty(),q_(G.value);else return this._def.out._parseAsync({data:G.value,path:A.path,parent:A})})();else{let b=this._def.in._parseSync({data:A.data,path:A.path,parent:A});if(b.status==="aborted")return l;if(b.status==="dirty")return z.dirty(),{status:"dirty",value:b.value};else return this._def.out._parseSync({data:b.value,path:A.path,parent:A})}}static create(_,z){return new qz({in:_,out:z,typeName:p.ZodPipeline})}}class Y1 extends _0{_parse(_){let z=this._def.innerType._parse(_),A=(b)=>{if(p4(b))b.value=Object.freeze(b.value);return b};return n_(z)?z.then((b)=>A(b)):A(z)}unwrap(){return this._def.innerType}}Y1.create=(_,z)=>{return new Y1({innerType:_,typeName:p.ZodReadonly,...o(z)})};function OY(_,z){let A=typeof _==="function"?_(z):typeof _==="string"?{message:_}:_;return typeof A==="string"?{message:A}:A}function SY(_,z={},A){if(_)return V_.create().superRefine((b,G)=>{let J=_(b);if(J instanceof Promise)return J.then((Y)=>{if(!Y){let X=OY(z,b),Q=X.fatal??A??!0;G.addIssue({code:"custom",...X,fatal:Q})}});if(!J){let Y=OY(z,b),X=Y.fatal??A??!0;G.addIssue({code:"custom",...Y,fatal:X})}return});return V_.create()}var QE={object:S0.lazycreate},p;(function(_){_.ZodString="ZodString",_.ZodNumber="ZodNumber",_.ZodNaN="ZodNaN",_.ZodBigInt="ZodBigInt",_.ZodBoolean="ZodBoolean",_.ZodDate="ZodDate",_.ZodSymbol="ZodSymbol",_.ZodUndefined="ZodUndefined",_.ZodNull="ZodNull",_.ZodAny="ZodAny",_.ZodUnknown="ZodUnknown",_.ZodNever="ZodNever",_.ZodVoid="ZodVoid",_.ZodArray="ZodArray",_.ZodObject="ZodObject",_.ZodUnion="ZodUnion",_.ZodDiscriminatedUnion="ZodDiscriminatedUnion",_.ZodIntersection="ZodIntersection",_.ZodTuple="ZodTuple",_.ZodRecord="ZodRecord",_.ZodMap="ZodMap",_.ZodSet="ZodSet",_.ZodFunction="ZodFunction",_.ZodLazy="ZodLazy",_.ZodLiteral="ZodLiteral",_.ZodEnum="ZodEnum",_.ZodEffects="ZodEffects",_.ZodNativeEnum="ZodNativeEnum",_.ZodOptional="ZodOptional",_.ZodNullable="ZodNullable",_.ZodDefault="ZodDefault",_.ZodCatch="ZodCatch",_.ZodPromise="ZodPromise",_.ZodBranded="ZodBranded",_.ZodPipeline="ZodPipeline",_.ZodReadonly="ZodReadonly"})(p||(p={}));var $E=(_,z={message:`Input not instance of ${_.name}`})=>SY((A)=>A instanceof _,z),kY=T9.create,IY=r4.create,HE=Kz.create,BE=n4.create,xY=a_.create,ZE=W_.create,FE=Hz.create,KE=s_.create,qE=t_.create,WE=V_.create,VE=d4.create,UE=G4.create,DE=Bz.create,ME=C9.create,NE=S0.create,wE=S0.strictCreate,EE=e_.create,OE=t3.create,LE=_1.create,jE=J4.create,RE=Zz.create,PE=Fz.create,SE=U_.create,kE=o_.create,IE=z1.create,xE=A1.create,TE=i4.create,CE=b1.create,vE=D_.create,yE=g9.create,gE=v9.create,fE=w4.create,hE=g9.createWithPreprocess,mE=qz.create,uE=()=>kY().optional(),cE=()=>IY().optional(),lE=()=>xY().optional(),pE={string:(_)=>T9.create({..._,coerce:!0}),number:(_)=>r4.create({..._,coerce:!0}),boolean:(_)=>a_.create({..._,coerce:!0}),bigint:(_)=>n4.create({..._,coerce:!0}),date:(_)=>W_.create({..._,coerce:!0})};var dE=l;var TY=U.object({sha256:U.string(),mediaType:U.string()}),rE=U.object({type:U.literal("user"),text:U.string(),images:U.array(TY).optional(),id:U.string().optional(),timestamp:U.string().optional()}),nE=U.object({type:U.literal("compaction-summary"),text:U.string(),id:U.string().optional(),timestamp:U.string().optional()}),iE=U.object({type:U.literal("command"),name:U.string(),args:U.string().optional(),output:U.string().optional(),id:U.string().optional(),timestamp:U.string().optional()}),oE=U.object({type:U.literal("agent"),text:U.string(),id:U.string().optional(),timestamp:U.string().optional(),model:U.string().optional()}),aE=U.object({type:U.literal("thinking"),text:U.string(),id:U.string().optional(),timestamp:U.string().optional(),model:U.string().optional()}),CY=U.object({type:U.literal("tool-call"),toolName:U.string().nullable(),input:U.unknown().optional(),output:U.unknown().optional(),images:U.array(TY).optional(),error:U.string().optional(),isError:U.union([U.boolean(),U.string()]).optional(),id:U.string().optional(),timestamp:U.string().optional(),model:U.string().optional()}),Y0=U.discriminatedUnion("type",[rE,nE,iE,oE,aE,CY]),Z5=U.object({inputTokens:U.number(),cachedInputTokens:U.number(),outputTokens:U.number(),reasoningOutputTokens:U.number(),totalTokens:U.number()}),Y4=CY,sE=Y4.extend({toolName:U.literal("Write"),input:U.object({file_path:U.string(),content:U.string().optional()}).passthrough().optional(),output:U.object({type:U.string().optional()}).passthrough().optional()}),tE=Y4.extend({toolName:U.literal("Read"),input:U.object({file_path:U.string()}).passthrough().optional(),output:U.union([U.string(),U.object({type:U.string().optional(),file:U.object({content:U.string().optional(),numLines:U.number().optional(),startLine:U.number().optional(),totalLines:U.number().optional()}).passthrough().optional()}).passthrough()]).optional()}),eE=Y4.extend({toolName:U.literal("Edit"),input:U.object({file_path:U.string(),diff:U.string().optional()}).passthrough().optional(),output:U.union([U.string(),U.object({userModified:U.boolean().optional()}).passthrough()]).optional()}),vY=U.object({filenames:U.array(U.string()),durationMs:U.number().optional(),truncated:U.boolean().optional()}).passthrough(),_O=Y4.extend({toolName:U.literal("Glob"),input:U.object({pattern:U.string().optional()}).passthrough().optional(),output:vY.optional()}),zO=Y4.extend({toolName:U.literal("Grep"),input:U.unknown().optional(),output:vY.extend({mode:U.string().optional(),numMatches:U.number().optional()}).passthrough().optional()}),AO=Y4.extend({toolName:U.literal("Bash"),input:U.object({command:U.string(),description:U.string().optional()}).passthrough().optional(),output:U.union([U.string(),U.object({stdout:U.string().optional(),stderr:U.string().optional(),interrupted:U.boolean().optional(),isImage:U.boolean().optional()}).passthrough()]).optional()}),bO=Y4.extend({toolName:U.literal("BashOutput"),input:U.object({bash_id:U.string().optional()}).passthrough().optional(),output:U.object({command:U.string().optional(),exitCode:U.number().optional(),shellId:U.string().optional(),status:U.string().optional(),stderr:U.string().optional(),stdout:U.string().optional(),timestamp:U.string().optional()}).passthrough().optional()}),GO=Y4.extend({toolName:U.literal("Task"),input:U.unknown().optional(),output:U.object({status:U.string().optional(),totalDurationMs:U.number().optional(),totalToolUseCount:U.number().optional(),content:U.array(U.object({type:U.string().optional(),text:U.string().optional()}).passthrough()).optional(),usage:Z5.optional()}).passthrough().optional()}),B5=U.object({content:U.string(),status:U.string().optional()}).passthrough(),JO=Y4.extend({toolName:U.literal("TodoWrite"),input:U.object({todos:U.array(B5).optional()}).passthrough().optional(),output:U.object({oldTodos:U.array(B5).optional(),newTodos:U.array(B5).optional()}).passthrough().optional()}),YO=[sE,tE,eE,_O,zO,AO,bO,GO,JO],XO=Y4,yY=U.union([...YO,XO]),M_=U.object({model:U.string(),usage:Z5}),t0=U.object({relativeCwd:U.string().nullable(),branch:U.string().nullable(),repo:U.string().nullable()}).strict().nullable(),o4=U.object({v:U.literal(1),id:U.string(),source:U.enum(["claude-code","codex","opencode","pi","unknown"]),timestamp:U.coerce.date(),preview:U.string().nullable(),summary:U.string().nullable().default(null),model:U.string().nullable(),clientVersion:U.string().nullable(),blendedTokens:U.number(),costUsd:U.number(),messageCount:U.number(),toolCount:U.number(),userMessageCount:U.number(),filesChanged:U.number(),linesAdded:U.number().default(0),linesRemoved:U.number().default(0),linesModified:U.number().default(0),tokenUsage:Z5,modelUsage:U.array(M_),git:t0,cwd:U.string().nullable(),messages:U.array(Y0)});import{appendFileSync as FO,mkdirSync as KO}from"fs";import{dirname as qO}from"path";import{existsSync as QO,readFileSync as $O}from"fs";import{homedir as HO}from"os";import{dirname as gY,resolve as F5}from"path";function BO(){let z=process.env.VI_CLI_PATH;if(z?.startsWith("bun "))z=z.slice(4);let A=z?gY(z):process.cwd(),b=10,G=0;while(G<b){let J=F5(A,"package.json");if(QO(J))try{if(JSON.parse($O(J,"utf-8")).workspaces)return A}catch{}let Y=gY(A);if(Y===A)break;A=Y,G++}return null}function ZO(){let _=BO();return _?F5(_,"logs"):null}function _6(){let _=ZO();return _?F5(_,"dev.log"):null}function f9(_){let z=HO();if(_.startsWith(z))return _.replace(z,"~");let A=/^(\/Users\/[^/]+|\/home\/[^/]+)/;return _.replace(A,"~")}function Wz(_){if(_==="."||_===null)return"";return _}function M9(_,z){if(!z)return _;let A=z.endsWith("/")?z:`${z}/`,b=A.slice(0,-1),G=(Y)=>typeof Y==="object"&&Y!==null&&!Array.isArray(Y),J=(Y)=>{if(typeof Y==="string"){if(Y.includes(A))return Y.replaceAll(A,"./");if(Y.includes(b))return Y.replaceAll(b,".");return Y}if(Array.isArray(Y))return Y.map(J);if(G(Y)){let X={};for(let[Q,$]of Object.entries(Y))X[Q]=J($);return X}return Y};return J(_)}var fY=!1;function WO(_){if(_===void 0||_===null)return _;if(process.env.DEBUG_PAYLOADS!=="true"){if(!fY)return fY=!0,"[payload logging disabled - set DEBUG_PAYLOADS=true to enable]";return}if(typeof _==="object"){let A=JSON.stringify(_),b=Math.round(A.length/1024),G=A.includes('"isImage":true')||A.includes('"isImage": true')||A.length>1e4&&/[A-Za-z0-9+/]{100,}/.test(A);if(G||A.length>1e4)return`[payload: ${b}KB${G?", contains binary data":""}]`}return _}class hY{component;logToFile;logFilePath;disableConsole;constructor(_){this.component=_.component,this.disableConsole=_.disableConsole??!1;let z=typeof process<"u"&&!!process.versions?.node;if(this.logToFile=_.logToFile??(z&&!1),z&&this.logToFile){let A=_6(),b=_.logFilePath??A;if(b)this.logFilePath=b;else this.logToFile=!1,this.logFilePath=""}else this.logFilePath="",this.logToFile=!1;if(process.env.DEBUG)console.log(`[${this.component}] Logger config:`,{logToFile:this.logToFile,logFilePath:this.logFilePath,cwd:process.cwd(),NODE_ENV:"production"});if(this.logToFile)try{let A=qO(this.logFilePath);KO(A,{recursive:!0})}catch(A){if(process.env.DEBUG)console.error(`[${this.component}] Failed to create logs directory:`,A)}}log(_,z,A){let b=new Date,J=`[${`${String(b.getMonth()+1).padStart(2,"0")}-${String(b.getDate()).padStart(2,"0")} ${String(b.getHours()).padStart(2,"0")}:${String(b.getMinutes()).padStart(2,"0")}:${String(b.getSeconds()).padStart(2,"0")}`}] [${this.component}] [${_}] ${z}`,Y=_==="ERROR"?console.error:_==="WARN"?console.warn:console.log,X=WO(A);if(!this.disableConsole){if(Y(J),X!==void 0){let Q=typeof X==="object"?JSON.stringify(X,null,2):String(X);Y(` ${Q}`)}}if(this.logToFile)try{let Q=J+`
47
+ `),r_}function D4(){return{async get(_,z){let b=(await s3()).get("SELECT value FROM kv WHERE key = ?",_);if(!b)return z;try{return JSON.parse(b.value)}catch{return z}},async set(_,z){let A=await s3(),b=JSON.stringify(z);A.run("INSERT OR REPLACE INTO kv (key, value) VALUES (?, ?)",_,b)},async delete(_){(await s3()).run("DELETE FROM kv WHERE key = ?",_)},async keys(_){let z=await s3();if(_)return z.all("SELECT key FROM kv WHERE key LIKE ?",`${_}%`).map((G)=>G.key);return z.all("SELECT key FROM kv").map((b)=>b.key)}}}async function A4(_){let z=D4(),A=`transcript.${_}.id`,b=await z.get(A);if(b)return b;let G=xw()();return await z.set(A,G),G}async function G5(_,z){let A=D4(),b=`transcript.${_}.id`;await A.set(b,z)}async function Qz(_,z){let A=D4(),b=`call.${_}.transcriptId`;await A.set(b,z)}async function $z(_){let z=D4(),A=`call.${_}.transcriptId`;return z.get(A)}async function Hz(_){let z=D4(),A=`call.${_}.transcriptId`;await z.delete(A)}var J5=BY(gw(),".config","agentlogs"),Y5=BY(J5,"config.json");function ZY(){if(!HY(J5))Cw(J5,{recursive:!0})}function X5(){if(ZY(),!HY(Y5))return{environments:[]};try{let _=vw(Y5,"utf-8"),z=JSON.parse(_);return{environments:Array.isArray(z.environments)?z.environments:[]}}catch{return{environments:[]}}}function FY(_){ZY();try{yw(Y5,JSON.stringify(_,null,2),"utf-8")}catch(z){throw console.error("Failed to write config file:",z),z}}function n_(){return X5().environments}function t3(_){return n_().find((z)=>z.name===_)}function Q5(_){return`auth.token.${_}`}async function $5(_){let z=process.env.AGENTLOGS_AUTH_TOKEN?.trim();if(z)return z;try{if(!t3(_)?.user?.email)return null;return await D4().get(Q5(_))??null}catch{return null}}async function KY(_,z,A){try{await D4().set(Q5(_),A)}catch(b){throw console.error("Failed to store token:",b),b}}async function qY(_){try{await D4().delete(Q5(_))}catch{}}function WY(_){let z=X5(),A=z.environments.findIndex((b)=>b.name===_.name);if(A>=0)z.environments[A]=_;else z.environments.push(_);FY(z)}function VY(_){let z=X5();z.environments=z.environments.filter((A)=>A.name!==_),FY(z)}function fw(_){try{return new URL(_).host.toLowerCase()}catch{return"custom"}}async function T9(){let _=n_(),z=[];for(let A of _){let b=await $5(A.name);if(b)z.push({...A,token:b})}if(z.length===0){let A=process.env.AGENTLOGS_AUTH_TOKEN?.trim();if(A){let b=process.env.AGENTLOGS_SERVER_URL?.trim()||"https://agentlogs.ai"?.trim()||"https://agentlogs.ai";z.push({name:fw(b),baseURL:b,user:{id:"ci",email:"ci@agentlogs.ai",name:"CI"},lastLoginTime:new Date().toISOString(),token:A})}}return z}async function UY(_){try{let{host:z,baseURL:A}=n3(_.hostname);console.log("\uD83D\uDD10 AgentLogs Device Authorization"),console.log(`\uD83C\uDF10 Server: ${A}`),console.log("⏳ Requesting device authorization...");let b=i3(A),{data:G,error:J}=await b.device.code({client_id:"agentlogs-cli",scope:"openid profile email"});if(J||!G)console.error("❌ Error:",J?.error_description||"Failed to request device code"),process.exit(1);let{device_code:Y,user_code:X,verification_uri:Q,verification_uri_complete:$,interval:H=5}=G;console.log(`
48
+ \uD83D\uDCF1 Device Authorization in Progress`),console.log(`Please visit: ${Q}`),console.log(`Enter code: ${X}
49
+ `);let B=$||Q;if(B)console.log("\uD83C\uDF10 Opening browser..."),await RG(B);console.log(`⏳ Waiting for authorization... (polling every ${H}s)`),await hw(b,Y,H,z,A)}catch(z){console.error("❌ Error:",z instanceof Error?z.message:"Unknown error"),process.exit(1)}}async function hw(_,z,A,b,G){let J=A;return new Promise((Y)=>{let X=async()=>{try{let{data:Q,error:$}=await _.device.token({grant_type:"urn:ietf:params:oauth:grant-type:device_code",device_code:z,client_id:"agentlogs-cli"});if(Q?.access_token){console.log(`
50
+ ✅ Authorization Successful!`),console.log("\uD83D\uDD11 Access token received!");let{data:H}=await _.getSession({fetchOptions:{headers:{Authorization:`Bearer ${Q.access_token}`}}});if(H?.user)await KY(b,H.user.email,Q.access_token),WY({name:b,baseURL:G,user:{id:H.user.id,email:H.user.email,name:H.user.name},lastLoginTime:new Date().toISOString()}),console.log(`\uD83D\uDC4B Hello, ${H.user.name}!`),console.log(`\uD83D\uDCE7 Logged in as: ${H.user.email}`),console.log(`\uD83C\uDF10 Environment: ${b}`);else console.log("⚠️ Warning: Could not retrieve user session");Y(),process.exit(0)}else if($)switch($.error){case"authorization_pending":break;case"slow_down":J+=5,console.log(`⚠️ Slowing down polling to ${J}s`);break;case"access_denied":console.error("❌ Access was denied by the user"),process.exit(1);break;case"expired_token":console.error("❌ The device code has expired. Please try again."),process.exit(1);break;default:console.error("❌ Error:",$.error_description||$.error),process.exit(1)}}catch(Q){console.error("❌ Error:",Q instanceof Error?Q.message:"Unknown error"),process.exit(1)}setTimeout(X,J*1000)};setTimeout(X,J*1000)})}async function DY(_={}){let z;try{z=mw(_.hostname)}catch(b){console.error("❌ Error:",b instanceof Error?b.message:"Invalid hostname"),process.exit(1)}if(z.length===0){if(_.hostname)console.log(`ℹ️ Not currently logged in to ${_.hostname}`);else console.log("ℹ️ Not currently logged in to any environment");return}let A=[];for(let b of z){let G=t3(b);if(!G)continue;try{await qY(b),VY(b),A.push(G)}catch(J){console.error(`⚠️ Warning: Could not completely clear credentials for ${b}:`,J instanceof Error?J.message:"Unknown error")}}if(A.length===0){console.log("ℹ️ No environments were logged out");return}if(A.length===1){console.log(`✅ Logged out from ${A[0].name} successfully`),console.log(`\uD83D\uDCE7 Was logged in as: ${A[0].user.email}`);return}console.log(`✅ Logged out from ${A.length} environments:`);for(let b of A)console.log(`- ${b.name} (${b.user.email})`)}function mw(_){if(_){let{host:z}=n3(_);return t3(z)?[z]:[]}return n_().map((z)=>z.name)}async function MY(_={}){if(_.allowMode){let b=_.allowMode.toLowerCase();if(b!=="allowlist"&&b!=="denylist")console.error("Invalid allowMode. Use 'allowlist' or 'denylist'."),process.exit(1);JG(b),console.log(`Allow mode set to: ${b}`),console.log()}let z=t9();console.log("AgentLogs Settings"),console.log("──────────────────"),console.log(`Mode: ${z.allowMode}`),console.log(`Config: ${YG()}`),console.log();let A=Object.keys(z.repos);if(A.length===0)console.log("Repos: (none configured)");else{console.log("Repos:");for(let b of A){let G=z.repos[b];if(G.allow){let J=G.visibility??"(server default)";console.log(` ✓ ${b} ${J}`)}else console.log(` ✗ ${b} (denied)`)}}process.exit(0)}async function NY(){let _=n_();if(_.length===0)console.log("❌ Not logged in"),console.log("Run `agentlogs login agentlogs.ai` to authenticate"),process.exit(1);console.log(`\uD83D\uDD10 AgentLogs Authentication Status
51
+ `);let z=!1;for(let A of _){let b=await $5(A.name);if(!b){console.log(`${A.name} (${A.baseURL})`),console.log(" ❌ Token not found"),console.log(` \uD83D\uDCE7 Was: ${A.user.email}`),console.log("");continue}try{let G=i3(A.baseURL),{data:J,error:Y}=await G.getSession({fetchOptions:{headers:{Authorization:`Bearer ${b}`}}});if(Y||!J?.user){console.log(`${A.name} (${A.baseURL})`),console.log(" ⚠️ Token invalid or expired"),console.log(` \uD83D\uDCE7 Was: ${A.user.email}`),console.log(` Run \`agentlogs login ${A.name}\` to re-authenticate`),console.log("");continue}if(z=!0,console.log(`${A.name} (${A.baseURL})`),console.log(" ✅ Logged in"),console.log(` \uD83D\uDC64 ${J.user.name}`),console.log(` \uD83D\uDCE7 ${J.user.email}`),A.lastLoginTime){let X=new Date(A.lastLoginTime);console.log(` \uD83D\uDD50 Last login: ${X.toLocaleString()}`)}console.log("")}catch(G){console.log(`${A.name} (${A.baseURL})`),console.log(` ❌ Error verifying session: ${G instanceof Error?G.message:"Unknown error"}`),console.log("")}}if(!z)process.exit(1)}import{resolve as sP}from"path";import{spawnSync as tP}from"child_process";import{existsSync as eP,readFileSync as _S}from"fs";var U={};J8(U,{void:()=>OE,util:()=>z0,unknown:()=>wE,union:()=>PE,undefined:()=>DE,tuple:()=>IE,transformer:()=>uE,symbol:()=>UE,string:()=>kY,strictObject:()=>RE,setErrorMap:()=>lw,set:()=>CE,record:()=>xE,quotelessJson:()=>uw,promise:()=>mE,preprocess:()=>pE,pipeline:()=>dE,ostring:()=>rE,optional:()=>cE,onumber:()=>nE,oboolean:()=>iE,objectUtil:()=>H5,object:()=>jE,number:()=>IY,nullable:()=>lE,null:()=>ME,never:()=>EE,nativeEnum:()=>hE,nan:()=>qE,map:()=>TE,makeIssue:()=>Bz,literal:()=>gE,lazy:()=>yE,late:()=>FE,isValid:()=>p4,isDirty:()=>_6,isAsync:()=>o_,isAborted:()=>e3,intersection:()=>kE,instanceof:()=>KE,getParsedType:()=>b4,getErrorMap:()=>i_,function:()=>vE,enum:()=>fE,effect:()=>uE,discriminatedUnion:()=>SE,defaultErrorMap:()=>M4,datetimeRegex:()=>RY,date:()=>VE,custom:()=>SY,coerce:()=>oE,boolean:()=>xY,bigint:()=>WE,array:()=>LE,any:()=>NE,addIssueToContext:()=>T,ZodVoid:()=>Fz,ZodUnknown:()=>d4,ZodUnion:()=>z1,ZodUndefined:()=>e_,ZodType:()=>_0,ZodTuple:()=>J4,ZodTransformer:()=>f9,ZodSymbol:()=>Zz,ZodString:()=>C9,ZodSet:()=>U_,ZodSchema:()=>_0,ZodRecord:()=>Kz,ZodReadonly:()=>Q1,ZodPromise:()=>D_,ZodPipeline:()=>Vz,ZodParsedType:()=>k,ZodOptional:()=>y9,ZodObject:()=>S0,ZodNumber:()=>r4,ZodNullable:()=>w4,ZodNull:()=>_1,ZodNever:()=>G4,ZodNativeEnum:()=>J1,ZodNaN:()=>Wz,ZodMap:()=>qz,ZodLiteral:()=>G1,ZodLazy:()=>b1,ZodIssueCode:()=>j,ZodIntersection:()=>A1,ZodFunction:()=>s_,ZodFirstPartyTypeKind:()=>p,ZodError:()=>J9,ZodEnum:()=>i4,ZodEffects:()=>f9,ZodDiscriminatedUnion:()=>z6,ZodDefault:()=>Y1,ZodDate:()=>W_,ZodCatch:()=>X1,ZodBranded:()=>A6,ZodBoolean:()=>t_,ZodBigInt:()=>n4,ZodArray:()=>v9,ZodAny:()=>V_,Schema:()=>_0,ParseStatus:()=>g0,OK:()=>d0,NEVER:()=>aE,INVALID:()=>l,EMPTY_PATH:()=>pw,DIRTY:()=>q_,BRAND:()=>ZE});var z0;(function(_){_.assertEqual=(G)=>{};function z(G){}_.assertIs=z;function A(G){throw Error()}_.assertNever=A,_.arrayToEnum=(G)=>{let J={};for(let Y of G)J[Y]=Y;return J},_.getValidEnumValues=(G)=>{let J=_.objectKeys(G).filter((X)=>typeof G[G[X]]!=="number"),Y={};for(let X of J)Y[X]=G[X];return _.objectValues(Y)},_.objectValues=(G)=>{return _.objectKeys(G).map(function(J){return G[J]})},_.objectKeys=typeof Object.keys==="function"?(G)=>Object.keys(G):(G)=>{let J=[];for(let Y in G)if(Object.prototype.hasOwnProperty.call(G,Y))J.push(Y);return J},_.find=(G,J)=>{for(let Y of G)if(J(Y))return Y;return},_.isInteger=typeof Number.isInteger==="function"?(G)=>Number.isInteger(G):(G)=>typeof G==="number"&&Number.isFinite(G)&&Math.floor(G)===G;function b(G,J=" | "){return G.map((Y)=>typeof Y==="string"?`'${Y}'`:Y).join(J)}_.joinValues=b,_.jsonStringifyReplacer=(G,J)=>{if(typeof J==="bigint")return J.toString();return J}})(z0||(z0={}));var H5;(function(_){_.mergeShapes=(z,A)=>{return{...z,...A}}})(H5||(H5={}));var k=z0.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),b4=(_)=>{switch(typeof _){case"undefined":return k.undefined;case"string":return k.string;case"number":return Number.isNaN(_)?k.nan:k.number;case"boolean":return k.boolean;case"function":return k.function;case"bigint":return k.bigint;case"symbol":return k.symbol;case"object":if(Array.isArray(_))return k.array;if(_===null)return k.null;if(_.then&&typeof _.then==="function"&&_.catch&&typeof _.catch==="function")return k.promise;if(typeof Map<"u"&&_ instanceof Map)return k.map;if(typeof Set<"u"&&_ instanceof Set)return k.set;if(typeof Date<"u"&&_ instanceof Date)return k.date;return k.object;default:return k.unknown}};var j=z0.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"]),uw=(_)=>{return JSON.stringify(_,null,2).replace(/"([^"]+)":/g,"$1:")};class J9 extends Error{get errors(){return this.issues}constructor(_){super();this.issues=[],this.addIssue=(A)=>{this.issues=[...this.issues,A]},this.addIssues=(A=[])=>{this.issues=[...this.issues,...A]};let z=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,z);else this.__proto__=z;this.name="ZodError",this.issues=_}format(_){let z=_||function(G){return G.message},A={_errors:[]},b=(G)=>{for(let J of G.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)A._errors.push(z(J));else{let Y=A,X=0;while(X<J.path.length){let Q=J.path[X];if(X!==J.path.length-1)Y[Q]=Y[Q]||{_errors:[]};else Y[Q]=Y[Q]||{_errors:[]},Y[Q]._errors.push(z(J));Y=Y[Q],X++}}};return b(this),A}static assert(_){if(!(_ instanceof J9))throw Error(`Not a ZodError: ${_}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,z0.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(_=(z)=>z.message){let z={},A=[];for(let b of this.issues)if(b.path.length>0){let G=b.path[0];z[G]=z[G]||[],z[G].push(_(b))}else A.push(_(b));return{formErrors:A,fieldErrors:z}}get formErrors(){return this.flatten()}}J9.create=(_)=>{return new J9(_)};var cw=(_,z)=>{let A;switch(_.code){case j.invalid_type:if(_.received===k.undefined)A="Required";else A=`Expected ${_.expected}, received ${_.received}`;break;case j.invalid_literal:A=`Invalid literal value, expected ${JSON.stringify(_.expected,z0.jsonStringifyReplacer)}`;break;case j.unrecognized_keys:A=`Unrecognized key(s) in object: ${z0.joinValues(_.keys,", ")}`;break;case j.invalid_union:A="Invalid input";break;case j.invalid_union_discriminator:A=`Invalid discriminator value. Expected ${z0.joinValues(_.options)}`;break;case j.invalid_enum_value:A=`Invalid enum value. Expected ${z0.joinValues(_.options)}, received '${_.received}'`;break;case j.invalid_arguments:A="Invalid function arguments";break;case j.invalid_return_type:A="Invalid function return type";break;case j.invalid_date:A="Invalid date";break;case j.invalid_string:if(typeof _.validation==="object")if("includes"in _.validation){if(A=`Invalid input: must include "${_.validation.includes}"`,typeof _.validation.position==="number")A=`${A} at one or more positions greater than or equal to ${_.validation.position}`}else if("startsWith"in _.validation)A=`Invalid input: must start with "${_.validation.startsWith}"`;else if("endsWith"in _.validation)A=`Invalid input: must end with "${_.validation.endsWith}"`;else z0.assertNever(_.validation);else if(_.validation!=="regex")A=`Invalid ${_.validation}`;else A="Invalid";break;case j.too_small:if(_.type==="array")A=`Array must contain ${_.exact?"exactly":_.inclusive?"at least":"more than"} ${_.minimum} element(s)`;else if(_.type==="string")A=`String must contain ${_.exact?"exactly":_.inclusive?"at least":"over"} ${_.minimum} character(s)`;else if(_.type==="number")A=`Number must be ${_.exact?"exactly equal to ":_.inclusive?"greater than or equal to ":"greater than "}${_.minimum}`;else if(_.type==="bigint")A=`Number must be ${_.exact?"exactly equal to ":_.inclusive?"greater than or equal to ":"greater than "}${_.minimum}`;else if(_.type==="date")A=`Date must be ${_.exact?"exactly equal to ":_.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(_.minimum))}`;else A="Invalid input";break;case j.too_big:if(_.type==="array")A=`Array must contain ${_.exact?"exactly":_.inclusive?"at most":"less than"} ${_.maximum} element(s)`;else if(_.type==="string")A=`String must contain ${_.exact?"exactly":_.inclusive?"at most":"under"} ${_.maximum} character(s)`;else if(_.type==="number")A=`Number must be ${_.exact?"exactly":_.inclusive?"less than or equal to":"less than"} ${_.maximum}`;else if(_.type==="bigint")A=`BigInt must be ${_.exact?"exactly":_.inclusive?"less than or equal to":"less than"} ${_.maximum}`;else if(_.type==="date")A=`Date must be ${_.exact?"exactly":_.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(_.maximum))}`;else A="Invalid input";break;case j.custom:A="Invalid input";break;case j.invalid_intersection_types:A="Intersection results could not be merged";break;case j.not_multiple_of:A=`Number must be a multiple of ${_.multipleOf}`;break;case j.not_finite:A="Number must be finite";break;default:A=z.defaultError,z0.assertNever(_)}return{message:A}},M4=cw;var wY=M4;function lw(_){wY=_}function i_(){return wY}var Bz=(_)=>{let{data:z,path:A,errorMaps:b,issueData:G}=_,J=[...A,...G.path||[]],Y={...G,path:J};if(G.message!==void 0)return{...G,path:J,message:G.message};let X="",Q=b.filter(($)=>!!$).slice().reverse();for(let $ of Q)X=$(Y,{data:z,defaultError:X}).message;return{...G,path:J,message:X}},pw=[];function T(_,z){let A=i_(),b=Bz({issueData:z,data:_.data,path:_.path,errorMaps:[_.common.contextualErrorMap,_.schemaErrorMap,A,A===M4?void 0:M4].filter((G)=>!!G)});_.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(_,z){let A=[];for(let b of z){if(b.status==="aborted")return l;if(b.status==="dirty")_.dirty();A.push(b.value)}return{status:_.value,value:A}}static async mergeObjectAsync(_,z){let A=[];for(let b of z){let G=await b.key,J=await b.value;A.push({key:G,value:J})}return g0.mergeObjectSync(_,A)}static mergeObjectSync(_,z){let A={};for(let b of z){let{key:G,value:J}=b;if(G.status==="aborted")return l;if(J.status==="aborted")return l;if(G.status==="dirty")_.dirty();if(J.status==="dirty")_.dirty();if(G.value!=="__proto__"&&(typeof J.value<"u"||b.alwaysSet))A[G.value]=J.value}return{status:_.value,value:A}}}var l=Object.freeze({status:"aborted"}),q_=(_)=>({status:"dirty",value:_}),d0=(_)=>({status:"valid",value:_}),e3=(_)=>_.status==="aborted",_6=(_)=>_.status==="dirty",p4=(_)=>_.status==="valid",o_=(_)=>typeof Promise<"u"&&_ instanceof Promise;var v;(function(_){_.errToObj=(z)=>typeof z==="string"?{message:z}:z||{},_.toString=(z)=>typeof z==="string"?z:z?.message})(v||(v={}));class g9{constructor(_,z,A,b){this._cachedPath=[],this.parent=_,this.data=z,this._path=A,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 EY=(_,z)=>{if(p4(z))return{success:!0,data:z.value};else{if(!_.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let A=new J9(_.common.issues);return this._error=A,this._error}}}};function o(_){if(!_)return{};let{errorMap:z,invalid_type_error:A,required_error:b,description:G}=_;if(z&&(A||b))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(z)return{errorMap:z,description:G};return{errorMap:(Y,X)=>{let{message:Q}=_;if(Y.code==="invalid_enum_value")return{message:Q??X.defaultError};if(typeof X.data>"u")return{message:Q??b??X.defaultError};if(Y.code!=="invalid_type")return{message:X.defaultError};return{message:Q??A??X.defaultError}},description:G}}class _0{get description(){return this._def.description}_getType(_){return b4(_.data)}_getOrReturnCtx(_,z){return z||{common:_.parent.common,data:_.data,parsedType:b4(_.data),schemaErrorMap:this._def.errorMap,path:_.path,parent:_.parent}}_processInputParams(_){return{status:new g0,ctx:{common:_.parent.common,data:_.data,parsedType:b4(_.data),schemaErrorMap:this._def.errorMap,path:_.path,parent:_.parent}}}_parseSync(_){let z=this._parse(_);if(o_(z))throw Error("Synchronous parse encountered promise.");return z}_parseAsync(_){let z=this._parse(_);return Promise.resolve(z)}parse(_,z){let A=this.safeParse(_,z);if(A.success)return A.data;throw A.error}safeParse(_,z){let A={common:{issues:[],async:z?.async??!1,contextualErrorMap:z?.errorMap},path:z?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:_,parsedType:b4(_)},b=this._parseSync({data:_,path:A.path,parent:A});return EY(A,b)}"~validate"(_){let z={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:_,parsedType:b4(_)};if(!this["~standard"].async)try{let A=this._parseSync({data:_,path:[],parent:z});return p4(A)?{value:A.value}:{issues:z.common.issues}}catch(A){if(A?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;z.common={issues:[],async:!0}}return this._parseAsync({data:_,path:[],parent:z}).then((A)=>p4(A)?{value:A.value}:{issues:z.common.issues})}async parseAsync(_,z){let A=await this.safeParseAsync(_,z);if(A.success)return A.data;throw A.error}async safeParseAsync(_,z){let A={common:{issues:[],contextualErrorMap:z?.errorMap,async:!0},path:z?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:_,parsedType:b4(_)},b=this._parse({data:_,path:A.path,parent:A}),G=await(o_(b)?b:Promise.resolve(b));return EY(A,G)}refine(_,z){let A=(b)=>{if(typeof z==="string"||typeof z>"u")return{message:z};else if(typeof z==="function")return z(b);else return z};return this._refinement((b,G)=>{let J=_(b),Y=()=>G.addIssue({code:j.custom,...A(b)});if(typeof Promise<"u"&&J instanceof Promise)return J.then((X)=>{if(!X)return Y(),!1;else return!0});if(!J)return Y(),!1;else return!0})}refinement(_,z){return this._refinement((A,b)=>{if(!_(A))return b.addIssue(typeof z==="function"?z(A,b):z),!1;else return!0})}_refinement(_){return new f9({schema:this,typeName:p.ZodEffects,effect:{type:"refinement",refinement:_}})}superRefine(_){return this._refinement(_)}constructor(_){this.spa=this.safeParseAsync,this._def=_,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:(z)=>this["~validate"](z)}}optional(){return y9.create(this,this._def)}nullable(){return w4.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return v9.create(this)}promise(){return D_.create(this,this._def)}or(_){return z1.create([this,_],this._def)}and(_){return A1.create(this,_,this._def)}transform(_){return new f9({...o(this._def),schema:this,typeName:p.ZodEffects,effect:{type:"transform",transform:_}})}default(_){let z=typeof _==="function"?_:()=>_;return new Y1({...o(this._def),innerType:this,defaultValue:z,typeName:p.ZodDefault})}brand(){return new A6({typeName:p.ZodBranded,type:this,...o(this._def)})}catch(_){let z=typeof _==="function"?_:()=>_;return new X1({...o(this._def),innerType:this,catchValue:z,typeName:p.ZodCatch})}describe(_){return new this.constructor({...this._def,description:_})}pipe(_){return Vz.create(this,_)}readonly(){return Q1.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var dw=/^c[^\s-]{8,}$/i,rw=/^[0-9a-z]+$/,nw=/^[0-9A-HJKMNP-TV-Z]{26}$/i,iw=/^[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,ow=/^[a-z0-9_-]{21}$/i,aw=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,sw=/^[-+]?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)?)??$/,tw=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ew="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",B5,_E=/^(?:(?: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])$/,zE=/^(?:(?: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])$/,AE=/^(([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]))$/,bE=/^(([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])$/,GE=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,JE=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,LY="((\\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])))",YE=new RegExp(`^${LY}$`);function jY(_){let z="[0-5]\\d";if(_.precision)z=`${z}\\.\\d{${_.precision}}`;else if(_.precision==null)z=`${z}(\\.\\d+)?`;let A=_.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${z})${A}`}function XE(_){return new RegExp(`^${jY(_)}$`)}function RY(_){let z=`${LY}T${jY(_)}`,A=[];if(A.push(_.local?"Z?":"Z"),_.offset)A.push("([+-]\\d{2}:?\\d{2})");return z=`${z}(${A.join("|")})`,new RegExp(`^${z}$`)}function QE(_,z){if((z==="v4"||!z)&&_E.test(_))return!0;if((z==="v6"||!z)&&AE.test(_))return!0;return!1}function $E(_,z){if(!aw.test(_))return!1;try{let[A]=_.split(".");if(!A)return!1;let b=A.replace(/-/g,"+").replace(/_/g,"/").padEnd(A.length+(4-A.length%4)%4,"="),G=JSON.parse(atob(b));if(typeof G!=="object"||G===null)return!1;if("typ"in G&&G?.typ!=="JWT")return!1;if(!G.alg)return!1;if(z&&G.alg!==z)return!1;return!0}catch{return!1}}function HE(_,z){if((z==="v4"||!z)&&zE.test(_))return!0;if((z==="v6"||!z)&&bE.test(_))return!0;return!1}class C9 extends _0{_parse(_){if(this._def.coerce)_.data=String(_.data);if(this._getType(_)!==k.string){let G=this._getOrReturnCtx(_);return T(G,{code:j.invalid_type,expected:k.string,received:G.parsedType}),l}let A=new g0,b=void 0;for(let G of this._def.checks)if(G.kind==="min"){if(_.data.length<G.value)b=this._getOrReturnCtx(_,b),T(b,{code:j.too_small,minimum:G.value,type:"string",inclusive:!0,exact:!1,message:G.message}),A.dirty()}else if(G.kind==="max"){if(_.data.length>G.value)b=this._getOrReturnCtx(_,b),T(b,{code:j.too_big,maximum:G.value,type:"string",inclusive:!0,exact:!1,message:G.message}),A.dirty()}else if(G.kind==="length"){let J=_.data.length>G.value,Y=_.data.length<G.value;if(J||Y){if(b=this._getOrReturnCtx(_,b),J)T(b,{code:j.too_big,maximum:G.value,type:"string",inclusive:!0,exact:!0,message:G.message});else if(Y)T(b,{code:j.too_small,minimum:G.value,type:"string",inclusive:!0,exact:!0,message:G.message});A.dirty()}}else if(G.kind==="email"){if(!tw.test(_.data))b=this._getOrReturnCtx(_,b),T(b,{validation:"email",code:j.invalid_string,message:G.message}),A.dirty()}else if(G.kind==="emoji"){if(!B5)B5=new RegExp(ew,"u");if(!B5.test(_.data))b=this._getOrReturnCtx(_,b),T(b,{validation:"emoji",code:j.invalid_string,message:G.message}),A.dirty()}else if(G.kind==="uuid"){if(!iw.test(_.data))b=this._getOrReturnCtx(_,b),T(b,{validation:"uuid",code:j.invalid_string,message:G.message}),A.dirty()}else if(G.kind==="nanoid"){if(!ow.test(_.data))b=this._getOrReturnCtx(_,b),T(b,{validation:"nanoid",code:j.invalid_string,message:G.message}),A.dirty()}else if(G.kind==="cuid"){if(!dw.test(_.data))b=this._getOrReturnCtx(_,b),T(b,{validation:"cuid",code:j.invalid_string,message:G.message}),A.dirty()}else if(G.kind==="cuid2"){if(!rw.test(_.data))b=this._getOrReturnCtx(_,b),T(b,{validation:"cuid2",code:j.invalid_string,message:G.message}),A.dirty()}else if(G.kind==="ulid"){if(!nw.test(_.data))b=this._getOrReturnCtx(_,b),T(b,{validation:"ulid",code:j.invalid_string,message:G.message}),A.dirty()}else if(G.kind==="url")try{new URL(_.data)}catch{b=this._getOrReturnCtx(_,b),T(b,{validation:"url",code:j.invalid_string,message:G.message}),A.dirty()}else if(G.kind==="regex"){if(G.regex.lastIndex=0,!G.regex.test(_.data))b=this._getOrReturnCtx(_,b),T(b,{validation:"regex",code:j.invalid_string,message:G.message}),A.dirty()}else if(G.kind==="trim")_.data=_.data.trim();else if(G.kind==="includes"){if(!_.data.includes(G.value,G.position))b=this._getOrReturnCtx(_,b),T(b,{code:j.invalid_string,validation:{includes:G.value,position:G.position},message:G.message}),A.dirty()}else if(G.kind==="toLowerCase")_.data=_.data.toLowerCase();else if(G.kind==="toUpperCase")_.data=_.data.toUpperCase();else if(G.kind==="startsWith"){if(!_.data.startsWith(G.value))b=this._getOrReturnCtx(_,b),T(b,{code:j.invalid_string,validation:{startsWith:G.value},message:G.message}),A.dirty()}else if(G.kind==="endsWith"){if(!_.data.endsWith(G.value))b=this._getOrReturnCtx(_,b),T(b,{code:j.invalid_string,validation:{endsWith:G.value},message:G.message}),A.dirty()}else if(G.kind==="datetime"){if(!RY(G).test(_.data))b=this._getOrReturnCtx(_,b),T(b,{code:j.invalid_string,validation:"datetime",message:G.message}),A.dirty()}else if(G.kind==="date"){if(!YE.test(_.data))b=this._getOrReturnCtx(_,b),T(b,{code:j.invalid_string,validation:"date",message:G.message}),A.dirty()}else if(G.kind==="time"){if(!XE(G).test(_.data))b=this._getOrReturnCtx(_,b),T(b,{code:j.invalid_string,validation:"time",message:G.message}),A.dirty()}else if(G.kind==="duration"){if(!sw.test(_.data))b=this._getOrReturnCtx(_,b),T(b,{validation:"duration",code:j.invalid_string,message:G.message}),A.dirty()}else if(G.kind==="ip"){if(!QE(_.data,G.version))b=this._getOrReturnCtx(_,b),T(b,{validation:"ip",code:j.invalid_string,message:G.message}),A.dirty()}else if(G.kind==="jwt"){if(!$E(_.data,G.alg))b=this._getOrReturnCtx(_,b),T(b,{validation:"jwt",code:j.invalid_string,message:G.message}),A.dirty()}else if(G.kind==="cidr"){if(!HE(_.data,G.version))b=this._getOrReturnCtx(_,b),T(b,{validation:"cidr",code:j.invalid_string,message:G.message}),A.dirty()}else if(G.kind==="base64"){if(!GE.test(_.data))b=this._getOrReturnCtx(_,b),T(b,{validation:"base64",code:j.invalid_string,message:G.message}),A.dirty()}else if(G.kind==="base64url"){if(!JE.test(_.data))b=this._getOrReturnCtx(_,b),T(b,{validation:"base64url",code:j.invalid_string,message:G.message}),A.dirty()}else z0.assertNever(G);return{status:A.value,value:_.data}}_regex(_,z,A){return this.refinement((b)=>_.test(b),{validation:z,code:j.invalid_string,...v.errToObj(A)})}_addCheck(_){return new C9({...this._def,checks:[...this._def.checks,_]})}email(_){return this._addCheck({kind:"email",...v.errToObj(_)})}url(_){return this._addCheck({kind:"url",...v.errToObj(_)})}emoji(_){return this._addCheck({kind:"emoji",...v.errToObj(_)})}uuid(_){return this._addCheck({kind:"uuid",...v.errToObj(_)})}nanoid(_){return this._addCheck({kind:"nanoid",...v.errToObj(_)})}cuid(_){return this._addCheck({kind:"cuid",...v.errToObj(_)})}cuid2(_){return this._addCheck({kind:"cuid2",...v.errToObj(_)})}ulid(_){return this._addCheck({kind:"ulid",...v.errToObj(_)})}base64(_){return this._addCheck({kind:"base64",...v.errToObj(_)})}base64url(_){return this._addCheck({kind:"base64url",...v.errToObj(_)})}jwt(_){return this._addCheck({kind:"jwt",...v.errToObj(_)})}ip(_){return this._addCheck({kind:"ip",...v.errToObj(_)})}cidr(_){return this._addCheck({kind:"cidr",...v.errToObj(_)})}datetime(_){if(typeof _==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:_});return this._addCheck({kind:"datetime",precision:typeof _?.precision>"u"?null:_?.precision,offset:_?.offset??!1,local:_?.local??!1,...v.errToObj(_?.message)})}date(_){return this._addCheck({kind:"date",message:_})}time(_){if(typeof _==="string")return this._addCheck({kind:"time",precision:null,message:_});return this._addCheck({kind:"time",precision:typeof _?.precision>"u"?null:_?.precision,...v.errToObj(_?.message)})}duration(_){return this._addCheck({kind:"duration",...v.errToObj(_)})}regex(_,z){return this._addCheck({kind:"regex",regex:_,...v.errToObj(z)})}includes(_,z){return this._addCheck({kind:"includes",value:_,position:z?.position,...v.errToObj(z?.message)})}startsWith(_,z){return this._addCheck({kind:"startsWith",value:_,...v.errToObj(z)})}endsWith(_,z){return this._addCheck({kind:"endsWith",value:_,...v.errToObj(z)})}min(_,z){return this._addCheck({kind:"min",value:_,...v.errToObj(z)})}max(_,z){return this._addCheck({kind:"max",value:_,...v.errToObj(z)})}length(_,z){return this._addCheck({kind:"length",value:_,...v.errToObj(z)})}nonempty(_){return this.min(1,v.errToObj(_))}trim(){return new C9({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new C9({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new C9({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((_)=>_.kind==="datetime")}get isDate(){return!!this._def.checks.find((_)=>_.kind==="date")}get isTime(){return!!this._def.checks.find((_)=>_.kind==="time")}get isDuration(){return!!this._def.checks.find((_)=>_.kind==="duration")}get isEmail(){return!!this._def.checks.find((_)=>_.kind==="email")}get isURL(){return!!this._def.checks.find((_)=>_.kind==="url")}get isEmoji(){return!!this._def.checks.find((_)=>_.kind==="emoji")}get isUUID(){return!!this._def.checks.find((_)=>_.kind==="uuid")}get isNANOID(){return!!this._def.checks.find((_)=>_.kind==="nanoid")}get isCUID(){return!!this._def.checks.find((_)=>_.kind==="cuid")}get isCUID2(){return!!this._def.checks.find((_)=>_.kind==="cuid2")}get isULID(){return!!this._def.checks.find((_)=>_.kind==="ulid")}get isIP(){return!!this._def.checks.find((_)=>_.kind==="ip")}get isCIDR(){return!!this._def.checks.find((_)=>_.kind==="cidr")}get isBase64(){return!!this._def.checks.find((_)=>_.kind==="base64")}get isBase64url(){return!!this._def.checks.find((_)=>_.kind==="base64url")}get minLength(){let _=null;for(let z of this._def.checks)if(z.kind==="min"){if(_===null||z.value>_)_=z.value}return _}get maxLength(){let _=null;for(let z of this._def.checks)if(z.kind==="max"){if(_===null||z.value<_)_=z.value}return _}}C9.create=(_)=>{return new C9({checks:[],typeName:p.ZodString,coerce:_?.coerce??!1,...o(_)})};function BE(_,z){let A=(_.toString().split(".")[1]||"").length,b=(z.toString().split(".")[1]||"").length,G=A>b?A:b,J=Number.parseInt(_.toFixed(G).replace(".","")),Y=Number.parseInt(z.toFixed(G).replace(".",""));return J%Y/10**G}class r4 extends _0{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(_){if(this._def.coerce)_.data=Number(_.data);if(this._getType(_)!==k.number){let G=this._getOrReturnCtx(_);return T(G,{code:j.invalid_type,expected:k.number,received:G.parsedType}),l}let A=void 0,b=new g0;for(let G of this._def.checks)if(G.kind==="int"){if(!z0.isInteger(_.data))A=this._getOrReturnCtx(_,A),T(A,{code:j.invalid_type,expected:"integer",received:"float",message:G.message}),b.dirty()}else if(G.kind==="min"){if(G.inclusive?_.data<G.value:_.data<=G.value)A=this._getOrReturnCtx(_,A),T(A,{code:j.too_small,minimum:G.value,type:"number",inclusive:G.inclusive,exact:!1,message:G.message}),b.dirty()}else if(G.kind==="max"){if(G.inclusive?_.data>G.value:_.data>=G.value)A=this._getOrReturnCtx(_,A),T(A,{code:j.too_big,maximum:G.value,type:"number",inclusive:G.inclusive,exact:!1,message:G.message}),b.dirty()}else if(G.kind==="multipleOf"){if(BE(_.data,G.value)!==0)A=this._getOrReturnCtx(_,A),T(A,{code:j.not_multiple_of,multipleOf:G.value,message:G.message}),b.dirty()}else if(G.kind==="finite"){if(!Number.isFinite(_.data))A=this._getOrReturnCtx(_,A),T(A,{code:j.not_finite,message:G.message}),b.dirty()}else z0.assertNever(G);return{status:b.value,value:_.data}}gte(_,z){return this.setLimit("min",_,!0,v.toString(z))}gt(_,z){return this.setLimit("min",_,!1,v.toString(z))}lte(_,z){return this.setLimit("max",_,!0,v.toString(z))}lt(_,z){return this.setLimit("max",_,!1,v.toString(z))}setLimit(_,z,A,b){return new r4({...this._def,checks:[...this._def.checks,{kind:_,value:z,inclusive:A,message:v.toString(b)}]})}_addCheck(_){return new r4({...this._def,checks:[...this._def.checks,_]})}int(_){return this._addCheck({kind:"int",message:v.toString(_)})}positive(_){return this._addCheck({kind:"min",value:0,inclusive:!1,message:v.toString(_)})}negative(_){return this._addCheck({kind:"max",value:0,inclusive:!1,message:v.toString(_)})}nonpositive(_){return this._addCheck({kind:"max",value:0,inclusive:!0,message:v.toString(_)})}nonnegative(_){return this._addCheck({kind:"min",value:0,inclusive:!0,message:v.toString(_)})}multipleOf(_,z){return this._addCheck({kind:"multipleOf",value:_,message:v.toString(z)})}finite(_){return this._addCheck({kind:"finite",message:v.toString(_)})}safe(_){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:v.toString(_)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:v.toString(_)})}get minValue(){let _=null;for(let z of this._def.checks)if(z.kind==="min"){if(_===null||z.value>_)_=z.value}return _}get maxValue(){let _=null;for(let z of this._def.checks)if(z.kind==="max"){if(_===null||z.value<_)_=z.value}return _}get isInt(){return!!this._def.checks.find((_)=>_.kind==="int"||_.kind==="multipleOf"&&z0.isInteger(_.value))}get isFinite(){let _=null,z=null;for(let A of this._def.checks)if(A.kind==="finite"||A.kind==="int"||A.kind==="multipleOf")return!0;else if(A.kind==="min"){if(z===null||A.value>z)z=A.value}else if(A.kind==="max"){if(_===null||A.value<_)_=A.value}return Number.isFinite(z)&&Number.isFinite(_)}}r4.create=(_)=>{return new r4({checks:[],typeName:p.ZodNumber,coerce:_?.coerce||!1,...o(_)})};class n4 extends _0{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse(_){if(this._def.coerce)try{_.data=BigInt(_.data)}catch{return this._getInvalidInput(_)}if(this._getType(_)!==k.bigint)return this._getInvalidInput(_);let A=void 0,b=new g0;for(let G of this._def.checks)if(G.kind==="min"){if(G.inclusive?_.data<G.value:_.data<=G.value)A=this._getOrReturnCtx(_,A),T(A,{code:j.too_small,type:"bigint",minimum:G.value,inclusive:G.inclusive,message:G.message}),b.dirty()}else if(G.kind==="max"){if(G.inclusive?_.data>G.value:_.data>=G.value)A=this._getOrReturnCtx(_,A),T(A,{code:j.too_big,type:"bigint",maximum:G.value,inclusive:G.inclusive,message:G.message}),b.dirty()}else if(G.kind==="multipleOf"){if(_.data%G.value!==BigInt(0))A=this._getOrReturnCtx(_,A),T(A,{code:j.not_multiple_of,multipleOf:G.value,message:G.message}),b.dirty()}else z0.assertNever(G);return{status:b.value,value:_.data}}_getInvalidInput(_){let z=this._getOrReturnCtx(_);return T(z,{code:j.invalid_type,expected:k.bigint,received:z.parsedType}),l}gte(_,z){return this.setLimit("min",_,!0,v.toString(z))}gt(_,z){return this.setLimit("min",_,!1,v.toString(z))}lte(_,z){return this.setLimit("max",_,!0,v.toString(z))}lt(_,z){return this.setLimit("max",_,!1,v.toString(z))}setLimit(_,z,A,b){return new n4({...this._def,checks:[...this._def.checks,{kind:_,value:z,inclusive:A,message:v.toString(b)}]})}_addCheck(_){return new n4({...this._def,checks:[...this._def.checks,_]})}positive(_){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:v.toString(_)})}negative(_){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:v.toString(_)})}nonpositive(_){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:v.toString(_)})}nonnegative(_){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:v.toString(_)})}multipleOf(_,z){return this._addCheck({kind:"multipleOf",value:_,message:v.toString(z)})}get minValue(){let _=null;for(let z of this._def.checks)if(z.kind==="min"){if(_===null||z.value>_)_=z.value}return _}get maxValue(){let _=null;for(let z of this._def.checks)if(z.kind==="max"){if(_===null||z.value<_)_=z.value}return _}}n4.create=(_)=>{return new n4({checks:[],typeName:p.ZodBigInt,coerce:_?.coerce??!1,...o(_)})};class t_ extends _0{_parse(_){if(this._def.coerce)_.data=Boolean(_.data);if(this._getType(_)!==k.boolean){let A=this._getOrReturnCtx(_);return T(A,{code:j.invalid_type,expected:k.boolean,received:A.parsedType}),l}return d0(_.data)}}t_.create=(_)=>{return new t_({typeName:p.ZodBoolean,coerce:_?.coerce||!1,...o(_)})};class W_ extends _0{_parse(_){if(this._def.coerce)_.data=new Date(_.data);if(this._getType(_)!==k.date){let G=this._getOrReturnCtx(_);return T(G,{code:j.invalid_type,expected:k.date,received:G.parsedType}),l}if(Number.isNaN(_.data.getTime())){let G=this._getOrReturnCtx(_);return T(G,{code:j.invalid_date}),l}let A=new g0,b=void 0;for(let G of this._def.checks)if(G.kind==="min"){if(_.data.getTime()<G.value)b=this._getOrReturnCtx(_,b),T(b,{code:j.too_small,message:G.message,inclusive:!0,exact:!1,minimum:G.value,type:"date"}),A.dirty()}else if(G.kind==="max"){if(_.data.getTime()>G.value)b=this._getOrReturnCtx(_,b),T(b,{code:j.too_big,message:G.message,inclusive:!0,exact:!1,maximum:G.value,type:"date"}),A.dirty()}else z0.assertNever(G);return{status:A.value,value:new Date(_.data.getTime())}}_addCheck(_){return new W_({...this._def,checks:[...this._def.checks,_]})}min(_,z){return this._addCheck({kind:"min",value:_.getTime(),message:v.toString(z)})}max(_,z){return this._addCheck({kind:"max",value:_.getTime(),message:v.toString(z)})}get minDate(){let _=null;for(let z of this._def.checks)if(z.kind==="min"){if(_===null||z.value>_)_=z.value}return _!=null?new Date(_):null}get maxDate(){let _=null;for(let z of this._def.checks)if(z.kind==="max"){if(_===null||z.value<_)_=z.value}return _!=null?new Date(_):null}}W_.create=(_)=>{return new W_({checks:[],coerce:_?.coerce||!1,typeName:p.ZodDate,...o(_)})};class Zz extends _0{_parse(_){if(this._getType(_)!==k.symbol){let A=this._getOrReturnCtx(_);return T(A,{code:j.invalid_type,expected:k.symbol,received:A.parsedType}),l}return d0(_.data)}}Zz.create=(_)=>{return new Zz({typeName:p.ZodSymbol,...o(_)})};class e_ extends _0{_parse(_){if(this._getType(_)!==k.undefined){let A=this._getOrReturnCtx(_);return T(A,{code:j.invalid_type,expected:k.undefined,received:A.parsedType}),l}return d0(_.data)}}e_.create=(_)=>{return new e_({typeName:p.ZodUndefined,...o(_)})};class _1 extends _0{_parse(_){if(this._getType(_)!==k.null){let A=this._getOrReturnCtx(_);return T(A,{code:j.invalid_type,expected:k.null,received:A.parsedType}),l}return d0(_.data)}}_1.create=(_)=>{return new _1({typeName:p.ZodNull,...o(_)})};class V_ extends _0{constructor(){super(...arguments);this._any=!0}_parse(_){return d0(_.data)}}V_.create=(_)=>{return new V_({typeName:p.ZodAny,...o(_)})};class d4 extends _0{constructor(){super(...arguments);this._unknown=!0}_parse(_){return d0(_.data)}}d4.create=(_)=>{return new d4({typeName:p.ZodUnknown,...o(_)})};class G4 extends _0{_parse(_){let z=this._getOrReturnCtx(_);return T(z,{code:j.invalid_type,expected:k.never,received:z.parsedType}),l}}G4.create=(_)=>{return new G4({typeName:p.ZodNever,...o(_)})};class Fz extends _0{_parse(_){if(this._getType(_)!==k.undefined){let A=this._getOrReturnCtx(_);return T(A,{code:j.invalid_type,expected:k.void,received:A.parsedType}),l}return d0(_.data)}}Fz.create=(_)=>{return new Fz({typeName:p.ZodVoid,...o(_)})};class v9 extends _0{_parse(_){let{ctx:z,status:A}=this._processInputParams(_),b=this._def;if(z.parsedType!==k.array)return T(z,{code:j.invalid_type,expected:k.array,received:z.parsedType}),l;if(b.exactLength!==null){let J=z.data.length>b.exactLength.value,Y=z.data.length<b.exactLength.value;if(J||Y)T(z,{code:J?j.too_big:j.too_small,minimum:Y?b.exactLength.value:void 0,maximum:J?b.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:b.exactLength.message}),A.dirty()}if(b.minLength!==null){if(z.data.length<b.minLength.value)T(z,{code:j.too_small,minimum:b.minLength.value,type:"array",inclusive:!0,exact:!1,message:b.minLength.message}),A.dirty()}if(b.maxLength!==null){if(z.data.length>b.maxLength.value)T(z,{code:j.too_big,maximum:b.maxLength.value,type:"array",inclusive:!0,exact:!1,message:b.maxLength.message}),A.dirty()}if(z.common.async)return Promise.all([...z.data].map((J,Y)=>{return b.type._parseAsync(new g9(z,J,z.path,Y))})).then((J)=>{return g0.mergeArray(A,J)});let G=[...z.data].map((J,Y)=>{return b.type._parseSync(new g9(z,J,z.path,Y))});return g0.mergeArray(A,G)}get element(){return this._def.type}min(_,z){return new v9({...this._def,minLength:{value:_,message:v.toString(z)}})}max(_,z){return new v9({...this._def,maxLength:{value:_,message:v.toString(z)}})}length(_,z){return new v9({...this._def,exactLength:{value:_,message:v.toString(z)}})}nonempty(_){return this.min(1,_)}}v9.create=(_,z)=>{return new v9({type:_,minLength:null,maxLength:null,exactLength:null,typeName:p.ZodArray,...o(z)})};function a_(_){if(_ instanceof S0){let z={};for(let A in _.shape){let b=_.shape[A];z[A]=y9.create(a_(b))}return new S0({..._._def,shape:()=>z})}else if(_ instanceof v9)return new v9({..._._def,type:a_(_.element)});else if(_ instanceof y9)return y9.create(a_(_.unwrap()));else if(_ instanceof w4)return w4.create(a_(_.unwrap()));else if(_ instanceof J4)return J4.create(_.items.map((z)=>a_(z)));else return _}class S0 extends _0{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let _=this._def.shape(),z=z0.objectKeys(_);return this._cached={shape:_,keys:z},this._cached}_parse(_){if(this._getType(_)!==k.object){let Q=this._getOrReturnCtx(_);return T(Q,{code:j.invalid_type,expected:k.object,received:Q.parsedType}),l}let{status:A,ctx:b}=this._processInputParams(_),{shape:G,keys:J}=this._getCached(),Y=[];if(!(this._def.catchall instanceof G4&&this._def.unknownKeys==="strip")){for(let Q in b.data)if(!J.includes(Q))Y.push(Q)}let X=[];for(let Q of J){let $=G[Q],H=b.data[Q];X.push({key:{status:"valid",value:Q},value:$._parse(new g9(b,H,b.path,Q)),alwaysSet:Q in b.data})}if(this._def.catchall instanceof G4){let Q=this._def.unknownKeys;if(Q==="passthrough")for(let $ of Y)X.push({key:{status:"valid",value:$},value:{status:"valid",value:b.data[$]}});else if(Q==="strict"){if(Y.length>0)T(b,{code:j.unrecognized_keys,keys:Y}),A.dirty()}else if(Q==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let Q=this._def.catchall;for(let $ of Y){let H=b.data[$];X.push({key:{status:"valid",value:$},value:Q._parse(new g9(b,H,b.path,$)),alwaysSet:$ in b.data})}}if(b.common.async)return Promise.resolve().then(async()=>{let Q=[];for(let $ of X){let H=await $.key,B=await $.value;Q.push({key:H,value:B,alwaysSet:$.alwaysSet})}return Q}).then((Q)=>{return g0.mergeObjectSync(A,Q)});else return g0.mergeObjectSync(A,X)}get shape(){return this._def.shape()}strict(_){return v.errToObj,new S0({...this._def,unknownKeys:"strict",..._!==void 0?{errorMap:(z,A)=>{let b=this._def.errorMap?.(z,A).message??A.defaultError;if(z.code==="unrecognized_keys")return{message:v.errToObj(_).message??b};return{message:b}}}:{}})}strip(){return new S0({...this._def,unknownKeys:"strip"})}passthrough(){return new S0({...this._def,unknownKeys:"passthrough"})}extend(_){return new S0({...this._def,shape:()=>({...this._def.shape(),..._})})}merge(_){return new S0({unknownKeys:_._def.unknownKeys,catchall:_._def.catchall,shape:()=>({...this._def.shape(),..._._def.shape()}),typeName:p.ZodObject})}setKey(_,z){return this.augment({[_]:z})}catchall(_){return new S0({...this._def,catchall:_})}pick(_){let z={};for(let A of z0.objectKeys(_))if(_[A]&&this.shape[A])z[A]=this.shape[A];return new S0({...this._def,shape:()=>z})}omit(_){let z={};for(let A of z0.objectKeys(this.shape))if(!_[A])z[A]=this.shape[A];return new S0({...this._def,shape:()=>z})}deepPartial(){return a_(this)}partial(_){let z={};for(let A of z0.objectKeys(this.shape)){let b=this.shape[A];if(_&&!_[A])z[A]=b;else z[A]=b.optional()}return new S0({...this._def,shape:()=>z})}required(_){let z={};for(let A of z0.objectKeys(this.shape))if(_&&!_[A])z[A]=this.shape[A];else{let G=this.shape[A];while(G instanceof y9)G=G._def.innerType;z[A]=G}return new S0({...this._def,shape:()=>z})}keyof(){return PY(z0.objectKeys(this.shape))}}S0.create=(_,z)=>{return new S0({shape:()=>_,unknownKeys:"strip",catchall:G4.create(),typeName:p.ZodObject,...o(z)})};S0.strictCreate=(_,z)=>{return new S0({shape:()=>_,unknownKeys:"strict",catchall:G4.create(),typeName:p.ZodObject,...o(z)})};S0.lazycreate=(_,z)=>{return new S0({shape:_,unknownKeys:"strip",catchall:G4.create(),typeName:p.ZodObject,...o(z)})};class z1 extends _0{_parse(_){let{ctx:z}=this._processInputParams(_),A=this._def.options;function b(G){for(let Y of G)if(Y.result.status==="valid")return Y.result;for(let Y of G)if(Y.result.status==="dirty")return z.common.issues.push(...Y.ctx.common.issues),Y.result;let J=G.map((Y)=>new J9(Y.ctx.common.issues));return T(z,{code:j.invalid_union,unionErrors:J}),l}if(z.common.async)return Promise.all(A.map(async(G)=>{let J={...z,common:{...z.common,issues:[]},parent:null};return{result:await G._parseAsync({data:z.data,path:z.path,parent:J}),ctx:J}})).then(b);else{let G=void 0,J=[];for(let X of A){let Q={...z,common:{...z.common,issues:[]},parent:null},$=X._parseSync({data:z.data,path:z.path,parent:Q});if($.status==="valid")return $;else if($.status==="dirty"&&!G)G={result:$,ctx:Q};if(Q.common.issues.length)J.push(Q.common.issues)}if(G)return z.common.issues.push(...G.ctx.common.issues),G.result;let Y=J.map((X)=>new J9(X));return T(z,{code:j.invalid_union,unionErrors:Y}),l}}get options(){return this._def.options}}z1.create=(_,z)=>{return new z1({options:_,typeName:p.ZodUnion,...o(z)})};var N4=(_)=>{if(_ instanceof b1)return N4(_.schema);else if(_ instanceof f9)return N4(_.innerType());else if(_ instanceof G1)return[_.value];else if(_ instanceof i4)return _.options;else if(_ instanceof J1)return z0.objectValues(_.enum);else if(_ instanceof Y1)return N4(_._def.innerType);else if(_ instanceof e_)return[void 0];else if(_ instanceof _1)return[null];else if(_ instanceof y9)return[void 0,...N4(_.unwrap())];else if(_ instanceof w4)return[null,...N4(_.unwrap())];else if(_ instanceof A6)return N4(_.unwrap());else if(_ instanceof Q1)return N4(_.unwrap());else if(_ instanceof X1)return N4(_._def.innerType);else return[]};class z6 extends _0{_parse(_){let{ctx:z}=this._processInputParams(_);if(z.parsedType!==k.object)return T(z,{code:j.invalid_type,expected:k.object,received:z.parsedType}),l;let A=this.discriminator,b=z.data[A],G=this.optionsMap.get(b);if(!G)return T(z,{code:j.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[A]}),l;if(z.common.async)return G._parseAsync({data:z.data,path:z.path,parent:z});else return G._parseSync({data:z.data,path:z.path,parent:z})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(_,z,A){let b=new Map;for(let G of z){let J=N4(G.shape[_]);if(!J.length)throw Error(`A discriminator value for key \`${_}\` could not be extracted from all schema options`);for(let Y of J){if(b.has(Y))throw Error(`Discriminator property ${String(_)} has duplicate value ${String(Y)}`);b.set(Y,G)}}return new z6({typeName:p.ZodDiscriminatedUnion,discriminator:_,options:z,optionsMap:b,...o(A)})}}function Z5(_,z){let A=b4(_),b=b4(z);if(_===z)return{valid:!0,data:_};else if(A===k.object&&b===k.object){let G=z0.objectKeys(z),J=z0.objectKeys(_).filter((X)=>G.indexOf(X)!==-1),Y={..._,...z};for(let X of J){let Q=Z5(_[X],z[X]);if(!Q.valid)return{valid:!1};Y[X]=Q.data}return{valid:!0,data:Y}}else if(A===k.array&&b===k.array){if(_.length!==z.length)return{valid:!1};let G=[];for(let J=0;J<_.length;J++){let Y=_[J],X=z[J],Q=Z5(Y,X);if(!Q.valid)return{valid:!1};G.push(Q.data)}return{valid:!0,data:G}}else if(A===k.date&&b===k.date&&+_===+z)return{valid:!0,data:_};else return{valid:!1}}class A1 extends _0{_parse(_){let{status:z,ctx:A}=this._processInputParams(_),b=(G,J)=>{if(e3(G)||e3(J))return l;let Y=Z5(G.value,J.value);if(!Y.valid)return T(A,{code:j.invalid_intersection_types}),l;if(_6(G)||_6(J))z.dirty();return{status:z.value,value:Y.data}};if(A.common.async)return Promise.all([this._def.left._parseAsync({data:A.data,path:A.path,parent:A}),this._def.right._parseAsync({data:A.data,path:A.path,parent:A})]).then(([G,J])=>b(G,J));else return b(this._def.left._parseSync({data:A.data,path:A.path,parent:A}),this._def.right._parseSync({data:A.data,path:A.path,parent:A}))}}A1.create=(_,z,A)=>{return new A1({left:_,right:z,typeName:p.ZodIntersection,...o(A)})};class J4 extends _0{_parse(_){let{status:z,ctx:A}=this._processInputParams(_);if(A.parsedType!==k.array)return T(A,{code:j.invalid_type,expected:k.array,received:A.parsedType}),l;if(A.data.length<this._def.items.length)return T(A,{code:j.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),l;if(!this._def.rest&&A.data.length>this._def.items.length)T(A,{code:j.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),z.dirty();let G=[...A.data].map((J,Y)=>{let X=this._def.items[Y]||this._def.rest;if(!X)return null;return X._parse(new g9(A,J,A.path,Y))}).filter((J)=>!!J);if(A.common.async)return Promise.all(G).then((J)=>{return g0.mergeArray(z,J)});else return g0.mergeArray(z,G)}get items(){return this._def.items}rest(_){return new J4({...this._def,rest:_})}}J4.create=(_,z)=>{if(!Array.isArray(_))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new J4({items:_,typeName:p.ZodTuple,rest:null,...o(z)})};class Kz extends _0{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(_){let{status:z,ctx:A}=this._processInputParams(_);if(A.parsedType!==k.object)return T(A,{code:j.invalid_type,expected:k.object,received:A.parsedType}),l;let b=[],G=this._def.keyType,J=this._def.valueType;for(let Y in A.data)b.push({key:G._parse(new g9(A,Y,A.path,Y)),value:J._parse(new g9(A,A.data[Y],A.path,Y)),alwaysSet:Y in A.data});if(A.common.async)return g0.mergeObjectAsync(z,b);else return g0.mergeObjectSync(z,b)}get element(){return this._def.valueType}static create(_,z,A){if(z instanceof _0)return new Kz({keyType:_,valueType:z,typeName:p.ZodRecord,...o(A)});return new Kz({keyType:C9.create(),valueType:_,typeName:p.ZodRecord,...o(z)})}}class qz extends _0{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(_){let{status:z,ctx:A}=this._processInputParams(_);if(A.parsedType!==k.map)return T(A,{code:j.invalid_type,expected:k.map,received:A.parsedType}),l;let b=this._def.keyType,G=this._def.valueType,J=[...A.data.entries()].map(([Y,X],Q)=>{return{key:b._parse(new g9(A,Y,A.path,[Q,"key"])),value:G._parse(new g9(A,X,A.path,[Q,"value"]))}});if(A.common.async){let Y=new Map;return Promise.resolve().then(async()=>{for(let X of J){let Q=await X.key,$=await X.value;if(Q.status==="aborted"||$.status==="aborted")return l;if(Q.status==="dirty"||$.status==="dirty")z.dirty();Y.set(Q.value,$.value)}return{status:z.value,value:Y}})}else{let Y=new Map;for(let X of J){let{key:Q,value:$}=X;if(Q.status==="aborted"||$.status==="aborted")return l;if(Q.status==="dirty"||$.status==="dirty")z.dirty();Y.set(Q.value,$.value)}return{status:z.value,value:Y}}}}qz.create=(_,z,A)=>{return new qz({valueType:z,keyType:_,typeName:p.ZodMap,...o(A)})};class U_ extends _0{_parse(_){let{status:z,ctx:A}=this._processInputParams(_);if(A.parsedType!==k.set)return T(A,{code:j.invalid_type,expected:k.set,received:A.parsedType}),l;let b=this._def;if(b.minSize!==null){if(A.data.size<b.minSize.value)T(A,{code:j.too_small,minimum:b.minSize.value,type:"set",inclusive:!0,exact:!1,message:b.minSize.message}),z.dirty()}if(b.maxSize!==null){if(A.data.size>b.maxSize.value)T(A,{code:j.too_big,maximum:b.maxSize.value,type:"set",inclusive:!0,exact:!1,message:b.maxSize.message}),z.dirty()}let G=this._def.valueType;function J(X){let Q=new Set;for(let $ of X){if($.status==="aborted")return l;if($.status==="dirty")z.dirty();Q.add($.value)}return{status:z.value,value:Q}}let Y=[...A.data.values()].map((X,Q)=>G._parse(new g9(A,X,A.path,Q)));if(A.common.async)return Promise.all(Y).then((X)=>J(X));else return J(Y)}min(_,z){return new U_({...this._def,minSize:{value:_,message:v.toString(z)}})}max(_,z){return new U_({...this._def,maxSize:{value:_,message:v.toString(z)}})}size(_,z){return this.min(_,z).max(_,z)}nonempty(_){return this.min(1,_)}}U_.create=(_,z)=>{return new U_({valueType:_,minSize:null,maxSize:null,typeName:p.ZodSet,...o(z)})};class s_ extends _0{constructor(){super(...arguments);this.validate=this.implement}_parse(_){let{ctx:z}=this._processInputParams(_);if(z.parsedType!==k.function)return T(z,{code:j.invalid_type,expected:k.function,received:z.parsedType}),l;function A(Y,X){return Bz({data:Y,path:z.path,errorMaps:[z.common.contextualErrorMap,z.schemaErrorMap,i_(),M4].filter((Q)=>!!Q),issueData:{code:j.invalid_arguments,argumentsError:X}})}function b(Y,X){return Bz({data:Y,path:z.path,errorMaps:[z.common.contextualErrorMap,z.schemaErrorMap,i_(),M4].filter((Q)=>!!Q),issueData:{code:j.invalid_return_type,returnTypeError:X}})}let G={errorMap:z.common.contextualErrorMap},J=z.data;if(this._def.returns instanceof D_){let Y=this;return d0(async function(...X){let Q=new J9([]),$=await Y._def.args.parseAsync(X,G).catch((Z)=>{throw Q.addIssue(A(X,Z)),Q}),H=await Reflect.apply(J,this,$);return await Y._def.returns._def.type.parseAsync(H,G).catch((Z)=>{throw Q.addIssue(b(H,Z)),Q})})}else{let Y=this;return d0(function(...X){let Q=Y._def.args.safeParse(X,G);if(!Q.success)throw new J9([A(X,Q.error)]);let $=Reflect.apply(J,this,Q.data),H=Y._def.returns.safeParse($,G);if(!H.success)throw new J9([b($,H.error)]);return H.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(..._){return new s_({...this._def,args:J4.create(_).rest(d4.create())})}returns(_){return new s_({...this._def,returns:_})}implement(_){return this.parse(_)}strictImplement(_){return this.parse(_)}static create(_,z,A){return new s_({args:_?_:J4.create([]).rest(d4.create()),returns:z||d4.create(),typeName:p.ZodFunction,...o(A)})}}class b1 extends _0{get schema(){return this._def.getter()}_parse(_){let{ctx:z}=this._processInputParams(_);return this._def.getter()._parse({data:z.data,path:z.path,parent:z})}}b1.create=(_,z)=>{return new b1({getter:_,typeName:p.ZodLazy,...o(z)})};class G1 extends _0{_parse(_){if(_.data!==this._def.value){let z=this._getOrReturnCtx(_);return T(z,{received:z.data,code:j.invalid_literal,expected:this._def.value}),l}return{status:"valid",value:_.data}}get value(){return this._def.value}}G1.create=(_,z)=>{return new G1({value:_,typeName:p.ZodLiteral,...o(z)})};function PY(_,z){return new i4({values:_,typeName:p.ZodEnum,...o(z)})}class i4 extends _0{_parse(_){if(typeof _.data!=="string"){let z=this._getOrReturnCtx(_),A=this._def.values;return T(z,{expected:z0.joinValues(A),received:z.parsedType,code:j.invalid_type}),l}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(_.data)){let z=this._getOrReturnCtx(_),A=this._def.values;return T(z,{received:z.data,code:j.invalid_enum_value,options:A}),l}return d0(_.data)}get options(){return this._def.values}get enum(){let _={};for(let z of this._def.values)_[z]=z;return _}get Values(){let _={};for(let z of this._def.values)_[z]=z;return _}get Enum(){let _={};for(let z of this._def.values)_[z]=z;return _}extract(_,z=this._def){return i4.create(_,{...this._def,...z})}exclude(_,z=this._def){return i4.create(this.options.filter((A)=>!_.includes(A)),{...this._def,...z})}}i4.create=PY;class J1 extends _0{_parse(_){let z=z0.getValidEnumValues(this._def.values),A=this._getOrReturnCtx(_);if(A.parsedType!==k.string&&A.parsedType!==k.number){let b=z0.objectValues(z);return T(A,{expected:z0.joinValues(b),received:A.parsedType,code:j.invalid_type}),l}if(!this._cache)this._cache=new Set(z0.getValidEnumValues(this._def.values));if(!this._cache.has(_.data)){let b=z0.objectValues(z);return T(A,{received:A.data,code:j.invalid_enum_value,options:b}),l}return d0(_.data)}get enum(){return this._def.values}}J1.create=(_,z)=>{return new J1({values:_,typeName:p.ZodNativeEnum,...o(z)})};class D_ extends _0{unwrap(){return this._def.type}_parse(_){let{ctx:z}=this._processInputParams(_);if(z.parsedType!==k.promise&&z.common.async===!1)return T(z,{code:j.invalid_type,expected:k.promise,received:z.parsedType}),l;let A=z.parsedType===k.promise?z.data:Promise.resolve(z.data);return d0(A.then((b)=>{return this._def.type.parseAsync(b,{path:z.path,errorMap:z.common.contextualErrorMap})}))}}D_.create=(_,z)=>{return new D_({type:_,typeName:p.ZodPromise,...o(z)})};class f9 extends _0{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===p.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(_){let{status:z,ctx:A}=this._processInputParams(_),b=this._def.effect||null,G={addIssue:(J)=>{if(T(A,J),J.fatal)z.abort();else z.dirty()},get path(){return A.path}};if(G.addIssue=G.addIssue.bind(G),b.type==="preprocess"){let J=b.transform(A.data,G);if(A.common.async)return Promise.resolve(J).then(async(Y)=>{if(z.value==="aborted")return l;let X=await this._def.schema._parseAsync({data:Y,path:A.path,parent:A});if(X.status==="aborted")return l;if(X.status==="dirty")return q_(X.value);if(z.value==="dirty")return q_(X.value);return X});else{if(z.value==="aborted")return l;let Y=this._def.schema._parseSync({data:J,path:A.path,parent:A});if(Y.status==="aborted")return l;if(Y.status==="dirty")return q_(Y.value);if(z.value==="dirty")return q_(Y.value);return Y}}if(b.type==="refinement"){let J=(Y)=>{let X=b.refinement(Y,G);if(A.common.async)return Promise.resolve(X);if(X instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return Y};if(A.common.async===!1){let Y=this._def.schema._parseSync({data:A.data,path:A.path,parent:A});if(Y.status==="aborted")return l;if(Y.status==="dirty")z.dirty();return J(Y.value),{status:z.value,value:Y.value}}else return this._def.schema._parseAsync({data:A.data,path:A.path,parent:A}).then((Y)=>{if(Y.status==="aborted")return l;if(Y.status==="dirty")z.dirty();return J(Y.value).then(()=>{return{status:z.value,value:Y.value}})})}if(b.type==="transform")if(A.common.async===!1){let J=this._def.schema._parseSync({data:A.data,path:A.path,parent:A});if(!p4(J))return l;let Y=b.transform(J.value,G);if(Y instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:z.value,value:Y}}else return this._def.schema._parseAsync({data:A.data,path:A.path,parent:A}).then((J)=>{if(!p4(J))return l;return Promise.resolve(b.transform(J.value,G)).then((Y)=>({status:z.value,value:Y}))});z0.assertNever(b)}}f9.create=(_,z,A)=>{return new f9({schema:_,typeName:p.ZodEffects,effect:z,...o(A)})};f9.createWithPreprocess=(_,z,A)=>{return new f9({schema:z,effect:{type:"preprocess",transform:_},typeName:p.ZodEffects,...o(A)})};class y9 extends _0{_parse(_){if(this._getType(_)===k.undefined)return d0(void 0);return this._def.innerType._parse(_)}unwrap(){return this._def.innerType}}y9.create=(_,z)=>{return new y9({innerType:_,typeName:p.ZodOptional,...o(z)})};class w4 extends _0{_parse(_){if(this._getType(_)===k.null)return d0(null);return this._def.innerType._parse(_)}unwrap(){return this._def.innerType}}w4.create=(_,z)=>{return new w4({innerType:_,typeName:p.ZodNullable,...o(z)})};class Y1 extends _0{_parse(_){let{ctx:z}=this._processInputParams(_),A=z.data;if(z.parsedType===k.undefined)A=this._def.defaultValue();return this._def.innerType._parse({data:A,path:z.path,parent:z})}removeDefault(){return this._def.innerType}}Y1.create=(_,z)=>{return new Y1({innerType:_,typeName:p.ZodDefault,defaultValue:typeof z.default==="function"?z.default:()=>z.default,...o(z)})};class X1 extends _0{_parse(_){let{ctx:z}=this._processInputParams(_),A={...z,common:{...z.common,issues:[]}},b=this._def.innerType._parse({data:A.data,path:A.path,parent:{...A}});if(o_(b))return b.then((G)=>{return{status:"valid",value:G.status==="valid"?G.value:this._def.catchValue({get error(){return new J9(A.common.issues)},input:A.data})}});else return{status:"valid",value:b.status==="valid"?b.value:this._def.catchValue({get error(){return new J9(A.common.issues)},input:A.data})}}removeCatch(){return this._def.innerType}}X1.create=(_,z)=>{return new X1({innerType:_,typeName:p.ZodCatch,catchValue:typeof z.catch==="function"?z.catch:()=>z.catch,...o(z)})};class Wz extends _0{_parse(_){if(this._getType(_)!==k.nan){let A=this._getOrReturnCtx(_);return T(A,{code:j.invalid_type,expected:k.nan,received:A.parsedType}),l}return{status:"valid",value:_.data}}}Wz.create=(_)=>{return new Wz({typeName:p.ZodNaN,...o(_)})};var ZE=Symbol("zod_brand");class A6 extends _0{_parse(_){let{ctx:z}=this._processInputParams(_),A=z.data;return this._def.type._parse({data:A,path:z.path,parent:z})}unwrap(){return this._def.type}}class Vz extends _0{_parse(_){let{status:z,ctx:A}=this._processInputParams(_);if(A.common.async)return(async()=>{let G=await this._def.in._parseAsync({data:A.data,path:A.path,parent:A});if(G.status==="aborted")return l;if(G.status==="dirty")return z.dirty(),q_(G.value);else return this._def.out._parseAsync({data:G.value,path:A.path,parent:A})})();else{let b=this._def.in._parseSync({data:A.data,path:A.path,parent:A});if(b.status==="aborted")return l;if(b.status==="dirty")return z.dirty(),{status:"dirty",value:b.value};else return this._def.out._parseSync({data:b.value,path:A.path,parent:A})}}static create(_,z){return new Vz({in:_,out:z,typeName:p.ZodPipeline})}}class Q1 extends _0{_parse(_){let z=this._def.innerType._parse(_),A=(b)=>{if(p4(b))b.value=Object.freeze(b.value);return b};return o_(z)?z.then((b)=>A(b)):A(z)}unwrap(){return this._def.innerType}}Q1.create=(_,z)=>{return new Q1({innerType:_,typeName:p.ZodReadonly,...o(z)})};function OY(_,z){let A=typeof _==="function"?_(z):typeof _==="string"?{message:_}:_;return typeof A==="string"?{message:A}:A}function SY(_,z={},A){if(_)return V_.create().superRefine((b,G)=>{let J=_(b);if(J instanceof Promise)return J.then((Y)=>{if(!Y){let X=OY(z,b),Q=X.fatal??A??!0;G.addIssue({code:"custom",...X,fatal:Q})}});if(!J){let Y=OY(z,b),X=Y.fatal??A??!0;G.addIssue({code:"custom",...Y,fatal:X})}return});return V_.create()}var FE={object:S0.lazycreate},p;(function(_){_.ZodString="ZodString",_.ZodNumber="ZodNumber",_.ZodNaN="ZodNaN",_.ZodBigInt="ZodBigInt",_.ZodBoolean="ZodBoolean",_.ZodDate="ZodDate",_.ZodSymbol="ZodSymbol",_.ZodUndefined="ZodUndefined",_.ZodNull="ZodNull",_.ZodAny="ZodAny",_.ZodUnknown="ZodUnknown",_.ZodNever="ZodNever",_.ZodVoid="ZodVoid",_.ZodArray="ZodArray",_.ZodObject="ZodObject",_.ZodUnion="ZodUnion",_.ZodDiscriminatedUnion="ZodDiscriminatedUnion",_.ZodIntersection="ZodIntersection",_.ZodTuple="ZodTuple",_.ZodRecord="ZodRecord",_.ZodMap="ZodMap",_.ZodSet="ZodSet",_.ZodFunction="ZodFunction",_.ZodLazy="ZodLazy",_.ZodLiteral="ZodLiteral",_.ZodEnum="ZodEnum",_.ZodEffects="ZodEffects",_.ZodNativeEnum="ZodNativeEnum",_.ZodOptional="ZodOptional",_.ZodNullable="ZodNullable",_.ZodDefault="ZodDefault",_.ZodCatch="ZodCatch",_.ZodPromise="ZodPromise",_.ZodBranded="ZodBranded",_.ZodPipeline="ZodPipeline",_.ZodReadonly="ZodReadonly"})(p||(p={}));var KE=(_,z={message:`Input not instance of ${_.name}`})=>SY((A)=>A instanceof _,z),kY=C9.create,IY=r4.create,qE=Wz.create,WE=n4.create,xY=t_.create,VE=W_.create,UE=Zz.create,DE=e_.create,ME=_1.create,NE=V_.create,wE=d4.create,EE=G4.create,OE=Fz.create,LE=v9.create,jE=S0.create,RE=S0.strictCreate,PE=z1.create,SE=z6.create,kE=A1.create,IE=J4.create,xE=Kz.create,TE=qz.create,CE=U_.create,vE=s_.create,yE=b1.create,gE=G1.create,fE=i4.create,hE=J1.create,mE=D_.create,uE=f9.create,cE=y9.create,lE=w4.create,pE=f9.createWithPreprocess,dE=Vz.create,rE=()=>kY().optional(),nE=()=>IY().optional(),iE=()=>xY().optional(),oE={string:(_)=>C9.create({..._,coerce:!0}),number:(_)=>r4.create({..._,coerce:!0}),boolean:(_)=>t_.create({..._,coerce:!0}),bigint:(_)=>n4.create({..._,coerce:!0}),date:(_)=>W_.create({..._,coerce:!0})};var aE=l;var TY=U.object({sha256:U.string(),mediaType:U.string()}),sE=U.object({type:U.literal("user"),text:U.string(),images:U.array(TY).optional(),id:U.string().optional(),timestamp:U.string().optional()}),tE=U.object({type:U.literal("compaction-summary"),text:U.string(),id:U.string().optional(),timestamp:U.string().optional()}),eE=U.object({type:U.literal("command"),name:U.string(),args:U.string().optional(),output:U.string().optional(),id:U.string().optional(),timestamp:U.string().optional()}),_O=U.object({type:U.literal("agent"),text:U.string(),id:U.string().optional(),timestamp:U.string().optional(),model:U.string().optional()}),zO=U.object({type:U.literal("thinking"),text:U.string(),id:U.string().optional(),timestamp:U.string().optional(),model:U.string().optional()}),CY=U.object({type:U.literal("tool-call"),toolName:U.string().nullable(),input:U.unknown().optional(),output:U.unknown().optional(),images:U.array(TY).optional(),error:U.string().optional(),isError:U.union([U.boolean(),U.string()]).optional(),id:U.string().optional(),timestamp:U.string().optional(),model:U.string().optional()}),Y0=U.discriminatedUnion("type",[sE,tE,eE,_O,zO,CY]),K5=U.object({inputTokens:U.number(),cachedInputTokens:U.number(),outputTokens:U.number(),reasoningOutputTokens:U.number(),totalTokens:U.number()}),Y4=CY,AO=Y4.extend({toolName:U.literal("Write"),input:U.object({file_path:U.string(),content:U.string().optional()}).passthrough().optional(),output:U.object({type:U.string().optional()}).passthrough().optional()}),bO=Y4.extend({toolName:U.literal("Read"),input:U.object({file_path:U.string()}).passthrough().optional(),output:U.union([U.string(),U.object({type:U.string().optional(),file:U.object({content:U.string().optional(),numLines:U.number().optional(),startLine:U.number().optional(),totalLines:U.number().optional()}).passthrough().optional()}).passthrough()]).optional()}),GO=Y4.extend({toolName:U.literal("Edit"),input:U.object({file_path:U.string(),diff:U.string().optional()}).passthrough().optional(),output:U.union([U.string(),U.object({userModified:U.boolean().optional()}).passthrough()]).optional()}),vY=U.object({filenames:U.array(U.string()),durationMs:U.number().optional(),truncated:U.boolean().optional()}).passthrough(),JO=Y4.extend({toolName:U.literal("Glob"),input:U.object({pattern:U.string().optional()}).passthrough().optional(),output:vY.optional()}),YO=Y4.extend({toolName:U.literal("Grep"),input:U.unknown().optional(),output:vY.extend({mode:U.string().optional(),numMatches:U.number().optional()}).passthrough().optional()}),XO=Y4.extend({toolName:U.literal("Bash"),input:U.object({command:U.string(),description:U.string().optional()}).passthrough().optional(),output:U.union([U.string(),U.object({stdout:U.string().optional(),stderr:U.string().optional(),interrupted:U.boolean().optional(),isImage:U.boolean().optional()}).passthrough()]).optional()}),QO=Y4.extend({toolName:U.literal("BashOutput"),input:U.object({bash_id:U.string().optional()}).passthrough().optional(),output:U.object({command:U.string().optional(),exitCode:U.number().optional(),shellId:U.string().optional(),status:U.string().optional(),stderr:U.string().optional(),stdout:U.string().optional(),timestamp:U.string().optional()}).passthrough().optional()}),$O=Y4.extend({toolName:U.literal("Task"),input:U.unknown().optional(),output:U.object({status:U.string().optional(),totalDurationMs:U.number().optional(),totalToolUseCount:U.number().optional(),content:U.array(U.object({type:U.string().optional(),text:U.string().optional()}).passthrough()).optional(),usage:K5.optional()}).passthrough().optional()}),F5=U.object({content:U.string(),status:U.string().optional()}).passthrough(),HO=Y4.extend({toolName:U.literal("TodoWrite"),input:U.object({todos:U.array(F5).optional()}).passthrough().optional(),output:U.object({oldTodos:U.array(F5).optional(),newTodos:U.array(F5).optional()}).passthrough().optional()}),BO=[AO,bO,GO,JO,YO,XO,QO,$O,HO],ZO=Y4,yY=U.union([...BO,ZO]),M_=U.object({model:U.string(),usage:K5}),t0=U.object({relativeCwd:U.string().nullable(),branch:U.string().nullable(),repo:U.string().nullable()}).strict().nullable(),o4=U.object({v:U.literal(1),id:U.string(),source:U.enum(["claude-code","codex","opencode","pi","unknown"]),timestamp:U.coerce.date(),preview:U.string().nullable(),summary:U.string().nullable().default(null),model:U.string().nullable(),clientVersion:U.string().nullable(),blendedTokens:U.number(),costUsd:U.number(),messageCount:U.number(),toolCount:U.number(),userMessageCount:U.number(),filesChanged:U.number(),linesAdded:U.number().default(0),linesRemoved:U.number().default(0),linesModified:U.number().default(0),tokenUsage:K5,modelUsage:U.array(M_),git:t0,cwd:U.string().nullable(),messages:U.array(Y0)});import{appendFileSync as UO,mkdirSync as DO}from"fs";import{dirname as MO}from"path";import{existsSync as FO,readFileSync as KO}from"fs";import{homedir as qO}from"os";import{dirname as gY,resolve as q5}from"path";function WO(){let z=process.env.VI_CLI_PATH;if(z?.startsWith("bun "))z=z.slice(4);let A=z?gY(z):process.cwd(),b=10,G=0;while(G<b){let J=q5(A,"package.json");if(FO(J))try{if(JSON.parse(KO(J,"utf-8")).workspaces)return A}catch{}let Y=gY(A);if(Y===A)break;A=Y,G++}return null}function VO(){let _=WO();return _?q5(_,"logs"):null}function b6(){let _=VO();return _?q5(_,"dev.log"):null}function h9(_){let z=qO();if(_.startsWith(z))return _.replace(z,"~");let A=/^(\/Users\/[^/]+|\/home\/[^/]+)/;return _.replace(A,"~")}function Uz(_){if(_==="."||_===null)return"";return _}function M9(_,z){if(!z)return _;let A=z.endsWith("/")?z:`${z}/`,b=A.slice(0,-1),G=(Y)=>typeof Y==="object"&&Y!==null&&!Array.isArray(Y),J=(Y)=>{if(typeof Y==="string"){if(Y.includes(A))return Y.replaceAll(A,"./");if(Y.includes(b))return Y.replaceAll(b,".");return Y}if(Array.isArray(Y))return Y.map(J);if(G(Y)){let X={};for(let[Q,$]of Object.entries(Y))X[Q]=J($);return X}return Y};return J(_)}var fY=!1;function NO(_){if(_===void 0||_===null)return _;if(process.env.DEBUG_PAYLOADS!=="true"){if(!fY)return fY=!0,"[payload logging disabled - set DEBUG_PAYLOADS=true to enable]";return}if(typeof _==="object"){let A=JSON.stringify(_),b=Math.round(A.length/1024),G=A.includes('"isImage":true')||A.includes('"isImage": true')||A.length>1e4&&/[A-Za-z0-9+/]{100,}/.test(A);if(G||A.length>1e4)return`[payload: ${b}KB${G?", contains binary data":""}]`}return _}class hY{component;logToFile;logFilePath;disableConsole;constructor(_){this.component=_.component,this.disableConsole=_.disableConsole??!1;let z=typeof process<"u"&&!!process.versions?.node;if(this.logToFile=_.logToFile??(z&&!1),z&&this.logToFile){let A=b6(),b=_.logFilePath??A;if(b)this.logFilePath=b;else this.logToFile=!1,this.logFilePath=""}else this.logFilePath="",this.logToFile=!1;if(process.env.DEBUG)console.log(`[${this.component}] Logger config:`,{logToFile:this.logToFile,logFilePath:this.logFilePath,cwd:process.cwd(),NODE_ENV:"production"});if(this.logToFile)try{let A=MO(this.logFilePath);DO(A,{recursive:!0})}catch(A){if(process.env.DEBUG)console.error(`[${this.component}] Failed to create logs directory:`,A)}}log(_,z,A){let b=new Date,J=`[${`${String(b.getMonth()+1).padStart(2,"0")}-${String(b.getDate()).padStart(2,"0")} ${String(b.getHours()).padStart(2,"0")}:${String(b.getMinutes()).padStart(2,"0")}:${String(b.getSeconds()).padStart(2,"0")}`}] [${this.component}] [${_}] ${z}`,Y=_==="ERROR"?console.error:_==="WARN"?console.warn:console.log,X=NO(A);if(!this.disableConsole){if(Y(J),X!==void 0){let Q=typeof X==="object"?JSON.stringify(X,null,2):String(X);Y(` ${Q}`)}}if(this.logToFile)try{let Q=J+`
52
52
  `;if(X!==void 0){let $=typeof X==="object"?JSON.stringify(X):String(X);Q+=` ${$}
53
- `}FO(this.logFilePath,Q)}catch{}}debug(_,z){if(process.env.DEBUG)this.log("DEBUG",_,z)}info(_,z){this.log("INFO",_,z)}warn(_,z){this.log("WARN",_,z)}error(_,z){this.log("ERROR",_,z)}}function mY(_,z){return new hY({component:_,...z})}import{execSync as VO}from"child_process";import{resolve as UO}from"path";var DO="http://localhost:3000",MO=1e4;async function NO(_,z,A){try{return(await fetch(`${z}/api/blobs/${_}`,{method:"HEAD",headers:{...A&&{Authorization:`Bearer ${A}`}},signal:AbortSignal.timeout(5000)})).ok}catch{return!1}}async function wO(_,z,A){if(!_||_.length===0)return;let G=(await Promise.all(_.map(async(J)=>({blob:J,exists:await NO(J.sha256,z,A)})))).filter((J)=>!J.exists).map((J)=>J.blob);return G.length>0?G:void 0}async function K5(_,z={}){let A=z.serverUrl??process.env.VI_SERVER_URL??DO,b=z.authToken??null,G=z.timeoutMs??MO,J=await wO(_.blobs,A,b),Y=new FormData,X=`${_.unifiedTranscript.id||"transcript"}.jsonl`;if(_.id)Y.set("id",_.id);if(Y.set("sha256",_.sha256),Y.set("unifiedTranscript",JSON.stringify(_.unifiedTranscript)),_.visibility)Y.set("visibility",_.visibility);if(Y.set("transcript",new Blob([_.rawTranscript],{type:"application/jsonl"}),X),J)for(let Q of J){let $=Q.data.buffer.slice(Q.data.byteOffset,Q.data.byteOffset+Q.data.byteLength);Y.append(`blob:${Q.sha256}`,new Blob([$],{type:Q.mediaType}),`${Q.sha256}.blob`)}try{let Q=await fetch(`${A}/api/ingest`,{method:"POST",headers:{...b&&{Authorization:`Bearer ${b}`}},body:Y,signal:AbortSignal.timeout(G)});if(!Q.ok)return console.error(`Upload failed: ${Q.status} ${Q.statusText}`),{success:!1};let $=await Q.json();if(EO($))return{success:!0,id:$.id,transcriptId:$.transcriptId};return console.error("Upload succeeded but response had unexpected shape:",$),{success:!1}}catch(Q){if(Q instanceof Error)console.error("Upload error:",Q.message);return{success:!1}}}function EO(_){if(typeof _!=="object"||_===null)return!1;let z=_;return typeof z.success==="boolean"&&(z.success===!1||typeof z.id==="string"&&typeof z.transcriptId==="string")&&(z.eventsReceived===void 0||typeof z.eventsReceived==="number")}function uY(_){let z=UO(_),A=f9(z);try{let b=VO("git remote get-url origin",{cwd:z,encoding:"utf8",timeout:2000,stdio:["pipe","pipe","ignore"]}).trim(),G=OO(b),J=G.split("/").pop()||"unknown";return{repoId:G,repoName:J,cwd:A}}catch{return{repoId:null,repoName:z.split("/").pop()||"unknown",cwd:A}}}function OO(_){let z=/^(?<user>[^@]+)@(?<host>[^:]+):(?<path>.+)$/,A=_.match(z);if(A?.groups)return`${A.groups.host}/${A.groups.path.replace(/\.git$/i,"")}`;try{let b=new URL(_),G=b.pathname.replace(/\.git$/i,"").replace(/^\//,"");return`${b.host}/${G}`}catch{return _.replace(/\.git$/i,"")}}import LO from"node:crypto";import cY from"node:fs/promises";import jO from"node:path";var RO=200000,PO=["anthropic/","claude-3-5-","claude-3-","claude-","openai/","azure/","openrouter/openai/"],rY=new Set(["[request interrupted by user]","[request aborted by user]","[request cancelled by user]"]),SO=new Set(["/clear"]),kO=/^<\/?(?:command|local)-[a-z-]+>/i,nY=/^[α-ωΑ-Ω]\s/i,IO=/<command-name>(.*?)<\/command-name>/s,xO=/<command-args>(.*?)<\/command-args>/s,TO=/^<local-command-stdout>(.*)<\/local-command-stdout>$/s,CO=/<system-reminder>[\s\S]*?<\/system-reminder>/g,iY=["npm ","npm:","npm error","node:","node.js","error:","fatal:","warning:","traceback (most recent call last):","usage:","hint:","note:","code:","requirestack"],vO=new RegExp("\\b("+["fix","please","should","update","change","add","remove","create","write","implement","refactor","investigate","explain","help","why","what","how","need","ensure","make","build","let's","optimize","review","check"].join("|")+")\\b","i"),yO=3;function N_(_){let z=0,A=0,b=0,G=0,J=0,Y=new Set;for(let X of _)if(X.type==="user")A++;else if(X.type==="tool-call"){if(z++,X.isError||X.error)continue;let{toolName:Q,input:$,output:H}=X;if($&&typeof $.file_path==="string"){if(Q==="Edit"||Q==="Write")Y.add($.file_path)}if(Q==="Write"&&$&&typeof $.content==="string"){let Z=$.content.split(`
53
+ `}UO(this.logFilePath,Q)}catch{}}debug(_,z){if(process.env.DEBUG)this.log("DEBUG",_,z)}info(_,z){this.log("INFO",_,z)}warn(_,z){this.log("WARN",_,z)}error(_,z){this.log("ERROR",_,z)}}function mY(_,z){return new hY({component:_,...z})}import{execSync as wO}from"child_process";import{resolve as EO}from"path";var OO="http://localhost:3000",LO=1e4;async function jO(_,z,A){try{return(await fetch(`${z}/api/blobs/${_}`,{method:"HEAD",headers:{...A&&{Authorization:`Bearer ${A}`}},signal:AbortSignal.timeout(5000)})).ok}catch{return!1}}async function RO(_,z,A){if(!_||_.length===0)return;let G=(await Promise.all(_.map(async(J)=>({blob:J,exists:await jO(J.sha256,z,A)})))).filter((J)=>!J.exists).map((J)=>J.blob);return G.length>0?G:void 0}async function W5(_,z={}){let A=z.serverUrl??process.env.VI_SERVER_URL??OO,b=z.authToken??null,G=z.timeoutMs??LO,J=await RO(_.blobs,A,b),Y=new FormData,X=`${_.unifiedTranscript.id||"transcript"}.jsonl`;if(_.id)Y.set("id",_.id);if(Y.set("sha256",_.sha256),Y.set("unifiedTranscript",JSON.stringify(_.unifiedTranscript)),_.visibility)Y.set("visibility",_.visibility);if(Y.set("transcript",new Blob([_.rawTranscript],{type:"application/jsonl"}),X),J)for(let Q of J){let $=Q.data.buffer.slice(Q.data.byteOffset,Q.data.byteOffset+Q.data.byteLength);Y.append(`blob:${Q.sha256}`,new Blob([$],{type:Q.mediaType}),`${Q.sha256}.blob`)}try{let Q=await fetch(`${A}/api/ingest`,{method:"POST",headers:{...b&&{Authorization:`Bearer ${b}`}},body:Y,signal:AbortSignal.timeout(G)});if(!Q.ok)return console.error(`Upload failed: ${Q.status} ${Q.statusText}`),{success:!1};let $=await Q.json();if(PO($))return{success:!0,id:$.id,transcriptId:$.transcriptId};return console.error("Upload succeeded but response had unexpected shape:",$),{success:!1}}catch(Q){if(Q instanceof Error)console.error("Upload error:",Q.message);return{success:!1}}}function PO(_){if(typeof _!=="object"||_===null)return!1;let z=_;return typeof z.success==="boolean"&&(z.success===!1||typeof z.id==="string"&&typeof z.transcriptId==="string")&&(z.eventsReceived===void 0||typeof z.eventsReceived==="number")}function uY(_){let z=EO(_),A=h9(z);try{let b=wO("git remote get-url origin",{cwd:z,encoding:"utf8",timeout:2000,stdio:["pipe","pipe","ignore"]}).trim(),G=SO(b),J=G.split("/").pop()||"unknown";return{repoId:G,repoName:J,cwd:A}}catch{return{repoId:null,repoName:z.split("/").pop()||"unknown",cwd:A}}}function SO(_){let z=/^(?<user>[^@]+)@(?<host>[^:]+):(?<path>.+)$/,A=_.match(z);if(A?.groups)return`${A.groups.host}/${A.groups.path.replace(/\.git$/i,"")}`;try{let b=new URL(_),G=b.pathname.replace(/\.git$/i,"").replace(/^\//,"");return`${b.host}/${G}`}catch{return _.replace(/\.git$/i,"")}}import kO from"node:crypto";import cY from"node:fs/promises";import IO from"node:path";var xO=200000,TO=["anthropic/","claude-3-5-","claude-3-","claude-","openai/","azure/","openrouter/openai/"],rY=new Set(["[request interrupted by user]","[request aborted by user]","[request cancelled by user]"]),CO=new Set(["/clear"]),vO=/^<\/?(?:command|local)-[a-z-]+>/i,nY=/^[α-ωΑ-Ω]\s/i,yO=/<command-name>(.*?)<\/command-name>/s,gO=/<command-args>(.*?)<\/command-args>/s,fO=/^<local-command-stdout>(.*)<\/local-command-stdout>$/s,hO=/<system-reminder>[\s\S]*?<\/system-reminder>/g,iY=["npm ","npm:","npm error","node:","node.js","error:","fatal:","warning:","traceback (most recent call last):","usage:","hint:","note:","code:","requirestack"],mO=new RegExp("\\b("+["fix","please","should","update","change","add","remove","create","write","implement","refactor","investigate","explain","help","why","what","how","need","ensure","make","build","let's","optimize","review","check"].join("|")+")\\b","i"),uO=3;function N_(_){let z=0,A=0,b=0,G=0,J=0,Y=new Set;for(let X of _)if(X.type==="user")A++;else if(X.type==="tool-call"){if(z++,X.isError||X.error)continue;let{toolName:Q,input:$,output:H}=X;if($&&typeof $.file_path==="string"){if(Q==="Edit"||Q==="Write")Y.add($.file_path)}if(Q==="Write"&&$&&typeof $.content==="string"){let Z=$.content.split(`
54
54
  `).length;b+=Z}let B=$?.diff??H?.diff;if(Q==="Edit"&&typeof B==="string"){let Z=0,F=0,K=B.split(`
55
- `);for(let W of K)if(W.startsWith("+")&&!W.startsWith("+++"))Z++;else if(W.startsWith("-")&&!W.startsWith("---"))F++;let q=Math.min(Z,F);b+=Z-q,G+=F-q,J+=q}}return{toolCount:z,userMessageCount:A,filesChanged:Y.size,linesAdded:b,linesRemoved:G,linesModified:J}}function A6(_,z={}){let A=gO(_);if(A.records.size===0)return null;let b=mO(A.records);if(b.length===0)return null;let G=b[b.length-1],J=uO(b),Y=lO(J),X=pO(J),Q=zL(Y),$=J.map((L)=>{let R=L.message?.usage;if(!R)return null;return{model:L.message?.model??null,usage:R}}).filter((L)=>L!==null),H=GL($,z.pricing),B=dO(b),Z=B.length>0?iO(B[0]):null,F=_X(G.timestamp)??z.now??new Date,K=sO(b),q=tO(X),W=W5(b),V=z.gitContext!==void 0?z.gitContext:aO(b),w=W?f9(W):"",{messages:O,blobs:M}=BL(b),P=N_(O),D={v:1,id:K??G.uuid,source:"claude-code",timestamp:F,preview:Z,summary:null,model:q,clientVersion:z.clientVersion??oO(b),blendedTokens:Q,costUsd:H,messageCount:O.length,...P,tokenUsage:Y,modelUsage:Array.from(X.entries()).map(([L,R])=>({model:aY(L),usage:R})),git:V,cwd:w,messages:O};return{transcript:o4.parse(D),blobs:M}}function gO(_){let z=new Map,A=new Map;for(let b of _){let G=typeof b.type==="string"?b.type:"";if(G==="summary")continue;let J=typeof b.uuid==="string"?b.uuid:null;if(!J)continue;let Y={uuid:J,type:G,timestamp:typeof b.timestamp==="string"?b.timestamp:void 0,parentUuid:typeof b.parentUuid==="string"||b.parentUuid===null?b.parentUuid:void 0,logicalParentUuid:typeof b.logicalParentUuid==="string"||b.logicalParentUuid===null?b.logicalParentUuid:void 0,isSidechain:Boolean(b.isSidechain),isMeta:Boolean(b.isMeta),isCompactSummary:Boolean(b.isCompactSummary),sessionId:typeof b.sessionId==="string"?b.sessionId:void 0,cwd:typeof b.cwd==="string"?b.cwd:void 0,gitBranch:typeof b.gitBranch==="string"?b.gitBranch:void 0,costUSD:typeof b.costUSD==="number"?b.costUSD:void 0,message:fO(b.message),raw:b};if(z.set(J,Y),Y.parentUuid){let X=A.get(Y.parentUuid)??new Set;X.add(J),A.set(Y.parentUuid,X)}}return{records:z,children:A}}function fO(_){if(!_||typeof _!=="object")return;let z=_,A=typeof z.id==="string"?z.id:void 0,b=typeof z.role==="string"?z.role:void 0,G=z.content,J=typeof z.model==="string"?z.model:void 0,Y=hO(z.usage);return{id:A,role:b,content:G,model:J,usage:Y}}function hO(_){if(!_||typeof _!=="object")return null;let z=_,A={};if(typeof z.input_tokens==="number")A.input_tokens=z.input_tokens;if(typeof z.cache_creation_input_tokens==="number")A.cache_creation_input_tokens=z.cache_creation_input_tokens;if(typeof z.cache_read_input_tokens==="number")A.cache_read_input_tokens=z.cache_read_input_tokens;if(typeof z.output_tokens==="number")A.output_tokens=z.output_tokens;if(typeof z.reasoning_output_tokens==="number")A.reasoning_output_tokens=z.reasoning_output_tokens;return Object.keys(A).length>0?A:null}function mO(_){let z=[];for(let A of _.values()){if(A.isSidechain)continue;z.push(A)}return z.sort((A,b)=>{let G=lY(A.timestamp)??0,J=lY(b.timestamp)??0;if(G!==J)return G-J;return A.uuid.localeCompare(b.uuid)}),z}function uO(_){let z=new Map;for(let A of _){if(A.type!=="assistant")continue;if(!A.message?.usage)continue;let G=cO(A);z.set(G,A)}return Array.from(z.values())}function cO(_){let z=_.message,A=pY(z?.id),b=pY(_.raw.requestId);if(A&&b)return`${A}:${b}`;if(A)return A;if(b)return b;return _.uuid}function lO(_){let z={inputTokens:0,cachedInputTokens:0,outputTokens:0,reasoningOutputTokens:0,totalTokens:0};for(let A of _){let b=A.message?.usage;if(!b)continue;let G=Y9(b.input_tokens),J=Y9(b.cache_creation_input_tokens),Y=Y9(b.cache_read_input_tokens),X=Y9(b.output_tokens),Q=Y9(b.reasoning_output_tokens);z.inputTokens+=G+J+Y,z.cachedInputTokens+=Y,z.outputTokens+=X,z.reasoningOutputTokens+=Q,z.totalTokens+=G+J+Y+X+Q}return z}function pO(_){let z=new Map;for(let A of _){let b=A.message?.model,G=A.message?.usage;if(!b||!G)continue;let J=z.get(b)??{inputTokens:0,cachedInputTokens:0,outputTokens:0,reasoningOutputTokens:0,totalTokens:0},Y=Y9(G.input_tokens),X=Y9(G.cache_creation_input_tokens),Q=Y9(G.cache_read_input_tokens),$=Y9(G.output_tokens),H=Y9(G.reasoning_output_tokens);J.inputTokens+=Y+X+Q,J.cachedInputTokens+=Q,J.outputTokens+=$,J.reasoningOutputTokens+=H,J.totalTokens+=Y+X+Q+$+H,z.set(b,J)}return z}function dO(_){let z=[];for(let A of _){if(!rO(A))continue;z.push(A)}return z}function rO(_){if(_.type!=="user")return!1;if(_.isSidechain)return!1;if(_.isMeta)return!1;let z=_.raw;if(z&&typeof z==="object"){if("toolUseResult"in z)return!1}let A=_.message?.content;if(Array.isArray(A)){if(A.some((J)=>nO(J)))return!1}let b=sY(_);if(!b)return!1;let G=b.toLowerCase();if(rY.has(G))return!1;if(oY(b))return!1;if(nY.test(b))return!1;if(iY.some((J)=>G.startsWith(J))){if(!eY(b))return!1}return!0}function nO(_){if(!_||typeof _!=="object")return!1;let z=_;if(z.type==="tool_result")return!0;if(typeof z.tool_use_id==="string")return!0;return!1}function oY(_){return kO.test(_)}function iO(_){let z=sY(_);if(!z)return null;return tY(z)}function W5(_){for(let z of _)if(z.cwd)return z.cwd;return}function oO(_){for(let z of _){let A=z.raw.version;if(typeof A==="string"&&A.length>0)return A}return null}function aO(_){let z=W5(_),A=_.find((J)=>J.gitBranch)?.gitBranch??null;if(!z)return t0.parse({relativeCwd:null,branch:A,repo:null});let b=z.split(/[\\/]+/).filter(Boolean);if(b.length===0)return t0.parse({relativeCwd:null,branch:A,repo:null});let G=b.findIndex((J)=>{let Y=J.toLowerCase();return Y.includes("github")||Y.includes("gitlab")||Y.includes("bitbucket")});if(G>=0){let J=b[G]?.toLowerCase()??"",Y=J.includes("gitlab")?"gitlab.com":J.includes("bitbucket")?"bitbucket.org":"github.com",X=b[G+1],Q=b[G+2]?.replace(/\.git$/i,"");if(X&&Q){let $=b.slice(G+3),H=$.length>0?$.join("/"):".";return t0.parse({relativeCwd:Wz(H),branch:A,repo:`${Y}/${X}/${Q}`})}}return t0.parse({relativeCwd:null,branch:A,repo:null})}async function e0(_,z){if(!_)return null;try{if(!(await cY.stat(_)).isDirectory())return t0.parse({relativeCwd:null,branch:z??null,repo:null})}catch{return t0.parse({relativeCwd:null,branch:z??null,repo:null})}let A=await Z8(_);if(!A)return t0.parse({relativeCwd:null,branch:z??null,repo:null});let b=jO.relative(A,_)||".",G=z??await ob(A),J=await F8(A);return t0.parse({relativeCwd:Wz(b),branch:G,repo:J})}function sO(_){for(let z of _){let A=typeof z.sessionId==="string"?z.sessionId.trim():"";if(A.length>0)return A}return null}function aY(_){if(_.includes("/"))return _;return`anthropic/${_}`}function tO(_){let z=null,A=-1;for(let[b,G]of _){let J=G.totalTokens>0?G.totalTokens:G.inputTokens+G.outputTokens;if(J>A)A=J,z=b}return z?aY(z):null}function sY(_){return eO(_.message)[0]??null}function eO(_){if(!_)return[];let z=_.content;if(typeof z==="string"){let A=q5(z);return A?[A]:[]}if(Array.isArray(z)){let A=[];for(let b of z){if(typeof b==="string"){let G=q5(b);if(G)A.push(G);continue}if(b&&typeof b==="object"){let G=b,J=["content","text"];for(let Y of J){let X=G[Y];if(typeof X==="string"){let Q=q5(X);if(Q)A.push(Q)}}}}return A}return[]}function q5(_,z=yO){let A=_L(_);if(A.length===0)return null;let G=A.slice(0,z).join(" "),J=tY(G);return J.length>0?J:null}function _L(_){let z=[];for(let A of _.split(/\r?\n/)){let b=A.trim();if(!b)continue;let G=b.toLowerCase();if(rY.has(G))continue;if(oY(b))continue;if(nY.test(b))continue;if(iY.some((J)=>G.startsWith(J))){if(!eY(b))continue}if(!/[a-z]/i.test(b)&&!/\d/.test(b))continue;z.push(b)}return z}function tY(_){return _.replace(/\s+/g," ").trim()}function eY(_){let z=_.toLowerCase();if(vO.test(z))return!0;if(z.includes("?"))return!0;return["can you","can we","could you","could we","would you","would we","should we","should i","let's","let us"].some((b)=>z.includes(b))}function zL(_){return Math.max(0,_.inputTokens-_.cachedInputTokens)+_.outputTokens+_.reasoningOutputTokens}function _X(_){if(!_)return null;let z=new Date(_);return Number.isNaN(z.getTime())?null:z}function lY(_){let z=_X(_);return z?z.getTime():null}function Y9(_){return typeof _==="number"&&Number.isFinite(_)?_:0}function pY(_){if(typeof _!=="string")return;let z=_.trim();return z.length>0?z:void 0}function AL(_){return LO.createHash("sha256").update(_).digest("hex")}function z6(_,z){if(_===null||_===void 0)return _;if(Array.isArray(_))return _.map((A)=>z6(A,z));if(typeof _==="object"){let A=_;if(A.type==="image"&&A.source&&typeof A.source==="object"){let G=A.source;if(typeof G.data==="string"&&G.data.length>0){let J=G.data,Y=typeof G.mediaType==="string"?G.mediaType:typeof G.media_type==="string"?G.media_type:"image/unknown",X=Buffer.from(J,"base64"),Q=AL(X);if(!z.has(Q))z.set(Q,{data:X,mediaType:Y});return{type:"image",source:{type:"sha256",mediaType:Y,sha256:Q}}}}let b={};for(let[G,J]of Object.entries(A))b[G]=z6(J,z);return b}return _}function bL(_){let z=[];function A(b){if(b===null||b===void 0)return;if(Array.isArray(b)){for(let G of b)A(G);return}if(typeof b==="object"){let G=b;if(G.type==="image"&&G.source&&typeof G.source==="object"){let J=G.source;if(J.type==="sha256"&&typeof J.sha256==="string"){z.push({sha256:J.sha256,mediaType:typeof J.mediaType==="string"?J.mediaType:"image/unknown"});return}}for(let J of Object.values(G))A(J)}}return A(_),z}function GL(_,z){if(!z||Object.keys(z).length===0)return 0;let A=0;for(let b of _){let G=b.model;if(!G)continue;let J=JL(G,z);if(!J)continue;let Y=YL({input_tokens:Y9(b.usage.input_tokens),output_tokens:Y9(b.usage.output_tokens),cache_creation_input_tokens:Y9(b.usage.cache_creation_input_tokens),cache_read_input_tokens:Y9(b.usage.cache_read_input_tokens)},J);A+=Y}return A}function JL(_,z){let A=_.trim();if(!A)return null;let b=new Set;b.add(A);for(let J of PO)b.add(`${J}${A}`);for(let J of b){let Y=z[J];if(Y)return Y}let G=A.toLowerCase();for(let[J,Y]of Object.entries(z)){let X=J.toLowerCase();if(X.includes(G)||G.includes(X))return Y}return null}function YL(_,z){let A=(X,Q,$,H=RO)=>{if(X==null||X<=0)return 0;if(X>H&&$!=null){let B=Math.min(X,H),F=Math.max(0,X-H)*$;if(Q!=null)F+=B*Q;return F}if(Q!=null)return X*Q;return 0},b=A(_.input_tokens,z.input_cost_per_token,z.input_cost_per_token_above_200k_tokens),G=A(_.output_tokens,z.output_cost_per_token,z.output_cost_per_token_above_200k_tokens),J=A(_.cache_creation_input_tokens,z.cache_creation_input_token_cost,z.cache_creation_input_token_cost_above_200k_tokens),Y=A(_.cache_read_input_tokens,z.cache_read_input_token_cost,z.cache_read_input_token_cost_above_200k_tokens);return b+G+J+Y}function XL(_){let z=_.match(IO);if(!z)return null;let A=z[1].trim(),G=_.match(xO)?.[1]?.trim()||void 0;return{name:A,args:G||void 0}}function QL(_){let z=_.trim().match(TO);if(!z)return null;return z[1]}function $L(_){return _.replace(CO,"").trim()}function HL(_){return _.replace(/\x1B\[[0-9;]*m/g,"")}function BL(_){let z=[],A=new Map,b=new Map,G=null,J=!1,Y=new Map,X=new Set,Q=W5(_);for(let $ of _){if($.isMeta)continue;let H=FL($),B=$.type;if(B==="user"){let{texts:Z,images:F,toolResults:K}=ZL($,A);for(let q of Z){if(!q.trim())continue;let W=QL(q);if(W!==null){if(J){J=!1;continue}if(G){let M=HL(W).trim();z.push(Y0.parse({type:"command",name:G.name,args:G.args,output:M||void 0,id:G.id,timestamp:G.timestamp})),G=null}continue}let V=XL(q);if(V){if(SO.has(V.name)){J=!0;continue}if(G)z.push(Y0.parse({type:"command",name:G.name,args:G.args,id:G.id,timestamp:G.timestamp}));G={name:V.name,args:V.args,id:$.uuid,timestamp:H.timestamp};continue}let w=$L(q);if(!w)continue;let O=$.isCompactSummary?"compaction-summary":"user";if(O==="user"){let M=`${H.timestamp}:${w}`,P=Y.get(M);if(P){if(!P.hasImages&&F.length>0){let R=z[P.index];R.images=F,P.hasImages=!0}continue}let D={type:O,text:w,id:$.uuid,timestamp:H.timestamp};if(F.length>0)D.images=F;let L=z.length;z.push(Y0.parse(D)),Y.set(M,{index:L,hasImages:F.length>0})}else{let M={type:O,text:w,id:$.uuid,timestamp:H.timestamp};z.push(Y0.parse(M))}}for(let q of K){let W=q.callId?b.get(q.callId):void 0;if(W){let V=z[W.index],w=z6(q.output,A);V.output=w;let O=bL(w);if(O.length>0)V.images=O;if(q.error)V.error=q.error;if(typeof q.isError<"u")V.isError=q.isError;let M=dY(V,Q);z[W.index]=M}}continue}if(B==="assistant"){let Z=$.message?.content;if(!Array.isArray(Z))continue;for(let F of Z){if(!F||typeof F!=="object")continue;let K=F;if(K.type==="thinking"&&typeof K.thinking==="string"){let q=`thinking:${H.id}:${H.timestamp}:${K.thinking}`;if(X.has(q))continue;X.add(q),z.push(Y0.parse({type:"thinking",text:K.thinking,...H}));continue}if(K.type==="text"&&typeof K.text==="string"){let q=`agent:${H.id}:${H.timestamp}:${K.text}`;if(X.has(q))continue;X.add(q),z.push(Y0.parse({type:"agent",text:K.text,...H}));continue}if(K.type==="tool_use"){let q=typeof K.id==="string"?K.id:"",W=typeof K.name==="string"?K.name:null,V=K.input??void 0,w={type:"tool-call",toolName:W,...H,input:V},O=Y0.parse(w),M=dY(O,Q);if(z.push(M),q)b.set(q,{index:z.length-1,toolName:W});continue}if(K.type==="image")continue}}}if(G)z.push(Y0.parse({type:"command",name:G.name,args:G.args,id:G.id,timestamp:G.timestamp}));return{messages:z,blobs:A}}function ZL(_,z){let A=_.message;if(!A)return{texts:[],images:[],toolResults:[]};let b=A.content;if(typeof b==="string")return b?{texts:[b],images:[],toolResults:[]}:{texts:[],images:[],toolResults:[]};if(!Array.isArray(b))return{texts:[],images:[],toolResults:[]};let G=[],J=[],Y=[];for(let X of b){if(!X||typeof X!=="object")continue;if(typeof X==="string"){if(X)G.push(X);continue}let Q=X,$=typeof Q.type==="string"?Q.type:void 0;if($==="tool_result"){let H=Q,B=typeof H.tool_use_id==="string"?H.tool_use_id:void 0,Z=H.content,F=_.raw.toolUseResult??_.raw.tool_use_result;if(F)Z=F;let K=typeof H.error==="string"?H.error:void 0,q=H.is_error??H.isError,W=typeof q==="boolean"?q:typeof H.success==="boolean"?!H.success:void 0;Y.push({callId:B,output:Z,error:K,isError:W});continue}if($==="text"&&typeof Q.text==="string"){if(Q.text)G.push(Q.text);continue}if($==="image"){let H=z6(Q,z);if(H&&typeof H==="object"&&H.type==="image"){let B=H.source;if(B?.type==="sha256"&&typeof B.sha256==="string")J.push({sha256:B.sha256,mediaType:typeof B.mediaType==="string"?B.mediaType:"image/unknown"})}continue}for(let H of["content","text"]){let B=Q[H];if(typeof B==="string"&&B)G.push(B)}}return{texts:G,images:J,toolResults:Y}}function FL(_){return{id:_.message?.id,timestamp:_.timestamp,model:_.message?.model}}function dY(_,z){if(!z)return _;let A=z.endsWith("/")?z:`${z}/`,b=(D)=>{if(D.startsWith(A))return`./${D.slice(A.length)}`;return D},G=(D)=>typeof D==="object"&&D!==null&&!Array.isArray(D),J=(D)=>G(D)?{...D}:void 0,Y=(D,L)=>{let R={...D};for(let S of L)delete R[S];return R},X=(D,L)=>{if(typeof D[L]==="string")D[L]=b(D[L])},Q=(D)=>typeof D==="number"&&Number.isFinite(D)?D:0,$=(D)=>{if(!Array.isArray(D))return D;return D.map((L)=>{if(G(L)){let R={...L};return delete R.activeForm,R}return L})},{toolName:H,input:B,output:Z}=_,F=B,K=Z,q=!1,W=!1,V=_.isError;switch(H){case"Write":{let D=J(B);if(D)X(D,"file_path"),F=D,q=!0;let L=J(Z);if(L){let R={};if(L.type!==void 0)R.type=L.type;K=R,W=!0}break}case"Read":{let D=J(B);if(D)X(D,"file_path"),F=D,q=!0;let L=J(Z);if(L){let R={};if(typeof L.type==="string")R.type=L.type;if(L.file&&G(L.file)){let S=L.file,y={};if(typeof S.content==="string")y.content=S.content;if(typeof S.numLines==="number")y.numLines=S.numLines;if(typeof S.startLine==="number")y.startLine=S.startLine;if(typeof S.totalLines==="number")y.totalLines=S.totalLines;if(Object.keys(y).length>0)R.file=y}K=R,W=!0}break}case"Edit":{let D=J(B),L=J(Z),R,S;if(L&&Array.isArray(L.structuredPatch)){let y=[];for(let e of L.structuredPatch)if(G(e)){if(S===void 0&&typeof e.oldStart==="number")S=e.oldStart;if(Array.isArray(e.lines)){for(let u of e.lines)if(typeof u==="string")y.push(u)}}if(y.length>0)R=`${y.join(`
55
+ `);for(let W of K)if(W.startsWith("+")&&!W.startsWith("+++"))Z++;else if(W.startsWith("-")&&!W.startsWith("---"))F++;let q=Math.min(Z,F);b+=Z-q,G+=F-q,J+=q}}return{toolCount:z,userMessageCount:A,filesChanged:Y.size,linesAdded:b,linesRemoved:G,linesModified:J}}function J6(_,z={}){let A=cO(_);if(A.records.size===0)return null;let b=dO(A.records);if(b.length===0)return null;let G=b[b.length-1],J=rO(b),Y=iO(J),X=oO(J),Q=YL(Y),$=J.map((L)=>{let R=L.message?.usage;if(!R)return null;return{model:L.message?.model??null,usage:R}}).filter((L)=>L!==null),H=$L($,z.pricing),B=aO(b),Z=B.length>0?eO(B[0]):null,F=_X(G.timestamp)??z.now??new Date,K=AL(b),q=bL(X),W=U5(b),V=z.gitContext!==void 0?z.gitContext:zL(b),w=W?h9(W):"",{messages:O,blobs:M}=WL(b);if(O.length===0)return null;let P=N_(O),D={v:1,id:K??G.uuid,source:"claude-code",timestamp:F,preview:Z,summary:null,model:q,clientVersion:z.clientVersion??_L(b),blendedTokens:Q,costUsd:H,messageCount:O.length,...P,tokenUsage:Y,modelUsage:Array.from(X.entries()).map(([L,R])=>({model:aY(L),usage:R})),git:V,cwd:w,messages:O};return{transcript:o4.parse(D),blobs:M}}function cO(_){let z=new Map,A=new Map;for(let b of _){let G=typeof b.type==="string"?b.type:"";if(G==="summary")continue;let J=typeof b.uuid==="string"?b.uuid:null;if(!J)continue;let Y={uuid:J,type:G,timestamp:typeof b.timestamp==="string"?b.timestamp:void 0,parentUuid:typeof b.parentUuid==="string"||b.parentUuid===null?b.parentUuid:void 0,logicalParentUuid:typeof b.logicalParentUuid==="string"||b.logicalParentUuid===null?b.logicalParentUuid:void 0,isSidechain:Boolean(b.isSidechain),isMeta:Boolean(b.isMeta),isCompactSummary:Boolean(b.isCompactSummary),sessionId:typeof b.sessionId==="string"?b.sessionId:void 0,cwd:typeof b.cwd==="string"?b.cwd:void 0,gitBranch:typeof b.gitBranch==="string"?b.gitBranch:void 0,costUSD:typeof b.costUSD==="number"?b.costUSD:void 0,message:lO(b.message),raw:b};if(z.set(J,Y),Y.parentUuid){let X=A.get(Y.parentUuid)??new Set;X.add(J),A.set(Y.parentUuid,X)}}return{records:z,children:A}}function lO(_){if(!_||typeof _!=="object")return;let z=_,A=typeof z.id==="string"?z.id:void 0,b=typeof z.role==="string"?z.role:void 0,G=z.content,J=typeof z.model==="string"?z.model:void 0,Y=pO(z.usage);return{id:A,role:b,content:G,model:J,usage:Y}}function pO(_){if(!_||typeof _!=="object")return null;let z=_,A={};if(typeof z.input_tokens==="number")A.input_tokens=z.input_tokens;if(typeof z.cache_creation_input_tokens==="number")A.cache_creation_input_tokens=z.cache_creation_input_tokens;if(typeof z.cache_read_input_tokens==="number")A.cache_read_input_tokens=z.cache_read_input_tokens;if(typeof z.output_tokens==="number")A.output_tokens=z.output_tokens;if(typeof z.reasoning_output_tokens==="number")A.reasoning_output_tokens=z.reasoning_output_tokens;return Object.keys(A).length>0?A:null}function dO(_){let z=[];for(let A of _.values()){if(A.isSidechain)continue;z.push(A)}return z.sort((A,b)=>{let G=lY(A.timestamp)??0,J=lY(b.timestamp)??0;if(G!==J)return G-J;return A.uuid.localeCompare(b.uuid)}),z}function rO(_){let z=new Map;for(let A of _){if(A.type!=="assistant")continue;if(!A.message?.usage)continue;let G=nO(A);z.set(G,A)}return Array.from(z.values())}function nO(_){let z=_.message,A=pY(z?.id),b=pY(_.raw.requestId);if(A&&b)return`${A}:${b}`;if(A)return A;if(b)return b;return _.uuid}function iO(_){let z={inputTokens:0,cachedInputTokens:0,outputTokens:0,reasoningOutputTokens:0,totalTokens:0};for(let A of _){let b=A.message?.usage;if(!b)continue;let G=Y9(b.input_tokens),J=Y9(b.cache_creation_input_tokens),Y=Y9(b.cache_read_input_tokens),X=Y9(b.output_tokens),Q=Y9(b.reasoning_output_tokens);z.inputTokens+=G+J+Y,z.cachedInputTokens+=Y,z.outputTokens+=X,z.reasoningOutputTokens+=Q,z.totalTokens+=G+J+Y+X+Q}return z}function oO(_){let z=new Map;for(let A of _){let b=A.message?.model,G=A.message?.usage;if(!b||!G)continue;let J=z.get(b)??{inputTokens:0,cachedInputTokens:0,outputTokens:0,reasoningOutputTokens:0,totalTokens:0},Y=Y9(G.input_tokens),X=Y9(G.cache_creation_input_tokens),Q=Y9(G.cache_read_input_tokens),$=Y9(G.output_tokens),H=Y9(G.reasoning_output_tokens);J.inputTokens+=Y+X+Q,J.cachedInputTokens+=Q,J.outputTokens+=$,J.reasoningOutputTokens+=H,J.totalTokens+=Y+X+Q+$+H,z.set(b,J)}return z}function aO(_){let z=[];for(let A of _){if(!sO(A))continue;z.push(A)}return z}function sO(_){if(_.type!=="user")return!1;if(_.isSidechain)return!1;if(_.isMeta)return!1;let z=_.raw;if(z&&typeof z==="object"){if("toolUseResult"in z)return!1}let A=_.message?.content;if(Array.isArray(A)){if(A.some((J)=>tO(J)))return!1}let b=sY(_);if(!b)return!1;let G=b.toLowerCase();if(rY.has(G))return!1;if(oY(b))return!1;if(nY.test(b))return!1;if(iY.some((J)=>G.startsWith(J))){if(!eY(b))return!1}return!0}function tO(_){if(!_||typeof _!=="object")return!1;let z=_;if(z.type==="tool_result")return!0;if(typeof z.tool_use_id==="string")return!0;return!1}function oY(_){return vO.test(_)}function eO(_){let z=sY(_);if(!z)return null;return tY(z)}function U5(_){for(let z of _)if(z.cwd)return z.cwd;return}function _L(_){for(let z of _){let A=z.raw.version;if(typeof A==="string"&&A.length>0)return A}return null}function zL(_){let z=U5(_),A=_.find((J)=>J.gitBranch)?.gitBranch??null;if(!z)return t0.parse({relativeCwd:null,branch:A,repo:null});let b=z.split(/[\\/]+/).filter(Boolean);if(b.length===0)return t0.parse({relativeCwd:null,branch:A,repo:null});let G=b.findIndex((J)=>{let Y=J.toLowerCase();return Y.includes("github")||Y.includes("gitlab")||Y.includes("bitbucket")});if(G>=0){let J=b[G]?.toLowerCase()??"",Y=J.includes("gitlab")?"gitlab.com":J.includes("bitbucket")?"bitbucket.org":"github.com",X=b[G+1],Q=b[G+2]?.replace(/\.git$/i,"");if(X&&Q){let $=b.slice(G+3),H=$.length>0?$.join("/"):".";return t0.parse({relativeCwd:Uz(H),branch:A,repo:`${Y}/${X}/${Q}`})}}return t0.parse({relativeCwd:null,branch:A,repo:null})}async function e0(_,z){if(!_)return null;try{if(!(await cY.stat(_)).isDirectory())return t0.parse({relativeCwd:null,branch:z??null,repo:null})}catch{return t0.parse({relativeCwd:null,branch:z??null,repo:null})}let A=await q8(_);if(!A)return t0.parse({relativeCwd:null,branch:z??null,repo:null});let b=IO.relative(A,_)||".",G=z??await sb(A),J=await W8(A);return t0.parse({relativeCwd:Uz(b),branch:G,repo:J})}function AL(_){for(let z of _){let A=typeof z.sessionId==="string"?z.sessionId.trim():"";if(A.length>0)return A}return null}function aY(_){if(_.includes("/"))return _;return`anthropic/${_}`}function bL(_){let z=null,A=-1;for(let[b,G]of _){let J=G.totalTokens>0?G.totalTokens:G.inputTokens+G.outputTokens;if(J>A)A=J,z=b}return z?aY(z):null}function sY(_){return GL(_.message)[0]??null}function GL(_){if(!_)return[];let z=_.content;if(typeof z==="string"){let A=V5(z);return A?[A]:[]}if(Array.isArray(z)){let A=[];for(let b of z){if(typeof b==="string"){let G=V5(b);if(G)A.push(G);continue}if(b&&typeof b==="object"){let G=b,J=["content","text"];for(let Y of J){let X=G[Y];if(typeof X==="string"){let Q=V5(X);if(Q)A.push(Q)}}}}return A}return[]}function V5(_,z=uO){let A=JL(_);if(A.length===0)return null;let G=A.slice(0,z).join(" "),J=tY(G);return J.length>0?J:null}function JL(_){let z=[];for(let A of _.split(/\r?\n/)){let b=A.trim();if(!b)continue;let G=b.toLowerCase();if(rY.has(G))continue;if(oY(b))continue;if(nY.test(b))continue;if(iY.some((J)=>G.startsWith(J))){if(!eY(b))continue}if(!/[a-z]/i.test(b)&&!/\d/.test(b))continue;z.push(b)}return z}function tY(_){return _.replace(/\s+/g," ").trim()}function eY(_){let z=_.toLowerCase();if(mO.test(z))return!0;if(z.includes("?"))return!0;return["can you","can we","could you","could we","would you","would we","should we","should i","let's","let us"].some((b)=>z.includes(b))}function YL(_){return Math.max(0,_.inputTokens-_.cachedInputTokens)+_.outputTokens+_.reasoningOutputTokens}function _X(_){if(!_)return null;let z=new Date(_);return Number.isNaN(z.getTime())?null:z}function lY(_){let z=_X(_);return z?z.getTime():null}function Y9(_){return typeof _==="number"&&Number.isFinite(_)?_:0}function pY(_){if(typeof _!=="string")return;let z=_.trim();return z.length>0?z:void 0}function XL(_){return kO.createHash("sha256").update(_).digest("hex")}function G6(_,z){if(_===null||_===void 0)return _;if(Array.isArray(_))return _.map((A)=>G6(A,z));if(typeof _==="object"){let A=_;if(A.type==="image"&&A.source&&typeof A.source==="object"){let G=A.source;if(typeof G.data==="string"&&G.data.length>0){let J=G.data,Y=typeof G.mediaType==="string"?G.mediaType:typeof G.media_type==="string"?G.media_type:"image/unknown",X=Buffer.from(J,"base64"),Q=XL(X);if(!z.has(Q))z.set(Q,{data:X,mediaType:Y});return{type:"image",source:{type:"sha256",mediaType:Y,sha256:Q}}}}let b={};for(let[G,J]of Object.entries(A))b[G]=G6(J,z);return b}return _}function QL(_){let z=[];function A(b){if(b===null||b===void 0)return;if(Array.isArray(b)){for(let G of b)A(G);return}if(typeof b==="object"){let G=b;if(G.type==="image"&&G.source&&typeof G.source==="object"){let J=G.source;if(J.type==="sha256"&&typeof J.sha256==="string"){z.push({sha256:J.sha256,mediaType:typeof J.mediaType==="string"?J.mediaType:"image/unknown"});return}}for(let J of Object.values(G))A(J)}}return A(_),z}function $L(_,z){if(!z||Object.keys(z).length===0)return 0;let A=0;for(let b of _){let G=b.model;if(!G)continue;let J=HL(G,z);if(!J)continue;let Y=BL({input_tokens:Y9(b.usage.input_tokens),output_tokens:Y9(b.usage.output_tokens),cache_creation_input_tokens:Y9(b.usage.cache_creation_input_tokens),cache_read_input_tokens:Y9(b.usage.cache_read_input_tokens)},J);A+=Y}return A}function HL(_,z){let A=_.trim();if(!A)return null;let b=new Set;b.add(A);for(let J of TO)b.add(`${J}${A}`);for(let J of b){let Y=z[J];if(Y)return Y}let G=A.toLowerCase();for(let[J,Y]of Object.entries(z)){let X=J.toLowerCase();if(X.includes(G)||G.includes(X))return Y}return null}function BL(_,z){let A=(X,Q,$,H=xO)=>{if(X==null||X<=0)return 0;if(X>H&&$!=null){let B=Math.min(X,H),F=Math.max(0,X-H)*$;if(Q!=null)F+=B*Q;return F}if(Q!=null)return X*Q;return 0},b=A(_.input_tokens,z.input_cost_per_token,z.input_cost_per_token_above_200k_tokens),G=A(_.output_tokens,z.output_cost_per_token,z.output_cost_per_token_above_200k_tokens),J=A(_.cache_creation_input_tokens,z.cache_creation_input_token_cost,z.cache_creation_input_token_cost_above_200k_tokens),Y=A(_.cache_read_input_tokens,z.cache_read_input_token_cost,z.cache_read_input_token_cost_above_200k_tokens);return b+G+J+Y}function ZL(_){let z=_.match(yO);if(!z)return null;let A=z[1].trim(),G=_.match(gO)?.[1]?.trim()||void 0;return{name:A,args:G||void 0}}function FL(_){let z=_.trim().match(fO);if(!z)return null;return z[1]}function KL(_){return _.replace(hO,"").trim()}function qL(_){return _.replace(/\x1B\[[0-9;]*m/g,"")}function WL(_){let z=[],A=new Map,b=new Map,G=null,J=!1,Y=new Map,X=new Set,Q=U5(_);for(let $ of _){if($.isMeta)continue;let H=UL($),B=$.type;if(B==="user"){let{texts:Z,images:F,toolResults:K}=VL($,A);for(let q of Z){if(!q.trim())continue;let W=FL(q);if(W!==null){if(J){J=!1;continue}if(G){let M=qL(W).trim();z.push(Y0.parse({type:"command",name:G.name,args:G.args,output:M||void 0,id:G.id,timestamp:G.timestamp})),G=null}continue}let V=ZL(q);if(V){if(CO.has(V.name)){J=!0;continue}if(G)z.push(Y0.parse({type:"command",name:G.name,args:G.args,id:G.id,timestamp:G.timestamp}));G={name:V.name,args:V.args,id:$.uuid,timestamp:H.timestamp};continue}let w=KL(q);if(!w)continue;let O=$.isCompactSummary?"compaction-summary":"user";if(O==="user"){let M=`${H.timestamp}:${w}`,P=Y.get(M);if(P){if(!P.hasImages&&F.length>0){let R=z[P.index];R.images=F,P.hasImages=!0}continue}let D={type:O,text:w,id:$.uuid,timestamp:H.timestamp};if(F.length>0)D.images=F;let L=z.length;z.push(Y0.parse(D)),Y.set(M,{index:L,hasImages:F.length>0})}else{let M={type:O,text:w,id:$.uuid,timestamp:H.timestamp};z.push(Y0.parse(M))}}for(let q of K){let W=q.callId?b.get(q.callId):void 0;if(W){let V=z[W.index],w=G6(q.output,A);V.output=w;let O=QL(w);if(O.length>0)V.images=O;if(q.error)V.error=q.error;if(typeof q.isError<"u")V.isError=q.isError;let M=dY(V,Q);z[W.index]=M}}continue}if(B==="assistant"){let Z=$.message?.content;if(!Array.isArray(Z))continue;for(let F of Z){if(!F||typeof F!=="object")continue;let K=F;if(K.type==="thinking"&&typeof K.thinking==="string"){let q=`thinking:${H.id}:${H.timestamp}:${K.thinking}`;if(X.has(q))continue;X.add(q),z.push(Y0.parse({type:"thinking",text:K.thinking,...H}));continue}if(K.type==="text"&&typeof K.text==="string"){let q=`agent:${H.id}:${H.timestamp}:${K.text}`;if(X.has(q))continue;X.add(q),z.push(Y0.parse({type:"agent",text:K.text,...H}));continue}if(K.type==="tool_use"){let q=typeof K.id==="string"?K.id:"",W=typeof K.name==="string"?K.name:null,V=K.input??void 0,w={type:"tool-call",toolName:W,...H,input:V},O=Y0.parse(w),M=dY(O,Q);if(z.push(M),q)b.set(q,{index:z.length-1,toolName:W});continue}if(K.type==="image")continue}}}if(G)z.push(Y0.parse({type:"command",name:G.name,args:G.args,id:G.id,timestamp:G.timestamp}));return{messages:z,blobs:A}}function VL(_,z){let A=_.message;if(!A)return{texts:[],images:[],toolResults:[]};let b=A.content;if(typeof b==="string")return b?{texts:[b],images:[],toolResults:[]}:{texts:[],images:[],toolResults:[]};if(!Array.isArray(b))return{texts:[],images:[],toolResults:[]};let G=[],J=[],Y=[];for(let X of b){if(!X||typeof X!=="object")continue;if(typeof X==="string"){if(X)G.push(X);continue}let Q=X,$=typeof Q.type==="string"?Q.type:void 0;if($==="tool_result"){let H=Q,B=typeof H.tool_use_id==="string"?H.tool_use_id:void 0,Z=H.content,F=_.raw.toolUseResult??_.raw.tool_use_result;if(F)Z=F;let K=typeof H.error==="string"?H.error:void 0,q=H.is_error??H.isError,W=typeof q==="boolean"?q:typeof H.success==="boolean"?!H.success:void 0;Y.push({callId:B,output:Z,error:K,isError:W});continue}if($==="text"&&typeof Q.text==="string"){if(Q.text)G.push(Q.text);continue}if($==="image"){let H=G6(Q,z);if(H&&typeof H==="object"&&H.type==="image"){let B=H.source;if(B?.type==="sha256"&&typeof B.sha256==="string")J.push({sha256:B.sha256,mediaType:typeof B.mediaType==="string"?B.mediaType:"image/unknown"})}continue}for(let H of["content","text"]){let B=Q[H];if(typeof B==="string"&&B)G.push(B)}}return{texts:G,images:J,toolResults:Y}}function UL(_){return{id:_.message?.id,timestamp:_.timestamp,model:_.message?.model}}function dY(_,z){if(!z)return _;let A=z.endsWith("/")?z:`${z}/`,b=(D)=>{if(D.startsWith(A))return`./${D.slice(A.length)}`;return D},G=(D)=>typeof D==="object"&&D!==null&&!Array.isArray(D),J=(D)=>G(D)?{...D}:void 0,Y=(D,L)=>{let R={...D};for(let S of L)delete R[S];return R},X=(D,L)=>{if(typeof D[L]==="string")D[L]=b(D[L])},Q=(D)=>typeof D==="number"&&Number.isFinite(D)?D:0,$=(D)=>{if(!Array.isArray(D))return D;return D.map((L)=>{if(G(L)){let R={...L};return delete R.activeForm,R}return L})},{toolName:H,input:B,output:Z}=_,F=B,K=Z,q=!1,W=!1,V=_.isError;switch(H){case"Write":{let D=J(B);if(D)X(D,"file_path"),F=D,q=!0;let L=J(Z);if(L){let R={};if(L.type!==void 0)R.type=L.type;K=R,W=!0}break}case"Read":{let D=J(B);if(D)X(D,"file_path"),F=D,q=!0;let L=J(Z);if(L){let R={};if(typeof L.type==="string")R.type=L.type;if(L.file&&G(L.file)){let S=L.file,y={};if(typeof S.content==="string")y.content=S.content;if(typeof S.numLines==="number")y.numLines=S.numLines;if(typeof S.startLine==="number")y.startLine=S.startLine;if(typeof S.totalLines==="number")y.totalLines=S.totalLines;if(Object.keys(y).length>0)R.file=y}K=R,W=!0}break}case"Edit":{let D=J(B),L=J(Z),R,S;if(L&&Array.isArray(L.structuredPatch)){let y=[];for(let e of L.structuredPatch)if(G(e)){if(S===void 0&&typeof e.oldStart==="number")S=e.oldStart;if(Array.isArray(e.lines)){for(let u of e.lines)if(typeof u==="string")y.push(u)}}if(y.length>0)R=`${y.join(`
56
56
  `)}
57
57
  `}if(S===void 0&&typeof Z==="string"){let y=Z.match(/^\s*(\d+)[→\t]/m);if(y)S=parseInt(y[1],10)}if(D){X(D,"file_path");let y=typeof D.old_string==="string"?D.old_string:typeof D.oldString==="string"?D.oldString:void 0,e=typeof D.new_string==="string"?D.new_string:typeof D.newString==="string"?D.newString:void 0,u=V===!0||V==="true"||typeof Z==="string"&&!Z.includes("has been updated")||L&&typeof L.type==="string"&&L.type==="error";if(!R&&!u&&y!==void 0&&e!==void 0){let g=y.split(`
58
58
  `),m=e.split(`
59
59
  `),d=[];for(let Z0 of g)d.push(`-${Z0}`);for(let Z0 of m)d.push(`+${Z0}`);R=`${d.join(`
60
60
  `)}
61
- `}if(delete D.old_string,delete D.new_string,delete D.oldString,delete D.newString,R)D.diff=R;if(S!==void 0&&S>0)D.lineOffset=S;F=D,q=!0}if(L){let y=Y(L,["filePath","newString","oldString","originalFile","structuredPatch","replaceAll"]);K=Object.keys(y).length>0?y:void 0,W=!0}break}case"Glob":case"Grep":{let D=J(Z);if(D&&Array.isArray(D.filenames))D.filenames=D.filenames.map((L)=>typeof L==="string"?b(L):L),delete D.numFiles,K=D,W=!0;break}case"Bash":{let D=J(B);if(D&&typeof D.command==="string"){let R=D.command.match(/^(?:bash|zsh)\s+-lc\s+['"](.*)['"]$/s);if(R)D.command=R[1];F=D,q=!0}let L=J(Z);if(L)delete L.stdoutLines,delete L.stderrLines,K=L,W=!0;break}case"Task":{let D=J(B);if(D)F=D,q=!0;let L=J(Z);if(L){let R={};for(let[S,y]of Object.entries(L)){if(S==="usage"&&G(y)){let e=y,u=Q(e.input_tokens??e.inputTokens),g=Q(e.cached_input_tokens??e.cachedInputTokens)+Q(e.cache_creation_input_tokens??e.cacheCreationInputTokens)+Q(e.cache_read_input_tokens??e.cacheReadInputTokens),m=Q(e.output_tokens??e.outputTokens),d=Q(e.reasoning_output_tokens??e.reasoningOutputTokens),Z0=e.total_tokens??e.totalTokens,S9=typeof Z0==="number"&&Number.isFinite(Z0)?Z0:u+g+m+d;R.usage={inputTokens:u,cachedInputTokens:g,outputTokens:m,reasoningOutputTokens:d,totalTokens:S9};continue}if(S==="usage"||S==="totalTokens"||S==="prompt")continue;R[S]=y}K=R,W=!0}break}case"TodoWrite":{let D=J(B);if(D){if(Array.isArray(D.todos))D.todos=$(D.todos);F=D,q=!0}let L=J(Z);if(L){let R={...L},S=!1;if(Array.isArray(R.newTodos))R.newTodos=$(R.newTodos),S=!0;if(Array.isArray(R.oldTodos))R.oldTodos=$(R.oldTodos),S=!0;K=S?R:L,W=S}break}case"BashOutput":{let D=J(Z);if(D)delete D.stdoutLines,delete D.stderrLines,K=D,W=!0;break}default:break}if(H==="KillShell"&&typeof V==="boolean")V=String(V);let w={..._};if(F!==void 0)F=M9(F,z);if(K!==void 0)K=M9(K,z);if(q||F!==B)if(typeof F>"u")delete w.input;else w.input=F;if(W||K!==Z)if(typeof K>"u")delete w.output;else w.output=K;if(typeof V>"u"){if(typeof w.error==="string"&&w.error.trim())V=!0;else if(typeof K==="string"&&/^error:/i.test(K.trim()))V=!0}if(typeof V<"u")w.isError=V;let O={},M=["id","input","model","output","timestamp","toolName","error","isError","type"];for(let D of M)if(Object.prototype.hasOwnProperty.call(w,D))O[D]=w[D];for(let D of Object.keys(w))if(!Object.prototype.hasOwnProperty.call(O,D))O[D]=w[D];return yY.parse(O)}import KL from"node:crypto";import V5 from"node:path";var U5={inputTokens:0,cachedInputTokens:0,outputTokens:0,reasoningOutputTokens:0,totalTokens:0},zX=["anthropic/","claude-3-5-","claude-3-","claude-","openai/","azure/","openrouter/openai/"],qL=200000,WL={shell:"Bash",exec_command:"Bash"},VL=["<user_instructions","<environment_context","# agents.md instructions for","<permissions instructions>"],UL=/^<image name=\[Image #\d+\]>$/i,DL=[/<image[^>]*>/gi,/<\/image>/gi,/\[\s*image\s*#?\d+\s*\]/gi];function w5(_,z={}){let A=ML(_);if(A.length===0)return null;let b=new Map,G=new Set,J=[],Y=[],X=new Map,Q=null,$=null,H=null,B,Z={...U5},F={...U5};for(let L of A){if(!L)continue;let{type:R,payload:S,timestamp:y}=L;if(y&&(!B||cL(y,B)>0))B=y;if(R==="session_meta"&&S){if(Q=NL(S),!$)$=Q.cwd;continue}if(R==="turn_context"&&S){let u=i(S.cwd);if(u)$=u;let g=i(S.model);if(g)H=dL(g);continue}if(R==="event_msg"&&S){if(i(S.type)==="token_count"){let g=AX(S.info,"last_token_usage"),m=AX(S.info,"total_token_usage"),d=null;if(g)d=g;else if(m)d={inputTokens:Math.max(0,m.inputTokens-F.inputTokens),cachedInputTokens:Math.max(0,m.cachedInputTokens-F.cachedInputTokens),outputTokens:Math.max(0,m.outputTokens-F.outputTokens),reasoningOutputTokens:Math.max(0,m.reasoningOutputTokens-F.reasoningOutputTokens),totalTokens:Math.max(0,m.totalTokens-F.totalTokens)};if(d)Z={inputTokens:Z.inputTokens+d.inputTokens,cachedInputTokens:Z.cachedInputTokens+d.cachedInputTokens,outputTokens:Z.outputTokens+d.outputTokens,reasoningOutputTokens:Z.reasoningOutputTokens+d.reasoningOutputTokens,totalTokens:Z.totalTokens+d.totalTokens};if(m)F=m}continue}if(R!=="response_item"||!S)continue;switch(i(S.type)){case"message":{let u=i(S.role);if(u==="user"){let{texts:g,images:m}=OL(S.content,X),d=b6(g.join(`
61
+ `}if(delete D.old_string,delete D.new_string,delete D.oldString,delete D.newString,R)D.diff=R;if(S!==void 0&&S>0)D.lineOffset=S;F=D,q=!0}if(L){let y=Y(L,["filePath","newString","oldString","originalFile","structuredPatch","replaceAll"]);K=Object.keys(y).length>0?y:void 0,W=!0}break}case"Glob":case"Grep":{let D=J(Z);if(D&&Array.isArray(D.filenames))D.filenames=D.filenames.map((L)=>typeof L==="string"?b(L):L),delete D.numFiles,K=D,W=!0;break}case"Bash":{let D=J(B);if(D&&typeof D.command==="string"){let R=D.command.match(/^(?:bash|zsh)\s+-lc\s+['"](.*)['"]$/s);if(R)D.command=R[1];F=D,q=!0}let L=J(Z);if(L)delete L.stdoutLines,delete L.stderrLines,K=L,W=!0;break}case"Task":{let D=J(B);if(D)F=D,q=!0;let L=J(Z);if(L){let R={};for(let[S,y]of Object.entries(L)){if(S==="usage"&&G(y)){let e=y,u=Q(e.input_tokens??e.inputTokens),g=Q(e.cached_input_tokens??e.cachedInputTokens)+Q(e.cache_creation_input_tokens??e.cacheCreationInputTokens)+Q(e.cache_read_input_tokens??e.cacheReadInputTokens),m=Q(e.output_tokens??e.outputTokens),d=Q(e.reasoning_output_tokens??e.reasoningOutputTokens),Z0=e.total_tokens??e.totalTokens,S9=typeof Z0==="number"&&Number.isFinite(Z0)?Z0:u+g+m+d;R.usage={inputTokens:u,cachedInputTokens:g,outputTokens:m,reasoningOutputTokens:d,totalTokens:S9};continue}if(S==="usage"||S==="totalTokens"||S==="prompt")continue;R[S]=y}K=R,W=!0}break}case"TodoWrite":{let D=J(B);if(D){if(Array.isArray(D.todos))D.todos=$(D.todos);F=D,q=!0}let L=J(Z);if(L){let R={...L},S=!1;if(Array.isArray(R.newTodos))R.newTodos=$(R.newTodos),S=!0;if(Array.isArray(R.oldTodos))R.oldTodos=$(R.oldTodos),S=!0;K=S?R:L,W=S}break}case"BashOutput":{let D=J(Z);if(D)delete D.stdoutLines,delete D.stderrLines,K=D,W=!0;break}default:break}if(H==="KillShell"&&typeof V==="boolean")V=String(V);let w={..._};if(F!==void 0)F=M9(F,z);if(K!==void 0)K=M9(K,z);if(q||F!==B)if(typeof F>"u")delete w.input;else w.input=F;if(W||K!==Z)if(typeof K>"u")delete w.output;else w.output=K;if(typeof V>"u"){if(typeof w.error==="string"&&w.error.trim())V=!0;else if(typeof K==="string"&&/^error:/i.test(K.trim()))V=!0}if(typeof V<"u")w.isError=V;let O={},M=["id","input","model","output","timestamp","toolName","error","isError","type"];for(let D of M)if(Object.prototype.hasOwnProperty.call(w,D))O[D]=w[D];for(let D of Object.keys(w))if(!Object.prototype.hasOwnProperty.call(O,D))O[D]=w[D];return yY.parse(O)}import DL from"node:crypto";import D5 from"node:path";var M5={inputTokens:0,cachedInputTokens:0,outputTokens:0,reasoningOutputTokens:0,totalTokens:0},zX=["anthropic/","claude-3-5-","claude-3-","claude-","openai/","azure/","openrouter/openai/"],ML=200000,NL={shell:"Bash",exec_command:"Bash"},wL=["<user_instructions","<environment_context","# agents.md instructions for","<permissions instructions>"],EL=/^<image name=\[Image #\d+\]>$/i,OL=[/<image[^>]*>/gi,/<\/image>/gi,/\[\s*image\s*#?\d+\s*\]/gi];function O5(_,z={}){let A=LL(_);if(A.length===0)return null;let b=new Map,G=new Set,J=[],Y=[],X=new Map,Q=null,$=null,H=null,B,Z={...M5},F={...M5};for(let L of A){if(!L)continue;let{type:R,payload:S,timestamp:y}=L;if(y&&(!B||nL(y,B)>0))B=y;if(R==="session_meta"&&S){if(Q=jL(S),!$)$=Q.cwd;continue}if(R==="turn_context"&&S){let u=i(S.cwd);if(u)$=u;let g=i(S.model);if(g)H=aL(g);continue}if(R==="event_msg"&&S){if(i(S.type)==="token_count"){let g=AX(S.info,"last_token_usage"),m=AX(S.info,"total_token_usage"),d=null;if(g)d=g;else if(m)d={inputTokens:Math.max(0,m.inputTokens-F.inputTokens),cachedInputTokens:Math.max(0,m.cachedInputTokens-F.cachedInputTokens),outputTokens:Math.max(0,m.outputTokens-F.outputTokens),reasoningOutputTokens:Math.max(0,m.reasoningOutputTokens-F.reasoningOutputTokens),totalTokens:Math.max(0,m.totalTokens-F.totalTokens)};if(d)Z={inputTokens:Z.inputTokens+d.inputTokens,cachedInputTokens:Z.cachedInputTokens+d.cachedInputTokens,outputTokens:Z.outputTokens+d.outputTokens,reasoningOutputTokens:Z.reasoningOutputTokens+d.reasoningOutputTokens,totalTokens:Z.totalTokens+d.totalTokens};if(m)F=m}continue}if(R!=="response_item"||!S)continue;switch(i(S.type)){case"message":{let u=i(S.role);if(u==="user"){let{texts:g,images:m}=SL(S.content,X),d=Y6(g.join(`
62
62
 
63
- `));if(!d&&m.length===0)break;if(d&&gL(d))break;if(d)Y.push(d);let Z0=i(S.id),S9={type:"user",timestamp:y,text:d||""};if(Z0)S9.id=Z0;if(m.length>0)S9.images=m;M5(S9,J,G)}else if(u==="assistant"){let g=wL(S.content,!0);if(g.length===0)break;let m=g.join(`
63
+ `));if(!d&&m.length===0)break;if(d&&cL(d))break;if(d)Y.push(d);let Z0=i(S.id),S9={type:"user",timestamp:y,text:d||""};if(Z0)S9.id=Z0;if(m.length>0)S9.images=m;w5(S9,J,G)}else if(u==="assistant"){let g=RL(S.content,!0);if(g.length===0)break;let m=g.join(`
64
64
 
65
- `).trim();if(!m)break;let d=i(S.id),Z0={type:"agent",timestamp:y,model:H??void 0,text:m};if(d)Z0.id=d;M5(Z0,J,G)}break}case"reasoning":{let u=jL(S);for(let g of u){let m=i(S.id),d={type:"thinking",timestamp:y,model:H??void 0,text:g};if(m)d.id=m;M5(d,J,G)}break}case"function_call":{let u=i(S.call_id)??i(S.id)??void 0,g=i(S.name),m=YX(g),d=D5(S.arguments),Z0=RL(d,$),S9=Y0.parse({type:"tool-call",id:u,timestamp:y,model:H??void 0,toolName:m,input:Z0}),uV=N5(S9,$,g);b.set(u??"",{index:J.push(uV)-1,rawName:g});break}case"function_call_output":{let u=i(S.call_id);if(!u)break;let g=b.get(u);if(!g)break;let m=D5(S.output),d=GX(J[g.index],m,$,g.rawName);J[g.index]=d;break}case"custom_tool_call":{let u=i(S.call_id)??i(S.id)??void 0,g=i(S.name),m=YX(g),d=PL(g,S.input,$),Z0=Y0.parse({type:"tool-call",id:u,timestamp:y,model:H??void 0,toolName:m,input:d}),S9=N5(Z0,$,g);b.set(u??"",{index:J.push(S9)-1,rawName:g});break}case"custom_tool_call_output":{let u=i(S.call_id);if(!u)break;let g=b.get(u);if(!g)break;let m=D5(S.output),d=GX(J[g.index],m,$,g.rawName);J[g.index]=d;break}default:break}}if(J.length===0)return null;let K=lL(B)??z.now??new Date,q=fL(Y),W=Z??{...U5},V=yL(W),w=rL(H,W,z.pricing),O=z.gitContext!==void 0?z.gitContext:hL(Q,$),M=$?f9($):"",P=N_(J);return{transcript:o4.parse({v:1,id:Q?.id??J[0]?.id??pL(K),source:"codex",timestamp:K,preview:q,summary:null,model:H,clientVersion:z.clientVersion??Q?.cliVersion??null,blendedTokens:V,costUsd:w,messageCount:J.length,...P,tokenUsage:W,modelUsage:H?[M_.parse({model:H,usage:W})]:[],git:O,cwd:M,messages:J}),blobs:X}}function ML(_){let z=[];for(let A of _){if(!A||typeof A!=="object")continue;let b=A,G=i(b.type);if(!G)continue;let J=i(b.timestamp)??void 0,Y=b.payload&&typeof b.payload==="object"?b.payload:null;z.push({type:G,timestamp:J,payload:Y})}return z}function NL(_){let z=_.git??{};return{id:i(_.id),cwd:i(_.cwd),cliVersion:i(_.cli_version??_.cliVersion),git:{branch:i(z.branch),repositoryUrl:i(z.repository_url??z.repositoryUrl)}}}function AX(_,z="total_token_usage"){if(!_||typeof _!=="object")return null;let A=_,b;if(z==="last_token_usage")b=A.last_token_usage??A.lastTokenUsage??A.total_token_usage??A.totalTokenUsage;else b=A.total_token_usage??A.totalTokenUsage??A.last_token_usage??A.lastTokenUsage;if(!b||typeof b!=="object")return null;let G=b;return{inputTokens:E4(G.input_tokens??G.inputTokens),cachedInputTokens:E4(G.cached_input_tokens??G.cachedInputTokens),outputTokens:E4(G.output_tokens??G.outputTokens),reasoningOutputTokens:E4(G.reasoning_output_tokens??G.reasoningOutputTokens),totalTokens:E4(G.total_tokens??G.totalTokens)}}function wL(_,z=!1){let A=(G)=>{if(z)return G.trim();return b6(G)};if(typeof _==="string"){let G=A(_);return G?[G]:[]}if(!Array.isArray(_))return[];let b=[];for(let G of _){if(!G)continue;if(typeof G==="string"){let J=A(G);if(J)b.push(J);continue}if(typeof G==="object"){let J=G,Y=i(J.text??J.content);if(Y){let X=A(Y);if(X)b.push(X)}}}return b}function EL(_){return KL.createHash("sha256").update(_).digest("hex")}function OL(_,z){let A=[],b=[],G=(J)=>{if(!J)return;let Y=LL(J),X=Y.trim();if(!X||UL.test(X))return;A.push(Y)};if(typeof _==="string")return G(_),{texts:A,images:b};if(!Array.isArray(_))return{texts:A,images:b};for(let J of _){if(!J)continue;if(typeof J==="string"){G(J);continue}if(typeof J!=="object")continue;let Y=J,X=i(Y.type);if(X==="input_text"||X==="text"||X==="output_text"){G(i(Y.text??Y.content));continue}if(X==="input_image"||X==="image"){let Q=bX(Y,z);if(Q)b.push(Q);continue}if(Y.image_url||Y.imageUrl||Y.url){let Q=bX(Y,z);if(Q){b.push(Q);continue}}G(i(Y.text??Y.content))}return{texts:A,images:b}}function LL(_){let z=_;for(let A of DL)z=z.replace(A,"");return z}function bX(_,z){let A=_.image_url??_.imageUrl??_.url,b=typeof A==="string"?A:A&&typeof A==="object"?i(A.url):void 0;if(!b)return null;let G=b.match(/^data:([^;]+);base64,([\s\S]+)$/);if(!G)return null;let J=G[1]||"image/unknown",Y=G[2];if(!Y)return null;let X=Buffer.from(Y,"base64"),Q=EL(X);if(!z.has(Q))z.set(Q,{data:X,mediaType:J});return{sha256:Q,mediaType:J}}function jL(_){let z=[],A=_.summary;if(Array.isArray(A)){for(let G of A)if(G&&typeof G==="object"){let J=i(G.text);if(J)z.push(J)}}let b=_.content;if(Array.isArray(b)){for(let G of b)if(G&&typeof G==="object"){let J=G;if(i(J.type)==="reasoning"||i(J.type)==="text"){let Y=i(J.text??J.content);if(Y)z.push(Y)}}}return z}function D5(_){let z=i(_);if(!z)return _;try{return JSON.parse(z)}catch{return _}}function RL(_,z){if(!_||typeof _!=="object")return _;let A={..._};if(typeof A.workdir==="string"&&z)A.workdir=w_(A.workdir,z);return A}function PL(_,z,A){if(!z)return z;if(_==="apply_patch"){let b=i(z);if(!b)return z;let G=vL(b,A);if(G.diff||G.file_path)return G}return z}function GX(_,z,A,b){if(_.type!=="tool-call")return _;let G=z;if(b==="shell")G=XX(z);else if(b==="exec_command")G=TL(z);else if(b==="apply_patch")G=CL(z);let J={..._,output:G};if(b==="shell"||b==="exec_command"){let Y=SL(J,A);if(Y)return Y}return N5(J,A,b)}function SL(_,z){if(_.type!=="tool-call"||!_.input)return null;let A=_.input,b=null;if(typeof A.cmd==="string")b=A.cmd;else if(typeof A.command==="string")b=A.command;else if(Array.isArray(A.command)&&A.command.length>=3){let X=A.command[0];if((X==="bash"||X==="zsh"||X==="/bin/zsh"||X==="/bin/bash")&&A.command[1]==="-lc")b=i(A.command[2])}if(!b)return null;let G=b.match(/^cat\s+<<'EOF'\s+>\s+(\S+)\s*\n([\s\S]*?)EOF$/);if(G){let[,X,Q]=G,$=z?w_(`${z}/${X}`,z):`./${X}`;return Y0.parse({..._,toolName:"Write",input:{file_path:$,content:Q||""},output:void 0})}let J=b.match(/^cat\s+(\S+)$/);if(J){let[,X]=J,Q=z?w_(`${z}/${X}`,z):`./${X}`,$;if(_.output&&typeof _.output==="object"){let H=_.output;$=i(H.stdout)??void 0}return Y0.parse({..._,toolName:"Read",input:{file_path:Q},output:$})}let Y=kL(b);if(Y.length>0&&Y[0]==="rg"){let X=IL(Y,z);if(X){let Q=JX(_.output),$;if(Q){let H=Q.split(`
66
- `).filter((B)=>B.trim().length>0);if(X.input.output_mode==="files_with_matches")$={mode:"files_with_matches",filenames:H,numMatches:H.length};else $={mode:"content",content:Q,numMatches:H.length,numLines:H.length}}return Y0.parse({..._,toolName:"Grep",input:X.input,output:$})}}if(Y.length>=4&&Y[0]==="sed"){let X=xL(Y,z);if(X){let{filePath:Q,startLine:$}=X,H=JX(_.output),B;if(H){let Z=H.split(`
67
- `).length;B={file:{content:H,numLines:Z,startLine:$}}}return Y0.parse({..._,toolName:"Read",input:{file_path:Q},output:B})}}return null}function kL(_){let z=[],A="",b=null,G=!1;for(let J of _){if(G){A+=J,G=!1;continue}if(J==="\\"&&b!=="'"){G=!0;continue}if(b){if(J===b)b=null;else A+=J;continue}if(J==="'"||J==='"'){b=J;continue}if(/\s/.test(J)){if(A.length>0)z.push(A),A="";continue}A+=J}if(A.length>0)z.push(A);return z}function JX(_){if(typeof _==="string")return _;if(_&&typeof _==="object"){let A=i(_.stdout);if(A)return A}return}function IL(_,z){if(_.length<2)return null;let A={},b=null,G=null;for(let J=1;J<_.length;J+=1){let Y=_[J];if(Y==="--")continue;if(Y.startsWith("-")){switch(Y){case"-i":A["-i"]=!0;break;case"-U":A.multiline=!0;break;case"-A":case"-B":case"-C":{let X=_[J+1];if(X)A[Y]=X,J+=1;break}case"-l":case"--files-with-matches":A.output_mode="files_with_matches";break;case"-c":case"--count":A.output_mode="count";break;case"-g":case"--glob":{let X=_[J+1];if(X)A.glob=X,J+=1;break}case"-t":case"--type":{let X=_[J+1];if(X)A.type=X,J+=1;break}case"-e":case"--regexp":{let X=_[J+1];if(X)b=X,J+=1;break}default:break}continue}if(!b){b=Y;continue}if(!G){G=Y;continue}}if(!b)return null;if(A.pattern=b,G)A.path=z?w_(G,z):G;return{input:A}}function xL(_,z){let A=_.indexOf("-n");if(A===-1)return null;let b=_[A+1],G=_[A+2];if(!b||!G)return null;let J=b.match(/^(\d+)(?:,(\d+))?p$/);if(!J)return null;let Y=parseInt(J[1],10);if(!Number.isFinite(Y)||Y<=0)return null;return{filePath:z?w_(G,z):G,startLine:Y}}function N5(_,z,A){if(_.type!=="tool-call")return _;let{toolName:b,input:G,output:J}=_;if(A==="shell"||A==="exec_command"){if(b="Bash",G&&typeof G==="object"){let Y=G,X={},Q=null;if(typeof Y.cmd==="string")Q=Y.cmd;else if(Array.isArray(Y.command)&&Y.command.length>=3){let $=Y.command[0];if(($==="bash"||$==="zsh"||$==="/bin/zsh"||$==="/bin/bash")&&Y.command[1]==="-lc")Q=i(Y.command[2])}else if(typeof Y.command==="string")Q=Y.command;if(Q)X.command=Q;if(typeof Y.description==="string")X.description=Y.description;G=X}}if(A==="apply_patch"){if(b="Edit",G&&typeof G==="object"){let Y={...G},X=i(Y.file_path);if(X&&z)Y.file_path=w_(X,z);G=Y}}if(z)G=M9(G,z),J=M9(J,z);return Y0.parse({..._,toolName:b,input:G,output:J})}function XX(_){if(!_||typeof _!=="object")return _;let z=_,A={},b=i(z.output??z.stdout);if(typeof z.stdout==="string")A.stdout=z.stdout;else if(b)A.stdout=b;let G=i(z.stderr);if(G)A.stderr=G;let J=z.metadata&&typeof z.metadata==="object"?z.metadata:{},Y=E4(J.exit_code??J.exitCode??z.exit_code??z.exitCode);if(Number.isFinite(Y))A.exitCode=Y;let X=E4(J.duration_seconds??J.durationSeconds);if(Number.isFinite(X)&&X>0)A.durationSeconds=X;return Object.keys(A).length>0?A:void 0}function TL(_){let z=i(_);if(!z)return XX(_);let A={},b=z.match(/Process exited with code (\d+)/);if(b)A.exitCode=parseInt(b[1],10);let G=z.match(/Wall time: ([\d.]+) seconds/);if(G){let Y=parseFloat(G[1]);if(Y>0)A.durationSeconds=Y}let J=z.match(/Output:\n([\s\S]*?)$/);if(J&&J[1]){let Y=J[1].trim();if(Y)A.stdout=Y}return Object.keys(A).length>0?A:void 0}function CL(_){if(!_||typeof _!=="object")return _;let z=_,A={},b=i(z.output);if(b)A.message=b;let G=z.metadata&&typeof z.metadata==="object"?z.metadata:null;if(G){let J=E4(G.exit_code??G.exitCode);if(Number.isFinite(J))A.exitCode=J;let Y=E4(G.duration_seconds??G.durationSeconds);if(Number.isFinite(Y)&&Y>0)A.durationSeconds=Y}return Object.keys(A).length>0?A:void 0}function vL(_,z){let A=_.split(/\r?\n/),b=null,G=[];for(let X of A){if(X.startsWith("*** ")){let Q=X.match(/^\*\*\* (?:Update|Add|Delete) File: (.+)$/);if(Q&&Q[1])b=Q[1].trim();continue}G.push(X)}let J=G.join(`
65
+ `).trim();if(!m)break;let d=i(S.id),Z0={type:"agent",timestamp:y,model:H??void 0,text:m};if(d)Z0.id=d;w5(Z0,J,G)}break}case"reasoning":{let u=IL(S);for(let g of u){let m=i(S.id),d={type:"thinking",timestamp:y,model:H??void 0,text:g};if(m)d.id=m;w5(d,J,G)}break}case"function_call":{let u=i(S.call_id)??i(S.id)??void 0,g=i(S.name),m=YX(g),d=N5(S.arguments),Z0=xL(d,$),S9=Y0.parse({type:"tool-call",id:u,timestamp:y,model:H??void 0,toolName:m,input:Z0}),lV=E5(S9,$,g);b.set(u??"",{index:J.push(lV)-1,rawName:g});break}case"function_call_output":{let u=i(S.call_id);if(!u)break;let g=b.get(u);if(!g)break;let m=N5(S.output),d=GX(J[g.index],m,$,g.rawName);J[g.index]=d;break}case"custom_tool_call":{let u=i(S.call_id)??i(S.id)??void 0,g=i(S.name),m=YX(g),d=TL(g,S.input,$),Z0=Y0.parse({type:"tool-call",id:u,timestamp:y,model:H??void 0,toolName:m,input:d}),S9=E5(Z0,$,g);b.set(u??"",{index:J.push(S9)-1,rawName:g});break}case"custom_tool_call_output":{let u=i(S.call_id);if(!u)break;let g=b.get(u);if(!g)break;let m=N5(S.output),d=GX(J[g.index],m,$,g.rawName);J[g.index]=d;break}default:break}}if(J.length===0)return null;let K=iL(B)??z.now??new Date,q=lL(Y),W=Z??{...M5},V=uL(W),w=sL(H,W,z.pricing),O=z.gitContext!==void 0?z.gitContext:pL(Q,$),M=$?h9($):"",P=N_(J);return{transcript:o4.parse({v:1,id:Q?.id??J[0]?.id??oL(K),source:"codex",timestamp:K,preview:q,summary:null,model:H,clientVersion:z.clientVersion??Q?.cliVersion??null,blendedTokens:V,costUsd:w,messageCount:J.length,...P,tokenUsage:W,modelUsage:H?[M_.parse({model:H,usage:W})]:[],git:O,cwd:M,messages:J}),blobs:X}}function LL(_){let z=[];for(let A of _){if(!A||typeof A!=="object")continue;let b=A,G=i(b.type);if(!G)continue;let J=i(b.timestamp)??void 0,Y=b.payload&&typeof b.payload==="object"?b.payload:null;z.push({type:G,timestamp:J,payload:Y})}return z}function jL(_){let z=_.git??{};return{id:i(_.id),cwd:i(_.cwd),cliVersion:i(_.cli_version??_.cliVersion),git:{branch:i(z.branch),repositoryUrl:i(z.repository_url??z.repositoryUrl)}}}function AX(_,z="total_token_usage"){if(!_||typeof _!=="object")return null;let A=_,b;if(z==="last_token_usage")b=A.last_token_usage??A.lastTokenUsage??A.total_token_usage??A.totalTokenUsage;else b=A.total_token_usage??A.totalTokenUsage??A.last_token_usage??A.lastTokenUsage;if(!b||typeof b!=="object")return null;let G=b;return{inputTokens:E4(G.input_tokens??G.inputTokens),cachedInputTokens:E4(G.cached_input_tokens??G.cachedInputTokens),outputTokens:E4(G.output_tokens??G.outputTokens),reasoningOutputTokens:E4(G.reasoning_output_tokens??G.reasoningOutputTokens),totalTokens:E4(G.total_tokens??G.totalTokens)}}function RL(_,z=!1){let A=(G)=>{if(z)return G.trim();return Y6(G)};if(typeof _==="string"){let G=A(_);return G?[G]:[]}if(!Array.isArray(_))return[];let b=[];for(let G of _){if(!G)continue;if(typeof G==="string"){let J=A(G);if(J)b.push(J);continue}if(typeof G==="object"){let J=G,Y=i(J.text??J.content);if(Y){let X=A(Y);if(X)b.push(X)}}}return b}function PL(_){return DL.createHash("sha256").update(_).digest("hex")}function SL(_,z){let A=[],b=[],G=(J)=>{if(!J)return;let Y=kL(J),X=Y.trim();if(!X||EL.test(X))return;A.push(Y)};if(typeof _==="string")return G(_),{texts:A,images:b};if(!Array.isArray(_))return{texts:A,images:b};for(let J of _){if(!J)continue;if(typeof J==="string"){G(J);continue}if(typeof J!=="object")continue;let Y=J,X=i(Y.type);if(X==="input_text"||X==="text"||X==="output_text"){G(i(Y.text??Y.content));continue}if(X==="input_image"||X==="image"){let Q=bX(Y,z);if(Q)b.push(Q);continue}if(Y.image_url||Y.imageUrl||Y.url){let Q=bX(Y,z);if(Q){b.push(Q);continue}}G(i(Y.text??Y.content))}return{texts:A,images:b}}function kL(_){let z=_;for(let A of OL)z=z.replace(A,"");return z}function bX(_,z){let A=_.image_url??_.imageUrl??_.url,b=typeof A==="string"?A:A&&typeof A==="object"?i(A.url):void 0;if(!b)return null;let G=b.match(/^data:([^;]+);base64,([\s\S]+)$/);if(!G)return null;let J=G[1]||"image/unknown",Y=G[2];if(!Y)return null;let X=Buffer.from(Y,"base64"),Q=PL(X);if(!z.has(Q))z.set(Q,{data:X,mediaType:J});return{sha256:Q,mediaType:J}}function IL(_){let z=[],A=_.summary;if(Array.isArray(A)){for(let G of A)if(G&&typeof G==="object"){let J=i(G.text);if(J)z.push(J)}}let b=_.content;if(Array.isArray(b)){for(let G of b)if(G&&typeof G==="object"){let J=G;if(i(J.type)==="reasoning"||i(J.type)==="text"){let Y=i(J.text??J.content);if(Y)z.push(Y)}}}return z}function N5(_){let z=i(_);if(!z)return _;try{return JSON.parse(z)}catch{return _}}function xL(_,z){if(!_||typeof _!=="object")return _;let A={..._};if(typeof A.workdir==="string"&&z)A.workdir=w_(A.workdir,z);return A}function TL(_,z,A){if(!z)return z;if(_==="apply_patch"){let b=i(z);if(!b)return z;let G=mL(b,A);if(G.diff||G.file_path)return G}return z}function GX(_,z,A,b){if(_.type!=="tool-call")return _;let G=z;if(b==="shell")G=XX(z);else if(b==="exec_command")G=fL(z);else if(b==="apply_patch")G=hL(z);let J={..._,output:G};if(b==="shell"||b==="exec_command"){let Y=CL(J,A);if(Y)return Y}return E5(J,A,b)}function CL(_,z){if(_.type!=="tool-call"||!_.input)return null;let A=_.input,b=null;if(typeof A.cmd==="string")b=A.cmd;else if(typeof A.command==="string")b=A.command;else if(Array.isArray(A.command)&&A.command.length>=3){let X=A.command[0];if((X==="bash"||X==="zsh"||X==="/bin/zsh"||X==="/bin/bash")&&A.command[1]==="-lc")b=i(A.command[2])}if(!b)return null;let G=b.match(/^cat\s+<<'EOF'\s+>\s+(\S+)\s*\n([\s\S]*?)EOF$/);if(G){let[,X,Q]=G,$=z?w_(`${z}/${X}`,z):`./${X}`;return Y0.parse({..._,toolName:"Write",input:{file_path:$,content:Q||""},output:void 0})}let J=b.match(/^cat\s+(\S+)$/);if(J){let[,X]=J,Q=z?w_(`${z}/${X}`,z):`./${X}`,$;if(_.output&&typeof _.output==="object"){let H=_.output;$=i(H.stdout)??void 0}return Y0.parse({..._,toolName:"Read",input:{file_path:Q},output:$})}let Y=vL(b);if(Y.length>0&&Y[0]==="rg"){let X=yL(Y,z);if(X){let Q=JX(_.output),$;if(Q){let H=Q.split(`
66
+ `).filter((B)=>B.trim().length>0);if(X.input.output_mode==="files_with_matches")$={mode:"files_with_matches",filenames:H,numMatches:H.length};else $={mode:"content",content:Q,numMatches:H.length,numLines:H.length}}return Y0.parse({..._,toolName:"Grep",input:X.input,output:$})}}if(Y.length>=4&&Y[0]==="sed"){let X=gL(Y,z);if(X){let{filePath:Q,startLine:$}=X,H=JX(_.output),B;if(H){let Z=H.split(`
67
+ `).length;B={file:{content:H,numLines:Z,startLine:$}}}return Y0.parse({..._,toolName:"Read",input:{file_path:Q},output:B})}}return null}function vL(_){let z=[],A="",b=null,G=!1;for(let J of _){if(G){A+=J,G=!1;continue}if(J==="\\"&&b!=="'"){G=!0;continue}if(b){if(J===b)b=null;else A+=J;continue}if(J==="'"||J==='"'){b=J;continue}if(/\s/.test(J)){if(A.length>0)z.push(A),A="";continue}A+=J}if(A.length>0)z.push(A);return z}function JX(_){if(typeof _==="string")return _;if(_&&typeof _==="object"){let A=i(_.stdout);if(A)return A}return}function yL(_,z){if(_.length<2)return null;let A={},b=null,G=null;for(let J=1;J<_.length;J+=1){let Y=_[J];if(Y==="--")continue;if(Y.startsWith("-")){switch(Y){case"-i":A["-i"]=!0;break;case"-U":A.multiline=!0;break;case"-A":case"-B":case"-C":{let X=_[J+1];if(X)A[Y]=X,J+=1;break}case"-l":case"--files-with-matches":A.output_mode="files_with_matches";break;case"-c":case"--count":A.output_mode="count";break;case"-g":case"--glob":{let X=_[J+1];if(X)A.glob=X,J+=1;break}case"-t":case"--type":{let X=_[J+1];if(X)A.type=X,J+=1;break}case"-e":case"--regexp":{let X=_[J+1];if(X)b=X,J+=1;break}default:break}continue}if(!b){b=Y;continue}if(!G){G=Y;continue}}if(!b)return null;if(A.pattern=b,G)A.path=z?w_(G,z):G;return{input:A}}function gL(_,z){let A=_.indexOf("-n");if(A===-1)return null;let b=_[A+1],G=_[A+2];if(!b||!G)return null;let J=b.match(/^(\d+)(?:,(\d+))?p$/);if(!J)return null;let Y=parseInt(J[1],10);if(!Number.isFinite(Y)||Y<=0)return null;return{filePath:z?w_(G,z):G,startLine:Y}}function E5(_,z,A){if(_.type!=="tool-call")return _;let{toolName:b,input:G,output:J}=_;if(A==="shell"||A==="exec_command"){if(b="Bash",G&&typeof G==="object"){let Y=G,X={},Q=null;if(typeof Y.cmd==="string")Q=Y.cmd;else if(Array.isArray(Y.command)&&Y.command.length>=3){let $=Y.command[0];if(($==="bash"||$==="zsh"||$==="/bin/zsh"||$==="/bin/bash")&&Y.command[1]==="-lc")Q=i(Y.command[2])}else if(typeof Y.command==="string")Q=Y.command;if(Q)X.command=Q;if(typeof Y.description==="string")X.description=Y.description;G=X}}if(A==="apply_patch"){if(b="Edit",G&&typeof G==="object"){let Y={...G},X=i(Y.file_path);if(X&&z)Y.file_path=w_(X,z);G=Y}}if(z)G=M9(G,z),J=M9(J,z);return Y0.parse({..._,toolName:b,input:G,output:J})}function XX(_){if(!_||typeof _!=="object")return _;let z=_,A={},b=i(z.output??z.stdout);if(typeof z.stdout==="string")A.stdout=z.stdout;else if(b)A.stdout=b;let G=i(z.stderr);if(G)A.stderr=G;let J=z.metadata&&typeof z.metadata==="object"?z.metadata:{},Y=E4(J.exit_code??J.exitCode??z.exit_code??z.exitCode);if(Number.isFinite(Y))A.exitCode=Y;let X=E4(J.duration_seconds??J.durationSeconds);if(Number.isFinite(X)&&X>0)A.durationSeconds=X;return Object.keys(A).length>0?A:void 0}function fL(_){let z=i(_);if(!z)return XX(_);let A={},b=z.match(/Process exited with code (\d+)/);if(b)A.exitCode=parseInt(b[1],10);let G=z.match(/Wall time: ([\d.]+) seconds/);if(G){let Y=parseFloat(G[1]);if(Y>0)A.durationSeconds=Y}let J=z.match(/Output:\n([\s\S]*?)$/);if(J&&J[1]){let Y=J[1].trim();if(Y)A.stdout=Y}return Object.keys(A).length>0?A:void 0}function hL(_){if(!_||typeof _!=="object")return _;let z=_,A={},b=i(z.output);if(b)A.message=b;let G=z.metadata&&typeof z.metadata==="object"?z.metadata:null;if(G){let J=E4(G.exit_code??G.exitCode);if(Number.isFinite(J))A.exitCode=J;let Y=E4(G.duration_seconds??G.durationSeconds);if(Number.isFinite(Y)&&Y>0)A.durationSeconds=Y}return Object.keys(A).length>0?A:void 0}function mL(_,z){let A=_.split(/\r?\n/),b=null,G=[];for(let X of A){if(X.startsWith("*** ")){let Q=X.match(/^\*\*\* (?:Update|Add|Delete) File: (.+)$/);if(Q&&Q[1])b=Q[1].trim();continue}G.push(X)}let J=G.join(`
68
68
  `).trim(),Y={};if(b)Y.file_path=z?w_(b,z):b;if(J)Y.diff=J.endsWith(`
69
69
  `)?J:`${J}
70
- `;return Y}function w_(_,z){if(!_)return _;let A=V5.isAbsolute(_),b=_.replace(/\\/g,"/");if(!A){if(b==="."||b==="./")return".";if(b.startsWith("./")||b.startsWith("../"))return b;return`./${b}`}try{let G=V5.relative(z,_).replace(/\\/g,"/");if(G==="")return".";if(G.startsWith("..")||V5.isAbsolute(G))return _;return G==="."?".":`./${G}`}catch{return _}}function yL(_){return Math.max(0,_.inputTokens-_.cachedInputTokens)+_.outputTokens+_.reasoningOutputTokens}function gL(_){let z=_.trim().toLowerCase();return VL.some((A)=>z.startsWith(A))}function fL(_){for(let z of _){let A=b6(z);if(!A)continue;if(A.startsWith("<user_instructions>")||A.startsWith("<environment_context>"))continue;return A}return _.length>0?b6(_[0]):null}function hL(_,z){let A=z??_?.cwd??null;if(!_)return t0.parse({repo:null,branch:null,relativeCwd:null});let b=_.git.repositoryUrl?B8(_.git.repositoryUrl):null,G=_.git.branch,J=b?b.split("/").pop()??null:null,Y=mL(A,J);return t0.parse({repo:b,branch:G,relativeCwd:Wz(Y)})}function mL(_,z){if(!_)return null;let b=_.replace(/\\/g,"/").split("/").filter(Boolean);if(b.length===0)return null;if(z){let G=b.lastIndexOf(z);if(G>=0){let J=b.slice(G+1).join("/");return J.length>0?J:"."}}return null}function M5(_,z,A){let b=uL(_);if(b&&A.has(b))return;let G=Y0.parse(_);if(z.push(G),b)A.add(b)}function uL(_){if("text"in _&&typeof _.text==="string")return`${_.type}|${_.timestamp??""}|${_.text}`;if(_.type==="tool-call")return`${_.type}|${_.timestamp??""}|${_.id??""}|${_.toolName??""}`;return null}function YX(_){if(!_)return _;return WL[_]??_}function cL(_,z){let A=Date.parse(_),b=Date.parse(z);if(Number.isNaN(A)||Number.isNaN(b))return 0;return A===b?0:A>b?1:-1}function lL(_){if(!_)return null;let z=new Date(_);return Number.isNaN(z.getTime())?null:z}function E4(_){return typeof _==="number"&&Number.isFinite(_)?_:0}function i(_){if(typeof _!=="string")return null;let z=_.trim();return z.length>0?z:null}function b6(_){return _.replace(/\s+/g," ").trim()}function pL(_){return`codex-${_.getTime()}`}function dL(_){if(_.includes("/"))return _;return`openai/${_}`}function rL(_,z,A){if(!A||!_)return 0;let b=nL(_,A);if(!b)return 0;return iL({input_tokens:Math.max(0,z.inputTokens-z.cachedInputTokens),output_tokens:z.outputTokens+z.reasoningOutputTokens,cache_creation_input_tokens:0,cache_read_input_tokens:z.cachedInputTokens},b)}function nL(_,z){let A=_.trim();if(!A)return null;let b=new Set;b.add(A);for(let J of zX)b.add(`${J}${A}`);for(let J of zX)if(A.startsWith(J))b.add(A.slice(J.length));for(let J of b){let Y=z[J];if(Y)return Y}let G=A.toLowerCase();for(let[J,Y]of Object.entries(z)){let X=J.toLowerCase();if(X.includes(G)||G.includes(X))return Y}return null}function iL(_,z){let A=(X,Q,$,H=qL)=>{if(X==null||X<=0)return 0;if(X>H&&$!=null){let B=Math.min(X,H),F=Math.max(0,X-H)*$;if(Q!=null)F+=B*Q;return F}if(Q!=null)return X*Q;return 0},b=A(_.input_tokens,z.input_cost_per_token,z.input_cost_per_token_above_200k_tokens),G=A(_.output_tokens,z.output_cost_per_token,z.output_cost_per_token_above_200k_tokens),J=A(_.cache_creation_input_tokens,z.cache_creation_input_token_cost,z.cache_creation_input_token_cost_above_200k_tokens),Y=A(_.cache_read_input_tokens,z.cache_read_input_token_cost,z.cache_read_input_token_cost_above_200k_tokens);return b+G+J+Y}import Vz from"node:path";var E5={shell:"Bash",bash:"Bash",execute:"Bash",read_file:"Read",read:"Read",write_file:"Write",write:"Write",edit_file:"Edit",edit:"Edit",apply_patch:"Edit",multiedit:"Edit",glob:"Glob",grep:"Grep",find:"Glob",list_files:"Glob",ls:"Glob",webfetch:"WebFetch",websearch:"WebSearch",task:"Task",explore:"Explore",skill:"Skill",todowrite:"TodoWrite",todoread:"TodoRead",question:"Question",plan:"Plan",codesearch:"CodeSearch",lsp:"LSP"},oL=["anthropic/","claude-3-5-","claude-3-","claude-","openai/","azure/","openrouter/","google/","gemini/"],aL=200000;function E_(_,z={}){let{info:A,messages:b}=_;if(!b||b.length===0)return null;let G=z.cwd??A.directory??null,J=[],Y=[],X=null,Q=0,$=0,H=0,B=0,Z=0,F=[...b].sort((L,R)=>{return L.info.time.created-R.info.time.created});for(let L of F){let R=L.info,S=eL(R);if(R.role==="assistant"&&S&&!X)X=S;if(R.role==="assistant"&&R.tokens)$+=R.tokens.input??0,H+=R.tokens.output??0,B+=R.tokens.reasoning??0,Z+=R.tokens.cache?.read??0;if(R.role==="assistant"&&R.cost)Q+=R.cost;for(let y of L.parts){if(y.type==="step-start"||y.type==="step-finish")continue;let e=new Date(R.time.created).toISOString();switch(y.type){case"text":{let u=y.text?.trim();if(!u)break;if(R.role==="user")Y.push(u),J.push(Y0.parse({type:"user",text:u,id:R.id,timestamp:e}));else J.push(Y0.parse({type:"agent",text:u,id:R.id,timestamp:e,model:S??void 0}));break}case"reasoning":{let u=y.text?.trim();if(!u)break;J.push(Y0.parse({type:"thinking",text:u,timestamp:e,model:S??void 0}));break}case"tool":{let u=y.state??{},g=u.input;if(y.tool==="todoread")break;let m=sL(y.tool);if(m==="Task"&&g?.subagent_type&&typeof g.subagent_type==="string")m=tL(g.subagent_type);let d=bj(m,u.input,G,u.metadata),Z0=Gj(y.tool,m,u.output,u.metadata,G);J.push(Y0.parse({type:"tool-call",id:y.callID,timestamp:e,model:S??void 0,toolName:m,input:d,output:Z0,error:u.error,isError:u.status==="error"||!!u.error}));break}}}}if(J.length===0)return null;let K={inputTokens:$,cachedInputTokens:Z,outputTokens:H,reasoningOutputTokens:B,totalTokens:$+H},q=K.inputTokens+K.outputTokens,W=Q>0?Q:Jj(X,K,z.pricing),V=new Date(A.time.created),w=zj(Y),O=z.gitContext!==void 0?z.gitContext:t0.parse({repo:null,branch:null,relativeCwd:_j(F)}),M=G?f9(G):null,P=N_(J);return o4.parse({v:1,id:A.id,source:"opencode",timestamp:V,preview:w,summary:null,model:X,clientVersion:z.clientVersion??A.version??null,blendedTokens:q,costUsd:W,messageCount:J.length,...P,tokenUsage:K,modelUsage:X?[M_.parse({model:X,usage:K})]:[],git:O,cwd:M,messages:J})}function sL(_){let z=_.toLowerCase();return E5[z]??_}function tL(_){let z=_.toLowerCase();if(E5[z])return E5[z];return _.charAt(0).toUpperCase()+_.slice(1)}function eL(_){let z=_.modelID??_.model?.modelID,A=_.providerID??_.model?.providerID;if(!z)return null;if(A)return`${A}/${z}`;return z}function _j(_){for(let z of _){let A=z.info.path;if(A?.root&&A?.cwd){if(A.root===A.cwd)return null;try{let b=Vz.relative(A.root,A.cwd).replace(/\\/g,"/");if(b&&!b.startsWith("..")&&!Vz.isAbsolute(b))return b}catch{}}}return null}function zj(_){for(let z of _){let A=z.trim().replace(/\s+/g," ");if(!A)continue;if(A.startsWith("<")&&A.includes(">"))continue;return A.replace(/^["']|["']$/g,"")}return _.length>0?_[0].trim().replace(/\s+/g," "):null}function Aj(_){let z=_,A=z.match(/<file>\n?([\s\S]*?)\n?<\/file>/);if(A)z=A[1];return z=z.replace(/\n?\(End of file - total \d+ lines\)\n?$/,""),z.split(`
70
+ `;return Y}function w_(_,z){if(!_)return _;let A=D5.isAbsolute(_),b=_.replace(/\\/g,"/");if(!A){if(b==="."||b==="./")return".";if(b.startsWith("./")||b.startsWith("../"))return b;return`./${b}`}try{let G=D5.relative(z,_).replace(/\\/g,"/");if(G==="")return".";if(G.startsWith("..")||D5.isAbsolute(G))return _;return G==="."?".":`./${G}`}catch{return _}}function uL(_){return Math.max(0,_.inputTokens-_.cachedInputTokens)+_.outputTokens+_.reasoningOutputTokens}function cL(_){let z=_.trim().toLowerCase();return wL.some((A)=>z.startsWith(A))}function lL(_){for(let z of _){let A=Y6(z);if(!A)continue;if(A.startsWith("<user_instructions>")||A.startsWith("<environment_context>"))continue;return A}return _.length>0?Y6(_[0]):null}function pL(_,z){let A=z??_?.cwd??null;if(!_)return t0.parse({repo:null,branch:null,relativeCwd:null});let b=_.git.repositoryUrl?K8(_.git.repositoryUrl):null,G=_.git.branch,J=b?b.split("/").pop()??null:null,Y=dL(A,J);return t0.parse({repo:b,branch:G,relativeCwd:Uz(Y)})}function dL(_,z){if(!_)return null;let b=_.replace(/\\/g,"/").split("/").filter(Boolean);if(b.length===0)return null;if(z){let G=b.lastIndexOf(z);if(G>=0){let J=b.slice(G+1).join("/");return J.length>0?J:"."}}return null}function w5(_,z,A){let b=rL(_);if(b&&A.has(b))return;let G=Y0.parse(_);if(z.push(G),b)A.add(b)}function rL(_){if("text"in _&&typeof _.text==="string")return`${_.type}|${_.timestamp??""}|${_.text}`;if(_.type==="tool-call")return`${_.type}|${_.timestamp??""}|${_.id??""}|${_.toolName??""}`;return null}function YX(_){if(!_)return _;return NL[_]??_}function nL(_,z){let A=Date.parse(_),b=Date.parse(z);if(Number.isNaN(A)||Number.isNaN(b))return 0;return A===b?0:A>b?1:-1}function iL(_){if(!_)return null;let z=new Date(_);return Number.isNaN(z.getTime())?null:z}function E4(_){return typeof _==="number"&&Number.isFinite(_)?_:0}function i(_){if(typeof _!=="string")return null;let z=_.trim();return z.length>0?z:null}function Y6(_){return _.replace(/\s+/g," ").trim()}function oL(_){return`codex-${_.getTime()}`}function aL(_){if(_.includes("/"))return _;return`openai/${_}`}function sL(_,z,A){if(!A||!_)return 0;let b=tL(_,A);if(!b)return 0;return eL({input_tokens:Math.max(0,z.inputTokens-z.cachedInputTokens),output_tokens:z.outputTokens+z.reasoningOutputTokens,cache_creation_input_tokens:0,cache_read_input_tokens:z.cachedInputTokens},b)}function tL(_,z){let A=_.trim();if(!A)return null;let b=new Set;b.add(A);for(let J of zX)b.add(`${J}${A}`);for(let J of zX)if(A.startsWith(J))b.add(A.slice(J.length));for(let J of b){let Y=z[J];if(Y)return Y}let G=A.toLowerCase();for(let[J,Y]of Object.entries(z)){let X=J.toLowerCase();if(X.includes(G)||G.includes(X))return Y}return null}function eL(_,z){let A=(X,Q,$,H=ML)=>{if(X==null||X<=0)return 0;if(X>H&&$!=null){let B=Math.min(X,H),F=Math.max(0,X-H)*$;if(Q!=null)F+=B*Q;return F}if(Q!=null)return X*Q;return 0},b=A(_.input_tokens,z.input_cost_per_token,z.input_cost_per_token_above_200k_tokens),G=A(_.output_tokens,z.output_cost_per_token,z.output_cost_per_token_above_200k_tokens),J=A(_.cache_creation_input_tokens,z.cache_creation_input_token_cost,z.cache_creation_input_token_cost_above_200k_tokens),Y=A(_.cache_read_input_tokens,z.cache_read_input_token_cost,z.cache_read_input_token_cost_above_200k_tokens);return b+G+J+Y}import Dz from"node:path";var L5={shell:"Bash",bash:"Bash",execute:"Bash",read_file:"Read",read:"Read",write_file:"Write",write:"Write",edit_file:"Edit",edit:"Edit",apply_patch:"Edit",multiedit:"Edit",glob:"Glob",grep:"Grep",find:"Glob",list_files:"Glob",ls:"Glob",webfetch:"WebFetch",websearch:"WebSearch",task:"Task",explore:"Explore",skill:"Skill",todowrite:"TodoWrite",todoread:"TodoRead",question:"Question",plan:"Plan",codesearch:"CodeSearch",lsp:"LSP"},_j=["anthropic/","claude-3-5-","claude-3-","claude-","openai/","azure/","openrouter/","google/","gemini/"],zj=200000;function E_(_,z={}){let{info:A,messages:b}=_;if(!b||b.length===0)return null;let G=z.cwd??A.directory??null,J=[],Y=[],X=null,Q=0,$=0,H=0,B=0,Z=0,F=[...b].sort((L,R)=>{return L.info.time.created-R.info.time.created});for(let L of F){let R=L.info,S=Gj(R);if(R.role==="assistant"&&S&&!X)X=S;if(R.role==="assistant"&&R.tokens)$+=R.tokens.input??0,H+=R.tokens.output??0,B+=R.tokens.reasoning??0,Z+=R.tokens.cache?.read??0;if(R.role==="assistant"&&R.cost)Q+=R.cost;for(let y of L.parts){if(y.type==="step-start"||y.type==="step-finish")continue;let e=new Date(R.time.created).toISOString();switch(y.type){case"text":{let u=y.text?.trim();if(!u)break;if(R.role==="user")Y.push(u),J.push(Y0.parse({type:"user",text:u,id:R.id,timestamp:e}));else J.push(Y0.parse({type:"agent",text:u,id:R.id,timestamp:e,model:S??void 0}));break}case"reasoning":{let u=y.text?.trim();if(!u)break;J.push(Y0.parse({type:"thinking",text:u,timestamp:e,model:S??void 0}));break}case"tool":{let u=y.state??{},g=u.input;if(y.tool==="todoread")break;let m=Aj(y.tool);if(m==="Task"&&g?.subagent_type&&typeof g.subagent_type==="string")m=bj(g.subagent_type);let d=Qj(m,u.input,G,u.metadata),Z0=$j(y.tool,m,u.output,u.metadata,G);J.push(Y0.parse({type:"tool-call",id:y.callID,timestamp:e,model:S??void 0,toolName:m,input:d,output:Z0,error:u.error,isError:u.status==="error"||!!u.error}));break}}}}if(J.length===0)return null;let K={inputTokens:$,cachedInputTokens:Z,outputTokens:H,reasoningOutputTokens:B,totalTokens:$+H},q=K.inputTokens+K.outputTokens,W=Q>0?Q:Hj(X,K,z.pricing),V=new Date(A.time.created),w=Yj(Y),O=z.gitContext!==void 0?z.gitContext:t0.parse({repo:null,branch:null,relativeCwd:Jj(F)}),M=G?h9(G):null,P=N_(J);return o4.parse({v:1,id:A.id,source:"opencode",timestamp:V,preview:w,summary:null,model:X,clientVersion:z.clientVersion??A.version??null,blendedTokens:q,costUsd:W,messageCount:J.length,...P,tokenUsage:K,modelUsage:X?[M_.parse({model:X,usage:K})]:[],git:O,cwd:M,messages:J})}function Aj(_){let z=_.toLowerCase();return L5[z]??_}function bj(_){let z=_.toLowerCase();if(L5[z])return L5[z];return _.charAt(0).toUpperCase()+_.slice(1)}function Gj(_){let z=_.modelID??_.model?.modelID,A=_.providerID??_.model?.providerID;if(!z)return null;if(A)return`${A}/${z}`;return z}function Jj(_){for(let z of _){let A=z.info.path;if(A?.root&&A?.cwd){if(A.root===A.cwd)return null;try{let b=Dz.relative(A.root,A.cwd).replace(/\\/g,"/");if(b&&!b.startsWith("..")&&!Dz.isAbsolute(b))return b}catch{}}}return null}function Yj(_){for(let z of _){let A=z.trim().replace(/\s+/g," ");if(!A)continue;if(A.startsWith("<")&&A.includes(">"))continue;return A.replace(/^["']|["']$/g,"")}return _.length>0?_[0].trim().replace(/\s+/g," "):null}function Xj(_){let z=_,A=z.match(/<file>\n?([\s\S]*?)\n?<\/file>/);if(A)z=A[1];return z=z.replace(/\n?\(End of file - total \d+ lines\)\n?$/,""),z.split(`
71
71
  `).map((J)=>{let Y=J.match(/^\d+\| (.*)$/);return Y?Y[1]:J}).join(`
72
72
  `)}function QX(_){if(!_)return _;let z=_.split(`
73
73
  `),A=[],b=!1;for(let G of z){if(G.startsWith("Index: ")||G.startsWith("===")||G.startsWith("--- ")||G.startsWith("+++ "))continue;if(G.startsWith("@@")){b=!0;continue}if(b)A.push(G)}return A.join(`
74
- `).trim()||void 0}function bj(_,z,A,b){if(!z||typeof z!=="object")return z;let G={...z};if(_==="Edit"&&typeof G.patchText==="string"&&b?.files){let J=b.files;if(J.length===1){let Y=J[0];return{file_path:Y.relativePath??(A&&Y.filePath?a4(Y.filePath,A):Y.filePath),diff:QX(Y.diff),type:Y.type}}else if(J.length>1)return{files:J.map((Y)=>({file_path:Y.relativePath??(A&&Y.filePath?a4(Y.filePath,A):Y.filePath),type:Y.type,diff:QX(Y.diff)}))}}if(typeof G.filePath==="string")G.file_path=A?a4(G.filePath,A):G.filePath,delete G.filePath;else if(typeof G.file_path==="string"&&A)G.file_path=a4(G.file_path,A);if(_==="Grep"&&typeof G.include==="string")G.glob=G.include,delete G.include;if((_==="Glob"||_==="Grep")&&typeof G.path==="string")delete G.path;else if(typeof G.path==="string"&&A)G.path=a4(G.path,A);if(typeof G.workdir==="string"&&A)G.workdir=a4(G.workdir,A);return A?M9(G,A):G}function Gj(_,z,A,b,G){let J=A;if(z==="Bash"&&b){let Y={};if(typeof b.output==="string")Y.stdout=b.output;if(typeof b.exit==="number")Y.exitCode=b.exit;if(typeof b.description==="string")Y.description=b.description;J=Object.keys(Y).length>0?Y:A}else if(z==="Read"){let Y=b?.preview??(typeof A==="string"?Aj(A):null);if(Y){let X=Y.split(`
74
+ `).trim()||void 0}function Qj(_,z,A,b){if(!z||typeof z!=="object")return z;let G={...z};if(_==="Edit"&&typeof G.patchText==="string"&&b?.files){let J=b.files;if(J.length===1){let Y=J[0];return{file_path:Y.relativePath??(A&&Y.filePath?a4(Y.filePath,A):Y.filePath),diff:QX(Y.diff),type:Y.type}}else if(J.length>1)return{files:J.map((Y)=>({file_path:Y.relativePath??(A&&Y.filePath?a4(Y.filePath,A):Y.filePath),type:Y.type,diff:QX(Y.diff)}))}}if(typeof G.filePath==="string")G.file_path=A?a4(G.filePath,A):G.filePath,delete G.filePath;else if(typeof G.file_path==="string"&&A)G.file_path=a4(G.file_path,A);if(_==="Grep"&&typeof G.include==="string")G.glob=G.include,delete G.include;if((_==="Glob"||_==="Grep")&&typeof G.path==="string")delete G.path;else if(typeof G.path==="string"&&A)G.path=a4(G.path,A);if(typeof G.workdir==="string"&&A)G.workdir=a4(G.workdir,A);return A?M9(G,A):G}function $j(_,z,A,b,G){let J=A;if(z==="Bash"&&b){let Y={};if(typeof b.output==="string")Y.stdout=b.output;if(typeof b.exit==="number")Y.exitCode=b.exit;if(typeof b.description==="string")Y.description=b.description;J=Object.keys(Y).length>0?Y:A}else if(z==="Read"){let Y=b?.preview??(typeof A==="string"?Xj(A):null);if(Y){let X=Y.split(`
75
75
  `).length;J={file:{content:Y,numLines:X,totalLines:X}}}}else if(z==="Glob"){let X=(typeof A==="string"?A:"").split(`
76
76
  `).map((Q)=>Q.trim()).filter(Boolean).map((Q)=>G?a4(Q,G):Q);J={filenames:X,numFiles:b?.count??X.length}}else if(z==="Grep"){let X=(typeof A==="string"?A:"").split(`
77
77
  `),Q=b?.matches??0,$=X.slice(1).filter((H)=>H.trim());J={mode:"content",content:$.join(`
78
- `),numMatches:Q,numLines:$.length}}else if(_==="apply_patch"&&b?.files){let Y=b.files;if(Y.length===1){let X=Y[0];J={additions:X.additions,deletions:X.deletions}}else J={files:Y.map((X)=>({file_path:X.relativePath??(G&&X.filePath?a4(X.filePath,G):X.filePath),additions:X.additions,deletions:X.deletions}))}}else if(z==="Edit"&&b?.filediff)J={diff:b.diff,additions:b.filediff.additions,deletions:b.filediff.deletions};else if(z==="Write"&&b)J={created:!b.exists};else if(z==="Explore")J={content:(typeof A==="string"?A:"").replace(/<task_metadata>[\s\S]*?<\/task_metadata>/g,"").trim()};else if(z==="Skill")J={content:typeof A==="string"?A:""};else if(z==="WebFetch")J={content:typeof A==="string"?A:""};else if(z==="TodoWrite"||z==="TodoRead")J={todos:b?.todos??[]};return G?M9(J,G):J}function a4(_,z){if(!_)return _;let A=Vz.isAbsolute(_),b=_.replace(/\\/g,"/");if(!A){if(b==="."||b==="./")return".";if(b.startsWith("./")||b.startsWith("../"))return b;return`./${b}`}try{let G=Vz.relative(z,_).replace(/\\/g,"/");if(G==="")return".";if(G.startsWith("..")||Vz.isAbsolute(G))return _;return G==="."?".":`./${G}`}catch{return _}}function Jj(_,z,A){if(!A||!_)return 0;let b=Yj(_,A);if(!b)return 0;return Xj({input_tokens:z.inputTokens,output_tokens:z.outputTokens,cache_creation_input_tokens:0,cache_read_input_tokens:z.cachedInputTokens},b)}function Yj(_,z){let A=_.trim();if(!A)return null;let b=new Set;b.add(A);for(let J of oL)b.add(`${J}${A}`);for(let J of b){let Y=z[J];if(Y)return Y}let G=A.toLowerCase();for(let[J,Y]of Object.entries(z)){let X=J.toLowerCase();if(X.includes(G)||G.includes(X))return Y}return null}function Xj(_,z){let A=(X,Q,$,H=aL)=>{if(X==null||X<=0)return 0;if(X>H&&$!=null){let B=Math.min(X,H),F=Math.max(0,X-H)*$;if(Q!=null)F+=B*Q;return F}if(Q!=null)return X*Q;return 0},b=A(_.input_tokens,z.input_cost_per_token,z.input_cost_per_token_above_200k_tokens),G=A(_.output_tokens,z.output_cost_per_token,z.output_cost_per_token_above_200k_tokens),J=A(_.cache_creation_input_tokens,z.cache_creation_input_token_cost,z.cache_creation_input_token_cost_above_200k_tokens),Y=A(_.cache_read_input_tokens,z.cache_read_input_token_cost,z.cache_read_input_token_cost_above_200k_tokens);return b+G+J+Y}import Qj from"node:crypto";var $j={read:"Read",write:"Write",edit:"Edit",bash:"Bash",grep:"Grep",find:"Glob",ls:"Ls"};function O_(_,z={}){let{header:A,entries:b}=_;if(b.length===0)return null;let G=z.leafId??Hj(b);if(!G)return null;let J=Bj(b,G);if(J.length===0)return null;let Y=Zj(b,G),X=Y?`${A.id}-${Y}`:A.id,Q=z.cwd??A.cwd,{messages:$,blobs:H,tokenUsage:B,modelUsageMap:Z,primaryModel:F,cwd:K}=Fj(J,Q);if($.length===0)return null;let q=Mj($),W=wj(A.timestamp)??z.now??new Date,V=Ej(B),w=B.cost??jj(F,B,z.pricing),O=z.gitContext!==void 0?z.gitContext:null,M=K?f9(K):"",P=N_($);return{transcript:o4.parse({v:1,id:X,source:"pi",timestamp:W,preview:q,summary:null,model:F,clientVersion:z.clientVersion??null,blendedTokens:V,costUsd:w,messageCount:$.length,...P,tokenUsage:{inputTokens:B.inputTokens,cachedInputTokens:B.cachedInputTokens,outputTokens:B.outputTokens,reasoningOutputTokens:B.reasoningOutputTokens,totalTokens:B.totalTokens},modelUsage:Array.from(Z.entries()).map(([L,R])=>M_.parse({model:L,usage:R})),git:O,cwd:M,messages:$}),blobs:H}}function Hj(_){let z=new Set;for(let b of _)if(b.parentId)z.add(b.parentId);let A=null;for(let b of _)if(!z.has(b.id)){if(!A||b.timestamp>A.timestamp)A={id:b.id,timestamp:b.timestamp}}return A?.id??null}function Bj(_,z){let A=new Map(_.map((J)=>[J.id,J])),b=[],G=z;while(G){let J=A.get(G);if(!J)break;b.unshift(J),G=J.parentId}return b}function Zj(_,z){let A=new Map;for(let J of _){let Y=A.get(J.parentId)??[];Y.push(J.id),A.set(J.parentId,Y)}let b=new Map(_.map((J)=>[J.id,J])),G=z;while(G){let J=b.get(G);if(!J)break;let Y=J.parentId;if((A.get(Y)??[]).length>1)return G;G=Y}return null}function Fj(_,z){let A={messages:[],blobs:new Map,tokenUsage:{inputTokens:0,cachedInputTokens:0,outputTokens:0,reasoningOutputTokens:0,totalTokens:0,cost:0},modelUsageMap:new Map,primaryModel:null,cwd:z,toolCallsById:new Map};for(let b of _)if(b.type==="message")Kj(b,A);else if(b.type==="compaction")qj(b,A);return A}function Kj(_,z){let{message:A,timestamp:b}=_,G=z.cwd;switch(A.role){case"user":{let{text:J,images:Y}=Wj(A.content,z.blobs);if(J||Y.length>0){let X={type:"user",text:J||"",timestamp:b};if(Y.length>0)X.images=Y;z.messages.push(Y0.parse(X))}break}case"assistant":{let J=`${A.provider}/${A.model}`;if(!z.primaryModel)z.primaryModel=J;if(A.usage){z.tokenUsage.inputTokens+=A.usage.input??0,z.tokenUsage.cachedInputTokens+=A.usage.cacheRead??0,z.tokenUsage.outputTokens+=A.usage.output??0,z.tokenUsage.totalTokens+=A.usage.totalTokens??0,z.tokenUsage.cost+=A.usage.cost?.total??0;let Y=z.modelUsageMap.get(J)??{inputTokens:0,cachedInputTokens:0,outputTokens:0,reasoningOutputTokens:0,totalTokens:0};Y.inputTokens+=A.usage.input??0,Y.cachedInputTokens+=A.usage.cacheRead??0,Y.outputTokens+=A.usage.output??0,Y.totalTokens+=A.usage.totalTokens??0,z.modelUsageMap.set(J,Y)}for(let Y of A.content)if(Y.type==="thinking"&&Y.thinking)z.messages.push(Y0.parse({type:"thinking",text:Y.thinking,timestamp:b,model:J}));else if(Y.type==="text"&&Y.text)z.messages.push(Y0.parse({type:"agent",text:Y.text,timestamp:b,model:J}));else if(Y.type==="toolCall"){let X=Vj(Y.name),Q=Uj(X,Y.arguments,G),$=Y0.parse({type:"tool-call",id:Y.id,toolName:X,input:Q,timestamp:b,model:J});z.toolCallsById.set(Y.id,z.messages.length),z.messages.push($)}break}case"toolResult":{let J=z.toolCallsById.get(A.toolCallId);if(J!==void 0){let Y=z.messages[J],{output:X,images:Q}=Dj(A.toolName,A.content,A.details,G,z.blobs);if(Y.output=X,Q.length>0)Y.images=Q;if(A.isError)Y.isError=!0}break}case"bashExecution":{z.messages.push(Y0.parse({type:"command",name:A.excludeFromContext?"!!":"!",args:A.command,output:A.output||void 0,timestamp:b}));break}case"compactionSummary":{z.messages.push(Y0.parse({type:"compaction-summary",text:A.summary,timestamp:b}));break}case"branchSummary":{z.messages.push(Y0.parse({type:"agent",text:`[Branch summary] ${A.summary}`,timestamp:b}));break}case"custom":break}}function qj(_,z){z.messages.push(Y0.parse({type:"compaction-summary",text:_.summary,timestamp:_.timestamp}))}function Wj(_,z){if(typeof _==="string")return{text:_,images:[]};let A=[],b=[];for(let G of _)if(G.type==="text"&&G.text)A.push(G.text);else if(G.type==="image"){let J=Buffer.from(G.data,"base64"),Y=HX(J);if(!z.has(Y))z.set(Y,{data:J,mediaType:G.mimeType});b.push({sha256:Y,mediaType:G.mimeType})}return{text:A.join(`
78
+ `),numMatches:Q,numLines:$.length}}else if(_==="apply_patch"&&b?.files){let Y=b.files;if(Y.length===1){let X=Y[0];J={additions:X.additions,deletions:X.deletions}}else J={files:Y.map((X)=>({file_path:X.relativePath??(G&&X.filePath?a4(X.filePath,G):X.filePath),additions:X.additions,deletions:X.deletions}))}}else if(z==="Edit"&&b?.filediff)J={diff:b.diff,additions:b.filediff.additions,deletions:b.filediff.deletions};else if(z==="Write"&&b)J={created:!b.exists};else if(z==="Explore")J={content:(typeof A==="string"?A:"").replace(/<task_metadata>[\s\S]*?<\/task_metadata>/g,"").trim()};else if(z==="Skill")J={content:typeof A==="string"?A:""};else if(z==="WebFetch")J={content:typeof A==="string"?A:""};else if(z==="TodoWrite"||z==="TodoRead")J={todos:b?.todos??[]};return G?M9(J,G):J}function a4(_,z){if(!_)return _;let A=Dz.isAbsolute(_),b=_.replace(/\\/g,"/");if(!A){if(b==="."||b==="./")return".";if(b.startsWith("./")||b.startsWith("../"))return b;return`./${b}`}try{let G=Dz.relative(z,_).replace(/\\/g,"/");if(G==="")return".";if(G.startsWith("..")||Dz.isAbsolute(G))return _;return G==="."?".":`./${G}`}catch{return _}}function Hj(_,z,A){if(!A||!_)return 0;let b=Bj(_,A);if(!b)return 0;return Zj({input_tokens:z.inputTokens,output_tokens:z.outputTokens,cache_creation_input_tokens:0,cache_read_input_tokens:z.cachedInputTokens},b)}function Bj(_,z){let A=_.trim();if(!A)return null;let b=new Set;b.add(A);for(let J of _j)b.add(`${J}${A}`);for(let J of b){let Y=z[J];if(Y)return Y}let G=A.toLowerCase();for(let[J,Y]of Object.entries(z)){let X=J.toLowerCase();if(X.includes(G)||G.includes(X))return Y}return null}function Zj(_,z){let A=(X,Q,$,H=zj)=>{if(X==null||X<=0)return 0;if(X>H&&$!=null){let B=Math.min(X,H),F=Math.max(0,X-H)*$;if(Q!=null)F+=B*Q;return F}if(Q!=null)return X*Q;return 0},b=A(_.input_tokens,z.input_cost_per_token,z.input_cost_per_token_above_200k_tokens),G=A(_.output_tokens,z.output_cost_per_token,z.output_cost_per_token_above_200k_tokens),J=A(_.cache_creation_input_tokens,z.cache_creation_input_token_cost,z.cache_creation_input_token_cost_above_200k_tokens),Y=A(_.cache_read_input_tokens,z.cache_read_input_token_cost,z.cache_read_input_token_cost_above_200k_tokens);return b+G+J+Y}import Fj from"node:crypto";var Kj={read:"Read",write:"Write",edit:"Edit",bash:"Bash",grep:"Grep",find:"Glob",ls:"Ls"};function O_(_,z={}){let{header:A,entries:b}=_;if(b.length===0)return null;let G=z.leafId??qj(b);if(!G)return null;let J=Wj(b,G);if(J.length===0)return null;let Y=Vj(b,G),X=Y?`${A.id}-${Y}`:A.id,Q=z.cwd??A.cwd,{messages:$,blobs:H,tokenUsage:B,modelUsageMap:Z,primaryModel:F,cwd:K}=Uj(J,Q);if($.length===0)return null;let q=Lj($),W=Rj(A.timestamp)??z.now??new Date,V=Pj(B),w=B.cost??Ij(F,B,z.pricing),O=z.gitContext!==void 0?z.gitContext:null,M=K?h9(K):"",P=N_($);return{transcript:o4.parse({v:1,id:X,source:"pi",timestamp:W,preview:q,summary:null,model:F,clientVersion:z.clientVersion??null,blendedTokens:V,costUsd:w,messageCount:$.length,...P,tokenUsage:{inputTokens:B.inputTokens,cachedInputTokens:B.cachedInputTokens,outputTokens:B.outputTokens,reasoningOutputTokens:B.reasoningOutputTokens,totalTokens:B.totalTokens},modelUsage:Array.from(Z.entries()).map(([L,R])=>M_.parse({model:L,usage:R})),git:O,cwd:M,messages:$}),blobs:H}}function qj(_){let z=new Set;for(let b of _)if(b.parentId)z.add(b.parentId);let A=null;for(let b of _)if(!z.has(b.id)){if(!A||b.timestamp>A.timestamp)A={id:b.id,timestamp:b.timestamp}}return A?.id??null}function Wj(_,z){let A=new Map(_.map((J)=>[J.id,J])),b=[],G=z;while(G){let J=A.get(G);if(!J)break;b.unshift(J),G=J.parentId}return b}function Vj(_,z){let A=new Map;for(let J of _){let Y=A.get(J.parentId)??[];Y.push(J.id),A.set(J.parentId,Y)}let b=new Map(_.map((J)=>[J.id,J])),G=z;while(G){let J=b.get(G);if(!J)break;let Y=J.parentId;if((A.get(Y)??[]).length>1)return G;G=Y}return null}function Uj(_,z){let A={messages:[],blobs:new Map,tokenUsage:{inputTokens:0,cachedInputTokens:0,outputTokens:0,reasoningOutputTokens:0,totalTokens:0,cost:0},modelUsageMap:new Map,primaryModel:null,cwd:z,toolCallsById:new Map};for(let b of _)if(b.type==="message")Dj(b,A);else if(b.type==="compaction")Mj(b,A);return A}function Dj(_,z){let{message:A,timestamp:b}=_,G=z.cwd;switch(A.role){case"user":{let{text:J,images:Y}=Nj(A.content,z.blobs);if(J||Y.length>0){let X={type:"user",text:J||"",timestamp:b};if(Y.length>0)X.images=Y;z.messages.push(Y0.parse(X))}break}case"assistant":{let J=`${A.provider}/${A.model}`;if(!z.primaryModel)z.primaryModel=J;if(A.usage){z.tokenUsage.inputTokens+=A.usage.input??0,z.tokenUsage.cachedInputTokens+=A.usage.cacheRead??0,z.tokenUsage.outputTokens+=A.usage.output??0,z.tokenUsage.totalTokens+=A.usage.totalTokens??0,z.tokenUsage.cost+=A.usage.cost?.total??0;let Y=z.modelUsageMap.get(J)??{inputTokens:0,cachedInputTokens:0,outputTokens:0,reasoningOutputTokens:0,totalTokens:0};Y.inputTokens+=A.usage.input??0,Y.cachedInputTokens+=A.usage.cacheRead??0,Y.outputTokens+=A.usage.output??0,Y.totalTokens+=A.usage.totalTokens??0,z.modelUsageMap.set(J,Y)}for(let Y of A.content)if(Y.type==="thinking"&&Y.thinking)z.messages.push(Y0.parse({type:"thinking",text:Y.thinking,timestamp:b,model:J}));else if(Y.type==="text"&&Y.text)z.messages.push(Y0.parse({type:"agent",text:Y.text,timestamp:b,model:J}));else if(Y.type==="toolCall"){let X=wj(Y.name),Q=Ej(X,Y.arguments,G),$=Y0.parse({type:"tool-call",id:Y.id,toolName:X,input:Q,timestamp:b,model:J});z.toolCallsById.set(Y.id,z.messages.length),z.messages.push($)}break}case"toolResult":{let J=z.toolCallsById.get(A.toolCallId);if(J!==void 0){let Y=z.messages[J],{output:X,images:Q}=Oj(A.toolName,A.content,A.details,G,z.blobs);if(Y.output=X,Q.length>0)Y.images=Q;if(A.isError)Y.isError=!0}break}case"bashExecution":{z.messages.push(Y0.parse({type:"command",name:A.excludeFromContext?"!!":"!",args:A.command,output:A.output||void 0,timestamp:b}));break}case"compactionSummary":{z.messages.push(Y0.parse({type:"compaction-summary",text:A.summary,timestamp:b}));break}case"branchSummary":{z.messages.push(Y0.parse({type:"agent",text:`[Branch summary] ${A.summary}`,timestamp:b}));break}case"custom":break}}function Mj(_,z){z.messages.push(Y0.parse({type:"compaction-summary",text:_.summary,timestamp:_.timestamp}))}function Nj(_,z){if(typeof _==="string")return{text:_,images:[]};let A=[],b=[];for(let G of _)if(G.type==="text"&&G.text)A.push(G.text);else if(G.type==="image"){let J=Buffer.from(G.data,"base64"),Y=HX(J);if(!z.has(Y))z.set(Y,{data:J,mediaType:G.mimeType});b.push({sha256:Y,mediaType:G.mimeType})}return{text:A.join(`
79
79
 
80
- `),images:b}}function HX(_){return Qj.createHash("sha256").update(_).digest("hex")}function Vj(_){return $j[_.toLowerCase()]??_}function Uj(_,z,A){if(!z||typeof z!=="object")return z;let b={...z};if(typeof b.path==="string")b.file_path=A?$X(b.path,A):b.path,delete b.path;if(typeof b.file_path==="string"&&A)b.file_path=$X(b.file_path,A);return A?M9(b,A):b}function Dj(_,z,A,b,G){let J=[],Y=[];for(let $ of z)if($.type==="text"&&$.text)J.push($.text);else if($.type==="image"){let H=Buffer.from($.data,"base64"),B=HX(H);if(!G.has(B))G.set(B,{data:H,mediaType:$.mimeType});Y.push({sha256:B,mediaType:$.mimeType})}let X=J.join(`
80
+ `),images:b}}function HX(_){return Fj.createHash("sha256").update(_).digest("hex")}function wj(_){return Kj[_.toLowerCase()]??_}function Ej(_,z,A){if(!z||typeof z!=="object")return z;let b={...z};if(typeof b.path==="string")b.file_path=A?$X(b.path,A):b.path,delete b.path;if(typeof b.file_path==="string"&&A)b.file_path=$X(b.file_path,A);return A?M9(b,A):b}function Oj(_,z,A,b,G){let J=[],Y=[];for(let $ of z)if($.type==="text"&&$.text)J.push($.text);else if($.type==="image"){let H=Buffer.from($.data,"base64"),B=HX(H);if(!G.has(B))G.set(B,{data:H,mediaType:$.mimeType});Y.push({sha256:B,mediaType:$.mimeType})}let X=J.join(`
81
81
  `);if(_==="edit"&&A&&typeof A==="object"){let $=A;if($.diff)return{output:{diff:$.diff},images:Y}}if(_==="read"&&X){let $=X.split(`
82
- `).length;return{output:{file:{content:X,numLines:$,totalLines:$}},images:Y}}return{output:X||(b?M9(A,b):A),images:Y}}function $X(_,z){if(!_)return _;let A=_.startsWith("/"),b=_.replace(/\\/g,"/");if(!A){if(b==="."||b==="./")return".";if(b.startsWith("./")||b.startsWith("../"))return b;return`./${b}`}let G=z.replace(/\\/g,"/");if(b.startsWith(G+"/"))return`./${b.slice(G.length+1)}`;return f9(b)}function Mj(_){for(let z of _)if(z.type==="user"&&z.text)return Nj(z.text);return null}function Nj(_){return _.replace(/\s+/g," ").trim()}function wj(_){if(!_)return null;let z=new Date(_);return Number.isNaN(z.getTime())?null:z}function Ej(_){return Math.max(0,_.inputTokens-_.cachedInputTokens)+_.outputTokens+_.reasoningOutputTokens}var Oj=["anthropic/","openai/","google/"],Lj=200000;function jj(_,z,A){if(!A||!_)return 0;let b=Rj(_,A);if(!b)return 0;return Pj({input_tokens:Math.max(0,z.inputTokens-z.cachedInputTokens),output_tokens:z.outputTokens,cache_read_input_tokens:z.cachedInputTokens},b)}function Rj(_,z){let A=_.trim();if(!A)return null;let b=new Set;b.add(A);for(let G of Oj)b.add(`${G}${A}`);for(let G of b){let J=z[G];if(J)return J}return null}function Pj(_,z){let A=(Y,X,Q,$=Lj)=>{if(Y==null||Y<=0)return 0;if(Y>$&&Q!=null){let H=Math.min(Y,$),Z=Math.max(0,Y-$)*Q;if(X!=null)Z+=H*X;return Z}if(X!=null)return Y*X;return 0},b=A(_.input_tokens,z.input_cost_per_token,z.input_cost_per_token_above_200k_tokens),G=A(_.output_tokens,z.output_cost_per_token,z.output_cost_per_token_above_200k_tokens),J=A(_.cache_read_input_tokens,z.cache_read_input_token_cost,z.cache_read_input_token_cost_above_200k_tokens);return b+G+J}var Sj="https://raw.githubusercontent.com/BerriAI/litellm/main/model_prices_and_context_window.json",kj=200000,Ij=U.object({input_cost_per_token:U.number().optional(),output_cost_per_token:U.number().optional(),cache_creation_input_token_cost:U.number().optional(),cache_read_input_token_cost:U.number().optional(),max_tokens:U.number().optional(),max_input_tokens:U.number().optional(),max_output_tokens:U.number().optional(),input_cost_per_token_above_200k_tokens:U.number().optional(),output_cost_per_token_above_200k_tokens:U.number().optional(),cache_creation_input_token_cost_above_200k_tokens:U.number().optional(),cache_read_input_token_cost_above_200k_tokens:U.number().optional(),input_cost_per_token_above_128k_tokens:U.number().optional(),output_cost_per_token_above_128k_tokens:U.number().optional()}),xj=["anthropic/","claude-3-5-","claude-3-","claude-","openai/","azure/","openrouter/openai/"];function Tj(_){if(_!=null)return _;return{debug:()=>{},error:()=>{},info:()=>{},warn:()=>{}}}class r0{cachedPricing=null;logger;offline;offlineLoader;url;providerPrefixes;constructor(_={}){this.logger=Tj(_.logger),this.offline=Boolean(_.offline),this.offlineLoader=_.offlineLoader,this.url=_.url??Sj,this.providerPrefixes=_.providerPrefixes??xj}[Symbol.dispose](){this.clearCache()}clearCache(){this.cachedPricing=null}async loadOfflinePricing(){if(this.offlineLoader==null)throw Error("Offline loader was not provided");let _=new Map(Object.entries(await this.offlineLoader()));return this.cachedPricing=_,_}async fetchRemotePricing(){this.logger.warn("Fetching latest model pricing from LiteLLM...");let _=await fetch(this.url);if(!_.ok)throw Error(`Failed to fetch pricing data: ${_.statusText}`);let z=await _.json(),A=new Map;for(let[b,G]of Object.entries(z)){if(typeof G!=="object"||G==null)continue;let J=Ij.safeParse(G);if(!J.success)continue;A.set(b,J.data)}return this.cachedPricing=A,this.logger.info(`Loaded pricing for ${A.size} models`),A}async ensurePricingLoaded(){if(this.cachedPricing!=null)return this.cachedPricing;if(this.offline)return this.loadOfflinePricing();try{return await this.fetchRemotePricing()}catch(_){if(this.logger.warn("Failed to fetch model pricing from LiteLLM, falling back to offline loader (if available)."),this.offlineLoader!=null)return this.loadOfflinePricing();throw _}}async fetchModelPricing(){return this.ensurePricingLoaded()}createMatchingCandidates(_){let z=new Set;z.add(_);for(let A of this.providerPrefixes)z.add(`${A}${_}`);return Array.from(z)}async getModelPricing(_){let z=await this.ensurePricingLoaded();for(let b of this.createMatchingCandidates(_)){let G=z.get(b);if(G!=null)return G}let A=_.toLowerCase();for(let[b,G]of z){let J=b.toLowerCase();if(J.includes(A)||A.includes(J))return G}return null}async getModelContextLimit(_){return(await this.getModelPricing(_))?.max_input_tokens??null}calculateCostFromPricing(_,z){let A=(X,Q,$,H=kj)=>{if(X==null||X<=0)return 0;if(X>H&&$!=null){let B=Math.min(X,H),F=Math.max(0,X-H)*$;if(Q!=null)F+=B*Q;return F}if(Q!=null)return X*Q;return 0},b=A(_.input_tokens,z.input_cost_per_token,z.input_cost_per_token_above_200k_tokens),G=A(_.output_tokens,z.output_cost_per_token,z.output_cost_per_token_above_200k_tokens),J=A(_.cache_creation_input_tokens,z.cache_creation_input_token_cost,z.cache_creation_input_token_cost_above_200k_tokens),Y=A(_.cache_read_input_tokens,z.cache_read_input_token_cost,z.cache_read_input_token_cost_above_200k_tokens);return b+G+J+Y}async calculateCostFromTokens(_,z){if(z==null||z==="")return 0;let A=await this.getModelPricing(z);if(A==null)throw Error(`Model pricing not found for ${z}`);return this.calculateCostFromPricing(_,A)}}async function BX(_={}){let z=_.serverUrl??process.env.VI_SERVER_URL??"http://localhost:3000",A=_.authToken??null,b=_.timeoutMs??1e4;try{let G=await fetch(`${z}/api/transcripts`,{method:"GET",headers:{...A&&{Authorization:`Bearer ${A}`}},signal:AbortSignal.timeout(b)});if(!G.ok)return console.error(`Failed to fetch transcript metadata: ${G.status} ${G.statusText}`),[];let J=await G.json();if(Cj(J))return J.transcripts;return console.error("Transcript metadata response had unexpected shape:",J),[]}catch(G){if(G instanceof Error)console.error("Failed to fetch transcript metadata:",G.message);return[]}}function Cj(_){if(typeof _!=="object"||_===null||!("transcripts"in _))return!1;let{transcripts:z}=_;if(!Array.isArray(z))return!1;return z.every((A)=>{if(typeof A!=="object"||A===null)return!1;let b=A;return typeof b.transcriptId==="string"&&b.transcriptId.length>0&&typeof b.sha256==="string"&&b.sha256.length>0&&typeof b.repoId==="string"&&b.repoId.length>0})}var ZX=[{name:"OpenAI API Key",regex:"sk-[a-zA-Z0-9]{20,}"},{name:"OpenAI Project Key",regex:"sk-proj-[a-zA-Z0-9\\-_]{20,}"},{name:"Anthropic API Key",regex:"sk-ant-[a-zA-Z0-9\\-_]{20,}"},{name:"Cohere API Key",regex:"co-[a-zA-Z0-9]{40,}"},{name:"HuggingFace Token",regex:"hf_[a-zA-Z0-9]{34,}"},{name:"Replicate API Token",regex:"r8_[a-zA-Z0-9]{40}"},{name:"JWT Token",regex:"eyJ[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]+\\.[A-Za-z0-9-_.+/=]*"},{name:"OAuth Client Secret",regex:`(?i)client_secret['"\\s:=]+[a-zA-Z0-9\\-_.~]{10,100}`},{name:"OAuth Client ID",regex:`(?i)client_id['"\\s:=]+[a-zA-Z0-9\\-_.~]{10,100}`},{name:"Bearer Token",regex:"Bearer\\s+[a-zA-Z0-9\\-._~+/]+=*"},{name:"Authorization Bearer",regex:"(?i)authorization:\\s*Bearer\\s+[a-zA-Z0-9\\-._~+/]+=*"},{name:"Google OAuth Access Token",regex:"ya29\\.[0-9A-Za-z\\-_]+"},{name:"GitHub Fine-Grained Token",regex:"github_pat_[0-9a-zA-Z_]{20,}"},{name:"GitHub OAuth App Secret",regex:`[g|G][i|I][t|T][h|H][u|U][b|B].*['|"][0-9a-zA-Z]{35,40}['|"]`},{name:"GitLab PAT",regex:"glpat-[a-zA-Z0-9_-]{16,}"},{name:"GitLab Runner Token",regex:"glrt-[a-zA-Z0-9_-]{16,}"},{name:"MongoDB URI",regex:`mongodb(\\+srv)?:\\/\\/[^\\s'"]+`},{name:"PostgreSQL URI",regex:`postgres(?:ql)?:\\/\\/[^\\s'"]+`},{name:"MySQL URI",regex:`mysql:\\/\\/[^\\s'"]+`},{name:"Redis URI",regex:`redis:\\/\\/[^\\s'"]+`},{name:"JDBC URL",regex:`jdbc:\\w+:\\/\\/[^\\s'"]+`},{name:"Password in URL",regex:`[a-zA-Z]{3,10}://[^/\\s:@]{3,20}:[^/\\s:@]{3,20}@.{1,100}["'\\s]`},{name:"DigitalOcean Token",regex:"dop_v1_[a-z0-9]{64}"},{name:"CircleCI Token",regex:"circle-token=[a-z0-9]{40}"},{name:"New Relic Key",regex:"NRII-[a-zA-Z0-9]{20,}"},{name:"Sentry DSN",regex:"https:\\/\\/[a-zA-Z0-9]+@[a-z]+\\.ingest\\.sentry\\.io\\/\\d+"},{name:"Cloudinary URL",regex:"cloudinary:\\/\\/[0-9]{15}:[a-zA-Z0-9]+@[a-zA-Z]+"},{name:"Discord Bot Token",regex:"[MN][A-Za-z\\d]{23}\\.[\\w-]{6}\\.[\\w-]{27}"},{name:"Discord Webhook",regex:"https:\\/\\/discord(?:app)?\\.com\\/api\\/webhooks\\/[0-9]+\\/[a-zA-Z0-9_-]+"},{name:"Telegram Bot Token",regex:"\\d{9}:[a-zA-Z0-9_-]{35}"},{name:"Microsoft Teams Webhook",regex:"https:\\/\\/[a-z]+\\.webhook\\.office\\.com\\/webhookb2\\/[a-zA-Z0-9@\\-]+\\/.*"},{name:"Stripe Publishable Key",regex:"pk_live_[0-9a-zA-Z]{24}"},{name:"PayPal Braintree Token",regex:"access_token\\$production\\$[0-9a-z]{16}\\$[0-9a-f]{32}"},{name:"Square Access Token",regex:"sq0atp-[0-9A-Za-z\\-_]{22}"},{name:"Square OAuth Secret",regex:"sq0csp-[0-9A-Za-z\\-_]{43}"},{name:"SendGrid API Key",regex:"SG\\.[\\w\\d\\-_]{22}\\.[\\w\\d\\-_]{43}"},{name:"Mailgun API Key",regex:"key-[0-9a-zA-Z]{32}"},{name:"MailChimp API Key",regex:"[0-9a-f]{32}-us[0-9]{1,2}"},{name:"Shopify Access Token",regex:"shpat_[0-9a-fA-F]{32}"},{name:"Dropbox Access Token",regex:"sl\\.[A-Za-z0-9_-]{20,100}"},{name:"Asana Token",regex:"0\\/[0-9a-z]{32}"},{name:"Linear API Key",regex:"lin_api_[a-zA-Z0-9]{40}"},{name:"Riot Games API Key",regex:"RGAPI-[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}"},{name:"Generic API Key",regex:`(?i)(api[_-]?key)['"\\s:=]+[a-zA-Z0-9\\-_.]{16,}`},{name:"Generic Secret",regex:`(?i)(secret|password|passwd|pwd)['"\\s:=]+[^\\s'"]{8,}`},{name:"Generic Token",regex:`(?i)(token)['"\\s:=]+[a-zA-Z0-9\\-_.]{16,}`},{name:"Private Key Block",regex:"-----BEGIN (RSA|DSA|EC|OPENSSH|PGP)?\\s*PRIVATE\\s+KEY"},{name:"Certificate Block",regex:"-----BEGIN CERTIFICATE-----"},{name:"AWS API Gateway",regex:"[0-9a-z]+.execute-api.[0-9a-z._-]+.amazonaws.com"},{name:"AWS API Key",regex:"AKIA[0-9A-Z]{16}"},{name:"AWS ARN",regex:"arn:aws:[a-z0-9-]+:[a-z]{2}-[a-z]+-[0-9]+:[0-9]+:.+"},{name:"AWS Access Key ID Value",regex:"(A3T[A-Z0-9]|AKIA|AGPA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}"},{name:"AWS AppSync GraphQL Key",regex:"da2-[a-z0-9]{26}"},{name:"AWS EC2 External",regex:"ec2-[0-9a-z._-]+.compute(-1)?.amazonaws.com"},{name:"AWS EC2 Internal",regex:"[0-9a-z._-]+.compute(-1)?.internal"},{name:"AWS ELB",regex:"[0-9a-z._-]+.elb.amazonaws.com"},{name:"AWS ElasticCache",regex:"[0-9a-z._-]+.cache.amazonaws.com"},{name:"AWS MWS ID",regex:"mzn\\.mws\\.[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"},{name:"AWS MWS key",regex:"amzn\\.mws\\.[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"},{name:"AWS RDS",regex:"[0-9a-z._-]+.rds.amazonaws.com"},{name:"AWS S3 Bucket",regex:"s3://[0-9a-z._/-]+"},{name:"AWS client ID",regex:"(A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}"},{name:"AWS cred file info",regex:"(aws_access_key_id|aws_secret_access_key)"},{name:"Abbysale",regex:"(?:abbysale).{0,40}\\b([a-z0-9A-Z]{40})\\b"},{name:"Abstract",regex:"(?:abstract).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Abuseipdb",regex:"(?:abuseipdb).{0,40}\\b([a-z0-9]{80})\\b"},{name:"Accuweather",regex:"(?:accuweather).{0,40}([a-z0-9A-Z\\%]{35})\\b"},{name:"Adafruitio",regex:"\\b(aio\\_[a-zA-Z0-9]{28})\\b"},{name:"Adobeio - 1",regex:"(?:adobe).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Adzuna - 1",regex:"(?:adzuna).{0,40}\\b([a-z0-9]{8})\\b"},{name:"Adzuna - 2",regex:"(?:adzuna).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Aeroworkflow - 1",regex:"(?:aeroworkflow).{0,40}\\b([0-9]{1,})\\b"},{name:"Aeroworkflow - 2",regex:"(?:aeroworkflow).{0,40}\\b([a-zA-Z0-9^!]{20})\\b"},{name:"Agora",regex:"(?:agora).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Airbrakeprojectkey - 1",regex:"(?:airbrake).{0,40}\\b([0-9]{6})\\b"},{name:"Airbrakeprojectkey - 2",regex:"(?:airbrake).{0,40}\\b([a-zA-Z-0-9]{32})\\b"},{name:"Airbrakeuserkey",regex:"(?:airbrake).{0,40}\\b([a-zA-Z-0-9]{40})\\b"},{name:"Airship",regex:"(?:airship).{0,40}\\b([0-9Aa-zA-Z]{91})\\b"},{name:"Airvisual",regex:"(?:airvisual).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Alconost",regex:"(?:alconost).{0,40}\\b([0-9Aa-z]{32})\\b"},{name:"Alegra - 1",regex:"(?:alegra).{0,40}\\b([a-z0-9-]{20})\\b"},{name:"Alegra - 2",regex:"(?:alegra).{0,40}\\b([a-zA-Z0-9.-@]{25,30})\\b"},{name:"Aletheiaapi",regex:"(?:aletheiaapi).{0,40}\\b([A-Z0-9]{32})\\b"},{name:"Algoliaadminkey - 1",regex:"(?:algolia).{0,40}\\b([A-Z0-9]{10})\\b"},{name:"Algoliaadminkey - 2",regex:"(?:algolia).{0,40}\\b([a-zA-Z0-9]{32})\\b"},{name:"Alibaba - 2",regex:"\\b(LTAI[a-zA-Z0-9]{17,21})[\\\"' ;\\s]*"},{name:"Alienvault",regex:"(?:alienvault).{0,40}\\b([a-z0-9]{64})\\b"},{name:"Allsports",regex:"(?:allsports).{0,40}\\b([0-9a-z]{64})\\b"},{name:"Amadeus - 1",regex:"(?:amadeus).{0,40}\\b([0-9A-Za-z]{32})\\b"},{name:"Amadeus - 2",regex:"(?:amadeus).{0,40}\\b([0-9A-Za-z]{16})\\b"},{name:"Amazon SNS Topic",regex:"arn:aws:sns:[a-z0-9\\-]+:[0-9]+:[A-Za-z0-9\\-_]+"},{name:"Ambee",regex:"(?:ambee).{0,40}\\b([0-9a-f]{64})\\b"},{name:"Amplitudeapikey",regex:"(?:amplitude).{0,40}\\b([a-f0-9]{32})"},{name:"Apacta",regex:"(?:apacta).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Api2cart",regex:"(?:api2cart).{0,40}\\b([0-9a-f]{32})\\b"},{name:"Apideck - 1",regex:"\\b(sk_live_[a-z0-9A-Z-]{93})\\b"},{name:"Apideck - 2",regex:"(?:apideck).{0,40}\\b([a-z0-9A-Z]{40})\\b"},{name:"Apiflash - 1",regex:"(?:apiflash).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Apiflash - 2",regex:"(?:apiflash).{0,40}\\b([a-zA-Z0-9\\S]{21,30})\\b"},{name:"Apifonica",regex:"(?:apifonica).{0,40}\\b([0-9a-z]{11}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12})\\b"},{name:"Apify",regex:"\\b(apify\\_api\\_[a-zA-Z-0-9]{36})\\b"},{name:"Apimatic - 1",regex:"(?:apimatic).{0,40}\\b([a-z0-9-\\S]{8,32})\\b"},{name:"Apimatic - 2",regex:"(?:apimatic).{0,40}\\b([a-zA-Z0-9]{3,20}@[a-zA-Z0-9]{2,12}.[a-zA-Z0-9]{2,5})\\b"},{name:"Apiscience",regex:"(?:apiscience).{0,40}\\b([a-bA-Z0-9\\S]{22})\\b"},{name:"Apollo",regex:"(?:apollo).{0,40}\\b([a-zA-Z0-9]{22})\\b"},{name:"Appcues - 1",regex:"(?:appcues).{0,40}\\b([0-9]{5})\\b"},{name:"Appcues - 2",regex:"(?:appcues).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Appcues - 3",regex:"(?:appcues).{0,40}\\b([a-z0-9-]{39})\\b"},{name:"Appfollow",regex:"(?:appfollow).{0,40}\\b([0-9A-Za-z]{20})\\b"},{name:"Appsynergy",regex:"(?:appsynergy).{0,40}\\b([a-z0-9]{64})\\b"},{name:"Apptivo - 1",regex:"(?:apptivo).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Apptivo - 2",regex:"(?:apptivo).{0,40}\\b([a-zA-Z0-9-]{32})\\b"},{name:"Artifactory - 2",regex:"\\b([A-Za-z0-9](?:[A-Za-z0-9\\-]{0,61}[A-Za-z0-9])\\.jfrog\\.io)"},{name:"Artifactory API Token",regex:'(?:\\s|=|:|"|^)AKC[a-zA-Z0-9]{10,}'},{name:"Artifactory Password",regex:'(?:\\s|=|:|"|^)AP[\\dABCDEF][a-zA-Z0-9]{8,}'},{name:"Artsy - 1",regex:"(?:artsy).{0,40}\\b([0-9a-zA-Z]{20})\\b"},{name:"Artsy - 2",regex:"(?:artsy).{0,40}\\b([0-9a-zA-Z]{32})\\b"},{name:"Asanaoauth",regex:"(?:asana).{0,40}\\b([a-z\\/:0-9]{51})\\b"},{name:"Asanapersonalaccesstoken",regex:"(?:asana).{0,40}\\b([0-9]{1,}\\/[0-9]{16,}:[A-Za-z0-9]{32,})\\b"},{name:"Assemblyai",regex:"(?:assemblyai).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Asymmetric Private Key",regex:"-----BEGIN ((EC|PGP|DSA|RSA|OPENSSH) )?PRIVATE KEY( BLOCK)?-----"},{name:"Audd",regex:"(?:audd).{0,40}\\b([a-z0-9-]{32})\\b"},{name:"Auth0managementapitoken",regex:"(?:auth0).{0,40}\\b(ey[a-zA-Z0-9._-]+)\\b"},{name:"Auth0oauth - 1",regex:"(?:auth0).{0,40}\\b([a-zA-Z0-9_-]{32,60})\\b"},{name:"Autodesk - 1",regex:"(?:autodesk).{0,40}\\b([0-9A-Za-z]{32})\\b"},{name:"Autodesk - 2",regex:"(?:autodesk).{0,40}\\b([0-9A-Za-z]{16})\\b"},{name:"Autoklose",regex:"(?:autoklose).{0,40}\\b([a-zA-Z0-9-]{32})\\b"},{name:"Autopilot",regex:"(?:autopilot).{0,40}\\b([0-9a-f]{32})\\b"},{name:"Avazapersonalaccesstoken",regex:"(?:avaza).{0,40}\\b([0-9]+-[0-9a-f]{40})\\b"},{name:"Aviationstack",regex:"(?:aviationstack).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Aws - 1",regex:"\\b((?:AKIA|ABIA|ACCA|ASIA)[0-9A-Z]{16})\\b"},{name:"Axonaut",regex:"(?:axonaut).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Aylien - 1",regex:"(?:aylien).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Aylien - 2",regex:"(?:aylien).{0,40}\\b([a-z0-9]{8})\\b"},{name:"Ayrshare",regex:"(?:ayrshare).{0,40}\\b([A-Z]{7}-[A-Z0-9]{7}-[A-Z0-9]{7}-[A-Z0-9]{7})\\b"},{name:"Bannerbear",regex:"(?:bannerbear).{0,40}\\b([0-9a-zA-Z]{22}tt)\\b"},{name:"Baremetrics",regex:"(?:baremetrics).{0,40}\\b([a-zA-Z0-9_]{25})\\b"},{name:"Baseapiio",regex:"(?:baseapi|base-api).{0,40}\\b([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\\b"},{name:"Beamer",regex:"(?:beamer).{0,40}\\b([a-zA-Z0-9_+/]{45}=)"},{name:"Beebole",regex:"(?:beebole).{0,40}\\b([0-9a-z]{40})\\b"},{name:"Besttime",regex:"(?:besttime).{0,40}\\b([0-9A-Za-z_]{36})\\b"},{name:"Billomat - 1",regex:"(?:billomat).{0,40}\\b([0-9a-z]{1,})\\b"},{name:"Billomat - 2",regex:"(?:billomat).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Bitbar",regex:"(?:bitbar).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Bitcoinaverage",regex:"(?:bitcoinaverage).{0,40}\\b([a-zA-Z0-9]{43})\\b"},{name:"Bitfinex",regex:"(?:bitfinex).{0,40}\\b([A-Za-z0-9_-]{43})\\b"},{name:"Bitly Secret Key",regex:"R_[0-9a-f]{32}"},{name:"Bitlyaccesstoken",regex:"(?:bitly).{0,40}\\b([a-zA-Z-0-9]{40})\\b"},{name:"Bitmex - 1",regex:"(?:bitmex).{0,40}([ \\r\\n]{1}[0-9a-zA-Z\\-\\_]{24}[ \\r\\n]{1})"},{name:"Bitmex - 2",regex:"(?:bitmex).{0,40}([ \\r\\n]{1}[0-9a-zA-Z\\-\\_]{48}[ \\r\\n]{1})"},{name:"Blablabus",regex:"(?:blablabus).{0,40}\\b([0-9A-Za-z]{22})\\b"},{name:"Blazemeter",regex:"(?:blazemeter|runscope).{0,40}\\b([0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12})\\b"},{name:"Blitapp",regex:"(?:blitapp).{0,40}\\b([a-zA-Z0-9_-]{39})\\b"},{name:"Blogger",regex:"(?:blogger).{0,40}\\b([0-9A-Za-z-]{39})\\b"},{name:"Bombbomb",regex:"(?:bombbomb).{0,40}\\b([a-zA-Z0-9-._]{704})\\b"},{name:"Boostnote",regex:"(?:boostnote).{0,40}\\b([0-9a-f]{64})\\b"},{name:"Borgbase",regex:"(?:borgbase).{0,40}\\b([a-zA-Z0-9/_.-]{148,152})\\b"},{name:"Braintree API Key",regex:"access_token$production$[0-9a-z]{16}$[0-9a-f]{32}"},{name:"Brandfetch",regex:"(?:brandfetch).{0,40}\\b([0-9A-Za-z]{40})\\b"},{name:"Browshot",regex:"(?:browshot).{0,40}\\b([a-zA-Z-0-9]{28})\\b"},{name:"Buddyns",regex:"(?:buddyns).{0,40}\\b([0-9a-z]{40})\\b"},{name:"Bugherd",regex:"(?:bugherd).{0,40}\\b([0-9a-z]{22})\\b"},{name:"Bugsnag",regex:"(?:bugsnag).{0,40}\\b([0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12})\\b"},{name:"Buildkite",regex:"(?:buildkite).{0,40}\\b([a-z0-9]{40})\\b"},{name:"Bulbul",regex:"(?:bulbul).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Buttercms",regex:"(?:buttercms).{0,40}\\b([a-z0-9]{40})\\b"},{name:"Caflou",regex:"(?:caflou).{0,40}\\b([a-bA-Z0-9\\S]{155})\\b"},{name:"Calendarific",regex:"(?:calendarific).{0,40}\\b([a-z0-9]{40})\\b"},{name:"Calendlyapikey",regex:"(?:calendly).{0,40}\\b([a-zA-Z-0-9]{20}.[a-zA-Z-0-9]{171}.[a-zA-Z-0-9_]{43})\\b"},{name:"Calorieninja",regex:"(?:calorieninja).{0,40}\\b([0-9A-Za-z]{40})\\b"},{name:"Campayn",regex:"(?:campayn).{0,40}\\b([a-z0-9]{64})\\b"},{name:"Cannyio",regex:"(?:canny).{0,40}\\b([a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[0-9]{4}-[a-z0-9]{12})\\b"},{name:"Capsulecrm",regex:"(?:capsulecrm).{0,40}\\b([a-zA-Z0-9-._+=]{64})\\b"},{name:"Captaindata - 1",regex:"(?:captaindata).{0,40}\\b([0-9a-f]{8}\\-[0-9a-f]{4}\\-[0-9a-f]{4}\\-[0-9a-f]{4}\\-[0-9a-f]{12})\\b"},{name:"Captaindata - 2",regex:"(?:captaindata).{0,40}\\b([0-9a-f]{64})\\b"},{name:"Carboninterface",regex:"(?:carboninterface).{0,40}\\b([a-zA-Z0-9]{21})\\b"},{name:"Cashboard - 1",regex:"(?:cashboard).{0,40}\\b([0-9A-Z]{3}-[0-9A-Z]{3}-[0-9A-Z]{3}-[0-9A-Z]{3})\\b"},{name:"Cashboard - 2",regex:"(?:cashboard).{0,40}\\b([0-9a-z]{1,})\\b"},{name:"Caspio - 1",regex:"(?:caspio).{0,40}\\b([a-z0-9]{8})\\b"},{name:"Caspio - 2",regex:"(?:caspio).{0,40}\\b([a-z0-9]{50})\\b"},{name:"Censys - 1",regex:"(?:censys).{0,40}\\b([a-zA-Z0-9]{32})\\b"},{name:"Censys - 2",regex:"(?:censys).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Centralstationcrm",regex:"(?:centralstation).{0,40}\\b([a-z0-9]{30})\\b"},{name:"Cexio - 1",regex:"(?:cexio|cex.io).{0,40}\\b([a-z]{2}[0-9]{9})\\b"},{name:"Cexio - 2",regex:"(?:cexio|cex.io).{0,40}\\b([0-9A-Za-z]{24,27})\\b"},{name:"Chatbot",regex:"(?:chatbot).{0,40}\\b([a-zA-Z0-9_]{32})\\b"},{name:"Chatfule",regex:"(?:chatfuel).{0,40}\\b([a-zA-Z0-9]{128})\\b"},{name:"Checio",regex:"(?:checio).{0,40}\\b(pk_[a-z0-9]{45})\\b"},{name:"Checklyhq",regex:"(?:checklyhq).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Checkout - 1",regex:"(?:checkout).{0,40}\\b((sk_|sk_test_)[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})\\b"},{name:"Checkout - 2",regex:"(?:checkout).{0,40}\\b(cus_[0-9a-zA-Z]{26})\\b"},{name:"Checkvist - 1",regex:"(?:checkvist).{0,40}\\b([\\w\\.-]+@[\\w-]+\\.[\\w\\.-]{2,5})\\b"},{name:"Checkvist - 2",regex:"(?:checkvist).{0,40}\\b([0-9a-zA-Z]{14})\\b"},{name:"Cicero",regex:"(?:cicero).{0,40}\\b([0-9a-z]{40})\\b"},{name:"Circleci",regex:"(?:circle).{0,40}([a-fA-F0-9]{40})"},{name:"Clearbit",regex:"(?:clearbit).{0,40}\\b([0-9a-z_]{35})\\b"},{name:"Clickhelp - 1",regex:"\\b([0-9A-Za-z]{3,20}.try.clickhelp.co)\\b"},{name:"Clickhelp - 2",regex:"(?:clickhelp).{0,40}\\b([0-9A-Za-z]{24})\\b"},{name:"Clicksendsms - 2",regex:"(?:sms).{0,40}\\b([a-zA-Z0-9]{3,20}@[a-zA-Z0-9]{2,12}.[a-zA-Z0-9]{2,5})\\b"},{name:"Clickuppersonaltoken",regex:"(?:clickup).{0,40}\\b(pk_[0-9]{8}_[0-9A-Z]{32})\\b"},{name:"Cliengo",regex:"(?:cliengo).{0,40}\\b([0-9a-f]{8}\\-[0-9a-f]{4}\\-[0-9a-f]{4}\\-[0-9a-f]{4}\\-[0-9a-f]{12})\\b"},{name:"Clinchpad",regex:"(?:clinchpad).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Clockify",regex:"(?:clockify).{0,40}\\b([a-zA-Z0-9]{48})\\b"},{name:"Clockworksms - 1",regex:"(?:clockwork|textanywhere).{0,40}\\b([0-9a-zA-Z]{24})\\b"},{name:"Clockworksms - 2",regex:"(?:clockwork|textanywhere).{0,40}\\b([0-9]{5})\\b"},{name:"Closecrm",regex:"\\b(api_[a-z0-9A-Z.]{45})\\b"},{name:"Cloudelements - 1",regex:"(?:cloudelements).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Cloudelements - 2",regex:"(?:cloudelements).{0,40}\\b([a-zA-Z0-9]{43})\\b"},{name:"Cloudflareapitoken",regex:"(?:cloudflare).{0,40}\\b([A-Za-z0-9_-]{40})\\b"},{name:"Cloudflarecakey",regex:"(?:cloudflare).{0,40}\\b(v[A-Za-z0-9._-]{173,})\\b"},{name:"Cloudimage",regex:"(?:cloudimage).{0,40}\\b([a-z0-9_]{30})\\b"},{name:"Cloudinary Credentials",regex:"cloudinary://[0-9]+:[A-Za-z0-9\\-_\\.]+@[A-Za-z0-9\\-_\\.]+"},{name:"Cloudmersive",regex:"(?:cloudmersive).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Cloudplan",regex:"(?:cloudplan).{0,40}\\b([A-Z0-9-]{32})\\b"},{name:"Cloverly",regex:"(?:cloverly).{0,40}\\b([a-z0-9:_]{28})\\b"},{name:"Cloze - 1",regex:"(?:cloze).{0,40}\\b([0-9a-f]{32})\\b"},{name:"Cloze - 2",regex:"(?:cloze).{0,40}\\b([\\w\\.-]+@[\\w-]+\\.[\\w\\.-]{2,5})\\b"},{name:"Clustdoc",regex:"(?:clustdoc).{0,40}\\b([0-9a-zA-Z]{60})\\b"},{name:"Codacy",regex:"(?:codacy).{0,40}\\b([0-9A-Za-z]{20})\\b"},{name:"Coinapi",regex:"(?:coinapi).{0,40}\\b([A-Z0-9-]{36})\\b"},{name:"Coinbase",regex:"(?:coinbase).{0,40}\\b([a-zA-Z-0-9]{64})\\b"},{name:"Coinlayer",regex:"(?:coinlayer).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Coinlib",regex:"(?:coinlib).{0,40}\\b([a-z0-9]{16})\\b"},{name:"Column",regex:"(?:column).{0,40}\\b((?:test|live)_[a-zA-Z0-9]{27})\\b"},{name:"Commercejs",regex:"(?:commercejs).{0,40}\\b([a-z0-9_]{48})\\b"},{name:"Commodities",regex:"(?:commodities).{0,40}\\b([a-zA-Z0-9]{60})\\b"},{name:"Companyhub - 1",regex:"(?:companyhub).{0,40}\\b([0-9a-zA-Z]{20})\\b"},{name:"Companyhub - 2",regex:"(?:companyhub).{0,40}\\b([a-zA-Z0-9$%^=-]{4,32})\\b"},{name:"Confluent - 1",regex:"(?:confluent).{0,40}\\b([a-zA-Z-0-9]{16})\\b"},{name:"Confluent - 2",regex:"(?:confluent).{0,40}\\b([a-zA-Z-0-9]{64})\\b"},{name:"Convertkit",regex:"(?:convertkit).{0,40}\\b([a-z0-9A-Z_]{22})\\b"},{name:"Convier",regex:"(?:convier).{0,40}\\b([0-9]{2}\\|[a-zA-Z0-9]{40})\\b"},{name:"Copper - 2",regex:"(?:copper).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Countrylayer",regex:"(?:countrylayer).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Courier",regex:"(?:courier).{0,40}\\b(pk\\_[a-zA-Z0-9]{1,}\\_[a-zA-Z0-9]{28})\\b"},{name:"Coveralls",regex:"(?:coveralls).{0,40}\\b([a-zA-Z0-9-]{37})\\b"},{name:"Crowdin",regex:"(?:crowdin).{0,40}\\b([0-9A-Za-z]{80})\\b"},{name:"Cryptocompare",regex:"(?:cryptocompare).{0,40}\\b([a-z-0-9]{64})\\b"},{name:"Currencycloud - 1",regex:"(?:currencycloud).{0,40}\\b([0-9a-z]{64})\\b"},{name:"Currencyfreaks",regex:"(?:currencyfreaks).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Currencylayer",regex:"(?:currencylayer).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Currencyscoop",regex:"(?:currencyscoop).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Currentsapi",regex:"(?:currentsapi).{0,40}\\b([a-zA-Z0-9\\S]{48})\\b"},{name:"Customerguru - 1",regex:"(?:guru).{0,40}\\b([a-z0-9A-Z]{50})\\b"},{name:"Customerguru - 2",regex:"(?:guru).{0,40}\\b([a-z0-9A-Z]{30})\\b"},{name:"Customerio",regex:"(?:customer).{0,40}\\b([a-z0-9A-Z]{20})\\b"},{name:"D7network",regex:"(?:d7network).{0,40}\\b([a-zA-Z0-9\\W\\S]{23}\\=)"},{name:"Dailyco",regex:"(?:daily).{0,40}\\b([0-9a-f]{64})\\b"},{name:"Dandelion",regex:"(?:dandelion).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Databricks",regex:"dapi[a-f0-9]{32}\\b"},{name:"Datadogtoken - 1",regex:"(?:datadog).{0,40}\\b([a-zA-Z-0-9]{32})\\b"},{name:"Datadogtoken - 2",regex:"(?:datadog).{0,40}\\b([a-zA-Z-0-9]{40})\\b"},{name:"Datafire",regex:"(?:datafire).{0,40}\\b([a-z0-9\\S]{175,190})\\b"},{name:"Datagov",regex:"(?:data.gov).{0,40}\\b([a-zA-Z0-9]{40})\\b"},{name:"Debounce",regex:"(?:debounce).{0,40}\\b([a-zA-Z0-9]{13})\\b"},{name:"Deepai",regex:"(?:deepai).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Deepgram",regex:"(?:deepgram).{0,40}\\b([0-9a-z]{40})\\b"},{name:"Delighted",regex:"(?:delighted).{0,40}\\b([a-z0-9A-Z]{32})\\b"},{name:"Deputy - 1",regex:"\\b([0-9a-z]{1,}.as.deputy.com)\\b"},{name:"Deputy - 2",regex:"(?:deputy).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Detectlanguage",regex:"(?:detectlanguage).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Dfuse",regex:"\\b(web\\_[0-9a-z]{32})\\b"},{name:"Diffbot",regex:"(?:diffbot).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Digitaloceantoken",regex:"(?:digitalocean).{0,40}\\b([A-Za-z0-9_-]{64})\\b"},{name:"Discordbottoken - 1",regex:"(?:discord).{0,40}\\b([A-Za-z0-9_-]{24}\\.[A-Za-z0-9_-]{6}\\.[A-Za-z0-9_-]{27})\\b"},{name:"Discordbottoken - 2",regex:"(?:discord).{0,40}\\b([0-9]{17})\\b"},{name:"Discordwebhook",regex:"(https:\\/\\/discord.com\\/api\\/webhooks\\/[0-9]{18}\\/[0-9a-zA-Z-]{68})"},{name:"Ditto",regex:"(?:ditto).{0,40}\\b([a-z0-9]{8}\\-[a-z0-9]{4}\\-[a-z0-9]{4}\\-[a-z0-9]{4}\\-[a-z0-9]{12}\\.[a-z0-9]{40})\\b"},{name:"Dnscheck - 1",regex:"(?:dnscheck).{0,40}\\b([a-z0-9A-Z-]{36})\\b"},{name:"Dnscheck - 2",regex:"(?:dnscheck).{0,40}\\b([a-z0-9A-Z]{32})\\b"},{name:"Documo",regex:"\\b(ey[a-zA-Z0-9]{34}.ey[a-zA-Z0-9]{154}.[a-zA-Z0-9_-]{43})\\b"},{name:"Doppler",regex:"\\b(dp\\.pt\\.[a-zA-Z0-9]{43})\\b"},{name:"Dotmailer - 1",regex:"(?:dotmailer).{0,40}\\b(apiuser-[a-z0-9]{12}@apiconnector.com)\\b"},{name:"Dotmailer - 2",regex:"(?:dotmailer).{0,40}\\b([a-zA-Z0-9\\S]{8,24})\\b"},{name:"Dovico",regex:"(?:dovico).{0,40}\\b([0-9a-z]{32}\\.[0-9a-z]{1,}\\b)"},{name:"Dronahq",regex:"(?:dronahq).{0,40}\\b([a-z0-9]{50})\\b"},{name:"Droneci",regex:"(?:droneci).{0,40}\\b([a-zA-Z0-9]{32})\\b"},{name:"Dropbox",regex:"\\b(sl\\.[A-Za-z0-9\\-\\_]{130,140})\\b"},{name:"Dwolla",regex:"(?:dwolla).{0,40}\\b([a-zA-Z-0-9]{50})\\b"},{name:"Dynalist",regex:"(?:dynalist).{0,40}\\b([a-zA-Z0-9-_]{128})\\b"},{name:"Dynatrace token",regex:"dt0[a-zA-Z]{1}[0-9]{2}\\.[A-Z0-9]{24}\\.[A-Z0-9]{64}"},{name:"Dyspatch",regex:"(?:dyspatch).{0,40}\\b([A-Z0-9]{52})\\b"},{name:"EC",regex:"-----BEGIN EC PRIVATE KEY-----"},{name:"Eagleeyenetworks - 1",regex:"(?:eagleeyenetworks).{0,40}\\b([a-zA-Z0-9]{3,20}@[a-zA-Z0-9]{2,12}.[a-zA-Z0-9]{2,5})\\b"},{name:"Eagleeyenetworks - 2",regex:"(?:eagleeyenetworks).{0,40}\\b([a-zA-Z0-9]{15})\\b"},{name:"Easyinsight - 1",regex:"(?:easyinsight|easy-insight).{0,40}\\b([a-zA-Z0-9]{20})\\b"},{name:"Easyinsight - 2",regex:"(?:easyinsight|easy-insight).{0,40}\\b([0-9Aa-zA-Z]{20})\\b"},{name:"Edamam - 1",regex:"(?:edamam).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Edamam - 2",regex:"(?:edamam).{0,40}\\b([0-9a-z]{8})\\b"},{name:"Edenai",regex:"(?:edenai).{0,40}\\b([a-zA-Z0-9]{36}.[a-zA-Z0-9]{92}.[a-zA-Z0-9_]{43})\\b"},{name:"Eightxeight - 1",regex:"(?:8x8).{0,40}\\b([a-zA-Z0-9_]{18,30})\\b"},{name:"Eightxeight - 2",regex:"(?:8x8).{0,40}\\b([a-zA-Z0-9]{43})\\b"},{name:"Elasticemail",regex:"(?:elastic).{0,40}\\b([A-Za-z0-9_-]{96})\\b"},{name:"Enablex - 1",regex:"(?:enablex).{0,40}\\b([a-zA-Z0-9]{36})\\b"},{name:"Enablex - 2",regex:"(?:enablex).{0,40}\\b([a-z0-9]{24})\\b"},{name:"Enigma",regex:"(?:enigma).{0,40}\\b([a-zA-Z0-9]{40})\\b"},{name:"Ethplorer",regex:"(?:ethplorer).{0,40}\\b([a-z0-9A-Z-]{22})\\b"},{name:"Etsyapikey",regex:"(?:etsy).{0,40}\\b([a-zA-Z-0-9]{24})\\b"},{name:"Everhour",regex:"(?:everhour).{0,40}\\b([0-9Aa-f]{4}-[0-9a-f]{4}-[0-9a-f]{6}-[0-9a-f]{6}-[0-9a-f]{8})\\b"},{name:"Exchangerateapi",regex:"(?:exchangerate).{0,40}\\b([a-z0-9]{24})\\b"},{name:"Exchangeratesapi",regex:"(?:exchangerates).{0,40}\\b([a-z0-9]{32})\\b"},{name:"FCM Server Key",regex:"AAAA[a-zA-Z0-9_-]{7}:[a-zA-Z0-9_-]{140}"},{name:"FCM_server_key",regex:"(AAAA[a-zA-Z0-9_-]{7}:[a-zA-Z0-9_-]{140})"},{name:"Facebook Access Token",regex:"EAACEdEose0cBA[0-9A-Za-z]+"},{name:"Facebook OAuth",regex:`[fF][aA][cC][eE][bB][oO][oO][kK].*['|"][0-9a-f]{32}['|"]`},{name:"Facebookoauth",regex:"(?:facebook).{0,40}\\b([A-Za-z0-9]{32})\\b"},{name:"Faceplusplus",regex:"(?:faceplusplus).{0,40}\\b([0-9a-zA-Z_-]{32})\\b"},{name:"Fakejson",regex:"(?:fakejson).{0,40}\\b([a-zA-Z0-9]{22})\\b"},{name:"Fastforex",regex:"(?:fastforex).{0,40}\\b([a-z0-9-]{28})\\b"},{name:"Fastlypersonaltoken",regex:"(?:fastly).{0,40}\\b([A-Za-z0-9_-]{32})\\b"},{name:"Feedier",regex:"(?:feedier).{0,40}\\b([a-z0-9A-Z]{32})\\b"},{name:"Fetchrss",regex:"(?:fetchrss).{0,40}\\b([0-9A-Za-z.]{40})\\b"},{name:"Figmapersonalaccesstoken",regex:"(?:figma).{0,40}\\b([0-9]{6}-[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12})\\b"},{name:"Fileio",regex:"(?:fileio).{0,40}\\b([A-Z0-9.-]{39})\\b"},{name:"Finage",regex:"\\b(API_KEY[0-9A-Z]{32})\\b"},{name:"Financialmodelingprep",regex:"(?:financialmodelingprep).{0,40}\\b([a-zA-Z0-9]{32})\\b"},{name:"Findl",regex:"(?:findl).{0,40}\\b([a-z0-9]{8}\\-[a-z0-9]{4}\\-[a-z0-9]{4}\\-[a-z0-9]{4}\\-[a-z0-9]{12})\\b"},{name:"Finnhub",regex:"(?:finnhub).{0,40}\\b([0-9a-z]{20})\\b"},{name:"Firebase Database Detect - 1",regex:"[a-z0-9.-]+\\.firebaseio\\.com"},{name:"Firebase Database Detect - 2",regex:"[a-z0-9.-]+\\.firebaseapp\\.com"},{name:"Fixerio",regex:"(?:fixer).{0,40}\\b([A-Za-z0-9]{32})\\b"},{name:"Flatio",regex:"(?:flat).{0,40}\\b([0-9a-z]{128})\\b"},{name:"Fleetbase",regex:"\\b(flb_live_[0-9a-zA-Z]{20})\\b"},{name:"Flickr",regex:"(?:flickr).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Flightapi",regex:"(?:flightapi).{0,40}\\b([a-z0-9]{24})\\b"},{name:"Flightstats - 1",regex:"(?:flightstats).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Flightstats - 2",regex:"(?:flightstats).{0,40}\\b([0-9a-z]{8})\\b"},{name:"Float",regex:"(?:float).{0,40}\\b([a-zA-Z0-9-._+=]{59,60})\\b"},{name:"Flowflu - 2",regex:"(?:flowflu).{0,40}\\b([a-zA-Z0-9]{51})\\b"},{name:"Flutterwave",regex:"\\b(FLWSECK-[0-9a-z]{32}-X)\\b"},{name:"Fmfw - 1",regex:"(?:fmfw).{0,40}\\b([a-zA-Z0-9-]{32})\\b"},{name:"Fmfw - 2",regex:"(?:fmfw).{0,40}\\b([a-zA-Z0-9_-]{32})\\b"},{name:"Formbucket",regex:"(?:formbucket).{0,40}\\b([0-9A-Za-z]{1,}.[0-9A-Za-z]{1,}\\.[0-9A-Z-a-z\\-_]{1,})"},{name:"Formio",regex:"(?:formio).{0,40}\\b(eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9\\.[0-9A-Za-z]{310}\\.[0-9A-Z-a-z\\-_]{43}[ \\r\\n]{1})"},{name:"Foursquare",regex:"(?:foursquare).{0,40}\\b([0-9A-Z]{48})\\b"},{name:"Frameio",regex:"\\b(fio-u-[0-9a-zA-Z_-]{64})\\b"},{name:"Freshbooks - 1",regex:"(?:freshbooks).{0,40}\\b([0-9a-z]{64})\\b"},{name:"Freshbooks - 2",regex:"(?:freshbooks).{0,40}\\b(https://www.[0-9A-Za-z_-]{1,}.com)\\b"},{name:"Freshdesk - 1",regex:"(?:freshdesk).{0,40}\\b([0-9A-Za-z]{20})\\b"},{name:"Freshdesk - 2",regex:"\\b([0-9a-z-]{1,}.freshdesk.com)\\b"},{name:"Front",regex:"(?:front).{0,40}\\b([0-9a-zA-Z]{36}.[0-9a-zA-Z\\.\\-\\_]{188,244})\\b"},{name:"Fulcrum",regex:"(?:fulcrum).{0,40}\\b([a-z0-9]{80})\\b"},{name:"Fullstory",regex:"(?:fullstory).{0,40}\\b([a-zA-Z-0-9/+]{88})\\b"},{name:"Fusebill",regex:"(?:fusebill).{0,40}\\b([a-zA-Z0-9]{88})\\b"},{name:"Fxmarket",regex:"(?:fxmarket).{0,40}\\b([0-9Aa-zA-Z-_=]{20})\\b"},{name:"Gcp",regex:"\\{[^{]+auth_provider_x509_cert_url[^}]+\\}"},{name:"Geckoboard",regex:"(?:geckoboard).{0,40}\\b([a-zA-Z0-9]{44})\\b"},{name:"Generic - 1376",regex:"jdbc:mysql(=| =|:| :)"},{name:"Generic - 1688",regex:"TOKEN[\\\\-|_|A-Z0-9]*(\\'|\\\")?(:|=)(\\'|\\\")?[\\\\-|_|A-Z0-9]{10}"},{name:"Generic - 1689",regex:"API[\\\\-|_|A-Z0-9]*(\\'|\\\")?(:|=)(\\'|\\\")?[\\\\-|_|A-Z0-9]{10}"},{name:"Generic - 1691",regex:"SECRET[\\\\-|_|A-Z0-9]*(\\'|\\\")?(:|=)(\\'|\\\")?[\\\\-|_|A-Z0-9]{10}"},{name:"Generic - 1692",regex:"AUTHORIZATION[\\\\-|_|A-Z0-9]*(\\'|\\\")?(:|=)(\\'|\\\")?[\\\\-|_|A-Z0-9]{10}"},{name:"Generic - 1693",regex:"PASSWORD[\\\\-|_|A-Z0-9]*(\\'|\\\")?(:|=)(\\'|\\\")?[\\\\-|_|A-Z0-9]{10}"},{name:"Generic - 1695",regex:`(A|a)(P|p)(Ii)[\\-|_|A-Za-z0-9]*(\\''|")?( )*(:|=)( )*(\\''|")?[0-9A-Za-z\\-_]+(\\''|")?`},{name:"Generic - 1700",regex:"BEGIN OPENSSH PRIVATE KEY"},{name:"Generic - 1701",regex:"BEGIN PRIVATE KEY"},{name:"Generic - 1702",regex:"BEGIN RSA PRIVATE KEY"},{name:"Generic - 1703",regex:"BEGIN DSA PRIVATE KEY"},{name:"Generic - 1704",regex:"BEGIN EC PRIVATE KEY"},{name:"Generic - 1705",regex:"BEGIN PGP PRIVATE KEY BLOCK"},{name:"Generic - 1707",regex:"[a-z0-9.-]+\\.s3-[a-z0-9-]\\.amazonaws\\.com"},{name:"Generic - 1708",regex:"[a-z0-9.-]+\\.s3-website[.-](eu|ap|us|ca|sa|cn)"},{name:"Generic - 1710",regex:"algolia_api_key"},{name:"Generic - 1711",regex:"asana_access_token"},{name:"Generic - 1713",regex:"azure_tenant"},{name:"Generic - 1714",regex:"bitly_access_token"},{name:"Generic - 1715",regex:"branchio_secret"},{name:"Generic - 1716",regex:"browserstack_access_key"},{name:"Generic - 1717",regex:"buildkite_access_token"},{name:"Generic - 1718",regex:"comcast_access_token"},{name:"Generic - 1719",regex:"datadog_api_key"},{name:"Generic - 1720",regex:"deviantart_secret"},{name:"Generic - 1721",regex:"deviantart_access_token"},{name:"Generic - 1722",regex:"dropbox_api_token"},{name:"Generic - 1723",regex:"facebook_appsecret"},{name:"Generic - 1724",regex:"facebook_access_token"},{name:"Generic - 1725",regex:"firebase_custom_token"},{name:"Generic - 1726",regex:"firebase_id_token"},{name:"Generic - 1727",regex:"github_client"},{name:"Generic - 1728",regex:"github_ssh_key"},{name:"Generic - 1730",regex:"gitlab_private_token"},{name:"Generic - 1731",regex:"google_cm"},{name:"Generic - 1732",regex:"google_maps_key"},{name:"Generic - 1733",regex:"heroku_api_key"},{name:"Generic - 1734",regex:"instagram_access_token"},{name:"Generic - 1735",regex:"mailchimp_api_key"},{name:"Generic - 1736",regex:"mailgun_api_key"},{name:"Generic - 1737",regex:"mailjet"},{name:"Generic - 1738",regex:"mapbox_access_token"},{name:"Generic - 1739",regex:"pagerduty_api_token"},{name:"Generic - 1740",regex:"paypal_key_sb"},{name:"Generic - 1741",regex:"paypal_key_live"},{name:"Generic - 1742",regex:"paypal_token_sb"},{name:"Generic - 1743",regex:"paypal_token_live"},{name:"Generic - 1744",regex:"pendo_integration_key"},{name:"Generic - 1745",regex:"salesforce_access_token"},{name:"Generic - 1746",regex:"saucelabs_ukey"},{name:"Generic - 1747",regex:"sendgrid_api_key"},{name:"Generic - 1748",regex:"slack_api_token"},{name:"Generic - 1749",regex:"slack_webhook"},{name:"Generic - 1750",regex:"square_secret"},{name:"Generic - 1751",regex:"square_auth_token"},{name:"Generic - 1752",regex:"travisci_api_token"},{name:"Generic - 1753",regex:"twilio_sid_token"},{name:"Generic - 1754",regex:"twitter_api_secret"},{name:"Generic - 1755",regex:"twitter_bearer_token"},{name:"Generic - 1756",regex:"spotify_access_token"},{name:"Generic - 1757",regex:"stripe_key_live"},{name:"Generic - 1758",regex:"wakatime_api_key"},{name:"Generic - 1759",regex:"wompi_auth_bearer_sb"},{name:"Generic - 1760",regex:"wompi_auth_bearer_live"},{name:"Generic - 1761",regex:"wpengine_api_key"},{name:"Generic - 1762",regex:"zapier_webhook"},{name:"Generic - 1763",regex:"zendesk_access_token"},{name:"Generic - 1764",regex:"ssh-rsa"},{name:"Generic - 1765",regex:"s3-[a-z0-9-]+\\.amazonaws\\.com/[a-z0-9._-]+"},{name:"Generic webhook secret",regex:"(webhook).+(secret|token|key).+"},{name:"Gengo",regex:"(?:gengo).{0,40}([ ]{0,1}[0-9a-zA-Z\\[\\]\\-\\(\\)\\{\\}|_^@$=~]{64}[ \\r\\n]{1})"},{name:"Geoapify",regex:"(?:geoapify).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Geocode",regex:"(?:geocode).{0,40}\\b([a-z0-9]{28})\\b"},{name:"Geocodify",regex:"(?:geocodify).{0,40}\\b([0-9a-z]{40})\\b"},{name:"Geocodio - 2",regex:"(?:geocod).{0,40}\\b([a-z0-9]{39})\\b"},{name:"Geoipifi",regex:"(?:ipifi).{0,40}\\b([a-z0-9A-Z_]{32})\\b"},{name:"Getemail",regex:"(?:getemail).{0,40}\\b([a-zA-Z0-9-]{20})\\b"},{name:"Getemails - 1",regex:"(?:getemails).{0,40}\\b([a-z0-9-]{26})\\b"},{name:"Getemails - 2",regex:"(?:getemails).{0,40}\\b([a-z0-9-]{18})\\b"},{name:"Getgeoapi",regex:"(?:getgeoapi).{0,40}\\b([0-9a-z]{40})\\b"},{name:"Getgist",regex:"(?:getgist).{0,40}\\b([a-z0-9A-Z+=]{68})"},{name:"Getsandbox - 1",regex:"(?:getsandbox).{0,40}\\b([a-z0-9-]{40})\\b"},{name:"Getsandbox - 2",regex:"(?:getsandbox).{0,40}\\b([a-z0-9-]{15,30})\\b"},{name:"GitHub",regex:`[gG][iI][tT][hH][uU][bB].*['|"][0-9a-zA-Z]{35,40}['|"]`},{name:"Github - 2",regex:"\\b((?:ghp|gho|ghu|ghs|ghr)_[a-zA-Z0-9]{36,255}\\b)"},{name:"Github App Token",regex:"(ghu|ghs)_[0-9a-zA-Z]{36}"},{name:"Github OAuth Access Token",regex:"gho_[0-9a-zA-Z]{36}"},{name:"Github Personal Access Token",regex:"ghp_[0-9a-zA-Z]{36}"},{name:"Github Refresh Token",regex:"ghr_[0-9a-zA-Z]{76}"},{name:"Github_old",regex:`(?:github)[^\\.].{0,40}[ =:'"]+([a-f0-9]{40})\\b`},{name:"Githubapp - 1",regex:"(?:github).{0,40}\\b([0-9]{6})\\b"},{name:"Githubapp - 2",regex:"(?:github).{0,40}(-----BEGIN RSA PRIVATE KEY-----\\s[A-Za-z0-9+\\/\\s]*\\s-----END RSA PRIVATE KEY-----)"},{name:"Gitlab",regex:"(?:gitlab).{0,40}\\b([a-zA-Z0-9\\-=_]{20,22})\\b"},{name:"Gitlabv2",regex:"\\b(glpat-[a-zA-Z0-9\\-=_]{20,22})\\b"},{name:"Gitter",regex:"(?:gitter).{0,40}\\b([a-z0-9-]{40})\\b"},{name:"Glassnode",regex:"(?:glassnode).{0,40}\\b([0-9A-Za-z]{27})\\b"},{name:"Gocanvas - 1",regex:"(?:gocanvas).{0,40}\\b([0-9A-Za-z/+]{43}=[ \\r\\n]{1})"},{name:"Gocanvas - 2",regex:"(?:gocanvas).{0,40}\\b([\\w\\.-]+@[\\w-]+\\.[\\w\\.-]{2,5})\\b"},{name:"Gocardless",regex:`\\b(live_[0-9A-Za-z\\_\\-]{40}[ "'\\r\\n]{1})`},{name:"Goodday",regex:"(?:goodday).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Google (GCP) Service Account",regex:'"type": "service_account"'},{name:"Google API Key",regex:"AIza[0-9a-z-_]{35}"},{name:"Google Calendar URI",regex:"https://www\\.google\\.com/calendar/embed\\?src=[A-Za-z0-9%@&;=\\-_\\./]+"},{name:"Graphcms - 1",regex:"(?:graph).{0,40}\\b([a-z0-9]{25})\\b"},{name:"Graphcms - 2",regex:"\\b(ey[a-zA-Z0-9]{73}.ey[a-zA-Z0-9]{365}.[a-zA-Z0-9_-]{683})\\b"},{name:"Graphhopper",regex:"(?:graphhopper).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Groovehq",regex:"(?:groove).{0,40}\\b([a-z0-9A-Z]{64})"},{name:"Guru - 1",regex:"(?:guru).{0,40}\\b([a-zA-Z0-9]{3,20}@[a-zA-Z0-9]{2,12}.[a-zA-Z0-9]{2,5})\\b"},{name:"Guru - 2",regex:"(?:guru).{0,40}\\b([a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12})\\b"},{name:"Gyazo",regex:"(?:gyazo).{0,40}\\b([0-9A-Za-z-]{43})\\b"},{name:"Happi",regex:"(?:happi).{0,40}\\b([a-zA-Z0-9]{56})"},{name:"Happyscribe",regex:"(?:happyscribe).{0,40}\\b([0-9a-zA-Z]{24})\\b"},{name:"Harvest - 1",regex:"(?:harvest).{0,40}\\b([a-z0-9A-Z._]{97})\\b"},{name:"Harvest - 2",regex:"(?:harvest).{0,40}\\b([0-9]{4,9})\\b"},{name:"Hellosign",regex:"(?:hellosign).{0,40}\\b([a-zA-Z-0-9/+]{64})\\b"},{name:"Helpcrunch",regex:"(?:helpcrunch).{0,40}\\b([a-zA-Z-0-9+/=]{328})"},{name:"Helpscout",regex:"(?:helpscout).{0,40}\\b([A-Za-z0-9]{56})\\b"},{name:"Hereapi",regex:"(?:hereapi).{0,40}\\b([a-zA-Z0-9\\S]{43})\\b"},{name:"Heroku",regex:"(?:heroku).{0,40}\\b([0-9Aa-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\\b"},{name:"Hive - 1",regex:"(?:hive).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Hive - 2",regex:"(?:hive).{0,40}\\b([0-9A-Za-z]{17})\\b"},{name:"Hiveage",regex:"(?:hiveage).{0,40}\\b([0-9A-Za-z\\_\\-]{20})\\b"},{name:"Holidayapi",regex:"(?:holidayapi).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Host",regex:"(?:host).{0,40}\\b([a-z0-9]{14})\\b"},{name:"Html2pdf",regex:"(?:html2pdf).{0,40}\\b([a-zA-Z0-9]{64})\\b"},{name:"Hubspotapikey",regex:"(?:hubspot).{0,40}\\b([A-Za-z0-9]{8}\\-[A-Za-z0-9]{4}\\-[A-Za-z0-9]{4}\\-[A-Za-z0-9]{4}\\-[A-Za-z0-9]{12})\\b"},{name:"Humanity",regex:"(?:humanity).{0,40}\\b([0-9a-z]{40})\\b"},{name:"Hunter",regex:"(?:hunter).{0,40}\\b([a-z0-9_-]{40})\\b"},{name:"Hypertrack - 1",regex:"(?:hypertrack).{0,40}\\b([0-9a-zA-Z\\_\\-]{54})\\b"},{name:"Hypertrack - 2",regex:"(?:hypertrack).{0,40}\\b([0-9a-zA-Z\\_\\-]{27})\\b"},{name:"Ibmclouduserkey",regex:"(?:ibm).{0,40}\\b([A-Za-z0-9_-]{44})\\b"},{name:"Iconfinder",regex:"(?:iconfinder).{0,40}\\b([a-zA-Z0-9]{64})\\b"},{name:"Iexcloud",regex:"(?:iexcloud).{0,40}\\b([a-z0-9_]{35})\\b"},{name:"Imagekit",regex:"(?:imagekit).{0,40}\\b([a-zA-Z0-9_=]{36})"},{name:"Imagga",regex:"(?:imagga).{0,40}\\b([a-z0-9A-Z=]{72})"},{name:"Impala",regex:"(?:impala).{0,40}\\b([0-9A-Za-z_]{46})\\b"},{name:"Insightly",regex:"(?:insightly).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Integromat",regex:"(?:integromat).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Intercom",regex:"(?:intercom).{0,40}\\b([a-zA-Z0-9\\W\\S]{59}\\=)"},{name:"Intrinio",regex:"(?:intrinio).{0,40}\\b([a-zA-Z0-9]{44})\\b"},{name:"Invoiceocean - 1",regex:"(?:invoiceocean).{0,40}\\b([0-9A-Za-z]{20})\\b"},{name:"Invoiceocean - 2",regex:"\\b([0-9a-z]{1,}.invoiceocean.com)\\b"},{name:"Ipapi",regex:"(?:ipapi).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Ipgeolocation",regex:"(?:ipgeolocation).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Ipify",regex:"(?:ipify).{0,40}\\b([a-zA-Z0-9_-]{32})\\b"},{name:"Ipinfodb",regex:"(?:ipinfodb).{0,40}\\b([a-z0-9]{64})\\b"},{name:"Ipquality",regex:"(?:ipquality).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Ipstack",regex:"(?:ipstack).{0,40}\\b([a-fA-f0-9]{32})\\b"},{name:"JDBC Connection String",regex:"jdbc:[a-z:]+://[A-Za-z0-9\\.\\-_:;=/@?,&]+"},{name:"Jiratoken - 1",regex:"(?:jira).{0,40}\\b([a-zA-Z-0-9]{24})\\b"},{name:"Jiratoken - 2",regex:"(?:jira).{0,40}\\b([a-zA-Z-0-9]{5,24}\\@[a-zA-Z-0-9]{3,16}\\.com)\\b"},{name:"Jiratoken - 3",regex:"(?:jira).{0,40}\\b([a-zA-Z-0-9]{5,24}\\.[a-zA-Z-0-9]{3,16}\\.[a-zA-Z-0-9]{3,16})\\b"},{name:"Jotform",regex:"(?:jotform).{0,40}\\b([0-9Aa-z]{32})\\b"},{name:"Jumpcloud",regex:"(?:jumpcloud).{0,40}\\b([a-zA-Z0-9]{40})\\b"},{name:"Juro",regex:"(?:juro).{0,40}\\b([a-zA-Z0-9]{40})\\b"},{name:"Kanban - 1",regex:"(?:kanban).{0,40}\\b([0-9A-Z]{12})\\b"},{name:"Kanban - 2",regex:"\\b([0-9a-z]{1,}.kanbantool.com)\\b"},{name:"Karmacrm",regex:"(?:karma).{0,40}\\b([a-zA-Z0-9]{20})\\b"},{name:"Keenio - 1",regex:"(?:keen).{0,40}\\b([0-9a-z]{24})\\b"},{name:"Keenio - 2",regex:"(?:keen).{0,40}\\b([0-9A-Z]{64})\\b"},{name:"Kickbox",regex:"(?:kickbox).{0,40}\\b([a-zA-Z0-9_]+[a-zA-Z0-9]{64})\\b"},{name:"Klipfolio",regex:"(?:klipfolio).{0,40}\\b([0-9a-f]{40})\\b"},{name:"Kontent",regex:"(?:kontent).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Kraken - 1",regex:`(?:kraken).{0,40}\\b([0-9A-Za-z\\/\\+=]{56}[ "'\\r\\n]{1})`},{name:"Kraken - 2",regex:`(?:kraken).{0,40}\\b([0-9A-Za-z\\/\\+=]{86,88}[ "'\\r\\n]{1})`},{name:"Kucoin - 1",regex:"(?:kucoin).{0,40}([ \\r\\n]{1}[!-~]{7,32}[ \\r\\n]{1})"},{name:"Kucoin - 2",regex:"(?:kucoin).{0,40}\\b([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\\b"},{name:"Kucoin - 3",regex:"(?:kucoin).{0,40}\\b([0-9a-f]{24})\\b"},{name:"Kylas",regex:"(?:kylas).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Languagelayer",regex:"(?:languagelayer).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Lastfm",regex:"(?:lastfm).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Launchdarkly",regex:"(?:launchdarkly).{0,40}\\b([a-z0-9-]{40})\\b"},{name:"Leadfeeder",regex:"(?:leadfeeder).{0,40}\\b([a-zA-Z0-9-]{43})\\b"},{name:"Lendflow",regex:"(?:lendflow).{0,40}\\b([a-zA-Z0-9]{36}\\.[a-zA-Z0-9]{235}\\.[a-zA-Z0-9]{32}\\-[a-zA-Z0-9]{47}\\-[a-zA-Z0-9_]{162}\\-[a-zA-Z0-9]{42}\\-[a-zA-Z0-9_]{40}\\-[a-zA-Z0-9_]{66}\\-[a-zA-Z0-9_]{59}\\-[a-zA-Z0-9]{7}\\-[a-zA-Z0-9_]{220})\\b"},{name:"Lessannoyingcrm",regex:"(?:less).{0,40}\\b([a-zA-Z0-9-]{57})\\b"},{name:"Lexigram",regex:"(?:lexigram).{0,40}\\b([a-zA-Z0-9\\S]{301})\\b"},{name:"Linearapi",regex:"\\b(lin_api_[0-9A-Za-z]{40})\\b"},{name:"Linemessaging",regex:"(?:line).{0,40}\\b([A-Za-z0-9+/]{171,172})\\b"},{name:"Linenotify",regex:"(?:linenotify).{0,40}\\b([0-9A-Za-z]{43})\\b"},{name:"Linkpreview",regex:"(?:linkpreview).{0,40}\\b([a-zA-Z0-9]{32})\\b"},{name:"Liveagent",regex:"(?:liveagent).{0,40}\\b([a-zA-Z0-9]{32})\\b"},{name:"Livestorm",regex:"(?:livestorm).{0,40}\\b(eyJhbGciOiJIUzI1NiJ9\\.eyJhdWQiOiJhcGkubGl2ZXN0b3JtLmNvIiwianRpIjoi[0-9A-Z-a-z]{134}\\.[0-9A-Za-z\\-\\_]{43}[ \\r\\n]{1})"},{name:"Locationiq",regex:"\\b(pk\\.[a-zA-Z-0-9]{32})\\b"},{name:"Loginradius",regex:"(?:loginradius).{0,40}\\b([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\\b"},{name:"Lokalisetoken",regex:"(?:lokalise).{0,40}\\b([a-z0-9]{40})\\b"},{name:"Loyverse",regex:"(?:loyverse).{0,40}\\b([0-9-a-z]{32})\\b"},{name:"Luno - 1",regex:"(?:luno).{0,40}\\b([a-z0-9]{13})\\b"},{name:"Luno - 2",regex:"(?:luno).{0,40}\\b([a-zA-Z0-9_-]{43})\\b"},{name:"M3o",regex:"(?:m3o).{0,40}\\b([0-9A-Za-z]{48})\\b"},{name:"Macaddress",regex:"(?:macaddress).{0,40}\\b([a-zA-Z0-9_]{32})\\b"},{name:"Madkudu",regex:"(?:madkudu).{0,40}\\b([0-9a-f]{32})\\b"},{name:"Magnetic",regex:"(?:magnetic).{0,40}\\b([0-9Aa-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12})\\b"},{name:"Mailboxlayer",regex:"(?:mailboxlayer).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Mailerlite",regex:"(?:mailerlite).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Mailgun - 2",regex:"(?:mailgun).{0,40}\\b([a-zA-Z-0-9]{72})\\b"},{name:"Mailgun API Key - 1",regex:"key-[0-9a-zA-Z]{32}"},{name:"Mailgun API key - 2",regex:"(mailgun|mg)[0-9a-z]{32}"},{name:"Mailjetbasicauth",regex:"(?:mailjet).{0,40}\\b([A-Za-z0-9]{87}\\=)"},{name:"Mailjetsms",regex:"(?:mailjet).{0,40}\\b([A-Za-z0-9]{32})\\b"},{name:"Mailmodo",regex:"(?:mailmodo).{0,40}\\b([A-Z0-9]{7}-[A-Z0-9]{7}-[A-Z0-9]{7}-[A-Z0-9]{7})\\b"},{name:"Mailsac",regex:"(?:mailsac).{0,40}\\b(k_[0-9A-Za-z]{36,})\\b"},{name:"Mandrill",regex:"(?:mandrill).{0,40}\\b([A-Za-z0-9_-]{22})\\b"},{name:"Manifest",regex:"(?:manifest).{0,40}\\b([a-zA-z0-9]{32})\\b"},{name:"Mapbox - 2",regex:"\\b(sk\\.[a-zA-Z-0-9\\.]{80,240})\\b"},{name:"Mapquest",regex:"(?:mapquest).{0,40}\\b([0-9A-Za-z]{32})\\b"},{name:"Marketstack",regex:"(?:marketstack).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Mattermostpersonaltoken - 1",regex:"(?:mattermost).{0,40}\\b([A-Za-z0-9-_]{1,}.cloud.mattermost.com)\\b"},{name:"Mattermostpersonaltoken - 2",regex:"(?:mattermost).{0,40}\\b([a-z0-9]{26})\\b"},{name:"Mavenlink",regex:"(?:mavenlink).{0,40}\\b([0-9a-z]{64})\\b"},{name:"Maxmindlicense - 1",regex:"(?:maxmind|geoip).{0,40}\\b([0-9A-Za-z]{16})\\b"},{name:"Maxmindlicense - 2",regex:"(?:maxmind|geoip).{0,40}\\b([0-9]{2,7})\\b"},{name:"Meaningcloud",regex:"(?:meaningcloud).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Mediastack",regex:"(?:mediastack).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Meistertask",regex:"(?:meistertask).{0,40}\\b([a-zA-Z0-9]{43})\\b"},{name:"Mesibo",regex:"(?:mesibo).{0,40}\\b([0-9A-Za-z]{64})\\b"},{name:"Messagebird",regex:"(?:messagebird).{0,40}\\b([A-Za-z0-9_-]{25})\\b"},{name:"Metaapi - 1",regex:"(?:metaapi|meta-api).{0,40}\\b([0-9a-f]{64})\\b"},{name:"Metaapi - 2",regex:"(?:metaapi|meta-api).{0,40}\\b([0-9a-f]{24})\\b"},{name:"Metrilo",regex:"(?:metrilo).{0,40}\\b([a-z0-9]{16})\\b"},{name:"Microsoftteamswebhook",regex:"(https:\\/\\/[a-zA-Z-0-9]+\\.webhook\\.office\\.com\\/webhookb2\\/[a-zA-Z-0-9]{8}-[a-zA-Z-0-9]{4}-[a-zA-Z-0-9]{4}-[a-zA-Z-0-9]{4}-[a-zA-Z-0-9]{12}\\@[a-zA-Z-0-9]{8}-[a-zA-Z-0-9]{4}-[a-zA-Z-0-9]{4}-[a-zA-Z-0-9]{4}-[a-zA-Z-0-9]{12}\\/IncomingWebhook\\/[a-zA-Z-0-9]{32}\\/[a-zA-Z-0-9]{8}-[a-zA-Z-0-9]{4}-[a-zA-Z-0-9]{4}-[a-zA-Z-0-9]{4}-[a-zA-Z-0-9]{12})"},{name:"Midise",regex:"midi-662b69edd2[a-zA-Z0-9]{54}"},{name:"Mindmeister",regex:"(?:mindmeister).{0,40}\\b([a-zA-Z0-9]{43})\\b"},{name:"Mite - 1",regex:"(?:mite).{0,40}\\b([0-9a-z]{16})\\b"},{name:"Mite - 2",regex:"\\b([0-9a-z-]{1,}.mite.yo.lk)\\b"},{name:"Mixmax",regex:"(?:mixmax).{0,40}\\b([a-zA-Z0-9_-]{36})\\b"},{name:"Mixpanel - 1",regex:"(?:mixpanel).{0,40}\\b([a-zA-Z0-9.-]{30,40})\\b"},{name:"Mixpanel - 2",regex:"(?:mixpanel).{0,40}\\b([a-zA-Z0-9-]{32})\\b"},{name:"Moderation",regex:"(?:moderation).{0,40}\\b([a-zA-Z0-9]{36}\\.[a-zA-Z0-9]{115}\\.[a-zA-Z0-9_]{43})\\b"},{name:"Monday",regex:"(?:monday).{0,40}\\b(ey[a-zA-Z0-9_.]{210,225})\\b"},{name:"Moonclerck",regex:"(?:moonclerck).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Moonclerk",regex:"(?:moonclerk).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Moosend",regex:"(?:moosend).{0,40}\\b([0-9Aa-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\\b"},{name:"Mrticktock - 1",regex:"(?:mrticktock).{0,40}\\b([a-zA-Z0-9!=@#$%()_^]{1,50})"},{name:"Myfreshworks - 2",regex:"(?:freshworks).{0,40}\\b([a-z0-9A-Z-]{22})\\b"},{name:"Myintervals",regex:"(?:myintervals).{0,40}\\b([0-9a-z]{11})\\b"},{name:"Nasdaqdatalink",regex:"(?:nasdaq).{0,40}\\b([a-zA-Z0-9_-]{20})\\b"},{name:"Nethunt - 1",regex:"(?:nethunt).{0,40}\\b([a-zA-Z0-9.-@]{25,30})\\b"},{name:"Nethunt - 2",regex:"(?:nethunt).{0,40}\\b([a-z0-9-\\S]{36})\\b"},{name:"Netlify",regex:"(?:netlify).{0,40}\\b([A-Za-z0-9_-]{43,45})\\b"},{name:"Neutrinoapi - 1",regex:"(?:neutrinoapi).{0,40}\\b([a-zA-Z0-9]{48})\\b"},{name:"Neutrinoapi - 2",regex:"(?:neutrinoapi).{0,40}\\b([a-zA-Z0-9]{6,24})\\b"},{name:"Newrelic Admin API Key",regex:"NRAA-[a-f0-9]{27}"},{name:"Newrelic Insights API Key",regex:"NRI(?:I|Q)-[A-Za-z0-9\\-_]{32}"},{name:"Newrelic REST API Key",regex:"NRRA-[a-f0-9]{42}"},{name:"Newrelic Synthetics Location Key",regex:"NRSP-[a-z]{2}[0-9]{2}[a-f0-9]{31}"},{name:"Newrelicpersonalapikey",regex:"(?:newrelic).{0,40}\\b([A-Za-z0-9_\\.]{4}-[A-Za-z0-9_\\.]{42})\\b"},{name:"Newsapi",regex:"(?:newsapi).{0,40}\\b([a-z0-9]{32})"},{name:"Newscatcher",regex:"(?:newscatcher).{0,40}\\b([0-9A-Za-z_]{43})\\b"},{name:"Nexmoapikey - 1",regex:"(?:nexmo).{0,40}\\b([A-Za-z0-9_-]{8})\\b"},{name:"Nexmoapikey - 2",regex:"(?:nexmo).{0,40}\\b([A-Za-z0-9_-]{16})\\b"},{name:"Nftport",regex:"(?:nftport).{0,40}\\b([a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12})\\b"},{name:"Nicereply",regex:"(?:nicereply).{0,40}\\b([0-9a-f]{40})\\b"},{name:"Nimble",regex:"(?:nimble).{0,40}\\b([a-zA-Z0-9]{30})\\b"},{name:"Nitro",regex:"(?:nitro).{0,40}\\b([0-9a-f]{32})\\b"},{name:"Noticeable",regex:"(?:noticeable).{0,40}\\b([0-9a-zA-Z]{20})\\b"},{name:"Notion",regex:"\\b(secret_[A-Za-z0-9]{43})\\b"},{name:"Nozbeteams",regex:"(?:nozbe|nozbeteams).{0,40}\\b([0-9A-Za-z]{16}_[0-9A-Za-z\\-_]{64}[ \\r\\n]{1})"},{name:"Numverify",regex:"(?:numverify).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Nutritionix - 1",regex:"(?:nutritionix).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Nutritionix - 2",regex:"(?:nutritionix).{0,40}\\b([a-z0-9]{8})\\b"},{name:"Nylas",regex:"(?:nylas).{0,40}\\b([0-9A-Za-z]{30})\\b"},{name:"Nytimes",regex:"(?:nytimes).{0,40}\\b([a-z0-9A-Z-]{32})\\b"},{name:"Oanda",regex:"(?:oanda).{0,40}\\b([a-zA-Z0-9]{24})\\b"},{name:"Omnisend",regex:"(?:omnisend).{0,40}\\b([a-z0-9A-Z-]{75})\\b"},{name:"Onedesk - 1",regex:"(?:onedesk).{0,40}\\b([a-zA-Z0-9!=@#$%^]{8,64})"},{name:"Onelogin - 2",regex:`secret[a-zA-Z0-9_' "=]{0,20}([a-z0-9]{64})`},{name:"Onepagecrm - 1",regex:"(?:onepagecrm).{0,40}\\b([a-zA-Z0-9=]{44})"},{name:"Onepagecrm - 2",regex:"(?:onepagecrm).{0,40}\\b([a-z0-9]{24})\\b"},{name:"Onwaterio",regex:"(?:onwater).{0,40}\\b([a-zA-Z0-9_-]{20})\\b"},{name:"Oopspam",regex:"(?:oopspam).{0,40}\\b([a-zA-Z0-9]{40})\\b"},{name:"Opencagedata",regex:"(?:opencagedata).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Opengraphr",regex:"(?:opengraphr).{0,40}\\b([0-9Aa-zA-Z]{80})\\b"},{name:"Openuv",regex:"(?:openuv).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Openweather",regex:"(?:openweather).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Optimizely",regex:"(?:optimizely).{0,40}\\b([0-9A-Za-z-:]{54})\\b"},{name:"Owlbot",regex:"(?:owlbot).{0,40}\\b([a-z0-9]{40})\\b"},{name:"PGP private key block",regex:"-----BEGIN PGP PRIVATE KEY BLOCK-----"},{name:"Pagerdutyapikey",regex:"(?:pagerduty).{0,40}\\b([a-z]{1}\\+[a-zA-Z]{9}\\-[a-z]{2}\\-[a-z0-9]{5})\\b"},{name:"Pandadoc",regex:"(?:pandadoc).{0,40}\\b([a-zA-Z0-9]{40})\\b"},{name:"Pandascore",regex:"(?:pandascore).{0,40}([ \\r\\n]{0,1}[0-9A-Za-z\\-\\_]{51}[ \\r\\n]{1})"},{name:"Paralleldots",regex:"(?:paralleldots).{0,40}\\b([0-9A-Za-z]{43})\\b"},{name:"Partnerstack",regex:"(?:partnerstack).{0,40}\\b([0-9A-Za-z]{64})\\b"},{name:"Passbase",regex:"(?:passbase).{0,40}\\b([a-zA-Z0-9]{128})\\b"},{name:"Pastebin",regex:"(?:pastebin).{0,40}\\b([a-zA-Z0-9_]{32})\\b"},{name:"PayPal Braintree access token",regex:"access_token\\$production\\$[0-9a-z]{16}\\$[0-9a-f]{32}"},{name:"Paymoapp",regex:"(?:paymoapp).{0,40}\\b([a-zA-Z0-9]{44})\\b"},{name:"Paymongo",regex:"(?:paymongo).{0,40}\\b([a-zA-Z0-9_]{32})\\b"},{name:"Paypaloauth - 1",regex:"\\b([A-Za-z0-9_\\.]{7}-[A-Za-z0-9_\\.]{72})\\b"},{name:"Paypaloauth - 2",regex:"\\b([A-Za-z0-9_\\.]{69}-[A-Za-z0-9_\\.]{10})\\b"},{name:"Paystack",regex:"\\b(sk\\_[a-z]{1,}\\_[A-Za-z0-9]{40})\\b"},{name:"Pdflayer",regex:"(?:pdflayer).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Pdfshift",regex:"(?:pdfshift).{0,40}\\b([0-9a-f]{32})\\b"},{name:"Peopledatalabs",regex:"(?:peopledatalabs).{0,40}\\b([a-z0-9]{64})\\b"},{name:"Pepipost",regex:"(?:pepipost|netcore).{0,40}\\b([a-zA-Z-0-9]{32})\\b"},{name:"Picatic API key",regex:"sk_live_[0-9a-z]{32}"},{name:"Pipedream",regex:"(?:pipedream).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Pipedrive",regex:"(?:pipedrive).{0,40}\\b([a-zA-Z0-9]{40})\\b"},{name:"Pivotaltracker",regex:"(?:pivotal).{0,40}([a-z0-9]{32})"},{name:"Pixabay",regex:"(?:pixabay).{0,40}\\b([a-z0-9-]{34})\\b"},{name:"Plaidkey - 1",regex:"(?:plaid).{0,40}\\b([a-z0-9]{24})\\b"},{name:"Plaidkey - 2",regex:"(?:plaid).{0,40}\\b([a-z0-9]{30})\\b"},{name:"Planviewleankit - 1",regex:"(?:planviewleankit|planview).{0,40}\\b([0-9a-f]{128})\\b"},{name:"Planviewleankit - 2",regex:"(?:planviewleankit|planview).{0,40}(?:subdomain).\\b([a-zA-Z][a-zA-Z0-9.-]{1,23}[a-zA-Z0-9])\\b"},{name:"Planyo",regex:"(?:planyo).{0,40}\\b([0-9a-z]{62})\\b"},{name:"Plivo - 1",regex:"(?:plivo).{0,40}\\b([A-Za-z0-9_-]{40})\\b"},{name:"Plivo - 2",regex:"(?:plivo).{0,40}\\b([A-Z]{20})\\b"},{name:"Poloniex - 1",regex:"(?:poloniex).{0,40}\\b([0-9a-f]{128})\\b"},{name:"Poloniex - 2",regex:"(?:poloniex).{0,40}\\b([0-9A-Z]{8}-[0-9A-Z]{8}-[0-9A-Z]{8}-[0-9A-Z]{8})\\b"},{name:"Polygon",regex:"(?:polygon).{0,40}\\b([a-z0-9A-Z]{32})\\b"},{name:"Positionstack",regex:"(?:positionstack).{0,40}\\b([a-zA-Z0-9_]{32})\\b"},{name:"Postageapp",regex:"(?:postageapp).{0,40}\\b([0-9A-Za-z]{32})\\b"},{name:"Posthog",regex:"\\b(phc_[a-zA-Z0-9_]{43})\\b"},{name:"Postman",regex:"\\b(PMAK-[a-zA-Z-0-9]{59})\\b"},{name:"Postmark",regex:"(?:postmark).{0,40}\\b([0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12})\\b"},{name:"Powrbot",regex:"(?:powrbot).{0,40}\\b([a-z0-9A-Z]{40})\\b"},{name:"Privatekey",regex:"-----\\s*?BEGIN[ A-Z0-9_-]*?PRIVATE KEY\\s*?-----[\\s\\S]*?----\\s*?END[ A-Z0-9_-]*? PRIVATE KEY\\s*?-----"},{name:"Prospectcrm",regex:"(?:prospect).{0,40}\\b([a-z0-9-]{32})\\b"},{name:"Prospectio",regex:"(?:prospect).{0,40}\\b([a-z0-9A-Z-]{50})\\b"},{name:"Protocolsio",regex:"(?:protocols).{0,40}\\b([a-z0-9]{64})\\b"},{name:"Proxycrawl",regex:"(?:proxycrawl).{0,40}\\b([a-zA-Z0-9_]{22})\\b"},{name:"Pubnubpublishkey - 1",regex:"\\b(sub-c-[0-9a-z]{8}-[a-z]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12})\\b"},{name:"Pubnubpublishkey - 2",regex:"\\b(pub-c-[0-9a-z]{8}-[0-9a-z]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12})\\b"},{name:"Purestake",regex:"(?:purestake).{0,40}\\b([a-zA-Z0-9]{40})\\b"},{name:"Pushbulletapikey",regex:"(?:pushbullet).{0,40}\\b([A-Za-z0-9_\\.]{34})\\b"},{name:"Pusherchannelkey - 1",regex:"(?:key).{0,40}\\b([a-z0-9]{20})\\b"},{name:"Pusherchannelkey - 2",regex:"(?:pusher).{0,40}\\b([a-z0-9]{20})\\b"},{name:"Pusherchannelkey - 3",regex:"(?:pusher).{0,40}\\b([0-9]{7})\\b"},{name:"PyPI upload token",regex:"pypi-AgEIcHlwaS5vcmc[A-Za-z0-9-_]{50,1000}"},{name:"Qualaroo",regex:"(?:qualaroo).{0,40}\\b([a-z0-9A-Z=]{64})"},{name:"Qubole",regex:"(?:qubole).{0,40}\\b([0-9a-z]{64})\\b"},{name:"Quickmetrics",regex:"(?:quickmetrics).{0,40}\\b([a-zA-Z0-9_-]{22})\\b"},{name:"REDIS_URL",regex:"(REDIS_URL).+"},{name:"RKCS8",regex:"-----BEGIN PRIVATE KEY-----"},{name:"RSA private key",regex:"-----BEGIN RSA PRIVATE KEY-----"},{name:"Rapidapi",regex:"(?:rapidapi).{0,40}\\b([A-Za-z0-9_-]{50})\\b"},{name:"Raven",regex:"(?:raven).{0,40}\\b([A-Z0-9-]{16})\\b"},{name:"Rawg",regex:"(?:rawg).{0,40}\\b([0-9Aa-z]{32})\\b"},{name:"Razorpay - 1",regex:"\\brzp_\\w{2,6}_\\w{10,20}\\b"},{name:"Readme",regex:"(?:readme).{0,40}\\b([a-zA-Z0-9_]{32})\\b"},{name:"Reallysimplesystems",regex:"\\b(ey[a-zA-Z0-9-._]{153}.ey[a-zA-Z0-9-._]{916,1000})\\b"},{name:"Rebrandly",regex:"(?:rebrandly).{0,40}\\b([a-zA-Z0-9_]{32})\\b"},{name:"Refiner",regex:"(?:refiner).{0,40}\\b([0-9Aa-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\\b"},{name:"Repairshopr - 1",regex:"(?:repairshopr).{0,40}\\b([a-zA-Z0-9_.!+$#^*]{3,32})\\b"},{name:"Repairshopr - 2",regex:"(?:repairshopr).{0,40}\\b([a-zA-Z0-9-]{51})\\b"},{name:"Restpack",regex:"(?:restpack).{0,40}\\b([a-zA-Z0-9]{48})\\b"},{name:"Restpackhtmltopdfapi",regex:"(?:restpack).{0,40}\\b([0-9A-Za-z]{48})\\b"},{name:"Rev - 1",regex:"(?:rev).{0,40}\\b([0-9a-zA-Z\\/\\+]{27}\\=[ \\r\\n]{1})"},{name:"Rev - 2",regex:"(?:rev).{0,40}\\b([0-9a-zA-Z\\-]{27}[ \\r\\n]{1})"},{name:"Revampcrm - 1",regex:"(?:revamp).{0,40}\\b([a-zA-Z0-9]{40}\\b)"},{name:"Revampcrm - 2",regex:"(?:revamp).{0,40}\\b([a-zA-Z0-9.-@]{25,30})\\b"},{name:"Ringcentral - 1",regex:"(?:ringcentral).{0,40}\\b(https://www.[0-9A-Za-z_-]{1,}.com)\\b"},{name:"Ringcentral - 2",regex:"(?:ringcentral).{0,40}\\b([0-9A-Za-z_-]{22})\\b"},{name:"Ritekit",regex:"(?:ritekit).{0,40}\\b([0-9a-f]{44})\\b"},{name:"Roaring",regex:"(?:roaring).{0,40}\\b([0-9A-Za-z_-]{28})\\b"},{name:"Rocketreach",regex:"(?:rocketreach).{0,40}\\b([a-z0-9-]{39})\\b"},{name:"Roninapp - 1",regex:"(?:ronin).{0,40}\\b([0-9Aa-zA-Z]{3,32})\\b"},{name:"Roninapp - 2",regex:"(?:ronin).{0,40}\\b([0-9a-zA-Z]{26})\\b"},{name:"Route4me",regex:"(?:route4me).{0,40}\\b([0-9A-Z]{32})\\b"},{name:"Rownd - 1",regex:"(?:rownd).{0,40}\\b([a-z0-9]{8}\\-[a-z0-9]{4}\\-[a-z0-9]{4}\\-[a-z0-9]{4}\\-[a-z0-9]{12})\\b"},{name:"Rownd - 2",regex:"(?:rownd).{0,40}\\b([a-z0-9]{48})\\b"},{name:"Rownd - 3",regex:"(?:rownd).{0,40}\\b([0-9]{18})\\b"},{name:"Rubygems",regex:"\\b(rubygems_[a-zA0-9]{48})\\b"},{name:"Runrunit - 1",regex:"(?:runrunit).{0,40}\\b([0-9a-f]{32})\\b"},{name:"Runrunit - 2",regex:"(?:runrunit).{0,40}\\b([0-9A-Za-z]{18,20})\\b"},{name:"SSH",regex:"-----BEGIN OPENSSH PRIVATE KEY-----"},{name:"SSH (DSA) private key",regex:"-----BEGIN DSA PRIVATE KEY-----"},{name:"Salesblink",regex:"(?:salesblink).{0,40}\\b([a-zA-Z]{16})\\b"},{name:"Salescookie",regex:"(?:salescookie).{0,40}\\b([a-zA-z0-9]{32})\\b"},{name:"Salesflare",regex:"(?:salesflare).{0,40}\\b([a-zA-Z0-9_]{45})\\b"},{name:"Satismeterprojectkey - 1",regex:"(?:satismeter).{0,40}\\b([a-zA-Z0-9]{4,20}@[a-zA-Z0-9]{2,12}.[a-zA-Z0-9]{2,12})\\b"},{name:"Satismeterprojectkey - 2",regex:"(?:satismeter).{0,40}\\b([a-zA-Z0-9]{24})\\b"},{name:"Satismeterprojectkey - 3",regex:"(?:satismeter).{0,40}\\b([a-zA-Z0-9!=@#$%^]{6,32})"},{name:"Satismeterwritekey",regex:"(?:satismeter).{0,40}\\b([a-z0-9A-Z]{16})\\b"},{name:"Saucelabs - 1",regex:"\\b(oauth\\-[a-z0-9]{8,}\\-[a-z0-9]{5})\\b"},{name:"Saucelabs - 2",regex:"(?:saucelabs).{0,40}\\b([a-z0-9]{8}\\-[a-z0-9]{4}\\-[a-z0-9]{4}\\-[a-z0-9]{4}\\-[a-z0-9]{12})\\b"},{name:"Scalewaykey",regex:"(?:scaleway).{0,40}\\b([0-9a-z]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[0-9a-z]{4}-[0-9a-z]{12})\\b"},{name:"Scrapeowl",regex:"(?:scrapeowl).{0,40}\\b([0-9a-z]{30})\\b"},{name:"Scraperapi",regex:"(?:scraperapi).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Scraperbox",regex:"(?:scraperbox).{0,40}\\b([A-Z0-9]{32})\\b"},{name:"Scrapersite",regex:"(?:scrapersite).{0,40}\\b([a-zA-Z0-9]{45})\\b"},{name:"Scrapestack",regex:"(?:scrapestack).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Scrapfly",regex:"(?:scrapfly).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Scrapingant",regex:"(?:scrapingant).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Scrapingbee",regex:"(?:scrapingbee).{0,40}\\b([A-Z0-9]{80})\\b"},{name:"Screenshotapi",regex:"(?:screenshotapi).{0,40}\\b([0-9A-Z]{7}\\-[0-9A-Z]{7}\\-[0-9A-Z]{7}\\-[0-9A-Z]{7})\\b"},{name:"Screenshotlayer",regex:"(?:screenshotlayer).{0,40}\\b([a-zA-Z0-9_]{32})\\b"},{name:"Securitytrails",regex:"(?:securitytrails).{0,40}\\b([a-zA-Z0-9]{32})\\b"},{name:"Segmentapikey",regex:"(?:segment).{0,40}\\b([A-Za-z0-9_\\-a-zA-Z]{43}\\.[A-Za-z0-9_\\-a-zA-Z]{43})\\b"},{name:"Selectpdf",regex:"(?:selectpdf).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Semaphore",regex:"(?:semaphore).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Sendbird - 1",regex:"(?:sendbird).{0,40}\\b([0-9a-f]{40})\\b"},{name:"Sendbird - 2",regex:"(?:sendbird).{0,40}\\b([0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12})\\b"},{name:"Sendbirdorganizationapi",regex:"(?:sendbird).{0,40}\\b([0-9a-f]{24})\\b"},{name:"Sendgrid",regex:"(SG\\.[\\w\\-_]{20,24}\\.[\\w\\-_]{39,50})\\b"},{name:"Sendinbluev2",regex:"\\b(xkeysib\\-[A-Za-z0-9_-]{81})\\b"},{name:"Sentiment - 1",regex:"(?:sentiment).{0,40}\\b([0-9]{17})\\b"},{name:"Sentiment - 2",regex:"(?:sentiment).{0,40}\\b([a-zA-Z0-9]{20})\\b"},{name:"Sentrytoken",regex:"(?:sentry).{0,40}\\b([a-f0-9]{64})\\b"},{name:"Serphouse",regex:"(?:serphouse).{0,40}\\b([0-9A-Za-z]{60})\\b"},{name:"Serpstack",regex:"(?:serpstack).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Sheety - 1",regex:"(?:sheety).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Sheety - 2",regex:"(?:sheety).{0,40}\\b([0-9a-z]{64})\\b"},{name:"Sherpadesk",regex:"(?:sherpadesk).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Shipday",regex:"(?:shipday).{0,40}\\b([a-zA-Z0-9.]{11}[a-zA-Z0-9]{20})\\b"},{name:"Shodankey",regex:"(?:shodan).{0,40}\\b([a-zA-Z0-9]{32})\\b"},{name:"Shopify custom app access token",regex:"shpca_[a-fA-F0-9]{32}"},{name:"Shopify private app access token",regex:"shppa_[a-fA-F0-9]{32}"},{name:"Shopify shared secret",regex:"shpss_[a-fA-F0-9]{32}"},{name:"Shoppable Service Auth",regex:"data-shoppable-auth-token.+"},{name:"Shortcut",regex:"(?:shortcut).{0,40}\\b([0-9a-f-]{36})\\b"},{name:"Shotstack",regex:"(?:shotstack).{0,40}\\b([a-zA-Z0-9]{40})\\b"},{name:"Shutterstock - 1",regex:"(?:shutterstock).{0,40}\\b([0-9a-zA-Z]{32})\\b"},{name:"Shutterstock - 2",regex:"(?:shutterstock).{0,40}\\b([0-9a-zA-Z]{16})\\b"},{name:"Shutterstockoauth",regex:"(?:shutterstock).{0,40}\\b(v2/[0-9A-Za-z]{388})\\b"},{name:"Signalwire - 1",regex:"\\b([0-9a-z-]{3,64}.signalwire.com)\\b"},{name:"Signalwire - 2",regex:"(?:signalwire).{0,40}\\b([0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12})\\b"},{name:"Signalwire - 3",regex:"(?:signalwire).{0,40}\\b([0-9A-Za-z]{50})\\b"},{name:"Signaturit",regex:"(?:signaturit).{0,40}\\b([0-9A-Za-z]{86})\\b"},{name:"Signupgenius",regex:"(?:signupgenius).{0,40}\\b([0-9A-Za-z]{32})\\b"},{name:"Sigopt",regex:"(?:sigopt).{0,40}\\b([A-Z0-9]{48})\\b"},{name:"Simplesat",regex:"(?:simplesat).{0,40}\\b([a-z0-9]{40})"},{name:"Simplynoted",regex:"(?:simplynoted).{0,40}\\b([a-zA-Z0-9\\S]{340,360})\\b"},{name:"Simvoly",regex:"(?:simvoly).{0,40}\\b([a-z0-9]{33})\\b"},{name:"Sinchmessage",regex:"(?:sinch).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Sirv - 1",regex:"(?:sirv).{0,40}\\b([a-zA-Z0-9\\S]{88})"},{name:"Sirv - 2",regex:"(?:sirv).{0,40}\\b([a-zA-Z0-9]{26})\\b"},{name:"Siteleaf",regex:"(?:siteleaf).{0,40}\\b([0-9Aa-z]{32})\\b"},{name:"Skrappio",regex:"(?:skrapp).{0,40}\\b([a-z0-9A-Z]{42})\\b"},{name:"Skybiometry",regex:"(?:skybiometry).{0,40}\\b([0-9a-z]{25,26})\\b"},{name:"Slack",regex:"xox[baprs]-[0-9a-zA-Z-]{10,72}"},{name:"Slack Token",regex:"(xox[pborsa]-[0-9]{12}-[0-9]{12}-[0-9]{12}-[a-z0-9]{32})"},{name:"Slack User token",regex:"xoxp-[0-9A-Za-z\\-]{72}"},{name:"Slack Webhook",regex:"https://hooks.slack.com/services/T[a-zA-Z0-9_]{8,10}/B[a-zA-Z0-9_]{8,12}/[a-zA-Z0-9_]{23,24}"},{name:"Slack access token",regex:"xoxb-[0-9A-Za-z\\-]{51}"},{name:"Slackwebhook",regex:"(https:\\/\\/hooks.slack.com\\/services\\/[A-Za-z0-9+\\/]{44,46})"},{name:"Smartsheets",regex:"(?:smartsheets).{0,40}\\b([a-zA-Z0-9]{37})\\b"},{name:"Smartystreets - 1",regex:"(?:smartystreets).{0,40}\\b([a-zA-Z0-9]{20})\\b"},{name:"Smartystreets - 2",regex:"(?:smartystreets).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Smooch - 1",regex:"(?:smooch).{0,40}\\b(act_[0-9a-z]{24})\\b"},{name:"Smooch - 2",regex:"(?:smooch).{0,40}\\b([0-9a-zA-Z_-]{86})\\b"},{name:"Snipcart",regex:"(?:snipcart).{0,40}\\b([0-9A-Za-z_]{75})\\b"},{name:"Snykkey",regex:"(?:snyk).{0,40}\\b([0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12})\\b"},{name:"SonarQube Token",regex:"sonar.{0,50}(?:\"|'|`)?[0-9a-f]{40}(?:\"|'|`)?"},{name:"Splunkobservabilitytoken",regex:"(?:splunk).{0,40}\\b([a-z0-9A-Z]{22})\\b"},{name:"Spoonacular",regex:"(?:spoonacular).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Sportsmonk",regex:"(?:sportsmonk).{0,40}\\b([0-9a-zA-Z]{60})\\b"},{name:"Square",regex:"(?:square).{0,40}(EAAA[a-zA-Z0-9\\-\\+\\=]{60})"},{name:"Square API Key",regex:"sq0(atp|csp)-[0-9a-z-_]{22,43}"},{name:"Squareapp - 1",regex:"[\\w\\-]*sq0i[a-z]{2}-[0-9A-Za-z\\-_]{22,43}"},{name:"Squareapp - 2",regex:"[\\w\\-]*sq0c[a-z]{2}-[0-9A-Za-z\\-_]{40,50}"},{name:"Squarespace",regex:"(?:squarespace).{0,40}\\b([0-9Aa-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\\b"},{name:"Squareup",regex:"\\b(sq0idp-[0-9A-Za-z]{22})\\b"},{name:"Sslmate",regex:"(?:sslmate).{0,40}\\b([a-zA-Z0-9]{36})\\b"},{name:"Stitchdata",regex:"(?:stitchdata).{0,40}\\b([0-9a-z_]{35})\\b"},{name:"Stockdata",regex:"(?:stockdata).{0,40}\\b([0-9A-Za-z]{40})\\b"},{name:"Storecove",regex:"(?:storecove).{0,40}\\b([a-zA-Z0-9_-]{43})\\b"},{name:"Stormglass",regex:"(?:stormglass).{0,40}\\b([0-9Aa-z-]{73})\\b"},{name:"Storyblok",regex:"(?:storyblok).{0,40}\\b([0-9A-Za-z]{22}t{2})\\b"},{name:"Storychief",regex:"(?:storychief).{0,40}\\b([a-zA-Z0-9_\\-.]{940,1000})"},{name:"Strava - 1",regex:"(?:strava).{0,40}\\b([0-9]{5})\\b"},{name:"Strava - 2",regex:"(?:strava).{0,40}\\b([0-9a-z]{40})\\b"},{name:"Streak",regex:"(?:streak).{0,40}\\b([0-9Aa-f]{32})\\b"},{name:"Stripe",regex:"[rs]k_live_[a-zA-Z0-9]{20,30}"},{name:"Stripe API Key - 1",regex:"sk_live_[0-9a-zA-Z]{24}"},{name:"Stripe API key - 2",regex:"stripe[sr]k_live_[0-9a-zA-Z]{24}"},{name:"Stripe API key - 3",regex:"stripe[sk|rk]_live_[0-9a-zA-Z]{24}"},{name:"Stripe Public Live Key",regex:"pk_live_[0-9a-z]{24}"},{name:"Stripe Public Test Key",regex:"pk_test_[0-9a-z]{24}"},{name:"Stripe Restriced Key",regex:"rk_(?:live|test)_[0-9a-zA-Z]{24}"},{name:"Stripe Restricted API Key",regex:"rk_live_[0-9a-zA-Z]{24}"},{name:"Stripe Secret Key",regex:"sk_(?:live|test)_[0-9a-zA-Z]{24}"},{name:"Stripe Secret Live Key",regex:"(sk|rk)_live_[0-9a-z]{24}"},{name:"Stripe Secret Test Key",regex:"(sk|rk)_test_[0-9a-z]{24}"},{name:"Stytch - 1",regex:"(?:stytch).{0,40}\\b([a-zA-Z0-9-_]{47}=)"},{name:"Stytch - 2",regex:"(?:stytch).{0,40}\\b([a-z0-9-]{49})\\b"},{name:"Sugester - 1",regex:"(?:sugester).{0,40}\\b([a-zA-Z0-9_.!+$#^*%]{3,32})\\b"},{name:"Sugester - 2",regex:"(?:sugester).{0,40}\\b([a-zA-Z0-9]{32})\\b"},{name:"Sumologickey - 1",regex:"(?:sumo).{0,40}\\b([A-Za-z0-9]{14})\\b"},{name:"Sumologickey - 2",regex:"(?:sumo).{0,40}\\b([A-Za-z0-9]{64})\\b"},{name:"Supernotesapi",regex:"(?:supernotes).{0,40}([ \\r\\n]{0,1}[0-9A-Za-z\\-_]{43}[ \\r\\n]{1})"},{name:"Surveyanyplace - 1",regex:"(?:survey).{0,40}\\b([a-z0-9A-Z-]{36})\\b"},{name:"Surveyanyplace - 2",regex:"(?:survey).{0,40}\\b([a-z0-9A-Z]{32})\\b"},{name:"Surveybot",regex:"(?:surveybot).{0,40}\\b([A-Za-z0-9-]{80})\\b"},{name:"Surveysparrow",regex:"(?:surveysparrow).{0,40}\\b([a-zA-Z0-9-_]{88})\\b"},{name:"Survicate",regex:"(?:survicate).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Swell - 1",regex:"(?:swell).{0,40}\\b([a-zA-Z0-9]{6,24})\\b"},{name:"Swell - 2",regex:"(?:swell).{0,40}\\b([a-zA-Z0-9]{32})\\b"},{name:"Swiftype",regex:"(?:swiftype).{0,40}\\b([a-zA-z-0-9]{6}\\_[a-zA-z-0-9]{6}\\-[a-zA-z-0-9]{6})\\b"},{name:"Tallyfy",regex:"(?:tallyfy).{0,40}\\b([0-9A-Za-z]{36}\\.[0-9A-Za-z]{264}\\.[0-9A-Za-z\\-\\_]{683})\\b"},{name:"Tatumio",regex:"(?:tatum).{0,40}\\b([0-9a-z-]{36})\\b"},{name:"Taxjar",regex:"(?:taxjar).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Teamgate - 1",regex:"(?:teamgate).{0,40}\\b([a-z0-9]{40})\\b"},{name:"Teamgate - 2",regex:"(?:teamgate).{0,40}\\b([a-zA-Z0-9]{80})\\b"},{name:"Teamworkcrm",regex:"(?:teamwork|teamworkcrm).{0,40}\\b(tkn\\.v1_[0-9A-Za-z]{71}=[ \\r\\n]{1})"},{name:"Teamworkdesk",regex:"(?:teamwork|teamworkdesk).{0,40}\\b(tkn\\.v1_[0-9A-Za-z]{71}=[ \\r\\n]{1})"},{name:"Teamworkspaces",regex:"(?:teamwork|teamworkspaces).{0,40}\\b(tkn\\.v1_[0-9A-Za-z]{71}=[ \\r\\n]{1})"},{name:"Technicalanalysisapi",regex:"(?:technicalanalysisapi).{0,40}\\b([A-Z0-9]{48})\\b"},{name:"Telegram Bot API Key",regex:"[0-9]+:AA[0-9A-Za-z\\-_]{33}"},{name:"Telegram Secret",regex:"d{5,}:A[0-9a-z_-]{34,34}"},{name:"Telegrambottoken",regex:"(?:telegram).{0,40}\\b([0-9]{8,10}:[a-zA-Z0-9_-]{35})\\b"},{name:"Telnyx",regex:"(?:telnyx).{0,40}\\b(KEY[0-9A-Za-z_-]{55})\\b"},{name:"Terraformcloudpersonaltoken",regex:"\\b([A-Za-z0-9]{14}.atlasv1.[A-Za-z0-9]{67})\\b"},{name:"Text2data",regex:"(?:text2data).{0,40}\\b([0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12})\\b"},{name:"Textmagic - 1",regex:"(?:textmagic).{0,40}\\b([0-9A-Za-z]{30})\\b"},{name:"Textmagic - 2",regex:"(?:textmagic).{0,40}\\b([0-9A-Za-z]{1,25})\\b"},{name:"Theoddsapi",regex:"(?:theoddsapi|the-odds-api).{0,40}\\b([0-9a-f]{32})\\b"},{name:"Thinkific - 1",regex:"(?:thinkific).{0,40}\\b([0-9a-f]{32})\\b"},{name:"Thinkific - 2",regex:"(?:thinkific).{0,40}\\b([0-9A-Za-z]{4,40})\\b"},{name:"Thousandeyes - 1",regex:"(?:thousandeyes).{0,40}\\b([a-zA-Z0-9]{32})\\b"},{name:"Thousandeyes - 2",regex:"(?:thousandeyes).{0,40}\\b([a-zA-Z0-9]{3,20}@[a-zA-Z0-9]{2,12}.[a-zA-Z0-9]{2,5})\\b"},{name:"Ticketmaster",regex:"(?:ticketmaster).{0,40}\\b([a-zA-Z0-9]{32})\\b"},{name:"Tiingo",regex:"(?:tiingo).{0,40}\\b([0-9a-z]{40})\\b"},{name:"Timezoneapi",regex:"(?:timezoneapi).{0,40}\\b([a-zA-Z0-9]{20})\\b"},{name:"Tly",regex:"(?:tly).{0,40}\\b([0-9A-Za-z]{60})\\b"},{name:"Tmetric",regex:"(?:tmetric).{0,40}\\b([0-9A-Z]{64})\\b"},{name:"Todoist",regex:"(?:todoist).{0,40}\\b([0-9a-z]{40})\\b"},{name:"Toggltrack",regex:"(?:toggl).{0,40}\\b([0-9Aa-z]{32})\\b"},{name:"Tomorrowio",regex:"(?:tomorrow).{0,40}\\b([a-zA-Z0-9]{32})\\b"},{name:"Tomtom",regex:"(?:tomtom).{0,40}\\b([0-9Aa-zA-Z]{32})\\b"},{name:"Tradier",regex:"(?:tradier).{0,40}\\b([a-zA-Z0-9]{28})\\b"},{name:"Travelpayouts",regex:"(?:travelpayouts).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Travisci",regex:"(?:travis).{0,40}\\b([a-zA-Z0-9A-Z_]{22})\\b"},{name:"Trello URL",regex:"https://trello.com/b/[0-9a-z]/[0-9a-z_-]+"},{name:"Trelloapikey - 2",regex:"(?:trello).{0,40}\\b([a-zA-Z-0-9]{32})\\b"},{name:"Twelvedata",regex:"(?:twelvedata).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Twilio - 1",regex:"\\bAC[0-9a-f]{32}\\b"},{name:"Twilio API Key",regex:"SK[0-9a-fA-F]{32}"},{name:"Twitter Access Token",regex:"[tT][wW][iI][tT][tT][eE][rR].*[1-9][0-9]+-[0-9a-zA-Z]{40}"},{name:"Twitter Client ID",regex:"twitter[0-9a-z]{18,25}"},{name:"Twitter OAuth",regex:`[tT][wW][iI][tT][tT][eE][rR].*['|"][0-9a-zA-Z]{35,44}['|"]`},{name:"Twitter Secret Key",regex:"twitter[0-9a-z]{35,44}"},{name:"Tyntec",regex:"(?:tyntec).{0,40}\\b([a-zA-Z0-9]{32})\\b"},{name:"Typeform",regex:"(?:typeform).{0,40}\\b([0-9A-Za-z]{44})\\b"},{name:"Ubidots",regex:"\\b(BBFF-[0-9a-zA-Z]{30})\\b"},{name:"Unifyid",regex:"(?:unify).{0,40}\\b([0-9A-Za-z_=-]{44})"},{name:"Unplugg",regex:"(?:unplu).{0,40}\\b([a-z0-9]{64})\\b"},{name:"Unsplash",regex:"(?:unsplash).{0,40}\\b([0-9A-Za-z_]{43})\\b"},{name:"Upcdatabase",regex:"(?:upcdatabase).{0,40}\\b([A-Z0-9]{32})\\b"},{name:"Uplead",regex:"(?:uplead).{0,40}\\b([a-z0-9-]{32})\\b"},{name:"Uploadcare",regex:"(?:uploadcare).{0,40}\\b([a-z0-9]{20})\\b"},{name:"Upwave",regex:"(?:upwave).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Uri",regex:"\\b[a-zA-Z]{1,10}:?\\/\\/[-.%\\w{}]{1,50}:([-.%\\S]{3,50})@[-.%\\w\\/:]+\\b"},{name:"Urlscan",regex:"(?:urlscan).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Userstack",regex:"(?:userstack).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Vatlayer",regex:"(?:vatlayer).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Vercel",regex:"(?:vercel).{0,40}\\b([a-zA-Z0-9]{24})\\b"},{name:"Verifier - 1",regex:"(?:verifier).{0,40}\\b([a-zA-Z-0-9-]{5,16}\\@[a-zA-Z-0-9]{4,16}\\.[a-zA-Z-0-9]{3,6})\\b"},{name:"Verifier - 2",regex:"(?:verifier).{0,40}\\b([a-z0-9]{96})\\b"},{name:"Verimail",regex:"(?:verimail).{0,40}\\b([A-Z0-9]{32})\\b"},{name:"Veriphone",regex:"(?:veriphone).{0,40}\\b([0-9A-Z]{32})\\b"},{name:"Versioneye",regex:"(?:versioneye).{0,40}\\b([a-zA-Z0-9-]{40})\\b"},{name:"Viewneo",regex:"(?:viewneo).{0,40}\\b([a-z0-9A-Z]{120,300}.[a-z0-9A-Z]{150,300}.[a-z0-9A-Z-_]{600,800})"},{name:"Virustotal",regex:"(?:virustotal).{0,40}\\b([a-f0-9]{64})\\b"},{name:"Visualcrossing",regex:"(?:visualcrossing).{0,40}\\b([0-9A-Z]{25})\\b"},{name:"Voicegain",regex:"(?:voicegain).{0,40}\\b(ey[0-9a-zA-Z_-]{34}.ey[0-9a-zA-Z_-]{108}.[0-9a-zA-Z_-]{43})\\b"},{name:"Vouchery - 1",regex:"(?:vouchery).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Vouchery - 2",regex:"(?:vouchery).{0,40}\\b([a-zA-Z0-9-\\S]{2,20})\\b"},{name:"Vpnapi",regex:"(?:vpnapi).{0,40}\\b([a-z0-9A-Z]{32})\\b"},{name:"Vultrapikey",regex:"(?:vultr).{0,40} \\b([A-Z0-9]{36})\\b"},{name:"Vyte",regex:"(?:vyte).{0,40}\\b([0-9a-z]{50})\\b"},{name:"Walkscore",regex:"(?:walkscore).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Weatherbit",regex:"(?:weatherbit).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Weatherstack",regex:"(?:weatherstack).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Webex - 1",regex:"(?:error).{0,40}(redirect_uri_mismatch)"},{name:"Webex - 2",regex:"(?:webex).{0,40}\\b([A-Za-z0-9_-]{65})\\b"},{name:"Webex - 3",regex:"(?:webex).{0,40}\\b([A-Za-z0-9_-]{64})\\b"},{name:"Webflow",regex:"(?:webflow).{0,40}\\b([a-zA0-9]{64})\\b"},{name:"Webscraper",regex:"(?:webscraper).{0,40}\\b([a-zA-Z0-9]{60})\\b"},{name:"Webscraping",regex:"(?:webscraping).{0,40}\\b([0-9A-Za-z]{32})\\b"},{name:"Wepay - 2",regex:"(?:wepay).{0,40}\\b([a-zA-Z0-9_?]{62})\\b"},{name:"Whoxy",regex:"(?:whoxy).{0,40}\\b([0-9a-z]{33})\\b"},{name:"Worksnaps",regex:"(?:worksnaps).{0,40}\\b([0-9A-Za-z]{40})\\b"},{name:"Workstack",regex:"(?:workstack).{0,40}\\b([0-9Aa-zA-Z]{60})\\b"},{name:"Worldcoinindex",regex:"(?:worldcoinindex).{0,40}\\b([a-zA-Z0-9]{35})\\b"},{name:"Worldweather",regex:"(?:worldweather).{0,40}\\b([0-9a-z]{31})\\b"},{name:"Wrike",regex:"(?:wrike).{0,40}\\b(ey[a-zA-Z0-9-._]{333})\\b"},{name:"Yandex",regex:"(?:yandex).{0,40}\\b([a-z0-9A-Z.]{83})\\b"},{name:"Youneedabudget",regex:"(?:youneedabudget).{0,40}\\b([0-9a-f]{64})\\b"},{name:"Yousign",regex:"(?:yousign).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Youtubeapikey - 1",regex:"(?:youtube).{0,40}\\b([a-zA-Z-0-9_]{39})\\b"},{name:"Zapier Webhook",regex:"https://(?:www.)?hooks\\.zapier\\.com/hooks/catch/[A-Za-z0-9]+/[A-Za-z0-9]+/"},{name:"Zapierwebhook",regex:"(https:\\/\\/hooks.zapier.com\\/hooks\\/catch\\/[A-Za-z0-9\\/]{16})"},{name:"Zendeskapi - 3",regex:"(?:zendesk).{0,40}([A-Za-z0-9_-]{40})"},{name:"Zenkitapi",regex:"(?:zenkit).{0,40}\\b([0-9a-z]{8}\\-[0-9A-Za-z]{32})\\b"},{name:"Zenscrape",regex:"(?:zenscrape).{0,40}\\b([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\\b"},{name:"Zenserp",regex:"(?:zenserp).{0,40}\\b([0-9a-z-]{36})\\b"},{name:"Zeplin",regex:"(?:zeplin).{0,40}\\b([a-zA-Z0-9-.]{350,400})\\b"},{name:"Zerobounce",regex:"(?:zerobounce).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Zipapi - 1",regex:"(?:zipapi).{0,40}\\b([a-zA-Z0-9!=@#$%^]{7,})"},{name:"Zipapi - 3",regex:"(?:zipapi).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Zipcodeapi",regex:"(?:zipcodeapi).{0,40}\\b([a-zA-Z0-9]{64})\\b"},{name:"Zoho Webhook",regex:"https://creator\\.zoho\\.com/api/[A-Za-z0-9/\\-_\\.]+\\?authtoken=[A-Za-z0-9]+"},{name:"Zonkafeedback",regex:"(?:zonka).{0,40}\\b([A-Za-z0-9]{36})\\b"},{name:"access_key_secret",regex:"access[_-]?key[_-]?secret(=| =|:| :)"},{name:"access_secret",regex:"access[_-]?secret(=| =|:| :)"},{name:"access_token",regex:"access[_-]?token(=| =|:| :)"},{name:"account_sid",regex:"account[_-]?sid(=| =|:| :)"},{name:"admin_email",regex:"admin[_-]?email(=| =|:| :)"},{name:"adzerk_api_key",regex:"adzerk[_-]?api[_-]?key(=| =|:| :)"},{name:"algolia_admin_key_1",regex:"algolia[_-]?admin[_-]?key[_-]?1(=| =|:| :)"},{name:"algolia_admin_key_2",regex:"algolia[_-]?admin[_-]?key[_-]?2(=| =|:| :)"},{name:"algolia_admin_key_mcm",regex:"algolia[_-]?admin[_-]?key[_-]?mcm(=| =|:| :)"},{name:"algolia_api_key",regex:"algolia[_-]?api[_-]?key(=| =|:| :)"},{name:"algolia_api_key_mcm",regex:"algolia[_-]?api[_-]?key[_-]?mcm(=| =|:| :)"},{name:"algolia_api_key_search",regex:"algolia[_-]?api[_-]?key[_-]?search(=| =|:| :)"},{name:"algolia_search_api_key",regex:"algolia[_-]?search[_-]?api[_-]?key(=| =|:| :)"},{name:"algolia_search_key",regex:"algolia[_-]?search[_-]?key(=| =|:| :)"},{name:"algolia_search_key_1",regex:"algolia[_-]?search[_-]?key[_-]?1(=| =|:| :)"},{name:"alias_pass",regex:"alias[_-]?pass(=| =|:| :)"},{name:"alicloud_access_key",regex:"alicloud[_-]?access[_-]?key(=| =|:| :)"},{name:"alicloud_secret_key",regex:"alicloud[_-]?secret[_-]?key(=| =|:| :)"},{name:"amazon_bucket_name",regex:"amazon[_-]?bucket[_-]?name(=| =|:| :)"},{name:"amazon_secret_access_key",regex:"amazon[_-]?secret[_-]?access[_-]?key(=| =|:| :)"},{name:"anaconda_token",regex:"anaconda[_-]?token(=| =|:| :)"},{name:"android_docs_deploy_token",regex:"android[_-]?docs[_-]?deploy[_-]?token(=| =|:| :)"},{name:"ansible_vault_password",regex:"ansible[_-]?vault[_-]?password(=| =|:| :)"},{name:"aos_key",regex:"aos[_-]?key(=| =|:| :)"},{name:"aos_sec",regex:"aos[_-]?sec(=| =|:| :)"},{name:"api_key",regex:"api[_-]?key(=| =|:| :)"},{name:"api_key_secret",regex:"api[_-]?key[_-]?secret(=| =|:| :)"},{name:"api_key_sid",regex:"api[_-]?key[_-]?sid(=| =|:| :)"},{name:"api_secret",regex:"api[_-]?secret(=| =|:| :)"},{name:"apiary_api_key",regex:"apiary[_-]?api[_-]?key(=| =|:| :)"},{name:"apigw_access_token",regex:"apigw[_-]?access[_-]?token(=| =|:| :)"},{name:"apikey_patterns",regex:`apikey[:](?:['"]?[a-zA-Z0-9-_|]+['"]?)`},{name:"app_bucket_perm",regex:"app[_-]?bucket[_-]?perm(=| =|:| :)"},{name:"app_report_token_key",regex:"app[_-]?report[_-]?token[_-]?key(=| =|:| :)"},{name:"app_secrete",regex:"app[_-]?secrete(=| =|:| :)"},{name:"app_token",regex:"app[_-]?token(=| =|:| :)"},{name:"appclientsecret",regex:"appclientsecret(=| =|:| :)"},{name:"apple_id_password",regex:"apple[_-]?id[_-]?password(=| =|:| :)"},{name:"argos_token",regex:"argos[_-]?token(=| =|:| :)"},{name:"artifactory",regex:`(artifactory.{0,50}("|')?[a-zA-Z0-9=]{112}("|')?)`},{name:"artifactory_key",regex:"artifactory[_-]?key(=| =|:| :)"},{name:"artifacts_aws_access_key_id",regex:"artifacts[_-]?aws[_-]?access[_-]?key[_-]?id(=| =|:| :)"},{name:"artifacts_aws_secret_access_key",regex:"artifacts[_-]?aws[_-]?secret[_-]?access[_-]?key(=| =|:| :)"},{name:"artifacts_bucket",regex:"artifacts[_-]?bucket(=| =|:| :)"},{name:"artifacts_key",regex:"artifacts[_-]?key(=| =|:| :)"},{name:"artifacts_secret",regex:"artifacts[_-]?secret(=| =|:| :)"},{name:"assistant_iam_apikey",regex:"assistant[_-]?iam[_-]?apikey(=| =|:| :)"},{name:"auth0_api_clientsecret",regex:"auth0[_-]?api[_-]?clientsecret(=| =|:| :)"},{name:"auth0_client_secret",regex:"auth0[_-]?client[_-]?secret(=| =|:| :)"},{name:"auth_token",regex:"auth[_-]?token(=| =|:| :)"},{name:"author_email_addr",regex:"author[_-]?email[_-]?addr(=| =|:| :)"},{name:"author_npm_api_key",regex:"author[_-]?npm[_-]?api[_-]?key(=| =|:| :)"},{name:"aws_access",regex:"aws[_-]?access(=| =|:| :)"},{name:"aws_access_key",regex:"aws[_-]?access[_-]?key(=| =|:| :)"},{name:"aws_access_key_id - 1",regex:"aws[_-]?access[_-]?key[_-]?id(=| =|:| :)"},{name:"aws_config_accesskeyid",regex:"aws[_-]?config[_-]?accesskeyid(=| =|:| :)"},{name:"aws_config_secretaccesskey",regex:"aws[_-]?config[_-]?secretaccesskey(=| =|:| :)"},{name:"aws_key",regex:"aws[_-]?key(=| =|:| :)"},{name:"aws_patterns",regex:"(?:accesskeyid|secretaccesskey|aws_access_key_id|aws_secret_access_key)"},{name:"aws_secret",regex:"aws[_-]?secret(=| =|:| :)"},{name:"aws_secret_access_key",regex:"aws[_-]?secret[_-]?access[_-]?key(=| =|:| :)"},{name:"aws_secret_key",regex:"aws[_-]?secret[_-]?key(=| =|:| :)"},{name:"aws_secrets",regex:"aws[_-]?secrets(=| =|:| :)"},{name:"aws_ses_access_key_id",regex:"aws[_-]?ses[_-]?access[_-]?key[_-]?id(=| =|:| :)"},{name:"aws_ses_secret_access_key",regex:"aws[_-]?ses[_-]?secret[_-]?access[_-]?key(=| =|:| :)"},{name:"awsaccesskeyid",regex:"awsaccesskeyid(=| =|:| :)"},{name:"awscn_access_key_id",regex:"awscn[_-]?access[_-]?key[_-]?id(=| =|:| :)"},{name:"awscn_secret_access_key",regex:"awscn[_-]?secret[_-]?access[_-]?key(=| =|:| :)"},{name:"awssecretkey",regex:"awssecretkey(=| =|:| :)"},{name:"b2_app_key",regex:"b2[_-]?app[_-]?key(=| =|:| :)"},{name:"b2_bucket",regex:"b2[_-]?bucket(=| =|:| :)"},{name:"bintray_api_key",regex:"bintray[_-]?api[_-]?key(=| =|:| :)"},{name:"bintray_apikey",regex:"bintray[_-]?apikey(=| =|:| :)"},{name:"bintray_gpg_password",regex:"bintray[_-]?gpg[_-]?password(=| =|:| :)"},{name:"bintray_key",regex:"bintray[_-]?key(=| =|:| :)"},{name:"bintray_token",regex:"bintray[_-]?token(=| =|:| :)"},{name:"bintraykey",regex:"bintraykey(=| =|:| :)"},{name:"bluemix_api_key",regex:"bluemix[_-]?api[_-]?key(=| =|:| :)"},{name:"bluemix_auth",regex:"bluemix[_-]?auth(=| =|:| :)"},{name:"bluemix_pass",regex:"bluemix[_-]?pass(=| =|:| :)"},{name:"bluemix_pass_prod",regex:"bluemix[_-]?pass[_-]?prod(=| =|:| :)"},{name:"bluemix_password",regex:"bluemix[_-]?password(=| =|:| :)"},{name:"bluemix_pwd",regex:"bluemix[_-]?pwd(=| =|:| :)"},{name:"bluemix_username",regex:"bluemix[_-]?username(=| =|:| :)"},{name:"brackets_repo_oauth_token",regex:"brackets[_-]?repo[_-]?oauth[_-]?token(=| =|:| :)"},{name:"browser_stack_access_key",regex:"browser[_-]?stack[_-]?access[_-]?key(=| =|:| :)"},{name:"browserstack_access_key",regex:"browserstack[_-]?access[_-]?key(=| =|:| :)"},{name:"bucketeer_aws_access_key_id",regex:"bucketeer[_-]?aws[_-]?access[_-]?key[_-]?id(=| =|:| :)"},{name:"bucketeer_aws_secret_access_key",regex:"bucketeer[_-]?aws[_-]?secret[_-]?access[_-]?key(=| =|:| :)"},{name:"built_branch_deploy_key",regex:"built[_-]?branch[_-]?deploy[_-]?key(=| =|:| :)"},{name:"bundlesize_github_token",regex:"bundlesize[_-]?github[_-]?token(=| =|:| :)"},{name:"bx_password",regex:"bx[_-]?password(=| =|:| :)"},{name:"bx_username",regex:"bx[_-]?username(=| =|:| :)"},{name:"cache_s3_secret_key",regex:"cache[_-]?s3[_-]?secret[_-]?key(=| =|:| :)"},{name:"cargo_token",regex:"cargo[_-]?token(=| =|:| :)"},{name:"cattle_access_key",regex:"cattle[_-]?access[_-]?key(=| =|:| :)"},{name:"cattle_agent_instance_auth",regex:"cattle[_-]?agent[_-]?instance[_-]?auth(=| =|:| :)"},{name:"cattle_secret_key",regex:"cattle[_-]?secret[_-]?key(=| =|:| :)"},{name:"censys_secret",regex:"censys[_-]?secret(=| =|:| :)"},{name:"certificate_password",regex:"certificate[_-]?password(=| =|:| :)"},{name:"cf_password",regex:"cf[_-]?password(=| =|:| :)"},{name:"cheverny_token",regex:"cheverny[_-]?token(=| =|:| :)"},{name:"chrome_client_secret",regex:"chrome[_-]?client[_-]?secret(=| =|:| :)"},{name:"chrome_refresh_token",regex:"chrome[_-]?refresh[_-]?token(=| =|:| :)"},{name:"ci_deploy_password",regex:"ci[_-]?deploy[_-]?password(=| =|:| :)"},{name:"ci_project_url",regex:"ci[_-]?project[_-]?url(=| =|:| :)"},{name:"ci_registry_user",regex:"ci[_-]?registry[_-]?user(=| =|:| :)"},{name:"ci_server_name",regex:"ci[_-]?server[_-]?name(=| =|:| :)"},{name:"ci_user_token",regex:"ci[_-]?user[_-]?token(=| =|:| :)"},{name:"claimr_database",regex:"claimr[_-]?database(=| =|:| :)"},{name:"claimr_db",regex:"claimr[_-]?db(=| =|:| :)"},{name:"claimr_superuser",regex:"claimr[_-]?superuser(=| =|:| :)"},{name:"claimr_token",regex:"claimr[_-]?token(=| =|:| :)"},{name:"cli_e2e_cma_token",regex:"cli[_-]?e2e[_-]?cma[_-]?token(=| =|:| :)"},{name:"client_secret",regex:"client[_-]?secret(=| =|:| :)"},{name:"clojars_password",regex:"clojars[_-]?password(=| =|:| :)"},{name:"cloud_api_key",regex:"cloud[_-]?api[_-]?key(=| =|:| :)"},{name:"cloudant_archived_database",regex:"cloudant[_-]?archived[_-]?database(=| =|:| :)"},{name:"cloudant_audited_database",regex:"cloudant[_-]?audited[_-]?database(=| =|:| :)"},{name:"cloudant_database",regex:"cloudant[_-]?database(=| =|:| :)"},{name:"cloudant_instance",regex:"cloudant[_-]?instance(=| =|:| :)"},{name:"cloudant_order_database",regex:"cloudant[_-]?order[_-]?database(=| =|:| :)"},{name:"cloudant_parsed_database",regex:"cloudant[_-]?parsed[_-]?database(=| =|:| :)"},{name:"cloudant_password",regex:"cloudant[_-]?password(=| =|:| :)"},{name:"cloudant_processed_database",regex:"cloudant[_-]?processed[_-]?database(=| =|:| :)"},{name:"cloudant_service_database",regex:"cloudant[_-]?service[_-]?database(=| =|:| :)"},{name:"cloudflare_api_key",regex:"cloudflare[_-]?api[_-]?key(=| =|:| :)"},{name:"cloudflare_auth_email",regex:"cloudflare[_-]?auth[_-]?email(=| =|:| :)"},{name:"cloudflare_auth_key",regex:"cloudflare[_-]?auth[_-]?key(=| =|:| :)"},{name:"cloudflare_email",regex:"cloudflare[_-]?email(=| =|:| :)"},{name:"cloudinary_url",regex:"cloudinary[_-]?url(=| =|:| :)"},{name:"cloudinary_url_staging",regex:"cloudinary[_-]?url[_-]?staging(=| =|:| :)"},{name:"clu_repo_url",regex:"clu[_-]?repo[_-]?url(=| =|:| :)"},{name:"clu_ssh_private_key_base64",regex:"clu[_-]?ssh[_-]?private[_-]?key[_-]?base64(=| =|:| :)"},{name:"cn_access_key_id",regex:"cn[_-]?access[_-]?key[_-]?id(=| =|:| :)"},{name:"cn_secret_access_key",regex:"cn[_-]?secret[_-]?access[_-]?key(=| =|:| :)"},{name:"cocoapods_trunk_email",regex:"cocoapods[_-]?trunk[_-]?email(=| =|:| :)"},{name:"cocoapods_trunk_token",regex:"cocoapods[_-]?trunk[_-]?token(=| =|:| :)"},{name:"codacy_project_token",regex:"codacy[_-]?project[_-]?token(=| =|:| :)"},{name:"codeclimate",regex:`(codeclima.{0,50}("|')?[0-9a-f]{64}("|')?)`},{name:"codeclimate_repo_token",regex:"codeclimate[_-]?repo[_-]?token(=| =|:| :)"},{name:"codecov_token",regex:"codecov[_-]?token(=| =|:| :)"},{name:"coding_token",regex:"coding[_-]?token(=| =|:| :)"},{name:"conekta_apikey",regex:"conekta[_-]?apikey(=| =|:| :)"},{name:"consumer_key",regex:"consumer[_-]?key(=| =|:| :)"},{name:"consumerkey",regex:"consumerkey(=| =|:| :)"},{name:"contentful_access_token",regex:"contentful[_-]?access[_-]?token(=| =|:| :)"},{name:"contentful_cma_test_token",regex:"contentful[_-]?cma[_-]?test[_-]?token(=| =|:| :)"},{name:"contentful_integration_management_token",regex:"contentful[_-]?integration[_-]?management[_-]?token(=| =|:| :)"},{name:"contentful_php_management_test_token",regex:"contentful[_-]?php[_-]?management[_-]?test[_-]?token(=| =|:| :)"},{name:"contentful_test_org_cma_token",regex:"contentful[_-]?test[_-]?org[_-]?cma[_-]?token(=| =|:| :)"},{name:"contentful_v2_access_token",regex:"contentful[_-]?v2[_-]?access[_-]?token(=| =|:| :)"},{name:"conversation_password",regex:"conversation[_-]?password(=| =|:| :)"},{name:"conversation_username",regex:"conversation[_-]?username(=| =|:| :)"},{name:"cos_secrets",regex:"cos[_-]?secrets(=| =|:| :)"},{name:"coveralls_api_token",regex:"coveralls[_-]?api[_-]?token(=| =|:| :)"},{name:"coveralls_repo_token",regex:"coveralls[_-]?repo[_-]?token(=| =|:| :)"},{name:"coveralls_token",regex:"coveralls[_-]?token(=| =|:| :)"},{name:"coverity_scan_token",regex:"coverity[_-]?scan[_-]?token(=| =|:| :)"},{name:"cypress_record_key",regex:"cypress[_-]?record[_-]?key(=| =|:| :)"},{name:"danger_github_api_token",regex:"danger[_-]?github[_-]?api[_-]?token(=| =|:| :)"},{name:"database_host",regex:"database[_-]?host(=| =|:| :)"},{name:"database_name",regex:"database[_-]?name(=| =|:| :)"},{name:"database_password",regex:"database[_-]?password(=| =|:| :)"},{name:"database_port",regex:"database[_-]?port(=| =|:| :)"},{name:"database_user",regex:"database[_-]?user(=| =|:| :)"},{name:"database_username",regex:"database[_-]?username(=| =|:| :)"},{name:"datadog_api_key",regex:"datadog[_-]?api[_-]?key(=| =|:| :)"},{name:"datadog_app_key",regex:"datadog[_-]?app[_-]?key(=| =|:| :)"},{name:"db_connection",regex:"db[_-]?connection(=| =|:| :)"},{name:"db_database",regex:"db[_-]?database(=| =|:| :)"},{name:"db_host",regex:"db[_-]?host(=| =|:| :)"},{name:"db_password",regex:"db[_-]?password(=| =|:| :)"},{name:"db_pw",regex:"db[_-]?pw(=| =|:| :)"},{name:"db_user",regex:"db[_-]?user(=| =|:| :)"},{name:"db_username",regex:"db[_-]?username(=| =|:| :)"},{name:"ddg_test_email",regex:"ddg[_-]?test[_-]?email(=| =|:| :)"},{name:"ddg_test_email_pw",regex:"ddg[_-]?test[_-]?email[_-]?pw(=| =|:| :)"},{name:"ddgc_github_token",regex:"ddgc[_-]?github[_-]?token(=| =|:| :)"},{name:"deploy_password",regex:"deploy[_-]?password(=| =|:| :)"},{name:"deploy_secure",regex:"deploy[_-]?secure(=| =|:| :)"},{name:"deploy_token",regex:"deploy[_-]?token(=| =|:| :)"},{name:"deploy_user",regex:"deploy[_-]?user(=| =|:| :)"},{name:"dgpg_passphrase",regex:"dgpg[_-]?passphrase(=| =|:| :)"},{name:"digitalocean_access_token",regex:"digitalocean[_-]?access[_-]?token(=| =|:| :)"},{name:"digitalocean_ssh_key_body",regex:"digitalocean[_-]?ssh[_-]?key[_-]?body(=| =|:| :)"},{name:"digitalocean_ssh_key_ids",regex:"digitalocean[_-]?ssh[_-]?key[_-]?ids(=| =|:| :)"},{name:"docker_hub_password",regex:"docker[_-]?hub[_-]?password(=| =|:| :)"},{name:"docker_key",regex:"docker[_-]?key(=| =|:| :)"},{name:"docker_pass",regex:"docker[_-]?pass(=| =|:| :)"},{name:"docker_passwd",regex:"docker[_-]?passwd(=| =|:| :)"},{name:"docker_password",regex:"docker[_-]?password(=| =|:| :)"},{name:"docker_postgres_url",regex:"docker[_-]?postgres[_-]?url(=| =|:| :)"},{name:"docker_token",regex:"docker[_-]?token(=| =|:| :)"},{name:"dockerhub_password",regex:"dockerhub[_-]?password(=| =|:| :)"},{name:"dockerhubpassword",regex:"dockerhubpassword(=| =|:| :)"},{name:"doordash_auth_token",regex:"doordash[_-]?auth[_-]?token(=| =|:| :)"},{name:"dropbox_oauth_bearer",regex:"dropbox[_-]?oauth[_-]?bearer(=| =|:| :)"},{name:"droplet_travis_password",regex:"droplet[_-]?travis[_-]?password(=| =|:| :)"},{name:"dsonar_login",regex:"dsonar[_-]?login(=| =|:| :)"},{name:"dsonar_projectkey",regex:"dsonar[_-]?projectkey(=| =|:| :)"},{name:"elastic_cloud_auth",regex:"elastic[_-]?cloud[_-]?auth(=| =|:| :)"},{name:"elasticsearch_password",regex:"elasticsearch[_-]?password(=| =|:| :)"},{name:"encryption_password",regex:"encryption[_-]?password(=| =|:| :)"},{name:"end_user_password",regex:"end[_-]?user[_-]?password(=| =|:| :)"},{name:"env_github_oauth_token",regex:"env[_-]?github[_-]?oauth[_-]?token(=| =|:| :)"},{name:"env_heroku_api_key",regex:"env[_-]?heroku[_-]?api[_-]?key(=| =|:| :)"},{name:"env_key",regex:"env[_-]?key(=| =|:| :)"},{name:"env_secret",regex:"env[_-]?secret(=| =|:| :)"},{name:"env_secret_access_key",regex:"env[_-]?secret[_-]?access[_-]?key(=| =|:| :)"},{name:"env_sonatype_password",regex:"env[_-]?sonatype[_-]?password(=| =|:| :)"},{name:"eureka_awssecretkey",regex:"eureka[_-]?awssecretkey(=| =|:| :)"},{name:"exp_password",regex:"exp[_-]?password(=| =|:| :)"},{name:"facebook_access_token",regex:"(EAACEdEose0cBA[0-9A-Za-z]+)"},{name:"facebook_oauth",regex:`[f|F][a|A][c|C][e|E][b|B][o|O][o|O][k|K].*['|"][0-9a-f]{32}['|"]`},{name:"file_password",regex:"file[_-]?password(=| =|:| :)"},{name:"firebase_api_json",regex:"firebase[_-]?api[_-]?json(=| =|:| :)"},{name:"firebase_api_token",regex:"firebase[_-]?api[_-]?token(=| =|:| :)"},{name:"firebase_key",regex:"firebase[_-]?key(=| =|:| :)"},{name:"firebase_project_develop",regex:"firebase[_-]?project[_-]?develop(=| =|:| :)"},{name:"firebase_token",regex:"firebase[_-]?token(=| =|:| :)"},{name:"firefox_secret",regex:"firefox[_-]?secret(=| =|:| :)"},{name:"flask_secret_key",regex:"flask[_-]?secret[_-]?key(=| =|:| :)"},{name:"flickr_api_key",regex:"flickr[_-]?api[_-]?key(=| =|:| :)"},{name:"flickr_api_secret",regex:"flickr[_-]?api[_-]?secret(=| =|:| :)"},{name:"fossa_api_key",regex:"fossa[_-]?api[_-]?key(=| =|:| :)"},{name:"ftp_host",regex:"ftp[_-]?host(=| =|:| :)"},{name:"ftp_login",regex:"ftp[_-]?login(=| =|:| :)"},{name:"ftp_password",regex:"ftp[_-]?password(=| =|:| :)"},{name:"ftp_pw",regex:"ftp[_-]?pw(=| =|:| :)"},{name:"ftp_user",regex:"ftp[_-]?user(=| =|:| :)"},{name:"ftp_username",regex:"ftp[_-]?username(=| =|:| :)"},{name:"gcloud_bucket",regex:"gcloud[_-]?bucket(=| =|:| :)"},{name:"gcloud_project",regex:"gcloud[_-]?project(=| =|:| :)"},{name:"gcloud_service_key",regex:"gcloud[_-]?service[_-]?key(=| =|:| :)"},{name:"gcr_password",regex:"gcr[_-]?password(=| =|:| :)"},{name:"gcs_bucket",regex:"gcs[_-]?bucket(=| =|:| :)"},{name:"gh_api_key",regex:"gh[_-]?api[_-]?key(=| =|:| :)"},{name:"gh_email",regex:"gh[_-]?email(=| =|:| :)"},{name:"gh_next_oauth_client_secret",regex:"gh[_-]?next[_-]?oauth[_-]?client[_-]?secret(=| =|:| :)"},{name:"gh_next_unstable_oauth_client_id",regex:"gh[_-]?next[_-]?unstable[_-]?oauth[_-]?client[_-]?id(=| =|:| :)"},{name:"gh_next_unstable_oauth_client_secret",regex:"gh[_-]?next[_-]?unstable[_-]?oauth[_-]?client[_-]?secret(=| =|:| :)"},{name:"gh_oauth_client_secret",regex:"gh[_-]?oauth[_-]?client[_-]?secret(=| =|:| :)"},{name:"gh_oauth_token",regex:"gh[_-]?oauth[_-]?token(=| =|:| :)"},{name:"gh_repo_token",regex:"gh[_-]?repo[_-]?token(=| =|:| :)"},{name:"gh_token",regex:"gh[_-]?token(=| =|:| :)"},{name:"gh_unstable_oauth_client_secret",regex:"gh[_-]?unstable[_-]?oauth[_-]?client[_-]?secret(=| =|:| :)"},{name:"ghb_token",regex:"ghb[_-]?token(=| =|:| :)"},{name:"ghost_api_key",regex:"ghost[_-]?api[_-]?key(=| =|:| :)"},{name:"git_author_email",regex:"git[_-]?author[_-]?email(=| =|:| :)"},{name:"git_author_name",regex:"git[_-]?author[_-]?name(=| =|:| :)"},{name:"git_committer_email",regex:"git[_-]?committer[_-]?email(=| =|:| :)"},{name:"git_committer_name",regex:"git[_-]?committer[_-]?name(=| =|:| :)"},{name:"git_email",regex:"git[_-]?email(=| =|:| :)"},{name:"git_name",regex:"git[_-]?name(=| =|:| :)"},{name:"git_token",regex:"git[_-]?token(=| =|:| :)"},{name:"github_access_token - 1",regex:"github[_-]?access[_-]?token(=| =|:| :)"},{name:"github_access_token - 2",regex:"[a-zA-Z0-9_-]*:[a-zA-Z0-9_-]+@github.com*"},{name:"github_api_key",regex:"github[_-]?api[_-]?key(=| =|:| :)"},{name:"github_api_token",regex:"github[_-]?api[_-]?token(=| =|:| :)"},{name:"github_auth",regex:"github[_-]?auth(=| =|:| :)"},{name:"github_auth_token",regex:"github[_-]?auth[_-]?token(=| =|:| :)"},{name:"github_client_secret",regex:"github[_-]?client[_-]?secret(=| =|:| :)"},{name:"github_deploy_hb_doc_pass",regex:"github[_-]?deploy[_-]?hb[_-]?doc[_-]?pass(=| =|:| :)"},{name:"github_deployment_token",regex:"github[_-]?deployment[_-]?token(=| =|:| :)"},{name:"github_hunter_token",regex:"github[_-]?hunter[_-]?token(=| =|:| :)"},{name:"github_hunter_username",regex:"github[_-]?hunter[_-]?username(=| =|:| :)"},{name:"github_key",regex:"github[_-]?key(=| =|:| :)"},{name:"github_oauth",regex:"github[_-]?oauth(=| =|:| :)"},{name:"github_oauth_token",regex:"github[_-]?oauth[_-]?token(=| =|:| :)"},{name:"github_password",regex:"github[_-]?password(=| =|:| :)"},{name:"github_pwd",regex:"github[_-]?pwd(=| =|:| :)"},{name:"github_release_token",regex:"github[_-]?release[_-]?token(=| =|:| :)"},{name:"github_repo",regex:"github[_-]?repo(=| =|:| :)"},{name:"github_token",regex:"github[_-]?token(=| =|:| :)"},{name:"github_tokens",regex:"github[_-]?tokens(=| =|:| :)"},{name:"gitlab_user_email",regex:"gitlab[_-]?user[_-]?email(=| =|:| :)"},{name:"gogs_password",regex:"gogs[_-]?password(=| =|:| :)"},{name:"google_account_type",regex:"google[_-]?account[_-]?type(=| =|:| :)"},{name:"google_client_email",regex:"google[_-]?client[_-]?email(=| =|:| :)"},{name:"google_client_id",regex:"google[_-]?client[_-]?id(=| =|:| :)"},{name:"google_client_secret",regex:"google[_-]?client[_-]?secret(=| =|:| :)"},{name:"google_maps_api_key",regex:"google[_-]?maps[_-]?api[_-]?key(=| =|:| :)"},{name:"google_oauth",regex:"(ya29.[0-9A-Za-z-_]+)"},{name:"google_patterns",regex:"(?:google_client_id|google_client_secret|google_client_token)"},{name:"google_private_key",regex:"google[_-]?private[_-]?key(=| =|:| :)"},{name:"google_url",regex:"([0-9]{12}-[a-z0-9]{32}.apps.googleusercontent.com)"},{name:"gpg_key_name",regex:"gpg[_-]?key[_-]?name(=| =|:| :)"},{name:"gpg_keyname",regex:"gpg[_-]?keyname(=| =|:| :)"},{name:"gpg_ownertrust",regex:"gpg[_-]?ownertrust(=| =|:| :)"},{name:"gpg_passphrase",regex:"gpg[_-]?passphrase(=| =|:| :)"},{name:"gpg_private_key",regex:"gpg[_-]?private[_-]?key(=| =|:| :)"},{name:"gpg_secret_keys",regex:"gpg[_-]?secret[_-]?keys(=| =|:| :)"},{name:"gradle_publish_key",regex:"gradle[_-]?publish[_-]?key(=| =|:| :)"},{name:"gradle_publish_secret",regex:"gradle[_-]?publish[_-]?secret(=| =|:| :)"},{name:"gradle_signing_key_id",regex:"gradle[_-]?signing[_-]?key[_-]?id(=| =|:| :)"},{name:"gradle_signing_password",regex:"gradle[_-]?signing[_-]?password(=| =|:| :)"},{name:"gren_github_token",regex:"gren[_-]?github[_-]?token(=| =|:| :)"},{name:"grgit_user",regex:"grgit[_-]?user(=| =|:| :)"},{name:"hab_auth_token",regex:"hab[_-]?auth[_-]?token(=| =|:| :)"},{name:"hab_key",regex:"hab[_-]?key(=| =|:| :)"},{name:"hb_codesign_gpg_pass",regex:"hb[_-]?codesign[_-]?gpg[_-]?pass(=| =|:| :)"},{name:"hb_codesign_key_pass",regex:"hb[_-]?codesign[_-]?key[_-]?pass(=| =|:| :)"},{name:"heroku_api_key",regex:"heroku[_-]?api[_-]?key(=| =|:| :)"},{name:"heroku_api_key_api_key",regex:"([h|H][e|E][r|R][o|O][k|K][u|U].{0,30}[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12})"},{name:"heroku_email",regex:"heroku[_-]?email(=| =|:| :)"},{name:"heroku_token",regex:"heroku[_-]?token(=| =|:| :)"},{name:"hockeyapp",regex:`hockey.{0,50}("|')?[0-9a-f]{32}("|')?`},{name:"hockeyapp_token",regex:"hockeyapp[_-]?token(=| =|:| :)"},{name:"homebrew_github_api_token",regex:"homebrew[_-]?github[_-]?api[_-]?token(=| =|:| :)"},{name:"hub_dxia2_password",regex:"hub[_-]?dxia2[_-]?password(=| =|:| :)"},{name:"ij_repo_password",regex:"ij[_-]?repo[_-]?password(=| =|:| :)"},{name:"ij_repo_username",regex:"ij[_-]?repo[_-]?username(=| =|:| :)"},{name:"index_name",regex:"index[_-]?name(=| =|:| :)"},{name:"integration_test_api_key",regex:"integration[_-]?test[_-]?api[_-]?key(=| =|:| :)"},{name:"integration_test_appid",regex:"integration[_-]?test[_-]?appid(=| =|:| :)"},{name:"internal_secrets",regex:"internal[_-]?secrets(=| =|:| :)"},{name:"ios_docs_deploy_token",regex:"ios[_-]?docs[_-]?deploy[_-]?token(=| =|:| :)"},{name:"itest_gh_token",regex:"itest[_-]?gh[_-]?token(=| =|:| :)"},{name:"jdbc",regex:"mysql: jdbc:mysql(=| =|:| :)"},{name:"jdbc_databaseurl",regex:"jdbc[_-]?databaseurl(=| =|:| :)"},{name:"jdbc_host",regex:"jdbc[_-]?host(=| =|:| :)"},{name:"jwt_secret",regex:"jwt[_-]?secret(=| =|:| :)"},{name:"kafka_admin_url",regex:"kafka[_-]?admin[_-]?url(=| =|:| :)"},{name:"kafka_instance_name",regex:"kafka[_-]?instance[_-]?name(=| =|:| :)"},{name:"kafka_rest_url",regex:"kafka[_-]?rest[_-]?url(=| =|:| :)"},{name:"keystore_pass",regex:"keystore[_-]?pass(=| =|:| :)"},{name:"kovan_private_key",regex:"kovan[_-]?private[_-]?key(=| =|:| :)"},{name:"kubecfg_s3_path",regex:"kubecfg[_-]?s3[_-]?path(=| =|:| :)"},{name:"kubeconfig",regex:"kubeconfig(=| =|:| :)"},{name:"kxoltsn3vogdop92m",regex:"kxoltsn3vogdop92m(=| =|:| :)"},{name:"leanplum_key",regex:"leanplum[_-]?key(=| =|:| :)"},{name:"lektor_deploy_password",regex:"lektor[_-]?deploy[_-]?password(=| =|:| :)"},{name:"lektor_deploy_username",regex:"lektor[_-]?deploy[_-]?username(=| =|:| :)"},{name:"lighthouse_api_key",regex:"lighthouse[_-]?api[_-]?key(=| =|:| :)"},{name:"linux_signing_key",regex:"linux[_-]?signing[_-]?key(=| =|:| :)"},{name:"ll_publish_url",regex:"ll[_-]?publish[_-]?url(=| =|:| :)"},{name:"ll_shared_key",regex:"ll[_-]?shared[_-]?key(=| =|:| :)"},{name:"looker_test_runner_client_secret",regex:"looker[_-]?test[_-]?runner[_-]?client[_-]?secret(=| =|:| :)"},{name:"lottie_happo_api_key",regex:"lottie[_-]?happo[_-]?api[_-]?key(=| =|:| :)"},{name:"lottie_happo_secret_key",regex:"lottie[_-]?happo[_-]?secret[_-]?key(=| =|:| :)"},{name:"lottie_s3_secret_key",regex:"lottie[_-]?s3[_-]?secret[_-]?key(=| =|:| :)"},{name:"lottie_upload_cert_key_password",regex:"lottie[_-]?upload[_-]?cert[_-]?key[_-]?password(=| =|:| :)"},{name:"lottie_upload_cert_key_store_password",regex:"lottie[_-]?upload[_-]?cert[_-]?key[_-]?store[_-]?password(=| =|:| :)"},{name:"magento_auth_password",regex:"magento[_-]?auth[_-]?password(=| =|:| :)"},{name:"magento_auth_username",regex:"magento[_-]?auth[_-]?username (=| =|:| :)"},{name:"magento_password",regex:"magento[_-]?password(=| =|:| :)"},{name:"mail_password",regex:"mail[_-]?password(=| =|:| :)"},{name:"mailchimp",regex:"(W(?:[a-f0-9]{32}(-us[0-9]{1,2}))a-zA-Z0-9)"},{name:"mailchimp_api_key",regex:"mailchimp[_-]?api[_-]?key(=| =|:| :)"},{name:"mailchimp_key",regex:"mailchimp[_-]?key(=| =|:| :)"},{name:"mailer_password",regex:"mailer[_-]?password(=| =|:| :)"},{name:"mailgun",regex:"(key-[0-9a-f]{32})"},{name:"mailgun_api_key",regex:"mailgun[_-]?api[_-]?key(=| =|:| :)"},{name:"mailgun_apikey",regex:"mailgun[_-]?apikey(=| =|:| :)"},{name:"mailgun_password",regex:"mailgun[_-]?password(=| =|:| :)"},{name:"mailgun_priv_key",regex:"mailgun[_-]?priv[_-]?key(=| =|:| :)"},{name:"mailgun_pub_apikey",regex:"mailgun[_-]?pub[_-]?apikey(=| =|:| :)"},{name:"mailgun_pub_key",regex:"mailgun[_-]?pub[_-]?key(=| =|:| :)"},{name:"mailgun_secret_api_key",regex:"mailgun[_-]?secret[_-]?api[_-]?key(=| =|:| :)"},{name:"manage_key",regex:"manage[_-]?key(=| =|:| :)"},{name:"manage_secret",regex:"manage[_-]?secret(=| =|:| :)"},{name:"management_token",regex:"management[_-]?token(=| =|:| :)"},{name:"managementapiaccesstoken",regex:"managementapiaccesstoken(=| =|:| :)"},{name:"mandrill_api_key",regex:"mandrill[_-]?api[_-]?key(=| =|:| :)"},{name:"manifest_app_token",regex:"manifest[_-]?app[_-]?token(=| =|:| :)"},{name:"manifest_app_url",regex:"manifest[_-]?app[_-]?url(=| =|:| :)"},{name:"mapbox_access_token",regex:"mapbox[_-]?access[_-]?token(=| =|:| :)"},{name:"mapbox_api_token",regex:"mapbox[_-]?api[_-]?token(=| =|:| :)"},{name:"mapbox_aws_access_key_id",regex:"mapbox[_-]?aws[_-]?access[_-]?key[_-]?id(=| =|:| :)"},{name:"mapbox_aws_secret_access_key",regex:"mapbox[_-]?aws[_-]?secret[_-]?access[_-]?key(=| =|:| :)"},{name:"mapboxaccesstoken",regex:"mapboxaccesstoken(=| =|:| :)"},{name:"master_password",regex:"(master_password).+"},{name:"mg_api_key",regex:"mg[_-]?api[_-]?key(=| =|:| :)"},{name:"mg_public_api_key",regex:"mg[_-]?public[_-]?api[_-]?key(=| =|:| :)"},{name:"mh_apikey",regex:"mh[_-]?apikey(=| =|:| :)"},{name:"mh_password",regex:"mh[_-]?password(=| =|:| :)"},{name:"mile_zero_key",regex:"mile[_-]?zero[_-]?key(=| =|:| :)"},{name:"minio_access_key",regex:"minio[_-]?access[_-]?key(=| =|:| :)"},{name:"minio_secret_key",regex:"minio[_-]?secret[_-]?key(=| =|:| :)"},{name:"multi_bob_sid",regex:"multi[_-]?bob[_-]?sid(=| =|:| :)"},{name:"multi_connect_sid",regex:"multi[_-]?connect[_-]?sid(=| =|:| :)"},{name:"multi_disconnect_sid",regex:"multi[_-]?disconnect[_-]?sid(=| =|:| :)"},{name:"multi_workflow_sid",regex:"multi[_-]?workflow[_-]?sid(=| =|:| :)"},{name:"multi_workspace_sid",regex:"multi[_-]?workspace[_-]?sid(=| =|:| :)"},{name:"my_secret_env",regex:"my[_-]?secret[_-]?env(=| =|:| :)"},{name:"mysql_database",regex:"mysql[_-]?database(=| =|:| :)"},{name:"mysql_hostname",regex:"mysql[_-]?hostname(=| =|:| :)"},{name:"mysql_password",regex:"mysql[_-]?password(=| =|:| :)"},{name:"mysql_root_password",regex:"mysql[_-]?root[_-]?password(=| =|:| :)"},{name:"mysql_user",regex:"mysql[_-]?user(=| =|:| :)"},{name:"mysql_username",regex:"mysql[_-]?username(=| =|:| :)"},{name:"mysqlmasteruser",regex:"mysqlmasteruser(=| =|:| :)"},{name:"mysqlsecret",regex:"mysqlsecret(=| =|:| :)"},{name:"nativeevents",regex:"nativeevents(=| =|:| :)"},{name:"netlify_api_key",regex:"netlify[_-]?api[_-]?key(=| =|:| :)"},{name:"new_relic_beta_token",regex:"new[_-]?relic[_-]?beta[_-]?token(=| =|:| :)"},{name:"nexus_password",regex:"nexus[_-]?password(=| =|:| :)"},{name:"nexuspassword",regex:"nexuspassword(=| =|:| :)"},{name:"ngrok_auth_token",regex:"ngrok[_-]?auth[_-]?token(=| =|:| :)"},{name:"ngrok_token",regex:"ngrok[_-]?token(=| =|:| :)"},{name:"node_env",regex:"node[_-]?env(=| =|:| :)"},{name:"node_pre_gyp_accesskeyid",regex:"node[_-]?pre[_-]?gyp[_-]?accesskeyid(=| =|:| :)"},{name:"node_pre_gyp_github_token",regex:"node[_-]?pre[_-]?gyp[_-]?github[_-]?token(=| =|:| :)"},{name:"node_pre_gyp_secretaccesskey",regex:"node[_-]?pre[_-]?gyp[_-]?secretaccesskey(=| =|:| :)"},{name:"non_token",regex:"non[_-]?token(=| =|:| :)"},{name:"now_token",regex:"now[_-]?token(=| =|:| :)"},{name:"npm_api_key",regex:"npm[_-]?api[_-]?key(=| =|:| :)"},{name:"npm_api_token",regex:"npm[_-]?api[_-]?token(=| =|:| :)"},{name:"npm_auth_token",regex:"npm[_-]?auth[_-]?token(=| =|:| :)"},{name:"npm_email",regex:"npm[_-]?email(=| =|:| :)"},{name:"npm_password",regex:"npm[_-]?password(=| =|:| :)"},{name:"npm_secret_key",regex:"npm[_-]?secret[_-]?key(=| =|:| :)"},{name:"npm_token - 1",regex:"npm[_-]?token(=| =|:| :)"},{name:"nuget_api_key - 1",regex:"(oy2[a-z0-9]{43})"},{name:"nuget_api_key - 2",regex:"nuget[_-]?api[_-]?key(=| =|:| :)"},{name:"numbers_service_pass",regex:"numbers[_-]?service[_-]?pass(=| =|:| :)"},{name:"oauth_token",regex:"oauth[_-]?token(=| =|:| :)"},{name:"object_storage_password",regex:"object[_-]?storage[_-]?password(=| =|:| :)"},{name:"object_storage_region_name",regex:"object[_-]?storage[_-]?region[_-]?name(=| =|:| :)"},{name:"object_store_bucket",regex:"object[_-]?store[_-]?bucket(=| =|:| :)"},{name:"object_store_creds",regex:"object[_-]?store[_-]?creds(=| =|:| :)"},{name:"oc_pass",regex:"oc[_-]?pass(=| =|:| :)"},{name:"octest_app_password",regex:"octest[_-]?app[_-]?password(=| =|:| :)"},{name:"octest_app_username",regex:"octest[_-]?app[_-]?username(=| =|:| :)"},{name:"octest_password",regex:"octest[_-]?password(=| =|:| :)"},{name:"ofta_key",regex:"ofta[_-]?key(=| =|:| :)"},{name:"ofta_region",regex:"ofta[_-]?region(=| =|:| :)"},{name:"ofta_secret",regex:"ofta[_-]?secret(=| =|:| :)"},{name:"okta_client_token",regex:"okta[_-]?client[_-]?token(=| =|:| :)"},{name:"okta_oauth2_client_secret",regex:"okta[_-]?oauth2[_-]?client[_-]?secret(=| =|:| :)"},{name:"okta_oauth2_clientsecret",regex:"okta[_-]?oauth2[_-]?clientsecret(=| =|:| :)"},{name:"omise_key",regex:"omise[_-]?key(=| =|:| :)"},{name:"omise_pkey",regex:"omise[_-]?pkey(=| =|:| :)"},{name:"omise_pubkey",regex:"omise[_-]?pubkey(=| =|:| :)"},{name:"omise_skey",regex:"omise[_-]?skey(=| =|:| :)"},{name:"onesignal_api_key",regex:"onesignal[_-]?api[_-]?key(=| =|:| :)"},{name:"onesignal_user_auth_key",regex:"onesignal[_-]?user[_-]?auth[_-]?key(=| =|:| :)"},{name:"open_whisk_key",regex:"open[_-]?whisk[_-]?key(=| =|:| :)"},{name:"openwhisk_key",regex:"openwhisk[_-]?key(=| =|:| :)"},{name:"os_auth_url",regex:"os[_-]?auth[_-]?url(=| =|:| :)"},{name:"os_password",regex:"os[_-]?password(=| =|:| :)"},{name:"ossrh_jira_password",regex:"ossrh[_-]?jira[_-]?password(=| =|:| :)"},{name:"ossrh_pass",regex:"ossrh[_-]?pass(=| =|:| :)"},{name:"ossrh_password",regex:"ossrh[_-]?password(=| =|:| :)"},{name:"ossrh_secret",regex:"ossrh[_-]?secret(=| =|:| :)"},{name:"ossrh_username",regex:"ossrh[_-]?username(=| =|:| :)"},{name:"outlook_team",regex:"(https://outlook.office.com/webhook/[0-9a-f-]{36}@)"},{name:"packagecloud_token",regex:"packagecloud[_-]?token(=| =|:| :)"},{name:"pagerduty_apikey",regex:"pagerduty[_-]?apikey(=| =|:| :)"},{name:"parse_js_key",regex:"parse[_-]?js[_-]?key(=| =|:| :)"},{name:"passwordtravis",regex:"passwordtravis(=| =|:| :)"},{name:"paypal_braintree_access_token",regex:"(access_token$production$[0-9a-z]{16}$[0-9a-f]{32})"},{name:"paypal_client_secret",regex:"paypal[_-]?client[_-]?secret(=| =|:| :)"},{name:"percy_project",regex:"percy[_-]?project(=| =|:| :)"},{name:"percy_token",regex:"percy[_-]?token(=| =|:| :)"},{name:"personal_key",regex:"personal[_-]?key(=| =|:| :)"},{name:"personal_secret",regex:"personal[_-]?secret(=| =|:| :)"},{name:"pg_database",regex:"pg[_-]?database(=| =|:| :)"},{name:"pg_host",regex:"pg[_-]?host(=| =|:| :)"},{name:"places_api_key",regex:"places[_-]?api[_-]?key(=| =|:| :)"},{name:"places_apikey",regex:"places[_-]?apikey(=| =|:| :)"},{name:"plotly_apikey",regex:"plotly[_-]?apikey(=| =|:| :)"},{name:"plugin_password",regex:"plugin[_-]?password(=| =|:| :)"},{name:"postgres_env_postgres_db",regex:"postgres[_-]?env[_-]?postgres[_-]?db(=| =|:| :)"},{name:"postgres_env_postgres_password",regex:"postgres[_-]?env[_-]?postgres[_-]?password(=| =|:| :)"},{name:"postgresql_db",regex:"postgresql[_-]?db(=| =|:| :)"},{name:"postgresql_pass",regex:"postgresql[_-]?pass(=| =|:| :)"},{name:"prebuild_auth",regex:"prebuild[_-]?auth(=| =|:| :)"},{name:"preferred_username",regex:"preferred[_-]?username(=| =|:| :)"},{name:"pring_mail_username",regex:"pring[_-]?mail[_-]?username(=| =|:| :)"},{name:"private_key",regex:"-----(?:(?:BEGIN|END) )(?:(?:EC|PGP|DSA|RSA|OPENSSH).)?PRIVATE.KEY(.BLOCK)?-----"},{name:"private_signing_password",regex:"private[_-]?signing[_-]?password(=| =|:| :)"},{name:"prod_access_key_id",regex:"prod[_-]?access[_-]?key[_-]?id(=| =|:| :)"},{name:"prod_password",regex:"prod[_-]?password(=| =|:| :)"},{name:"prod_secret_key",regex:"prod[_-]?secret[_-]?key(=| =|:| :)"},{name:"project_config",regex:"project[_-]?config(=| =|:| :)"},{name:"publish_access",regex:"publish[_-]?access(=| =|:| :)"},{name:"publish_key",regex:"publish[_-]?key(=| =|:| :)"},{name:"publish_secret",regex:"publish[_-]?secret(=| =|:| :)"},{name:"pushover_token",regex:"pushover[_-]?token(=| =|:| :)"},{name:"pypi_passowrd",regex:"pypi[_-]?passowrd(=| =|:| :)"},{name:"qiita_token",regex:"qiita[_-]?token(=| =|:| :)"},{name:"quip_token",regex:"quip[_-]?token(=| =|:| :)"},{name:"rabbitmq_password",regex:"rabbitmq[_-]?password(=| =|:| :)"},{name:"randrmusicapiaccesstoken",regex:"randrmusicapiaccesstoken(=| =|:| :)"},{name:"redis_stunnel_urls",regex:"redis[_-]?stunnel[_-]?urls(=| =|:| :)"},{name:"rediscloud_url",regex:"rediscloud[_-]?url(=| =|:| :)"},{name:"refresh_token",regex:"refresh[_-]?token(=| =|:| :)"},{name:"registry_pass",regex:"registry[_-]?pass(=| =|:| :)"},{name:"registry_secure",regex:"registry[_-]?secure(=| =|:| :)"},{name:"release_gh_token",regex:"release[_-]?gh[_-]?token(=| =|:| :)"},{name:"release_token",regex:"release[_-]?token(=| =|:| :)"},{name:"reporting_webdav_pwd",regex:"reporting[_-]?webdav[_-]?pwd(=| =|:| :)"},{name:"reporting_webdav_url",regex:"reporting[_-]?webdav[_-]?url(=| =|:| :)"},{name:"repotoken",regex:"repotoken(=| =|:| :)"},{name:"rest_api_key",regex:"rest[_-]?api[_-]?key(=| =|:| :)"},{name:"rinkeby_private_key",regex:"rinkeby[_-]?private[_-]?key(=| =|:| :)"},{name:"ropsten_private_key",regex:"ropsten[_-]?private[_-]?key(=| =|:| :)"},{name:"route53_access_key_id",regex:"route53[_-]?access[_-]?key[_-]?id(=| =|:| :)"},{name:"rtd_key_pass",regex:"rtd[_-]?key[_-]?pass(=| =|:| :)"},{name:"rtd_store_pass",regex:"rtd[_-]?store[_-]?pass(=| =|:| :)"},{name:"rubygems_auth_token",regex:"rubygems[_-]?auth[_-]?token(=| =|:| :)"},{name:"s3_access_key",regex:"s3[_-]?access[_-]?key(=| =|:| :)"},{name:"s3_access_key_id",regex:"s3[_-]?access[_-]?key[_-]?id(=| =|:| :)"},{name:"s3_bucket_name_app_logs",regex:"s3[_-]?bucket[_-]?name[_-]?app[_-]?logs(=| =|:| :)"},{name:"s3_bucket_name_assets",regex:"s3[_-]?bucket[_-]?name[_-]?assets(=| =|:| :)"},{name:"s3_external_3_amazonaws_com",regex:"s3[_-]?external[_-]?3[_-]?amazonaws[_-]?com(=| =|:| :)"},{name:"s3_key",regex:"s3[_-]?key(=| =|:| :)"},{name:"s3_key_app_logs",regex:"s3[_-]?key[_-]?app[_-]?logs(=| =|:| :)"},{name:"s3_key_assets",regex:"s3[_-]?key[_-]?assets(=| =|:| :)"},{name:"s3_secret_app_logs",regex:"s3[_-]?secret[_-]?app[_-]?logs(=| =|:| :)"},{name:"s3_secret_assets",regex:"s3[_-]?secret[_-]?assets(=| =|:| :)"},{name:"s3_secret_key",regex:"s3[_-]?secret[_-]?key(=| =|:| :)"},{name:"s3_user_secret",regex:"s3[_-]?user[_-]?secret(=| =|:| :)"},{name:"sacloud_access_token",regex:"sacloud[_-]?access[_-]?token(=| =|:| :)"},{name:"sacloud_access_token_secret",regex:"sacloud[_-]?access[_-]?token[_-]?secret(=| =|:| :)"},{name:"sacloud_api",regex:"sacloud[_-]?api(=| =|:| :)"},{name:"salesforce_bulk_test_password",regex:"salesforce[_-]?bulk[_-]?test[_-]?password(=| =|:| :)"},{name:"salesforce_bulk_test_security_token",regex:"salesforce[_-]?bulk[_-]?test[_-]?security[_-]?token(=| =|:| :)"},{name:"sandbox_access_token",regex:"sandbox[_-]?access[_-]?token(=| =|:| :)"},{name:"sandbox_aws_access_key_id",regex:"sandbox[_-]?aws[_-]?access[_-]?key[_-]?id(=| =|:| :)"},{name:"sandbox_aws_secret_access_key",regex:"sandbox[_-]?aws[_-]?secret[_-]?access[_-]?key(=| =|:| :)"},{name:"sauce_access_key",regex:"sauce[_-]?access[_-]?key(=| =|:| :)"},{name:"sauce_token",regex:`(sauce.{0,50}("|')?[0-9a-f-]{36}("|')?)`},{name:"scrutinizer_token",regex:"scrutinizer[_-]?token(=| =|:| :)"},{name:"sdr_token",regex:"sdr[_-]?token(=| =|:| :)"},{name:"secret_0",regex:"secret[_-]?0(=| =|:| :)"},{name:"secret_1",regex:"secret[_-]?1(=| =|:| :)"},{name:"secret_10",regex:"secret[_-]?10(=| =|:| :)"},{name:"secret_11",regex:"secret[_-]?11(=| =|:| :)"},{name:"secret_2",regex:"secret[_-]?2(=| =|:| :)"},{name:"secret_3",regex:"secret[_-]?3(=| =|:| :)"},{name:"secret_4",regex:"secret[_-]?4(=| =|:| :)"},{name:"secret_5",regex:"secret[_-]?5(=| =|:| :)"},{name:"secret_6",regex:"secret[_-]?6(=| =|:| :)"},{name:"secret_7",regex:"secret[_-]?7(=| =|:| :)"},{name:"secret_8",regex:"secret[_-]?8(=| =|:| :)"},{name:"secret_9",regex:"secret[_-]?9(=| =|:| :)"},{name:"secret_key_base",regex:"secret[_-]?key[_-]?base(=| =|:| :)"},{name:"secretaccesskey",regex:"secretaccesskey(=| =|:| :)"},{name:"secretkey",regex:"secretkey(=| =|:| :)"},{name:"segment_api_key",regex:"segment[_-]?api[_-]?key(=| =|:| :)"},{name:"selion_log_level_dev",regex:"selion[_-]?log[_-]?level[_-]?dev(=| =|:| :)"},{name:"selion_selenium_host",regex:"selion[_-]?selenium[_-]?host(=| =|:| :)"},{name:"sendgrid - 2",regex:"sendgrid(=| =|:| :)"},{name:"sendgrid_api_key - 1",regex:"sendgrid[_-]?api[_-]?key(=| =|:| :)"},{name:"sendgrid_key",regex:"sendgrid[_-]?key(=| =|:| :)"},{name:"sendgrid_password",regex:"sendgrid[_-]?password(=| =|:| :)"},{name:"sendgrid_user",regex:"sendgrid[_-]?user(=| =|:| :)"},{name:"sendgrid_username",regex:"sendgrid[_-]?username(=| =|:| :)"},{name:"sendwithus_key",regex:"sendwithus[_-]?key(=| =|:| :)"},{name:"sentry_auth_token",regex:"sentry[_-]?auth[_-]?token(=| =|:| :)"},{name:"sentry_default_org",regex:"sentry[_-]?default[_-]?org(=| =|:| :)"},{name:"sentry_endpoint",regex:"sentry[_-]?endpoint(=| =|:| :)"},{name:"sentry_key",regex:"sentry[_-]?key(=| =|:| :)"},{name:"service_account_secret",regex:"service[_-]?account[_-]?secret(=| =|:| :)"},{name:"ses_access_key",regex:"ses[_-]?access[_-]?key(=| =|:| :)"},{name:"ses_secret_key",regex:"ses[_-]?secret[_-]?key(=| =|:| :)"},{name:"setdstaccesskey",regex:"setdstaccesskey(=| =|:| :)"},{name:"setdstsecretkey",regex:"setdstsecretkey(=| =|:| :)"},{name:"setsecretkey",regex:"setsecretkey(=| =|:| :)"},{name:"signing_key",regex:"signing[_-]?key(=| =|:| :)"},{name:"signing_key_password",regex:"signing[_-]?key[_-]?password(=| =|:| :)"},{name:"signing_key_secret",regex:"signing[_-]?key[_-]?secret(=| =|:| :)"},{name:"signing_key_sid",regex:"signing[_-]?key[_-]?sid(=| =|:| :)"},{name:"slack_webhook_url",regex:"(hooks.slack.com/services/T[A-Z0-9]{8}/B[A-Z0-9]{8}/[a-zA-Z0-9]{1,})"},{name:"slash_developer_space",regex:"slash[_-]?developer[_-]?space(=| =|:| :)"},{name:"slash_developer_space_key",regex:"slash[_-]?developer[_-]?space[_-]?key(=| =|:| :)"},{name:"slate_user_email",regex:"slate[_-]?user[_-]?email(=| =|:| :)"},{name:"snoowrap_client_secret",regex:"snoowrap[_-]?client[_-]?secret(=| =|:| :)"},{name:"snoowrap_password",regex:"snoowrap[_-]?password(=| =|:| :)"},{name:"snoowrap_refresh_token",regex:"snoowrap[_-]?refresh[_-]?token(=| =|:| :)"},{name:"snyk_api_token",regex:"snyk[_-]?api[_-]?token(=| =|:| :)"},{name:"snyk_token",regex:"snyk[_-]?token(=| =|:| :)"},{name:"socrata_app_token",regex:"socrata[_-]?app[_-]?token(=| =|:| :)"},{name:"socrata_password",regex:"socrata[_-]?password(=| =|:| :)"},{name:"sonar_organization_key",regex:"sonar[_-]?organization[_-]?key(=| =|:| :)"},{name:"sonar_project_key",regex:"sonar[_-]?project[_-]?key(=| =|:| :)"},{name:"sonar_token",regex:"sonar[_-]?token(=| =|:| :)"},{name:"sonarqube_docs_api_key",regex:`(sonar.{0,50}("|')?[0-9a-f]{40}("|')?)`},{name:"sonatype_gpg_key_name",regex:"sonatype[_-]?gpg[_-]?key[_-]?name(=| =|:| :)"},{name:"sonatype_gpg_passphrase",regex:"sonatype[_-]?gpg[_-]?passphrase(=| =|:| :)"},{name:"sonatype_nexus_password",regex:"sonatype[_-]?nexus[_-]?password(=| =|:| :)"},{name:"sonatype_pass",regex:"sonatype[_-]?pass(=| =|:| :)"},{name:"sonatype_password",regex:"sonatype[_-]?password(=| =|:| :)"},{name:"sonatype_token_password",regex:"sonatype[_-]?token[_-]?password(=| =|:| :)"},{name:"sonatype_token_user",regex:"sonatype[_-]?token[_-]?user(=| =|:| :)"},{name:"sonatypepassword",regex:"sonatypepassword(=| =|:| :)"},{name:"soundcloud_client_secret",regex:"soundcloud[_-]?client[_-]?secret(=| =|:| :)"},{name:"soundcloud_password",regex:"soundcloud[_-]?password(=| =|:| :)"},{name:"spaces_access_key_id",regex:"spaces[_-]?access[_-]?key[_-]?id(=| =|:| :)"},{name:"spaces_secret_access_key",regex:"spaces[_-]?secret[_-]?access[_-]?key(=| =|:| :)"},{name:"spotify_api_access_token",regex:"spotify[_-]?api[_-]?access[_-]?token(=| =|:| :)"},{name:"spotify_api_client_secret",regex:"spotify[_-]?api[_-]?client[_-]?secret(=| =|:| :)"},{name:"spring_mail_password",regex:"spring[_-]?mail[_-]?password(=| =|:| :)"},{name:"sqsaccesskey",regex:"sqsaccesskey(=| =|:| :)"},{name:"sqssecretkey",regex:"sqssecretkey(=| =|:| :)"},{name:"square_app_secret",regex:"(sq0[a-z]{3}-[0-9A-Za-z-_]{20,50})"},{name:"square_reader_sdk_repository_password",regex:"square[_-]?reader[_-]?sdk[_-]?repository[_-]?password(=| =|:| :)"},{name:"srcclr_api_token",regex:"srcclr[_-]?api[_-]?token(=| =|:| :)"},{name:"ssh_password",regex:`(sshpass -p.*['|"])`},{name:"sshpass",regex:"sshpass(=| =|:| :)"},{name:"ssmtp_config",regex:"ssmtp[_-]?config(=| =|:| :)"},{name:"staging_base_url_runscope",regex:"staging[_-]?base[_-]?url[_-]?runscope(=| =|:| :)"},{name:"star_test_aws_access_key_id",regex:"star[_-]?test[_-]?aws[_-]?access[_-]?key[_-]?id(=| =|:| :)"},{name:"star_test_bucket",regex:"star[_-]?test[_-]?bucket(=| =|:| :)"},{name:"star_test_location",regex:"star[_-]?test[_-]?location(=| =|:| :)"},{name:"star_test_secret_access_key",regex:"star[_-]?test[_-]?secret[_-]?access[_-]?key(=| =|:| :)"},{name:"starship_account_sid",regex:"starship[_-]?account[_-]?sid(=| =|:| :)"},{name:"starship_auth_token",regex:"starship[_-]?auth[_-]?token(=| =|:| :)"},{name:"stormpath_api_key_id",regex:"stormpath[_-]?api[_-]?key[_-]?id(=| =|:| :)"},{name:"stormpath_api_key_secret",regex:"stormpath[_-]?api[_-]?key[_-]?secret(=| =|:| :)"},{name:"strip_publishable_key",regex:"strip[_-]?publishable[_-]?key(=| =|:| :)"},{name:"strip_secret_key",regex:"strip[_-]?secret[_-]?key(=| =|:| :)"},{name:"stripe_private",regex:"stripe[_-]?private(=| =|:| :)"},{name:"stripe_public",regex:"stripe[_-]?public(=| =|:| :)"},{name:"stripe_restricted_api",regex:"(rk_live_[0-9a-zA-Z]{24,34})"},{name:"stripe_standard_api",regex:"(sk_live_[0-9a-zA-Z]{24,34})"},{name:"surge_login",regex:"surge[_-]?login(=| =|:| :)"},{name:"surge_token",regex:"surge[_-]?token(=| =|:| :)"},{name:"svn_pass",regex:"svn[_-]?pass(=| =|:| :)"},{name:"tesco_api_key",regex:"tesco[_-]?api[_-]?key(=| =|:| :)"},{name:"test_github_token",regex:"test[_-]?github[_-]?token(=| =|:| :)"},{name:"test_test",regex:"test[_-]?test(=| =|:| :)"},{name:"tester_keys_password",regex:"tester[_-]?keys[_-]?password(=| =|:| :)"},{name:"thera_oss_access_key",regex:"thera[_-]?oss[_-]?access[_-]?key(=| =|:| :)"},{name:"token_core_java",regex:"token[_-]?core[_-]?java(=| =|:| :)"},{name:"travis_access_token",regex:"travis[_-]?access[_-]?token(=| =|:| :)"},{name:"travis_api_token",regex:"travis[_-]?api[_-]?token(=| =|:| :)"},{name:"travis_branch",regex:"travis[_-]?branch(=| =|:| :)"},{name:"travis_com_token",regex:"travis[_-]?com[_-]?token(=| =|:| :)"},{name:"travis_e2e_token",regex:"travis[_-]?e2e[_-]?token(=| =|:| :)"},{name:"travis_gh_token",regex:"travis[_-]?gh[_-]?token(=| =|:| :)"},{name:"travis_pull_request",regex:"travis[_-]?pull[_-]?request(=| =|:| :)"},{name:"travis_secure_env_vars",regex:"travis[_-]?secure[_-]?env[_-]?vars(=| =|:| :)"},{name:"travis_token",regex:"travis[_-]?token(=| =|:| :)"},{name:"trex_client_token",regex:"trex[_-]?client[_-]?token(=| =|:| :)"},{name:"trex_okta_client_token",regex:"trex[_-]?okta[_-]?client[_-]?token(=| =|:| :)"},{name:"twilio_api_key",regex:"twilio[_-]?api[_-]?key(=| =|:| :)"},{name:"twilio_api_secret",regex:"twilio[_-]?api[_-]?secret(=| =|:| :)"},{name:"twilio_chat_account_api_service",regex:"twilio[_-]?chat[_-]?account[_-]?api[_-]?service(=| =|:| :)"},{name:"twilio_configuration_sid",regex:"twilio[_-]?configuration[_-]?sid(=| =|:| :)"},{name:"twilio_sid",regex:"twilio[_-]?sid(=| =|:| :)"},{name:"twilio_token",regex:"twilio[_-]?token(=| =|:| :)"},{name:"twine_password",regex:"twine[_-]?password(=| =|:| :)"},{name:"twitter_consumer_key",regex:"twitter[_-]?consumer[_-]?key(=| =|:| :)"},{name:"twitter_consumer_secret",regex:"twitter[_-]?consumer[_-]?secret(=| =|:| :)"},{name:"twitteroauthaccesssecret",regex:"twitteroauthaccesssecret(=| =|:| :)"},{name:"twitteroauthaccesstoken",regex:"twitteroauthaccesstoken(=| =|:| :)"},{name:"unity_password",regex:"unity[_-]?password(=| =|:| :)"},{name:"unity_serial",regex:"unity[_-]?serial(=| =|:| :)"},{name:"urban_key",regex:"urban[_-]?key(=| =|:| :)"},{name:"urban_master_secret",regex:"urban[_-]?master[_-]?secret(=| =|:| :)"},{name:"urban_secret",regex:"urban[_-]?secret(=| =|:| :)"},{name:"us_east_1_elb_amazonaws_com",regex:"us[_-]?east[_-]?1[_-]?elb[_-]?amazonaws[_-]?com(=| =|:| :)"},{name:"use_ssh",regex:"use[_-]?ssh(=| =|:| :)"},{name:"user_assets_access_key_id",regex:"user[_-]?assets[_-]?access[_-]?key[_-]?id(=| =|:| :)"},{name:"user_assets_secret_access_key",regex:"user[_-]?assets[_-]?secret[_-]?access[_-]?key(=| =|:| :)"},{name:"usertravis",regex:"usertravis(=| =|:| :)"},{name:"v_sfdc_client_secret",regex:"v[_-]?sfdc[_-]?client[_-]?secret(=| =|:| :)"},{name:"v_sfdc_password",regex:"v[_-]?sfdc[_-]?password(=| =|:| :)"},{name:"vip_github_build_repo_deploy_key",regex:"vip[_-]?github[_-]?build[_-]?repo[_-]?deploy[_-]?key(=| =|:| :)"},{name:"vip_github_deploy_key",regex:"vip[_-]?github[_-]?deploy[_-]?key(=| =|:| :)"},{name:"vip_github_deploy_key_pass",regex:"vip[_-]?github[_-]?deploy[_-]?key[_-]?pass(=| =|:| :)"},{name:"virustotal_apikey",regex:"virustotal[_-]?apikey(=| =|:| :)"},{name:"visual_recognition_api_key",regex:"visual[_-]?recognition[_-]?api[_-]?key(=| =|:| :)"},{name:"vscetoken",regex:"vscetoken(=| =|:| :)"},{name:"wakatime_api_key",regex:"wakatime[_-]?api[_-]?key(=| =|:| :)"},{name:"watson_conversation_password",regex:"watson[_-]?conversation[_-]?password(=| =|:| :)"},{name:"watson_device_password",regex:"watson[_-]?device[_-]?password(=| =|:| :)"},{name:"watson_password",regex:"watson[_-]?password(=| =|:| :)"},{name:"widget_basic_password",regex:"widget[_-]?basic[_-]?password(=| =|:| :)"},{name:"widget_basic_password_2",regex:"widget[_-]?basic[_-]?password[_-]?2(=| =|:| :)"},{name:"widget_basic_password_3",regex:"widget[_-]?basic[_-]?password[_-]?3(=| =|:| :)"},{name:"widget_basic_password_4",regex:"widget[_-]?basic[_-]?password[_-]?4(=| =|:| :)"},{name:"widget_basic_password_5",regex:"widget[_-]?basic[_-]?password[_-]?5(=| =|:| :)"},{name:"widget_fb_password",regex:"widget[_-]?fb[_-]?password(=| =|:| :)"},{name:"widget_fb_password_2",regex:"widget[_-]?fb[_-]?password[_-]?2(=| =|:| :)"},{name:"widget_fb_password_3",regex:"widget[_-]?fb[_-]?password[_-]?3(=| =|:| :)"},{name:"widget_test_server",regex:"widget[_-]?test[_-]?server(=| =|:| :)"},{name:"wincert_password",regex:"wincert[_-]?password(=| =|:| :)"},{name:"wordpress_db_password",regex:"wordpress[_-]?db[_-]?password(=| =|:| :)"},{name:"wordpress_db_user",regex:"wordpress[_-]?db[_-]?user(=| =|:| :)"},{name:"wpjm_phpunit_google_geocode_api_key",regex:"wpjm[_-]?phpunit[_-]?google[_-]?geocode[_-]?api[_-]?key(=| =|:| :)"},{name:"wporg_password",regex:"wporg[_-]?password(=| =|:| :)"},{name:"wpt_db_password",regex:"wpt[_-]?db[_-]?password(=| =|:| :)"},{name:"wpt_db_user",regex:"wpt[_-]?db[_-]?user(=| =|:| :)"},{name:"wpt_prepare_dir",regex:"wpt[_-]?prepare[_-]?dir(=| =|:| :)"},{name:"wpt_report_api_key",regex:"wpt[_-]?report[_-]?api[_-]?key(=| =|:| :)"},{name:"wpt_ssh_connect",regex:"wpt[_-]?ssh[_-]?connect(=| =|:| :)"},{name:"wpt_ssh_private_key_base64",regex:"wpt[_-]?ssh[_-]?private[_-]?key[_-]?base64(=| =|:| :)"},{name:"www_googleapis_com",regex:"www[_-]?googleapis[_-]?com(=| =|:| :)"},{name:"yangshun_gh_password",regex:"yangshun[_-]?gh[_-]?password(=| =|:| :)"},{name:"yangshun_gh_token",regex:"yangshun[_-]?gh[_-]?token(=| =|:| :)"},{name:"yt_account_client_secret",regex:"yt[_-]?account[_-]?client[_-]?secret(=| =|:| :)"},{name:"yt_account_refresh_token",regex:"yt[_-]?account[_-]?refresh[_-]?token(=| =|:| :)"},{name:"yt_api_key",regex:"yt[_-]?api[_-]?key(=| =|:| :)"},{name:"yt_client_secret",regex:"yt[_-]?client[_-]?secret(=| =|:| :)"},{name:"yt_partner_client_secret",regex:"yt[_-]?partner[_-]?client[_-]?secret(=| =|:| :)"},{name:"yt_partner_refresh_token",regex:"yt[_-]?partner[_-]?refresh[_-]?token(=| =|:| :)"},{name:"yt_server_api_key",regex:"yt[_-]?server[_-]?api[_-]?key(=| =|:| :)"},{name:"zendesk_travis_github",regex:"zendesk[_-]?travis[_-]?github(=| =|:| :)"},{name:"zensonatypepassword",regex:"zensonatypepassword(=| =|:| :)"},{name:"zhuliang_gh_token",regex:"zhuliang[_-]?gh[_-]?token(=| =|:| :)"},{name:"zopim_account_key",regex:"zopim[_-]?account[_-]?key(=| =|:| :)"},{name:"docker_registry_auth",regex:'auth":.*"(?:[A-Za-z0-9+\\/]{4})*(?:[A-Za-z0-9+\\/]{4}|[A-Za-z0-9+\\/]{3}=|[A-Za-z0-9+\\/]{2}={2})'}];var FX="*",vj=new Set([`
83
- `,"\r","\t",'"',"'",":",",","{","}","[","]","\\"]),KX=[];for(let{regex:_}of ZX)try{let z=_,A="g";if(z.startsWith("(?i)"))z=z.slice(4),A="gi";KX.push(new RegExp(z,A))}catch{}function G6(_,z=FX){let A=z.length>0?z[0]:FX,b=_;for(let G of KX)b=b.replace(G,(J)=>Array.from(J,(Y)=>vj.has(Y)?Y:A).join(""));return b}function L_(_){if(typeof _==="string")return G6(_);if(Array.isArray(_))return _.map((z)=>L_(z));if(_ instanceof Date)return _;if(_!==null&&typeof _==="object"){let z={};for(let[A,b]of Object.entries(_))z[A]=L_(b);return z}return _}var yj=[".env",".env.local",".env.development",".env.production",".env.test",".env.staging",/\.env\.(dev|prod|stage|preview|ci|build|docker)$/i,".zshrc",".bashrc",".bash_profile",".profile",".zprofile",".zshenv",".zsh_history",".bash_history","id_rsa","id_ed25519","id_ecdsa","id_dsa",/^id_[a-z0-9]+$/i,/\.pem$/i,/\.key$/i,".aws/credentials",".aws/config",".docker/config.json",".npmrc",".yarnrc",".yarnrc.yml",".git-credentials",".netrc",".kube/config","kubeconfig","database.yml","secrets.yml","secrets.yaml","master.key","credentials.yml.enc",".gcloud/credentials","service-account.json","service_account.json",/gcp.*credentials.*\.json$/i,/firebase.*\.json$/i];function gj(_){let z=_.replace(/\\/g,"/"),A=z.split("/").pop()||"";for(let b of yj)if(typeof b==="string"){if(A===b||z.endsWith(`/${b}`)||z===b)return!0}else if(b.test(A)||b.test(z))return!0;return!1}function O5(_){return _.replace(/[^\s]/g,"*")}function L5(_){let z=_.messages.map((A)=>fj(A));return{..._,messages:z}}function fj(_){if(_.type!=="tool-call")return _;let z=_.toolName;if(z!=="Read"&&z!=="Write")return _;let A=_.input,b=A?.file_path;if(typeof b!=="string"||!gj(b))return _;let G={..._};if(z==="Write"&&A){let J=A.content;if(typeof J==="string")G.input={...A,content:O5(J)}}if(z==="Read"){let J=_.output;if(typeof J==="string")G.output=O5(J);else if(J&&typeof J==="object"){let Y=J,X=Y.file;if(X&&typeof X.content==="string")G.output={...Y,file:{...X,content:O5(X.content)}}}}return G}import{spawn as hj}from"child_process";import{promises as h9}from"fs";import{homedir as j5}from"os";import{basename as mj,extname as uj,join as X4,resolve as qX}from"path";var Uz=100,WX=80,cj=new Set(["[request interrupted by user]","[request aborted by user]","[request cancelled by user]"]),lj=/^<\/?(?:command|local)-[a-z-]+>/i,pj=/^[α-ωΑ-Ω]\s/i,dj=/<system-reminder>[\s\S]*?<\/system-reminder>/g,rj=["npm ","npm:","npm error","node:","node.js","error:","fatal:","warning:","traceback (most recent call last):","usage:","hint:","note:","code:","requirestack"],nj=X4(j5(),".claude"),ij=X4(j5(),".codex"),oj=X4(j5(),".pi","agent","sessions");async function aj(_){let z=_?.limit??Uz,A=process.env.CLAUDE_HOME??nj,b=X4(A,"projects");if(!await R5(b))return[];let G=[];try{let X=await h9.readdir(b,{withFileTypes:!0});for(let Q of X){if(!Q.isDirectory())continue;let $=X4(b,Q.name);try{let H=await h9.readdir($,{withFileTypes:!0});for(let B of H){if(!B.isFile()||uj(B.name)!==".jsonl")continue;let Z=X4($,B.name),F=mj(B.name,".jsonl");try{let K=await h9.stat(Z);G.push({path:Z,id:F,mtime:K.mtime})}catch{}}}catch{}}}catch{}G.sort((X,Q)=>Q.mtime.getTime()-X.mtime.getTime());let J=G.slice(0,z*2),Y=[];for(let X of J)try{let Q=await zR(X.path);Y.push({id:X.id,source:"claude-code",path:X.path,timestamp:Q.timestamp,preview:Q.preview,cwd:Q.cwd,repoId:null,stats:Q.stats})}catch{}return Y.sort((X,Q)=>Q.timestamp.getTime()-X.timestamp.getTime()).slice(0,z)}async function sj(_){let z=_?.limit??Uz,A=process.env.CODEX_HOME??ij,b=X4(A,"sessions");if(!await R5(b))return[];let G=[],Y=(await JR(b)).slice(0,z*2);for(let X of Y)try{let Q=await YR(X);if(!Q)continue;G.push({id:Q.sessionId,source:"codex",path:X,timestamp:Q.timestamp,preview:Q.preview,cwd:Q.cwd,repoId:null,stats:Q.stats})}catch{}return G.sort((X,Q)=>Q.timestamp.getTime()-X.timestamp.getTime()).slice(0,z)}async function tj(_){let z=_?.limit??Uz;try{let A=await ej(z*2);if(!A)return[];let b=JSON.parse(A),G=[];for(let J of b){if(J.parentId)continue;let Y=J.updated?new Date(J.updated):J.created?new Date(J.created):new Date(0);G.push({id:J.id,source:"opencode",path:J.id,timestamp:Y,preview:J.title?J6(J.title):null,cwd:J.directory??null,repoId:null,stats:null})}return G.sort((J,Y)=>Y.timestamp.getTime()-J.timestamp.getTime()).slice(0,z)}catch{return[]}}function ej(_){return new Promise((z)=>{let A=!1,b=(X)=>{if(!A)A=!0,clearTimeout(Y),z(X)},G=hj("opencode",["session","list","--format","json","-n",String(_)],{stdio:["pipe","pipe","pipe"]}),J="",Y=setTimeout(()=>{G.kill(),b(null)},30000);G.stdout.on("data",(X)=>{J+=X.toString()}),G.on("close",(X)=>{b(X===0?J.trim()||null:null)}),G.on("error",()=>{b(null)})})}async function _R(_){let z=_?.limit??Uz,A=process.env.PI_SESSIONS??oj;if(!await R5(A))return[];let b=[];try{let G=await h9.readdir(A,{withFileTypes:!0});for(let J of G){if(!J.isDirectory())continue;let Y=X4(A,J.name);try{let X=await h9.readdir(Y,{withFileTypes:!0});for(let Q of X){if(!Q.isFile()||!Q.name.endsWith(".jsonl"))continue;let $=X4(Y,Q.name);try{let H=await XR($);if(!H)continue;b.push({id:H.sessionId,source:"pi",path:$,timestamp:H.timestamp,preview:H.preview,cwd:H.cwd,repoId:null,stats:null})}catch{}}}catch{}}}catch{}return b.sort((G,J)=>J.timestamp.getTime()-G.timestamp.getTime()).slice(0,z)}async function VX(_){let z=_?.sources??["claude-code","codex","opencode","pi"],A=_?.limit??Uz,b=_?.cwd?qX(_.cwd):null,G=A*3,J=await Promise.all([z.includes("claude-code")?aj({limit:G}):[],z.includes("codex")?sj({limit:G}):[],z.includes("opencode")?tj({limit:G}):[],z.includes("pi")?_R({limit:G}):[]]),Y=[];for(let X of J)Y.push(...X);if(Y=Y.filter((X)=>X.preview&&X.preview.trim().length>0),b)Y=Y.filter((X)=>{if(!X.cwd)return!1;let Q=qX(X.cwd);return Q.startsWith(b)||b.startsWith(Q)});return Y.sort((X,Q)=>Q.timestamp.getTime()-X.timestamp.getTime()).slice(0,A)}async function R5(_){try{return(await h9.stat(_)).isDirectory()}catch{return!1}}function J6(_){let z=_.replace(/\s+/g," ").trim();if(z.length<=WX)return z;return z.slice(0,WX-1)+"…"}var X1=51200,Q1=20480;async function zR(_){let z=await h9.open(_,"r");try{let b=(await z.stat()).size,G=null,J=null,Y=null,X=Buffer.alloc(Math.min(X1,b));await z.read(X,0,X.length,0);let Q=X.toString("utf8");for(let $ of Q.split(/\r?\n/)){if(!$.trim())continue;if(!$.endsWith("}"))break;try{let H=JSON.parse($);if(!G&&typeof H.cwd==="string")G=H.cwd;if(typeof H.timestamp==="string"){let B=new Date(H.timestamp);if(!Number.isNaN(B.getTime())){if(!Y||B>Y)Y=B}}if(H.isSidechain||H.isMeta)continue;if(!J&&H.type==="user"){let Z=H.message?.content;if(H.toolUseResult||H.tool_use_result)continue;let F=AR(Z);if(F){let K=bR(F);if(K)J=J6(K)}}if(G&&J)break}catch{continue}}if(b>X1){let $=Math.max(0,b-Q1),H=Buffer.alloc(Math.min(Q1,b-$));await z.read(H,0,H.length,$);let Z=H.toString("utf8").split(/\r?\n/);if($>0&&Z.length>0)Z.shift();for(let F of Z){if(!F.trim())continue;try{let K=JSON.parse(F);if(typeof K.timestamp==="string"){let q=new Date(K.timestamp);if(!Number.isNaN(q.getTime())){if(!Y||q>Y)Y=q}}}catch{continue}}}return{timestamp:Y??new Date(0),cwd:G,preview:J,stats:null}}finally{await z.close()}}function AR(_){if(typeof _==="string")return _;if(Array.isArray(_))for(let z of _){if(typeof z==="string")return z;if(z&&typeof z==="object"){let A=z;if(A.type==="tool_result")continue;if(A.type==="text"&&typeof A.text==="string")return A.text}}return null}function bR(_){let z=_.replace(dj,""),A=[];for(let b of z.split(/\r?\n/)){let G=b.trim();if(!G)continue;let J=G.toLowerCase();if(cj.has(J))continue;if(lj.test(G))continue;if(pj.test(G))continue;if(rj.some((Y)=>J.startsWith(Y))){if(!G.includes("?")&&!GR(J))continue}if(!/[a-z]/i.test(G)&&!/\d/.test(G))continue;A.push(G)}if(A.length===0)return null;return A.slice(0,3).join(" ").replace(/\s+/g," ").trim()||null}function GR(_){return["can you","could you","please","help","how do","what is","why","fix","add","create","update"].some((A)=>_.includes(A))}async function JR(_){let z=[];async function A(b,G){if(G>4)return;try{let J=await h9.readdir(b,{withFileTypes:!0});for(let Y of J){let X=X4(b,Y.name);if(Y.isDirectory())await A(X,G+1);else if(Y.isFile()&&Y.name.endsWith(".jsonl")){let Q=await h9.stat(X);z.push({path:X,mtime:Q.mtime})}}}catch{}}return await A(_,0),z.sort((b,G)=>G.mtime.getTime()-b.mtime.getTime()),z.map((b)=>b.path)}async function YR(_){let z=await h9.open(_,"r");try{let b=(await z.stat()).size,G=null,J=null,Y=null,X=null,Q=Buffer.alloc(Math.min(X1,b));await z.read(Q,0,Q.length,0);let $=Q.toString("utf8");for(let H of $.split(/\r?\n/)){if(!H.trim())continue;if(!H.endsWith("}"))break;try{let B=JSON.parse(H),Z=B.timestamp,F=B.type,K=B.payload;if(Z){let q=new Date(Z);if(!Number.isNaN(q.getTime())){if(!J||q>J)J=q}}if(!K)continue;if(F==="session_meta")G=K.id??null,Y=K.cwd??null;if(F==="event_msg"&&K.type==="user_message"&&!X){let q=K.message;if(q)X=J6(q)}if(G&&Y&&X)break}catch{continue}}if(b>X1){let H=Math.max(0,b-Q1),B=Buffer.alloc(Math.min(Q1,b-H));await z.read(B,0,B.length,H);let F=B.toString("utf8").split(/\r?\n/);if(H>0&&F.length>0)F.shift();for(let K of F){if(!K.trim())continue;try{let W=JSON.parse(K).timestamp;if(W){let V=new Date(W);if(!Number.isNaN(V.getTime())){if(!J||V>J)J=V}}}catch{continue}}}if(!G)return null;return{sessionId:G,timestamp:J??new Date(0),cwd:Y,preview:X,stats:null}}finally{await z.close()}}async function XR(_){let z=await h9.open(_,"r");try{let b=(await z.stat()).size,G=null,J=null,Y=null,X=null,Q=null,$=Buffer.alloc(Math.min(X1,b));await z.read($,0,$.length,0);let B=$.toString("utf8").split(/\r?\n/);for(let Z=0;Z<B.length;Z++){let F=B[Z];if(!F.trim())continue;if(!F.endsWith("}"))break;try{let K=JSON.parse(F);if(Z===0&&K.id&&K.timestamp){G=K.id,Y=K.cwd??null,J=new Date(K.timestamp),Q=J;continue}if(K.timestamp){let q=new Date(K.timestamp);if(!Number.isNaN(q.getTime())){if(!Q||q>Q)Q=q}}if(!X&&K.type==="message"){let q=K.message;if(q?.role==="user"){let W=q.content;if(Array.isArray(W)){for(let V of W)if(V&&typeof V==="object"&&V.type==="text"){let w=V.text;if(w){X=J6(w);break}}}}}if(G&&Y&&X)break}catch{continue}}if(b>X1){let Z=Math.max(0,b-Q1),F=Buffer.alloc(Math.min(Q1,b-Z));await z.read(F,0,F.length,Z);let q=F.toString("utf8").split(/\r?\n/);if(Z>0&&q.length>0)q.shift();for(let W of q){if(!W.trim())continue;try{let V=JSON.parse(W);if(V.timestamp){let w=new Date(V.timestamp);if(!Number.isNaN(w.getTime())){if(!Q||w>Q)Q=w}}}catch{continue}}}if(!G)return null;return{sessionId:G,timestamp:Q??J??new Date(0),cwd:Y,preview:X}}finally{await z.close()}}function DX(_){return _===161||_===164||_===167||_===168||_===170||_===173||_===174||_>=176&&_<=180||_>=182&&_<=186||_>=188&&_<=191||_===198||_===208||_===215||_===216||_>=222&&_<=225||_===230||_>=232&&_<=234||_===236||_===237||_===240||_===242||_===243||_>=247&&_<=250||_===252||_===254||_===257||_===273||_===275||_===283||_===294||_===295||_===299||_>=305&&_<=307||_===312||_>=319&&_<=322||_===324||_>=328&&_<=331||_===333||_===338||_===339||_===358||_===359||_===363||_===462||_===464||_===466||_===468||_===470||_===472||_===474||_===476||_===593||_===609||_===708||_===711||_>=713&&_<=715||_===717||_===720||_>=728&&_<=731||_===733||_===735||_>=768&&_<=879||_>=913&&_<=929||_>=931&&_<=937||_>=945&&_<=961||_>=963&&_<=969||_===1025||_>=1040&&_<=1103||_===1105||_===8208||_>=8211&&_<=8214||_===8216||_===8217||_===8220||_===8221||_>=8224&&_<=8226||_>=8228&&_<=8231||_===8240||_===8242||_===8243||_===8245||_===8251||_===8254||_===8308||_===8319||_>=8321&&_<=8324||_===8364||_===8451||_===8453||_===8457||_===8467||_===8470||_===8481||_===8482||_===8486||_===8491||_===8531||_===8532||_>=8539&&_<=8542||_>=8544&&_<=8555||_>=8560&&_<=8569||_===8585||_>=8592&&_<=8601||_===8632||_===8633||_===8658||_===8660||_===8679||_===8704||_===8706||_===8707||_===8711||_===8712||_===8715||_===8719||_===8721||_===8725||_===8730||_>=8733&&_<=8736||_===8739||_===8741||_>=8743&&_<=8748||_===8750||_>=8756&&_<=8759||_===8764||_===8765||_===8776||_===8780||_===8786||_===8800||_===8801||_>=8804&&_<=8807||_===8810||_===8811||_===8814||_===8815||_===8834||_===8835||_===8838||_===8839||_===8853||_===8857||_===8869||_===8895||_===8978||_>=9312&&_<=9449||_>=9451&&_<=9547||_>=9552&&_<=9587||_>=9600&&_<=9615||_>=9618&&_<=9621||_===9632||_===9633||_>=9635&&_<=9641||_===9650||_===9651||_===9654||_===9655||_===9660||_===9661||_===9664||_===9665||_>=9670&&_<=9672||_===9675||_>=9678&&_<=9681||_>=9698&&_<=9701||_===9711||_===9733||_===9734||_===9737||_===9742||_===9743||_===9756||_===9758||_===9792||_===9794||_===9824||_===9825||_>=9827&&_<=9829||_>=9831&&_<=9834||_===9836||_===9837||_===9839||_===9886||_===9887||_===9919||_>=9926&&_<=9933||_>=9935&&_<=9939||_>=9941&&_<=9953||_===9955||_===9960||_===9961||_>=9963&&_<=9969||_===9972||_>=9974&&_<=9977||_===9979||_===9980||_===9982||_===9983||_===10045||_>=10102&&_<=10111||_>=11094&&_<=11097||_>=12872&&_<=12879||_>=57344&&_<=63743||_>=65024&&_<=65039||_===65533||_>=127232&&_<=127242||_>=127248&&_<=127277||_>=127280&&_<=127337||_>=127344&&_<=127373||_===127375||_===127376||_>=127387&&_<=127404||_>=917760&&_<=917999||_>=983040&&_<=1048573||_>=1048576&&_<=1114109}function MX(_){return _===12288||_>=65281&&_<=65376||_>=65504&&_<=65510}function NX(_){return _>=4352&&_<=4447||_===8986||_===8987||_===9001||_===9002||_>=9193&&_<=9196||_===9200||_===9203||_===9725||_===9726||_===9748||_===9749||_>=9776&&_<=9783||_>=9800&&_<=9811||_===9855||_>=9866&&_<=9871||_===9875||_===9889||_===9898||_===9899||_===9917||_===9918||_===9924||_===9925||_===9934||_===9940||_===9962||_===9970||_===9971||_===9973||_===9978||_===9981||_===9989||_===9994||_===9995||_===10024||_===10060||_===10062||_>=10067&&_<=10069||_===10071||_>=10133&&_<=10135||_===10160||_===10175||_===11035||_===11036||_===11088||_===11093||_>=11904&&_<=11929||_>=11931&&_<=12019||_>=12032&&_<=12245||_>=12272&&_<=12287||_>=12289&&_<=12350||_>=12353&&_<=12438||_>=12441&&_<=12543||_>=12549&&_<=12591||_>=12593&&_<=12686||_>=12688&&_<=12773||_>=12783&&_<=12830||_>=12832&&_<=12871||_>=12880&&_<=42124||_>=42128&&_<=42182||_>=43360&&_<=43388||_>=44032&&_<=55203||_>=63744&&_<=64255||_>=65040&&_<=65049||_>=65072&&_<=65106||_>=65108&&_<=65126||_>=65128&&_<=65131||_>=94176&&_<=94180||_>=94192&&_<=94198||_>=94208&&_<=101589||_>=101631&&_<=101662||_>=101760&&_<=101874||_>=110576&&_<=110579||_>=110581&&_<=110587||_===110589||_===110590||_>=110592&&_<=110882||_===110898||_>=110928&&_<=110930||_===110933||_>=110948&&_<=110951||_>=110960&&_<=111355||_>=119552&&_<=119638||_>=119648&&_<=119670||_===126980||_===127183||_===127374||_>=127377&&_<=127386||_>=127488&&_<=127490||_>=127504&&_<=127547||_>=127552&&_<=127560||_===127568||_===127569||_>=127584&&_<=127589||_>=127744&&_<=127776||_>=127789&&_<=127797||_>=127799&&_<=127868||_>=127870&&_<=127891||_>=127904&&_<=127946||_>=127951&&_<=127955||_>=127968&&_<=127984||_===127988||_>=127992&&_<=128062||_===128064||_>=128066&&_<=128252||_>=128255&&_<=128317||_>=128331&&_<=128334||_>=128336&&_<=128359||_===128378||_===128405||_===128406||_===128420||_>=128507&&_<=128591||_>=128640&&_<=128709||_===128716||_>=128720&&_<=128722||_>=128725&&_<=128728||_>=128732&&_<=128735||_===128747||_===128748||_>=128756&&_<=128764||_>=128992&&_<=129003||_===129008||_>=129292&&_<=129338||_>=129340&&_<=129349||_>=129351&&_<=129535||_>=129648&&_<=129660||_>=129664&&_<=129674||_>=129678&&_<=129734||_===129736||_>=129741&&_<=129756||_>=129759&&_<=129770||_>=129775&&_<=129784||_>=131072&&_<=196605||_>=196608&&_<=262141}function QR(_){if(!Number.isSafeInteger(_))throw TypeError(`Expected a code point, got \`${typeof _}\`.`)}function P5(_,{ambiguousAsWide:z=!1}={}){if(QR(_),MX(_)||NX(_)||z&&DX(_))return 2;return 1}var $1=new Intl.Segmenter(void 0,{granularity:"grapheme"});function Y6(){return $1}function $R(_){let z=_.codePointAt(0);return z>=126976&&z<=130047||z>=8960&&z<=9215||z>=9728&&z<=10175||z>=11088&&z<=11093||_.includes("️")||_.length>2}var HR=/^(?:\p{Default_Ignorable_Code_Point}|\p{Control}|\p{Mark}|\p{Surrogate})+$/v,BR=/^[\p{Default_Ignorable_Code_Point}\p{Control}\p{Format}\p{Mark}\p{Surrogate}]+/v,ZR=/^\p{RGI_Emoji}$/v,FR=512,Dz=new Map;function k5(_){if(HR.test(_))return 0;if($R(_)&&ZR.test(_))return 2;let A=_.replace(BR,"").codePointAt(0);if(A===void 0)return 0;let b=P5(A);if(_.length>1)for(let G of _.slice(1)){let J=G.codePointAt(0);if(J>=65280&&J<=65519)b+=P5(J)}return b}function W0(_){if(_.length===0)return 0;let z=!0;for(let J=0;J<_.length;J++){let Y=_.charCodeAt(J);if(Y<32||Y>126){z=!1;break}}if(z)return _.length;let A=Dz.get(_);if(A!==void 0)return A;let b=_;if(_.includes("\t"))b=b.replace(/\t/g," ");if(b.includes("\x1B"))b=b.replace(/\x1b\[[0-9;]*[mGKHJ]/g,""),b=b.replace(/\x1b\]8;;[^\x07]*\x07/g,""),b=b.replace(/\x1b_[^\x07\x1b]*(?:\x07|\x1b\\)/g,"");let G=0;for(let{segment:J}of $1.segment(b))G+=k5(J);if(Dz.size>=FR){let J=Dz.keys().next().value;if(J!==void 0)Dz.delete(J)}return Dz.set(_,G),G}function Q4(_,z){if(z>=_.length||_[z]!=="\x1B")return null;let A=_[z+1];if(A==="["){let b=z+2;while(b<_.length&&!/[mGKHJ]/.test(_[b]))b++;if(b<_.length)return{code:_.substring(z,b+1),length:b+1-z};return null}if(A==="]"){let b=z+2;while(b<_.length){if(_[b]==="\x07")return{code:_.substring(z,b+1),length:b+1-z};if(_[b]==="\x1B"&&_[b+1]==="\\")return{code:_.substring(z,b+2),length:b+2-z};b++}return null}if(A==="_"){let b=z+2;while(b<_.length){if(_[b]==="\x07")return{code:_.substring(z,b+1),length:b+1-z};if(_[b]==="\x1B"&&_[b+1]==="\\")return{code:_.substring(z,b+2),length:b+2-z};b++}return null}return null}class X6{bold=!1;dim=!1;italic=!1;underline=!1;blink=!1;inverse=!1;hidden=!1;strikethrough=!1;fgColor=null;bgColor=null;process(_){if(!_.endsWith("m"))return;let z=_.match(/\x1b\[([\d;]*)m/);if(!z)return;let A=z[1];if(A===""||A==="0"){this.reset();return}let b=A.split(";"),G=0;while(G<b.length){let J=Number.parseInt(b[G],10);if(J===38||J===48){if(b[G+1]==="5"&&b[G+2]!==void 0){let Y=`${b[G]};${b[G+1]};${b[G+2]}`;if(J===38)this.fgColor=Y;else this.bgColor=Y;G+=3;continue}else if(b[G+1]==="2"&&b[G+4]!==void 0){let Y=`${b[G]};${b[G+1]};${b[G+2]};${b[G+3]};${b[G+4]}`;if(J===38)this.fgColor=Y;else this.bgColor=Y;G+=5;continue}}switch(J){case 0:this.reset();break;case 1:this.bold=!0;break;case 2:this.dim=!0;break;case 3:this.italic=!0;break;case 4:this.underline=!0;break;case 5:this.blink=!0;break;case 7:this.inverse=!0;break;case 8:this.hidden=!0;break;case 9:this.strikethrough=!0;break;case 21:this.bold=!1;break;case 22:this.bold=!1,this.dim=!1;break;case 23:this.italic=!1;break;case 24:this.underline=!1;break;case 25:this.blink=!1;break;case 27:this.inverse=!1;break;case 28:this.hidden=!1;break;case 29:this.strikethrough=!1;break;case 39:this.fgColor=null;break;case 49:this.bgColor=null;break;default:if(J>=30&&J<=37||J>=90&&J<=97)this.fgColor=String(J);else if(J>=40&&J<=47||J>=100&&J<=107)this.bgColor=String(J);break}G++}}reset(){this.bold=!1,this.dim=!1,this.italic=!1,this.underline=!1,this.blink=!1,this.inverse=!1,this.hidden=!1,this.strikethrough=!1,this.fgColor=null,this.bgColor=null}clear(){this.reset()}getActiveCodes(){let _=[];if(this.bold)_.push("1");if(this.dim)_.push("2");if(this.italic)_.push("3");if(this.underline)_.push("4");if(this.blink)_.push("5");if(this.inverse)_.push("7");if(this.hidden)_.push("8");if(this.strikethrough)_.push("9");if(this.fgColor)_.push(this.fgColor);if(this.bgColor)_.push(this.bgColor);if(_.length===0)return"";return`\x1B[${_.join(";")}m`}hasActiveCodes(){return this.bold||this.dim||this.italic||this.underline||this.blink||this.inverse||this.hidden||this.strikethrough||this.fgColor!==null||this.bgColor!==null}getLineEndReset(){if(this.underline)return"\x1B[24m";return""}}function wX(_,z){let A=0;while(A<_.length){let b=Q4(_,A);if(b)z.process(b.code),A+=b.length;else A++}}function KR(_){let z=[],A="",b="",G=!1,J=0;while(J<_.length){let Y=Q4(_,J);if(Y){b+=Y.code,J+=Y.length;continue}let X=_[J],Q=X===" ";if(Q!==G&&A)z.push(A),A="";if(b)A+=b,b="";G=Q,A+=X,J++}if(b)A+=b;if(A)z.push(A);return z}function Mz(_,z){if(!_)return[""];let A=_.split(`
84
- `),b=[],G=new X6;for(let J of A){let Y=b.length>0?G.getActiveCodes():"";b.push(...qR(Y+J,z)),wX(J,G)}return b.length>0?b:[""]}function qR(_,z){if(!_)return[""];if(W0(_)<=z)return[_];let b=[],G=new X6,J=KR(_),Y="",X=0;for(let Q of J){let $=W0(Q),H=Q.trim()==="";if($>z&&!H){if(Y){let F=G.getLineEndReset();if(F)Y+=F;b.push(Y),Y="",X=0}let Z=WR(Q,z,G);b.push(...Z.slice(0,-1)),Y=Z[Z.length-1],X=W0(Y);continue}if(X+$>z&&X>0){let Z=Y.trimEnd(),F=G.getLineEndReset();if(F)Z+=F;if(b.push(Z),H)Y=G.getActiveCodes(),X=0;else Y=G.getActiveCodes()+Q,X=$}else Y+=Q,X+=$;wX(Q,G)}if(Y)b.push(Y);return b.length>0?b.map((Q)=>Q.trimEnd()):[""]}function WR(_,z,A){let b=[],G=A.getActiveCodes(),J=0,Y=0,X=[];while(Y<_.length){let Q=Q4(_,Y);if(Q)X.push({type:"ansi",value:Q.code}),Y+=Q.length;else{let $=Y;while($<_.length){if(Q4(_,$))break;$++}let H=_.slice(Y,$);for(let B of $1.segment(H))X.push({type:"grapheme",value:B.segment});Y=$}}for(let Q of X){if(Q.type==="ansi"){G+=Q.value,A.process(Q.value);continue}let $=Q.value;if(!$)continue;let H=W0($);if(J+H>z){let B=A.getLineEndReset();if(B)G+=B;b.push(G),G=A.getActiveCodes(),J=0}G+=$,J+=H}if(G)b.push(G);return b.length>0?b:[""]}function Nz(_,z,A){let b=W0(_),G=Math.max(0,z-b),J=" ".repeat(G),Y=_+J;return A(Y)}function n0(_,z,A="...",b=!1){let G=W0(_);if(G<=z)return b?_+" ".repeat(z-G):_;let J=W0(A),Y=z-J;if(Y<=0)return A.substring(0,z);let X=0,Q=[];while(X<_.length){let Z=Q4(_,X);if(Z)Q.push({type:"ansi",value:Z.code}),X+=Z.length;else{let F=X;while(F<_.length){if(Q4(_,F))break;F++}let K=_.slice(X,F);for(let q of $1.segment(K))Q.push({type:"grapheme",value:q.segment});X=F}}let $="",H=0;for(let Z of Q){if(Z.type==="ansi"){$+=Z.value;continue}let F=Z.value;if(!F)continue;let K=W0(F);if(H+K>Y)break;$+=F,H+=K}let B=`${$}\x1B[0m${A}`;if(b){let Z=W0(B);return B+" ".repeat(Math.max(0,z-Z))}return B}function Q6(_,z,A,b=!1){return I5(_,z,A,b).text}function I5(_,z,A,b=!1){if(A<=0)return{text:"",width:0};let G=z+A,J="",Y=0,X=0,Q=0,$="";while(Q<_.length){let H=Q4(_,Q);if(H){if(X>=z&&X<G)J+=H.code;else if(X<z)$+=H.code;Q+=H.length;continue}let B=Q;while(B<_.length&&!Q4(_,B))B++;for(let{segment:Z}of $1.segment(_.slice(Q,B))){let F=k5(Z),K=X>=z&&X<G,q=!b||X+F<=G;if(K&&q){if($)J+=$,$="";J+=Z,Y+=F}if(X+=F,X>=G)break}if(Q=B,X>=G)break}return{text:J,width:Y}}var S5=new X6;function EX(_,z,A,b,G=!1){let J="",Y=0,X="",Q=0,$=0,H=0,B="",Z=!1,F=A+b;S5.clear();while(H<_.length){let K=Q4(_,H);if(K){if(S5.process(K.code),$<z)B+=K.code;else if($>=A&&$<F&&Z)X+=K.code;H+=K.length;continue}let q=H;while(q<_.length&&!Q4(_,q))q++;for(let{segment:W}of $1.segment(_.slice(H,q))){let V=k5(W);if($<z){if(B)J+=B,B="";J+=W,Y+=V}else if($>=A&&$<F){if(!G||$+V<=F){if(!Z)X+=S5.getActiveCodes(),Z=!0;X+=W,Q+=V}}if($+=V,b<=0?$>=z:$>=F)break}if(H=q,b<=0?$>=z:$>=F)break}return{before:J,beforeWidth:Y,after:X,afterWidth:Q}}var O4=!1;function B6(_){O4=_}var VR=new Set(["`","-","=","[","]","\\",";","'",",",".","/","!","@","#","$","%","^","&","*","(",")","_","+","|","~","{","}",":","<",">","?"]),D0={shift:1,alt:2,ctrl:4},OX=192,C0={escape:27,tab:9,enter:13,space:32,backspace:127,kpEnter:57414},X9={up:-1,down:-2,right:-3,left:-4},T0={delete:-10,insert:-11,pageUp:-12,pageDown:-13,home:-14,end:-15},N9={up:["\x1B[A","\x1BOA"],down:["\x1B[B","\x1BOB"],right:["\x1B[C","\x1BOC"],left:["\x1B[D","\x1BOD"],home:["\x1B[H","\x1BOH","\x1B[1~","\x1B[7~"],end:["\x1B[F","\x1BOF","\x1B[4~","\x1B[8~"],insert:["\x1B[2~"],delete:["\x1B[3~"],pageUp:["\x1B[5~","\x1B[[5~"],pageDown:["\x1B[6~","\x1B[[6~"],clear:["\x1B[E","\x1BOE"],f1:["\x1BOP","\x1B[11~","\x1B[[A"],f2:["\x1BOQ","\x1B[12~","\x1B[[B"],f3:["\x1BOR","\x1B[13~","\x1B[[C"],f4:["\x1BOS","\x1B[14~","\x1B[[D"],f5:["\x1B[15~","\x1B[[E"],f6:["\x1B[17~"],f7:["\x1B[18~"],f8:["\x1B[19~"],f9:["\x1B[20~"],f10:["\x1B[21~"],f11:["\x1B[23~"],f12:["\x1B[24~"]},UR={up:["\x1B[a"],down:["\x1B[b"],right:["\x1B[c"],left:["\x1B[d"],clear:["\x1B[e"],insert:["\x1B[2$"],delete:["\x1B[3$"],pageUp:["\x1B[5$"],pageDown:["\x1B[6$"],home:["\x1B[7$"],end:["\x1B[8$"]},DR={up:["\x1BOa"],down:["\x1BOb"],right:["\x1BOc"],left:["\x1BOd"],clear:["\x1BOe"],insert:["\x1B[2^"],delete:["\x1B[3^"],pageUp:["\x1B[5^"],pageDown:["\x1B[6^"],home:["\x1B[7^"],end:["\x1B[8^"]};var Q9=(_,z)=>z.includes(_),W9=(_,z,A)=>{if(A===D0.shift)return Q9(_,UR[z]);if(A===D0.ctrl)return Q9(_,DR[z]);return!1},$6="press";function x5(_){if(_.includes("\x1B[200~"))return!1;if(_.includes(":3u")||_.includes(":3~")||_.includes(":3A")||_.includes(":3B")||_.includes(":3C")||_.includes(":3D")||_.includes(":3H")||_.includes(":3F"))return!0;return!1}function H6(_){if(!_)return"press";let z=parseInt(_,10);if(z===2)return"repeat";if(z===3)return"release";return"press"}function MR(_){let z=_.match(/^\x1b\[(\d+)(?::(\d*))?(?::(\d+))?(?:;(\d+))?(?::(\d+))?u$/);if(z){let J=parseInt(z[1],10),Y=z[2]&&z[2].length>0?parseInt(z[2],10):void 0,X=z[3]?parseInt(z[3],10):void 0,Q=z[4]?parseInt(z[4],10):1,$=H6(z[5]);return $6=$,{codepoint:J,shiftedKey:Y,baseLayoutKey:X,modifier:Q-1,eventType:$}}let A=_.match(/^\x1b\[1;(\d+)(?::(\d+))?([ABCD])$/);if(A){let J=parseInt(A[1],10),Y=H6(A[2]),X={A:-1,B:-2,C:-3,D:-4};return $6=Y,{codepoint:X[A[3]],modifier:J-1,eventType:Y}}let b=_.match(/^\x1b\[(\d+)(?:;(\d+))?(?::(\d+))?~$/);if(b){let J=parseInt(b[1],10),Y=b[2]?parseInt(b[2],10):1,X=H6(b[3]),$={2:T0.insert,3:T0.delete,5:T0.pageUp,6:T0.pageDown,7:T0.home,8:T0.end}[J];if($!==void 0)return $6=X,{codepoint:$,modifier:Y-1,eventType:X}}let G=_.match(/^\x1b\[1;(\d+)(?::(\d+))?([HF])$/);if(G){let J=parseInt(G[1],10),Y=H6(G[2]),X=G[3]==="H"?T0.home:T0.end;return $6=Y,{codepoint:X,modifier:J-1,eventType:Y}}return null}function r(_,z,A){let b=MR(_);if(!b)return!1;let G=b.modifier&~OX,J=A&~OX;if(G!==J)return!1;if(b.codepoint===z)return!0;if(b.baseLayoutKey!==void 0&&b.baseLayoutKey===z)return!0;return!1}function LX(_,z,A){let b=_.match(/^\x1b\[27;(\d+);(\d+)~$/);if(!b)return!1;let G=parseInt(b[1],10),J=parseInt(b[2],10),Y=G-1;return J===z&&Y===A}function NR(_){let z=_.toLowerCase(),A=z.charCodeAt(0);if(A>=97&&A<=122||z==="["||z==="\\"||z==="]"||z==="_")return String.fromCharCode(A&31);if(z==="-")return String.fromCharCode(31);return null}function wR(_){let z=_.toLowerCase().split("+"),A=z[z.length-1];if(!A)return null;return{key:A,ctrl:z.includes("ctrl"),shift:z.includes("shift"),alt:z.includes("alt")}}function H1(_,z){let A=wR(z);if(!A)return!1;let{key:b,ctrl:G,shift:J,alt:Y}=A,X=0;if(J)X|=D0.shift;if(Y)X|=D0.alt;if(G)X|=D0.ctrl;switch(b){case"escape":case"esc":if(X!==0)return!1;return _==="\x1B"||r(_,C0.escape,0);case"space":if(!O4){if(G&&!Y&&!J&&_==="\x00")return!0;if(Y&&!G&&!J&&_==="\x1B ")return!0}if(X===0)return _===" "||r(_,C0.space,0);return r(_,C0.space,X);case"tab":if(J&&!G&&!Y)return _==="\x1B[Z"||r(_,C0.tab,D0.shift);if(X===0)return _==="\t"||r(_,C0.tab,0);return r(_,C0.tab,X);case"enter":case"return":if(J&&!G&&!Y){if(r(_,C0.enter,D0.shift)||r(_,C0.kpEnter,D0.shift))return!0;if(LX(_,C0.enter,D0.shift))return!0;if(O4)return _==="\x1B\r"||_===`
82
+ `).length;return{output:{file:{content:X,numLines:$,totalLines:$}},images:Y}}return{output:X||(b?M9(A,b):A),images:Y}}function $X(_,z){if(!_)return _;let A=_.startsWith("/"),b=_.replace(/\\/g,"/");if(!A){if(b==="."||b==="./")return".";if(b.startsWith("./")||b.startsWith("../"))return b;return`./${b}`}let G=z.replace(/\\/g,"/");if(b.startsWith(G+"/"))return`./${b.slice(G.length+1)}`;return h9(b)}function Lj(_){for(let z of _)if(z.type==="user"&&z.text)return jj(z.text);return null}function jj(_){return _.replace(/\s+/g," ").trim()}function Rj(_){if(!_)return null;let z=new Date(_);return Number.isNaN(z.getTime())?null:z}function Pj(_){return Math.max(0,_.inputTokens-_.cachedInputTokens)+_.outputTokens+_.reasoningOutputTokens}var Sj=["anthropic/","openai/","google/"],kj=200000;function Ij(_,z,A){if(!A||!_)return 0;let b=xj(_,A);if(!b)return 0;return Tj({input_tokens:Math.max(0,z.inputTokens-z.cachedInputTokens),output_tokens:z.outputTokens,cache_read_input_tokens:z.cachedInputTokens},b)}function xj(_,z){let A=_.trim();if(!A)return null;let b=new Set;b.add(A);for(let G of Sj)b.add(`${G}${A}`);for(let G of b){let J=z[G];if(J)return J}return null}function Tj(_,z){let A=(Y,X,Q,$=kj)=>{if(Y==null||Y<=0)return 0;if(Y>$&&Q!=null){let H=Math.min(Y,$),Z=Math.max(0,Y-$)*Q;if(X!=null)Z+=H*X;return Z}if(X!=null)return Y*X;return 0},b=A(_.input_tokens,z.input_cost_per_token,z.input_cost_per_token_above_200k_tokens),G=A(_.output_tokens,z.output_cost_per_token,z.output_cost_per_token_above_200k_tokens),J=A(_.cache_read_input_tokens,z.cache_read_input_token_cost,z.cache_read_input_token_cost_above_200k_tokens);return b+G+J}var Cj="https://raw.githubusercontent.com/BerriAI/litellm/main/model_prices_and_context_window.json",vj=200000,yj=U.object({input_cost_per_token:U.number().optional(),output_cost_per_token:U.number().optional(),cache_creation_input_token_cost:U.number().optional(),cache_read_input_token_cost:U.number().optional(),max_tokens:U.number().optional(),max_input_tokens:U.number().optional(),max_output_tokens:U.number().optional(),input_cost_per_token_above_200k_tokens:U.number().optional(),output_cost_per_token_above_200k_tokens:U.number().optional(),cache_creation_input_token_cost_above_200k_tokens:U.number().optional(),cache_read_input_token_cost_above_200k_tokens:U.number().optional(),input_cost_per_token_above_128k_tokens:U.number().optional(),output_cost_per_token_above_128k_tokens:U.number().optional()}),gj=["anthropic/","claude-3-5-","claude-3-","claude-","openai/","azure/","openrouter/openai/"];function fj(_){if(_!=null)return _;return{debug:()=>{},error:()=>{},info:()=>{},warn:()=>{}}}class r0{cachedPricing=null;logger;offline;offlineLoader;url;providerPrefixes;constructor(_={}){this.logger=fj(_.logger),this.offline=Boolean(_.offline),this.offlineLoader=_.offlineLoader,this.url=_.url??Cj,this.providerPrefixes=_.providerPrefixes??gj}[Symbol.dispose](){this.clearCache()}clearCache(){this.cachedPricing=null}async loadOfflinePricing(){if(this.offlineLoader==null)throw Error("Offline loader was not provided");let _=new Map(Object.entries(await this.offlineLoader()));return this.cachedPricing=_,_}async fetchRemotePricing(){this.logger.warn("Fetching latest model pricing from LiteLLM...");let _=await fetch(this.url);if(!_.ok)throw Error(`Failed to fetch pricing data: ${_.statusText}`);let z=await _.json(),A=new Map;for(let[b,G]of Object.entries(z)){if(typeof G!=="object"||G==null)continue;let J=yj.safeParse(G);if(!J.success)continue;A.set(b,J.data)}return this.cachedPricing=A,this.logger.info(`Loaded pricing for ${A.size} models`),A}async ensurePricingLoaded(){if(this.cachedPricing!=null)return this.cachedPricing;if(this.offline)return this.loadOfflinePricing();try{return await this.fetchRemotePricing()}catch(_){if(this.logger.warn("Failed to fetch model pricing from LiteLLM, falling back to offline loader (if available)."),this.offlineLoader!=null)return this.loadOfflinePricing();throw _}}async fetchModelPricing(){return this.ensurePricingLoaded()}createMatchingCandidates(_){let z=new Set;z.add(_);for(let A of this.providerPrefixes)z.add(`${A}${_}`);return Array.from(z)}async getModelPricing(_){let z=await this.ensurePricingLoaded();for(let b of this.createMatchingCandidates(_)){let G=z.get(b);if(G!=null)return G}let A=_.toLowerCase();for(let[b,G]of z){let J=b.toLowerCase();if(J.includes(A)||A.includes(J))return G}return null}async getModelContextLimit(_){return(await this.getModelPricing(_))?.max_input_tokens??null}calculateCostFromPricing(_,z){let A=(X,Q,$,H=vj)=>{if(X==null||X<=0)return 0;if(X>H&&$!=null){let B=Math.min(X,H),F=Math.max(0,X-H)*$;if(Q!=null)F+=B*Q;return F}if(Q!=null)return X*Q;return 0},b=A(_.input_tokens,z.input_cost_per_token,z.input_cost_per_token_above_200k_tokens),G=A(_.output_tokens,z.output_cost_per_token,z.output_cost_per_token_above_200k_tokens),J=A(_.cache_creation_input_tokens,z.cache_creation_input_token_cost,z.cache_creation_input_token_cost_above_200k_tokens),Y=A(_.cache_read_input_tokens,z.cache_read_input_token_cost,z.cache_read_input_token_cost_above_200k_tokens);return b+G+J+Y}async calculateCostFromTokens(_,z){if(z==null||z==="")return 0;let A=await this.getModelPricing(z);if(A==null)throw Error(`Model pricing not found for ${z}`);return this.calculateCostFromPricing(_,A)}}async function BX(_={}){let z=_.serverUrl??process.env.VI_SERVER_URL??"http://localhost:3000",A=_.authToken??null,b=_.timeoutMs??1e4;try{let G=await fetch(`${z}/api/transcripts`,{method:"GET",headers:{...A&&{Authorization:`Bearer ${A}`}},signal:AbortSignal.timeout(b)});if(!G.ok)return console.error(`Failed to fetch transcript metadata: ${G.status} ${G.statusText}`),[];let J=await G.json();if(hj(J))return J.transcripts;return console.error("Transcript metadata response had unexpected shape:",J),[]}catch(G){if(G instanceof Error)console.error("Failed to fetch transcript metadata:",G.message);return[]}}function hj(_){if(typeof _!=="object"||_===null||!("transcripts"in _))return!1;let{transcripts:z}=_;if(!Array.isArray(z))return!1;return z.every((A)=>{if(typeof A!=="object"||A===null)return!1;let b=A;return typeof b.transcriptId==="string"&&b.transcriptId.length>0&&typeof b.sha256==="string"&&b.sha256.length>0&&typeof b.repoId==="string"&&b.repoId.length>0})}var ZX=[{name:"OpenAI API Key",regex:"sk-[a-zA-Z0-9]{20,}"},{name:"OpenAI Project Key",regex:"sk-proj-[a-zA-Z0-9\\-_]{20,}"},{name:"Anthropic API Key",regex:"sk-ant-[a-zA-Z0-9\\-_]{20,}"},{name:"Cohere API Key",regex:"co-[a-zA-Z0-9]{40,}"},{name:"HuggingFace Token",regex:"hf_[a-zA-Z0-9]{34,}"},{name:"Replicate API Token",regex:"r8_[a-zA-Z0-9]{40}"},{name:"JWT Token",regex:"eyJ[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]+\\.[A-Za-z0-9-_.+/=]*"},{name:"OAuth Client Secret",regex:`(?i)client_secret['"\\s:=]+[a-zA-Z0-9\\-_.~]{10,100}`},{name:"OAuth Client ID",regex:`(?i)client_id['"\\s:=]+[a-zA-Z0-9\\-_.~]{10,100}`},{name:"Bearer Token",regex:"Bearer\\s+[a-zA-Z0-9\\-._~+/]+=*"},{name:"Authorization Bearer",regex:"(?i)authorization:\\s*Bearer\\s+[a-zA-Z0-9\\-._~+/]+=*"},{name:"Google OAuth Access Token",regex:"ya29\\.[0-9A-Za-z\\-_]+"},{name:"GitHub Fine-Grained Token",regex:"github_pat_[0-9a-zA-Z_]{20,}"},{name:"GitHub OAuth App Secret",regex:`[g|G][i|I][t|T][h|H][u|U][b|B].*['|"][0-9a-zA-Z]{35,40}['|"]`},{name:"GitLab PAT",regex:"glpat-[a-zA-Z0-9_-]{16,}"},{name:"GitLab Runner Token",regex:"glrt-[a-zA-Z0-9_-]{16,}"},{name:"MongoDB URI",regex:`mongodb(\\+srv)?:\\/\\/[^\\s'"]+`},{name:"PostgreSQL URI",regex:`postgres(?:ql)?:\\/\\/[^\\s'"]+`},{name:"MySQL URI",regex:`mysql:\\/\\/[^\\s'"]+`},{name:"Redis URI",regex:`redis:\\/\\/[^\\s'"]+`},{name:"JDBC URL",regex:`jdbc:\\w+:\\/\\/[^\\s'"]+`},{name:"Password in URL",regex:`[a-zA-Z]{3,10}://[^/\\s:@]{3,20}:[^/\\s:@]{3,20}@.{1,100}["'\\s]`},{name:"DigitalOcean Token",regex:"dop_v1_[a-z0-9]{64}"},{name:"CircleCI Token",regex:"circle-token=[a-z0-9]{40}"},{name:"New Relic Key",regex:"NRII-[a-zA-Z0-9]{20,}"},{name:"Sentry DSN",regex:"https:\\/\\/[a-zA-Z0-9]+@[a-z]+\\.ingest\\.sentry\\.io\\/\\d+"},{name:"Cloudinary URL",regex:"cloudinary:\\/\\/[0-9]{15}:[a-zA-Z0-9]+@[a-zA-Z]+"},{name:"Discord Bot Token",regex:"[MN][A-Za-z\\d]{23}\\.[\\w-]{6}\\.[\\w-]{27}"},{name:"Discord Webhook",regex:"https:\\/\\/discord(?:app)?\\.com\\/api\\/webhooks\\/[0-9]+\\/[a-zA-Z0-9_-]+"},{name:"Telegram Bot Token",regex:"\\d{9}:[a-zA-Z0-9_-]{35}"},{name:"Microsoft Teams Webhook",regex:"https:\\/\\/[a-z]+\\.webhook\\.office\\.com\\/webhookb2\\/[a-zA-Z0-9@\\-]+\\/.*"},{name:"Stripe Publishable Key",regex:"pk_live_[0-9a-zA-Z]{24}"},{name:"PayPal Braintree Token",regex:"access_token\\$production\\$[0-9a-z]{16}\\$[0-9a-f]{32}"},{name:"Square Access Token",regex:"sq0atp-[0-9A-Za-z\\-_]{22}"},{name:"Square OAuth Secret",regex:"sq0csp-[0-9A-Za-z\\-_]{43}"},{name:"SendGrid API Key",regex:"SG\\.[\\w\\d\\-_]{22}\\.[\\w\\d\\-_]{43}"},{name:"Mailgun API Key",regex:"key-[0-9a-zA-Z]{32}"},{name:"MailChimp API Key",regex:"[0-9a-f]{32}-us[0-9]{1,2}"},{name:"Shopify Access Token",regex:"shpat_[0-9a-fA-F]{32}"},{name:"Dropbox Access Token",regex:"sl\\.[A-Za-z0-9_-]{20,100}"},{name:"Asana Token",regex:"0\\/[0-9a-z]{32}"},{name:"Linear API Key",regex:"lin_api_[a-zA-Z0-9]{40}"},{name:"Riot Games API Key",regex:"RGAPI-[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}"},{name:"Generic API Key",regex:`(?i)(api[_-]?key)['"\\s:=]+[a-zA-Z0-9\\-_.]{16,}`},{name:"Generic Secret",regex:`(?i)(secret|password|passwd|pwd)['"\\s:=]+[^\\s'"]{8,}`},{name:"Generic Token",regex:`(?i)(token)['"\\s:=]+[a-zA-Z0-9\\-_.]{16,}`},{name:"Private Key Block",regex:"-----BEGIN (RSA|DSA|EC|OPENSSH|PGP)?\\s*PRIVATE\\s+KEY"},{name:"Certificate Block",regex:"-----BEGIN CERTIFICATE-----"},{name:"AWS API Gateway",regex:"[0-9a-z]+.execute-api.[0-9a-z._-]+.amazonaws.com"},{name:"AWS API Key",regex:"AKIA[0-9A-Z]{16}"},{name:"AWS ARN",regex:"arn:aws:[a-z0-9-]+:[a-z]{2}-[a-z]+-[0-9]+:[0-9]+:.+"},{name:"AWS Access Key ID Value",regex:"(A3T[A-Z0-9]|AKIA|AGPA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}"},{name:"AWS AppSync GraphQL Key",regex:"da2-[a-z0-9]{26}"},{name:"AWS EC2 External",regex:"ec2-[0-9a-z._-]+.compute(-1)?.amazonaws.com"},{name:"AWS EC2 Internal",regex:"[0-9a-z._-]+.compute(-1)?.internal"},{name:"AWS ELB",regex:"[0-9a-z._-]+.elb.amazonaws.com"},{name:"AWS ElasticCache",regex:"[0-9a-z._-]+.cache.amazonaws.com"},{name:"AWS MWS ID",regex:"mzn\\.mws\\.[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"},{name:"AWS MWS key",regex:"amzn\\.mws\\.[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"},{name:"AWS RDS",regex:"[0-9a-z._-]+.rds.amazonaws.com"},{name:"AWS S3 Bucket",regex:"s3://[0-9a-z._/-]+"},{name:"AWS client ID",regex:"(A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}"},{name:"AWS cred file info",regex:"(aws_access_key_id|aws_secret_access_key)"},{name:"Abbysale",regex:"(?:abbysale).{0,40}\\b([a-z0-9A-Z]{40})\\b"},{name:"Abstract",regex:"(?:abstract).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Abuseipdb",regex:"(?:abuseipdb).{0,40}\\b([a-z0-9]{80})\\b"},{name:"Accuweather",regex:"(?:accuweather).{0,40}([a-z0-9A-Z\\%]{35})\\b"},{name:"Adafruitio",regex:"\\b(aio\\_[a-zA-Z0-9]{28})\\b"},{name:"Adobeio - 1",regex:"(?:adobe).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Adzuna - 1",regex:"(?:adzuna).{0,40}\\b([a-z0-9]{8})\\b"},{name:"Adzuna - 2",regex:"(?:adzuna).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Aeroworkflow - 1",regex:"(?:aeroworkflow).{0,40}\\b([0-9]{1,})\\b"},{name:"Aeroworkflow - 2",regex:"(?:aeroworkflow).{0,40}\\b([a-zA-Z0-9^!]{20})\\b"},{name:"Agora",regex:"(?:agora).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Airbrakeprojectkey - 1",regex:"(?:airbrake).{0,40}\\b([0-9]{6})\\b"},{name:"Airbrakeprojectkey - 2",regex:"(?:airbrake).{0,40}\\b([a-zA-Z-0-9]{32})\\b"},{name:"Airbrakeuserkey",regex:"(?:airbrake).{0,40}\\b([a-zA-Z-0-9]{40})\\b"},{name:"Airship",regex:"(?:airship).{0,40}\\b([0-9Aa-zA-Z]{91})\\b"},{name:"Airvisual",regex:"(?:airvisual).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Alconost",regex:"(?:alconost).{0,40}\\b([0-9Aa-z]{32})\\b"},{name:"Alegra - 1",regex:"(?:alegra).{0,40}\\b([a-z0-9-]{20})\\b"},{name:"Alegra - 2",regex:"(?:alegra).{0,40}\\b([a-zA-Z0-9.-@]{25,30})\\b"},{name:"Aletheiaapi",regex:"(?:aletheiaapi).{0,40}\\b([A-Z0-9]{32})\\b"},{name:"Algoliaadminkey - 1",regex:"(?:algolia).{0,40}\\b([A-Z0-9]{10})\\b"},{name:"Algoliaadminkey - 2",regex:"(?:algolia).{0,40}\\b([a-zA-Z0-9]{32})\\b"},{name:"Alibaba - 2",regex:"\\b(LTAI[a-zA-Z0-9]{17,21})[\\\"' ;\\s]*"},{name:"Alienvault",regex:"(?:alienvault).{0,40}\\b([a-z0-9]{64})\\b"},{name:"Allsports",regex:"(?:allsports).{0,40}\\b([0-9a-z]{64})\\b"},{name:"Amadeus - 1",regex:"(?:amadeus).{0,40}\\b([0-9A-Za-z]{32})\\b"},{name:"Amadeus - 2",regex:"(?:amadeus).{0,40}\\b([0-9A-Za-z]{16})\\b"},{name:"Amazon SNS Topic",regex:"arn:aws:sns:[a-z0-9\\-]+:[0-9]+:[A-Za-z0-9\\-_]+"},{name:"Ambee",regex:"(?:ambee).{0,40}\\b([0-9a-f]{64})\\b"},{name:"Amplitudeapikey",regex:"(?:amplitude).{0,40}\\b([a-f0-9]{32})"},{name:"Apacta",regex:"(?:apacta).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Api2cart",regex:"(?:api2cart).{0,40}\\b([0-9a-f]{32})\\b"},{name:"Apideck - 1",regex:"\\b(sk_live_[a-z0-9A-Z-]{93})\\b"},{name:"Apideck - 2",regex:"(?:apideck).{0,40}\\b([a-z0-9A-Z]{40})\\b"},{name:"Apiflash - 1",regex:"(?:apiflash).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Apiflash - 2",regex:"(?:apiflash).{0,40}\\b([a-zA-Z0-9\\S]{21,30})\\b"},{name:"Apifonica",regex:"(?:apifonica).{0,40}\\b([0-9a-z]{11}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12})\\b"},{name:"Apify",regex:"\\b(apify\\_api\\_[a-zA-Z-0-9]{36})\\b"},{name:"Apimatic - 1",regex:"(?:apimatic).{0,40}\\b([a-z0-9-\\S]{8,32})\\b"},{name:"Apimatic - 2",regex:"(?:apimatic).{0,40}\\b([a-zA-Z0-9]{3,20}@[a-zA-Z0-9]{2,12}.[a-zA-Z0-9]{2,5})\\b"},{name:"Apiscience",regex:"(?:apiscience).{0,40}\\b([a-bA-Z0-9\\S]{22})\\b"},{name:"Apollo",regex:"(?:apollo).{0,40}\\b([a-zA-Z0-9]{22})\\b"},{name:"Appcues - 1",regex:"(?:appcues).{0,40}\\b([0-9]{5})\\b"},{name:"Appcues - 2",regex:"(?:appcues).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Appcues - 3",regex:"(?:appcues).{0,40}\\b([a-z0-9-]{39})\\b"},{name:"Appfollow",regex:"(?:appfollow).{0,40}\\b([0-9A-Za-z]{20})\\b"},{name:"Appsynergy",regex:"(?:appsynergy).{0,40}\\b([a-z0-9]{64})\\b"},{name:"Apptivo - 1",regex:"(?:apptivo).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Apptivo - 2",regex:"(?:apptivo).{0,40}\\b([a-zA-Z0-9-]{32})\\b"},{name:"Artifactory - 2",regex:"\\b([A-Za-z0-9](?:[A-Za-z0-9\\-]{0,61}[A-Za-z0-9])\\.jfrog\\.io)"},{name:"Artifactory API Token",regex:'(?:\\s|=|:|"|^)AKC[a-zA-Z0-9]{10,}'},{name:"Artifactory Password",regex:'(?:\\s|=|:|"|^)AP[\\dABCDEF][a-zA-Z0-9]{8,}'},{name:"Artsy - 1",regex:"(?:artsy).{0,40}\\b([0-9a-zA-Z]{20})\\b"},{name:"Artsy - 2",regex:"(?:artsy).{0,40}\\b([0-9a-zA-Z]{32})\\b"},{name:"Asanaoauth",regex:"(?:asana).{0,40}\\b([a-z\\/:0-9]{51})\\b"},{name:"Asanapersonalaccesstoken",regex:"(?:asana).{0,40}\\b([0-9]{1,}\\/[0-9]{16,}:[A-Za-z0-9]{32,})\\b"},{name:"Assemblyai",regex:"(?:assemblyai).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Asymmetric Private Key",regex:"-----BEGIN ((EC|PGP|DSA|RSA|OPENSSH) )?PRIVATE KEY( BLOCK)?-----"},{name:"Audd",regex:"(?:audd).{0,40}\\b([a-z0-9-]{32})\\b"},{name:"Auth0managementapitoken",regex:"(?:auth0).{0,40}\\b(ey[a-zA-Z0-9._-]+)\\b"},{name:"Auth0oauth - 1",regex:"(?:auth0).{0,40}\\b([a-zA-Z0-9_-]{32,60})\\b"},{name:"Autodesk - 1",regex:"(?:autodesk).{0,40}\\b([0-9A-Za-z]{32})\\b"},{name:"Autodesk - 2",regex:"(?:autodesk).{0,40}\\b([0-9A-Za-z]{16})\\b"},{name:"Autoklose",regex:"(?:autoklose).{0,40}\\b([a-zA-Z0-9-]{32})\\b"},{name:"Autopilot",regex:"(?:autopilot).{0,40}\\b([0-9a-f]{32})\\b"},{name:"Avazapersonalaccesstoken",regex:"(?:avaza).{0,40}\\b([0-9]+-[0-9a-f]{40})\\b"},{name:"Aviationstack",regex:"(?:aviationstack).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Aws - 1",regex:"\\b((?:AKIA|ABIA|ACCA|ASIA)[0-9A-Z]{16})\\b"},{name:"Axonaut",regex:"(?:axonaut).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Aylien - 1",regex:"(?:aylien).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Aylien - 2",regex:"(?:aylien).{0,40}\\b([a-z0-9]{8})\\b"},{name:"Ayrshare",regex:"(?:ayrshare).{0,40}\\b([A-Z]{7}-[A-Z0-9]{7}-[A-Z0-9]{7}-[A-Z0-9]{7})\\b"},{name:"Bannerbear",regex:"(?:bannerbear).{0,40}\\b([0-9a-zA-Z]{22}tt)\\b"},{name:"Baremetrics",regex:"(?:baremetrics).{0,40}\\b([a-zA-Z0-9_]{25})\\b"},{name:"Baseapiio",regex:"(?:baseapi|base-api).{0,40}\\b([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\\b"},{name:"Beamer",regex:"(?:beamer).{0,40}\\b([a-zA-Z0-9_+/]{45}=)"},{name:"Beebole",regex:"(?:beebole).{0,40}\\b([0-9a-z]{40})\\b"},{name:"Besttime",regex:"(?:besttime).{0,40}\\b([0-9A-Za-z_]{36})\\b"},{name:"Billomat - 1",regex:"(?:billomat).{0,40}\\b([0-9a-z]{1,})\\b"},{name:"Billomat - 2",regex:"(?:billomat).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Bitbar",regex:"(?:bitbar).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Bitcoinaverage",regex:"(?:bitcoinaverage).{0,40}\\b([a-zA-Z0-9]{43})\\b"},{name:"Bitfinex",regex:"(?:bitfinex).{0,40}\\b([A-Za-z0-9_-]{43})\\b"},{name:"Bitly Secret Key",regex:"R_[0-9a-f]{32}"},{name:"Bitlyaccesstoken",regex:"(?:bitly).{0,40}\\b([a-zA-Z-0-9]{40})\\b"},{name:"Bitmex - 1",regex:"(?:bitmex).{0,40}([ \\r\\n]{1}[0-9a-zA-Z\\-\\_]{24}[ \\r\\n]{1})"},{name:"Bitmex - 2",regex:"(?:bitmex).{0,40}([ \\r\\n]{1}[0-9a-zA-Z\\-\\_]{48}[ \\r\\n]{1})"},{name:"Blablabus",regex:"(?:blablabus).{0,40}\\b([0-9A-Za-z]{22})\\b"},{name:"Blazemeter",regex:"(?:blazemeter|runscope).{0,40}\\b([0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12})\\b"},{name:"Blitapp",regex:"(?:blitapp).{0,40}\\b([a-zA-Z0-9_-]{39})\\b"},{name:"Blogger",regex:"(?:blogger).{0,40}\\b([0-9A-Za-z-]{39})\\b"},{name:"Bombbomb",regex:"(?:bombbomb).{0,40}\\b([a-zA-Z0-9-._]{704})\\b"},{name:"Boostnote",regex:"(?:boostnote).{0,40}\\b([0-9a-f]{64})\\b"},{name:"Borgbase",regex:"(?:borgbase).{0,40}\\b([a-zA-Z0-9/_.-]{148,152})\\b"},{name:"Braintree API Key",regex:"access_token$production$[0-9a-z]{16}$[0-9a-f]{32}"},{name:"Brandfetch",regex:"(?:brandfetch).{0,40}\\b([0-9A-Za-z]{40})\\b"},{name:"Browshot",regex:"(?:browshot).{0,40}\\b([a-zA-Z-0-9]{28})\\b"},{name:"Buddyns",regex:"(?:buddyns).{0,40}\\b([0-9a-z]{40})\\b"},{name:"Bugherd",regex:"(?:bugherd).{0,40}\\b([0-9a-z]{22})\\b"},{name:"Bugsnag",regex:"(?:bugsnag).{0,40}\\b([0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12})\\b"},{name:"Buildkite",regex:"(?:buildkite).{0,40}\\b([a-z0-9]{40})\\b"},{name:"Bulbul",regex:"(?:bulbul).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Buttercms",regex:"(?:buttercms).{0,40}\\b([a-z0-9]{40})\\b"},{name:"Caflou",regex:"(?:caflou).{0,40}\\b([a-bA-Z0-9\\S]{155})\\b"},{name:"Calendarific",regex:"(?:calendarific).{0,40}\\b([a-z0-9]{40})\\b"},{name:"Calendlyapikey",regex:"(?:calendly).{0,40}\\b([a-zA-Z-0-9]{20}.[a-zA-Z-0-9]{171}.[a-zA-Z-0-9_]{43})\\b"},{name:"Calorieninja",regex:"(?:calorieninja).{0,40}\\b([0-9A-Za-z]{40})\\b"},{name:"Campayn",regex:"(?:campayn).{0,40}\\b([a-z0-9]{64})\\b"},{name:"Cannyio",regex:"(?:canny).{0,40}\\b([a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[0-9]{4}-[a-z0-9]{12})\\b"},{name:"Capsulecrm",regex:"(?:capsulecrm).{0,40}\\b([a-zA-Z0-9-._+=]{64})\\b"},{name:"Captaindata - 1",regex:"(?:captaindata).{0,40}\\b([0-9a-f]{8}\\-[0-9a-f]{4}\\-[0-9a-f]{4}\\-[0-9a-f]{4}\\-[0-9a-f]{12})\\b"},{name:"Captaindata - 2",regex:"(?:captaindata).{0,40}\\b([0-9a-f]{64})\\b"},{name:"Carboninterface",regex:"(?:carboninterface).{0,40}\\b([a-zA-Z0-9]{21})\\b"},{name:"Cashboard - 1",regex:"(?:cashboard).{0,40}\\b([0-9A-Z]{3}-[0-9A-Z]{3}-[0-9A-Z]{3}-[0-9A-Z]{3})\\b"},{name:"Cashboard - 2",regex:"(?:cashboard).{0,40}\\b([0-9a-z]{1,})\\b"},{name:"Caspio - 1",regex:"(?:caspio).{0,40}\\b([a-z0-9]{8})\\b"},{name:"Caspio - 2",regex:"(?:caspio).{0,40}\\b([a-z0-9]{50})\\b"},{name:"Censys - 1",regex:"(?:censys).{0,40}\\b([a-zA-Z0-9]{32})\\b"},{name:"Censys - 2",regex:"(?:censys).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Centralstationcrm",regex:"(?:centralstation).{0,40}\\b([a-z0-9]{30})\\b"},{name:"Cexio - 1",regex:"(?:cexio|cex.io).{0,40}\\b([a-z]{2}[0-9]{9})\\b"},{name:"Cexio - 2",regex:"(?:cexio|cex.io).{0,40}\\b([0-9A-Za-z]{24,27})\\b"},{name:"Chatbot",regex:"(?:chatbot).{0,40}\\b([a-zA-Z0-9_]{32})\\b"},{name:"Chatfule",regex:"(?:chatfuel).{0,40}\\b([a-zA-Z0-9]{128})\\b"},{name:"Checio",regex:"(?:checio).{0,40}\\b(pk_[a-z0-9]{45})\\b"},{name:"Checklyhq",regex:"(?:checklyhq).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Checkout - 1",regex:"(?:checkout).{0,40}\\b((sk_|sk_test_)[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})\\b"},{name:"Checkout - 2",regex:"(?:checkout).{0,40}\\b(cus_[0-9a-zA-Z]{26})\\b"},{name:"Checkvist - 1",regex:"(?:checkvist).{0,40}\\b([\\w\\.-]+@[\\w-]+\\.[\\w\\.-]{2,5})\\b"},{name:"Checkvist - 2",regex:"(?:checkvist).{0,40}\\b([0-9a-zA-Z]{14})\\b"},{name:"Cicero",regex:"(?:cicero).{0,40}\\b([0-9a-z]{40})\\b"},{name:"Circleci",regex:"(?:circle).{0,40}([a-fA-F0-9]{40})"},{name:"Clearbit",regex:"(?:clearbit).{0,40}\\b([0-9a-z_]{35})\\b"},{name:"Clickhelp - 1",regex:"\\b([0-9A-Za-z]{3,20}.try.clickhelp.co)\\b"},{name:"Clickhelp - 2",regex:"(?:clickhelp).{0,40}\\b([0-9A-Za-z]{24})\\b"},{name:"Clicksendsms - 2",regex:"(?:sms).{0,40}\\b([a-zA-Z0-9]{3,20}@[a-zA-Z0-9]{2,12}.[a-zA-Z0-9]{2,5})\\b"},{name:"Clickuppersonaltoken",regex:"(?:clickup).{0,40}\\b(pk_[0-9]{8}_[0-9A-Z]{32})\\b"},{name:"Cliengo",regex:"(?:cliengo).{0,40}\\b([0-9a-f]{8}\\-[0-9a-f]{4}\\-[0-9a-f]{4}\\-[0-9a-f]{4}\\-[0-9a-f]{12})\\b"},{name:"Clinchpad",regex:"(?:clinchpad).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Clockify",regex:"(?:clockify).{0,40}\\b([a-zA-Z0-9]{48})\\b"},{name:"Clockworksms - 1",regex:"(?:clockwork|textanywhere).{0,40}\\b([0-9a-zA-Z]{24})\\b"},{name:"Clockworksms - 2",regex:"(?:clockwork|textanywhere).{0,40}\\b([0-9]{5})\\b"},{name:"Closecrm",regex:"\\b(api_[a-z0-9A-Z.]{45})\\b"},{name:"Cloudelements - 1",regex:"(?:cloudelements).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Cloudelements - 2",regex:"(?:cloudelements).{0,40}\\b([a-zA-Z0-9]{43})\\b"},{name:"Cloudflareapitoken",regex:"(?:cloudflare).{0,40}\\b([A-Za-z0-9_-]{40})\\b"},{name:"Cloudflarecakey",regex:"(?:cloudflare).{0,40}\\b(v[A-Za-z0-9._-]{173,})\\b"},{name:"Cloudimage",regex:"(?:cloudimage).{0,40}\\b([a-z0-9_]{30})\\b"},{name:"Cloudinary Credentials",regex:"cloudinary://[0-9]+:[A-Za-z0-9\\-_\\.]+@[A-Za-z0-9\\-_\\.]+"},{name:"Cloudmersive",regex:"(?:cloudmersive).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Cloudplan",regex:"(?:cloudplan).{0,40}\\b([A-Z0-9-]{32})\\b"},{name:"Cloverly",regex:"(?:cloverly).{0,40}\\b([a-z0-9:_]{28})\\b"},{name:"Cloze - 1",regex:"(?:cloze).{0,40}\\b([0-9a-f]{32})\\b"},{name:"Cloze - 2",regex:"(?:cloze).{0,40}\\b([\\w\\.-]+@[\\w-]+\\.[\\w\\.-]{2,5})\\b"},{name:"Clustdoc",regex:"(?:clustdoc).{0,40}\\b([0-9a-zA-Z]{60})\\b"},{name:"Codacy",regex:"(?:codacy).{0,40}\\b([0-9A-Za-z]{20})\\b"},{name:"Coinapi",regex:"(?:coinapi).{0,40}\\b([A-Z0-9-]{36})\\b"},{name:"Coinbase",regex:"(?:coinbase).{0,40}\\b([a-zA-Z-0-9]{64})\\b"},{name:"Coinlayer",regex:"(?:coinlayer).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Coinlib",regex:"(?:coinlib).{0,40}\\b([a-z0-9]{16})\\b"},{name:"Column",regex:"(?:column).{0,40}\\b((?:test|live)_[a-zA-Z0-9]{27})\\b"},{name:"Commercejs",regex:"(?:commercejs).{0,40}\\b([a-z0-9_]{48})\\b"},{name:"Commodities",regex:"(?:commodities).{0,40}\\b([a-zA-Z0-9]{60})\\b"},{name:"Companyhub - 1",regex:"(?:companyhub).{0,40}\\b([0-9a-zA-Z]{20})\\b"},{name:"Companyhub - 2",regex:"(?:companyhub).{0,40}\\b([a-zA-Z0-9$%^=-]{4,32})\\b"},{name:"Confluent - 1",regex:"(?:confluent).{0,40}\\b([a-zA-Z-0-9]{16})\\b"},{name:"Confluent - 2",regex:"(?:confluent).{0,40}\\b([a-zA-Z-0-9]{64})\\b"},{name:"Convertkit",regex:"(?:convertkit).{0,40}\\b([a-z0-9A-Z_]{22})\\b"},{name:"Convier",regex:"(?:convier).{0,40}\\b([0-9]{2}\\|[a-zA-Z0-9]{40})\\b"},{name:"Copper - 2",regex:"(?:copper).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Countrylayer",regex:"(?:countrylayer).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Courier",regex:"(?:courier).{0,40}\\b(pk\\_[a-zA-Z0-9]{1,}\\_[a-zA-Z0-9]{28})\\b"},{name:"Coveralls",regex:"(?:coveralls).{0,40}\\b([a-zA-Z0-9-]{37})\\b"},{name:"Crowdin",regex:"(?:crowdin).{0,40}\\b([0-9A-Za-z]{80})\\b"},{name:"Cryptocompare",regex:"(?:cryptocompare).{0,40}\\b([a-z-0-9]{64})\\b"},{name:"Currencycloud - 1",regex:"(?:currencycloud).{0,40}\\b([0-9a-z]{64})\\b"},{name:"Currencyfreaks",regex:"(?:currencyfreaks).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Currencylayer",regex:"(?:currencylayer).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Currencyscoop",regex:"(?:currencyscoop).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Currentsapi",regex:"(?:currentsapi).{0,40}\\b([a-zA-Z0-9\\S]{48})\\b"},{name:"Customerguru - 1",regex:"(?:guru).{0,40}\\b([a-z0-9A-Z]{50})\\b"},{name:"Customerguru - 2",regex:"(?:guru).{0,40}\\b([a-z0-9A-Z]{30})\\b"},{name:"Customerio",regex:"(?:customer).{0,40}\\b([a-z0-9A-Z]{20})\\b"},{name:"D7network",regex:"(?:d7network).{0,40}\\b([a-zA-Z0-9\\W\\S]{23}\\=)"},{name:"Dailyco",regex:"(?:daily).{0,40}\\b([0-9a-f]{64})\\b"},{name:"Dandelion",regex:"(?:dandelion).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Databricks",regex:"dapi[a-f0-9]{32}\\b"},{name:"Datadogtoken - 1",regex:"(?:datadog).{0,40}\\b([a-zA-Z-0-9]{32})\\b"},{name:"Datadogtoken - 2",regex:"(?:datadog).{0,40}\\b([a-zA-Z-0-9]{40})\\b"},{name:"Datafire",regex:"(?:datafire).{0,40}\\b([a-z0-9\\S]{175,190})\\b"},{name:"Datagov",regex:"(?:data.gov).{0,40}\\b([a-zA-Z0-9]{40})\\b"},{name:"Debounce",regex:"(?:debounce).{0,40}\\b([a-zA-Z0-9]{13})\\b"},{name:"Deepai",regex:"(?:deepai).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Deepgram",regex:"(?:deepgram).{0,40}\\b([0-9a-z]{40})\\b"},{name:"Delighted",regex:"(?:delighted).{0,40}\\b([a-z0-9A-Z]{32})\\b"},{name:"Deputy - 1",regex:"\\b([0-9a-z]{1,}.as.deputy.com)\\b"},{name:"Deputy - 2",regex:"(?:deputy).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Detectlanguage",regex:"(?:detectlanguage).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Dfuse",regex:"\\b(web\\_[0-9a-z]{32})\\b"},{name:"Diffbot",regex:"(?:diffbot).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Digitaloceantoken",regex:"(?:digitalocean).{0,40}\\b([A-Za-z0-9_-]{64})\\b"},{name:"Discordbottoken - 1",regex:"(?:discord).{0,40}\\b([A-Za-z0-9_-]{24}\\.[A-Za-z0-9_-]{6}\\.[A-Za-z0-9_-]{27})\\b"},{name:"Discordbottoken - 2",regex:"(?:discord).{0,40}\\b([0-9]{17})\\b"},{name:"Discordwebhook",regex:"(https:\\/\\/discord.com\\/api\\/webhooks\\/[0-9]{18}\\/[0-9a-zA-Z-]{68})"},{name:"Ditto",regex:"(?:ditto).{0,40}\\b([a-z0-9]{8}\\-[a-z0-9]{4}\\-[a-z0-9]{4}\\-[a-z0-9]{4}\\-[a-z0-9]{12}\\.[a-z0-9]{40})\\b"},{name:"Dnscheck - 1",regex:"(?:dnscheck).{0,40}\\b([a-z0-9A-Z-]{36})\\b"},{name:"Dnscheck - 2",regex:"(?:dnscheck).{0,40}\\b([a-z0-9A-Z]{32})\\b"},{name:"Documo",regex:"\\b(ey[a-zA-Z0-9]{34}.ey[a-zA-Z0-9]{154}.[a-zA-Z0-9_-]{43})\\b"},{name:"Doppler",regex:"\\b(dp\\.pt\\.[a-zA-Z0-9]{43})\\b"},{name:"Dotmailer - 1",regex:"(?:dotmailer).{0,40}\\b(apiuser-[a-z0-9]{12}@apiconnector.com)\\b"},{name:"Dotmailer - 2",regex:"(?:dotmailer).{0,40}\\b([a-zA-Z0-9\\S]{8,24})\\b"},{name:"Dovico",regex:"(?:dovico).{0,40}\\b([0-9a-z]{32}\\.[0-9a-z]{1,}\\b)"},{name:"Dronahq",regex:"(?:dronahq).{0,40}\\b([a-z0-9]{50})\\b"},{name:"Droneci",regex:"(?:droneci).{0,40}\\b([a-zA-Z0-9]{32})\\b"},{name:"Dropbox",regex:"\\b(sl\\.[A-Za-z0-9\\-\\_]{130,140})\\b"},{name:"Dwolla",regex:"(?:dwolla).{0,40}\\b([a-zA-Z-0-9]{50})\\b"},{name:"Dynalist",regex:"(?:dynalist).{0,40}\\b([a-zA-Z0-9-_]{128})\\b"},{name:"Dynatrace token",regex:"dt0[a-zA-Z]{1}[0-9]{2}\\.[A-Z0-9]{24}\\.[A-Z0-9]{64}"},{name:"Dyspatch",regex:"(?:dyspatch).{0,40}\\b([A-Z0-9]{52})\\b"},{name:"EC",regex:"-----BEGIN EC PRIVATE KEY-----"},{name:"Eagleeyenetworks - 1",regex:"(?:eagleeyenetworks).{0,40}\\b([a-zA-Z0-9]{3,20}@[a-zA-Z0-9]{2,12}.[a-zA-Z0-9]{2,5})\\b"},{name:"Eagleeyenetworks - 2",regex:"(?:eagleeyenetworks).{0,40}\\b([a-zA-Z0-9]{15})\\b"},{name:"Easyinsight - 1",regex:"(?:easyinsight|easy-insight).{0,40}\\b([a-zA-Z0-9]{20})\\b"},{name:"Easyinsight - 2",regex:"(?:easyinsight|easy-insight).{0,40}\\b([0-9Aa-zA-Z]{20})\\b"},{name:"Edamam - 1",regex:"(?:edamam).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Edamam - 2",regex:"(?:edamam).{0,40}\\b([0-9a-z]{8})\\b"},{name:"Edenai",regex:"(?:edenai).{0,40}\\b([a-zA-Z0-9]{36}.[a-zA-Z0-9]{92}.[a-zA-Z0-9_]{43})\\b"},{name:"Eightxeight - 1",regex:"(?:8x8).{0,40}\\b([a-zA-Z0-9_]{18,30})\\b"},{name:"Eightxeight - 2",regex:"(?:8x8).{0,40}\\b([a-zA-Z0-9]{43})\\b"},{name:"Elasticemail",regex:"(?:elastic).{0,40}\\b([A-Za-z0-9_-]{96})\\b"},{name:"Enablex - 1",regex:"(?:enablex).{0,40}\\b([a-zA-Z0-9]{36})\\b"},{name:"Enablex - 2",regex:"(?:enablex).{0,40}\\b([a-z0-9]{24})\\b"},{name:"Enigma",regex:"(?:enigma).{0,40}\\b([a-zA-Z0-9]{40})\\b"},{name:"Ethplorer",regex:"(?:ethplorer).{0,40}\\b([a-z0-9A-Z-]{22})\\b"},{name:"Etsyapikey",regex:"(?:etsy).{0,40}\\b([a-zA-Z-0-9]{24})\\b"},{name:"Everhour",regex:"(?:everhour).{0,40}\\b([0-9Aa-f]{4}-[0-9a-f]{4}-[0-9a-f]{6}-[0-9a-f]{6}-[0-9a-f]{8})\\b"},{name:"Exchangerateapi",regex:"(?:exchangerate).{0,40}\\b([a-z0-9]{24})\\b"},{name:"Exchangeratesapi",regex:"(?:exchangerates).{0,40}\\b([a-z0-9]{32})\\b"},{name:"FCM Server Key",regex:"AAAA[a-zA-Z0-9_-]{7}:[a-zA-Z0-9_-]{140}"},{name:"FCM_server_key",regex:"(AAAA[a-zA-Z0-9_-]{7}:[a-zA-Z0-9_-]{140})"},{name:"Facebook Access Token",regex:"EAACEdEose0cBA[0-9A-Za-z]+"},{name:"Facebook OAuth",regex:`[fF][aA][cC][eE][bB][oO][oO][kK].*['|"][0-9a-f]{32}['|"]`},{name:"Facebookoauth",regex:"(?:facebook).{0,40}\\b([A-Za-z0-9]{32})\\b"},{name:"Faceplusplus",regex:"(?:faceplusplus).{0,40}\\b([0-9a-zA-Z_-]{32})\\b"},{name:"Fakejson",regex:"(?:fakejson).{0,40}\\b([a-zA-Z0-9]{22})\\b"},{name:"Fastforex",regex:"(?:fastforex).{0,40}\\b([a-z0-9-]{28})\\b"},{name:"Fastlypersonaltoken",regex:"(?:fastly).{0,40}\\b([A-Za-z0-9_-]{32})\\b"},{name:"Feedier",regex:"(?:feedier).{0,40}\\b([a-z0-9A-Z]{32})\\b"},{name:"Fetchrss",regex:"(?:fetchrss).{0,40}\\b([0-9A-Za-z.]{40})\\b"},{name:"Figmapersonalaccesstoken",regex:"(?:figma).{0,40}\\b([0-9]{6}-[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12})\\b"},{name:"Fileio",regex:"(?:fileio).{0,40}\\b([A-Z0-9.-]{39})\\b"},{name:"Finage",regex:"\\b(API_KEY[0-9A-Z]{32})\\b"},{name:"Financialmodelingprep",regex:"(?:financialmodelingprep).{0,40}\\b([a-zA-Z0-9]{32})\\b"},{name:"Findl",regex:"(?:findl).{0,40}\\b([a-z0-9]{8}\\-[a-z0-9]{4}\\-[a-z0-9]{4}\\-[a-z0-9]{4}\\-[a-z0-9]{12})\\b"},{name:"Finnhub",regex:"(?:finnhub).{0,40}\\b([0-9a-z]{20})\\b"},{name:"Firebase Database Detect - 1",regex:"[a-z0-9.-]+\\.firebaseio\\.com"},{name:"Firebase Database Detect - 2",regex:"[a-z0-9.-]+\\.firebaseapp\\.com"},{name:"Fixerio",regex:"(?:fixer).{0,40}\\b([A-Za-z0-9]{32})\\b"},{name:"Flatio",regex:"(?:flat).{0,40}\\b([0-9a-z]{128})\\b"},{name:"Fleetbase",regex:"\\b(flb_live_[0-9a-zA-Z]{20})\\b"},{name:"Flickr",regex:"(?:flickr).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Flightapi",regex:"(?:flightapi).{0,40}\\b([a-z0-9]{24})\\b"},{name:"Flightstats - 1",regex:"(?:flightstats).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Flightstats - 2",regex:"(?:flightstats).{0,40}\\b([0-9a-z]{8})\\b"},{name:"Float",regex:"(?:float).{0,40}\\b([a-zA-Z0-9-._+=]{59,60})\\b"},{name:"Flowflu - 2",regex:"(?:flowflu).{0,40}\\b([a-zA-Z0-9]{51})\\b"},{name:"Flutterwave",regex:"\\b(FLWSECK-[0-9a-z]{32}-X)\\b"},{name:"Fmfw - 1",regex:"(?:fmfw).{0,40}\\b([a-zA-Z0-9-]{32})\\b"},{name:"Fmfw - 2",regex:"(?:fmfw).{0,40}\\b([a-zA-Z0-9_-]{32})\\b"},{name:"Formbucket",regex:"(?:formbucket).{0,40}\\b([0-9A-Za-z]{1,}.[0-9A-Za-z]{1,}\\.[0-9A-Z-a-z\\-_]{1,})"},{name:"Formio",regex:"(?:formio).{0,40}\\b(eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9\\.[0-9A-Za-z]{310}\\.[0-9A-Z-a-z\\-_]{43}[ \\r\\n]{1})"},{name:"Foursquare",regex:"(?:foursquare).{0,40}\\b([0-9A-Z]{48})\\b"},{name:"Frameio",regex:"\\b(fio-u-[0-9a-zA-Z_-]{64})\\b"},{name:"Freshbooks - 1",regex:"(?:freshbooks).{0,40}\\b([0-9a-z]{64})\\b"},{name:"Freshbooks - 2",regex:"(?:freshbooks).{0,40}\\b(https://www.[0-9A-Za-z_-]{1,}.com)\\b"},{name:"Freshdesk - 1",regex:"(?:freshdesk).{0,40}\\b([0-9A-Za-z]{20})\\b"},{name:"Freshdesk - 2",regex:"\\b([0-9a-z-]{1,}.freshdesk.com)\\b"},{name:"Front",regex:"(?:front).{0,40}\\b([0-9a-zA-Z]{36}.[0-9a-zA-Z\\.\\-\\_]{188,244})\\b"},{name:"Fulcrum",regex:"(?:fulcrum).{0,40}\\b([a-z0-9]{80})\\b"},{name:"Fullstory",regex:"(?:fullstory).{0,40}\\b([a-zA-Z-0-9/+]{88})\\b"},{name:"Fusebill",regex:"(?:fusebill).{0,40}\\b([a-zA-Z0-9]{88})\\b"},{name:"Fxmarket",regex:"(?:fxmarket).{0,40}\\b([0-9Aa-zA-Z-_=]{20})\\b"},{name:"Gcp",regex:"\\{[^{]+auth_provider_x509_cert_url[^}]+\\}"},{name:"Geckoboard",regex:"(?:geckoboard).{0,40}\\b([a-zA-Z0-9]{44})\\b"},{name:"Generic - 1376",regex:"jdbc:mysql(=| =|:| :)"},{name:"Generic - 1688",regex:"TOKEN[\\\\-|_|A-Z0-9]*(\\'|\\\")?(:|=)(\\'|\\\")?[\\\\-|_|A-Z0-9]{10}"},{name:"Generic - 1689",regex:"API[\\\\-|_|A-Z0-9]*(\\'|\\\")?(:|=)(\\'|\\\")?[\\\\-|_|A-Z0-9]{10}"},{name:"Generic - 1691",regex:"SECRET[\\\\-|_|A-Z0-9]*(\\'|\\\")?(:|=)(\\'|\\\")?[\\\\-|_|A-Z0-9]{10}"},{name:"Generic - 1692",regex:"AUTHORIZATION[\\\\-|_|A-Z0-9]*(\\'|\\\")?(:|=)(\\'|\\\")?[\\\\-|_|A-Z0-9]{10}"},{name:"Generic - 1693",regex:"PASSWORD[\\\\-|_|A-Z0-9]*(\\'|\\\")?(:|=)(\\'|\\\")?[\\\\-|_|A-Z0-9]{10}"},{name:"Generic - 1695",regex:`(A|a)(P|p)(Ii)[\\-|_|A-Za-z0-9]*(\\''|")?( )*(:|=)( )*(\\''|")?[0-9A-Za-z\\-_]+(\\''|")?`},{name:"Generic - 1700",regex:"BEGIN OPENSSH PRIVATE KEY"},{name:"Generic - 1701",regex:"BEGIN PRIVATE KEY"},{name:"Generic - 1702",regex:"BEGIN RSA PRIVATE KEY"},{name:"Generic - 1703",regex:"BEGIN DSA PRIVATE KEY"},{name:"Generic - 1704",regex:"BEGIN EC PRIVATE KEY"},{name:"Generic - 1705",regex:"BEGIN PGP PRIVATE KEY BLOCK"},{name:"Generic - 1707",regex:"[a-z0-9.-]+\\.s3-[a-z0-9-]\\.amazonaws\\.com"},{name:"Generic - 1708",regex:"[a-z0-9.-]+\\.s3-website[.-](eu|ap|us|ca|sa|cn)"},{name:"Generic - 1710",regex:"algolia_api_key"},{name:"Generic - 1711",regex:"asana_access_token"},{name:"Generic - 1713",regex:"azure_tenant"},{name:"Generic - 1714",regex:"bitly_access_token"},{name:"Generic - 1715",regex:"branchio_secret"},{name:"Generic - 1716",regex:"browserstack_access_key"},{name:"Generic - 1717",regex:"buildkite_access_token"},{name:"Generic - 1718",regex:"comcast_access_token"},{name:"Generic - 1719",regex:"datadog_api_key"},{name:"Generic - 1720",regex:"deviantart_secret"},{name:"Generic - 1721",regex:"deviantart_access_token"},{name:"Generic - 1722",regex:"dropbox_api_token"},{name:"Generic - 1723",regex:"facebook_appsecret"},{name:"Generic - 1724",regex:"facebook_access_token"},{name:"Generic - 1725",regex:"firebase_custom_token"},{name:"Generic - 1726",regex:"firebase_id_token"},{name:"Generic - 1727",regex:"github_client"},{name:"Generic - 1728",regex:"github_ssh_key"},{name:"Generic - 1730",regex:"gitlab_private_token"},{name:"Generic - 1731",regex:"google_cm"},{name:"Generic - 1732",regex:"google_maps_key"},{name:"Generic - 1733",regex:"heroku_api_key"},{name:"Generic - 1734",regex:"instagram_access_token"},{name:"Generic - 1735",regex:"mailchimp_api_key"},{name:"Generic - 1736",regex:"mailgun_api_key"},{name:"Generic - 1737",regex:"mailjet"},{name:"Generic - 1738",regex:"mapbox_access_token"},{name:"Generic - 1739",regex:"pagerduty_api_token"},{name:"Generic - 1740",regex:"paypal_key_sb"},{name:"Generic - 1741",regex:"paypal_key_live"},{name:"Generic - 1742",regex:"paypal_token_sb"},{name:"Generic - 1743",regex:"paypal_token_live"},{name:"Generic - 1744",regex:"pendo_integration_key"},{name:"Generic - 1745",regex:"salesforce_access_token"},{name:"Generic - 1746",regex:"saucelabs_ukey"},{name:"Generic - 1747",regex:"sendgrid_api_key"},{name:"Generic - 1748",regex:"slack_api_token"},{name:"Generic - 1749",regex:"slack_webhook"},{name:"Generic - 1750",regex:"square_secret"},{name:"Generic - 1751",regex:"square_auth_token"},{name:"Generic - 1752",regex:"travisci_api_token"},{name:"Generic - 1753",regex:"twilio_sid_token"},{name:"Generic - 1754",regex:"twitter_api_secret"},{name:"Generic - 1755",regex:"twitter_bearer_token"},{name:"Generic - 1756",regex:"spotify_access_token"},{name:"Generic - 1757",regex:"stripe_key_live"},{name:"Generic - 1758",regex:"wakatime_api_key"},{name:"Generic - 1759",regex:"wompi_auth_bearer_sb"},{name:"Generic - 1760",regex:"wompi_auth_bearer_live"},{name:"Generic - 1761",regex:"wpengine_api_key"},{name:"Generic - 1762",regex:"zapier_webhook"},{name:"Generic - 1763",regex:"zendesk_access_token"},{name:"Generic - 1764",regex:"ssh-rsa"},{name:"Generic - 1765",regex:"s3-[a-z0-9-]+\\.amazonaws\\.com/[a-z0-9._-]+"},{name:"Generic webhook secret",regex:"(webhook).+(secret|token|key).+"},{name:"Gengo",regex:"(?:gengo).{0,40}([ ]{0,1}[0-9a-zA-Z\\[\\]\\-\\(\\)\\{\\}|_^@$=~]{64}[ \\r\\n]{1})"},{name:"Geoapify",regex:"(?:geoapify).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Geocode",regex:"(?:geocode).{0,40}\\b([a-z0-9]{28})\\b"},{name:"Geocodify",regex:"(?:geocodify).{0,40}\\b([0-9a-z]{40})\\b"},{name:"Geocodio - 2",regex:"(?:geocod).{0,40}\\b([a-z0-9]{39})\\b"},{name:"Geoipifi",regex:"(?:ipifi).{0,40}\\b([a-z0-9A-Z_]{32})\\b"},{name:"Getemail",regex:"(?:getemail).{0,40}\\b([a-zA-Z0-9-]{20})\\b"},{name:"Getemails - 1",regex:"(?:getemails).{0,40}\\b([a-z0-9-]{26})\\b"},{name:"Getemails - 2",regex:"(?:getemails).{0,40}\\b([a-z0-9-]{18})\\b"},{name:"Getgeoapi",regex:"(?:getgeoapi).{0,40}\\b([0-9a-z]{40})\\b"},{name:"Getgist",regex:"(?:getgist).{0,40}\\b([a-z0-9A-Z+=]{68})"},{name:"Getsandbox - 1",regex:"(?:getsandbox).{0,40}\\b([a-z0-9-]{40})\\b"},{name:"Getsandbox - 2",regex:"(?:getsandbox).{0,40}\\b([a-z0-9-]{15,30})\\b"},{name:"GitHub",regex:`[gG][iI][tT][hH][uU][bB].*['|"][0-9a-zA-Z]{35,40}['|"]`},{name:"Github - 2",regex:"\\b((?:ghp|gho|ghu|ghs|ghr)_[a-zA-Z0-9]{36,255}\\b)"},{name:"Github App Token",regex:"(ghu|ghs)_[0-9a-zA-Z]{36}"},{name:"Github OAuth Access Token",regex:"gho_[0-9a-zA-Z]{36}"},{name:"Github Personal Access Token",regex:"ghp_[0-9a-zA-Z]{36}"},{name:"Github Refresh Token",regex:"ghr_[0-9a-zA-Z]{76}"},{name:"Github_old",regex:`(?:github)[^\\.].{0,40}[ =:'"]+([a-f0-9]{40})\\b`},{name:"Githubapp - 1",regex:"(?:github).{0,40}\\b([0-9]{6})\\b"},{name:"Githubapp - 2",regex:"(?:github).{0,40}(-----BEGIN RSA PRIVATE KEY-----\\s[A-Za-z0-9+\\/\\s]*\\s-----END RSA PRIVATE KEY-----)"},{name:"Gitlab",regex:"(?:gitlab).{0,40}\\b([a-zA-Z0-9\\-=_]{20,22})\\b"},{name:"Gitlabv2",regex:"\\b(glpat-[a-zA-Z0-9\\-=_]{20,22})\\b"},{name:"Gitter",regex:"(?:gitter).{0,40}\\b([a-z0-9-]{40})\\b"},{name:"Glassnode",regex:"(?:glassnode).{0,40}\\b([0-9A-Za-z]{27})\\b"},{name:"Gocanvas - 1",regex:"(?:gocanvas).{0,40}\\b([0-9A-Za-z/+]{43}=[ \\r\\n]{1})"},{name:"Gocanvas - 2",regex:"(?:gocanvas).{0,40}\\b([\\w\\.-]+@[\\w-]+\\.[\\w\\.-]{2,5})\\b"},{name:"Gocardless",regex:`\\b(live_[0-9A-Za-z\\_\\-]{40}[ "'\\r\\n]{1})`},{name:"Goodday",regex:"(?:goodday).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Google (GCP) Service Account",regex:'"type": "service_account"'},{name:"Google API Key",regex:"AIza[0-9a-z-_]{35}"},{name:"Google Calendar URI",regex:"https://www\\.google\\.com/calendar/embed\\?src=[A-Za-z0-9%@&;=\\-_\\./]+"},{name:"Graphcms - 1",regex:"(?:graph).{0,40}\\b([a-z0-9]{25})\\b"},{name:"Graphcms - 2",regex:"\\b(ey[a-zA-Z0-9]{73}.ey[a-zA-Z0-9]{365}.[a-zA-Z0-9_-]{683})\\b"},{name:"Graphhopper",regex:"(?:graphhopper).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Groovehq",regex:"(?:groove).{0,40}\\b([a-z0-9A-Z]{64})"},{name:"Guru - 1",regex:"(?:guru).{0,40}\\b([a-zA-Z0-9]{3,20}@[a-zA-Z0-9]{2,12}.[a-zA-Z0-9]{2,5})\\b"},{name:"Guru - 2",regex:"(?:guru).{0,40}\\b([a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12})\\b"},{name:"Gyazo",regex:"(?:gyazo).{0,40}\\b([0-9A-Za-z-]{43})\\b"},{name:"Happi",regex:"(?:happi).{0,40}\\b([a-zA-Z0-9]{56})"},{name:"Happyscribe",regex:"(?:happyscribe).{0,40}\\b([0-9a-zA-Z]{24})\\b"},{name:"Harvest - 1",regex:"(?:harvest).{0,40}\\b([a-z0-9A-Z._]{97})\\b"},{name:"Harvest - 2",regex:"(?:harvest).{0,40}\\b([0-9]{4,9})\\b"},{name:"Hellosign",regex:"(?:hellosign).{0,40}\\b([a-zA-Z-0-9/+]{64})\\b"},{name:"Helpcrunch",regex:"(?:helpcrunch).{0,40}\\b([a-zA-Z-0-9+/=]{328})"},{name:"Helpscout",regex:"(?:helpscout).{0,40}\\b([A-Za-z0-9]{56})\\b"},{name:"Hereapi",regex:"(?:hereapi).{0,40}\\b([a-zA-Z0-9\\S]{43})\\b"},{name:"Heroku",regex:"(?:heroku).{0,40}\\b([0-9Aa-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\\b"},{name:"Hive - 1",regex:"(?:hive).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Hive - 2",regex:"(?:hive).{0,40}\\b([0-9A-Za-z]{17})\\b"},{name:"Hiveage",regex:"(?:hiveage).{0,40}\\b([0-9A-Za-z\\_\\-]{20})\\b"},{name:"Holidayapi",regex:"(?:holidayapi).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Host",regex:"(?:host).{0,40}\\b([a-z0-9]{14})\\b"},{name:"Html2pdf",regex:"(?:html2pdf).{0,40}\\b([a-zA-Z0-9]{64})\\b"},{name:"Hubspotapikey",regex:"(?:hubspot).{0,40}\\b([A-Za-z0-9]{8}\\-[A-Za-z0-9]{4}\\-[A-Za-z0-9]{4}\\-[A-Za-z0-9]{4}\\-[A-Za-z0-9]{12})\\b"},{name:"Humanity",regex:"(?:humanity).{0,40}\\b([0-9a-z]{40})\\b"},{name:"Hunter",regex:"(?:hunter).{0,40}\\b([a-z0-9_-]{40})\\b"},{name:"Hypertrack - 1",regex:"(?:hypertrack).{0,40}\\b([0-9a-zA-Z\\_\\-]{54})\\b"},{name:"Hypertrack - 2",regex:"(?:hypertrack).{0,40}\\b([0-9a-zA-Z\\_\\-]{27})\\b"},{name:"Ibmclouduserkey",regex:"(?:ibm).{0,40}\\b([A-Za-z0-9_-]{44})\\b"},{name:"Iconfinder",regex:"(?:iconfinder).{0,40}\\b([a-zA-Z0-9]{64})\\b"},{name:"Iexcloud",regex:"(?:iexcloud).{0,40}\\b([a-z0-9_]{35})\\b"},{name:"Imagekit",regex:"(?:imagekit).{0,40}\\b([a-zA-Z0-9_=]{36})"},{name:"Imagga",regex:"(?:imagga).{0,40}\\b([a-z0-9A-Z=]{72})"},{name:"Impala",regex:"(?:impala).{0,40}\\b([0-9A-Za-z_]{46})\\b"},{name:"Insightly",regex:"(?:insightly).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Integromat",regex:"(?:integromat).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Intercom",regex:"(?:intercom).{0,40}\\b([a-zA-Z0-9\\W\\S]{59}\\=)"},{name:"Intrinio",regex:"(?:intrinio).{0,40}\\b([a-zA-Z0-9]{44})\\b"},{name:"Invoiceocean - 1",regex:"(?:invoiceocean).{0,40}\\b([0-9A-Za-z]{20})\\b"},{name:"Invoiceocean - 2",regex:"\\b([0-9a-z]{1,}.invoiceocean.com)\\b"},{name:"Ipapi",regex:"(?:ipapi).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Ipgeolocation",regex:"(?:ipgeolocation).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Ipify",regex:"(?:ipify).{0,40}\\b([a-zA-Z0-9_-]{32})\\b"},{name:"Ipinfodb",regex:"(?:ipinfodb).{0,40}\\b([a-z0-9]{64})\\b"},{name:"Ipquality",regex:"(?:ipquality).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Ipstack",regex:"(?:ipstack).{0,40}\\b([a-fA-f0-9]{32})\\b"},{name:"JDBC Connection String",regex:"jdbc:[a-z:]+://[A-Za-z0-9\\.\\-_:;=/@?,&]+"},{name:"Jiratoken - 1",regex:"(?:jira).{0,40}\\b([a-zA-Z-0-9]{24})\\b"},{name:"Jiratoken - 2",regex:"(?:jira).{0,40}\\b([a-zA-Z-0-9]{5,24}\\@[a-zA-Z-0-9]{3,16}\\.com)\\b"},{name:"Jiratoken - 3",regex:"(?:jira).{0,40}\\b([a-zA-Z-0-9]{5,24}\\.[a-zA-Z-0-9]{3,16}\\.[a-zA-Z-0-9]{3,16})\\b"},{name:"Jotform",regex:"(?:jotform).{0,40}\\b([0-9Aa-z]{32})\\b"},{name:"Jumpcloud",regex:"(?:jumpcloud).{0,40}\\b([a-zA-Z0-9]{40})\\b"},{name:"Juro",regex:"(?:juro).{0,40}\\b([a-zA-Z0-9]{40})\\b"},{name:"Kanban - 1",regex:"(?:kanban).{0,40}\\b([0-9A-Z]{12})\\b"},{name:"Kanban - 2",regex:"\\b([0-9a-z]{1,}.kanbantool.com)\\b"},{name:"Karmacrm",regex:"(?:karma).{0,40}\\b([a-zA-Z0-9]{20})\\b"},{name:"Keenio - 1",regex:"(?:keen).{0,40}\\b([0-9a-z]{24})\\b"},{name:"Keenio - 2",regex:"(?:keen).{0,40}\\b([0-9A-Z]{64})\\b"},{name:"Kickbox",regex:"(?:kickbox).{0,40}\\b([a-zA-Z0-9_]+[a-zA-Z0-9]{64})\\b"},{name:"Klipfolio",regex:"(?:klipfolio).{0,40}\\b([0-9a-f]{40})\\b"},{name:"Kontent",regex:"(?:kontent).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Kraken - 1",regex:`(?:kraken).{0,40}\\b([0-9A-Za-z\\/\\+=]{56}[ "'\\r\\n]{1})`},{name:"Kraken - 2",regex:`(?:kraken).{0,40}\\b([0-9A-Za-z\\/\\+=]{86,88}[ "'\\r\\n]{1})`},{name:"Kucoin - 1",regex:"(?:kucoin).{0,40}([ \\r\\n]{1}[!-~]{7,32}[ \\r\\n]{1})"},{name:"Kucoin - 2",regex:"(?:kucoin).{0,40}\\b([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\\b"},{name:"Kucoin - 3",regex:"(?:kucoin).{0,40}\\b([0-9a-f]{24})\\b"},{name:"Kylas",regex:"(?:kylas).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Languagelayer",regex:"(?:languagelayer).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Lastfm",regex:"(?:lastfm).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Launchdarkly",regex:"(?:launchdarkly).{0,40}\\b([a-z0-9-]{40})\\b"},{name:"Leadfeeder",regex:"(?:leadfeeder).{0,40}\\b([a-zA-Z0-9-]{43})\\b"},{name:"Lendflow",regex:"(?:lendflow).{0,40}\\b([a-zA-Z0-9]{36}\\.[a-zA-Z0-9]{235}\\.[a-zA-Z0-9]{32}\\-[a-zA-Z0-9]{47}\\-[a-zA-Z0-9_]{162}\\-[a-zA-Z0-9]{42}\\-[a-zA-Z0-9_]{40}\\-[a-zA-Z0-9_]{66}\\-[a-zA-Z0-9_]{59}\\-[a-zA-Z0-9]{7}\\-[a-zA-Z0-9_]{220})\\b"},{name:"Lessannoyingcrm",regex:"(?:less).{0,40}\\b([a-zA-Z0-9-]{57})\\b"},{name:"Lexigram",regex:"(?:lexigram).{0,40}\\b([a-zA-Z0-9\\S]{301})\\b"},{name:"Linearapi",regex:"\\b(lin_api_[0-9A-Za-z]{40})\\b"},{name:"Linemessaging",regex:"(?:line).{0,40}\\b([A-Za-z0-9+/]{171,172})\\b"},{name:"Linenotify",regex:"(?:linenotify).{0,40}\\b([0-9A-Za-z]{43})\\b"},{name:"Linkpreview",regex:"(?:linkpreview).{0,40}\\b([a-zA-Z0-9]{32})\\b"},{name:"Liveagent",regex:"(?:liveagent).{0,40}\\b([a-zA-Z0-9]{32})\\b"},{name:"Livestorm",regex:"(?:livestorm).{0,40}\\b(eyJhbGciOiJIUzI1NiJ9\\.eyJhdWQiOiJhcGkubGl2ZXN0b3JtLmNvIiwianRpIjoi[0-9A-Z-a-z]{134}\\.[0-9A-Za-z\\-\\_]{43}[ \\r\\n]{1})"},{name:"Locationiq",regex:"\\b(pk\\.[a-zA-Z-0-9]{32})\\b"},{name:"Loginradius",regex:"(?:loginradius).{0,40}\\b([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\\b"},{name:"Lokalisetoken",regex:"(?:lokalise).{0,40}\\b([a-z0-9]{40})\\b"},{name:"Loyverse",regex:"(?:loyverse).{0,40}\\b([0-9-a-z]{32})\\b"},{name:"Luno - 1",regex:"(?:luno).{0,40}\\b([a-z0-9]{13})\\b"},{name:"Luno - 2",regex:"(?:luno).{0,40}\\b([a-zA-Z0-9_-]{43})\\b"},{name:"M3o",regex:"(?:m3o).{0,40}\\b([0-9A-Za-z]{48})\\b"},{name:"Macaddress",regex:"(?:macaddress).{0,40}\\b([a-zA-Z0-9_]{32})\\b"},{name:"Madkudu",regex:"(?:madkudu).{0,40}\\b([0-9a-f]{32})\\b"},{name:"Magnetic",regex:"(?:magnetic).{0,40}\\b([0-9Aa-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12})\\b"},{name:"Mailboxlayer",regex:"(?:mailboxlayer).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Mailerlite",regex:"(?:mailerlite).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Mailgun - 2",regex:"(?:mailgun).{0,40}\\b([a-zA-Z-0-9]{72})\\b"},{name:"Mailgun API Key - 1",regex:"key-[0-9a-zA-Z]{32}"},{name:"Mailgun API key - 2",regex:"(mailgun|mg)[0-9a-z]{32}"},{name:"Mailjetbasicauth",regex:"(?:mailjet).{0,40}\\b([A-Za-z0-9]{87}\\=)"},{name:"Mailjetsms",regex:"(?:mailjet).{0,40}\\b([A-Za-z0-9]{32})\\b"},{name:"Mailmodo",regex:"(?:mailmodo).{0,40}\\b([A-Z0-9]{7}-[A-Z0-9]{7}-[A-Z0-9]{7}-[A-Z0-9]{7})\\b"},{name:"Mailsac",regex:"(?:mailsac).{0,40}\\b(k_[0-9A-Za-z]{36,})\\b"},{name:"Mandrill",regex:"(?:mandrill).{0,40}\\b([A-Za-z0-9_-]{22})\\b"},{name:"Manifest",regex:"(?:manifest).{0,40}\\b([a-zA-z0-9]{32})\\b"},{name:"Mapbox - 2",regex:"\\b(sk\\.[a-zA-Z-0-9\\.]{80,240})\\b"},{name:"Mapquest",regex:"(?:mapquest).{0,40}\\b([0-9A-Za-z]{32})\\b"},{name:"Marketstack",regex:"(?:marketstack).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Mattermostpersonaltoken - 1",regex:"(?:mattermost).{0,40}\\b([A-Za-z0-9-_]{1,}.cloud.mattermost.com)\\b"},{name:"Mattermostpersonaltoken - 2",regex:"(?:mattermost).{0,40}\\b([a-z0-9]{26})\\b"},{name:"Mavenlink",regex:"(?:mavenlink).{0,40}\\b([0-9a-z]{64})\\b"},{name:"Maxmindlicense - 1",regex:"(?:maxmind|geoip).{0,40}\\b([0-9A-Za-z]{16})\\b"},{name:"Maxmindlicense - 2",regex:"(?:maxmind|geoip).{0,40}\\b([0-9]{2,7})\\b"},{name:"Meaningcloud",regex:"(?:meaningcloud).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Mediastack",regex:"(?:mediastack).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Meistertask",regex:"(?:meistertask).{0,40}\\b([a-zA-Z0-9]{43})\\b"},{name:"Mesibo",regex:"(?:mesibo).{0,40}\\b([0-9A-Za-z]{64})\\b"},{name:"Messagebird",regex:"(?:messagebird).{0,40}\\b([A-Za-z0-9_-]{25})\\b"},{name:"Metaapi - 1",regex:"(?:metaapi|meta-api).{0,40}\\b([0-9a-f]{64})\\b"},{name:"Metaapi - 2",regex:"(?:metaapi|meta-api).{0,40}\\b([0-9a-f]{24})\\b"},{name:"Metrilo",regex:"(?:metrilo).{0,40}\\b([a-z0-9]{16})\\b"},{name:"Microsoftteamswebhook",regex:"(https:\\/\\/[a-zA-Z-0-9]+\\.webhook\\.office\\.com\\/webhookb2\\/[a-zA-Z-0-9]{8}-[a-zA-Z-0-9]{4}-[a-zA-Z-0-9]{4}-[a-zA-Z-0-9]{4}-[a-zA-Z-0-9]{12}\\@[a-zA-Z-0-9]{8}-[a-zA-Z-0-9]{4}-[a-zA-Z-0-9]{4}-[a-zA-Z-0-9]{4}-[a-zA-Z-0-9]{12}\\/IncomingWebhook\\/[a-zA-Z-0-9]{32}\\/[a-zA-Z-0-9]{8}-[a-zA-Z-0-9]{4}-[a-zA-Z-0-9]{4}-[a-zA-Z-0-9]{4}-[a-zA-Z-0-9]{12})"},{name:"Midise",regex:"midi-662b69edd2[a-zA-Z0-9]{54}"},{name:"Mindmeister",regex:"(?:mindmeister).{0,40}\\b([a-zA-Z0-9]{43})\\b"},{name:"Mite - 1",regex:"(?:mite).{0,40}\\b([0-9a-z]{16})\\b"},{name:"Mite - 2",regex:"\\b([0-9a-z-]{1,}.mite.yo.lk)\\b"},{name:"Mixmax",regex:"(?:mixmax).{0,40}\\b([a-zA-Z0-9_-]{36})\\b"},{name:"Mixpanel - 1",regex:"(?:mixpanel).{0,40}\\b([a-zA-Z0-9.-]{30,40})\\b"},{name:"Mixpanel - 2",regex:"(?:mixpanel).{0,40}\\b([a-zA-Z0-9-]{32})\\b"},{name:"Moderation",regex:"(?:moderation).{0,40}\\b([a-zA-Z0-9]{36}\\.[a-zA-Z0-9]{115}\\.[a-zA-Z0-9_]{43})\\b"},{name:"Monday",regex:"(?:monday).{0,40}\\b(ey[a-zA-Z0-9_.]{210,225})\\b"},{name:"Moonclerck",regex:"(?:moonclerck).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Moonclerk",regex:"(?:moonclerk).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Moosend",regex:"(?:moosend).{0,40}\\b([0-9Aa-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\\b"},{name:"Mrticktock - 1",regex:"(?:mrticktock).{0,40}\\b([a-zA-Z0-9!=@#$%()_^]{1,50})"},{name:"Myfreshworks - 2",regex:"(?:freshworks).{0,40}\\b([a-z0-9A-Z-]{22})\\b"},{name:"Myintervals",regex:"(?:myintervals).{0,40}\\b([0-9a-z]{11})\\b"},{name:"Nasdaqdatalink",regex:"(?:nasdaq).{0,40}\\b([a-zA-Z0-9_-]{20})\\b"},{name:"Nethunt - 1",regex:"(?:nethunt).{0,40}\\b([a-zA-Z0-9.-@]{25,30})\\b"},{name:"Nethunt - 2",regex:"(?:nethunt).{0,40}\\b([a-z0-9-\\S]{36})\\b"},{name:"Netlify",regex:"(?:netlify).{0,40}\\b([A-Za-z0-9_-]{43,45})\\b"},{name:"Neutrinoapi - 1",regex:"(?:neutrinoapi).{0,40}\\b([a-zA-Z0-9]{48})\\b"},{name:"Neutrinoapi - 2",regex:"(?:neutrinoapi).{0,40}\\b([a-zA-Z0-9]{6,24})\\b"},{name:"Newrelic Admin API Key",regex:"NRAA-[a-f0-9]{27}"},{name:"Newrelic Insights API Key",regex:"NRI(?:I|Q)-[A-Za-z0-9\\-_]{32}"},{name:"Newrelic REST API Key",regex:"NRRA-[a-f0-9]{42}"},{name:"Newrelic Synthetics Location Key",regex:"NRSP-[a-z]{2}[0-9]{2}[a-f0-9]{31}"},{name:"Newrelicpersonalapikey",regex:"(?:newrelic).{0,40}\\b([A-Za-z0-9_\\.]{4}-[A-Za-z0-9_\\.]{42})\\b"},{name:"Newsapi",regex:"(?:newsapi).{0,40}\\b([a-z0-9]{32})"},{name:"Newscatcher",regex:"(?:newscatcher).{0,40}\\b([0-9A-Za-z_]{43})\\b"},{name:"Nexmoapikey - 1",regex:"(?:nexmo).{0,40}\\b([A-Za-z0-9_-]{8})\\b"},{name:"Nexmoapikey - 2",regex:"(?:nexmo).{0,40}\\b([A-Za-z0-9_-]{16})\\b"},{name:"Nftport",regex:"(?:nftport).{0,40}\\b([a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12})\\b"},{name:"Nicereply",regex:"(?:nicereply).{0,40}\\b([0-9a-f]{40})\\b"},{name:"Nimble",regex:"(?:nimble).{0,40}\\b([a-zA-Z0-9]{30})\\b"},{name:"Nitro",regex:"(?:nitro).{0,40}\\b([0-9a-f]{32})\\b"},{name:"Noticeable",regex:"(?:noticeable).{0,40}\\b([0-9a-zA-Z]{20})\\b"},{name:"Notion",regex:"\\b(secret_[A-Za-z0-9]{43})\\b"},{name:"Nozbeteams",regex:"(?:nozbe|nozbeteams).{0,40}\\b([0-9A-Za-z]{16}_[0-9A-Za-z\\-_]{64}[ \\r\\n]{1})"},{name:"Numverify",regex:"(?:numverify).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Nutritionix - 1",regex:"(?:nutritionix).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Nutritionix - 2",regex:"(?:nutritionix).{0,40}\\b([a-z0-9]{8})\\b"},{name:"Nylas",regex:"(?:nylas).{0,40}\\b([0-9A-Za-z]{30})\\b"},{name:"Nytimes",regex:"(?:nytimes).{0,40}\\b([a-z0-9A-Z-]{32})\\b"},{name:"Oanda",regex:"(?:oanda).{0,40}\\b([a-zA-Z0-9]{24})\\b"},{name:"Omnisend",regex:"(?:omnisend).{0,40}\\b([a-z0-9A-Z-]{75})\\b"},{name:"Onedesk - 1",regex:"(?:onedesk).{0,40}\\b([a-zA-Z0-9!=@#$%^]{8,64})"},{name:"Onelogin - 2",regex:`secret[a-zA-Z0-9_' "=]{0,20}([a-z0-9]{64})`},{name:"Onepagecrm - 1",regex:"(?:onepagecrm).{0,40}\\b([a-zA-Z0-9=]{44})"},{name:"Onepagecrm - 2",regex:"(?:onepagecrm).{0,40}\\b([a-z0-9]{24})\\b"},{name:"Onwaterio",regex:"(?:onwater).{0,40}\\b([a-zA-Z0-9_-]{20})\\b"},{name:"Oopspam",regex:"(?:oopspam).{0,40}\\b([a-zA-Z0-9]{40})\\b"},{name:"Opencagedata",regex:"(?:opencagedata).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Opengraphr",regex:"(?:opengraphr).{0,40}\\b([0-9Aa-zA-Z]{80})\\b"},{name:"Openuv",regex:"(?:openuv).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Openweather",regex:"(?:openweather).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Optimizely",regex:"(?:optimizely).{0,40}\\b([0-9A-Za-z-:]{54})\\b"},{name:"Owlbot",regex:"(?:owlbot).{0,40}\\b([a-z0-9]{40})\\b"},{name:"PGP private key block",regex:"-----BEGIN PGP PRIVATE KEY BLOCK-----"},{name:"Pagerdutyapikey",regex:"(?:pagerduty).{0,40}\\b([a-z]{1}\\+[a-zA-Z]{9}\\-[a-z]{2}\\-[a-z0-9]{5})\\b"},{name:"Pandadoc",regex:"(?:pandadoc).{0,40}\\b([a-zA-Z0-9]{40})\\b"},{name:"Pandascore",regex:"(?:pandascore).{0,40}([ \\r\\n]{0,1}[0-9A-Za-z\\-\\_]{51}[ \\r\\n]{1})"},{name:"Paralleldots",regex:"(?:paralleldots).{0,40}\\b([0-9A-Za-z]{43})\\b"},{name:"Partnerstack",regex:"(?:partnerstack).{0,40}\\b([0-9A-Za-z]{64})\\b"},{name:"Passbase",regex:"(?:passbase).{0,40}\\b([a-zA-Z0-9]{128})\\b"},{name:"Pastebin",regex:"(?:pastebin).{0,40}\\b([a-zA-Z0-9_]{32})\\b"},{name:"PayPal Braintree access token",regex:"access_token\\$production\\$[0-9a-z]{16}\\$[0-9a-f]{32}"},{name:"Paymoapp",regex:"(?:paymoapp).{0,40}\\b([a-zA-Z0-9]{44})\\b"},{name:"Paymongo",regex:"(?:paymongo).{0,40}\\b([a-zA-Z0-9_]{32})\\b"},{name:"Paypaloauth - 1",regex:"\\b([A-Za-z0-9_\\.]{7}-[A-Za-z0-9_\\.]{72})\\b"},{name:"Paypaloauth - 2",regex:"\\b([A-Za-z0-9_\\.]{69}-[A-Za-z0-9_\\.]{10})\\b"},{name:"Paystack",regex:"\\b(sk\\_[a-z]{1,}\\_[A-Za-z0-9]{40})\\b"},{name:"Pdflayer",regex:"(?:pdflayer).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Pdfshift",regex:"(?:pdfshift).{0,40}\\b([0-9a-f]{32})\\b"},{name:"Peopledatalabs",regex:"(?:peopledatalabs).{0,40}\\b([a-z0-9]{64})\\b"},{name:"Pepipost",regex:"(?:pepipost|netcore).{0,40}\\b([a-zA-Z-0-9]{32})\\b"},{name:"Picatic API key",regex:"sk_live_[0-9a-z]{32}"},{name:"Pipedream",regex:"(?:pipedream).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Pipedrive",regex:"(?:pipedrive).{0,40}\\b([a-zA-Z0-9]{40})\\b"},{name:"Pivotaltracker",regex:"(?:pivotal).{0,40}([a-z0-9]{32})"},{name:"Pixabay",regex:"(?:pixabay).{0,40}\\b([a-z0-9-]{34})\\b"},{name:"Plaidkey - 1",regex:"(?:plaid).{0,40}\\b([a-z0-9]{24})\\b"},{name:"Plaidkey - 2",regex:"(?:plaid).{0,40}\\b([a-z0-9]{30})\\b"},{name:"Planviewleankit - 1",regex:"(?:planviewleankit|planview).{0,40}\\b([0-9a-f]{128})\\b"},{name:"Planviewleankit - 2",regex:"(?:planviewleankit|planview).{0,40}(?:subdomain).\\b([a-zA-Z][a-zA-Z0-9.-]{1,23}[a-zA-Z0-9])\\b"},{name:"Planyo",regex:"(?:planyo).{0,40}\\b([0-9a-z]{62})\\b"},{name:"Plivo - 1",regex:"(?:plivo).{0,40}\\b([A-Za-z0-9_-]{40})\\b"},{name:"Plivo - 2",regex:"(?:plivo).{0,40}\\b([A-Z]{20})\\b"},{name:"Poloniex - 1",regex:"(?:poloniex).{0,40}\\b([0-9a-f]{128})\\b"},{name:"Poloniex - 2",regex:"(?:poloniex).{0,40}\\b([0-9A-Z]{8}-[0-9A-Z]{8}-[0-9A-Z]{8}-[0-9A-Z]{8})\\b"},{name:"Polygon",regex:"(?:polygon).{0,40}\\b([a-z0-9A-Z]{32})\\b"},{name:"Positionstack",regex:"(?:positionstack).{0,40}\\b([a-zA-Z0-9_]{32})\\b"},{name:"Postageapp",regex:"(?:postageapp).{0,40}\\b([0-9A-Za-z]{32})\\b"},{name:"Posthog",regex:"\\b(phc_[a-zA-Z0-9_]{43})\\b"},{name:"Postman",regex:"\\b(PMAK-[a-zA-Z-0-9]{59})\\b"},{name:"Postmark",regex:"(?:postmark).{0,40}\\b([0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12})\\b"},{name:"Powrbot",regex:"(?:powrbot).{0,40}\\b([a-z0-9A-Z]{40})\\b"},{name:"Privatekey",regex:"-----\\s*?BEGIN[ A-Z0-9_-]*?PRIVATE KEY\\s*?-----[\\s\\S]*?----\\s*?END[ A-Z0-9_-]*? PRIVATE KEY\\s*?-----"},{name:"Prospectcrm",regex:"(?:prospect).{0,40}\\b([a-z0-9-]{32})\\b"},{name:"Prospectio",regex:"(?:prospect).{0,40}\\b([a-z0-9A-Z-]{50})\\b"},{name:"Protocolsio",regex:"(?:protocols).{0,40}\\b([a-z0-9]{64})\\b"},{name:"Proxycrawl",regex:"(?:proxycrawl).{0,40}\\b([a-zA-Z0-9_]{22})\\b"},{name:"Pubnubpublishkey - 1",regex:"\\b(sub-c-[0-9a-z]{8}-[a-z]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12})\\b"},{name:"Pubnubpublishkey - 2",regex:"\\b(pub-c-[0-9a-z]{8}-[0-9a-z]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12})\\b"},{name:"Purestake",regex:"(?:purestake).{0,40}\\b([a-zA-Z0-9]{40})\\b"},{name:"Pushbulletapikey",regex:"(?:pushbullet).{0,40}\\b([A-Za-z0-9_\\.]{34})\\b"},{name:"Pusherchannelkey - 1",regex:"(?:key).{0,40}\\b([a-z0-9]{20})\\b"},{name:"Pusherchannelkey - 2",regex:"(?:pusher).{0,40}\\b([a-z0-9]{20})\\b"},{name:"Pusherchannelkey - 3",regex:"(?:pusher).{0,40}\\b([0-9]{7})\\b"},{name:"PyPI upload token",regex:"pypi-AgEIcHlwaS5vcmc[A-Za-z0-9-_]{50,1000}"},{name:"Qualaroo",regex:"(?:qualaroo).{0,40}\\b([a-z0-9A-Z=]{64})"},{name:"Qubole",regex:"(?:qubole).{0,40}\\b([0-9a-z]{64})\\b"},{name:"Quickmetrics",regex:"(?:quickmetrics).{0,40}\\b([a-zA-Z0-9_-]{22})\\b"},{name:"REDIS_URL",regex:"(REDIS_URL).+"},{name:"RKCS8",regex:"-----BEGIN PRIVATE KEY-----"},{name:"RSA private key",regex:"-----BEGIN RSA PRIVATE KEY-----"},{name:"Rapidapi",regex:"(?:rapidapi).{0,40}\\b([A-Za-z0-9_-]{50})\\b"},{name:"Raven",regex:"(?:raven).{0,40}\\b([A-Z0-9-]{16})\\b"},{name:"Rawg",regex:"(?:rawg).{0,40}\\b([0-9Aa-z]{32})\\b"},{name:"Razorpay - 1",regex:"\\brzp_\\w{2,6}_\\w{10,20}\\b"},{name:"Readme",regex:"(?:readme).{0,40}\\b([a-zA-Z0-9_]{32})\\b"},{name:"Reallysimplesystems",regex:"\\b(ey[a-zA-Z0-9-._]{153}.ey[a-zA-Z0-9-._]{916,1000})\\b"},{name:"Rebrandly",regex:"(?:rebrandly).{0,40}\\b([a-zA-Z0-9_]{32})\\b"},{name:"Refiner",regex:"(?:refiner).{0,40}\\b([0-9Aa-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\\b"},{name:"Repairshopr - 1",regex:"(?:repairshopr).{0,40}\\b([a-zA-Z0-9_.!+$#^*]{3,32})\\b"},{name:"Repairshopr - 2",regex:"(?:repairshopr).{0,40}\\b([a-zA-Z0-9-]{51})\\b"},{name:"Restpack",regex:"(?:restpack).{0,40}\\b([a-zA-Z0-9]{48})\\b"},{name:"Restpackhtmltopdfapi",regex:"(?:restpack).{0,40}\\b([0-9A-Za-z]{48})\\b"},{name:"Rev - 1",regex:"(?:rev).{0,40}\\b([0-9a-zA-Z\\/\\+]{27}\\=[ \\r\\n]{1})"},{name:"Rev - 2",regex:"(?:rev).{0,40}\\b([0-9a-zA-Z\\-]{27}[ \\r\\n]{1})"},{name:"Revampcrm - 1",regex:"(?:revamp).{0,40}\\b([a-zA-Z0-9]{40}\\b)"},{name:"Revampcrm - 2",regex:"(?:revamp).{0,40}\\b([a-zA-Z0-9.-@]{25,30})\\b"},{name:"Ringcentral - 1",regex:"(?:ringcentral).{0,40}\\b(https://www.[0-9A-Za-z_-]{1,}.com)\\b"},{name:"Ringcentral - 2",regex:"(?:ringcentral).{0,40}\\b([0-9A-Za-z_-]{22})\\b"},{name:"Ritekit",regex:"(?:ritekit).{0,40}\\b([0-9a-f]{44})\\b"},{name:"Roaring",regex:"(?:roaring).{0,40}\\b([0-9A-Za-z_-]{28})\\b"},{name:"Rocketreach",regex:"(?:rocketreach).{0,40}\\b([a-z0-9-]{39})\\b"},{name:"Roninapp - 1",regex:"(?:ronin).{0,40}\\b([0-9Aa-zA-Z]{3,32})\\b"},{name:"Roninapp - 2",regex:"(?:ronin).{0,40}\\b([0-9a-zA-Z]{26})\\b"},{name:"Route4me",regex:"(?:route4me).{0,40}\\b([0-9A-Z]{32})\\b"},{name:"Rownd - 1",regex:"(?:rownd).{0,40}\\b([a-z0-9]{8}\\-[a-z0-9]{4}\\-[a-z0-9]{4}\\-[a-z0-9]{4}\\-[a-z0-9]{12})\\b"},{name:"Rownd - 2",regex:"(?:rownd).{0,40}\\b([a-z0-9]{48})\\b"},{name:"Rownd - 3",regex:"(?:rownd).{0,40}\\b([0-9]{18})\\b"},{name:"Rubygems",regex:"\\b(rubygems_[a-zA0-9]{48})\\b"},{name:"Runrunit - 1",regex:"(?:runrunit).{0,40}\\b([0-9a-f]{32})\\b"},{name:"Runrunit - 2",regex:"(?:runrunit).{0,40}\\b([0-9A-Za-z]{18,20})\\b"},{name:"SSH",regex:"-----BEGIN OPENSSH PRIVATE KEY-----"},{name:"SSH (DSA) private key",regex:"-----BEGIN DSA PRIVATE KEY-----"},{name:"Salesblink",regex:"(?:salesblink).{0,40}\\b([a-zA-Z]{16})\\b"},{name:"Salescookie",regex:"(?:salescookie).{0,40}\\b([a-zA-z0-9]{32})\\b"},{name:"Salesflare",regex:"(?:salesflare).{0,40}\\b([a-zA-Z0-9_]{45})\\b"},{name:"Satismeterprojectkey - 1",regex:"(?:satismeter).{0,40}\\b([a-zA-Z0-9]{4,20}@[a-zA-Z0-9]{2,12}.[a-zA-Z0-9]{2,12})\\b"},{name:"Satismeterprojectkey - 2",regex:"(?:satismeter).{0,40}\\b([a-zA-Z0-9]{24})\\b"},{name:"Satismeterprojectkey - 3",regex:"(?:satismeter).{0,40}\\b([a-zA-Z0-9!=@#$%^]{6,32})"},{name:"Satismeterwritekey",regex:"(?:satismeter).{0,40}\\b([a-z0-9A-Z]{16})\\b"},{name:"Saucelabs - 1",regex:"\\b(oauth\\-[a-z0-9]{8,}\\-[a-z0-9]{5})\\b"},{name:"Saucelabs - 2",regex:"(?:saucelabs).{0,40}\\b([a-z0-9]{8}\\-[a-z0-9]{4}\\-[a-z0-9]{4}\\-[a-z0-9]{4}\\-[a-z0-9]{12})\\b"},{name:"Scalewaykey",regex:"(?:scaleway).{0,40}\\b([0-9a-z]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[0-9a-z]{4}-[0-9a-z]{12})\\b"},{name:"Scrapeowl",regex:"(?:scrapeowl).{0,40}\\b([0-9a-z]{30})\\b"},{name:"Scraperapi",regex:"(?:scraperapi).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Scraperbox",regex:"(?:scraperbox).{0,40}\\b([A-Z0-9]{32})\\b"},{name:"Scrapersite",regex:"(?:scrapersite).{0,40}\\b([a-zA-Z0-9]{45})\\b"},{name:"Scrapestack",regex:"(?:scrapestack).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Scrapfly",regex:"(?:scrapfly).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Scrapingant",regex:"(?:scrapingant).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Scrapingbee",regex:"(?:scrapingbee).{0,40}\\b([A-Z0-9]{80})\\b"},{name:"Screenshotapi",regex:"(?:screenshotapi).{0,40}\\b([0-9A-Z]{7}\\-[0-9A-Z]{7}\\-[0-9A-Z]{7}\\-[0-9A-Z]{7})\\b"},{name:"Screenshotlayer",regex:"(?:screenshotlayer).{0,40}\\b([a-zA-Z0-9_]{32})\\b"},{name:"Securitytrails",regex:"(?:securitytrails).{0,40}\\b([a-zA-Z0-9]{32})\\b"},{name:"Segmentapikey",regex:"(?:segment).{0,40}\\b([A-Za-z0-9_\\-a-zA-Z]{43}\\.[A-Za-z0-9_\\-a-zA-Z]{43})\\b"},{name:"Selectpdf",regex:"(?:selectpdf).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Semaphore",regex:"(?:semaphore).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Sendbird - 1",regex:"(?:sendbird).{0,40}\\b([0-9a-f]{40})\\b"},{name:"Sendbird - 2",regex:"(?:sendbird).{0,40}\\b([0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12})\\b"},{name:"Sendbirdorganizationapi",regex:"(?:sendbird).{0,40}\\b([0-9a-f]{24})\\b"},{name:"Sendgrid",regex:"(SG\\.[\\w\\-_]{20,24}\\.[\\w\\-_]{39,50})\\b"},{name:"Sendinbluev2",regex:"\\b(xkeysib\\-[A-Za-z0-9_-]{81})\\b"},{name:"Sentiment - 1",regex:"(?:sentiment).{0,40}\\b([0-9]{17})\\b"},{name:"Sentiment - 2",regex:"(?:sentiment).{0,40}\\b([a-zA-Z0-9]{20})\\b"},{name:"Sentrytoken",regex:"(?:sentry).{0,40}\\b([a-f0-9]{64})\\b"},{name:"Serphouse",regex:"(?:serphouse).{0,40}\\b([0-9A-Za-z]{60})\\b"},{name:"Serpstack",regex:"(?:serpstack).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Sheety - 1",regex:"(?:sheety).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Sheety - 2",regex:"(?:sheety).{0,40}\\b([0-9a-z]{64})\\b"},{name:"Sherpadesk",regex:"(?:sherpadesk).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Shipday",regex:"(?:shipday).{0,40}\\b([a-zA-Z0-9.]{11}[a-zA-Z0-9]{20})\\b"},{name:"Shodankey",regex:"(?:shodan).{0,40}\\b([a-zA-Z0-9]{32})\\b"},{name:"Shopify custom app access token",regex:"shpca_[a-fA-F0-9]{32}"},{name:"Shopify private app access token",regex:"shppa_[a-fA-F0-9]{32}"},{name:"Shopify shared secret",regex:"shpss_[a-fA-F0-9]{32}"},{name:"Shoppable Service Auth",regex:"data-shoppable-auth-token.+"},{name:"Shortcut",regex:"(?:shortcut).{0,40}\\b([0-9a-f-]{36})\\b"},{name:"Shotstack",regex:"(?:shotstack).{0,40}\\b([a-zA-Z0-9]{40})\\b"},{name:"Shutterstock - 1",regex:"(?:shutterstock).{0,40}\\b([0-9a-zA-Z]{32})\\b"},{name:"Shutterstock - 2",regex:"(?:shutterstock).{0,40}\\b([0-9a-zA-Z]{16})\\b"},{name:"Shutterstockoauth",regex:"(?:shutterstock).{0,40}\\b(v2/[0-9A-Za-z]{388})\\b"},{name:"Signalwire - 1",regex:"\\b([0-9a-z-]{3,64}.signalwire.com)\\b"},{name:"Signalwire - 2",regex:"(?:signalwire).{0,40}\\b([0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12})\\b"},{name:"Signalwire - 3",regex:"(?:signalwire).{0,40}\\b([0-9A-Za-z]{50})\\b"},{name:"Signaturit",regex:"(?:signaturit).{0,40}\\b([0-9A-Za-z]{86})\\b"},{name:"Signupgenius",regex:"(?:signupgenius).{0,40}\\b([0-9A-Za-z]{32})\\b"},{name:"Sigopt",regex:"(?:sigopt).{0,40}\\b([A-Z0-9]{48})\\b"},{name:"Simplesat",regex:"(?:simplesat).{0,40}\\b([a-z0-9]{40})"},{name:"Simplynoted",regex:"(?:simplynoted).{0,40}\\b([a-zA-Z0-9\\S]{340,360})\\b"},{name:"Simvoly",regex:"(?:simvoly).{0,40}\\b([a-z0-9]{33})\\b"},{name:"Sinchmessage",regex:"(?:sinch).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Sirv - 1",regex:"(?:sirv).{0,40}\\b([a-zA-Z0-9\\S]{88})"},{name:"Sirv - 2",regex:"(?:sirv).{0,40}\\b([a-zA-Z0-9]{26})\\b"},{name:"Siteleaf",regex:"(?:siteleaf).{0,40}\\b([0-9Aa-z]{32})\\b"},{name:"Skrappio",regex:"(?:skrapp).{0,40}\\b([a-z0-9A-Z]{42})\\b"},{name:"Skybiometry",regex:"(?:skybiometry).{0,40}\\b([0-9a-z]{25,26})\\b"},{name:"Slack",regex:"xox[baprs]-[0-9a-zA-Z-]{10,72}"},{name:"Slack Token",regex:"(xox[pborsa]-[0-9]{12}-[0-9]{12}-[0-9]{12}-[a-z0-9]{32})"},{name:"Slack User token",regex:"xoxp-[0-9A-Za-z\\-]{72}"},{name:"Slack Webhook",regex:"https://hooks.slack.com/services/T[a-zA-Z0-9_]{8,10}/B[a-zA-Z0-9_]{8,12}/[a-zA-Z0-9_]{23,24}"},{name:"Slack access token",regex:"xoxb-[0-9A-Za-z\\-]{51}"},{name:"Slackwebhook",regex:"(https:\\/\\/hooks.slack.com\\/services\\/[A-Za-z0-9+\\/]{44,46})"},{name:"Smartsheets",regex:"(?:smartsheets).{0,40}\\b([a-zA-Z0-9]{37})\\b"},{name:"Smartystreets - 1",regex:"(?:smartystreets).{0,40}\\b([a-zA-Z0-9]{20})\\b"},{name:"Smartystreets - 2",regex:"(?:smartystreets).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Smooch - 1",regex:"(?:smooch).{0,40}\\b(act_[0-9a-z]{24})\\b"},{name:"Smooch - 2",regex:"(?:smooch).{0,40}\\b([0-9a-zA-Z_-]{86})\\b"},{name:"Snipcart",regex:"(?:snipcart).{0,40}\\b([0-9A-Za-z_]{75})\\b"},{name:"Snykkey",regex:"(?:snyk).{0,40}\\b([0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12})\\b"},{name:"SonarQube Token",regex:"sonar.{0,50}(?:\"|'|`)?[0-9a-f]{40}(?:\"|'|`)?"},{name:"Splunkobservabilitytoken",regex:"(?:splunk).{0,40}\\b([a-z0-9A-Z]{22})\\b"},{name:"Spoonacular",regex:"(?:spoonacular).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Sportsmonk",regex:"(?:sportsmonk).{0,40}\\b([0-9a-zA-Z]{60})\\b"},{name:"Square",regex:"(?:square).{0,40}(EAAA[a-zA-Z0-9\\-\\+\\=]{60})"},{name:"Square API Key",regex:"sq0(atp|csp)-[0-9a-z-_]{22,43}"},{name:"Squareapp - 1",regex:"[\\w\\-]*sq0i[a-z]{2}-[0-9A-Za-z\\-_]{22,43}"},{name:"Squareapp - 2",regex:"[\\w\\-]*sq0c[a-z]{2}-[0-9A-Za-z\\-_]{40,50}"},{name:"Squarespace",regex:"(?:squarespace).{0,40}\\b([0-9Aa-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\\b"},{name:"Squareup",regex:"\\b(sq0idp-[0-9A-Za-z]{22})\\b"},{name:"Sslmate",regex:"(?:sslmate).{0,40}\\b([a-zA-Z0-9]{36})\\b"},{name:"Stitchdata",regex:"(?:stitchdata).{0,40}\\b([0-9a-z_]{35})\\b"},{name:"Stockdata",regex:"(?:stockdata).{0,40}\\b([0-9A-Za-z]{40})\\b"},{name:"Storecove",regex:"(?:storecove).{0,40}\\b([a-zA-Z0-9_-]{43})\\b"},{name:"Stormglass",regex:"(?:stormglass).{0,40}\\b([0-9Aa-z-]{73})\\b"},{name:"Storyblok",regex:"(?:storyblok).{0,40}\\b([0-9A-Za-z]{22}t{2})\\b"},{name:"Storychief",regex:"(?:storychief).{0,40}\\b([a-zA-Z0-9_\\-.]{940,1000})"},{name:"Strava - 1",regex:"(?:strava).{0,40}\\b([0-9]{5})\\b"},{name:"Strava - 2",regex:"(?:strava).{0,40}\\b([0-9a-z]{40})\\b"},{name:"Streak",regex:"(?:streak).{0,40}\\b([0-9Aa-f]{32})\\b"},{name:"Stripe",regex:"[rs]k_live_[a-zA-Z0-9]{20,30}"},{name:"Stripe API Key - 1",regex:"sk_live_[0-9a-zA-Z]{24}"},{name:"Stripe API key - 2",regex:"stripe[sr]k_live_[0-9a-zA-Z]{24}"},{name:"Stripe API key - 3",regex:"stripe[sk|rk]_live_[0-9a-zA-Z]{24}"},{name:"Stripe Public Live Key",regex:"pk_live_[0-9a-z]{24}"},{name:"Stripe Public Test Key",regex:"pk_test_[0-9a-z]{24}"},{name:"Stripe Restriced Key",regex:"rk_(?:live|test)_[0-9a-zA-Z]{24}"},{name:"Stripe Restricted API Key",regex:"rk_live_[0-9a-zA-Z]{24}"},{name:"Stripe Secret Key",regex:"sk_(?:live|test)_[0-9a-zA-Z]{24}"},{name:"Stripe Secret Live Key",regex:"(sk|rk)_live_[0-9a-z]{24}"},{name:"Stripe Secret Test Key",regex:"(sk|rk)_test_[0-9a-z]{24}"},{name:"Stytch - 1",regex:"(?:stytch).{0,40}\\b([a-zA-Z0-9-_]{47}=)"},{name:"Stytch - 2",regex:"(?:stytch).{0,40}\\b([a-z0-9-]{49})\\b"},{name:"Sugester - 1",regex:"(?:sugester).{0,40}\\b([a-zA-Z0-9_.!+$#^*%]{3,32})\\b"},{name:"Sugester - 2",regex:"(?:sugester).{0,40}\\b([a-zA-Z0-9]{32})\\b"},{name:"Sumologickey - 1",regex:"(?:sumo).{0,40}\\b([A-Za-z0-9]{14})\\b"},{name:"Sumologickey - 2",regex:"(?:sumo).{0,40}\\b([A-Za-z0-9]{64})\\b"},{name:"Supernotesapi",regex:"(?:supernotes).{0,40}([ \\r\\n]{0,1}[0-9A-Za-z\\-_]{43}[ \\r\\n]{1})"},{name:"Surveyanyplace - 1",regex:"(?:survey).{0,40}\\b([a-z0-9A-Z-]{36})\\b"},{name:"Surveyanyplace - 2",regex:"(?:survey).{0,40}\\b([a-z0-9A-Z]{32})\\b"},{name:"Surveybot",regex:"(?:surveybot).{0,40}\\b([A-Za-z0-9-]{80})\\b"},{name:"Surveysparrow",regex:"(?:surveysparrow).{0,40}\\b([a-zA-Z0-9-_]{88})\\b"},{name:"Survicate",regex:"(?:survicate).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Swell - 1",regex:"(?:swell).{0,40}\\b([a-zA-Z0-9]{6,24})\\b"},{name:"Swell - 2",regex:"(?:swell).{0,40}\\b([a-zA-Z0-9]{32})\\b"},{name:"Swiftype",regex:"(?:swiftype).{0,40}\\b([a-zA-z-0-9]{6}\\_[a-zA-z-0-9]{6}\\-[a-zA-z-0-9]{6})\\b"},{name:"Tallyfy",regex:"(?:tallyfy).{0,40}\\b([0-9A-Za-z]{36}\\.[0-9A-Za-z]{264}\\.[0-9A-Za-z\\-\\_]{683})\\b"},{name:"Tatumio",regex:"(?:tatum).{0,40}\\b([0-9a-z-]{36})\\b"},{name:"Taxjar",regex:"(?:taxjar).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Teamgate - 1",regex:"(?:teamgate).{0,40}\\b([a-z0-9]{40})\\b"},{name:"Teamgate - 2",regex:"(?:teamgate).{0,40}\\b([a-zA-Z0-9]{80})\\b"},{name:"Teamworkcrm",regex:"(?:teamwork|teamworkcrm).{0,40}\\b(tkn\\.v1_[0-9A-Za-z]{71}=[ \\r\\n]{1})"},{name:"Teamworkdesk",regex:"(?:teamwork|teamworkdesk).{0,40}\\b(tkn\\.v1_[0-9A-Za-z]{71}=[ \\r\\n]{1})"},{name:"Teamworkspaces",regex:"(?:teamwork|teamworkspaces).{0,40}\\b(tkn\\.v1_[0-9A-Za-z]{71}=[ \\r\\n]{1})"},{name:"Technicalanalysisapi",regex:"(?:technicalanalysisapi).{0,40}\\b([A-Z0-9]{48})\\b"},{name:"Telegram Bot API Key",regex:"[0-9]+:AA[0-9A-Za-z\\-_]{33}"},{name:"Telegram Secret",regex:"d{5,}:A[0-9a-z_-]{34,34}"},{name:"Telegrambottoken",regex:"(?:telegram).{0,40}\\b([0-9]{8,10}:[a-zA-Z0-9_-]{35})\\b"},{name:"Telnyx",regex:"(?:telnyx).{0,40}\\b(KEY[0-9A-Za-z_-]{55})\\b"},{name:"Terraformcloudpersonaltoken",regex:"\\b([A-Za-z0-9]{14}.atlasv1.[A-Za-z0-9]{67})\\b"},{name:"Text2data",regex:"(?:text2data).{0,40}\\b([0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12})\\b"},{name:"Textmagic - 1",regex:"(?:textmagic).{0,40}\\b([0-9A-Za-z]{30})\\b"},{name:"Textmagic - 2",regex:"(?:textmagic).{0,40}\\b([0-9A-Za-z]{1,25})\\b"},{name:"Theoddsapi",regex:"(?:theoddsapi|the-odds-api).{0,40}\\b([0-9a-f]{32})\\b"},{name:"Thinkific - 1",regex:"(?:thinkific).{0,40}\\b([0-9a-f]{32})\\b"},{name:"Thinkific - 2",regex:"(?:thinkific).{0,40}\\b([0-9A-Za-z]{4,40})\\b"},{name:"Thousandeyes - 1",regex:"(?:thousandeyes).{0,40}\\b([a-zA-Z0-9]{32})\\b"},{name:"Thousandeyes - 2",regex:"(?:thousandeyes).{0,40}\\b([a-zA-Z0-9]{3,20}@[a-zA-Z0-9]{2,12}.[a-zA-Z0-9]{2,5})\\b"},{name:"Ticketmaster",regex:"(?:ticketmaster).{0,40}\\b([a-zA-Z0-9]{32})\\b"},{name:"Tiingo",regex:"(?:tiingo).{0,40}\\b([0-9a-z]{40})\\b"},{name:"Timezoneapi",regex:"(?:timezoneapi).{0,40}\\b([a-zA-Z0-9]{20})\\b"},{name:"Tly",regex:"(?:tly).{0,40}\\b([0-9A-Za-z]{60})\\b"},{name:"Tmetric",regex:"(?:tmetric).{0,40}\\b([0-9A-Z]{64})\\b"},{name:"Todoist",regex:"(?:todoist).{0,40}\\b([0-9a-z]{40})\\b"},{name:"Toggltrack",regex:"(?:toggl).{0,40}\\b([0-9Aa-z]{32})\\b"},{name:"Tomorrowio",regex:"(?:tomorrow).{0,40}\\b([a-zA-Z0-9]{32})\\b"},{name:"Tomtom",regex:"(?:tomtom).{0,40}\\b([0-9Aa-zA-Z]{32})\\b"},{name:"Tradier",regex:"(?:tradier).{0,40}\\b([a-zA-Z0-9]{28})\\b"},{name:"Travelpayouts",regex:"(?:travelpayouts).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Travisci",regex:"(?:travis).{0,40}\\b([a-zA-Z0-9A-Z_]{22})\\b"},{name:"Trello URL",regex:"https://trello.com/b/[0-9a-z]/[0-9a-z_-]+"},{name:"Trelloapikey - 2",regex:"(?:trello).{0,40}\\b([a-zA-Z-0-9]{32})\\b"},{name:"Twelvedata",regex:"(?:twelvedata).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Twilio - 1",regex:"\\bAC[0-9a-f]{32}\\b"},{name:"Twilio API Key",regex:"SK[0-9a-fA-F]{32}"},{name:"Twitter Access Token",regex:"[tT][wW][iI][tT][tT][eE][rR].*[1-9][0-9]+-[0-9a-zA-Z]{40}"},{name:"Twitter Client ID",regex:"twitter[0-9a-z]{18,25}"},{name:"Twitter OAuth",regex:`[tT][wW][iI][tT][tT][eE][rR].*['|"][0-9a-zA-Z]{35,44}['|"]`},{name:"Twitter Secret Key",regex:"twitter[0-9a-z]{35,44}"},{name:"Tyntec",regex:"(?:tyntec).{0,40}\\b([a-zA-Z0-9]{32})\\b"},{name:"Typeform",regex:"(?:typeform).{0,40}\\b([0-9A-Za-z]{44})\\b"},{name:"Ubidots",regex:"\\b(BBFF-[0-9a-zA-Z]{30})\\b"},{name:"Unifyid",regex:"(?:unify).{0,40}\\b([0-9A-Za-z_=-]{44})"},{name:"Unplugg",regex:"(?:unplu).{0,40}\\b([a-z0-9]{64})\\b"},{name:"Unsplash",regex:"(?:unsplash).{0,40}\\b([0-9A-Za-z_]{43})\\b"},{name:"Upcdatabase",regex:"(?:upcdatabase).{0,40}\\b([A-Z0-9]{32})\\b"},{name:"Uplead",regex:"(?:uplead).{0,40}\\b([a-z0-9-]{32})\\b"},{name:"Uploadcare",regex:"(?:uploadcare).{0,40}\\b([a-z0-9]{20})\\b"},{name:"Upwave",regex:"(?:upwave).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Uri",regex:"\\b[a-zA-Z]{1,10}:?\\/\\/[-.%\\w{}]{1,50}:([-.%\\S]{3,50})@[-.%\\w\\/:]+\\b"},{name:"Urlscan",regex:"(?:urlscan).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Userstack",regex:"(?:userstack).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Vatlayer",regex:"(?:vatlayer).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Vercel",regex:"(?:vercel).{0,40}\\b([a-zA-Z0-9]{24})\\b"},{name:"Verifier - 1",regex:"(?:verifier).{0,40}\\b([a-zA-Z-0-9-]{5,16}\\@[a-zA-Z-0-9]{4,16}\\.[a-zA-Z-0-9]{3,6})\\b"},{name:"Verifier - 2",regex:"(?:verifier).{0,40}\\b([a-z0-9]{96})\\b"},{name:"Verimail",regex:"(?:verimail).{0,40}\\b([A-Z0-9]{32})\\b"},{name:"Veriphone",regex:"(?:veriphone).{0,40}\\b([0-9A-Z]{32})\\b"},{name:"Versioneye",regex:"(?:versioneye).{0,40}\\b([a-zA-Z0-9-]{40})\\b"},{name:"Viewneo",regex:"(?:viewneo).{0,40}\\b([a-z0-9A-Z]{120,300}.[a-z0-9A-Z]{150,300}.[a-z0-9A-Z-_]{600,800})"},{name:"Virustotal",regex:"(?:virustotal).{0,40}\\b([a-f0-9]{64})\\b"},{name:"Visualcrossing",regex:"(?:visualcrossing).{0,40}\\b([0-9A-Z]{25})\\b"},{name:"Voicegain",regex:"(?:voicegain).{0,40}\\b(ey[0-9a-zA-Z_-]{34}.ey[0-9a-zA-Z_-]{108}.[0-9a-zA-Z_-]{43})\\b"},{name:"Vouchery - 1",regex:"(?:vouchery).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Vouchery - 2",regex:"(?:vouchery).{0,40}\\b([a-zA-Z0-9-\\S]{2,20})\\b"},{name:"Vpnapi",regex:"(?:vpnapi).{0,40}\\b([a-z0-9A-Z]{32})\\b"},{name:"Vultrapikey",regex:"(?:vultr).{0,40} \\b([A-Z0-9]{36})\\b"},{name:"Vyte",regex:"(?:vyte).{0,40}\\b([0-9a-z]{50})\\b"},{name:"Walkscore",regex:"(?:walkscore).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Weatherbit",regex:"(?:weatherbit).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Weatherstack",regex:"(?:weatherstack).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Webex - 1",regex:"(?:error).{0,40}(redirect_uri_mismatch)"},{name:"Webex - 2",regex:"(?:webex).{0,40}\\b([A-Za-z0-9_-]{65})\\b"},{name:"Webex - 3",regex:"(?:webex).{0,40}\\b([A-Za-z0-9_-]{64})\\b"},{name:"Webflow",regex:"(?:webflow).{0,40}\\b([a-zA0-9]{64})\\b"},{name:"Webscraper",regex:"(?:webscraper).{0,40}\\b([a-zA-Z0-9]{60})\\b"},{name:"Webscraping",regex:"(?:webscraping).{0,40}\\b([0-9A-Za-z]{32})\\b"},{name:"Wepay - 2",regex:"(?:wepay).{0,40}\\b([a-zA-Z0-9_?]{62})\\b"},{name:"Whoxy",regex:"(?:whoxy).{0,40}\\b([0-9a-z]{33})\\b"},{name:"Worksnaps",regex:"(?:worksnaps).{0,40}\\b([0-9A-Za-z]{40})\\b"},{name:"Workstack",regex:"(?:workstack).{0,40}\\b([0-9Aa-zA-Z]{60})\\b"},{name:"Worldcoinindex",regex:"(?:worldcoinindex).{0,40}\\b([a-zA-Z0-9]{35})\\b"},{name:"Worldweather",regex:"(?:worldweather).{0,40}\\b([0-9a-z]{31})\\b"},{name:"Wrike",regex:"(?:wrike).{0,40}\\b(ey[a-zA-Z0-9-._]{333})\\b"},{name:"Yandex",regex:"(?:yandex).{0,40}\\b([a-z0-9A-Z.]{83})\\b"},{name:"Youneedabudget",regex:"(?:youneedabudget).{0,40}\\b([0-9a-f]{64})\\b"},{name:"Yousign",regex:"(?:yousign).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Youtubeapikey - 1",regex:"(?:youtube).{0,40}\\b([a-zA-Z-0-9_]{39})\\b"},{name:"Zapier Webhook",regex:"https://(?:www.)?hooks\\.zapier\\.com/hooks/catch/[A-Za-z0-9]+/[A-Za-z0-9]+/"},{name:"Zapierwebhook",regex:"(https:\\/\\/hooks.zapier.com\\/hooks\\/catch\\/[A-Za-z0-9\\/]{16})"},{name:"Zendeskapi - 3",regex:"(?:zendesk).{0,40}([A-Za-z0-9_-]{40})"},{name:"Zenkitapi",regex:"(?:zenkit).{0,40}\\b([0-9a-z]{8}\\-[0-9A-Za-z]{32})\\b"},{name:"Zenscrape",regex:"(?:zenscrape).{0,40}\\b([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\\b"},{name:"Zenserp",regex:"(?:zenserp).{0,40}\\b([0-9a-z-]{36})\\b"},{name:"Zeplin",regex:"(?:zeplin).{0,40}\\b([a-zA-Z0-9-.]{350,400})\\b"},{name:"Zerobounce",regex:"(?:zerobounce).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Zipapi - 1",regex:"(?:zipapi).{0,40}\\b([a-zA-Z0-9!=@#$%^]{7,})"},{name:"Zipapi - 3",regex:"(?:zipapi).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Zipcodeapi",regex:"(?:zipcodeapi).{0,40}\\b([a-zA-Z0-9]{64})\\b"},{name:"Zoho Webhook",regex:"https://creator\\.zoho\\.com/api/[A-Za-z0-9/\\-_\\.]+\\?authtoken=[A-Za-z0-9]+"},{name:"Zonkafeedback",regex:"(?:zonka).{0,40}\\b([A-Za-z0-9]{36})\\b"},{name:"access_key_secret",regex:"access[_-]?key[_-]?secret(=| =|:| :)"},{name:"access_secret",regex:"access[_-]?secret(=| =|:| :)"},{name:"access_token",regex:"access[_-]?token(=| =|:| :)"},{name:"account_sid",regex:"account[_-]?sid(=| =|:| :)"},{name:"admin_email",regex:"admin[_-]?email(=| =|:| :)"},{name:"adzerk_api_key",regex:"adzerk[_-]?api[_-]?key(=| =|:| :)"},{name:"algolia_admin_key_1",regex:"algolia[_-]?admin[_-]?key[_-]?1(=| =|:| :)"},{name:"algolia_admin_key_2",regex:"algolia[_-]?admin[_-]?key[_-]?2(=| =|:| :)"},{name:"algolia_admin_key_mcm",regex:"algolia[_-]?admin[_-]?key[_-]?mcm(=| =|:| :)"},{name:"algolia_api_key",regex:"algolia[_-]?api[_-]?key(=| =|:| :)"},{name:"algolia_api_key_mcm",regex:"algolia[_-]?api[_-]?key[_-]?mcm(=| =|:| :)"},{name:"algolia_api_key_search",regex:"algolia[_-]?api[_-]?key[_-]?search(=| =|:| :)"},{name:"algolia_search_api_key",regex:"algolia[_-]?search[_-]?api[_-]?key(=| =|:| :)"},{name:"algolia_search_key",regex:"algolia[_-]?search[_-]?key(=| =|:| :)"},{name:"algolia_search_key_1",regex:"algolia[_-]?search[_-]?key[_-]?1(=| =|:| :)"},{name:"alias_pass",regex:"alias[_-]?pass(=| =|:| :)"},{name:"alicloud_access_key",regex:"alicloud[_-]?access[_-]?key(=| =|:| :)"},{name:"alicloud_secret_key",regex:"alicloud[_-]?secret[_-]?key(=| =|:| :)"},{name:"amazon_bucket_name",regex:"amazon[_-]?bucket[_-]?name(=| =|:| :)"},{name:"amazon_secret_access_key",regex:"amazon[_-]?secret[_-]?access[_-]?key(=| =|:| :)"},{name:"anaconda_token",regex:"anaconda[_-]?token(=| =|:| :)"},{name:"android_docs_deploy_token",regex:"android[_-]?docs[_-]?deploy[_-]?token(=| =|:| :)"},{name:"ansible_vault_password",regex:"ansible[_-]?vault[_-]?password(=| =|:| :)"},{name:"aos_key",regex:"aos[_-]?key(=| =|:| :)"},{name:"aos_sec",regex:"aos[_-]?sec(=| =|:| :)"},{name:"api_key",regex:"api[_-]?key(=| =|:| :)"},{name:"api_key_secret",regex:"api[_-]?key[_-]?secret(=| =|:| :)"},{name:"api_key_sid",regex:"api[_-]?key[_-]?sid(=| =|:| :)"},{name:"api_secret",regex:"api[_-]?secret(=| =|:| :)"},{name:"apiary_api_key",regex:"apiary[_-]?api[_-]?key(=| =|:| :)"},{name:"apigw_access_token",regex:"apigw[_-]?access[_-]?token(=| =|:| :)"},{name:"apikey_patterns",regex:`apikey[:](?:['"]?[a-zA-Z0-9-_|]+['"]?)`},{name:"app_bucket_perm",regex:"app[_-]?bucket[_-]?perm(=| =|:| :)"},{name:"app_report_token_key",regex:"app[_-]?report[_-]?token[_-]?key(=| =|:| :)"},{name:"app_secrete",regex:"app[_-]?secrete(=| =|:| :)"},{name:"app_token",regex:"app[_-]?token(=| =|:| :)"},{name:"appclientsecret",regex:"appclientsecret(=| =|:| :)"},{name:"apple_id_password",regex:"apple[_-]?id[_-]?password(=| =|:| :)"},{name:"argos_token",regex:"argos[_-]?token(=| =|:| :)"},{name:"artifactory",regex:`(artifactory.{0,50}("|')?[a-zA-Z0-9=]{112}("|')?)`},{name:"artifactory_key",regex:"artifactory[_-]?key(=| =|:| :)"},{name:"artifacts_aws_access_key_id",regex:"artifacts[_-]?aws[_-]?access[_-]?key[_-]?id(=| =|:| :)"},{name:"artifacts_aws_secret_access_key",regex:"artifacts[_-]?aws[_-]?secret[_-]?access[_-]?key(=| =|:| :)"},{name:"artifacts_bucket",regex:"artifacts[_-]?bucket(=| =|:| :)"},{name:"artifacts_key",regex:"artifacts[_-]?key(=| =|:| :)"},{name:"artifacts_secret",regex:"artifacts[_-]?secret(=| =|:| :)"},{name:"assistant_iam_apikey",regex:"assistant[_-]?iam[_-]?apikey(=| =|:| :)"},{name:"auth0_api_clientsecret",regex:"auth0[_-]?api[_-]?clientsecret(=| =|:| :)"},{name:"auth0_client_secret",regex:"auth0[_-]?client[_-]?secret(=| =|:| :)"},{name:"auth_token",regex:"auth[_-]?token(=| =|:| :)"},{name:"author_email_addr",regex:"author[_-]?email[_-]?addr(=| =|:| :)"},{name:"author_npm_api_key",regex:"author[_-]?npm[_-]?api[_-]?key(=| =|:| :)"},{name:"aws_access",regex:"aws[_-]?access(=| =|:| :)"},{name:"aws_access_key",regex:"aws[_-]?access[_-]?key(=| =|:| :)"},{name:"aws_access_key_id - 1",regex:"aws[_-]?access[_-]?key[_-]?id(=| =|:| :)"},{name:"aws_config_accesskeyid",regex:"aws[_-]?config[_-]?accesskeyid(=| =|:| :)"},{name:"aws_config_secretaccesskey",regex:"aws[_-]?config[_-]?secretaccesskey(=| =|:| :)"},{name:"aws_key",regex:"aws[_-]?key(=| =|:| :)"},{name:"aws_patterns",regex:"(?:accesskeyid|secretaccesskey|aws_access_key_id|aws_secret_access_key)"},{name:"aws_secret",regex:"aws[_-]?secret(=| =|:| :)"},{name:"aws_secret_access_key",regex:"aws[_-]?secret[_-]?access[_-]?key(=| =|:| :)"},{name:"aws_secret_key",regex:"aws[_-]?secret[_-]?key(=| =|:| :)"},{name:"aws_secrets",regex:"aws[_-]?secrets(=| =|:| :)"},{name:"aws_ses_access_key_id",regex:"aws[_-]?ses[_-]?access[_-]?key[_-]?id(=| =|:| :)"},{name:"aws_ses_secret_access_key",regex:"aws[_-]?ses[_-]?secret[_-]?access[_-]?key(=| =|:| :)"},{name:"awsaccesskeyid",regex:"awsaccesskeyid(=| =|:| :)"},{name:"awscn_access_key_id",regex:"awscn[_-]?access[_-]?key[_-]?id(=| =|:| :)"},{name:"awscn_secret_access_key",regex:"awscn[_-]?secret[_-]?access[_-]?key(=| =|:| :)"},{name:"awssecretkey",regex:"awssecretkey(=| =|:| :)"},{name:"b2_app_key",regex:"b2[_-]?app[_-]?key(=| =|:| :)"},{name:"b2_bucket",regex:"b2[_-]?bucket(=| =|:| :)"},{name:"bintray_api_key",regex:"bintray[_-]?api[_-]?key(=| =|:| :)"},{name:"bintray_apikey",regex:"bintray[_-]?apikey(=| =|:| :)"},{name:"bintray_gpg_password",regex:"bintray[_-]?gpg[_-]?password(=| =|:| :)"},{name:"bintray_key",regex:"bintray[_-]?key(=| =|:| :)"},{name:"bintray_token",regex:"bintray[_-]?token(=| =|:| :)"},{name:"bintraykey",regex:"bintraykey(=| =|:| :)"},{name:"bluemix_api_key",regex:"bluemix[_-]?api[_-]?key(=| =|:| :)"},{name:"bluemix_auth",regex:"bluemix[_-]?auth(=| =|:| :)"},{name:"bluemix_pass",regex:"bluemix[_-]?pass(=| =|:| :)"},{name:"bluemix_pass_prod",regex:"bluemix[_-]?pass[_-]?prod(=| =|:| :)"},{name:"bluemix_password",regex:"bluemix[_-]?password(=| =|:| :)"},{name:"bluemix_pwd",regex:"bluemix[_-]?pwd(=| =|:| :)"},{name:"bluemix_username",regex:"bluemix[_-]?username(=| =|:| :)"},{name:"brackets_repo_oauth_token",regex:"brackets[_-]?repo[_-]?oauth[_-]?token(=| =|:| :)"},{name:"browser_stack_access_key",regex:"browser[_-]?stack[_-]?access[_-]?key(=| =|:| :)"},{name:"browserstack_access_key",regex:"browserstack[_-]?access[_-]?key(=| =|:| :)"},{name:"bucketeer_aws_access_key_id",regex:"bucketeer[_-]?aws[_-]?access[_-]?key[_-]?id(=| =|:| :)"},{name:"bucketeer_aws_secret_access_key",regex:"bucketeer[_-]?aws[_-]?secret[_-]?access[_-]?key(=| =|:| :)"},{name:"built_branch_deploy_key",regex:"built[_-]?branch[_-]?deploy[_-]?key(=| =|:| :)"},{name:"bundlesize_github_token",regex:"bundlesize[_-]?github[_-]?token(=| =|:| :)"},{name:"bx_password",regex:"bx[_-]?password(=| =|:| :)"},{name:"bx_username",regex:"bx[_-]?username(=| =|:| :)"},{name:"cache_s3_secret_key",regex:"cache[_-]?s3[_-]?secret[_-]?key(=| =|:| :)"},{name:"cargo_token",regex:"cargo[_-]?token(=| =|:| :)"},{name:"cattle_access_key",regex:"cattle[_-]?access[_-]?key(=| =|:| :)"},{name:"cattle_agent_instance_auth",regex:"cattle[_-]?agent[_-]?instance[_-]?auth(=| =|:| :)"},{name:"cattle_secret_key",regex:"cattle[_-]?secret[_-]?key(=| =|:| :)"},{name:"censys_secret",regex:"censys[_-]?secret(=| =|:| :)"},{name:"certificate_password",regex:"certificate[_-]?password(=| =|:| :)"},{name:"cf_password",regex:"cf[_-]?password(=| =|:| :)"},{name:"cheverny_token",regex:"cheverny[_-]?token(=| =|:| :)"},{name:"chrome_client_secret",regex:"chrome[_-]?client[_-]?secret(=| =|:| :)"},{name:"chrome_refresh_token",regex:"chrome[_-]?refresh[_-]?token(=| =|:| :)"},{name:"ci_deploy_password",regex:"ci[_-]?deploy[_-]?password(=| =|:| :)"},{name:"ci_project_url",regex:"ci[_-]?project[_-]?url(=| =|:| :)"},{name:"ci_registry_user",regex:"ci[_-]?registry[_-]?user(=| =|:| :)"},{name:"ci_server_name",regex:"ci[_-]?server[_-]?name(=| =|:| :)"},{name:"ci_user_token",regex:"ci[_-]?user[_-]?token(=| =|:| :)"},{name:"claimr_database",regex:"claimr[_-]?database(=| =|:| :)"},{name:"claimr_db",regex:"claimr[_-]?db(=| =|:| :)"},{name:"claimr_superuser",regex:"claimr[_-]?superuser(=| =|:| :)"},{name:"claimr_token",regex:"claimr[_-]?token(=| =|:| :)"},{name:"cli_e2e_cma_token",regex:"cli[_-]?e2e[_-]?cma[_-]?token(=| =|:| :)"},{name:"client_secret",regex:"client[_-]?secret(=| =|:| :)"},{name:"clojars_password",regex:"clojars[_-]?password(=| =|:| :)"},{name:"cloud_api_key",regex:"cloud[_-]?api[_-]?key(=| =|:| :)"},{name:"cloudant_archived_database",regex:"cloudant[_-]?archived[_-]?database(=| =|:| :)"},{name:"cloudant_audited_database",regex:"cloudant[_-]?audited[_-]?database(=| =|:| :)"},{name:"cloudant_database",regex:"cloudant[_-]?database(=| =|:| :)"},{name:"cloudant_instance",regex:"cloudant[_-]?instance(=| =|:| :)"},{name:"cloudant_order_database",regex:"cloudant[_-]?order[_-]?database(=| =|:| :)"},{name:"cloudant_parsed_database",regex:"cloudant[_-]?parsed[_-]?database(=| =|:| :)"},{name:"cloudant_password",regex:"cloudant[_-]?password(=| =|:| :)"},{name:"cloudant_processed_database",regex:"cloudant[_-]?processed[_-]?database(=| =|:| :)"},{name:"cloudant_service_database",regex:"cloudant[_-]?service[_-]?database(=| =|:| :)"},{name:"cloudflare_api_key",regex:"cloudflare[_-]?api[_-]?key(=| =|:| :)"},{name:"cloudflare_auth_email",regex:"cloudflare[_-]?auth[_-]?email(=| =|:| :)"},{name:"cloudflare_auth_key",regex:"cloudflare[_-]?auth[_-]?key(=| =|:| :)"},{name:"cloudflare_email",regex:"cloudflare[_-]?email(=| =|:| :)"},{name:"cloudinary_url",regex:"cloudinary[_-]?url(=| =|:| :)"},{name:"cloudinary_url_staging",regex:"cloudinary[_-]?url[_-]?staging(=| =|:| :)"},{name:"clu_repo_url",regex:"clu[_-]?repo[_-]?url(=| =|:| :)"},{name:"clu_ssh_private_key_base64",regex:"clu[_-]?ssh[_-]?private[_-]?key[_-]?base64(=| =|:| :)"},{name:"cn_access_key_id",regex:"cn[_-]?access[_-]?key[_-]?id(=| =|:| :)"},{name:"cn_secret_access_key",regex:"cn[_-]?secret[_-]?access[_-]?key(=| =|:| :)"},{name:"cocoapods_trunk_email",regex:"cocoapods[_-]?trunk[_-]?email(=| =|:| :)"},{name:"cocoapods_trunk_token",regex:"cocoapods[_-]?trunk[_-]?token(=| =|:| :)"},{name:"codacy_project_token",regex:"codacy[_-]?project[_-]?token(=| =|:| :)"},{name:"codeclimate",regex:`(codeclima.{0,50}("|')?[0-9a-f]{64}("|')?)`},{name:"codeclimate_repo_token",regex:"codeclimate[_-]?repo[_-]?token(=| =|:| :)"},{name:"codecov_token",regex:"codecov[_-]?token(=| =|:| :)"},{name:"coding_token",regex:"coding[_-]?token(=| =|:| :)"},{name:"conekta_apikey",regex:"conekta[_-]?apikey(=| =|:| :)"},{name:"consumer_key",regex:"consumer[_-]?key(=| =|:| :)"},{name:"consumerkey",regex:"consumerkey(=| =|:| :)"},{name:"contentful_access_token",regex:"contentful[_-]?access[_-]?token(=| =|:| :)"},{name:"contentful_cma_test_token",regex:"contentful[_-]?cma[_-]?test[_-]?token(=| =|:| :)"},{name:"contentful_integration_management_token",regex:"contentful[_-]?integration[_-]?management[_-]?token(=| =|:| :)"},{name:"contentful_php_management_test_token",regex:"contentful[_-]?php[_-]?management[_-]?test[_-]?token(=| =|:| :)"},{name:"contentful_test_org_cma_token",regex:"contentful[_-]?test[_-]?org[_-]?cma[_-]?token(=| =|:| :)"},{name:"contentful_v2_access_token",regex:"contentful[_-]?v2[_-]?access[_-]?token(=| =|:| :)"},{name:"conversation_password",regex:"conversation[_-]?password(=| =|:| :)"},{name:"conversation_username",regex:"conversation[_-]?username(=| =|:| :)"},{name:"cos_secrets",regex:"cos[_-]?secrets(=| =|:| :)"},{name:"coveralls_api_token",regex:"coveralls[_-]?api[_-]?token(=| =|:| :)"},{name:"coveralls_repo_token",regex:"coveralls[_-]?repo[_-]?token(=| =|:| :)"},{name:"coveralls_token",regex:"coveralls[_-]?token(=| =|:| :)"},{name:"coverity_scan_token",regex:"coverity[_-]?scan[_-]?token(=| =|:| :)"},{name:"cypress_record_key",regex:"cypress[_-]?record[_-]?key(=| =|:| :)"},{name:"danger_github_api_token",regex:"danger[_-]?github[_-]?api[_-]?token(=| =|:| :)"},{name:"database_host",regex:"database[_-]?host(=| =|:| :)"},{name:"database_name",regex:"database[_-]?name(=| =|:| :)"},{name:"database_password",regex:"database[_-]?password(=| =|:| :)"},{name:"database_port",regex:"database[_-]?port(=| =|:| :)"},{name:"database_user",regex:"database[_-]?user(=| =|:| :)"},{name:"database_username",regex:"database[_-]?username(=| =|:| :)"},{name:"datadog_api_key",regex:"datadog[_-]?api[_-]?key(=| =|:| :)"},{name:"datadog_app_key",regex:"datadog[_-]?app[_-]?key(=| =|:| :)"},{name:"db_connection",regex:"db[_-]?connection(=| =|:| :)"},{name:"db_database",regex:"db[_-]?database(=| =|:| :)"},{name:"db_host",regex:"db[_-]?host(=| =|:| :)"},{name:"db_password",regex:"db[_-]?password(=| =|:| :)"},{name:"db_pw",regex:"db[_-]?pw(=| =|:| :)"},{name:"db_user",regex:"db[_-]?user(=| =|:| :)"},{name:"db_username",regex:"db[_-]?username(=| =|:| :)"},{name:"ddg_test_email",regex:"ddg[_-]?test[_-]?email(=| =|:| :)"},{name:"ddg_test_email_pw",regex:"ddg[_-]?test[_-]?email[_-]?pw(=| =|:| :)"},{name:"ddgc_github_token",regex:"ddgc[_-]?github[_-]?token(=| =|:| :)"},{name:"deploy_password",regex:"deploy[_-]?password(=| =|:| :)"},{name:"deploy_secure",regex:"deploy[_-]?secure(=| =|:| :)"},{name:"deploy_token",regex:"deploy[_-]?token(=| =|:| :)"},{name:"deploy_user",regex:"deploy[_-]?user(=| =|:| :)"},{name:"dgpg_passphrase",regex:"dgpg[_-]?passphrase(=| =|:| :)"},{name:"digitalocean_access_token",regex:"digitalocean[_-]?access[_-]?token(=| =|:| :)"},{name:"digitalocean_ssh_key_body",regex:"digitalocean[_-]?ssh[_-]?key[_-]?body(=| =|:| :)"},{name:"digitalocean_ssh_key_ids",regex:"digitalocean[_-]?ssh[_-]?key[_-]?ids(=| =|:| :)"},{name:"docker_hub_password",regex:"docker[_-]?hub[_-]?password(=| =|:| :)"},{name:"docker_key",regex:"docker[_-]?key(=| =|:| :)"},{name:"docker_pass",regex:"docker[_-]?pass(=| =|:| :)"},{name:"docker_passwd",regex:"docker[_-]?passwd(=| =|:| :)"},{name:"docker_password",regex:"docker[_-]?password(=| =|:| :)"},{name:"docker_postgres_url",regex:"docker[_-]?postgres[_-]?url(=| =|:| :)"},{name:"docker_token",regex:"docker[_-]?token(=| =|:| :)"},{name:"dockerhub_password",regex:"dockerhub[_-]?password(=| =|:| :)"},{name:"dockerhubpassword",regex:"dockerhubpassword(=| =|:| :)"},{name:"doordash_auth_token",regex:"doordash[_-]?auth[_-]?token(=| =|:| :)"},{name:"dropbox_oauth_bearer",regex:"dropbox[_-]?oauth[_-]?bearer(=| =|:| :)"},{name:"droplet_travis_password",regex:"droplet[_-]?travis[_-]?password(=| =|:| :)"},{name:"dsonar_login",regex:"dsonar[_-]?login(=| =|:| :)"},{name:"dsonar_projectkey",regex:"dsonar[_-]?projectkey(=| =|:| :)"},{name:"elastic_cloud_auth",regex:"elastic[_-]?cloud[_-]?auth(=| =|:| :)"},{name:"elasticsearch_password",regex:"elasticsearch[_-]?password(=| =|:| :)"},{name:"encryption_password",regex:"encryption[_-]?password(=| =|:| :)"},{name:"end_user_password",regex:"end[_-]?user[_-]?password(=| =|:| :)"},{name:"env_github_oauth_token",regex:"env[_-]?github[_-]?oauth[_-]?token(=| =|:| :)"},{name:"env_heroku_api_key",regex:"env[_-]?heroku[_-]?api[_-]?key(=| =|:| :)"},{name:"env_key",regex:"env[_-]?key(=| =|:| :)"},{name:"env_secret",regex:"env[_-]?secret(=| =|:| :)"},{name:"env_secret_access_key",regex:"env[_-]?secret[_-]?access[_-]?key(=| =|:| :)"},{name:"env_sonatype_password",regex:"env[_-]?sonatype[_-]?password(=| =|:| :)"},{name:"eureka_awssecretkey",regex:"eureka[_-]?awssecretkey(=| =|:| :)"},{name:"exp_password",regex:"exp[_-]?password(=| =|:| :)"},{name:"facebook_access_token",regex:"(EAACEdEose0cBA[0-9A-Za-z]+)"},{name:"facebook_oauth",regex:`[f|F][a|A][c|C][e|E][b|B][o|O][o|O][k|K].*['|"][0-9a-f]{32}['|"]`},{name:"file_password",regex:"file[_-]?password(=| =|:| :)"},{name:"firebase_api_json",regex:"firebase[_-]?api[_-]?json(=| =|:| :)"},{name:"firebase_api_token",regex:"firebase[_-]?api[_-]?token(=| =|:| :)"},{name:"firebase_key",regex:"firebase[_-]?key(=| =|:| :)"},{name:"firebase_project_develop",regex:"firebase[_-]?project[_-]?develop(=| =|:| :)"},{name:"firebase_token",regex:"firebase[_-]?token(=| =|:| :)"},{name:"firefox_secret",regex:"firefox[_-]?secret(=| =|:| :)"},{name:"flask_secret_key",regex:"flask[_-]?secret[_-]?key(=| =|:| :)"},{name:"flickr_api_key",regex:"flickr[_-]?api[_-]?key(=| =|:| :)"},{name:"flickr_api_secret",regex:"flickr[_-]?api[_-]?secret(=| =|:| :)"},{name:"fossa_api_key",regex:"fossa[_-]?api[_-]?key(=| =|:| :)"},{name:"ftp_host",regex:"ftp[_-]?host(=| =|:| :)"},{name:"ftp_login",regex:"ftp[_-]?login(=| =|:| :)"},{name:"ftp_password",regex:"ftp[_-]?password(=| =|:| :)"},{name:"ftp_pw",regex:"ftp[_-]?pw(=| =|:| :)"},{name:"ftp_user",regex:"ftp[_-]?user(=| =|:| :)"},{name:"ftp_username",regex:"ftp[_-]?username(=| =|:| :)"},{name:"gcloud_bucket",regex:"gcloud[_-]?bucket(=| =|:| :)"},{name:"gcloud_project",regex:"gcloud[_-]?project(=| =|:| :)"},{name:"gcloud_service_key",regex:"gcloud[_-]?service[_-]?key(=| =|:| :)"},{name:"gcr_password",regex:"gcr[_-]?password(=| =|:| :)"},{name:"gcs_bucket",regex:"gcs[_-]?bucket(=| =|:| :)"},{name:"gh_api_key",regex:"gh[_-]?api[_-]?key(=| =|:| :)"},{name:"gh_email",regex:"gh[_-]?email(=| =|:| :)"},{name:"gh_next_oauth_client_secret",regex:"gh[_-]?next[_-]?oauth[_-]?client[_-]?secret(=| =|:| :)"},{name:"gh_next_unstable_oauth_client_id",regex:"gh[_-]?next[_-]?unstable[_-]?oauth[_-]?client[_-]?id(=| =|:| :)"},{name:"gh_next_unstable_oauth_client_secret",regex:"gh[_-]?next[_-]?unstable[_-]?oauth[_-]?client[_-]?secret(=| =|:| :)"},{name:"gh_oauth_client_secret",regex:"gh[_-]?oauth[_-]?client[_-]?secret(=| =|:| :)"},{name:"gh_oauth_token",regex:"gh[_-]?oauth[_-]?token(=| =|:| :)"},{name:"gh_repo_token",regex:"gh[_-]?repo[_-]?token(=| =|:| :)"},{name:"gh_token",regex:"gh[_-]?token(=| =|:| :)"},{name:"gh_unstable_oauth_client_secret",regex:"gh[_-]?unstable[_-]?oauth[_-]?client[_-]?secret(=| =|:| :)"},{name:"ghb_token",regex:"ghb[_-]?token(=| =|:| :)"},{name:"ghost_api_key",regex:"ghost[_-]?api[_-]?key(=| =|:| :)"},{name:"git_author_email",regex:"git[_-]?author[_-]?email(=| =|:| :)"},{name:"git_author_name",regex:"git[_-]?author[_-]?name(=| =|:| :)"},{name:"git_committer_email",regex:"git[_-]?committer[_-]?email(=| =|:| :)"},{name:"git_committer_name",regex:"git[_-]?committer[_-]?name(=| =|:| :)"},{name:"git_email",regex:"git[_-]?email(=| =|:| :)"},{name:"git_name",regex:"git[_-]?name(=| =|:| :)"},{name:"git_token",regex:"git[_-]?token(=| =|:| :)"},{name:"github_access_token - 1",regex:"github[_-]?access[_-]?token(=| =|:| :)"},{name:"github_access_token - 2",regex:"[a-zA-Z0-9_-]*:[a-zA-Z0-9_-]+@github.com*"},{name:"github_api_key",regex:"github[_-]?api[_-]?key(=| =|:| :)"},{name:"github_api_token",regex:"github[_-]?api[_-]?token(=| =|:| :)"},{name:"github_auth",regex:"github[_-]?auth(=| =|:| :)"},{name:"github_auth_token",regex:"github[_-]?auth[_-]?token(=| =|:| :)"},{name:"github_client_secret",regex:"github[_-]?client[_-]?secret(=| =|:| :)"},{name:"github_deploy_hb_doc_pass",regex:"github[_-]?deploy[_-]?hb[_-]?doc[_-]?pass(=| =|:| :)"},{name:"github_deployment_token",regex:"github[_-]?deployment[_-]?token(=| =|:| :)"},{name:"github_hunter_token",regex:"github[_-]?hunter[_-]?token(=| =|:| :)"},{name:"github_hunter_username",regex:"github[_-]?hunter[_-]?username(=| =|:| :)"},{name:"github_key",regex:"github[_-]?key(=| =|:| :)"},{name:"github_oauth",regex:"github[_-]?oauth(=| =|:| :)"},{name:"github_oauth_token",regex:"github[_-]?oauth[_-]?token(=| =|:| :)"},{name:"github_password",regex:"github[_-]?password(=| =|:| :)"},{name:"github_pwd",regex:"github[_-]?pwd(=| =|:| :)"},{name:"github_release_token",regex:"github[_-]?release[_-]?token(=| =|:| :)"},{name:"github_repo",regex:"github[_-]?repo(=| =|:| :)"},{name:"github_token",regex:"github[_-]?token(=| =|:| :)"},{name:"github_tokens",regex:"github[_-]?tokens(=| =|:| :)"},{name:"gitlab_user_email",regex:"gitlab[_-]?user[_-]?email(=| =|:| :)"},{name:"gogs_password",regex:"gogs[_-]?password(=| =|:| :)"},{name:"google_account_type",regex:"google[_-]?account[_-]?type(=| =|:| :)"},{name:"google_client_email",regex:"google[_-]?client[_-]?email(=| =|:| :)"},{name:"google_client_id",regex:"google[_-]?client[_-]?id(=| =|:| :)"},{name:"google_client_secret",regex:"google[_-]?client[_-]?secret(=| =|:| :)"},{name:"google_maps_api_key",regex:"google[_-]?maps[_-]?api[_-]?key(=| =|:| :)"},{name:"google_oauth",regex:"(ya29.[0-9A-Za-z-_]+)"},{name:"google_patterns",regex:"(?:google_client_id|google_client_secret|google_client_token)"},{name:"google_private_key",regex:"google[_-]?private[_-]?key(=| =|:| :)"},{name:"google_url",regex:"([0-9]{12}-[a-z0-9]{32}.apps.googleusercontent.com)"},{name:"gpg_key_name",regex:"gpg[_-]?key[_-]?name(=| =|:| :)"},{name:"gpg_keyname",regex:"gpg[_-]?keyname(=| =|:| :)"},{name:"gpg_ownertrust",regex:"gpg[_-]?ownertrust(=| =|:| :)"},{name:"gpg_passphrase",regex:"gpg[_-]?passphrase(=| =|:| :)"},{name:"gpg_private_key",regex:"gpg[_-]?private[_-]?key(=| =|:| :)"},{name:"gpg_secret_keys",regex:"gpg[_-]?secret[_-]?keys(=| =|:| :)"},{name:"gradle_publish_key",regex:"gradle[_-]?publish[_-]?key(=| =|:| :)"},{name:"gradle_publish_secret",regex:"gradle[_-]?publish[_-]?secret(=| =|:| :)"},{name:"gradle_signing_key_id",regex:"gradle[_-]?signing[_-]?key[_-]?id(=| =|:| :)"},{name:"gradle_signing_password",regex:"gradle[_-]?signing[_-]?password(=| =|:| :)"},{name:"gren_github_token",regex:"gren[_-]?github[_-]?token(=| =|:| :)"},{name:"grgit_user",regex:"grgit[_-]?user(=| =|:| :)"},{name:"hab_auth_token",regex:"hab[_-]?auth[_-]?token(=| =|:| :)"},{name:"hab_key",regex:"hab[_-]?key(=| =|:| :)"},{name:"hb_codesign_gpg_pass",regex:"hb[_-]?codesign[_-]?gpg[_-]?pass(=| =|:| :)"},{name:"hb_codesign_key_pass",regex:"hb[_-]?codesign[_-]?key[_-]?pass(=| =|:| :)"},{name:"heroku_api_key",regex:"heroku[_-]?api[_-]?key(=| =|:| :)"},{name:"heroku_api_key_api_key",regex:"([h|H][e|E][r|R][o|O][k|K][u|U].{0,30}[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12})"},{name:"heroku_email",regex:"heroku[_-]?email(=| =|:| :)"},{name:"heroku_token",regex:"heroku[_-]?token(=| =|:| :)"},{name:"hockeyapp",regex:`hockey.{0,50}("|')?[0-9a-f]{32}("|')?`},{name:"hockeyapp_token",regex:"hockeyapp[_-]?token(=| =|:| :)"},{name:"homebrew_github_api_token",regex:"homebrew[_-]?github[_-]?api[_-]?token(=| =|:| :)"},{name:"hub_dxia2_password",regex:"hub[_-]?dxia2[_-]?password(=| =|:| :)"},{name:"ij_repo_password",regex:"ij[_-]?repo[_-]?password(=| =|:| :)"},{name:"ij_repo_username",regex:"ij[_-]?repo[_-]?username(=| =|:| :)"},{name:"index_name",regex:"index[_-]?name(=| =|:| :)"},{name:"integration_test_api_key",regex:"integration[_-]?test[_-]?api[_-]?key(=| =|:| :)"},{name:"integration_test_appid",regex:"integration[_-]?test[_-]?appid(=| =|:| :)"},{name:"internal_secrets",regex:"internal[_-]?secrets(=| =|:| :)"},{name:"ios_docs_deploy_token",regex:"ios[_-]?docs[_-]?deploy[_-]?token(=| =|:| :)"},{name:"itest_gh_token",regex:"itest[_-]?gh[_-]?token(=| =|:| :)"},{name:"jdbc",regex:"mysql: jdbc:mysql(=| =|:| :)"},{name:"jdbc_databaseurl",regex:"jdbc[_-]?databaseurl(=| =|:| :)"},{name:"jdbc_host",regex:"jdbc[_-]?host(=| =|:| :)"},{name:"jwt_secret",regex:"jwt[_-]?secret(=| =|:| :)"},{name:"kafka_admin_url",regex:"kafka[_-]?admin[_-]?url(=| =|:| :)"},{name:"kafka_instance_name",regex:"kafka[_-]?instance[_-]?name(=| =|:| :)"},{name:"kafka_rest_url",regex:"kafka[_-]?rest[_-]?url(=| =|:| :)"},{name:"keystore_pass",regex:"keystore[_-]?pass(=| =|:| :)"},{name:"kovan_private_key",regex:"kovan[_-]?private[_-]?key(=| =|:| :)"},{name:"kubecfg_s3_path",regex:"kubecfg[_-]?s3[_-]?path(=| =|:| :)"},{name:"kubeconfig",regex:"kubeconfig(=| =|:| :)"},{name:"kxoltsn3vogdop92m",regex:"kxoltsn3vogdop92m(=| =|:| :)"},{name:"leanplum_key",regex:"leanplum[_-]?key(=| =|:| :)"},{name:"lektor_deploy_password",regex:"lektor[_-]?deploy[_-]?password(=| =|:| :)"},{name:"lektor_deploy_username",regex:"lektor[_-]?deploy[_-]?username(=| =|:| :)"},{name:"lighthouse_api_key",regex:"lighthouse[_-]?api[_-]?key(=| =|:| :)"},{name:"linux_signing_key",regex:"linux[_-]?signing[_-]?key(=| =|:| :)"},{name:"ll_publish_url",regex:"ll[_-]?publish[_-]?url(=| =|:| :)"},{name:"ll_shared_key",regex:"ll[_-]?shared[_-]?key(=| =|:| :)"},{name:"looker_test_runner_client_secret",regex:"looker[_-]?test[_-]?runner[_-]?client[_-]?secret(=| =|:| :)"},{name:"lottie_happo_api_key",regex:"lottie[_-]?happo[_-]?api[_-]?key(=| =|:| :)"},{name:"lottie_happo_secret_key",regex:"lottie[_-]?happo[_-]?secret[_-]?key(=| =|:| :)"},{name:"lottie_s3_secret_key",regex:"lottie[_-]?s3[_-]?secret[_-]?key(=| =|:| :)"},{name:"lottie_upload_cert_key_password",regex:"lottie[_-]?upload[_-]?cert[_-]?key[_-]?password(=| =|:| :)"},{name:"lottie_upload_cert_key_store_password",regex:"lottie[_-]?upload[_-]?cert[_-]?key[_-]?store[_-]?password(=| =|:| :)"},{name:"magento_auth_password",regex:"magento[_-]?auth[_-]?password(=| =|:| :)"},{name:"magento_auth_username",regex:"magento[_-]?auth[_-]?username (=| =|:| :)"},{name:"magento_password",regex:"magento[_-]?password(=| =|:| :)"},{name:"mail_password",regex:"mail[_-]?password(=| =|:| :)"},{name:"mailchimp",regex:"(W(?:[a-f0-9]{32}(-us[0-9]{1,2}))a-zA-Z0-9)"},{name:"mailchimp_api_key",regex:"mailchimp[_-]?api[_-]?key(=| =|:| :)"},{name:"mailchimp_key",regex:"mailchimp[_-]?key(=| =|:| :)"},{name:"mailer_password",regex:"mailer[_-]?password(=| =|:| :)"},{name:"mailgun",regex:"(key-[0-9a-f]{32})"},{name:"mailgun_api_key",regex:"mailgun[_-]?api[_-]?key(=| =|:| :)"},{name:"mailgun_apikey",regex:"mailgun[_-]?apikey(=| =|:| :)"},{name:"mailgun_password",regex:"mailgun[_-]?password(=| =|:| :)"},{name:"mailgun_priv_key",regex:"mailgun[_-]?priv[_-]?key(=| =|:| :)"},{name:"mailgun_pub_apikey",regex:"mailgun[_-]?pub[_-]?apikey(=| =|:| :)"},{name:"mailgun_pub_key",regex:"mailgun[_-]?pub[_-]?key(=| =|:| :)"},{name:"mailgun_secret_api_key",regex:"mailgun[_-]?secret[_-]?api[_-]?key(=| =|:| :)"},{name:"manage_key",regex:"manage[_-]?key(=| =|:| :)"},{name:"manage_secret",regex:"manage[_-]?secret(=| =|:| :)"},{name:"management_token",regex:"management[_-]?token(=| =|:| :)"},{name:"managementapiaccesstoken",regex:"managementapiaccesstoken(=| =|:| :)"},{name:"mandrill_api_key",regex:"mandrill[_-]?api[_-]?key(=| =|:| :)"},{name:"manifest_app_token",regex:"manifest[_-]?app[_-]?token(=| =|:| :)"},{name:"manifest_app_url",regex:"manifest[_-]?app[_-]?url(=| =|:| :)"},{name:"mapbox_access_token",regex:"mapbox[_-]?access[_-]?token(=| =|:| :)"},{name:"mapbox_api_token",regex:"mapbox[_-]?api[_-]?token(=| =|:| :)"},{name:"mapbox_aws_access_key_id",regex:"mapbox[_-]?aws[_-]?access[_-]?key[_-]?id(=| =|:| :)"},{name:"mapbox_aws_secret_access_key",regex:"mapbox[_-]?aws[_-]?secret[_-]?access[_-]?key(=| =|:| :)"},{name:"mapboxaccesstoken",regex:"mapboxaccesstoken(=| =|:| :)"},{name:"master_password",regex:"(master_password).+"},{name:"mg_api_key",regex:"mg[_-]?api[_-]?key(=| =|:| :)"},{name:"mg_public_api_key",regex:"mg[_-]?public[_-]?api[_-]?key(=| =|:| :)"},{name:"mh_apikey",regex:"mh[_-]?apikey(=| =|:| :)"},{name:"mh_password",regex:"mh[_-]?password(=| =|:| :)"},{name:"mile_zero_key",regex:"mile[_-]?zero[_-]?key(=| =|:| :)"},{name:"minio_access_key",regex:"minio[_-]?access[_-]?key(=| =|:| :)"},{name:"minio_secret_key",regex:"minio[_-]?secret[_-]?key(=| =|:| :)"},{name:"multi_bob_sid",regex:"multi[_-]?bob[_-]?sid(=| =|:| :)"},{name:"multi_connect_sid",regex:"multi[_-]?connect[_-]?sid(=| =|:| :)"},{name:"multi_disconnect_sid",regex:"multi[_-]?disconnect[_-]?sid(=| =|:| :)"},{name:"multi_workflow_sid",regex:"multi[_-]?workflow[_-]?sid(=| =|:| :)"},{name:"multi_workspace_sid",regex:"multi[_-]?workspace[_-]?sid(=| =|:| :)"},{name:"my_secret_env",regex:"my[_-]?secret[_-]?env(=| =|:| :)"},{name:"mysql_database",regex:"mysql[_-]?database(=| =|:| :)"},{name:"mysql_hostname",regex:"mysql[_-]?hostname(=| =|:| :)"},{name:"mysql_password",regex:"mysql[_-]?password(=| =|:| :)"},{name:"mysql_root_password",regex:"mysql[_-]?root[_-]?password(=| =|:| :)"},{name:"mysql_user",regex:"mysql[_-]?user(=| =|:| :)"},{name:"mysql_username",regex:"mysql[_-]?username(=| =|:| :)"},{name:"mysqlmasteruser",regex:"mysqlmasteruser(=| =|:| :)"},{name:"mysqlsecret",regex:"mysqlsecret(=| =|:| :)"},{name:"nativeevents",regex:"nativeevents(=| =|:| :)"},{name:"netlify_api_key",regex:"netlify[_-]?api[_-]?key(=| =|:| :)"},{name:"new_relic_beta_token",regex:"new[_-]?relic[_-]?beta[_-]?token(=| =|:| :)"},{name:"nexus_password",regex:"nexus[_-]?password(=| =|:| :)"},{name:"nexuspassword",regex:"nexuspassword(=| =|:| :)"},{name:"ngrok_auth_token",regex:"ngrok[_-]?auth[_-]?token(=| =|:| :)"},{name:"ngrok_token",regex:"ngrok[_-]?token(=| =|:| :)"},{name:"node_env",regex:"node[_-]?env(=| =|:| :)"},{name:"node_pre_gyp_accesskeyid",regex:"node[_-]?pre[_-]?gyp[_-]?accesskeyid(=| =|:| :)"},{name:"node_pre_gyp_github_token",regex:"node[_-]?pre[_-]?gyp[_-]?github[_-]?token(=| =|:| :)"},{name:"node_pre_gyp_secretaccesskey",regex:"node[_-]?pre[_-]?gyp[_-]?secretaccesskey(=| =|:| :)"},{name:"non_token",regex:"non[_-]?token(=| =|:| :)"},{name:"now_token",regex:"now[_-]?token(=| =|:| :)"},{name:"npm_api_key",regex:"npm[_-]?api[_-]?key(=| =|:| :)"},{name:"npm_api_token",regex:"npm[_-]?api[_-]?token(=| =|:| :)"},{name:"npm_auth_token",regex:"npm[_-]?auth[_-]?token(=| =|:| :)"},{name:"npm_email",regex:"npm[_-]?email(=| =|:| :)"},{name:"npm_password",regex:"npm[_-]?password(=| =|:| :)"},{name:"npm_secret_key",regex:"npm[_-]?secret[_-]?key(=| =|:| :)"},{name:"npm_token - 1",regex:"npm[_-]?token(=| =|:| :)"},{name:"nuget_api_key - 1",regex:"(oy2[a-z0-9]{43})"},{name:"nuget_api_key - 2",regex:"nuget[_-]?api[_-]?key(=| =|:| :)"},{name:"numbers_service_pass",regex:"numbers[_-]?service[_-]?pass(=| =|:| :)"},{name:"oauth_token",regex:"oauth[_-]?token(=| =|:| :)"},{name:"object_storage_password",regex:"object[_-]?storage[_-]?password(=| =|:| :)"},{name:"object_storage_region_name",regex:"object[_-]?storage[_-]?region[_-]?name(=| =|:| :)"},{name:"object_store_bucket",regex:"object[_-]?store[_-]?bucket(=| =|:| :)"},{name:"object_store_creds",regex:"object[_-]?store[_-]?creds(=| =|:| :)"},{name:"oc_pass",regex:"oc[_-]?pass(=| =|:| :)"},{name:"octest_app_password",regex:"octest[_-]?app[_-]?password(=| =|:| :)"},{name:"octest_app_username",regex:"octest[_-]?app[_-]?username(=| =|:| :)"},{name:"octest_password",regex:"octest[_-]?password(=| =|:| :)"},{name:"ofta_key",regex:"ofta[_-]?key(=| =|:| :)"},{name:"ofta_region",regex:"ofta[_-]?region(=| =|:| :)"},{name:"ofta_secret",regex:"ofta[_-]?secret(=| =|:| :)"},{name:"okta_client_token",regex:"okta[_-]?client[_-]?token(=| =|:| :)"},{name:"okta_oauth2_client_secret",regex:"okta[_-]?oauth2[_-]?client[_-]?secret(=| =|:| :)"},{name:"okta_oauth2_clientsecret",regex:"okta[_-]?oauth2[_-]?clientsecret(=| =|:| :)"},{name:"omise_key",regex:"omise[_-]?key(=| =|:| :)"},{name:"omise_pkey",regex:"omise[_-]?pkey(=| =|:| :)"},{name:"omise_pubkey",regex:"omise[_-]?pubkey(=| =|:| :)"},{name:"omise_skey",regex:"omise[_-]?skey(=| =|:| :)"},{name:"onesignal_api_key",regex:"onesignal[_-]?api[_-]?key(=| =|:| :)"},{name:"onesignal_user_auth_key",regex:"onesignal[_-]?user[_-]?auth[_-]?key(=| =|:| :)"},{name:"open_whisk_key",regex:"open[_-]?whisk[_-]?key(=| =|:| :)"},{name:"openwhisk_key",regex:"openwhisk[_-]?key(=| =|:| :)"},{name:"os_auth_url",regex:"os[_-]?auth[_-]?url(=| =|:| :)"},{name:"os_password",regex:"os[_-]?password(=| =|:| :)"},{name:"ossrh_jira_password",regex:"ossrh[_-]?jira[_-]?password(=| =|:| :)"},{name:"ossrh_pass",regex:"ossrh[_-]?pass(=| =|:| :)"},{name:"ossrh_password",regex:"ossrh[_-]?password(=| =|:| :)"},{name:"ossrh_secret",regex:"ossrh[_-]?secret(=| =|:| :)"},{name:"ossrh_username",regex:"ossrh[_-]?username(=| =|:| :)"},{name:"outlook_team",regex:"(https://outlook.office.com/webhook/[0-9a-f-]{36}@)"},{name:"packagecloud_token",regex:"packagecloud[_-]?token(=| =|:| :)"},{name:"pagerduty_apikey",regex:"pagerduty[_-]?apikey(=| =|:| :)"},{name:"parse_js_key",regex:"parse[_-]?js[_-]?key(=| =|:| :)"},{name:"passwordtravis",regex:"passwordtravis(=| =|:| :)"},{name:"paypal_braintree_access_token",regex:"(access_token$production$[0-9a-z]{16}$[0-9a-f]{32})"},{name:"paypal_client_secret",regex:"paypal[_-]?client[_-]?secret(=| =|:| :)"},{name:"percy_project",regex:"percy[_-]?project(=| =|:| :)"},{name:"percy_token",regex:"percy[_-]?token(=| =|:| :)"},{name:"personal_key",regex:"personal[_-]?key(=| =|:| :)"},{name:"personal_secret",regex:"personal[_-]?secret(=| =|:| :)"},{name:"pg_database",regex:"pg[_-]?database(=| =|:| :)"},{name:"pg_host",regex:"pg[_-]?host(=| =|:| :)"},{name:"places_api_key",regex:"places[_-]?api[_-]?key(=| =|:| :)"},{name:"places_apikey",regex:"places[_-]?apikey(=| =|:| :)"},{name:"plotly_apikey",regex:"plotly[_-]?apikey(=| =|:| :)"},{name:"plugin_password",regex:"plugin[_-]?password(=| =|:| :)"},{name:"postgres_env_postgres_db",regex:"postgres[_-]?env[_-]?postgres[_-]?db(=| =|:| :)"},{name:"postgres_env_postgres_password",regex:"postgres[_-]?env[_-]?postgres[_-]?password(=| =|:| :)"},{name:"postgresql_db",regex:"postgresql[_-]?db(=| =|:| :)"},{name:"postgresql_pass",regex:"postgresql[_-]?pass(=| =|:| :)"},{name:"prebuild_auth",regex:"prebuild[_-]?auth(=| =|:| :)"},{name:"preferred_username",regex:"preferred[_-]?username(=| =|:| :)"},{name:"pring_mail_username",regex:"pring[_-]?mail[_-]?username(=| =|:| :)"},{name:"private_key",regex:"-----(?:(?:BEGIN|END) )(?:(?:EC|PGP|DSA|RSA|OPENSSH).)?PRIVATE.KEY(.BLOCK)?-----"},{name:"private_signing_password",regex:"private[_-]?signing[_-]?password(=| =|:| :)"},{name:"prod_access_key_id",regex:"prod[_-]?access[_-]?key[_-]?id(=| =|:| :)"},{name:"prod_password",regex:"prod[_-]?password(=| =|:| :)"},{name:"prod_secret_key",regex:"prod[_-]?secret[_-]?key(=| =|:| :)"},{name:"project_config",regex:"project[_-]?config(=| =|:| :)"},{name:"publish_access",regex:"publish[_-]?access(=| =|:| :)"},{name:"publish_key",regex:"publish[_-]?key(=| =|:| :)"},{name:"publish_secret",regex:"publish[_-]?secret(=| =|:| :)"},{name:"pushover_token",regex:"pushover[_-]?token(=| =|:| :)"},{name:"pypi_passowrd",regex:"pypi[_-]?passowrd(=| =|:| :)"},{name:"qiita_token",regex:"qiita[_-]?token(=| =|:| :)"},{name:"quip_token",regex:"quip[_-]?token(=| =|:| :)"},{name:"rabbitmq_password",regex:"rabbitmq[_-]?password(=| =|:| :)"},{name:"randrmusicapiaccesstoken",regex:"randrmusicapiaccesstoken(=| =|:| :)"},{name:"redis_stunnel_urls",regex:"redis[_-]?stunnel[_-]?urls(=| =|:| :)"},{name:"rediscloud_url",regex:"rediscloud[_-]?url(=| =|:| :)"},{name:"refresh_token",regex:"refresh[_-]?token(=| =|:| :)"},{name:"registry_pass",regex:"registry[_-]?pass(=| =|:| :)"},{name:"registry_secure",regex:"registry[_-]?secure(=| =|:| :)"},{name:"release_gh_token",regex:"release[_-]?gh[_-]?token(=| =|:| :)"},{name:"release_token",regex:"release[_-]?token(=| =|:| :)"},{name:"reporting_webdav_pwd",regex:"reporting[_-]?webdav[_-]?pwd(=| =|:| :)"},{name:"reporting_webdav_url",regex:"reporting[_-]?webdav[_-]?url(=| =|:| :)"},{name:"repotoken",regex:"repotoken(=| =|:| :)"},{name:"rest_api_key",regex:"rest[_-]?api[_-]?key(=| =|:| :)"},{name:"rinkeby_private_key",regex:"rinkeby[_-]?private[_-]?key(=| =|:| :)"},{name:"ropsten_private_key",regex:"ropsten[_-]?private[_-]?key(=| =|:| :)"},{name:"route53_access_key_id",regex:"route53[_-]?access[_-]?key[_-]?id(=| =|:| :)"},{name:"rtd_key_pass",regex:"rtd[_-]?key[_-]?pass(=| =|:| :)"},{name:"rtd_store_pass",regex:"rtd[_-]?store[_-]?pass(=| =|:| :)"},{name:"rubygems_auth_token",regex:"rubygems[_-]?auth[_-]?token(=| =|:| :)"},{name:"s3_access_key",regex:"s3[_-]?access[_-]?key(=| =|:| :)"},{name:"s3_access_key_id",regex:"s3[_-]?access[_-]?key[_-]?id(=| =|:| :)"},{name:"s3_bucket_name_app_logs",regex:"s3[_-]?bucket[_-]?name[_-]?app[_-]?logs(=| =|:| :)"},{name:"s3_bucket_name_assets",regex:"s3[_-]?bucket[_-]?name[_-]?assets(=| =|:| :)"},{name:"s3_external_3_amazonaws_com",regex:"s3[_-]?external[_-]?3[_-]?amazonaws[_-]?com(=| =|:| :)"},{name:"s3_key",regex:"s3[_-]?key(=| =|:| :)"},{name:"s3_key_app_logs",regex:"s3[_-]?key[_-]?app[_-]?logs(=| =|:| :)"},{name:"s3_key_assets",regex:"s3[_-]?key[_-]?assets(=| =|:| :)"},{name:"s3_secret_app_logs",regex:"s3[_-]?secret[_-]?app[_-]?logs(=| =|:| :)"},{name:"s3_secret_assets",regex:"s3[_-]?secret[_-]?assets(=| =|:| :)"},{name:"s3_secret_key",regex:"s3[_-]?secret[_-]?key(=| =|:| :)"},{name:"s3_user_secret",regex:"s3[_-]?user[_-]?secret(=| =|:| :)"},{name:"sacloud_access_token",regex:"sacloud[_-]?access[_-]?token(=| =|:| :)"},{name:"sacloud_access_token_secret",regex:"sacloud[_-]?access[_-]?token[_-]?secret(=| =|:| :)"},{name:"sacloud_api",regex:"sacloud[_-]?api(=| =|:| :)"},{name:"salesforce_bulk_test_password",regex:"salesforce[_-]?bulk[_-]?test[_-]?password(=| =|:| :)"},{name:"salesforce_bulk_test_security_token",regex:"salesforce[_-]?bulk[_-]?test[_-]?security[_-]?token(=| =|:| :)"},{name:"sandbox_access_token",regex:"sandbox[_-]?access[_-]?token(=| =|:| :)"},{name:"sandbox_aws_access_key_id",regex:"sandbox[_-]?aws[_-]?access[_-]?key[_-]?id(=| =|:| :)"},{name:"sandbox_aws_secret_access_key",regex:"sandbox[_-]?aws[_-]?secret[_-]?access[_-]?key(=| =|:| :)"},{name:"sauce_access_key",regex:"sauce[_-]?access[_-]?key(=| =|:| :)"},{name:"sauce_token",regex:`(sauce.{0,50}("|')?[0-9a-f-]{36}("|')?)`},{name:"scrutinizer_token",regex:"scrutinizer[_-]?token(=| =|:| :)"},{name:"sdr_token",regex:"sdr[_-]?token(=| =|:| :)"},{name:"secret_0",regex:"secret[_-]?0(=| =|:| :)"},{name:"secret_1",regex:"secret[_-]?1(=| =|:| :)"},{name:"secret_10",regex:"secret[_-]?10(=| =|:| :)"},{name:"secret_11",regex:"secret[_-]?11(=| =|:| :)"},{name:"secret_2",regex:"secret[_-]?2(=| =|:| :)"},{name:"secret_3",regex:"secret[_-]?3(=| =|:| :)"},{name:"secret_4",regex:"secret[_-]?4(=| =|:| :)"},{name:"secret_5",regex:"secret[_-]?5(=| =|:| :)"},{name:"secret_6",regex:"secret[_-]?6(=| =|:| :)"},{name:"secret_7",regex:"secret[_-]?7(=| =|:| :)"},{name:"secret_8",regex:"secret[_-]?8(=| =|:| :)"},{name:"secret_9",regex:"secret[_-]?9(=| =|:| :)"},{name:"secret_key_base",regex:"secret[_-]?key[_-]?base(=| =|:| :)"},{name:"secretaccesskey",regex:"secretaccesskey(=| =|:| :)"},{name:"secretkey",regex:"secretkey(=| =|:| :)"},{name:"segment_api_key",regex:"segment[_-]?api[_-]?key(=| =|:| :)"},{name:"selion_log_level_dev",regex:"selion[_-]?log[_-]?level[_-]?dev(=| =|:| :)"},{name:"selion_selenium_host",regex:"selion[_-]?selenium[_-]?host(=| =|:| :)"},{name:"sendgrid - 2",regex:"sendgrid(=| =|:| :)"},{name:"sendgrid_api_key - 1",regex:"sendgrid[_-]?api[_-]?key(=| =|:| :)"},{name:"sendgrid_key",regex:"sendgrid[_-]?key(=| =|:| :)"},{name:"sendgrid_password",regex:"sendgrid[_-]?password(=| =|:| :)"},{name:"sendgrid_user",regex:"sendgrid[_-]?user(=| =|:| :)"},{name:"sendgrid_username",regex:"sendgrid[_-]?username(=| =|:| :)"},{name:"sendwithus_key",regex:"sendwithus[_-]?key(=| =|:| :)"},{name:"sentry_auth_token",regex:"sentry[_-]?auth[_-]?token(=| =|:| :)"},{name:"sentry_default_org",regex:"sentry[_-]?default[_-]?org(=| =|:| :)"},{name:"sentry_endpoint",regex:"sentry[_-]?endpoint(=| =|:| :)"},{name:"sentry_key",regex:"sentry[_-]?key(=| =|:| :)"},{name:"service_account_secret",regex:"service[_-]?account[_-]?secret(=| =|:| :)"},{name:"ses_access_key",regex:"ses[_-]?access[_-]?key(=| =|:| :)"},{name:"ses_secret_key",regex:"ses[_-]?secret[_-]?key(=| =|:| :)"},{name:"setdstaccesskey",regex:"setdstaccesskey(=| =|:| :)"},{name:"setdstsecretkey",regex:"setdstsecretkey(=| =|:| :)"},{name:"setsecretkey",regex:"setsecretkey(=| =|:| :)"},{name:"signing_key",regex:"signing[_-]?key(=| =|:| :)"},{name:"signing_key_password",regex:"signing[_-]?key[_-]?password(=| =|:| :)"},{name:"signing_key_secret",regex:"signing[_-]?key[_-]?secret(=| =|:| :)"},{name:"signing_key_sid",regex:"signing[_-]?key[_-]?sid(=| =|:| :)"},{name:"slack_webhook_url",regex:"(hooks.slack.com/services/T[A-Z0-9]{8}/B[A-Z0-9]{8}/[a-zA-Z0-9]{1,})"},{name:"slash_developer_space",regex:"slash[_-]?developer[_-]?space(=| =|:| :)"},{name:"slash_developer_space_key",regex:"slash[_-]?developer[_-]?space[_-]?key(=| =|:| :)"},{name:"slate_user_email",regex:"slate[_-]?user[_-]?email(=| =|:| :)"},{name:"snoowrap_client_secret",regex:"snoowrap[_-]?client[_-]?secret(=| =|:| :)"},{name:"snoowrap_password",regex:"snoowrap[_-]?password(=| =|:| :)"},{name:"snoowrap_refresh_token",regex:"snoowrap[_-]?refresh[_-]?token(=| =|:| :)"},{name:"snyk_api_token",regex:"snyk[_-]?api[_-]?token(=| =|:| :)"},{name:"snyk_token",regex:"snyk[_-]?token(=| =|:| :)"},{name:"socrata_app_token",regex:"socrata[_-]?app[_-]?token(=| =|:| :)"},{name:"socrata_password",regex:"socrata[_-]?password(=| =|:| :)"},{name:"sonar_organization_key",regex:"sonar[_-]?organization[_-]?key(=| =|:| :)"},{name:"sonar_project_key",regex:"sonar[_-]?project[_-]?key(=| =|:| :)"},{name:"sonar_token",regex:"sonar[_-]?token(=| =|:| :)"},{name:"sonarqube_docs_api_key",regex:`(sonar.{0,50}("|')?[0-9a-f]{40}("|')?)`},{name:"sonatype_gpg_key_name",regex:"sonatype[_-]?gpg[_-]?key[_-]?name(=| =|:| :)"},{name:"sonatype_gpg_passphrase",regex:"sonatype[_-]?gpg[_-]?passphrase(=| =|:| :)"},{name:"sonatype_nexus_password",regex:"sonatype[_-]?nexus[_-]?password(=| =|:| :)"},{name:"sonatype_pass",regex:"sonatype[_-]?pass(=| =|:| :)"},{name:"sonatype_password",regex:"sonatype[_-]?password(=| =|:| :)"},{name:"sonatype_token_password",regex:"sonatype[_-]?token[_-]?password(=| =|:| :)"},{name:"sonatype_token_user",regex:"sonatype[_-]?token[_-]?user(=| =|:| :)"},{name:"sonatypepassword",regex:"sonatypepassword(=| =|:| :)"},{name:"soundcloud_client_secret",regex:"soundcloud[_-]?client[_-]?secret(=| =|:| :)"},{name:"soundcloud_password",regex:"soundcloud[_-]?password(=| =|:| :)"},{name:"spaces_access_key_id",regex:"spaces[_-]?access[_-]?key[_-]?id(=| =|:| :)"},{name:"spaces_secret_access_key",regex:"spaces[_-]?secret[_-]?access[_-]?key(=| =|:| :)"},{name:"spotify_api_access_token",regex:"spotify[_-]?api[_-]?access[_-]?token(=| =|:| :)"},{name:"spotify_api_client_secret",regex:"spotify[_-]?api[_-]?client[_-]?secret(=| =|:| :)"},{name:"spring_mail_password",regex:"spring[_-]?mail[_-]?password(=| =|:| :)"},{name:"sqsaccesskey",regex:"sqsaccesskey(=| =|:| :)"},{name:"sqssecretkey",regex:"sqssecretkey(=| =|:| :)"},{name:"square_app_secret",regex:"(sq0[a-z]{3}-[0-9A-Za-z-_]{20,50})"},{name:"square_reader_sdk_repository_password",regex:"square[_-]?reader[_-]?sdk[_-]?repository[_-]?password(=| =|:| :)"},{name:"srcclr_api_token",regex:"srcclr[_-]?api[_-]?token(=| =|:| :)"},{name:"ssh_password",regex:`(sshpass -p.*['|"])`},{name:"sshpass",regex:"sshpass(=| =|:| :)"},{name:"ssmtp_config",regex:"ssmtp[_-]?config(=| =|:| :)"},{name:"staging_base_url_runscope",regex:"staging[_-]?base[_-]?url[_-]?runscope(=| =|:| :)"},{name:"star_test_aws_access_key_id",regex:"star[_-]?test[_-]?aws[_-]?access[_-]?key[_-]?id(=| =|:| :)"},{name:"star_test_bucket",regex:"star[_-]?test[_-]?bucket(=| =|:| :)"},{name:"star_test_location",regex:"star[_-]?test[_-]?location(=| =|:| :)"},{name:"star_test_secret_access_key",regex:"star[_-]?test[_-]?secret[_-]?access[_-]?key(=| =|:| :)"},{name:"starship_account_sid",regex:"starship[_-]?account[_-]?sid(=| =|:| :)"},{name:"starship_auth_token",regex:"starship[_-]?auth[_-]?token(=| =|:| :)"},{name:"stormpath_api_key_id",regex:"stormpath[_-]?api[_-]?key[_-]?id(=| =|:| :)"},{name:"stormpath_api_key_secret",regex:"stormpath[_-]?api[_-]?key[_-]?secret(=| =|:| :)"},{name:"strip_publishable_key",regex:"strip[_-]?publishable[_-]?key(=| =|:| :)"},{name:"strip_secret_key",regex:"strip[_-]?secret[_-]?key(=| =|:| :)"},{name:"stripe_private",regex:"stripe[_-]?private(=| =|:| :)"},{name:"stripe_public",regex:"stripe[_-]?public(=| =|:| :)"},{name:"stripe_restricted_api",regex:"(rk_live_[0-9a-zA-Z]{24,34})"},{name:"stripe_standard_api",regex:"(sk_live_[0-9a-zA-Z]{24,34})"},{name:"surge_login",regex:"surge[_-]?login(=| =|:| :)"},{name:"surge_token",regex:"surge[_-]?token(=| =|:| :)"},{name:"svn_pass",regex:"svn[_-]?pass(=| =|:| :)"},{name:"tesco_api_key",regex:"tesco[_-]?api[_-]?key(=| =|:| :)"},{name:"test_github_token",regex:"test[_-]?github[_-]?token(=| =|:| :)"},{name:"test_test",regex:"test[_-]?test(=| =|:| :)"},{name:"tester_keys_password",regex:"tester[_-]?keys[_-]?password(=| =|:| :)"},{name:"thera_oss_access_key",regex:"thera[_-]?oss[_-]?access[_-]?key(=| =|:| :)"},{name:"token_core_java",regex:"token[_-]?core[_-]?java(=| =|:| :)"},{name:"travis_access_token",regex:"travis[_-]?access[_-]?token(=| =|:| :)"},{name:"travis_api_token",regex:"travis[_-]?api[_-]?token(=| =|:| :)"},{name:"travis_branch",regex:"travis[_-]?branch(=| =|:| :)"},{name:"travis_com_token",regex:"travis[_-]?com[_-]?token(=| =|:| :)"},{name:"travis_e2e_token",regex:"travis[_-]?e2e[_-]?token(=| =|:| :)"},{name:"travis_gh_token",regex:"travis[_-]?gh[_-]?token(=| =|:| :)"},{name:"travis_pull_request",regex:"travis[_-]?pull[_-]?request(=| =|:| :)"},{name:"travis_secure_env_vars",regex:"travis[_-]?secure[_-]?env[_-]?vars(=| =|:| :)"},{name:"travis_token",regex:"travis[_-]?token(=| =|:| :)"},{name:"trex_client_token",regex:"trex[_-]?client[_-]?token(=| =|:| :)"},{name:"trex_okta_client_token",regex:"trex[_-]?okta[_-]?client[_-]?token(=| =|:| :)"},{name:"twilio_api_key",regex:"twilio[_-]?api[_-]?key(=| =|:| :)"},{name:"twilio_api_secret",regex:"twilio[_-]?api[_-]?secret(=| =|:| :)"},{name:"twilio_chat_account_api_service",regex:"twilio[_-]?chat[_-]?account[_-]?api[_-]?service(=| =|:| :)"},{name:"twilio_configuration_sid",regex:"twilio[_-]?configuration[_-]?sid(=| =|:| :)"},{name:"twilio_sid",regex:"twilio[_-]?sid(=| =|:| :)"},{name:"twilio_token",regex:"twilio[_-]?token(=| =|:| :)"},{name:"twine_password",regex:"twine[_-]?password(=| =|:| :)"},{name:"twitter_consumer_key",regex:"twitter[_-]?consumer[_-]?key(=| =|:| :)"},{name:"twitter_consumer_secret",regex:"twitter[_-]?consumer[_-]?secret(=| =|:| :)"},{name:"twitteroauthaccesssecret",regex:"twitteroauthaccesssecret(=| =|:| :)"},{name:"twitteroauthaccesstoken",regex:"twitteroauthaccesstoken(=| =|:| :)"},{name:"unity_password",regex:"unity[_-]?password(=| =|:| :)"},{name:"unity_serial",regex:"unity[_-]?serial(=| =|:| :)"},{name:"urban_key",regex:"urban[_-]?key(=| =|:| :)"},{name:"urban_master_secret",regex:"urban[_-]?master[_-]?secret(=| =|:| :)"},{name:"urban_secret",regex:"urban[_-]?secret(=| =|:| :)"},{name:"us_east_1_elb_amazonaws_com",regex:"us[_-]?east[_-]?1[_-]?elb[_-]?amazonaws[_-]?com(=| =|:| :)"},{name:"use_ssh",regex:"use[_-]?ssh(=| =|:| :)"},{name:"user_assets_access_key_id",regex:"user[_-]?assets[_-]?access[_-]?key[_-]?id(=| =|:| :)"},{name:"user_assets_secret_access_key",regex:"user[_-]?assets[_-]?secret[_-]?access[_-]?key(=| =|:| :)"},{name:"usertravis",regex:"usertravis(=| =|:| :)"},{name:"v_sfdc_client_secret",regex:"v[_-]?sfdc[_-]?client[_-]?secret(=| =|:| :)"},{name:"v_sfdc_password",regex:"v[_-]?sfdc[_-]?password(=| =|:| :)"},{name:"vip_github_build_repo_deploy_key",regex:"vip[_-]?github[_-]?build[_-]?repo[_-]?deploy[_-]?key(=| =|:| :)"},{name:"vip_github_deploy_key",regex:"vip[_-]?github[_-]?deploy[_-]?key(=| =|:| :)"},{name:"vip_github_deploy_key_pass",regex:"vip[_-]?github[_-]?deploy[_-]?key[_-]?pass(=| =|:| :)"},{name:"virustotal_apikey",regex:"virustotal[_-]?apikey(=| =|:| :)"},{name:"visual_recognition_api_key",regex:"visual[_-]?recognition[_-]?api[_-]?key(=| =|:| :)"},{name:"vscetoken",regex:"vscetoken(=| =|:| :)"},{name:"wakatime_api_key",regex:"wakatime[_-]?api[_-]?key(=| =|:| :)"},{name:"watson_conversation_password",regex:"watson[_-]?conversation[_-]?password(=| =|:| :)"},{name:"watson_device_password",regex:"watson[_-]?device[_-]?password(=| =|:| :)"},{name:"watson_password",regex:"watson[_-]?password(=| =|:| :)"},{name:"widget_basic_password",regex:"widget[_-]?basic[_-]?password(=| =|:| :)"},{name:"widget_basic_password_2",regex:"widget[_-]?basic[_-]?password[_-]?2(=| =|:| :)"},{name:"widget_basic_password_3",regex:"widget[_-]?basic[_-]?password[_-]?3(=| =|:| :)"},{name:"widget_basic_password_4",regex:"widget[_-]?basic[_-]?password[_-]?4(=| =|:| :)"},{name:"widget_basic_password_5",regex:"widget[_-]?basic[_-]?password[_-]?5(=| =|:| :)"},{name:"widget_fb_password",regex:"widget[_-]?fb[_-]?password(=| =|:| :)"},{name:"widget_fb_password_2",regex:"widget[_-]?fb[_-]?password[_-]?2(=| =|:| :)"},{name:"widget_fb_password_3",regex:"widget[_-]?fb[_-]?password[_-]?3(=| =|:| :)"},{name:"widget_test_server",regex:"widget[_-]?test[_-]?server(=| =|:| :)"},{name:"wincert_password",regex:"wincert[_-]?password(=| =|:| :)"},{name:"wordpress_db_password",regex:"wordpress[_-]?db[_-]?password(=| =|:| :)"},{name:"wordpress_db_user",regex:"wordpress[_-]?db[_-]?user(=| =|:| :)"},{name:"wpjm_phpunit_google_geocode_api_key",regex:"wpjm[_-]?phpunit[_-]?google[_-]?geocode[_-]?api[_-]?key(=| =|:| :)"},{name:"wporg_password",regex:"wporg[_-]?password(=| =|:| :)"},{name:"wpt_db_password",regex:"wpt[_-]?db[_-]?password(=| =|:| :)"},{name:"wpt_db_user",regex:"wpt[_-]?db[_-]?user(=| =|:| :)"},{name:"wpt_prepare_dir",regex:"wpt[_-]?prepare[_-]?dir(=| =|:| :)"},{name:"wpt_report_api_key",regex:"wpt[_-]?report[_-]?api[_-]?key(=| =|:| :)"},{name:"wpt_ssh_connect",regex:"wpt[_-]?ssh[_-]?connect(=| =|:| :)"},{name:"wpt_ssh_private_key_base64",regex:"wpt[_-]?ssh[_-]?private[_-]?key[_-]?base64(=| =|:| :)"},{name:"www_googleapis_com",regex:"www[_-]?googleapis[_-]?com(=| =|:| :)"},{name:"yangshun_gh_password",regex:"yangshun[_-]?gh[_-]?password(=| =|:| :)"},{name:"yangshun_gh_token",regex:"yangshun[_-]?gh[_-]?token(=| =|:| :)"},{name:"yt_account_client_secret",regex:"yt[_-]?account[_-]?client[_-]?secret(=| =|:| :)"},{name:"yt_account_refresh_token",regex:"yt[_-]?account[_-]?refresh[_-]?token(=| =|:| :)"},{name:"yt_api_key",regex:"yt[_-]?api[_-]?key(=| =|:| :)"},{name:"yt_client_secret",regex:"yt[_-]?client[_-]?secret(=| =|:| :)"},{name:"yt_partner_client_secret",regex:"yt[_-]?partner[_-]?client[_-]?secret(=| =|:| :)"},{name:"yt_partner_refresh_token",regex:"yt[_-]?partner[_-]?refresh[_-]?token(=| =|:| :)"},{name:"yt_server_api_key",regex:"yt[_-]?server[_-]?api[_-]?key(=| =|:| :)"},{name:"zendesk_travis_github",regex:"zendesk[_-]?travis[_-]?github(=| =|:| :)"},{name:"zensonatypepassword",regex:"zensonatypepassword(=| =|:| :)"},{name:"zhuliang_gh_token",regex:"zhuliang[_-]?gh[_-]?token(=| =|:| :)"},{name:"zopim_account_key",regex:"zopim[_-]?account[_-]?key(=| =|:| :)"},{name:"docker_registry_auth",regex:'auth":.*"(?:[A-Za-z0-9+\\/]{4})*(?:[A-Za-z0-9+\\/]{4}|[A-Za-z0-9+\\/]{3}=|[A-Za-z0-9+\\/]{2}={2})'}];var FX="*",mj=new Set([`
83
+ `,"\r","\t",'"',"'",":",",","{","}","[","]","\\"]),KX=[];for(let{regex:_}of ZX)try{let z=_,A="g";if(z.startsWith("(?i)"))z=z.slice(4),A="gi";KX.push(new RegExp(z,A))}catch{}function X6(_,z=FX){let A=z.length>0?z[0]:FX,b=_;for(let G of KX)b=b.replace(G,(J)=>Array.from(J,(Y)=>mj.has(Y)?Y:A).join(""));return b}function L_(_){if(typeof _==="string")return X6(_);if(Array.isArray(_))return _.map((z)=>L_(z));if(_ instanceof Date)return _;if(_!==null&&typeof _==="object"){let z={};for(let[A,b]of Object.entries(_))z[A]=L_(b);return z}return _}var uj=[".env",".env.local",".env.development",".env.production",".env.test",".env.staging",/\.env\.(dev|prod|stage|preview|ci|build|docker)$/i,".zshrc",".bashrc",".bash_profile",".profile",".zprofile",".zshenv",".zsh_history",".bash_history","id_rsa","id_ed25519","id_ecdsa","id_dsa",/^id_[a-z0-9]+$/i,/\.pem$/i,/\.key$/i,".aws/credentials",".aws/config",".docker/config.json",".npmrc",".yarnrc",".yarnrc.yml",".git-credentials",".netrc",".kube/config","kubeconfig","database.yml","secrets.yml","secrets.yaml","master.key","credentials.yml.enc",".gcloud/credentials","service-account.json","service_account.json",/gcp.*credentials.*\.json$/i,/firebase.*\.json$/i];function cj(_){let z=_.replace(/\\/g,"/"),A=z.split("/").pop()||"";for(let b of uj)if(typeof b==="string"){if(A===b||z.endsWith(`/${b}`)||z===b)return!0}else if(b.test(A)||b.test(z))return!0;return!1}function j5(_){return _.replace(/[^\s]/g,"*")}function R5(_){let z=_.messages.map((A)=>lj(A));return{..._,messages:z}}function lj(_){if(_.type!=="tool-call")return _;let z=_.toolName;if(z!=="Read"&&z!=="Write")return _;let A=_.input,b=A?.file_path;if(typeof b!=="string"||!cj(b))return _;let G={..._};if(z==="Write"&&A){let J=A.content;if(typeof J==="string")G.input={...A,content:j5(J)}}if(z==="Read"){let J=_.output;if(typeof J==="string")G.output=j5(J);else if(J&&typeof J==="object"){let Y=J,X=Y.file;if(X&&typeof X.content==="string")G.output={...Y,file:{...X,content:j5(X.content)}}}}return G}import{spawn as pj}from"child_process";import{promises as m9}from"fs";import{homedir as P5}from"os";import{basename as dj,extname as rj,join as X4,resolve as qX}from"path";var Mz=100,WX=80,nj=new Set(["[request interrupted by user]","[request aborted by user]","[request cancelled by user]"]),ij=/^<\/?(?:command|local)-[a-z-]+>/i,oj=/^[α-ωΑ-Ω]\s/i,aj=/<system-reminder>[\s\S]*?<\/system-reminder>/g,sj=["npm ","npm:","npm error","node:","node.js","error:","fatal:","warning:","traceback (most recent call last):","usage:","hint:","note:","code:","requirestack"],tj=X4(P5(),".claude"),ej=X4(P5(),".codex"),_R=X4(P5(),".pi","agent","sessions");async function zR(_){let z=_?.limit??Mz,A=process.env.CLAUDE_HOME??tj,b=X4(A,"projects");if(!await S5(b))return[];let G=[];try{let X=await m9.readdir(b,{withFileTypes:!0});for(let Q of X){if(!Q.isDirectory())continue;let $=X4(b,Q.name);try{let H=await m9.readdir($,{withFileTypes:!0});for(let B of H){if(!B.isFile()||rj(B.name)!==".jsonl")continue;let Z=X4($,B.name),F=dj(B.name,".jsonl");try{let K=await m9.stat(Z);G.push({path:Z,id:F,mtime:K.mtime})}catch{}}}catch{}}}catch{}G.sort((X,Q)=>Q.mtime.getTime()-X.mtime.getTime());let J=G.slice(0,z*2),Y=[];for(let X of J)try{let Q=await YR(X.path);Y.push({id:X.id,source:"claude-code",path:X.path,timestamp:Q.timestamp,preview:Q.preview,cwd:Q.cwd,repoId:null,stats:Q.stats})}catch{}return Y.sort((X,Q)=>Q.timestamp.getTime()-X.timestamp.getTime()).slice(0,z)}async function AR(_){let z=_?.limit??Mz,A=process.env.CODEX_HOME??ej,b=X4(A,"sessions");if(!await S5(b))return[];let G=[],Y=(await HR(b)).slice(0,z*2);for(let X of Y)try{let Q=await BR(X);if(!Q)continue;G.push({id:Q.sessionId,source:"codex",path:X,timestamp:Q.timestamp,preview:Q.preview,cwd:Q.cwd,repoId:null,stats:Q.stats})}catch{}return G.sort((X,Q)=>Q.timestamp.getTime()-X.timestamp.getTime()).slice(0,z)}async function bR(_){let z=_?.limit??Mz;try{let A=await GR(z*2);if(!A)return[];let b=JSON.parse(A),G=[];for(let J of b){if(J.parentId)continue;let Y=J.updated?new Date(J.updated):J.created?new Date(J.created):new Date(0);G.push({id:J.id,source:"opencode",path:J.id,timestamp:Y,preview:J.title?Q6(J.title):null,cwd:J.directory??null,repoId:null,stats:null})}return G.sort((J,Y)=>Y.timestamp.getTime()-J.timestamp.getTime()).slice(0,z)}catch{return[]}}function GR(_){return new Promise((z)=>{let A=!1,b=(X)=>{if(!A)A=!0,clearTimeout(Y),z(X)},G=pj("opencode",["session","list","--format","json","-n",String(_)],{stdio:["pipe","pipe","pipe"]}),J="",Y=setTimeout(()=>{G.kill(),b(null)},30000);G.stdout.on("data",(X)=>{J+=X.toString()}),G.on("close",(X)=>{b(X===0?J.trim()||null:null)}),G.on("error",()=>{b(null)})})}async function JR(_){let z=_?.limit??Mz,A=process.env.PI_SESSIONS??_R;if(!await S5(A))return[];let b=[];try{let G=await m9.readdir(A,{withFileTypes:!0});for(let J of G){if(!J.isDirectory())continue;let Y=X4(A,J.name);try{let X=await m9.readdir(Y,{withFileTypes:!0});for(let Q of X){if(!Q.isFile()||!Q.name.endsWith(".jsonl"))continue;let $=X4(Y,Q.name);try{let H=await ZR($);if(!H)continue;b.push({id:H.sessionId,source:"pi",path:$,timestamp:H.timestamp,preview:H.preview,cwd:H.cwd,repoId:null,stats:null})}catch{}}}catch{}}}catch{}return b.sort((G,J)=>J.timestamp.getTime()-G.timestamp.getTime()).slice(0,z)}async function VX(_){let z=_?.sources??["claude-code","codex","opencode","pi"],A=_?.limit??Mz,b=_?.cwd?qX(_.cwd):null,G=A*3,J=await Promise.all([z.includes("claude-code")?zR({limit:G}):[],z.includes("codex")?AR({limit:G}):[],z.includes("opencode")?bR({limit:G}):[],z.includes("pi")?JR({limit:G}):[]]),Y=[];for(let X of J)Y.push(...X);if(Y=Y.filter((X)=>X.preview&&X.preview.trim().length>0),b)Y=Y.filter((X)=>{if(!X.cwd)return!1;let Q=qX(X.cwd);return Q.startsWith(b)||b.startsWith(Q)});return Y.sort((X,Q)=>Q.timestamp.getTime()-X.timestamp.getTime()).slice(0,A)}async function S5(_){try{return(await m9.stat(_)).isDirectory()}catch{return!1}}function Q6(_){let z=_.replace(/\s+/g," ").trim();if(z.length<=WX)return z;return z.slice(0,WX-1)+"…"}var $1=51200,H1=20480;async function YR(_){let z=await m9.open(_,"r");try{let b=(await z.stat()).size,G=null,J=null,Y=null,X=Buffer.alloc(Math.min($1,b));await z.read(X,0,X.length,0);let Q=X.toString("utf8");for(let $ of Q.split(/\r?\n/)){if(!$.trim())continue;if(!$.endsWith("}"))break;try{let H=JSON.parse($);if(!G&&typeof H.cwd==="string")G=H.cwd;if(typeof H.timestamp==="string"){let B=new Date(H.timestamp);if(!Number.isNaN(B.getTime())){if(!Y||B>Y)Y=B}}if(H.isSidechain||H.isMeta)continue;if(!J&&H.type==="user"){let Z=H.message?.content;if(H.toolUseResult||H.tool_use_result)continue;let F=XR(Z);if(F){let K=QR(F);if(K)J=Q6(K)}}if(G&&J)break}catch{continue}}if(b>$1){let $=Math.max(0,b-H1),H=Buffer.alloc(Math.min(H1,b-$));await z.read(H,0,H.length,$);let Z=H.toString("utf8").split(/\r?\n/);if($>0&&Z.length>0)Z.shift();for(let F of Z){if(!F.trim())continue;try{let K=JSON.parse(F);if(typeof K.timestamp==="string"){let q=new Date(K.timestamp);if(!Number.isNaN(q.getTime())){if(!Y||q>Y)Y=q}}}catch{continue}}}return{timestamp:Y??new Date(0),cwd:G,preview:J,stats:null}}finally{await z.close()}}function XR(_){if(typeof _==="string")return _;if(Array.isArray(_))for(let z of _){if(typeof z==="string")return z;if(z&&typeof z==="object"){let A=z;if(A.type==="tool_result")continue;if(A.type==="text"&&typeof A.text==="string")return A.text}}return null}function QR(_){let z=_.replace(aj,""),A=[];for(let b of z.split(/\r?\n/)){let G=b.trim();if(!G)continue;let J=G.toLowerCase();if(nj.has(J))continue;if(ij.test(G))continue;if(oj.test(G))continue;if(sj.some((Y)=>J.startsWith(Y))){if(!G.includes("?")&&!$R(J))continue}if(!/[a-z]/i.test(G)&&!/\d/.test(G))continue;A.push(G)}if(A.length===0)return null;return A.slice(0,3).join(" ").replace(/\s+/g," ").trim()||null}function $R(_){return["can you","could you","please","help","how do","what is","why","fix","add","create","update"].some((A)=>_.includes(A))}async function HR(_){let z=[];async function A(b,G){if(G>4)return;try{let J=await m9.readdir(b,{withFileTypes:!0});for(let Y of J){let X=X4(b,Y.name);if(Y.isDirectory())await A(X,G+1);else if(Y.isFile()&&Y.name.endsWith(".jsonl")){let Q=await m9.stat(X);z.push({path:X,mtime:Q.mtime})}}}catch{}}return await A(_,0),z.sort((b,G)=>G.mtime.getTime()-b.mtime.getTime()),z.map((b)=>b.path)}async function BR(_){let z=await m9.open(_,"r");try{let b=(await z.stat()).size,G=null,J=null,Y=null,X=null,Q=Buffer.alloc(Math.min($1,b));await z.read(Q,0,Q.length,0);let $=Q.toString("utf8");for(let H of $.split(/\r?\n/)){if(!H.trim())continue;if(!H.endsWith("}"))break;try{let B=JSON.parse(H),Z=B.timestamp,F=B.type,K=B.payload;if(Z){let q=new Date(Z);if(!Number.isNaN(q.getTime())){if(!J||q>J)J=q}}if(!K)continue;if(F==="session_meta")G=K.id??null,Y=K.cwd??null;if(F==="event_msg"&&K.type==="user_message"&&!X){let q=K.message;if(q)X=Q6(q)}if(G&&Y&&X)break}catch{continue}}if(b>$1){let H=Math.max(0,b-H1),B=Buffer.alloc(Math.min(H1,b-H));await z.read(B,0,B.length,H);let F=B.toString("utf8").split(/\r?\n/);if(H>0&&F.length>0)F.shift();for(let K of F){if(!K.trim())continue;try{let W=JSON.parse(K).timestamp;if(W){let V=new Date(W);if(!Number.isNaN(V.getTime())){if(!J||V>J)J=V}}}catch{continue}}}if(!G)return null;return{sessionId:G,timestamp:J??new Date(0),cwd:Y,preview:X,stats:null}}finally{await z.close()}}async function ZR(_){let z=await m9.open(_,"r");try{let b=(await z.stat()).size,G=null,J=null,Y=null,X=null,Q=null,$=Buffer.alloc(Math.min($1,b));await z.read($,0,$.length,0);let B=$.toString("utf8").split(/\r?\n/);for(let Z=0;Z<B.length;Z++){let F=B[Z];if(!F.trim())continue;if(!F.endsWith("}"))break;try{let K=JSON.parse(F);if(Z===0&&K.id&&K.timestamp){G=K.id,Y=K.cwd??null,J=new Date(K.timestamp),Q=J;continue}if(K.timestamp){let q=new Date(K.timestamp);if(!Number.isNaN(q.getTime())){if(!Q||q>Q)Q=q}}if(!X&&K.type==="message"){let q=K.message;if(q?.role==="user"){let W=q.content;if(Array.isArray(W)){for(let V of W)if(V&&typeof V==="object"&&V.type==="text"){let w=V.text;if(w){X=Q6(w);break}}}}}if(G&&Y&&X)break}catch{continue}}if(b>$1){let Z=Math.max(0,b-H1),F=Buffer.alloc(Math.min(H1,b-Z));await z.read(F,0,F.length,Z);let q=F.toString("utf8").split(/\r?\n/);if(Z>0&&q.length>0)q.shift();for(let W of q){if(!W.trim())continue;try{let V=JSON.parse(W);if(V.timestamp){let w=new Date(V.timestamp);if(!Number.isNaN(w.getTime())){if(!Q||w>Q)Q=w}}}catch{continue}}}if(!G)return null;return{sessionId:G,timestamp:Q??J??new Date(0),cwd:Y,preview:X}}finally{await z.close()}}function DX(_){return _===161||_===164||_===167||_===168||_===170||_===173||_===174||_>=176&&_<=180||_>=182&&_<=186||_>=188&&_<=191||_===198||_===208||_===215||_===216||_>=222&&_<=225||_===230||_>=232&&_<=234||_===236||_===237||_===240||_===242||_===243||_>=247&&_<=250||_===252||_===254||_===257||_===273||_===275||_===283||_===294||_===295||_===299||_>=305&&_<=307||_===312||_>=319&&_<=322||_===324||_>=328&&_<=331||_===333||_===338||_===339||_===358||_===359||_===363||_===462||_===464||_===466||_===468||_===470||_===472||_===474||_===476||_===593||_===609||_===708||_===711||_>=713&&_<=715||_===717||_===720||_>=728&&_<=731||_===733||_===735||_>=768&&_<=879||_>=913&&_<=929||_>=931&&_<=937||_>=945&&_<=961||_>=963&&_<=969||_===1025||_>=1040&&_<=1103||_===1105||_===8208||_>=8211&&_<=8214||_===8216||_===8217||_===8220||_===8221||_>=8224&&_<=8226||_>=8228&&_<=8231||_===8240||_===8242||_===8243||_===8245||_===8251||_===8254||_===8308||_===8319||_>=8321&&_<=8324||_===8364||_===8451||_===8453||_===8457||_===8467||_===8470||_===8481||_===8482||_===8486||_===8491||_===8531||_===8532||_>=8539&&_<=8542||_>=8544&&_<=8555||_>=8560&&_<=8569||_===8585||_>=8592&&_<=8601||_===8632||_===8633||_===8658||_===8660||_===8679||_===8704||_===8706||_===8707||_===8711||_===8712||_===8715||_===8719||_===8721||_===8725||_===8730||_>=8733&&_<=8736||_===8739||_===8741||_>=8743&&_<=8748||_===8750||_>=8756&&_<=8759||_===8764||_===8765||_===8776||_===8780||_===8786||_===8800||_===8801||_>=8804&&_<=8807||_===8810||_===8811||_===8814||_===8815||_===8834||_===8835||_===8838||_===8839||_===8853||_===8857||_===8869||_===8895||_===8978||_>=9312&&_<=9449||_>=9451&&_<=9547||_>=9552&&_<=9587||_>=9600&&_<=9615||_>=9618&&_<=9621||_===9632||_===9633||_>=9635&&_<=9641||_===9650||_===9651||_===9654||_===9655||_===9660||_===9661||_===9664||_===9665||_>=9670&&_<=9672||_===9675||_>=9678&&_<=9681||_>=9698&&_<=9701||_===9711||_===9733||_===9734||_===9737||_===9742||_===9743||_===9756||_===9758||_===9792||_===9794||_===9824||_===9825||_>=9827&&_<=9829||_>=9831&&_<=9834||_===9836||_===9837||_===9839||_===9886||_===9887||_===9919||_>=9926&&_<=9933||_>=9935&&_<=9939||_>=9941&&_<=9953||_===9955||_===9960||_===9961||_>=9963&&_<=9969||_===9972||_>=9974&&_<=9977||_===9979||_===9980||_===9982||_===9983||_===10045||_>=10102&&_<=10111||_>=11094&&_<=11097||_>=12872&&_<=12879||_>=57344&&_<=63743||_>=65024&&_<=65039||_===65533||_>=127232&&_<=127242||_>=127248&&_<=127277||_>=127280&&_<=127337||_>=127344&&_<=127373||_===127375||_===127376||_>=127387&&_<=127404||_>=917760&&_<=917999||_>=983040&&_<=1048573||_>=1048576&&_<=1114109}function MX(_){return _===12288||_>=65281&&_<=65376||_>=65504&&_<=65510}function NX(_){return _>=4352&&_<=4447||_===8986||_===8987||_===9001||_===9002||_>=9193&&_<=9196||_===9200||_===9203||_===9725||_===9726||_===9748||_===9749||_>=9776&&_<=9783||_>=9800&&_<=9811||_===9855||_>=9866&&_<=9871||_===9875||_===9889||_===9898||_===9899||_===9917||_===9918||_===9924||_===9925||_===9934||_===9940||_===9962||_===9970||_===9971||_===9973||_===9978||_===9981||_===9989||_===9994||_===9995||_===10024||_===10060||_===10062||_>=10067&&_<=10069||_===10071||_>=10133&&_<=10135||_===10160||_===10175||_===11035||_===11036||_===11088||_===11093||_>=11904&&_<=11929||_>=11931&&_<=12019||_>=12032&&_<=12245||_>=12272&&_<=12287||_>=12289&&_<=12350||_>=12353&&_<=12438||_>=12441&&_<=12543||_>=12549&&_<=12591||_>=12593&&_<=12686||_>=12688&&_<=12773||_>=12783&&_<=12830||_>=12832&&_<=12871||_>=12880&&_<=42124||_>=42128&&_<=42182||_>=43360&&_<=43388||_>=44032&&_<=55203||_>=63744&&_<=64255||_>=65040&&_<=65049||_>=65072&&_<=65106||_>=65108&&_<=65126||_>=65128&&_<=65131||_>=94176&&_<=94180||_>=94192&&_<=94198||_>=94208&&_<=101589||_>=101631&&_<=101662||_>=101760&&_<=101874||_>=110576&&_<=110579||_>=110581&&_<=110587||_===110589||_===110590||_>=110592&&_<=110882||_===110898||_>=110928&&_<=110930||_===110933||_>=110948&&_<=110951||_>=110960&&_<=111355||_>=119552&&_<=119638||_>=119648&&_<=119670||_===126980||_===127183||_===127374||_>=127377&&_<=127386||_>=127488&&_<=127490||_>=127504&&_<=127547||_>=127552&&_<=127560||_===127568||_===127569||_>=127584&&_<=127589||_>=127744&&_<=127776||_>=127789&&_<=127797||_>=127799&&_<=127868||_>=127870&&_<=127891||_>=127904&&_<=127946||_>=127951&&_<=127955||_>=127968&&_<=127984||_===127988||_>=127992&&_<=128062||_===128064||_>=128066&&_<=128252||_>=128255&&_<=128317||_>=128331&&_<=128334||_>=128336&&_<=128359||_===128378||_===128405||_===128406||_===128420||_>=128507&&_<=128591||_>=128640&&_<=128709||_===128716||_>=128720&&_<=128722||_>=128725&&_<=128728||_>=128732&&_<=128735||_===128747||_===128748||_>=128756&&_<=128764||_>=128992&&_<=129003||_===129008||_>=129292&&_<=129338||_>=129340&&_<=129349||_>=129351&&_<=129535||_>=129648&&_<=129660||_>=129664&&_<=129674||_>=129678&&_<=129734||_===129736||_>=129741&&_<=129756||_>=129759&&_<=129770||_>=129775&&_<=129784||_>=131072&&_<=196605||_>=196608&&_<=262141}function FR(_){if(!Number.isSafeInteger(_))throw TypeError(`Expected a code point, got \`${typeof _}\`.`)}function k5(_,{ambiguousAsWide:z=!1}={}){if(FR(_),MX(_)||NX(_)||z&&DX(_))return 2;return 1}var B1=new Intl.Segmenter(void 0,{granularity:"grapheme"});function $6(){return B1}function KR(_){let z=_.codePointAt(0);return z>=126976&&z<=130047||z>=8960&&z<=9215||z>=9728&&z<=10175||z>=11088&&z<=11093||_.includes("️")||_.length>2}var qR=/^(?:\p{Default_Ignorable_Code_Point}|\p{Control}|\p{Mark}|\p{Surrogate})+$/v,WR=/^[\p{Default_Ignorable_Code_Point}\p{Control}\p{Format}\p{Mark}\p{Surrogate}]+/v,VR=/^\p{RGI_Emoji}$/v,UR=512,Nz=new Map;function x5(_){if(qR.test(_))return 0;if(KR(_)&&VR.test(_))return 2;let A=_.replace(WR,"").codePointAt(0);if(A===void 0)return 0;let b=k5(A);if(_.length>1)for(let G of _.slice(1)){let J=G.codePointAt(0);if(J>=65280&&J<=65519)b+=k5(J)}return b}function W0(_){if(_.length===0)return 0;let z=!0;for(let J=0;J<_.length;J++){let Y=_.charCodeAt(J);if(Y<32||Y>126){z=!1;break}}if(z)return _.length;let A=Nz.get(_);if(A!==void 0)return A;let b=_;if(_.includes("\t"))b=b.replace(/\t/g," ");if(b.includes("\x1B"))b=b.replace(/\x1b\[[0-9;]*[mGKHJ]/g,""),b=b.replace(/\x1b\]8;;[^\x07]*\x07/g,""),b=b.replace(/\x1b_[^\x07\x1b]*(?:\x07|\x1b\\)/g,"");let G=0;for(let{segment:J}of B1.segment(b))G+=x5(J);if(Nz.size>=UR){let J=Nz.keys().next().value;if(J!==void 0)Nz.delete(J)}return Nz.set(_,G),G}function Q4(_,z){if(z>=_.length||_[z]!=="\x1B")return null;let A=_[z+1];if(A==="["){let b=z+2;while(b<_.length&&!/[mGKHJ]/.test(_[b]))b++;if(b<_.length)return{code:_.substring(z,b+1),length:b+1-z};return null}if(A==="]"){let b=z+2;while(b<_.length){if(_[b]==="\x07")return{code:_.substring(z,b+1),length:b+1-z};if(_[b]==="\x1B"&&_[b+1]==="\\")return{code:_.substring(z,b+2),length:b+2-z};b++}return null}if(A==="_"){let b=z+2;while(b<_.length){if(_[b]==="\x07")return{code:_.substring(z,b+1),length:b+1-z};if(_[b]==="\x1B"&&_[b+1]==="\\")return{code:_.substring(z,b+2),length:b+2-z};b++}return null}return null}class H6{bold=!1;dim=!1;italic=!1;underline=!1;blink=!1;inverse=!1;hidden=!1;strikethrough=!1;fgColor=null;bgColor=null;process(_){if(!_.endsWith("m"))return;let z=_.match(/\x1b\[([\d;]*)m/);if(!z)return;let A=z[1];if(A===""||A==="0"){this.reset();return}let b=A.split(";"),G=0;while(G<b.length){let J=Number.parseInt(b[G],10);if(J===38||J===48){if(b[G+1]==="5"&&b[G+2]!==void 0){let Y=`${b[G]};${b[G+1]};${b[G+2]}`;if(J===38)this.fgColor=Y;else this.bgColor=Y;G+=3;continue}else if(b[G+1]==="2"&&b[G+4]!==void 0){let Y=`${b[G]};${b[G+1]};${b[G+2]};${b[G+3]};${b[G+4]}`;if(J===38)this.fgColor=Y;else this.bgColor=Y;G+=5;continue}}switch(J){case 0:this.reset();break;case 1:this.bold=!0;break;case 2:this.dim=!0;break;case 3:this.italic=!0;break;case 4:this.underline=!0;break;case 5:this.blink=!0;break;case 7:this.inverse=!0;break;case 8:this.hidden=!0;break;case 9:this.strikethrough=!0;break;case 21:this.bold=!1;break;case 22:this.bold=!1,this.dim=!1;break;case 23:this.italic=!1;break;case 24:this.underline=!1;break;case 25:this.blink=!1;break;case 27:this.inverse=!1;break;case 28:this.hidden=!1;break;case 29:this.strikethrough=!1;break;case 39:this.fgColor=null;break;case 49:this.bgColor=null;break;default:if(J>=30&&J<=37||J>=90&&J<=97)this.fgColor=String(J);else if(J>=40&&J<=47||J>=100&&J<=107)this.bgColor=String(J);break}G++}}reset(){this.bold=!1,this.dim=!1,this.italic=!1,this.underline=!1,this.blink=!1,this.inverse=!1,this.hidden=!1,this.strikethrough=!1,this.fgColor=null,this.bgColor=null}clear(){this.reset()}getActiveCodes(){let _=[];if(this.bold)_.push("1");if(this.dim)_.push("2");if(this.italic)_.push("3");if(this.underline)_.push("4");if(this.blink)_.push("5");if(this.inverse)_.push("7");if(this.hidden)_.push("8");if(this.strikethrough)_.push("9");if(this.fgColor)_.push(this.fgColor);if(this.bgColor)_.push(this.bgColor);if(_.length===0)return"";return`\x1B[${_.join(";")}m`}hasActiveCodes(){return this.bold||this.dim||this.italic||this.underline||this.blink||this.inverse||this.hidden||this.strikethrough||this.fgColor!==null||this.bgColor!==null}getLineEndReset(){if(this.underline)return"\x1B[24m";return""}}function wX(_,z){let A=0;while(A<_.length){let b=Q4(_,A);if(b)z.process(b.code),A+=b.length;else A++}}function DR(_){let z=[],A="",b="",G=!1,J=0;while(J<_.length){let Y=Q4(_,J);if(Y){b+=Y.code,J+=Y.length;continue}let X=_[J],Q=X===" ";if(Q!==G&&A)z.push(A),A="";if(b)A+=b,b="";G=Q,A+=X,J++}if(b)A+=b;if(A)z.push(A);return z}function wz(_,z){if(!_)return[""];let A=_.split(`
84
+ `),b=[],G=new H6;for(let J of A){let Y=b.length>0?G.getActiveCodes():"";b.push(...MR(Y+J,z)),wX(J,G)}return b.length>0?b:[""]}function MR(_,z){if(!_)return[""];if(W0(_)<=z)return[_];let b=[],G=new H6,J=DR(_),Y="",X=0;for(let Q of J){let $=W0(Q),H=Q.trim()==="";if($>z&&!H){if(Y){let F=G.getLineEndReset();if(F)Y+=F;b.push(Y),Y="",X=0}let Z=NR(Q,z,G);b.push(...Z.slice(0,-1)),Y=Z[Z.length-1],X=W0(Y);continue}if(X+$>z&&X>0){let Z=Y.trimEnd(),F=G.getLineEndReset();if(F)Z+=F;if(b.push(Z),H)Y=G.getActiveCodes(),X=0;else Y=G.getActiveCodes()+Q,X=$}else Y+=Q,X+=$;wX(Q,G)}if(Y)b.push(Y);return b.length>0?b.map((Q)=>Q.trimEnd()):[""]}function NR(_,z,A){let b=[],G=A.getActiveCodes(),J=0,Y=0,X=[];while(Y<_.length){let Q=Q4(_,Y);if(Q)X.push({type:"ansi",value:Q.code}),Y+=Q.length;else{let $=Y;while($<_.length){if(Q4(_,$))break;$++}let H=_.slice(Y,$);for(let B of B1.segment(H))X.push({type:"grapheme",value:B.segment});Y=$}}for(let Q of X){if(Q.type==="ansi"){G+=Q.value,A.process(Q.value);continue}let $=Q.value;if(!$)continue;let H=W0($);if(J+H>z){let B=A.getLineEndReset();if(B)G+=B;b.push(G),G=A.getActiveCodes(),J=0}G+=$,J+=H}if(G)b.push(G);return b.length>0?b:[""]}function Ez(_,z,A){let b=W0(_),G=Math.max(0,z-b),J=" ".repeat(G),Y=_+J;return A(Y)}function n0(_,z,A="...",b=!1){let G=W0(_);if(G<=z)return b?_+" ".repeat(z-G):_;let J=W0(A),Y=z-J;if(Y<=0)return A.substring(0,z);let X=0,Q=[];while(X<_.length){let Z=Q4(_,X);if(Z)Q.push({type:"ansi",value:Z.code}),X+=Z.length;else{let F=X;while(F<_.length){if(Q4(_,F))break;F++}let K=_.slice(X,F);for(let q of B1.segment(K))Q.push({type:"grapheme",value:q.segment});X=F}}let $="",H=0;for(let Z of Q){if(Z.type==="ansi"){$+=Z.value;continue}let F=Z.value;if(!F)continue;let K=W0(F);if(H+K>Y)break;$+=F,H+=K}let B=`${$}\x1B[0m${A}`;if(b){let Z=W0(B);return B+" ".repeat(Math.max(0,z-Z))}return B}function B6(_,z,A,b=!1){return T5(_,z,A,b).text}function T5(_,z,A,b=!1){if(A<=0)return{text:"",width:0};let G=z+A,J="",Y=0,X=0,Q=0,$="";while(Q<_.length){let H=Q4(_,Q);if(H){if(X>=z&&X<G)J+=H.code;else if(X<z)$+=H.code;Q+=H.length;continue}let B=Q;while(B<_.length&&!Q4(_,B))B++;for(let{segment:Z}of B1.segment(_.slice(Q,B))){let F=x5(Z),K=X>=z&&X<G,q=!b||X+F<=G;if(K&&q){if($)J+=$,$="";J+=Z,Y+=F}if(X+=F,X>=G)break}if(Q=B,X>=G)break}return{text:J,width:Y}}var I5=new H6;function EX(_,z,A,b,G=!1){let J="",Y=0,X="",Q=0,$=0,H=0,B="",Z=!1,F=A+b;I5.clear();while(H<_.length){let K=Q4(_,H);if(K){if(I5.process(K.code),$<z)B+=K.code;else if($>=A&&$<F&&Z)X+=K.code;H+=K.length;continue}let q=H;while(q<_.length&&!Q4(_,q))q++;for(let{segment:W}of B1.segment(_.slice(H,q))){let V=x5(W);if($<z){if(B)J+=B,B="";J+=W,Y+=V}else if($>=A&&$<F){if(!G||$+V<=F){if(!Z)X+=I5.getActiveCodes(),Z=!0;X+=W,Q+=V}}if($+=V,b<=0?$>=z:$>=F)break}if(H=q,b<=0?$>=z:$>=F)break}return{before:J,beforeWidth:Y,after:X,afterWidth:Q}}var O4=!1;function K6(_){O4=_}var wR=new Set(["`","-","=","[","]","\\",";","'",",",".","/","!","@","#","$","%","^","&","*","(",")","_","+","|","~","{","}",":","<",">","?"]),D0={shift:1,alt:2,ctrl:4},OX=192,C0={escape:27,tab:9,enter:13,space:32,backspace:127,kpEnter:57414},X9={up:-1,down:-2,right:-3,left:-4},T0={delete:-10,insert:-11,pageUp:-12,pageDown:-13,home:-14,end:-15},N9={up:["\x1B[A","\x1BOA"],down:["\x1B[B","\x1BOB"],right:["\x1B[C","\x1BOC"],left:["\x1B[D","\x1BOD"],home:["\x1B[H","\x1BOH","\x1B[1~","\x1B[7~"],end:["\x1B[F","\x1BOF","\x1B[4~","\x1B[8~"],insert:["\x1B[2~"],delete:["\x1B[3~"],pageUp:["\x1B[5~","\x1B[[5~"],pageDown:["\x1B[6~","\x1B[[6~"],clear:["\x1B[E","\x1BOE"],f1:["\x1BOP","\x1B[11~","\x1B[[A"],f2:["\x1BOQ","\x1B[12~","\x1B[[B"],f3:["\x1BOR","\x1B[13~","\x1B[[C"],f4:["\x1BOS","\x1B[14~","\x1B[[D"],f5:["\x1B[15~","\x1B[[E"],f6:["\x1B[17~"],f7:["\x1B[18~"],f8:["\x1B[19~"],f9:["\x1B[20~"],f10:["\x1B[21~"],f11:["\x1B[23~"],f12:["\x1B[24~"]},ER={up:["\x1B[a"],down:["\x1B[b"],right:["\x1B[c"],left:["\x1B[d"],clear:["\x1B[e"],insert:["\x1B[2$"],delete:["\x1B[3$"],pageUp:["\x1B[5$"],pageDown:["\x1B[6$"],home:["\x1B[7$"],end:["\x1B[8$"]},OR={up:["\x1BOa"],down:["\x1BOb"],right:["\x1BOc"],left:["\x1BOd"],clear:["\x1BOe"],insert:["\x1B[2^"],delete:["\x1B[3^"],pageUp:["\x1B[5^"],pageDown:["\x1B[6^"],home:["\x1B[7^"],end:["\x1B[8^"]};var Q9=(_,z)=>z.includes(_),W9=(_,z,A)=>{if(A===D0.shift)return Q9(_,ER[z]);if(A===D0.ctrl)return Q9(_,OR[z]);return!1},Z6="press";function C5(_){if(_.includes("\x1B[200~"))return!1;if(_.includes(":3u")||_.includes(":3~")||_.includes(":3A")||_.includes(":3B")||_.includes(":3C")||_.includes(":3D")||_.includes(":3H")||_.includes(":3F"))return!0;return!1}function F6(_){if(!_)return"press";let z=parseInt(_,10);if(z===2)return"repeat";if(z===3)return"release";return"press"}function LR(_){let z=_.match(/^\x1b\[(\d+)(?::(\d*))?(?::(\d+))?(?:;(\d+))?(?::(\d+))?u$/);if(z){let J=parseInt(z[1],10),Y=z[2]&&z[2].length>0?parseInt(z[2],10):void 0,X=z[3]?parseInt(z[3],10):void 0,Q=z[4]?parseInt(z[4],10):1,$=F6(z[5]);return Z6=$,{codepoint:J,shiftedKey:Y,baseLayoutKey:X,modifier:Q-1,eventType:$}}let A=_.match(/^\x1b\[1;(\d+)(?::(\d+))?([ABCD])$/);if(A){let J=parseInt(A[1],10),Y=F6(A[2]),X={A:-1,B:-2,C:-3,D:-4};return Z6=Y,{codepoint:X[A[3]],modifier:J-1,eventType:Y}}let b=_.match(/^\x1b\[(\d+)(?:;(\d+))?(?::(\d+))?~$/);if(b){let J=parseInt(b[1],10),Y=b[2]?parseInt(b[2],10):1,X=F6(b[3]),$={2:T0.insert,3:T0.delete,5:T0.pageUp,6:T0.pageDown,7:T0.home,8:T0.end}[J];if($!==void 0)return Z6=X,{codepoint:$,modifier:Y-1,eventType:X}}let G=_.match(/^\x1b\[1;(\d+)(?::(\d+))?([HF])$/);if(G){let J=parseInt(G[1],10),Y=F6(G[2]),X=G[3]==="H"?T0.home:T0.end;return Z6=Y,{codepoint:X,modifier:J-1,eventType:Y}}return null}function r(_,z,A){let b=LR(_);if(!b)return!1;let G=b.modifier&~OX,J=A&~OX;if(G!==J)return!1;if(b.codepoint===z)return!0;if(b.baseLayoutKey!==void 0&&b.baseLayoutKey===z)return!0;return!1}function LX(_,z,A){let b=_.match(/^\x1b\[27;(\d+);(\d+)~$/);if(!b)return!1;let G=parseInt(b[1],10),J=parseInt(b[2],10),Y=G-1;return J===z&&Y===A}function jR(_){let z=_.toLowerCase(),A=z.charCodeAt(0);if(A>=97&&A<=122||z==="["||z==="\\"||z==="]"||z==="_")return String.fromCharCode(A&31);if(z==="-")return String.fromCharCode(31);return null}function RR(_){let z=_.toLowerCase().split("+"),A=z[z.length-1];if(!A)return null;return{key:A,ctrl:z.includes("ctrl"),shift:z.includes("shift"),alt:z.includes("alt")}}function Z1(_,z){let A=RR(z);if(!A)return!1;let{key:b,ctrl:G,shift:J,alt:Y}=A,X=0;if(J)X|=D0.shift;if(Y)X|=D0.alt;if(G)X|=D0.ctrl;switch(b){case"escape":case"esc":if(X!==0)return!1;return _==="\x1B"||r(_,C0.escape,0);case"space":if(!O4){if(G&&!Y&&!J&&_==="\x00")return!0;if(Y&&!G&&!J&&_==="\x1B ")return!0}if(X===0)return _===" "||r(_,C0.space,0);return r(_,C0.space,X);case"tab":if(J&&!G&&!Y)return _==="\x1B[Z"||r(_,C0.tab,D0.shift);if(X===0)return _==="\t"||r(_,C0.tab,0);return r(_,C0.tab,X);case"enter":case"return":if(J&&!G&&!Y){if(r(_,C0.enter,D0.shift)||r(_,C0.kpEnter,D0.shift))return!0;if(LX(_,C0.enter,D0.shift))return!0;if(O4)return _==="\x1B\r"||_===`
85
85
  `;return!1}if(Y&&!G&&!J){if(r(_,C0.enter,D0.alt)||r(_,C0.kpEnter,D0.alt))return!0;if(LX(_,C0.enter,D0.alt))return!0;if(!O4)return _==="\x1B\r";return!1}if(X===0)return _==="\r"||!O4&&_===`
86
- `||_==="\x1BOM"||r(_,C0.enter,0)||r(_,C0.kpEnter,0);return r(_,C0.enter,X)||r(_,C0.kpEnter,X);case"backspace":if(Y&&!G&&!J){if(_==="\x1B"||_==="\x1B\b")return!0;return r(_,C0.backspace,D0.alt)}if(X===0)return _===""||_==="\b"||r(_,C0.backspace,0);return r(_,C0.backspace,X);case"insert":if(X===0)return Q9(_,N9.insert)||r(_,T0.insert,0);if(W9(_,"insert",X))return!0;return r(_,T0.insert,X);case"delete":if(X===0)return Q9(_,N9.delete)||r(_,T0.delete,0);if(W9(_,"delete",X))return!0;return r(_,T0.delete,X);case"clear":if(X===0)return Q9(_,N9.clear);return W9(_,"clear",X);case"home":if(X===0)return Q9(_,N9.home)||r(_,T0.home,0);if(W9(_,"home",X))return!0;return r(_,T0.home,X);case"end":if(X===0)return Q9(_,N9.end)||r(_,T0.end,0);if(W9(_,"end",X))return!0;return r(_,T0.end,X);case"pageup":if(X===0)return Q9(_,N9.pageUp)||r(_,T0.pageUp,0);if(W9(_,"pageUp",X))return!0;return r(_,T0.pageUp,X);case"pagedown":if(X===0)return Q9(_,N9.pageDown)||r(_,T0.pageDown,0);if(W9(_,"pageDown",X))return!0;return r(_,T0.pageDown,X);case"up":if(Y&&!G&&!J)return _==="\x1Bp"||r(_,X9.up,D0.alt);if(X===0)return Q9(_,N9.up)||r(_,X9.up,0);if(W9(_,"up",X))return!0;return r(_,X9.up,X);case"down":if(Y&&!G&&!J)return _==="\x1Bn"||r(_,X9.down,D0.alt);if(X===0)return Q9(_,N9.down)||r(_,X9.down,0);if(W9(_,"down",X))return!0;return r(_,X9.down,X);case"left":if(Y&&!G&&!J)return _==="\x1B[1;3D"||!O4&&_==="\x1BB"||_==="\x1Bb"||r(_,X9.left,D0.alt);if(G&&!Y&&!J)return _==="\x1B[1;5D"||W9(_,"left",D0.ctrl)||r(_,X9.left,D0.ctrl);if(X===0)return Q9(_,N9.left)||r(_,X9.left,0);if(W9(_,"left",X))return!0;return r(_,X9.left,X);case"right":if(Y&&!G&&!J)return _==="\x1B[1;3C"||!O4&&_==="\x1BF"||_==="\x1Bf"||r(_,X9.right,D0.alt);if(G&&!Y&&!J)return _==="\x1B[1;5C"||W9(_,"right",D0.ctrl)||r(_,X9.right,D0.ctrl);if(X===0)return Q9(_,N9.right)||r(_,X9.right,0);if(W9(_,"right",X))return!0;return r(_,X9.right,X);case"f1":case"f2":case"f3":case"f4":case"f5":case"f6":case"f7":case"f8":case"f9":case"f10":case"f11":case"f12":{if(X!==0)return!1;return Q9(_,N9[b])}}if(b.length===1&&(b>="a"&&b<="z"||VR.has(b))){let Q=b.charCodeAt(0),$=NR(b);if(G&&Y&&!J&&!O4&&$)return _===`\x1B${$}`;if(Y&&!G&&!J&&!O4&&b>="a"&&b<="z"){if(_===`\x1B${b}`)return!0}if(G&&!J&&!Y){if($&&_===$)return!0;return r(_,Q,D0.ctrl)}if(G&&J&&!Y)return r(_,Q,D0.shift+D0.ctrl);if(J&&!G&&!Y){if(_===b.toUpperCase())return!0;return r(_,Q,D0.shift)}if(X!==0)return r(_,Q,X);return _===b||r(_,Q,0)}return!1}var jX={cursorUp:"up",cursorDown:"down",cursorLeft:["left","ctrl+b"],cursorRight:["right","ctrl+f"],cursorWordLeft:["alt+left","ctrl+left","alt+b"],cursorWordRight:["alt+right","ctrl+right","alt+f"],cursorLineStart:["home","ctrl+a"],cursorLineEnd:["end","ctrl+e"],jumpForward:"ctrl+]",jumpBackward:"ctrl+alt+]",pageUp:"pageUp",pageDown:"pageDown",deleteCharBackward:"backspace",deleteCharForward:["delete","ctrl+d"],deleteWordBackward:["ctrl+w","alt+backspace"],deleteWordForward:["alt+d","alt+delete"],deleteToLineStart:"ctrl+u",deleteToLineEnd:"ctrl+k",newLine:"shift+enter",submit:"enter",tab:"tab",selectUp:"up",selectDown:"down",selectPageUp:"pageUp",selectPageDown:"pageDown",selectConfirm:"enter",selectCancel:["escape","ctrl+c"],copy:"ctrl+c",yank:"ctrl+y",yankPop:"alt+y",undo:"ctrl+-",expandTools:"ctrl+o",toggleSessionPath:"ctrl+p",toggleSessionSort:"ctrl+s",renameSession:"ctrl+r",deleteSession:"ctrl+d",deleteSessionNoninvasive:"ctrl+backspace"};class C5{actionToKeys;constructor(_={}){this.actionToKeys=new Map,this.buildMaps(_)}buildMaps(_){this.actionToKeys.clear();for(let[z,A]of Object.entries(jX)){let b=Array.isArray(A)?A:[A];this.actionToKeys.set(z,[...b])}for(let[z,A]of Object.entries(_)){if(A===void 0)continue;let b=Array.isArray(A)?A:[A];this.actionToKeys.set(z,b)}}matches(_,z){let A=this.actionToKeys.get(z);if(!A)return!1;for(let b of A)if(H1(_,b))return!0;return!1}getKeys(_){return this.actionToKeys.get(_)??[]}setConfig(_){this.buildMaps(_)}}var T5=null;function s4(){if(!T5)T5=new C5;return T5}class B1{text;paddingX;paddingY;customBgFn;cachedText;cachedWidth;cachedLines;constructor(_="",z=1,A=1,b){this.text=_,this.paddingX=z,this.paddingY=A,this.customBgFn=b}setText(_){this.text=_,this.cachedText=void 0,this.cachedWidth=void 0,this.cachedLines=void 0}setCustomBgFn(_){this.customBgFn=_,this.cachedText=void 0,this.cachedWidth=void 0,this.cachedLines=void 0}invalidate(){this.cachedText=void 0,this.cachedWidth=void 0,this.cachedLines=void 0}render(_){if(this.cachedLines&&this.cachedText===this.text&&this.cachedWidth===_)return this.cachedLines;if(!this.text||this.text.trim()===""){let H=[];return this.cachedText=this.text,this.cachedWidth=_,this.cachedLines=H,H}let z=this.text.replace(/\t/g," "),A=Math.max(1,_-this.paddingX*2),b=Mz(z,A),G=" ".repeat(this.paddingX),J=" ".repeat(this.paddingX),Y=[];for(let H of b){let B=G+H+J;if(this.customBgFn)Y.push(Nz(B,_,this.customBgFn));else{let Z=W0(B),F=Math.max(0,_-Z);Y.push(B+" ".repeat(F))}}let X=" ".repeat(_),Q=[];for(let H=0;H<this.paddingY;H++){let B=this.customBgFn?Nz(X,_,this.customBgFn):X;Q.push(B)}let $=[...Q,...Y,...Q];return this.cachedText=this.text,this.cachedWidth=_,this.cachedLines=$,$.length>0?$:[""]}}class Z6 extends B1{spinnerColorFn;messageColorFn;message;frames=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"];currentFrame=0;intervalId=null;ui=null;constructor(_,z,A,b="Loading..."){super("",1,0);this.spinnerColorFn=z,this.messageColorFn=A,this.message=b,this.ui=_,this.start()}render(_){return["",...super.render(_)]}start(){this.updateDisplay(),this.intervalId=setInterval(()=>{this.currentFrame=(this.currentFrame+1)%this.frames.length,this.updateDisplay()},80)}stop(){if(this.intervalId)clearInterval(this.intervalId),this.intervalId=null}setMessage(_){this.message=_,this.updateDisplay()}updateDisplay(){let _=this.frames[this.currentFrame];if(this.setText(`${this.spinnerColorFn(_)} ${this.messageColorFn(this.message)}`),this.ui)this.ui.requestRender()}}class RX extends Z6{abortController=new AbortController;onAbort;get signal(){return this.abortController.signal}get aborted(){return this.abortController.signal.aborted}handleInput(_){if(s4().matches(_,"selectCancel"))this.abortController.abort(),this.onAbort?.()}dispose(){this.stop()}}import*as Z1 from"node:fs";import*as xX from"node:os";import*as Ez from"node:path";var v5=null,ER={widthPx:9,heightPx:18};function y5(_){ER=_}function kX(){let _=process.env.TERM_PROGRAM?.toLowerCase()||"",z=process.env.TERM?.toLowerCase()||"",A=process.env.COLORTERM?.toLowerCase()||"";if(process.env.KITTY_WINDOW_ID||_==="kitty")return{images:"kitty",trueColor:!0,hyperlinks:!0};if(_==="ghostty"||z.includes("ghostty")||process.env.GHOSTTY_RESOURCES_DIR)return{images:"kitty",trueColor:!0,hyperlinks:!0};if(process.env.WEZTERM_PANE||_==="wezterm")return{images:"kitty",trueColor:!0,hyperlinks:!0};if(process.env.ITERM_SESSION_ID||_==="iterm.app")return{images:"iterm2",trueColor:!0,hyperlinks:!0};if(_==="vscode")return{images:null,trueColor:!0,hyperlinks:!0};if(_==="alacritty")return{images:null,trueColor:!0,hyperlinks:!0};return{images:null,trueColor:A==="truecolor"||A==="24bit",hyperlinks:!0}}function F6(){if(!v5)v5=kX();return v5}var PX="\x1B_G",SX="\x1B]1337;File=";function wz(_){if(_.startsWith(PX)||_.startsWith(SX))return!0;return _.includes(PX)||_.includes(SX)}function g5(_){return _!==null&&"focused"in _}var Oz="\x1B_pi:c\x07";function IX(_,z){if(_===void 0)return;if(typeof _==="number")return _;let A=_.match(/^(\d+(?:\.\d+)?)%$/);if(A)return Math.floor(z*parseFloat(A[1])/100);return}class f5{children=[];addChild(_){this.children.push(_)}removeChild(_){let z=this.children.indexOf(_);if(z!==-1)this.children.splice(z,1)}clear(){this.children=[]}invalidate(){for(let _ of this.children)_.invalidate?.()}render(_){let z=[];for(let A of this.children)z.push(...A.render(_));return z}}class F1 extends f5{terminal;previousLines=[];previousWidth=0;previousHeight=0;focusedComponent=null;onDebug;renderRequested=!1;cursorRow=0;hardwareCursorRow=0;inputBuffer="";cellSizeQueryPending=!1;showHardwareCursor=process.env.PI_HARDWARE_CURSOR==="1";maxLinesRendered=0;previousViewportTop=0;fullRedrawCount=0;stopped=!1;overlayStack=[];constructor(_,z){super();if(this.terminal=_,z!==void 0)this.showHardwareCursor=z}get fullRedraws(){return this.fullRedrawCount}getShowHardwareCursor(){return this.showHardwareCursor}setShowHardwareCursor(_){if(this.showHardwareCursor===_)return;if(this.showHardwareCursor=_,!_)this.terminal.hideCursor();this.requestRender()}setFocus(_){if(g5(this.focusedComponent))this.focusedComponent.focused=!1;if(this.focusedComponent=_,g5(_))_.focused=!0}showOverlay(_,z){let A={component:_,options:z,preFocus:this.focusedComponent,hidden:!1};if(this.overlayStack.push(A),this.isOverlayVisible(A))this.setFocus(_);return this.terminal.hideCursor(),this.requestRender(),{hide:()=>{let b=this.overlayStack.indexOf(A);if(b!==-1){if(this.overlayStack.splice(b,1),this.focusedComponent===_){let G=this.getTopmostVisibleOverlay();this.setFocus(G?.component??A.preFocus)}if(this.overlayStack.length===0)this.terminal.hideCursor();this.requestRender()}},setHidden:(b)=>{if(A.hidden===b)return;if(A.hidden=b,b){if(this.focusedComponent===_){let G=this.getTopmostVisibleOverlay();this.setFocus(G?.component??A.preFocus)}}else if(this.isOverlayVisible(A))this.setFocus(_);this.requestRender()},isHidden:()=>A.hidden}}hideOverlay(){let _=this.overlayStack.pop();if(!_)return;let z=this.getTopmostVisibleOverlay();if(this.setFocus(z?.component??_.preFocus),this.overlayStack.length===0)this.terminal.hideCursor();this.requestRender()}hasOverlay(){return this.overlayStack.some((_)=>this.isOverlayVisible(_))}isOverlayVisible(_){if(_.hidden)return!1;if(_.options?.visible)return _.options.visible(this.terminal.columns,this.terminal.rows);return!0}getTopmostVisibleOverlay(){for(let _=this.overlayStack.length-1;_>=0;_--)if(this.isOverlayVisible(this.overlayStack[_]))return this.overlayStack[_];return}invalidate(){super.invalidate();for(let _ of this.overlayStack)_.component.invalidate?.()}start(){this.stopped=!1,this.terminal.start((_)=>this.handleInput(_),()=>this.requestRender()),this.terminal.hideCursor(),this.queryCellSize(),this.requestRender()}queryCellSize(){if(!F6().images)return;this.cellSizeQueryPending=!0,this.terminal.write("\x1B[16t")}stop(){if(this.stopped=!0,this.previousLines.length>0){let z=this.previousLines.length-this.hardwareCursorRow;if(z>0)this.terminal.write(`\x1B[${z}B`);else if(z<0)this.terminal.write(`\x1B[${-z}A`);this.terminal.write(`\r
87
- `)}this.terminal.showCursor(),this.terminal.stop()}requestRender(_=!1){if(_)this.previousLines=[],this.previousWidth=-1,this.previousHeight=-1,this.cursorRow=0,this.hardwareCursorRow=0,this.maxLinesRendered=0,this.previousViewportTop=0;if(this.renderRequested)return;this.renderRequested=!0,process.nextTick(()=>{this.renderRequested=!1,this.doRender()})}handleInput(_){if(this.cellSizeQueryPending){this.inputBuffer+=_;let A=this.parseCellSizeResponse();if(A.length===0)return;_=A}if(H1(_,"shift+ctrl+d")&&this.onDebug){this.onDebug();return}let z=this.overlayStack.find((A)=>A.component===this.focusedComponent);if(z&&!this.isOverlayVisible(z)){let A=this.getTopmostVisibleOverlay();if(A)this.setFocus(A.component);else this.setFocus(z.preFocus)}if(this.focusedComponent?.handleInput){if(x5(_)&&!this.focusedComponent.wantsKeyRelease)return;this.focusedComponent.handleInput(_),this.requestRender()}}parseCellSizeResponse(){let _=/\x1b\[6;(\d+);(\d+)t/,z=this.inputBuffer.match(_);if(z){let G=parseInt(z[1],10),J=parseInt(z[2],10);if(G>0&&J>0)y5({widthPx:J,heightPx:G}),this.invalidate(),this.requestRender();this.inputBuffer=this.inputBuffer.replace(_,""),this.cellSizeQueryPending=!1}if(/\x1b(\[6?;?[\d;]*)?$/.test(this.inputBuffer)){let G=this.inputBuffer[this.inputBuffer.length-1];if(!/[a-zA-Z~]/.test(G))return""}let b=this.inputBuffer;return this.inputBuffer="",this.cellSizeQueryPending=!1,b}resolveOverlayLayout(_,z,A,b){let G=_??{},J=typeof G.margin==="number"?{top:G.margin,right:G.margin,bottom:G.margin,left:G.margin}:G.margin??{},Y=Math.max(0,J.top??0),X=Math.max(0,J.right??0),Q=Math.max(0,J.bottom??0),$=Math.max(0,J.left??0),H=Math.max(1,A-$-X),B=Math.max(1,b-Y-Q),Z=IX(G.width,A)??Math.min(80,H);if(G.minWidth!==void 0)Z=Math.max(Z,G.minWidth);Z=Math.max(1,Math.min(Z,H));let F=IX(G.maxHeight,b);if(F!==void 0)F=Math.max(1,Math.min(F,B));let K=F!==void 0?Math.min(z,F):z,q,W;if(G.row!==void 0)if(typeof G.row==="string"){let V=G.row.match(/^(\d+(?:\.\d+)?)%$/);if(V){let w=Math.max(0,B-K),O=parseFloat(V[1])/100;q=Y+Math.floor(w*O)}else q=this.resolveAnchorRow("center",K,B,Y)}else q=G.row;else{let V=G.anchor??"center";q=this.resolveAnchorRow(V,K,B,Y)}if(G.col!==void 0)if(typeof G.col==="string"){let V=G.col.match(/^(\d+(?:\.\d+)?)%$/);if(V){let w=Math.max(0,H-Z),O=parseFloat(V[1])/100;W=$+Math.floor(w*O)}else W=this.resolveAnchorCol("center",Z,H,$)}else W=G.col;else{let V=G.anchor??"center";W=this.resolveAnchorCol(V,Z,H,$)}if(G.offsetY!==void 0)q+=G.offsetY;if(G.offsetX!==void 0)W+=G.offsetX;return q=Math.max(Y,Math.min(q,b-Q-K)),W=Math.max($,Math.min(W,A-X-Z)),{width:Z,row:q,col:W,maxHeight:F}}resolveAnchorRow(_,z,A,b){switch(_){case"top-left":case"top-center":case"top-right":return b;case"bottom-left":case"bottom-center":case"bottom-right":return b+A-z;case"left-center":case"center":case"right-center":return b+Math.floor((A-z)/2)}}resolveAnchorCol(_,z,A,b){switch(_){case"top-left":case"left-center":case"bottom-left":return b;case"top-right":case"right-center":case"bottom-right":return b+A-z;case"top-center":case"center":case"bottom-center":return b+Math.floor((A-z)/2)}}compositeOverlays(_,z,A){if(this.overlayStack.length===0)return _;let b=[..._],G=[],J=b.length;for(let $ of this.overlayStack){if(!this.isOverlayVisible($))continue;let{component:H,options:B}=$,{width:Z,maxHeight:F}=this.resolveOverlayLayout(B,0,z,A),K=H.render(Z);if(F!==void 0&&K.length>F)K=K.slice(0,F);let{row:q,col:W}=this.resolveOverlayLayout(B,K.length,z,A);G.push({overlayLines:K,row:q,col:W,w:Z}),J=Math.max(J,q+K.length)}let Y=Math.max(this.maxLinesRendered,J);while(b.length<Y)b.push("");let X=Math.max(0,Y-A),Q=new Set;for(let{overlayLines:$,row:H,col:B,w:Z}of G)for(let F=0;F<$.length;F++){let K=X+H+F;if(K>=0&&K<b.length){let q=W0($[F])>Z?Q6($[F],0,Z,!0):$[F];b[K]=this.compositeLineAt(b[K],q,B,Z,z),Q.add(K)}}for(let $ of Q)if(W0(b[$])>z)b[$]=Q6(b[$],0,z,!0);return b}static SEGMENT_RESET="\x1B[0m\x1B]8;;\x07";applyLineResets(_){let z=F1.SEGMENT_RESET;for(let A=0;A<_.length;A++){let b=_[A];if(!wz(b))_[A]=b+z}return _}compositeLineAt(_,z,A,b,G){if(wz(_))return _;let J=A+b,Y=EX(_,A,J,G-J,!0),X=I5(z,0,b,!0),Q=Math.max(0,A-Y.beforeWidth),$=Math.max(0,b-X.width),H=Math.max(A,Y.beforeWidth),B=Math.max(b,X.width),Z=Math.max(0,G-H-B),F=Math.max(0,Z-Y.afterWidth),K=F1.SEGMENT_RESET,q=Y.before+" ".repeat(Q)+K+X.text+" ".repeat($)+K+Y.after+" ".repeat(F);if(W0(q)<=G)return q;return Q6(q,0,G,!0)}extractCursorPosition(_,z){let A=Math.max(0,_.length-z);for(let b=_.length-1;b>=A;b--){let G=_[b],J=G.indexOf(Oz);if(J!==-1){let Y=G.slice(0,J),X=W0(Y);return _[b]=G.slice(0,J)+G.slice(J+Oz.length),{row:b,col:X}}}return null}doRender(){if(this.stopped)return;let _=this.terminal.columns,z=this.terminal.rows,A=Math.max(0,this.maxLinesRendered-z),b=this.previousViewportTop,G=this.hardwareCursorRow,J=(D)=>{let L=G-b;return D-A-L},Y=this.render(_);if(this.overlayStack.length>0)Y=this.compositeOverlays(Y,_,z);let X=this.extractCursorPosition(Y,z);Y=this.applyLineResets(Y);let Q=this.previousWidth!==0&&this.previousWidth!==_,$=this.previousHeight!==0&&this.previousHeight!==z,H=(D)=>{this.fullRedrawCount+=1;let L="\x1B[?2026h";if(D)L+="\x1B[3J\x1B[2J\x1B[H";for(let R=0;R<Y.length;R++){if(R>0)L+=`\r
86
+ `||_==="\x1BOM"||r(_,C0.enter,0)||r(_,C0.kpEnter,0);return r(_,C0.enter,X)||r(_,C0.kpEnter,X);case"backspace":if(Y&&!G&&!J){if(_==="\x1B"||_==="\x1B\b")return!0;return r(_,C0.backspace,D0.alt)}if(X===0)return _===""||_==="\b"||r(_,C0.backspace,0);return r(_,C0.backspace,X);case"insert":if(X===0)return Q9(_,N9.insert)||r(_,T0.insert,0);if(W9(_,"insert",X))return!0;return r(_,T0.insert,X);case"delete":if(X===0)return Q9(_,N9.delete)||r(_,T0.delete,0);if(W9(_,"delete",X))return!0;return r(_,T0.delete,X);case"clear":if(X===0)return Q9(_,N9.clear);return W9(_,"clear",X);case"home":if(X===0)return Q9(_,N9.home)||r(_,T0.home,0);if(W9(_,"home",X))return!0;return r(_,T0.home,X);case"end":if(X===0)return Q9(_,N9.end)||r(_,T0.end,0);if(W9(_,"end",X))return!0;return r(_,T0.end,X);case"pageup":if(X===0)return Q9(_,N9.pageUp)||r(_,T0.pageUp,0);if(W9(_,"pageUp",X))return!0;return r(_,T0.pageUp,X);case"pagedown":if(X===0)return Q9(_,N9.pageDown)||r(_,T0.pageDown,0);if(W9(_,"pageDown",X))return!0;return r(_,T0.pageDown,X);case"up":if(Y&&!G&&!J)return _==="\x1Bp"||r(_,X9.up,D0.alt);if(X===0)return Q9(_,N9.up)||r(_,X9.up,0);if(W9(_,"up",X))return!0;return r(_,X9.up,X);case"down":if(Y&&!G&&!J)return _==="\x1Bn"||r(_,X9.down,D0.alt);if(X===0)return Q9(_,N9.down)||r(_,X9.down,0);if(W9(_,"down",X))return!0;return r(_,X9.down,X);case"left":if(Y&&!G&&!J)return _==="\x1B[1;3D"||!O4&&_==="\x1BB"||_==="\x1Bb"||r(_,X9.left,D0.alt);if(G&&!Y&&!J)return _==="\x1B[1;5D"||W9(_,"left",D0.ctrl)||r(_,X9.left,D0.ctrl);if(X===0)return Q9(_,N9.left)||r(_,X9.left,0);if(W9(_,"left",X))return!0;return r(_,X9.left,X);case"right":if(Y&&!G&&!J)return _==="\x1B[1;3C"||!O4&&_==="\x1BF"||_==="\x1Bf"||r(_,X9.right,D0.alt);if(G&&!Y&&!J)return _==="\x1B[1;5C"||W9(_,"right",D0.ctrl)||r(_,X9.right,D0.ctrl);if(X===0)return Q9(_,N9.right)||r(_,X9.right,0);if(W9(_,"right",X))return!0;return r(_,X9.right,X);case"f1":case"f2":case"f3":case"f4":case"f5":case"f6":case"f7":case"f8":case"f9":case"f10":case"f11":case"f12":{if(X!==0)return!1;return Q9(_,N9[b])}}if(b.length===1&&(b>="a"&&b<="z"||wR.has(b))){let Q=b.charCodeAt(0),$=jR(b);if(G&&Y&&!J&&!O4&&$)return _===`\x1B${$}`;if(Y&&!G&&!J&&!O4&&b>="a"&&b<="z"){if(_===`\x1B${b}`)return!0}if(G&&!J&&!Y){if($&&_===$)return!0;return r(_,Q,D0.ctrl)}if(G&&J&&!Y)return r(_,Q,D0.shift+D0.ctrl);if(J&&!G&&!Y){if(_===b.toUpperCase())return!0;return r(_,Q,D0.shift)}if(X!==0)return r(_,Q,X);return _===b||r(_,Q,0)}return!1}var jX={cursorUp:"up",cursorDown:"down",cursorLeft:["left","ctrl+b"],cursorRight:["right","ctrl+f"],cursorWordLeft:["alt+left","ctrl+left","alt+b"],cursorWordRight:["alt+right","ctrl+right","alt+f"],cursorLineStart:["home","ctrl+a"],cursorLineEnd:["end","ctrl+e"],jumpForward:"ctrl+]",jumpBackward:"ctrl+alt+]",pageUp:"pageUp",pageDown:"pageDown",deleteCharBackward:"backspace",deleteCharForward:["delete","ctrl+d"],deleteWordBackward:["ctrl+w","alt+backspace"],deleteWordForward:["alt+d","alt+delete"],deleteToLineStart:"ctrl+u",deleteToLineEnd:"ctrl+k",newLine:"shift+enter",submit:"enter",tab:"tab",selectUp:"up",selectDown:"down",selectPageUp:"pageUp",selectPageDown:"pageDown",selectConfirm:"enter",selectCancel:["escape","ctrl+c"],copy:"ctrl+c",yank:"ctrl+y",yankPop:"alt+y",undo:"ctrl+-",expandTools:"ctrl+o",toggleSessionPath:"ctrl+p",toggleSessionSort:"ctrl+s",renameSession:"ctrl+r",deleteSession:"ctrl+d",deleteSessionNoninvasive:"ctrl+backspace"};class y5{actionToKeys;constructor(_={}){this.actionToKeys=new Map,this.buildMaps(_)}buildMaps(_){this.actionToKeys.clear();for(let[z,A]of Object.entries(jX)){let b=Array.isArray(A)?A:[A];this.actionToKeys.set(z,[...b])}for(let[z,A]of Object.entries(_)){if(A===void 0)continue;let b=Array.isArray(A)?A:[A];this.actionToKeys.set(z,b)}}matches(_,z){let A=this.actionToKeys.get(z);if(!A)return!1;for(let b of A)if(Z1(_,b))return!0;return!1}getKeys(_){return this.actionToKeys.get(_)??[]}setConfig(_){this.buildMaps(_)}}var v5=null;function s4(){if(!v5)v5=new y5;return v5}class F1{text;paddingX;paddingY;customBgFn;cachedText;cachedWidth;cachedLines;constructor(_="",z=1,A=1,b){this.text=_,this.paddingX=z,this.paddingY=A,this.customBgFn=b}setText(_){this.text=_,this.cachedText=void 0,this.cachedWidth=void 0,this.cachedLines=void 0}setCustomBgFn(_){this.customBgFn=_,this.cachedText=void 0,this.cachedWidth=void 0,this.cachedLines=void 0}invalidate(){this.cachedText=void 0,this.cachedWidth=void 0,this.cachedLines=void 0}render(_){if(this.cachedLines&&this.cachedText===this.text&&this.cachedWidth===_)return this.cachedLines;if(!this.text||this.text.trim()===""){let H=[];return this.cachedText=this.text,this.cachedWidth=_,this.cachedLines=H,H}let z=this.text.replace(/\t/g," "),A=Math.max(1,_-this.paddingX*2),b=wz(z,A),G=" ".repeat(this.paddingX),J=" ".repeat(this.paddingX),Y=[];for(let H of b){let B=G+H+J;if(this.customBgFn)Y.push(Ez(B,_,this.customBgFn));else{let Z=W0(B),F=Math.max(0,_-Z);Y.push(B+" ".repeat(F))}}let X=" ".repeat(_),Q=[];for(let H=0;H<this.paddingY;H++){let B=this.customBgFn?Ez(X,_,this.customBgFn):X;Q.push(B)}let $=[...Q,...Y,...Q];return this.cachedText=this.text,this.cachedWidth=_,this.cachedLines=$,$.length>0?$:[""]}}class q6 extends F1{spinnerColorFn;messageColorFn;message;frames=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"];currentFrame=0;intervalId=null;ui=null;constructor(_,z,A,b="Loading..."){super("",1,0);this.spinnerColorFn=z,this.messageColorFn=A,this.message=b,this.ui=_,this.start()}render(_){return["",...super.render(_)]}start(){this.updateDisplay(),this.intervalId=setInterval(()=>{this.currentFrame=(this.currentFrame+1)%this.frames.length,this.updateDisplay()},80)}stop(){if(this.intervalId)clearInterval(this.intervalId),this.intervalId=null}setMessage(_){this.message=_,this.updateDisplay()}updateDisplay(){let _=this.frames[this.currentFrame];if(this.setText(`${this.spinnerColorFn(_)} ${this.messageColorFn(this.message)}`),this.ui)this.ui.requestRender()}}class RX extends q6{abortController=new AbortController;onAbort;get signal(){return this.abortController.signal}get aborted(){return this.abortController.signal.aborted}handleInput(_){if(s4().matches(_,"selectCancel"))this.abortController.abort(),this.onAbort?.()}dispose(){this.stop()}}import*as K1 from"node:fs";import*as xX from"node:os";import*as Lz from"node:path";var g5=null,PR={widthPx:9,heightPx:18};function f5(_){PR=_}function kX(){let _=process.env.TERM_PROGRAM?.toLowerCase()||"",z=process.env.TERM?.toLowerCase()||"",A=process.env.COLORTERM?.toLowerCase()||"";if(process.env.KITTY_WINDOW_ID||_==="kitty")return{images:"kitty",trueColor:!0,hyperlinks:!0};if(_==="ghostty"||z.includes("ghostty")||process.env.GHOSTTY_RESOURCES_DIR)return{images:"kitty",trueColor:!0,hyperlinks:!0};if(process.env.WEZTERM_PANE||_==="wezterm")return{images:"kitty",trueColor:!0,hyperlinks:!0};if(process.env.ITERM_SESSION_ID||_==="iterm.app")return{images:"iterm2",trueColor:!0,hyperlinks:!0};if(_==="vscode")return{images:null,trueColor:!0,hyperlinks:!0};if(_==="alacritty")return{images:null,trueColor:!0,hyperlinks:!0};return{images:null,trueColor:A==="truecolor"||A==="24bit",hyperlinks:!0}}function W6(){if(!g5)g5=kX();return g5}var PX="\x1B_G",SX="\x1B]1337;File=";function Oz(_){if(_.startsWith(PX)||_.startsWith(SX))return!0;return _.includes(PX)||_.includes(SX)}function h5(_){return _!==null&&"focused"in _}var jz="\x1B_pi:c\x07";function IX(_,z){if(_===void 0)return;if(typeof _==="number")return _;let A=_.match(/^(\d+(?:\.\d+)?)%$/);if(A)return Math.floor(z*parseFloat(A[1])/100);return}class m5{children=[];addChild(_){this.children.push(_)}removeChild(_){let z=this.children.indexOf(_);if(z!==-1)this.children.splice(z,1)}clear(){this.children=[]}invalidate(){for(let _ of this.children)_.invalidate?.()}render(_){let z=[];for(let A of this.children)z.push(...A.render(_));return z}}class q1 extends m5{terminal;previousLines=[];previousWidth=0;previousHeight=0;focusedComponent=null;onDebug;renderRequested=!1;cursorRow=0;hardwareCursorRow=0;inputBuffer="";cellSizeQueryPending=!1;showHardwareCursor=process.env.PI_HARDWARE_CURSOR==="1";maxLinesRendered=0;previousViewportTop=0;fullRedrawCount=0;stopped=!1;overlayStack=[];constructor(_,z){super();if(this.terminal=_,z!==void 0)this.showHardwareCursor=z}get fullRedraws(){return this.fullRedrawCount}getShowHardwareCursor(){return this.showHardwareCursor}setShowHardwareCursor(_){if(this.showHardwareCursor===_)return;if(this.showHardwareCursor=_,!_)this.terminal.hideCursor();this.requestRender()}setFocus(_){if(h5(this.focusedComponent))this.focusedComponent.focused=!1;if(this.focusedComponent=_,h5(_))_.focused=!0}showOverlay(_,z){let A={component:_,options:z,preFocus:this.focusedComponent,hidden:!1};if(this.overlayStack.push(A),this.isOverlayVisible(A))this.setFocus(_);return this.terminal.hideCursor(),this.requestRender(),{hide:()=>{let b=this.overlayStack.indexOf(A);if(b!==-1){if(this.overlayStack.splice(b,1),this.focusedComponent===_){let G=this.getTopmostVisibleOverlay();this.setFocus(G?.component??A.preFocus)}if(this.overlayStack.length===0)this.terminal.hideCursor();this.requestRender()}},setHidden:(b)=>{if(A.hidden===b)return;if(A.hidden=b,b){if(this.focusedComponent===_){let G=this.getTopmostVisibleOverlay();this.setFocus(G?.component??A.preFocus)}}else if(this.isOverlayVisible(A))this.setFocus(_);this.requestRender()},isHidden:()=>A.hidden}}hideOverlay(){let _=this.overlayStack.pop();if(!_)return;let z=this.getTopmostVisibleOverlay();if(this.setFocus(z?.component??_.preFocus),this.overlayStack.length===0)this.terminal.hideCursor();this.requestRender()}hasOverlay(){return this.overlayStack.some((_)=>this.isOverlayVisible(_))}isOverlayVisible(_){if(_.hidden)return!1;if(_.options?.visible)return _.options.visible(this.terminal.columns,this.terminal.rows);return!0}getTopmostVisibleOverlay(){for(let _=this.overlayStack.length-1;_>=0;_--)if(this.isOverlayVisible(this.overlayStack[_]))return this.overlayStack[_];return}invalidate(){super.invalidate();for(let _ of this.overlayStack)_.component.invalidate?.()}start(){this.stopped=!1,this.terminal.start((_)=>this.handleInput(_),()=>this.requestRender()),this.terminal.hideCursor(),this.queryCellSize(),this.requestRender()}queryCellSize(){if(!W6().images)return;this.cellSizeQueryPending=!0,this.terminal.write("\x1B[16t")}stop(){if(this.stopped=!0,this.previousLines.length>0){let z=this.previousLines.length-this.hardwareCursorRow;if(z>0)this.terminal.write(`\x1B[${z}B`);else if(z<0)this.terminal.write(`\x1B[${-z}A`);this.terminal.write(`\r
87
+ `)}this.terminal.showCursor(),this.terminal.stop()}requestRender(_=!1){if(_)this.previousLines=[],this.previousWidth=-1,this.previousHeight=-1,this.cursorRow=0,this.hardwareCursorRow=0,this.maxLinesRendered=0,this.previousViewportTop=0;if(this.renderRequested)return;this.renderRequested=!0,process.nextTick(()=>{this.renderRequested=!1,this.doRender()})}handleInput(_){if(this.cellSizeQueryPending){this.inputBuffer+=_;let A=this.parseCellSizeResponse();if(A.length===0)return;_=A}if(Z1(_,"shift+ctrl+d")&&this.onDebug){this.onDebug();return}let z=this.overlayStack.find((A)=>A.component===this.focusedComponent);if(z&&!this.isOverlayVisible(z)){let A=this.getTopmostVisibleOverlay();if(A)this.setFocus(A.component);else this.setFocus(z.preFocus)}if(this.focusedComponent?.handleInput){if(C5(_)&&!this.focusedComponent.wantsKeyRelease)return;this.focusedComponent.handleInput(_),this.requestRender()}}parseCellSizeResponse(){let _=/\x1b\[6;(\d+);(\d+)t/,z=this.inputBuffer.match(_);if(z){let G=parseInt(z[1],10),J=parseInt(z[2],10);if(G>0&&J>0)f5({widthPx:J,heightPx:G}),this.invalidate(),this.requestRender();this.inputBuffer=this.inputBuffer.replace(_,""),this.cellSizeQueryPending=!1}if(/\x1b(\[6?;?[\d;]*)?$/.test(this.inputBuffer)){let G=this.inputBuffer[this.inputBuffer.length-1];if(!/[a-zA-Z~]/.test(G))return""}let b=this.inputBuffer;return this.inputBuffer="",this.cellSizeQueryPending=!1,b}resolveOverlayLayout(_,z,A,b){let G=_??{},J=typeof G.margin==="number"?{top:G.margin,right:G.margin,bottom:G.margin,left:G.margin}:G.margin??{},Y=Math.max(0,J.top??0),X=Math.max(0,J.right??0),Q=Math.max(0,J.bottom??0),$=Math.max(0,J.left??0),H=Math.max(1,A-$-X),B=Math.max(1,b-Y-Q),Z=IX(G.width,A)??Math.min(80,H);if(G.minWidth!==void 0)Z=Math.max(Z,G.minWidth);Z=Math.max(1,Math.min(Z,H));let F=IX(G.maxHeight,b);if(F!==void 0)F=Math.max(1,Math.min(F,B));let K=F!==void 0?Math.min(z,F):z,q,W;if(G.row!==void 0)if(typeof G.row==="string"){let V=G.row.match(/^(\d+(?:\.\d+)?)%$/);if(V){let w=Math.max(0,B-K),O=parseFloat(V[1])/100;q=Y+Math.floor(w*O)}else q=this.resolveAnchorRow("center",K,B,Y)}else q=G.row;else{let V=G.anchor??"center";q=this.resolveAnchorRow(V,K,B,Y)}if(G.col!==void 0)if(typeof G.col==="string"){let V=G.col.match(/^(\d+(?:\.\d+)?)%$/);if(V){let w=Math.max(0,H-Z),O=parseFloat(V[1])/100;W=$+Math.floor(w*O)}else W=this.resolveAnchorCol("center",Z,H,$)}else W=G.col;else{let V=G.anchor??"center";W=this.resolveAnchorCol(V,Z,H,$)}if(G.offsetY!==void 0)q+=G.offsetY;if(G.offsetX!==void 0)W+=G.offsetX;return q=Math.max(Y,Math.min(q,b-Q-K)),W=Math.max($,Math.min(W,A-X-Z)),{width:Z,row:q,col:W,maxHeight:F}}resolveAnchorRow(_,z,A,b){switch(_){case"top-left":case"top-center":case"top-right":return b;case"bottom-left":case"bottom-center":case"bottom-right":return b+A-z;case"left-center":case"center":case"right-center":return b+Math.floor((A-z)/2)}}resolveAnchorCol(_,z,A,b){switch(_){case"top-left":case"left-center":case"bottom-left":return b;case"top-right":case"right-center":case"bottom-right":return b+A-z;case"top-center":case"center":case"bottom-center":return b+Math.floor((A-z)/2)}}compositeOverlays(_,z,A){if(this.overlayStack.length===0)return _;let b=[..._],G=[],J=b.length;for(let $ of this.overlayStack){if(!this.isOverlayVisible($))continue;let{component:H,options:B}=$,{width:Z,maxHeight:F}=this.resolveOverlayLayout(B,0,z,A),K=H.render(Z);if(F!==void 0&&K.length>F)K=K.slice(0,F);let{row:q,col:W}=this.resolveOverlayLayout(B,K.length,z,A);G.push({overlayLines:K,row:q,col:W,w:Z}),J=Math.max(J,q+K.length)}let Y=Math.max(this.maxLinesRendered,J);while(b.length<Y)b.push("");let X=Math.max(0,Y-A),Q=new Set;for(let{overlayLines:$,row:H,col:B,w:Z}of G)for(let F=0;F<$.length;F++){let K=X+H+F;if(K>=0&&K<b.length){let q=W0($[F])>Z?B6($[F],0,Z,!0):$[F];b[K]=this.compositeLineAt(b[K],q,B,Z,z),Q.add(K)}}for(let $ of Q)if(W0(b[$])>z)b[$]=B6(b[$],0,z,!0);return b}static SEGMENT_RESET="\x1B[0m\x1B]8;;\x07";applyLineResets(_){let z=q1.SEGMENT_RESET;for(let A=0;A<_.length;A++){let b=_[A];if(!Oz(b))_[A]=b+z}return _}compositeLineAt(_,z,A,b,G){if(Oz(_))return _;let J=A+b,Y=EX(_,A,J,G-J,!0),X=T5(z,0,b,!0),Q=Math.max(0,A-Y.beforeWidth),$=Math.max(0,b-X.width),H=Math.max(A,Y.beforeWidth),B=Math.max(b,X.width),Z=Math.max(0,G-H-B),F=Math.max(0,Z-Y.afterWidth),K=q1.SEGMENT_RESET,q=Y.before+" ".repeat(Q)+K+X.text+" ".repeat($)+K+Y.after+" ".repeat(F);if(W0(q)<=G)return q;return B6(q,0,G,!0)}extractCursorPosition(_,z){let A=Math.max(0,_.length-z);for(let b=_.length-1;b>=A;b--){let G=_[b],J=G.indexOf(jz);if(J!==-1){let Y=G.slice(0,J),X=W0(Y);return _[b]=G.slice(0,J)+G.slice(J+jz.length),{row:b,col:X}}}return null}doRender(){if(this.stopped)return;let _=this.terminal.columns,z=this.terminal.rows,A=Math.max(0,this.maxLinesRendered-z),b=this.previousViewportTop,G=this.hardwareCursorRow,J=(D)=>{let L=G-b;return D-A-L},Y=this.render(_);if(this.overlayStack.length>0)Y=this.compositeOverlays(Y,_,z);let X=this.extractCursorPosition(Y,z);Y=this.applyLineResets(Y);let Q=this.previousWidth!==0&&this.previousWidth!==_,$=this.previousHeight!==0&&this.previousHeight!==z,H=(D)=>{this.fullRedrawCount+=1;let L="\x1B[?2026h";if(D)L+="\x1B[3J\x1B[2J\x1B[H";for(let R=0;R<Y.length;R++){if(R>0)L+=`\r
88
88
  `;L+=Y[R]}if(L+="\x1B[?2026l",this.terminal.write(L),this.cursorRow=Math.max(0,Y.length-1),this.hardwareCursorRow=this.cursorRow,D)this.maxLinesRendered=Y.length;else this.maxLinesRendered=Math.max(this.maxLinesRendered,Y.length);this.previousViewportTop=Math.max(0,this.maxLinesRendered-z),this.positionHardwareCursor(X,Y.length),this.previousLines=Y,this.previousWidth=_,this.previousHeight=z};if(this.previousLines.length===0&&!Q&&!$){H(!1);return}if(Q||$){H(!0);return}if(Y.length<this.maxLinesRendered&&this.overlayStack.length===0){H(!0);return}let B=-1,Z=-1,F=Math.max(Y.length,this.previousLines.length);for(let D=0;D<F;D++){let L=D<this.previousLines.length?this.previousLines[D]:"",R=D<Y.length?Y[D]:"";if(L!==R){if(B===-1)B=D;Z=D}}let K=Y.length>this.previousLines.length;if(K){if(B===-1)B=this.previousLines.length;Z=Y.length-1}let q=K&&B===this.previousLines.length&&B>0;if(B===-1){this.positionHardwareCursor(X,Y.length),this.previousViewportTop=Math.max(0,this.maxLinesRendered-z);return}if(B>=Y.length){if(this.previousLines.length>Y.length){let D="\x1B[?2026h",L=Math.max(0,Y.length-1),R=J(L);if(R>0)D+=`\x1B[${R}B`;else if(R<0)D+=`\x1B[${-R}A`;D+="\r";let S=this.previousLines.length-Y.length;if(S>z){H(!0);return}if(S>0)D+="\x1B[1B";for(let y=0;y<S;y++)if(D+="\r\x1B[2K",y<S-1)D+="\x1B[1B";if(S>0)D+=`\x1B[${S}A`;D+="\x1B[?2026l",this.terminal.write(D),this.cursorRow=L,this.hardwareCursorRow=L}this.positionHardwareCursor(X,Y.length),this.previousLines=Y,this.previousWidth=_,this.previousHeight=z,this.previousViewportTop=Math.max(0,this.maxLinesRendered-z);return}if(B<A){H(!0);return}let W="\x1B[?2026h",V=b+z-1,w=q?B-1:B;if(w>V){let D=Math.max(0,Math.min(z-1,G-b)),L=z-1-D;if(L>0)W+=`\x1B[${L}B`;let R=w-V;W+=`\r
89
89
  `.repeat(R),b+=R,A+=R,G=w}let O=J(w);if(O>0)W+=`\x1B[${O}B`;else if(O<0)W+=`\x1B[${-O}A`;W+=q?`\r
90
90
  `:"\r";let M=Math.min(Z,Y.length-1);for(let D=B;D<=M;D++){if(D>B)W+=`\r
91
- `;W+="\x1B[2K";let L=Y[D];if(!wz(L)&&W0(L)>_){let S=Ez.join(xX.homedir(),".pi","agent","pi-crash.log"),y=[`Crash at ${new Date().toISOString()}`,`Terminal width: ${_}`,`Line ${D} visible width: ${W0(L)}`,"","=== All rendered lines ===",...Y.map((u,g)=>`[${g}] (w=${W0(u)}) ${u}`),""].join(`
92
- `);Z1.mkdirSync(Ez.dirname(S),{recursive:!0}),Z1.writeFileSync(S,y),this.stop();let e=[`Rendered line ${D} exceeds terminal width (${W0(L)} > ${_}).`,"","This is likely caused by a custom TUI component not truncating its output.","Use visibleWidth() to measure and truncateToWidth() to truncate lines.","",`Debug log written to: ${S}`].join(`
91
+ `;W+="\x1B[2K";let L=Y[D];if(!Oz(L)&&W0(L)>_){let S=Lz.join(xX.homedir(),".pi","agent","pi-crash.log"),y=[`Crash at ${new Date().toISOString()}`,`Terminal width: ${_}`,`Line ${D} visible width: ${W0(L)}`,"","=== All rendered lines ===",...Y.map((u,g)=>`[${g}] (w=${W0(u)}) ${u}`),""].join(`
92
+ `);K1.mkdirSync(Lz.dirname(S),{recursive:!0}),K1.writeFileSync(S,y),this.stop();let e=[`Rendered line ${D} exceeds terminal width (${W0(L)} > ${_}).`,"","This is likely caused by a custom TUI component not truncating its output.","Use visibleWidth() to measure and truncateToWidth() to truncate lines.","",`Debug log written to: ${S}`].join(`
93
93
  `);throw Error(e)}W+=L}let P=M;if(this.previousLines.length>Y.length){if(M<Y.length-1){let L=Y.length-1-M;W+=`\x1B[${L}B`,P=Y.length-1}let D=this.previousLines.length-Y.length;for(let L=Y.length;L<this.previousLines.length;L++)W+=`\r
94
- \x1B[2K`;W+=`\x1B[${D}A`}if(W+="\x1B[?2026l",process.env.PI_TUI_DEBUG==="1"){Z1.mkdirSync("/tmp/tui",{recursive:!0});let L=Ez.join("/tmp/tui",`render-${Date.now()}-${Math.random().toString(36).slice(2)}.log`),R=[`firstChanged: ${B}`,`viewportTop: ${A}`,`cursorRow: ${this.cursorRow}`,`height: ${z}`,`lineDiff: ${O}`,`hardwareCursorRow: ${G}`,`renderEnd: ${M}`,`finalCursorRow: ${P}`,`cursorPos: ${JSON.stringify(X)}`,`newLines.length: ${Y.length}`,`previousLines.length: ${this.previousLines.length}`,"","=== newLines ===",JSON.stringify(Y,null,2),"","=== previousLines ===",JSON.stringify(this.previousLines,null,2),"","=== buffer ===",JSON.stringify(W)].join(`
95
- `);Z1.writeFileSync(L,R)}this.terminal.write(W),this.cursorRow=Math.max(0,Y.length-1),this.hardwareCursorRow=P,this.maxLinesRendered=Math.max(this.maxLinesRendered,Y.length),this.previousViewportTop=Math.max(0,this.maxLinesRendered-z),this.positionHardwareCursor(X,Y.length),this.previousLines=Y,this.previousWidth=_,this.previousHeight=z}positionHardwareCursor(_,z){if(!_||z<=0){this.terminal.hideCursor();return}let A=Math.max(0,Math.min(_.row,z-1)),b=Math.max(0,_.col),G=A-this.hardwareCursorRow,J="";if(G>0)J+=`\x1B[${G}B`;else if(G<0)J+=`\x1B[${-G}A`;if(J+=`\x1B[${b+1}G`,J)this.terminal.write(J);if(this.hardwareCursorRow=A,this.showHardwareCursor)this.terminal.showCursor();else this.terminal.hideCursor()}}var OR=(_)=>_.replace(/[\r\n]+/g," ").trim();class Lz{items=[];filteredItems=[];selectedIndex=0;maxVisible=5;theme;onSelect;onCancel;onSelectionChange;constructor(_,z,A){this.items=_,this.filteredItems=_,this.maxVisible=z,this.theme=A}setFilter(_){this.filteredItems=this.items.filter((z)=>z.value.toLowerCase().startsWith(_.toLowerCase())),this.selectedIndex=0}setSelectedIndex(_){this.selectedIndex=Math.max(0,Math.min(_,this.filteredItems.length-1))}invalidate(){}render(_){let z=[];if(this.filteredItems.length===0)return z.push(this.theme.noMatch(" No matching commands")),z;let A=Math.max(0,Math.min(this.selectedIndex-Math.floor(this.maxVisible/2),this.filteredItems.length-this.maxVisible)),b=Math.min(A+this.maxVisible,this.filteredItems.length);for(let G=A;G<b;G++){let J=this.filteredItems[G];if(!J)continue;let Y=G===this.selectedIndex,X=J.description?OR(J.description):void 0,Q="";if(Y){let H=J.label||J.value;if(X&&_>40){let B=Math.min(30,_-2-4),Z=n0(H,B,""),F=" ".repeat(Math.max(1,32-Z.length)),K=2+Z.length+F.length,q=_-K-2;if(q>10){let W=n0(X,q,"");Q=this.theme.selectedText(`→ ${Z}${F}${W}`)}else{let W=_-2-2;Q=this.theme.selectedText(`→ ${n0(H,W,"")}`)}}else{let B=_-2-2;Q=this.theme.selectedText(`→ ${n0(H,B,"")}`)}}else{let $=J.label||J.value,H=" ";if(X&&_>40){let B=Math.min(30,_-2-4),Z=n0($,B,""),F=" ".repeat(Math.max(1,32-Z.length)),K=2+Z.length+F.length,q=_-K-2;if(q>10){let W=n0(X,q,""),V=this.theme.description(F+W);Q=" "+Z+V}else{let W=_-2-2;Q=" "+n0($,W,"")}}else{let B=_-2-2;Q=" "+n0($,B,"")}}z.push(Q)}if(A>0||b<this.filteredItems.length){let G=` (${this.selectedIndex+1}/${this.filteredItems.length})`;z.push(this.theme.scrollInfo(n0(G,_-2,"")))}return z}handleInput(_){let z=s4();if(z.matches(_,"selectUp"))this.selectedIndex=this.selectedIndex===0?this.filteredItems.length-1:this.selectedIndex-1,this.notifySelectionChange();else if(z.matches(_,"selectDown"))this.selectedIndex=this.selectedIndex===this.filteredItems.length-1?0:this.selectedIndex+1,this.notifySelectionChange();else if(z.matches(_,"selectConfirm")){let A=this.filteredItems[this.selectedIndex];if(A&&this.onSelect)this.onSelect(A)}else if(z.matches(_,"selectCancel")){if(this.onCancel)this.onCancel()}}notifySelectionChange(){let _=this.filteredItems[this.selectedIndex];if(_&&this.onSelectionChange)this.onSelectionChange(_)}getSelectedItem(){return this.filteredItems[this.selectedIndex]||null}}var ba=Y6();var Ha=Y6();function m5(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var R_=m5();function fX(_){R_=_}var Pz={exec:()=>null};function B0(_,z=""){let A=typeof _==="string"?_:_.source,b={replace:(G,J)=>{let Y=typeof J==="string"?J:J.source;return Y=Y.replace(_9.caret,"$1"),A=A.replace(G,Y),b},getRegex:()=>{return new RegExp(A,z)}};return b}var _9={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:(_)=>new RegExp(`^( {0,3}${_})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:(_)=>new RegExp(`^ {0,${Math.min(3,_-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:(_)=>new RegExp(`^ {0,${Math.min(3,_-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:(_)=>new RegExp(`^ {0,${Math.min(3,_-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:(_)=>new RegExp(`^ {0,${Math.min(3,_-1)}}#`),htmlBeginRegex:(_)=>new RegExp(`^ {0,${Math.min(3,_-1)}}<(?:[a-z].*>|!--)`,"i")},kR=/^(?:[ \t]*(?:\n|$))+/,IR=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,xR=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Sz=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,TR=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,u5=/(?:[*+-]|\d{1,9}[.)])/,hX=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,mX=B0(hX).replace(/bull/g,u5).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),CR=B0(hX).replace(/bull/g,u5).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),c5=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,vR=/^[^\n]+/,l5=/(?!\s*\])(?:\\.|[^\[\]\\])+/,yR=B0(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",l5).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),gR=B0(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,u5).getRegex(),D6="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",p5=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,fR=B0("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$))","i").replace("comment",p5).replace("tag",D6).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),uX=B0(c5).replace("hr",Sz).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",D6).getRegex(),hR=B0(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",uX).getRegex(),d5={blockquote:hR,code:IR,def:yR,fences:xR,heading:TR,hr:Sz,html:fR,lheading:mX,list:gR,newline:kR,paragraph:uX,table:Pz,text:vR},TX=B0("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Sz).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3}\t)[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",D6).getRegex(),mR={...d5,lheading:CR,table:TX,paragraph:B0(c5).replace("hr",Sz).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",TX).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",D6).getRegex()},uR={...d5,html:B0(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",p5).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Pz,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:B0(c5).replace("hr",Sz).replace("heading",` *#{1,6} *[^
96
- ]`).replace("lheading",mX).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},cR=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,lR=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,cX=/^( {2,}|\\)\n(?!\s*$)/,pR=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,M6=/[\p{P}\p{S}]/u,r5=/[\s\p{P}\p{S}]/u,lX=/[^\s\p{P}\p{S}]/u,dR=B0(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,r5).getRegex(),pX=/(?!~)[\p{P}\p{S}]/u,rR=/(?!~)[\s\p{P}\p{S}]/u,nR=/(?:[^\s\p{P}\p{S}]|~)/u,iR=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,dX=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,oR=B0(dX,"u").replace(/punct/g,M6).getRegex(),aR=B0(dX,"u").replace(/punct/g,pX).getRegex(),rX="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",sR=B0(rX,"gu").replace(/notPunctSpace/g,lX).replace(/punctSpace/g,r5).replace(/punct/g,M6).getRegex(),tR=B0(rX,"gu").replace(/notPunctSpace/g,nR).replace(/punctSpace/g,rR).replace(/punct/g,pX).getRegex(),eR=B0("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,lX).replace(/punctSpace/g,r5).replace(/punct/g,M6).getRegex(),_P=B0(/\\(punct)/,"gu").replace(/punct/g,M6).getRegex(),zP=B0(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),AP=B0(p5).replace("(?:-->|$)","-->").getRegex(),bP=B0("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",AP).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),W6=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,GP=B0(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",W6).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),nX=B0(/^!?\[(label)\]\[(ref)\]/).replace("label",W6).replace("ref",l5).getRegex(),iX=B0(/^!?\[(ref)\](?:\[\])?/).replace("ref",l5).getRegex(),JP=B0("reflink|nolink(?!\\()","g").replace("reflink",nX).replace("nolink",iX).getRegex(),n5={_backpedal:Pz,anyPunctuation:_P,autolink:zP,blockSkip:iR,br:cX,code:lR,del:Pz,emStrongLDelim:oR,emStrongRDelimAst:sR,emStrongRDelimUnd:eR,escape:cR,link:GP,nolink:iX,punctuation:dR,reflink:nX,reflinkSearch:JP,tag:bP,text:pR,url:Pz},YP={...n5,link:B0(/^!?\[(label)\]\((.*?)\)/).replace("label",W6).getRegex(),reflink:B0(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",W6).getRegex()},h5={...n5,emStrongRDelimAst:tR,emStrongLDelim:aR,url:B0(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},XP={...h5,br:B0(cX).replace("{2,}","*").getRegex(),text:B0(h5.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},K6={normal:d5,gfm:mR,pedantic:uR},jz={normal:n5,gfm:h5,breaks:XP,pedantic:YP},QP={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},CX=(_)=>QP[_];function $4(_,z){if(z){if(_9.escapeTest.test(_))return _.replace(_9.escapeReplace,CX)}else if(_9.escapeTestNoEncode.test(_))return _.replace(_9.escapeReplaceNoEncode,CX);return _}function vX(_){try{_=encodeURI(_).replace(_9.percentDecode,"%")}catch{return null}return _}function yX(_,z){let A=_.replace(_9.findPipe,(J,Y,X)=>{let Q=!1,$=Y;while(--$>=0&&X[$]==="\\")Q=!Q;if(Q)return"|";else return" |"}),b=A.split(_9.splitPipe),G=0;if(!b[0].trim())b.shift();if(b.length>0&&!b.at(-1)?.trim())b.pop();if(z)if(b.length>z)b.splice(z);else while(b.length<z)b.push("");for(;G<b.length;G++)b[G]=b[G].trim().replace(_9.slashPipe,"|");return b}function Rz(_,z,A){let b=_.length;if(b===0)return"";let G=0;while(G<b){let J=_.charAt(b-G-1);if(J===z&&!A)G++;else if(J!==z&&A)G++;else break}return _.slice(0,b-G)}function $P(_,z){if(_.indexOf(z[1])===-1)return-1;let A=0;for(let b=0;b<_.length;b++)if(_[b]==="\\")b++;else if(_[b]===z[0])A++;else if(_[b]===z[1]){if(A--,A<0)return b}if(A>0)return-2;return-1}function gX(_,z,A,b,G){let J=z.href,Y=z.title||null,X=_[1].replace(G.other.outputLinkReplace,"$1");b.state.inLink=!0;let Q={type:_[0].charAt(0)==="!"?"image":"link",raw:A,href:J,title:Y,text:X,tokens:b.inlineTokens(X)};return b.state.inLink=!1,Q}function HP(_,z,A){let b=_.match(A.other.indentCodeCompensation);if(b===null)return z;let G=b[1];return z.split(`
94
+ \x1B[2K`;W+=`\x1B[${D}A`}if(W+="\x1B[?2026l",process.env.PI_TUI_DEBUG==="1"){K1.mkdirSync("/tmp/tui",{recursive:!0});let L=Lz.join("/tmp/tui",`render-${Date.now()}-${Math.random().toString(36).slice(2)}.log`),R=[`firstChanged: ${B}`,`viewportTop: ${A}`,`cursorRow: ${this.cursorRow}`,`height: ${z}`,`lineDiff: ${O}`,`hardwareCursorRow: ${G}`,`renderEnd: ${M}`,`finalCursorRow: ${P}`,`cursorPos: ${JSON.stringify(X)}`,`newLines.length: ${Y.length}`,`previousLines.length: ${this.previousLines.length}`,"","=== newLines ===",JSON.stringify(Y,null,2),"","=== previousLines ===",JSON.stringify(this.previousLines,null,2),"","=== buffer ===",JSON.stringify(W)].join(`
95
+ `);K1.writeFileSync(L,R)}this.terminal.write(W),this.cursorRow=Math.max(0,Y.length-1),this.hardwareCursorRow=P,this.maxLinesRendered=Math.max(this.maxLinesRendered,Y.length),this.previousViewportTop=Math.max(0,this.maxLinesRendered-z),this.positionHardwareCursor(X,Y.length),this.previousLines=Y,this.previousWidth=_,this.previousHeight=z}positionHardwareCursor(_,z){if(!_||z<=0){this.terminal.hideCursor();return}let A=Math.max(0,Math.min(_.row,z-1)),b=Math.max(0,_.col),G=A-this.hardwareCursorRow,J="";if(G>0)J+=`\x1B[${G}B`;else if(G<0)J+=`\x1B[${-G}A`;if(J+=`\x1B[${b+1}G`,J)this.terminal.write(J);if(this.hardwareCursorRow=A,this.showHardwareCursor)this.terminal.showCursor();else this.terminal.hideCursor()}}var SR=(_)=>_.replace(/[\r\n]+/g," ").trim();class Rz{items=[];filteredItems=[];selectedIndex=0;maxVisible=5;theme;onSelect;onCancel;onSelectionChange;constructor(_,z,A){this.items=_,this.filteredItems=_,this.maxVisible=z,this.theme=A}setFilter(_){this.filteredItems=this.items.filter((z)=>z.value.toLowerCase().startsWith(_.toLowerCase())),this.selectedIndex=0}setSelectedIndex(_){this.selectedIndex=Math.max(0,Math.min(_,this.filteredItems.length-1))}invalidate(){}render(_){let z=[];if(this.filteredItems.length===0)return z.push(this.theme.noMatch(" No matching commands")),z;let A=Math.max(0,Math.min(this.selectedIndex-Math.floor(this.maxVisible/2),this.filteredItems.length-this.maxVisible)),b=Math.min(A+this.maxVisible,this.filteredItems.length);for(let G=A;G<b;G++){let J=this.filteredItems[G];if(!J)continue;let Y=G===this.selectedIndex,X=J.description?SR(J.description):void 0,Q="";if(Y){let H=J.label||J.value;if(X&&_>40){let B=Math.min(30,_-2-4),Z=n0(H,B,""),F=" ".repeat(Math.max(1,32-Z.length)),K=2+Z.length+F.length,q=_-K-2;if(q>10){let W=n0(X,q,"");Q=this.theme.selectedText(`→ ${Z}${F}${W}`)}else{let W=_-2-2;Q=this.theme.selectedText(`→ ${n0(H,W,"")}`)}}else{let B=_-2-2;Q=this.theme.selectedText(`→ ${n0(H,B,"")}`)}}else{let $=J.label||J.value,H=" ";if(X&&_>40){let B=Math.min(30,_-2-4),Z=n0($,B,""),F=" ".repeat(Math.max(1,32-Z.length)),K=2+Z.length+F.length,q=_-K-2;if(q>10){let W=n0(X,q,""),V=this.theme.description(F+W);Q=" "+Z+V}else{let W=_-2-2;Q=" "+n0($,W,"")}}else{let B=_-2-2;Q=" "+n0($,B,"")}}z.push(Q)}if(A>0||b<this.filteredItems.length){let G=` (${this.selectedIndex+1}/${this.filteredItems.length})`;z.push(this.theme.scrollInfo(n0(G,_-2,"")))}return z}handleInput(_){let z=s4();if(z.matches(_,"selectUp"))this.selectedIndex=this.selectedIndex===0?this.filteredItems.length-1:this.selectedIndex-1,this.notifySelectionChange();else if(z.matches(_,"selectDown"))this.selectedIndex=this.selectedIndex===this.filteredItems.length-1?0:this.selectedIndex+1,this.notifySelectionChange();else if(z.matches(_,"selectConfirm")){let A=this.filteredItems[this.selectedIndex];if(A&&this.onSelect)this.onSelect(A)}else if(z.matches(_,"selectCancel")){if(this.onCancel)this.onCancel()}}notifySelectionChange(){let _=this.filteredItems[this.selectedIndex];if(_&&this.onSelectionChange)this.onSelectionChange(_)}getSelectedItem(){return this.filteredItems[this.selectedIndex]||null}}var Fa=$6();var Ma=$6();function c5(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var R_=c5();function fX(_){R_=_}var kz={exec:()=>null};function B0(_,z=""){let A=typeof _==="string"?_:_.source,b={replace:(G,J)=>{let Y=typeof J==="string"?J:J.source;return Y=Y.replace(_9.caret,"$1"),A=A.replace(G,Y),b},getRegex:()=>{return new RegExp(A,z)}};return b}var _9={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:(_)=>new RegExp(`^( {0,3}${_})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:(_)=>new RegExp(`^ {0,${Math.min(3,_-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:(_)=>new RegExp(`^ {0,${Math.min(3,_-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:(_)=>new RegExp(`^ {0,${Math.min(3,_-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:(_)=>new RegExp(`^ {0,${Math.min(3,_-1)}}#`),htmlBeginRegex:(_)=>new RegExp(`^ {0,${Math.min(3,_-1)}}<(?:[a-z].*>|!--)`,"i")},vR=/^(?:[ \t]*(?:\n|$))+/,yR=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,gR=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Iz=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,fR=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,l5=/(?:[*+-]|\d{1,9}[.)])/,hX=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,mX=B0(hX).replace(/bull/g,l5).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),hR=B0(hX).replace(/bull/g,l5).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),p5=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,mR=/^[^\n]+/,d5=/(?!\s*\])(?:\\.|[^\[\]\\])+/,uR=B0(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",d5).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),cR=B0(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,l5).getRegex(),w6="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",r5=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,lR=B0("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$))","i").replace("comment",r5).replace("tag",w6).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),uX=B0(p5).replace("hr",Iz).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",w6).getRegex(),pR=B0(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",uX).getRegex(),n5={blockquote:pR,code:yR,def:uR,fences:gR,heading:fR,hr:Iz,html:lR,lheading:mX,list:cR,newline:vR,paragraph:uX,table:kz,text:mR},TX=B0("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Iz).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3}\t)[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",w6).getRegex(),dR={...n5,lheading:hR,table:TX,paragraph:B0(p5).replace("hr",Iz).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",TX).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",w6).getRegex()},rR={...n5,html:B0(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",r5).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:kz,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:B0(p5).replace("hr",Iz).replace("heading",` *#{1,6} *[^
96
+ ]`).replace("lheading",mX).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},nR=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,iR=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,cX=/^( {2,}|\\)\n(?!\s*$)/,oR=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,E6=/[\p{P}\p{S}]/u,i5=/[\s\p{P}\p{S}]/u,lX=/[^\s\p{P}\p{S}]/u,aR=B0(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,i5).getRegex(),pX=/(?!~)[\p{P}\p{S}]/u,sR=/(?!~)[\s\p{P}\p{S}]/u,tR=/(?:[^\s\p{P}\p{S}]|~)/u,eR=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,dX=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,_P=B0(dX,"u").replace(/punct/g,E6).getRegex(),zP=B0(dX,"u").replace(/punct/g,pX).getRegex(),rX="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",AP=B0(rX,"gu").replace(/notPunctSpace/g,lX).replace(/punctSpace/g,i5).replace(/punct/g,E6).getRegex(),bP=B0(rX,"gu").replace(/notPunctSpace/g,tR).replace(/punctSpace/g,sR).replace(/punct/g,pX).getRegex(),GP=B0("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,lX).replace(/punctSpace/g,i5).replace(/punct/g,E6).getRegex(),JP=B0(/\\(punct)/,"gu").replace(/punct/g,E6).getRegex(),YP=B0(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),XP=B0(r5).replace("(?:-->|$)","-->").getRegex(),QP=B0("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",XP).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),D6=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,$P=B0(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",D6).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),nX=B0(/^!?\[(label)\]\[(ref)\]/).replace("label",D6).replace("ref",d5).getRegex(),iX=B0(/^!?\[(ref)\](?:\[\])?/).replace("ref",d5).getRegex(),HP=B0("reflink|nolink(?!\\()","g").replace("reflink",nX).replace("nolink",iX).getRegex(),o5={_backpedal:kz,anyPunctuation:JP,autolink:YP,blockSkip:eR,br:cX,code:iR,del:kz,emStrongLDelim:_P,emStrongRDelimAst:AP,emStrongRDelimUnd:GP,escape:nR,link:$P,nolink:iX,punctuation:aR,reflink:nX,reflinkSearch:HP,tag:QP,text:oR,url:kz},BP={...o5,link:B0(/^!?\[(label)\]\((.*?)\)/).replace("label",D6).getRegex(),reflink:B0(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",D6).getRegex()},u5={...o5,emStrongRDelimAst:bP,emStrongLDelim:zP,url:B0(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},ZP={...u5,br:B0(cX).replace("{2,}","*").getRegex(),text:B0(u5.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},V6={normal:n5,gfm:dR,pedantic:rR},Pz={normal:o5,gfm:u5,breaks:ZP,pedantic:BP},FP={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},CX=(_)=>FP[_];function $4(_,z){if(z){if(_9.escapeTest.test(_))return _.replace(_9.escapeReplace,CX)}else if(_9.escapeTestNoEncode.test(_))return _.replace(_9.escapeReplaceNoEncode,CX);return _}function vX(_){try{_=encodeURI(_).replace(_9.percentDecode,"%")}catch{return null}return _}function yX(_,z){let A=_.replace(_9.findPipe,(J,Y,X)=>{let Q=!1,$=Y;while(--$>=0&&X[$]==="\\")Q=!Q;if(Q)return"|";else return" |"}),b=A.split(_9.splitPipe),G=0;if(!b[0].trim())b.shift();if(b.length>0&&!b.at(-1)?.trim())b.pop();if(z)if(b.length>z)b.splice(z);else while(b.length<z)b.push("");for(;G<b.length;G++)b[G]=b[G].trim().replace(_9.slashPipe,"|");return b}function Sz(_,z,A){let b=_.length;if(b===0)return"";let G=0;while(G<b){let J=_.charAt(b-G-1);if(J===z&&!A)G++;else if(J!==z&&A)G++;else break}return _.slice(0,b-G)}function KP(_,z){if(_.indexOf(z[1])===-1)return-1;let A=0;for(let b=0;b<_.length;b++)if(_[b]==="\\")b++;else if(_[b]===z[0])A++;else if(_[b]===z[1]){if(A--,A<0)return b}if(A>0)return-2;return-1}function gX(_,z,A,b,G){let J=z.href,Y=z.title||null,X=_[1].replace(G.other.outputLinkReplace,"$1");b.state.inLink=!0;let Q={type:_[0].charAt(0)==="!"?"image":"link",raw:A,href:J,title:Y,text:X,tokens:b.inlineTokens(X)};return b.state.inLink=!1,Q}function qP(_,z,A){let b=_.match(A.other.indentCodeCompensation);if(b===null)return z;let G=b[1];return z.split(`
97
97
  `).map((J)=>{let Y=J.match(A.other.beginningSpace);if(Y===null)return J;let[X]=Y;if(X.length>=G.length)return J.slice(G.length);return J}).join(`
98
- `)}var V6=class{options;rules;lexer;constructor(_){this.options=_||R_}space(_){let z=this.rules.block.newline.exec(_);if(z&&z[0].length>0)return{type:"space",raw:z[0]}}code(_){let z=this.rules.block.code.exec(_);if(z){let A=z[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:z[0],codeBlockStyle:"indented",text:!this.options.pedantic?Rz(A,`
99
- `):A}}}fences(_){let z=this.rules.block.fences.exec(_);if(z){let A=z[0],b=HP(A,z[3]||"",this.rules);return{type:"code",raw:A,lang:z[2]?z[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):z[2],text:b}}}heading(_){let z=this.rules.block.heading.exec(_);if(z){let A=z[2].trim();if(this.rules.other.endingHash.test(A)){let b=Rz(A,"#");if(this.options.pedantic)A=b.trim();else if(!b||this.rules.other.endingSpaceChar.test(b))A=b.trim()}return{type:"heading",raw:z[0],depth:z[1].length,text:A,tokens:this.lexer.inline(A)}}}hr(_){let z=this.rules.block.hr.exec(_);if(z)return{type:"hr",raw:Rz(z[0],`
100
- `)}}blockquote(_){let z=this.rules.block.blockquote.exec(_);if(z){let A=Rz(z[0],`
98
+ `)}var M6=class{options;rules;lexer;constructor(_){this.options=_||R_}space(_){let z=this.rules.block.newline.exec(_);if(z&&z[0].length>0)return{type:"space",raw:z[0]}}code(_){let z=this.rules.block.code.exec(_);if(z){let A=z[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:z[0],codeBlockStyle:"indented",text:!this.options.pedantic?Sz(A,`
99
+ `):A}}}fences(_){let z=this.rules.block.fences.exec(_);if(z){let A=z[0],b=qP(A,z[3]||"",this.rules);return{type:"code",raw:A,lang:z[2]?z[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):z[2],text:b}}}heading(_){let z=this.rules.block.heading.exec(_);if(z){let A=z[2].trim();if(this.rules.other.endingHash.test(A)){let b=Sz(A,"#");if(this.options.pedantic)A=b.trim();else if(!b||this.rules.other.endingSpaceChar.test(b))A=b.trim()}return{type:"heading",raw:z[0],depth:z[1].length,text:A,tokens:this.lexer.inline(A)}}}hr(_){let z=this.rules.block.hr.exec(_);if(z)return{type:"hr",raw:Sz(z[0],`
100
+ `)}}blockquote(_){let z=this.rules.block.blockquote.exec(_);if(z){let A=Sz(z[0],`
101
101
  `).split(`
102
102
  `),b="",G="",J=[];while(A.length>0){let Y=!1,X=[],Q;for(Q=0;Q<A.length;Q++)if(this.rules.other.blockquoteStart.test(A[Q]))X.push(A[Q]),Y=!0;else if(!Y)X.push(A[Q]);else break;A=A.slice(Q);let $=X.join(`
103
103
  `),H=$.replace(this.rules.other.blockquoteSetextReplace,`
@@ -117,7 +117,7 @@ ${H}`:H;let B=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
117
117
  `+Z}if(!F&&!Z.trim())F=!0;$+=D+`
118
118
  `,_=_.substring(D.length+1),B=L.slice(K)}}if(!G.loose){if(Y)G.loose=!0;else if(this.rules.other.doubleBlankLine.test($))Y=!0}let q=null,W;if(this.options.gfm){if(q=this.rules.other.listIsTask.exec(H),q)W=q[0]!=="[ ] ",H=H.replace(this.rules.other.listReplaceTask,"")}G.items.push({type:"list_item",raw:$,task:!!q,checked:W,loose:!1,text:H,tokens:[]}),G.raw+=$}let X=G.items.at(-1);if(X)X.raw=X.raw.trimEnd(),X.text=X.text.trimEnd();else return;G.raw=G.raw.trimEnd();for(let Q=0;Q<G.items.length;Q++)if(this.lexer.state.top=!1,G.items[Q].tokens=this.lexer.blockTokens(G.items[Q].text,[]),!G.loose){let $=G.items[Q].tokens.filter((B)=>B.type==="space"),H=$.length>0&&$.some((B)=>this.rules.other.anyLine.test(B.raw));G.loose=H}if(G.loose)for(let Q=0;Q<G.items.length;Q++)G.items[Q].loose=!0;return G}}html(_){let z=this.rules.block.html.exec(_);if(z)return{type:"html",block:!0,raw:z[0],pre:z[1]==="pre"||z[1]==="script"||z[1]==="style",text:z[0]}}def(_){let z=this.rules.block.def.exec(_);if(z){let A=z[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),b=z[2]?z[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",G=z[3]?z[3].substring(1,z[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):z[3];return{type:"def",tag:A,raw:z[0],href:b,title:G}}}table(_){let z=this.rules.block.table.exec(_);if(!z)return;if(!this.rules.other.tableDelimiter.test(z[2]))return;let A=yX(z[1]),b=z[2].replace(this.rules.other.tableAlignChars,"").split("|"),G=z[3]?.trim()?z[3].replace(this.rules.other.tableRowBlankLine,"").split(`
119
119
  `):[],J={type:"table",raw:z[0],header:[],align:[],rows:[]};if(A.length!==b.length)return;for(let Y of b)if(this.rules.other.tableAlignRight.test(Y))J.align.push("right");else if(this.rules.other.tableAlignCenter.test(Y))J.align.push("center");else if(this.rules.other.tableAlignLeft.test(Y))J.align.push("left");else J.align.push(null);for(let Y=0;Y<A.length;Y++)J.header.push({text:A[Y],tokens:this.lexer.inline(A[Y]),header:!0,align:J.align[Y]});for(let Y of G)J.rows.push(yX(Y,J.header.length).map((X,Q)=>{return{text:X,tokens:this.lexer.inline(X),header:!1,align:J.align[Q]}}));return J}lheading(_){let z=this.rules.block.lheading.exec(_);if(z)return{type:"heading",raw:z[0],depth:z[2].charAt(0)==="="?1:2,text:z[1],tokens:this.lexer.inline(z[1])}}paragraph(_){let z=this.rules.block.paragraph.exec(_);if(z){let A=z[1].charAt(z[1].length-1)===`
120
- `?z[1].slice(0,-1):z[1];return{type:"paragraph",raw:z[0],text:A,tokens:this.lexer.inline(A)}}}text(_){let z=this.rules.block.text.exec(_);if(z)return{type:"text",raw:z[0],text:z[0],tokens:this.lexer.inline(z[0])}}escape(_){let z=this.rules.inline.escape.exec(_);if(z)return{type:"escape",raw:z[0],text:z[1]}}tag(_){let z=this.rules.inline.tag.exec(_);if(z){if(!this.lexer.state.inLink&&this.rules.other.startATag.test(z[0]))this.lexer.state.inLink=!0;else if(this.lexer.state.inLink&&this.rules.other.endATag.test(z[0]))this.lexer.state.inLink=!1;if(!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(z[0]))this.lexer.state.inRawBlock=!0;else if(this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(z[0]))this.lexer.state.inRawBlock=!1;return{type:"html",raw:z[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:z[0]}}}link(_){let z=this.rules.inline.link.exec(_);if(z){let A=z[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(A)){if(!this.rules.other.endAngleBracket.test(A))return;let J=Rz(A.slice(0,-1),"\\");if((A.length-J.length)%2===0)return}else{let J=$P(z[2],"()");if(J===-2)return;if(J>-1){let X=(z[0].indexOf("!")===0?5:4)+z[1].length+J;z[2]=z[2].substring(0,J),z[0]=z[0].substring(0,X).trim(),z[3]=""}}let b=z[2],G="";if(this.options.pedantic){let J=this.rules.other.pedanticHrefTitle.exec(b);if(J)b=J[1],G=J[3]}else G=z[3]?z[3].slice(1,-1):"";if(b=b.trim(),this.rules.other.startAngleBracket.test(b))if(this.options.pedantic&&!this.rules.other.endAngleBracket.test(A))b=b.slice(1);else b=b.slice(1,-1);return gX(z,{href:b?b.replace(this.rules.inline.anyPunctuation,"$1"):b,title:G?G.replace(this.rules.inline.anyPunctuation,"$1"):G},z[0],this.lexer,this.rules)}}reflink(_,z){let A;if((A=this.rules.inline.reflink.exec(_))||(A=this.rules.inline.nolink.exec(_))){let b=(A[2]||A[1]).replace(this.rules.other.multipleSpaceGlobal," "),G=z[b.toLowerCase()];if(!G){let J=A[0].charAt(0);return{type:"text",raw:J,text:J}}return gX(A,G,A[0],this.lexer,this.rules)}}emStrong(_,z,A=""){let b=this.rules.inline.emStrongLDelim.exec(_);if(!b)return;if(b[3]&&A.match(this.rules.other.unicodeAlphaNumeric))return;if(!(b[1]||b[2])||!A||this.rules.inline.punctuation.exec(A)){let J=[...b[0]].length-1,Y,X,Q=J,$=0,H=b[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;H.lastIndex=0,z=z.slice(-1*_.length+J);while((b=H.exec(z))!=null){if(Y=b[1]||b[2]||b[3]||b[4]||b[5]||b[6],!Y)continue;if(X=[...Y].length,b[3]||b[4]){Q+=X;continue}else if(b[5]||b[6]){if(J%3&&!((J+X)%3)){$+=X;continue}}if(Q-=X,Q>0)continue;X=Math.min(X,X+Q+$);let B=[...b[0]][0].length,Z=_.slice(0,J+b.index+B+X);if(Math.min(J,X)%2){let K=Z.slice(1,-1);return{type:"em",raw:Z,text:K,tokens:this.lexer.inlineTokens(K)}}let F=Z.slice(2,-2);return{type:"strong",raw:Z,text:F,tokens:this.lexer.inlineTokens(F)}}}}codespan(_){let z=this.rules.inline.code.exec(_);if(z){let A=z[2].replace(this.rules.other.newLineCharGlobal," "),b=this.rules.other.nonSpaceChar.test(A),G=this.rules.other.startingSpaceChar.test(A)&&this.rules.other.endingSpaceChar.test(A);if(b&&G)A=A.substring(1,A.length-1);return{type:"codespan",raw:z[0],text:A}}}br(_){let z=this.rules.inline.br.exec(_);if(z)return{type:"br",raw:z[0]}}del(_){let z=this.rules.inline.del.exec(_);if(z)return{type:"del",raw:z[0],text:z[2],tokens:this.lexer.inlineTokens(z[2])}}autolink(_){let z=this.rules.inline.autolink.exec(_);if(z){let A,b;if(z[2]==="@")A=z[1],b="mailto:"+A;else A=z[1],b=A;return{type:"link",raw:z[0],text:A,href:b,tokens:[{type:"text",raw:A,text:A}]}}}url(_){let z;if(z=this.rules.inline.url.exec(_)){let A,b;if(z[2]==="@")A=z[0],b="mailto:"+A;else{let G;do G=z[0],z[0]=this.rules.inline._backpedal.exec(z[0])?.[0]??"";while(G!==z[0]);if(A=z[0],z[1]==="www.")b="http://"+z[0];else b=z[0]}return{type:"link",raw:z[0],text:A,href:b,tokens:[{type:"text",raw:A,text:A}]}}}inlineText(_){let z=this.rules.inline.text.exec(_);if(z){let A=this.lexer.state.inRawBlock;return{type:"text",raw:z[0],text:z[0],escaped:A}}}},L4=class _{tokens;options;state;tokenizer;inlineQueue;constructor(z){this.tokens=[],this.tokens.links=Object.create(null),this.options=z||R_,this.options.tokenizer=this.options.tokenizer||new V6,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let A={other:_9,block:K6.normal,inline:jz.normal};if(this.options.pedantic)A.block=K6.pedantic,A.inline=jz.pedantic;else if(this.options.gfm)if(A.block=K6.gfm,this.options.breaks)A.inline=jz.breaks;else A.inline=jz.gfm;this.tokenizer.rules=A}static get rules(){return{block:K6,inline:jz}}static lex(z,A){return new _(A).lex(z)}static lexInline(z,A){return new _(A).inlineTokens(z)}lex(z){z=z.replace(_9.carriageReturn,`
120
+ `?z[1].slice(0,-1):z[1];return{type:"paragraph",raw:z[0],text:A,tokens:this.lexer.inline(A)}}}text(_){let z=this.rules.block.text.exec(_);if(z)return{type:"text",raw:z[0],text:z[0],tokens:this.lexer.inline(z[0])}}escape(_){let z=this.rules.inline.escape.exec(_);if(z)return{type:"escape",raw:z[0],text:z[1]}}tag(_){let z=this.rules.inline.tag.exec(_);if(z){if(!this.lexer.state.inLink&&this.rules.other.startATag.test(z[0]))this.lexer.state.inLink=!0;else if(this.lexer.state.inLink&&this.rules.other.endATag.test(z[0]))this.lexer.state.inLink=!1;if(!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(z[0]))this.lexer.state.inRawBlock=!0;else if(this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(z[0]))this.lexer.state.inRawBlock=!1;return{type:"html",raw:z[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:z[0]}}}link(_){let z=this.rules.inline.link.exec(_);if(z){let A=z[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(A)){if(!this.rules.other.endAngleBracket.test(A))return;let J=Sz(A.slice(0,-1),"\\");if((A.length-J.length)%2===0)return}else{let J=KP(z[2],"()");if(J===-2)return;if(J>-1){let X=(z[0].indexOf("!")===0?5:4)+z[1].length+J;z[2]=z[2].substring(0,J),z[0]=z[0].substring(0,X).trim(),z[3]=""}}let b=z[2],G="";if(this.options.pedantic){let J=this.rules.other.pedanticHrefTitle.exec(b);if(J)b=J[1],G=J[3]}else G=z[3]?z[3].slice(1,-1):"";if(b=b.trim(),this.rules.other.startAngleBracket.test(b))if(this.options.pedantic&&!this.rules.other.endAngleBracket.test(A))b=b.slice(1);else b=b.slice(1,-1);return gX(z,{href:b?b.replace(this.rules.inline.anyPunctuation,"$1"):b,title:G?G.replace(this.rules.inline.anyPunctuation,"$1"):G},z[0],this.lexer,this.rules)}}reflink(_,z){let A;if((A=this.rules.inline.reflink.exec(_))||(A=this.rules.inline.nolink.exec(_))){let b=(A[2]||A[1]).replace(this.rules.other.multipleSpaceGlobal," "),G=z[b.toLowerCase()];if(!G){let J=A[0].charAt(0);return{type:"text",raw:J,text:J}}return gX(A,G,A[0],this.lexer,this.rules)}}emStrong(_,z,A=""){let b=this.rules.inline.emStrongLDelim.exec(_);if(!b)return;if(b[3]&&A.match(this.rules.other.unicodeAlphaNumeric))return;if(!(b[1]||b[2])||!A||this.rules.inline.punctuation.exec(A)){let J=[...b[0]].length-1,Y,X,Q=J,$=0,H=b[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;H.lastIndex=0,z=z.slice(-1*_.length+J);while((b=H.exec(z))!=null){if(Y=b[1]||b[2]||b[3]||b[4]||b[5]||b[6],!Y)continue;if(X=[...Y].length,b[3]||b[4]){Q+=X;continue}else if(b[5]||b[6]){if(J%3&&!((J+X)%3)){$+=X;continue}}if(Q-=X,Q>0)continue;X=Math.min(X,X+Q+$);let B=[...b[0]][0].length,Z=_.slice(0,J+b.index+B+X);if(Math.min(J,X)%2){let K=Z.slice(1,-1);return{type:"em",raw:Z,text:K,tokens:this.lexer.inlineTokens(K)}}let F=Z.slice(2,-2);return{type:"strong",raw:Z,text:F,tokens:this.lexer.inlineTokens(F)}}}}codespan(_){let z=this.rules.inline.code.exec(_);if(z){let A=z[2].replace(this.rules.other.newLineCharGlobal," "),b=this.rules.other.nonSpaceChar.test(A),G=this.rules.other.startingSpaceChar.test(A)&&this.rules.other.endingSpaceChar.test(A);if(b&&G)A=A.substring(1,A.length-1);return{type:"codespan",raw:z[0],text:A}}}br(_){let z=this.rules.inline.br.exec(_);if(z)return{type:"br",raw:z[0]}}del(_){let z=this.rules.inline.del.exec(_);if(z)return{type:"del",raw:z[0],text:z[2],tokens:this.lexer.inlineTokens(z[2])}}autolink(_){let z=this.rules.inline.autolink.exec(_);if(z){let A,b;if(z[2]==="@")A=z[1],b="mailto:"+A;else A=z[1],b=A;return{type:"link",raw:z[0],text:A,href:b,tokens:[{type:"text",raw:A,text:A}]}}}url(_){let z;if(z=this.rules.inline.url.exec(_)){let A,b;if(z[2]==="@")A=z[0],b="mailto:"+A;else{let G;do G=z[0],z[0]=this.rules.inline._backpedal.exec(z[0])?.[0]??"";while(G!==z[0]);if(A=z[0],z[1]==="www.")b="http://"+z[0];else b=z[0]}return{type:"link",raw:z[0],text:A,href:b,tokens:[{type:"text",raw:A,text:A}]}}}inlineText(_){let z=this.rules.inline.text.exec(_);if(z){let A=this.lexer.state.inRawBlock;return{type:"text",raw:z[0],text:z[0],escaped:A}}}},L4=class _{tokens;options;state;tokenizer;inlineQueue;constructor(z){this.tokens=[],this.tokens.links=Object.create(null),this.options=z||R_,this.options.tokenizer=this.options.tokenizer||new M6,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let A={other:_9,block:V6.normal,inline:Pz.normal};if(this.options.pedantic)A.block=V6.pedantic,A.inline=Pz.pedantic;else if(this.options.gfm)if(A.block=V6.gfm,this.options.breaks)A.inline=Pz.breaks;else A.inline=Pz.gfm;this.tokenizer.rules=A}static get rules(){return{block:V6,inline:Pz}}static lex(z,A){return new _(A).lex(z)}static lexInline(z,A){return new _(A).inlineTokens(z)}lex(z){z=z.replace(_9.carriageReturn,`
121
121
  `),this.blockTokens(z,this.tokens);for(let A=0;A<this.inlineQueue.length;A++){let b=this.inlineQueue[A];this.inlineTokens(b.src,b.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(z,A=[],b=!1){if(this.options.pedantic)z=z.replace(_9.tabCharGlobal," ").replace(_9.spaceLine,"");while(z){let G;if(this.options.extensions?.block?.some((Y)=>{if(G=Y.call({lexer:this},z,A))return z=z.substring(G.raw.length),A.push(G),!0;return!1}))continue;if(G=this.tokenizer.space(z)){z=z.substring(G.raw.length);let Y=A.at(-1);if(G.raw.length===1&&Y!==void 0)Y.raw+=`
122
122
  `;else A.push(G);continue}if(G=this.tokenizer.code(z)){z=z.substring(G.raw.length);let Y=A.at(-1);if(Y?.type==="paragraph"||Y?.type==="text")Y.raw+=`
123
123
  `+G.raw,Y.text+=`
@@ -127,7 +127,7 @@ ${H}`:H;let B=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
127
127
  `+G.raw,Y.text+=`
128
128
  `+G.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=Y.text;else A.push(G);b=J.length!==z.length,z=z.substring(G.raw.length);continue}if(G=this.tokenizer.text(z)){z=z.substring(G.raw.length);let Y=A.at(-1);if(Y?.type==="text")Y.raw+=`
129
129
  `+G.raw,Y.text+=`
130
- `+G.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=Y.text;else A.push(G);continue}if(z){let Y="Infinite loop on byte: "+z.charCodeAt(0);if(this.options.silent){console.error(Y);break}else throw Error(Y)}}return this.state.top=!0,A}inline(z,A=[]){return this.inlineQueue.push({src:z,tokens:A}),A}inlineTokens(z,A=[]){let b=z,G=null;if(this.tokens.links){let X=Object.keys(this.tokens.links);if(X.length>0){while((G=this.tokenizer.rules.inline.reflinkSearch.exec(b))!=null)if(X.includes(G[0].slice(G[0].lastIndexOf("[")+1,-1)))b=b.slice(0,G.index)+"["+"a".repeat(G[0].length-2)+"]"+b.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex)}}while((G=this.tokenizer.rules.inline.anyPunctuation.exec(b))!=null)b=b.slice(0,G.index)+"++"+b.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);while((G=this.tokenizer.rules.inline.blockSkip.exec(b))!=null)b=b.slice(0,G.index)+"["+"a".repeat(G[0].length-2)+"]"+b.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let J=!1,Y="";while(z){if(!J)Y="";J=!1;let X;if(this.options.extensions?.inline?.some(($)=>{if(X=$.call({lexer:this},z,A))return z=z.substring(X.raw.length),A.push(X),!0;return!1}))continue;if(X=this.tokenizer.escape(z)){z=z.substring(X.raw.length),A.push(X);continue}if(X=this.tokenizer.tag(z)){z=z.substring(X.raw.length),A.push(X);continue}if(X=this.tokenizer.link(z)){z=z.substring(X.raw.length),A.push(X);continue}if(X=this.tokenizer.reflink(z,this.tokens.links)){z=z.substring(X.raw.length);let $=A.at(-1);if(X.type==="text"&&$?.type==="text")$.raw+=X.raw,$.text+=X.text;else A.push(X);continue}if(X=this.tokenizer.emStrong(z,b,Y)){z=z.substring(X.raw.length),A.push(X);continue}if(X=this.tokenizer.codespan(z)){z=z.substring(X.raw.length),A.push(X);continue}if(X=this.tokenizer.br(z)){z=z.substring(X.raw.length),A.push(X);continue}if(X=this.tokenizer.del(z)){z=z.substring(X.raw.length),A.push(X);continue}if(X=this.tokenizer.autolink(z)){z=z.substring(X.raw.length),A.push(X);continue}if(!this.state.inLink&&(X=this.tokenizer.url(z))){z=z.substring(X.raw.length),A.push(X);continue}let Q=z;if(this.options.extensions?.startInline){let $=1/0,H=z.slice(1),B;if(this.options.extensions.startInline.forEach((Z)=>{if(B=Z.call({lexer:this},H),typeof B==="number"&&B>=0)$=Math.min($,B)}),$<1/0&&$>=0)Q=z.substring(0,$+1)}if(X=this.tokenizer.inlineText(Q)){if(z=z.substring(X.raw.length),X.raw.slice(-1)!=="_")Y=X.raw.slice(-1);J=!0;let $=A.at(-1);if($?.type==="text")$.raw+=X.raw,$.text+=X.text;else A.push(X);continue}if(z){let $="Infinite loop on byte: "+z.charCodeAt(0);if(this.options.silent){console.error($);break}else throw Error($)}}return A}},U6=class{options;parser;constructor(_){this.options=_||R_}space(_){return""}code({text:_,lang:z,escaped:A}){let b=(z||"").match(_9.notSpaceStart)?.[0],G=_.replace(_9.endingNewline,"")+`
130
+ `+G.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=Y.text;else A.push(G);continue}if(z){let Y="Infinite loop on byte: "+z.charCodeAt(0);if(this.options.silent){console.error(Y);break}else throw Error(Y)}}return this.state.top=!0,A}inline(z,A=[]){return this.inlineQueue.push({src:z,tokens:A}),A}inlineTokens(z,A=[]){let b=z,G=null;if(this.tokens.links){let X=Object.keys(this.tokens.links);if(X.length>0){while((G=this.tokenizer.rules.inline.reflinkSearch.exec(b))!=null)if(X.includes(G[0].slice(G[0].lastIndexOf("[")+1,-1)))b=b.slice(0,G.index)+"["+"a".repeat(G[0].length-2)+"]"+b.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex)}}while((G=this.tokenizer.rules.inline.anyPunctuation.exec(b))!=null)b=b.slice(0,G.index)+"++"+b.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);while((G=this.tokenizer.rules.inline.blockSkip.exec(b))!=null)b=b.slice(0,G.index)+"["+"a".repeat(G[0].length-2)+"]"+b.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let J=!1,Y="";while(z){if(!J)Y="";J=!1;let X;if(this.options.extensions?.inline?.some(($)=>{if(X=$.call({lexer:this},z,A))return z=z.substring(X.raw.length),A.push(X),!0;return!1}))continue;if(X=this.tokenizer.escape(z)){z=z.substring(X.raw.length),A.push(X);continue}if(X=this.tokenizer.tag(z)){z=z.substring(X.raw.length),A.push(X);continue}if(X=this.tokenizer.link(z)){z=z.substring(X.raw.length),A.push(X);continue}if(X=this.tokenizer.reflink(z,this.tokens.links)){z=z.substring(X.raw.length);let $=A.at(-1);if(X.type==="text"&&$?.type==="text")$.raw+=X.raw,$.text+=X.text;else A.push(X);continue}if(X=this.tokenizer.emStrong(z,b,Y)){z=z.substring(X.raw.length),A.push(X);continue}if(X=this.tokenizer.codespan(z)){z=z.substring(X.raw.length),A.push(X);continue}if(X=this.tokenizer.br(z)){z=z.substring(X.raw.length),A.push(X);continue}if(X=this.tokenizer.del(z)){z=z.substring(X.raw.length),A.push(X);continue}if(X=this.tokenizer.autolink(z)){z=z.substring(X.raw.length),A.push(X);continue}if(!this.state.inLink&&(X=this.tokenizer.url(z))){z=z.substring(X.raw.length),A.push(X);continue}let Q=z;if(this.options.extensions?.startInline){let $=1/0,H=z.slice(1),B;if(this.options.extensions.startInline.forEach((Z)=>{if(B=Z.call({lexer:this},H),typeof B==="number"&&B>=0)$=Math.min($,B)}),$<1/0&&$>=0)Q=z.substring(0,$+1)}if(X=this.tokenizer.inlineText(Q)){if(z=z.substring(X.raw.length),X.raw.slice(-1)!=="_")Y=X.raw.slice(-1);J=!0;let $=A.at(-1);if($?.type==="text")$.raw+=X.raw,$.text+=X.text;else A.push(X);continue}if(z){let $="Infinite loop on byte: "+z.charCodeAt(0);if(this.options.silent){console.error($);break}else throw Error($)}}return A}},N6=class{options;parser;constructor(_){this.options=_||R_}space(_){return""}code({text:_,lang:z,escaped:A}){let b=(z||"").match(_9.notSpaceStart)?.[0],G=_.replace(_9.endingNewline,"")+`
131
131
  `;if(!b)return"<pre><code>"+(A?G:$4(G,!0))+`</code></pre>
132
132
  `;return'<pre><code class="language-'+$4(b)+'">'+(A?G:$4(G,!0))+`</code></pre>
133
133
  `}blockquote({tokens:_}){return`<blockquote>
@@ -145,28 +145,28 @@ ${this.parser.parse(_)}</blockquote>
145
145
  `}tablerow({text:_}){return`<tr>
146
146
  ${_}</tr>
147
147
  `}tablecell(_){let z=this.parser.parseInline(_.tokens),A=_.header?"th":"td";return(_.align?`<${A} align="${_.align}">`:`<${A}>`)+z+`</${A}>
148
- `}strong({tokens:_}){return`<strong>${this.parser.parseInline(_)}</strong>`}em({tokens:_}){return`<em>${this.parser.parseInline(_)}</em>`}codespan({text:_}){return`<code>${$4(_,!0)}</code>`}br(_){return"<br>"}del({tokens:_}){return`<del>${this.parser.parseInline(_)}</del>`}link({href:_,title:z,tokens:A}){let b=this.parser.parseInline(A),G=vX(_);if(G===null)return b;_=G;let J='<a href="'+_+'"';if(z)J+=' title="'+$4(z)+'"';return J+=">"+b+"</a>",J}image({href:_,title:z,text:A,tokens:b}){if(b)A=this.parser.parseInline(b,this.parser.textRenderer);let G=vX(_);if(G===null)return $4(A);_=G;let J=`<img src="${_}" alt="${A}"`;if(z)J+=` title="${$4(z)}"`;return J+=">",J}text(_){return"tokens"in _&&_.tokens?this.parser.parseInline(_.tokens):("escaped"in _)&&_.escaped?_.text:$4(_.text)}},i5=class{strong({text:_}){return _}em({text:_}){return _}codespan({text:_}){return _}del({text:_}){return _}html({text:_}){return _}text({text:_}){return _}link({text:_}){return""+_}image({text:_}){return""+_}br(){return""}},j4=class _{options;renderer;textRenderer;constructor(z){this.options=z||R_,this.options.renderer=this.options.renderer||new U6,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new i5}static parse(z,A){return new _(A).parse(z)}static parseInline(z,A){return new _(A).parseInline(z)}parse(z,A=!0){let b="";for(let G=0;G<z.length;G++){let J=z[G];if(this.options.extensions?.renderers?.[J.type]){let X=J,Q=this.options.extensions.renderers[X.type].call({parser:this},X);if(Q!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(X.type)){b+=Q||"";continue}}let Y=J;switch(Y.type){case"space":{b+=this.renderer.space(Y);continue}case"hr":{b+=this.renderer.hr(Y);continue}case"heading":{b+=this.renderer.heading(Y);continue}case"code":{b+=this.renderer.code(Y);continue}case"table":{b+=this.renderer.table(Y);continue}case"blockquote":{b+=this.renderer.blockquote(Y);continue}case"list":{b+=this.renderer.list(Y);continue}case"html":{b+=this.renderer.html(Y);continue}case"paragraph":{b+=this.renderer.paragraph(Y);continue}case"text":{let X=Y,Q=this.renderer.text(X);while(G+1<z.length&&z[G+1].type==="text")X=z[++G],Q+=`
149
- `+this.renderer.text(X);if(A)b+=this.renderer.paragraph({type:"paragraph",raw:Q,text:Q,tokens:[{type:"text",raw:Q,text:Q,escaped:!0}]});else b+=Q;continue}default:{let X='Token with "'+Y.type+'" type was not found.';if(this.options.silent)return console.error(X),"";else throw Error(X)}}}return b}parseInline(z,A=this.renderer){let b="";for(let G=0;G<z.length;G++){let J=z[G];if(this.options.extensions?.renderers?.[J.type]){let X=this.options.extensions.renderers[J.type].call({parser:this},J);if(X!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(J.type)){b+=X||"";continue}}let Y=J;switch(Y.type){case"escape":{b+=A.text(Y);break}case"html":{b+=A.html(Y);break}case"link":{b+=A.link(Y);break}case"image":{b+=A.image(Y);break}case"strong":{b+=A.strong(Y);break}case"em":{b+=A.em(Y);break}case"codespan":{b+=A.codespan(Y);break}case"br":{b+=A.br(Y);break}case"del":{b+=A.del(Y);break}case"text":{b+=A.text(Y);break}default:{let X='Token with "'+Y.type+'" type was not found.';if(this.options.silent)return console.error(X),"";else throw Error(X)}}}return b}},q6=class{options;block;constructor(_){this.options=_||R_}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(_){return _}postprocess(_){return _}processAllTokens(_){return _}provideLexer(){return this.block?L4.lex:L4.lexInline}provideParser(){return this.block?j4.parse:j4.parseInline}},BP=class{defaults=m5();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=j4;Renderer=U6;TextRenderer=i5;Lexer=L4;Tokenizer=V6;Hooks=q6;constructor(..._){this.use(..._)}walkTokens(_,z){let A=[];for(let b of _)switch(A=A.concat(z.call(this,b)),b.type){case"table":{let G=b;for(let J of G.header)A=A.concat(this.walkTokens(J.tokens,z));for(let J of G.rows)for(let Y of J)A=A.concat(this.walkTokens(Y.tokens,z));break}case"list":{let G=b;A=A.concat(this.walkTokens(G.items,z));break}default:{let G=b;if(this.defaults.extensions?.childTokens?.[G.type])this.defaults.extensions.childTokens[G.type].forEach((J)=>{let Y=G[J].flat(1/0);A=A.concat(this.walkTokens(Y,z))});else if(G.tokens)A=A.concat(this.walkTokens(G.tokens,z))}}return A}use(..._){let z=this.defaults.extensions||{renderers:{},childTokens:{}};return _.forEach((A)=>{let b={...A};if(b.async=this.defaults.async||b.async||!1,A.extensions)A.extensions.forEach((G)=>{if(!G.name)throw Error("extension name required");if("renderer"in G){let J=z.renderers[G.name];if(J)z.renderers[G.name]=function(...Y){let X=G.renderer.apply(this,Y);if(X===!1)X=J.apply(this,Y);return X};else z.renderers[G.name]=G.renderer}if("tokenizer"in G){if(!G.level||G.level!=="block"&&G.level!=="inline")throw Error("extension level must be 'block' or 'inline'");let J=z[G.level];if(J)J.unshift(G.tokenizer);else z[G.level]=[G.tokenizer];if(G.start){if(G.level==="block")if(z.startBlock)z.startBlock.push(G.start);else z.startBlock=[G.start];else if(G.level==="inline")if(z.startInline)z.startInline.push(G.start);else z.startInline=[G.start]}}if("childTokens"in G&&G.childTokens)z.childTokens[G.name]=G.childTokens}),b.extensions=z;if(A.renderer){let G=this.defaults.renderer||new U6(this.defaults);for(let J in A.renderer){if(!(J in G))throw Error(`renderer '${J}' does not exist`);if(["options","parser"].includes(J))continue;let Y=J,X=A.renderer[Y],Q=G[Y];G[Y]=(...$)=>{let H=X.apply(G,$);if(H===!1)H=Q.apply(G,$);return H||""}}b.renderer=G}if(A.tokenizer){let G=this.defaults.tokenizer||new V6(this.defaults);for(let J in A.tokenizer){if(!(J in G))throw Error(`tokenizer '${J}' does not exist`);if(["options","rules","lexer"].includes(J))continue;let Y=J,X=A.tokenizer[Y],Q=G[Y];G[Y]=(...$)=>{let H=X.apply(G,$);if(H===!1)H=Q.apply(G,$);return H}}b.tokenizer=G}if(A.hooks){let G=this.defaults.hooks||new q6;for(let J in A.hooks){if(!(J in G))throw Error(`hook '${J}' does not exist`);if(["options","block"].includes(J))continue;let Y=J,X=A.hooks[Y],Q=G[Y];if(q6.passThroughHooks.has(J))G[Y]=($)=>{if(this.defaults.async)return Promise.resolve(X.call(G,$)).then((B)=>{return Q.call(G,B)});let H=X.call(G,$);return Q.call(G,H)};else G[Y]=(...$)=>{let H=X.apply(G,$);if(H===!1)H=Q.apply(G,$);return H}}b.hooks=G}if(A.walkTokens){let G=this.defaults.walkTokens,J=A.walkTokens;b.walkTokens=function(Y){let X=[];if(X.push(J.call(this,Y)),G)X=X.concat(G.call(this,Y));return X}}this.defaults={...this.defaults,...b}}),this}setOptions(_){return this.defaults={...this.defaults,..._},this}lexer(_,z){return L4.lex(_,z??this.defaults)}parser(_,z){return j4.parse(_,z??this.defaults)}parseMarkdown(_){return(A,b)=>{let G={...b},J={...this.defaults,...G},Y=this.onError(!!J.silent,!!J.async);if(this.defaults.async===!0&&G.async===!1)return Y(Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof A>"u"||A===null)return Y(Error("marked(): input parameter is undefined or null"));if(typeof A!=="string")return Y(Error("marked(): input parameter is of type "+Object.prototype.toString.call(A)+", string expected"));if(J.hooks)J.hooks.options=J,J.hooks.block=_;let X=J.hooks?J.hooks.provideLexer():_?L4.lex:L4.lexInline,Q=J.hooks?J.hooks.provideParser():_?j4.parse:j4.parseInline;if(J.async)return Promise.resolve(J.hooks?J.hooks.preprocess(A):A).then(($)=>X($,J)).then(($)=>J.hooks?J.hooks.processAllTokens($):$).then(($)=>J.walkTokens?Promise.all(this.walkTokens($,J.walkTokens)).then(()=>$):$).then(($)=>Q($,J)).then(($)=>J.hooks?J.hooks.postprocess($):$).catch(Y);try{if(J.hooks)A=J.hooks.preprocess(A);let $=X(A,J);if(J.hooks)$=J.hooks.processAllTokens($);if(J.walkTokens)this.walkTokens($,J.walkTokens);let H=Q($,J);if(J.hooks)H=J.hooks.postprocess(H);return H}catch($){return Y($)}}}onError(_,z){return(A)=>{if(A.message+=`
150
- Please report this to https://github.com/markedjs/marked.`,_){let b="<p>An error occurred:</p><pre>"+$4(A.message+"",!0)+"</pre>";if(z)return Promise.resolve(b);return b}if(z)return Promise.reject(A);throw A}}},j_=new BP;function K0(_,z){return j_.parse(_,z)}K0.options=K0.setOptions=function(_){return j_.setOptions(_),K0.defaults=j_.defaults,fX(K0.defaults),K0};K0.getDefaults=m5;K0.defaults=R_;K0.use=function(..._){return j_.use(..._),K0.defaults=j_.defaults,fX(K0.defaults),K0};K0.walkTokens=function(_,z){return j_.walkTokens(_,z)};K0.parseInline=j_.parseInline;K0.Parser=j4;K0.parser=j4.parse;K0.Renderer=U6;K0.TextRenderer=i5;K0.Lexer=L4;K0.lexer=L4.lex;K0.Tokenizer=V6;K0.Hooks=q6;K0.parse=K0;var{options:Za,setOptions:Fa,use:Ka,walkTokens:qa,parseInline:Wa}=K0;var Va=j4.parse,Ua=L4.lex;import{EventEmitter as FP}from"events";var R4="\x1B",oX="\x1B[200~",N6="\x1B[201~";function KP(_){if(!_.startsWith(R4))return"not-escape";if(_.length===1)return"incomplete";let z=_.slice(1);if(z.startsWith("[")){if(z.startsWith("[M"))return _.length>=6?"complete":"incomplete";return qP(_)}if(z.startsWith("]"))return WP(_);if(z.startsWith("P"))return VP(_);if(z.startsWith("_"))return UP(_);if(z.startsWith("O"))return z.length>=2?"complete":"incomplete";if(z.length===1)return"complete";return"complete"}function qP(_){if(!_.startsWith(`${R4}[`))return"complete";if(_.length<3)return"incomplete";let z=_.slice(2),A=z[z.length-1],b=A.charCodeAt(0);if(b>=64&&b<=126){if(z.startsWith("<")){if(/^<\d+;\d+;\d+[Mm]$/.test(z))return"complete";if(A==="M"||A==="m"){let J=z.slice(1,-1).split(";");if(J.length===3&&J.every((Y)=>/^\d+$/.test(Y)))return"complete"}return"incomplete"}return"complete"}return"incomplete"}function WP(_){if(!_.startsWith(`${R4}]`))return"complete";if(_.endsWith(`${R4}\\`)||_.endsWith("\x07"))return"complete";return"incomplete"}function VP(_){if(!_.startsWith(`${R4}P`))return"complete";if(_.endsWith(`${R4}\\`))return"complete";return"incomplete"}function UP(_){if(!_.startsWith(`${R4}_`))return"complete";if(_.endsWith(`${R4}\\`))return"complete";return"incomplete"}function aX(_){let z=[],A=0;while(A<_.length){let b=_.slice(A);if(b.startsWith(R4)){let G=1;while(G<=b.length){let J=b.slice(0,G),Y=KP(J);if(Y==="complete"){z.push(J),A+=G;break}else if(Y==="incomplete")G++;else{z.push(J),A+=G;break}}if(G>b.length)return{sequences:z,remainder:b}}else z.push(b[0]),A++}return{sequences:z,remainder:""}}class w6 extends FP{buffer="";timeout=null;timeoutMs;pasteMode=!1;pasteBuffer="";constructor(_={}){super();this.timeoutMs=_.timeout??10}process(_){if(this.timeout)clearTimeout(this.timeout),this.timeout=null;let z;if(Buffer.isBuffer(_))if(_.length===1&&_[0]>127){let G=_[0]-128;z=`\x1B${String.fromCharCode(G)}`}else z=_.toString();else z=_;if(z.length===0&&this.buffer.length===0){this.emit("data","");return}if(this.buffer+=z,this.pasteMode){this.pasteBuffer+=this.buffer,this.buffer="";let G=this.pasteBuffer.indexOf(N6);if(G!==-1){let J=this.pasteBuffer.slice(0,G),Y=this.pasteBuffer.slice(G+N6.length);if(this.pasteMode=!1,this.pasteBuffer="",this.emit("paste",J),Y.length>0)this.process(Y)}return}let A=this.buffer.indexOf(oX);if(A!==-1){if(A>0){let J=this.buffer.slice(0,A),Y=aX(J);for(let X of Y.sequences)this.emit("data",X)}this.buffer=this.buffer.slice(A+oX.length),this.pasteMode=!0,this.pasteBuffer=this.buffer,this.buffer="";let G=this.pasteBuffer.indexOf(N6);if(G!==-1){let J=this.pasteBuffer.slice(0,G),Y=this.pasteBuffer.slice(G+N6.length);if(this.pasteMode=!1,this.pasteBuffer="",this.emit("paste",J),Y.length>0)this.process(Y)}return}let b=aX(this.buffer);this.buffer=b.remainder;for(let G of b.sequences)this.emit("data",G);if(this.buffer.length>0)this.timeout=setTimeout(()=>{let G=this.flush();for(let J of G)this.emit("data",J)},this.timeoutMs)}flush(){if(this.timeout)clearTimeout(this.timeout),this.timeout=null;if(this.buffer.length===0)return[];let _=[this.buffer];return this.buffer="",_}clear(){if(this.timeout)clearTimeout(this.timeout),this.timeout=null;this.buffer="",this.pasteMode=!1,this.pasteBuffer=""}getBuffer(){return this.buffer}destroy(){this.clear()}}import*as sX from"node:fs";class E6{wasRaw=!1;inputHandler;resizeHandler;_kittyProtocolActive=!1;stdinBuffer;stdinDataHandler;writeLogPath=process.env.PI_TUI_WRITE_LOG||"";get kittyProtocolActive(){return this._kittyProtocolActive}start(_,z){if(this.inputHandler=_,this.resizeHandler=z,this.wasRaw=process.stdin.isRaw||!1,process.stdin.setRawMode)process.stdin.setRawMode(!0);if(process.stdin.setEncoding("utf8"),process.stdin.resume(),process.stdout.write("\x1B[?2004h"),process.stdout.on("resize",this.resizeHandler),process.platform!=="win32")process.kill(process.pid,"SIGWINCH");this.queryAndEnableKittyProtocol()}setupStdinBuffer(){this.stdinBuffer=new w6({timeout:10});let _=/^\x1b\[\?(\d+)u$/;this.stdinBuffer.on("data",(z)=>{if(!this._kittyProtocolActive){if(z.match(_)){this._kittyProtocolActive=!0,B6(!0),process.stdout.write("\x1B[>7u");return}}if(this.inputHandler)this.inputHandler(z)}),this.stdinBuffer.on("paste",(z)=>{if(this.inputHandler)this.inputHandler(`\x1B[200~${z}\x1B[201~`)}),this.stdinDataHandler=(z)=>{this.stdinBuffer.process(z)}}queryAndEnableKittyProtocol(){this.setupStdinBuffer(),process.stdin.on("data",this.stdinDataHandler),process.stdout.write("\x1B[?u")}stop(){if(process.stdout.write("\x1B[?2004l"),this._kittyProtocolActive)process.stdout.write("\x1B[<u"),this._kittyProtocolActive=!1,B6(!1);if(this.stdinBuffer)this.stdinBuffer.destroy(),this.stdinBuffer=void 0;if(this.stdinDataHandler)process.stdin.removeListener("data",this.stdinDataHandler),this.stdinDataHandler=void 0;if(this.inputHandler=void 0,this.resizeHandler)process.stdout.removeListener("resize",this.resizeHandler),this.resizeHandler=void 0;if(process.stdin.setRawMode)process.stdin.setRawMode(this.wasRaw)}write(_){if(process.stdout.write(_),this.writeLogPath)try{sX.appendFileSync(this.writeLogPath,_,{encoding:"utf8"})}catch{}}get columns(){return process.stdout.columns||80}get rows(){return process.stdout.rows||24}moveBy(_){if(_>0)process.stdout.write(`\x1B[${_}B`);else if(_<0)process.stdout.write(`\x1B[${-_}A`)}hideCursor(){process.stdout.write("\x1B[?25l")}showCursor(){process.stdout.write("\x1B[?25h")}clearLine(){process.stdout.write("\x1B[K")}clearFromCursor(){process.stdout.write("\x1B[J")}clearScreen(){process.stdout.write("\x1B[2J\x1B[H")}setTitle(_){process.stdout.write(`\x1B]0;${_}\x07`)}}var tX=(_=0)=>(z)=>`\x1B[${z+_}m`,eX=(_=0)=>(z)=>`\x1B[${38+_};5;${z}m`,_Q=(_=0)=>(z,A,b)=>`\x1B[${38+_};2;${z};${A};${b}m`,E0={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]}},ys=Object.keys(E0.modifier),DP=Object.keys(E0.color),MP=Object.keys(E0.bgColor),gs=[...DP,...MP];function NP(){let _=new Map;for(let[z,A]of Object.entries(E0)){for(let[b,G]of Object.entries(A))E0[b]={open:`\x1B[${G[0]}m`,close:`\x1B[${G[1]}m`},A[b]=E0[b],_.set(G[0],G[1]);Object.defineProperty(E0,z,{value:A,enumerable:!1})}return Object.defineProperty(E0,"codes",{value:_,enumerable:!1}),E0.color.close="\x1B[39m",E0.bgColor.close="\x1B[49m",E0.color.ansi=tX(),E0.color.ansi256=eX(),E0.color.ansi16m=_Q(),E0.bgColor.ansi=tX(10),E0.bgColor.ansi256=eX(10),E0.bgColor.ansi16m=_Q(10),Object.defineProperties(E0,{rgbToAnsi256:{value(z,A,b){if(z===A&&A===b){if(z<8)return 16;if(z>248)return 231;return Math.round((z-8)/247*24)+232}return 16+36*Math.round(z/255*5)+6*Math.round(A/255*5)+Math.round(b/255*5)},enumerable:!1},hexToRgb:{value(z){let A=/[a-f\d]{6}|[a-f\d]{3}/i.exec(z.toString(16));if(!A)return[0,0,0];let[b]=A;if(b.length===3)b=[...b].map((J)=>J+J).join("");let G=Number.parseInt(b,16);return[G>>16&255,G>>8&255,G&255]},enumerable:!1},hexToAnsi256:{value:(z)=>E0.rgbToAnsi256(...E0.hexToRgb(z)),enumerable:!1},ansi256ToAnsi:{value(z){if(z<8)return 30+z;if(z<16)return 90+(z-8);let A,b,G;if(z>=232)A=((z-232)*10+8)/255,b=A,G=A;else{z-=16;let X=z%36;A=Math.floor(z/36)/5,b=Math.floor(X/6)/5,G=X%6/5}let J=Math.max(A,b,G)*2;if(J===0)return 30;let Y=30+(Math.round(G)<<2|Math.round(b)<<1|Math.round(A));if(J===2)Y+=60;return Y},enumerable:!1},rgbToAnsi:{value:(z,A,b)=>E0.ansi256ToAnsi(E0.rgbToAnsi256(z,A,b)),enumerable:!1},hexToAnsi:{value:(z)=>E0.ansi256ToAnsi(E0.hexToAnsi256(z)),enumerable:!1}}),E0}var wP=NP(),m9=wP;import o5 from"node:process";import EP from"node:os";import zQ from"node:tty";function w9(_,z=globalThis.Deno?globalThis.Deno.args:o5.argv){let A=_.startsWith("-")?"":_.length===1?"-":"--",b=z.indexOf(A+_),G=z.indexOf("--");return b!==-1&&(G===-1||b<G)}var{env:O0}=o5,O6;if(w9("no-color")||w9("no-colors")||w9("color=false")||w9("color=never"))O6=0;else if(w9("color")||w9("colors")||w9("color=true")||w9("color=always"))O6=1;function OP(){if("FORCE_COLOR"in O0){if(O0.FORCE_COLOR==="true")return 1;if(O0.FORCE_COLOR==="false")return 0;return O0.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(O0.FORCE_COLOR,10),3)}}function LP(_){if(_===0)return!1;return{level:_,hasBasic:!0,has256:_>=2,has16m:_>=3}}function jP(_,{streamIsTTY:z,sniffFlags:A=!0}={}){let b=OP();if(b!==void 0)O6=b;let G=A?O6:b;if(G===0)return 0;if(A){if(w9("color=16m")||w9("color=full")||w9("color=truecolor"))return 3;if(w9("color=256"))return 2}if("TF_BUILD"in O0&&"AGENT_NAME"in O0)return 1;if(_&&!z&&G===void 0)return 0;let J=G||0;if(O0.TERM==="dumb")return J;if(o5.platform==="win32"){let Y=EP.release().split(".");if(Number(Y[0])>=10&&Number(Y[2])>=10586)return Number(Y[2])>=14931?3:2;return 1}if("CI"in O0){if(["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some((Y)=>(Y in O0)))return 3;if(["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some((Y)=>(Y in O0))||O0.CI_NAME==="codeship")return 1;return J}if("TEAMCITY_VERSION"in O0)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(O0.TEAMCITY_VERSION)?1:0;if(O0.COLORTERM==="truecolor")return 3;if(O0.TERM==="xterm-kitty")return 3;if(O0.TERM==="xterm-ghostty")return 3;if(O0.TERM==="wezterm")return 3;if("TERM_PROGRAM"in O0){let Y=Number.parseInt((O0.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(O0.TERM_PROGRAM){case"iTerm.app":return Y>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(O0.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(O0.TERM))return 1;if("COLORTERM"in O0)return 1;return J}function AQ(_,z={}){let A=jP(_,{streamIsTTY:_&&_.isTTY,...z});return LP(A)}var RP={stdout:AQ({isTTY:zQ.isatty(1)}),stderr:AQ({isTTY:zQ.isatty(2)})},bQ=RP;function GQ(_,z,A){let b=_.indexOf(z);if(b===-1)return _;let G=z.length,J=0,Y="";do Y+=_.slice(J,b)+z+A,J=b+G,b=_.indexOf(z,J);while(b!==-1);return Y+=_.slice(J),Y}function JQ(_,z,A,b){let G=0,J="";do{let Y=_[b-1]==="\r";J+=_.slice(G,Y?b-1:b)+z+(Y?`\r
148
+ `}strong({tokens:_}){return`<strong>${this.parser.parseInline(_)}</strong>`}em({tokens:_}){return`<em>${this.parser.parseInline(_)}</em>`}codespan({text:_}){return`<code>${$4(_,!0)}</code>`}br(_){return"<br>"}del({tokens:_}){return`<del>${this.parser.parseInline(_)}</del>`}link({href:_,title:z,tokens:A}){let b=this.parser.parseInline(A),G=vX(_);if(G===null)return b;_=G;let J='<a href="'+_+'"';if(z)J+=' title="'+$4(z)+'"';return J+=">"+b+"</a>",J}image({href:_,title:z,text:A,tokens:b}){if(b)A=this.parser.parseInline(b,this.parser.textRenderer);let G=vX(_);if(G===null)return $4(A);_=G;let J=`<img src="${_}" alt="${A}"`;if(z)J+=` title="${$4(z)}"`;return J+=">",J}text(_){return"tokens"in _&&_.tokens?this.parser.parseInline(_.tokens):("escaped"in _)&&_.escaped?_.text:$4(_.text)}},a5=class{strong({text:_}){return _}em({text:_}){return _}codespan({text:_}){return _}del({text:_}){return _}html({text:_}){return _}text({text:_}){return _}link({text:_}){return""+_}image({text:_}){return""+_}br(){return""}},j4=class _{options;renderer;textRenderer;constructor(z){this.options=z||R_,this.options.renderer=this.options.renderer||new N6,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new a5}static parse(z,A){return new _(A).parse(z)}static parseInline(z,A){return new _(A).parseInline(z)}parse(z,A=!0){let b="";for(let G=0;G<z.length;G++){let J=z[G];if(this.options.extensions?.renderers?.[J.type]){let X=J,Q=this.options.extensions.renderers[X.type].call({parser:this},X);if(Q!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(X.type)){b+=Q||"";continue}}let Y=J;switch(Y.type){case"space":{b+=this.renderer.space(Y);continue}case"hr":{b+=this.renderer.hr(Y);continue}case"heading":{b+=this.renderer.heading(Y);continue}case"code":{b+=this.renderer.code(Y);continue}case"table":{b+=this.renderer.table(Y);continue}case"blockquote":{b+=this.renderer.blockquote(Y);continue}case"list":{b+=this.renderer.list(Y);continue}case"html":{b+=this.renderer.html(Y);continue}case"paragraph":{b+=this.renderer.paragraph(Y);continue}case"text":{let X=Y,Q=this.renderer.text(X);while(G+1<z.length&&z[G+1].type==="text")X=z[++G],Q+=`
149
+ `+this.renderer.text(X);if(A)b+=this.renderer.paragraph({type:"paragraph",raw:Q,text:Q,tokens:[{type:"text",raw:Q,text:Q,escaped:!0}]});else b+=Q;continue}default:{let X='Token with "'+Y.type+'" type was not found.';if(this.options.silent)return console.error(X),"";else throw Error(X)}}}return b}parseInline(z,A=this.renderer){let b="";for(let G=0;G<z.length;G++){let J=z[G];if(this.options.extensions?.renderers?.[J.type]){let X=this.options.extensions.renderers[J.type].call({parser:this},J);if(X!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(J.type)){b+=X||"";continue}}let Y=J;switch(Y.type){case"escape":{b+=A.text(Y);break}case"html":{b+=A.html(Y);break}case"link":{b+=A.link(Y);break}case"image":{b+=A.image(Y);break}case"strong":{b+=A.strong(Y);break}case"em":{b+=A.em(Y);break}case"codespan":{b+=A.codespan(Y);break}case"br":{b+=A.br(Y);break}case"del":{b+=A.del(Y);break}case"text":{b+=A.text(Y);break}default:{let X='Token with "'+Y.type+'" type was not found.';if(this.options.silent)return console.error(X),"";else throw Error(X)}}}return b}},U6=class{options;block;constructor(_){this.options=_||R_}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(_){return _}postprocess(_){return _}processAllTokens(_){return _}provideLexer(){return this.block?L4.lex:L4.lexInline}provideParser(){return this.block?j4.parse:j4.parseInline}},WP=class{defaults=c5();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=j4;Renderer=N6;TextRenderer=a5;Lexer=L4;Tokenizer=M6;Hooks=U6;constructor(..._){this.use(..._)}walkTokens(_,z){let A=[];for(let b of _)switch(A=A.concat(z.call(this,b)),b.type){case"table":{let G=b;for(let J of G.header)A=A.concat(this.walkTokens(J.tokens,z));for(let J of G.rows)for(let Y of J)A=A.concat(this.walkTokens(Y.tokens,z));break}case"list":{let G=b;A=A.concat(this.walkTokens(G.items,z));break}default:{let G=b;if(this.defaults.extensions?.childTokens?.[G.type])this.defaults.extensions.childTokens[G.type].forEach((J)=>{let Y=G[J].flat(1/0);A=A.concat(this.walkTokens(Y,z))});else if(G.tokens)A=A.concat(this.walkTokens(G.tokens,z))}}return A}use(..._){let z=this.defaults.extensions||{renderers:{},childTokens:{}};return _.forEach((A)=>{let b={...A};if(b.async=this.defaults.async||b.async||!1,A.extensions)A.extensions.forEach((G)=>{if(!G.name)throw Error("extension name required");if("renderer"in G){let J=z.renderers[G.name];if(J)z.renderers[G.name]=function(...Y){let X=G.renderer.apply(this,Y);if(X===!1)X=J.apply(this,Y);return X};else z.renderers[G.name]=G.renderer}if("tokenizer"in G){if(!G.level||G.level!=="block"&&G.level!=="inline")throw Error("extension level must be 'block' or 'inline'");let J=z[G.level];if(J)J.unshift(G.tokenizer);else z[G.level]=[G.tokenizer];if(G.start){if(G.level==="block")if(z.startBlock)z.startBlock.push(G.start);else z.startBlock=[G.start];else if(G.level==="inline")if(z.startInline)z.startInline.push(G.start);else z.startInline=[G.start]}}if("childTokens"in G&&G.childTokens)z.childTokens[G.name]=G.childTokens}),b.extensions=z;if(A.renderer){let G=this.defaults.renderer||new N6(this.defaults);for(let J in A.renderer){if(!(J in G))throw Error(`renderer '${J}' does not exist`);if(["options","parser"].includes(J))continue;let Y=J,X=A.renderer[Y],Q=G[Y];G[Y]=(...$)=>{let H=X.apply(G,$);if(H===!1)H=Q.apply(G,$);return H||""}}b.renderer=G}if(A.tokenizer){let G=this.defaults.tokenizer||new M6(this.defaults);for(let J in A.tokenizer){if(!(J in G))throw Error(`tokenizer '${J}' does not exist`);if(["options","rules","lexer"].includes(J))continue;let Y=J,X=A.tokenizer[Y],Q=G[Y];G[Y]=(...$)=>{let H=X.apply(G,$);if(H===!1)H=Q.apply(G,$);return H}}b.tokenizer=G}if(A.hooks){let G=this.defaults.hooks||new U6;for(let J in A.hooks){if(!(J in G))throw Error(`hook '${J}' does not exist`);if(["options","block"].includes(J))continue;let Y=J,X=A.hooks[Y],Q=G[Y];if(U6.passThroughHooks.has(J))G[Y]=($)=>{if(this.defaults.async)return Promise.resolve(X.call(G,$)).then((B)=>{return Q.call(G,B)});let H=X.call(G,$);return Q.call(G,H)};else G[Y]=(...$)=>{let H=X.apply(G,$);if(H===!1)H=Q.apply(G,$);return H}}b.hooks=G}if(A.walkTokens){let G=this.defaults.walkTokens,J=A.walkTokens;b.walkTokens=function(Y){let X=[];if(X.push(J.call(this,Y)),G)X=X.concat(G.call(this,Y));return X}}this.defaults={...this.defaults,...b}}),this}setOptions(_){return this.defaults={...this.defaults,..._},this}lexer(_,z){return L4.lex(_,z??this.defaults)}parser(_,z){return j4.parse(_,z??this.defaults)}parseMarkdown(_){return(A,b)=>{let G={...b},J={...this.defaults,...G},Y=this.onError(!!J.silent,!!J.async);if(this.defaults.async===!0&&G.async===!1)return Y(Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof A>"u"||A===null)return Y(Error("marked(): input parameter is undefined or null"));if(typeof A!=="string")return Y(Error("marked(): input parameter is of type "+Object.prototype.toString.call(A)+", string expected"));if(J.hooks)J.hooks.options=J,J.hooks.block=_;let X=J.hooks?J.hooks.provideLexer():_?L4.lex:L4.lexInline,Q=J.hooks?J.hooks.provideParser():_?j4.parse:j4.parseInline;if(J.async)return Promise.resolve(J.hooks?J.hooks.preprocess(A):A).then(($)=>X($,J)).then(($)=>J.hooks?J.hooks.processAllTokens($):$).then(($)=>J.walkTokens?Promise.all(this.walkTokens($,J.walkTokens)).then(()=>$):$).then(($)=>Q($,J)).then(($)=>J.hooks?J.hooks.postprocess($):$).catch(Y);try{if(J.hooks)A=J.hooks.preprocess(A);let $=X(A,J);if(J.hooks)$=J.hooks.processAllTokens($);if(J.walkTokens)this.walkTokens($,J.walkTokens);let H=Q($,J);if(J.hooks)H=J.hooks.postprocess(H);return H}catch($){return Y($)}}}onError(_,z){return(A)=>{if(A.message+=`
150
+ Please report this to https://github.com/markedjs/marked.`,_){let b="<p>An error occurred:</p><pre>"+$4(A.message+"",!0)+"</pre>";if(z)return Promise.resolve(b);return b}if(z)return Promise.reject(A);throw A}}},j_=new WP;function K0(_,z){return j_.parse(_,z)}K0.options=K0.setOptions=function(_){return j_.setOptions(_),K0.defaults=j_.defaults,fX(K0.defaults),K0};K0.getDefaults=c5;K0.defaults=R_;K0.use=function(..._){return j_.use(..._),K0.defaults=j_.defaults,fX(K0.defaults),K0};K0.walkTokens=function(_,z){return j_.walkTokens(_,z)};K0.parseInline=j_.parseInline;K0.Parser=j4;K0.parser=j4.parse;K0.Renderer=N6;K0.TextRenderer=a5;K0.Lexer=L4;K0.lexer=L4.lex;K0.Tokenizer=M6;K0.Hooks=U6;K0.parse=K0;var{options:wa,setOptions:Ea,use:Oa,walkTokens:La,parseInline:ja}=K0;var Ra=j4.parse,Pa=L4.lex;import{EventEmitter as UP}from"events";var R4="\x1B",oX="\x1B[200~",O6="\x1B[201~";function DP(_){if(!_.startsWith(R4))return"not-escape";if(_.length===1)return"incomplete";let z=_.slice(1);if(z.startsWith("[")){if(z.startsWith("[M"))return _.length>=6?"complete":"incomplete";return MP(_)}if(z.startsWith("]"))return NP(_);if(z.startsWith("P"))return wP(_);if(z.startsWith("_"))return EP(_);if(z.startsWith("O"))return z.length>=2?"complete":"incomplete";if(z.length===1)return"complete";return"complete"}function MP(_){if(!_.startsWith(`${R4}[`))return"complete";if(_.length<3)return"incomplete";let z=_.slice(2),A=z[z.length-1],b=A.charCodeAt(0);if(b>=64&&b<=126){if(z.startsWith("<")){if(/^<\d+;\d+;\d+[Mm]$/.test(z))return"complete";if(A==="M"||A==="m"){let J=z.slice(1,-1).split(";");if(J.length===3&&J.every((Y)=>/^\d+$/.test(Y)))return"complete"}return"incomplete"}return"complete"}return"incomplete"}function NP(_){if(!_.startsWith(`${R4}]`))return"complete";if(_.endsWith(`${R4}\\`)||_.endsWith("\x07"))return"complete";return"incomplete"}function wP(_){if(!_.startsWith(`${R4}P`))return"complete";if(_.endsWith(`${R4}\\`))return"complete";return"incomplete"}function EP(_){if(!_.startsWith(`${R4}_`))return"complete";if(_.endsWith(`${R4}\\`))return"complete";return"incomplete"}function aX(_){let z=[],A=0;while(A<_.length){let b=_.slice(A);if(b.startsWith(R4)){let G=1;while(G<=b.length){let J=b.slice(0,G),Y=DP(J);if(Y==="complete"){z.push(J),A+=G;break}else if(Y==="incomplete")G++;else{z.push(J),A+=G;break}}if(G>b.length)return{sequences:z,remainder:b}}else z.push(b[0]),A++}return{sequences:z,remainder:""}}class L6 extends UP{buffer="";timeout=null;timeoutMs;pasteMode=!1;pasteBuffer="";constructor(_={}){super();this.timeoutMs=_.timeout??10}process(_){if(this.timeout)clearTimeout(this.timeout),this.timeout=null;let z;if(Buffer.isBuffer(_))if(_.length===1&&_[0]>127){let G=_[0]-128;z=`\x1B${String.fromCharCode(G)}`}else z=_.toString();else z=_;if(z.length===0&&this.buffer.length===0){this.emit("data","");return}if(this.buffer+=z,this.pasteMode){this.pasteBuffer+=this.buffer,this.buffer="";let G=this.pasteBuffer.indexOf(O6);if(G!==-1){let J=this.pasteBuffer.slice(0,G),Y=this.pasteBuffer.slice(G+O6.length);if(this.pasteMode=!1,this.pasteBuffer="",this.emit("paste",J),Y.length>0)this.process(Y)}return}let A=this.buffer.indexOf(oX);if(A!==-1){if(A>0){let J=this.buffer.slice(0,A),Y=aX(J);for(let X of Y.sequences)this.emit("data",X)}this.buffer=this.buffer.slice(A+oX.length),this.pasteMode=!0,this.pasteBuffer=this.buffer,this.buffer="";let G=this.pasteBuffer.indexOf(O6);if(G!==-1){let J=this.pasteBuffer.slice(0,G),Y=this.pasteBuffer.slice(G+O6.length);if(this.pasteMode=!1,this.pasteBuffer="",this.emit("paste",J),Y.length>0)this.process(Y)}return}let b=aX(this.buffer);this.buffer=b.remainder;for(let G of b.sequences)this.emit("data",G);if(this.buffer.length>0)this.timeout=setTimeout(()=>{let G=this.flush();for(let J of G)this.emit("data",J)},this.timeoutMs)}flush(){if(this.timeout)clearTimeout(this.timeout),this.timeout=null;if(this.buffer.length===0)return[];let _=[this.buffer];return this.buffer="",_}clear(){if(this.timeout)clearTimeout(this.timeout),this.timeout=null;this.buffer="",this.pasteMode=!1,this.pasteBuffer=""}getBuffer(){return this.buffer}destroy(){this.clear()}}import*as sX from"node:fs";class j6{wasRaw=!1;inputHandler;resizeHandler;_kittyProtocolActive=!1;stdinBuffer;stdinDataHandler;writeLogPath=process.env.PI_TUI_WRITE_LOG||"";get kittyProtocolActive(){return this._kittyProtocolActive}start(_,z){if(this.inputHandler=_,this.resizeHandler=z,this.wasRaw=process.stdin.isRaw||!1,process.stdin.setRawMode)process.stdin.setRawMode(!0);if(process.stdin.setEncoding("utf8"),process.stdin.resume(),process.stdout.write("\x1B[?2004h"),process.stdout.on("resize",this.resizeHandler),process.platform!=="win32")process.kill(process.pid,"SIGWINCH");this.queryAndEnableKittyProtocol()}setupStdinBuffer(){this.stdinBuffer=new L6({timeout:10});let _=/^\x1b\[\?(\d+)u$/;this.stdinBuffer.on("data",(z)=>{if(!this._kittyProtocolActive){if(z.match(_)){this._kittyProtocolActive=!0,K6(!0),process.stdout.write("\x1B[>7u");return}}if(this.inputHandler)this.inputHandler(z)}),this.stdinBuffer.on("paste",(z)=>{if(this.inputHandler)this.inputHandler(`\x1B[200~${z}\x1B[201~`)}),this.stdinDataHandler=(z)=>{this.stdinBuffer.process(z)}}queryAndEnableKittyProtocol(){this.setupStdinBuffer(),process.stdin.on("data",this.stdinDataHandler),process.stdout.write("\x1B[?u")}stop(){if(process.stdout.write("\x1B[?2004l"),this._kittyProtocolActive)process.stdout.write("\x1B[<u"),this._kittyProtocolActive=!1,K6(!1);if(this.stdinBuffer)this.stdinBuffer.destroy(),this.stdinBuffer=void 0;if(this.stdinDataHandler)process.stdin.removeListener("data",this.stdinDataHandler),this.stdinDataHandler=void 0;if(this.inputHandler=void 0,this.resizeHandler)process.stdout.removeListener("resize",this.resizeHandler),this.resizeHandler=void 0;if(process.stdin.setRawMode)process.stdin.setRawMode(this.wasRaw)}write(_){if(process.stdout.write(_),this.writeLogPath)try{sX.appendFileSync(this.writeLogPath,_,{encoding:"utf8"})}catch{}}get columns(){return process.stdout.columns||80}get rows(){return process.stdout.rows||24}moveBy(_){if(_>0)process.stdout.write(`\x1B[${_}B`);else if(_<0)process.stdout.write(`\x1B[${-_}A`)}hideCursor(){process.stdout.write("\x1B[?25l")}showCursor(){process.stdout.write("\x1B[?25h")}clearLine(){process.stdout.write("\x1B[K")}clearFromCursor(){process.stdout.write("\x1B[J")}clearScreen(){process.stdout.write("\x1B[2J\x1B[H")}setTitle(_){process.stdout.write(`\x1B]0;${_}\x07`)}}var tX=(_=0)=>(z)=>`\x1B[${z+_}m`,eX=(_=0)=>(z)=>`\x1B[${38+_};5;${z}m`,_Q=(_=0)=>(z,A,b)=>`\x1B[${38+_};2;${z};${A};${b}m`,E0={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]}},rs=Object.keys(E0.modifier),OP=Object.keys(E0.color),LP=Object.keys(E0.bgColor),ns=[...OP,...LP];function jP(){let _=new Map;for(let[z,A]of Object.entries(E0)){for(let[b,G]of Object.entries(A))E0[b]={open:`\x1B[${G[0]}m`,close:`\x1B[${G[1]}m`},A[b]=E0[b],_.set(G[0],G[1]);Object.defineProperty(E0,z,{value:A,enumerable:!1})}return Object.defineProperty(E0,"codes",{value:_,enumerable:!1}),E0.color.close="\x1B[39m",E0.bgColor.close="\x1B[49m",E0.color.ansi=tX(),E0.color.ansi256=eX(),E0.color.ansi16m=_Q(),E0.bgColor.ansi=tX(10),E0.bgColor.ansi256=eX(10),E0.bgColor.ansi16m=_Q(10),Object.defineProperties(E0,{rgbToAnsi256:{value(z,A,b){if(z===A&&A===b){if(z<8)return 16;if(z>248)return 231;return Math.round((z-8)/247*24)+232}return 16+36*Math.round(z/255*5)+6*Math.round(A/255*5)+Math.round(b/255*5)},enumerable:!1},hexToRgb:{value(z){let A=/[a-f\d]{6}|[a-f\d]{3}/i.exec(z.toString(16));if(!A)return[0,0,0];let[b]=A;if(b.length===3)b=[...b].map((J)=>J+J).join("");let G=Number.parseInt(b,16);return[G>>16&255,G>>8&255,G&255]},enumerable:!1},hexToAnsi256:{value:(z)=>E0.rgbToAnsi256(...E0.hexToRgb(z)),enumerable:!1},ansi256ToAnsi:{value(z){if(z<8)return 30+z;if(z<16)return 90+(z-8);let A,b,G;if(z>=232)A=((z-232)*10+8)/255,b=A,G=A;else{z-=16;let X=z%36;A=Math.floor(z/36)/5,b=Math.floor(X/6)/5,G=X%6/5}let J=Math.max(A,b,G)*2;if(J===0)return 30;let Y=30+(Math.round(G)<<2|Math.round(b)<<1|Math.round(A));if(J===2)Y+=60;return Y},enumerable:!1},rgbToAnsi:{value:(z,A,b)=>E0.ansi256ToAnsi(E0.rgbToAnsi256(z,A,b)),enumerable:!1},hexToAnsi:{value:(z)=>E0.ansi256ToAnsi(E0.hexToAnsi256(z)),enumerable:!1}}),E0}var RP=jP(),u9=RP;import s5 from"node:process";import PP from"node:os";import zQ from"node:tty";function w9(_,z=globalThis.Deno?globalThis.Deno.args:s5.argv){let A=_.startsWith("-")?"":_.length===1?"-":"--",b=z.indexOf(A+_),G=z.indexOf("--");return b!==-1&&(G===-1||b<G)}var{env:O0}=s5,R6;if(w9("no-color")||w9("no-colors")||w9("color=false")||w9("color=never"))R6=0;else if(w9("color")||w9("colors")||w9("color=true")||w9("color=always"))R6=1;function SP(){if("FORCE_COLOR"in O0){if(O0.FORCE_COLOR==="true")return 1;if(O0.FORCE_COLOR==="false")return 0;return O0.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(O0.FORCE_COLOR,10),3)}}function kP(_){if(_===0)return!1;return{level:_,hasBasic:!0,has256:_>=2,has16m:_>=3}}function IP(_,{streamIsTTY:z,sniffFlags:A=!0}={}){let b=SP();if(b!==void 0)R6=b;let G=A?R6:b;if(G===0)return 0;if(A){if(w9("color=16m")||w9("color=full")||w9("color=truecolor"))return 3;if(w9("color=256"))return 2}if("TF_BUILD"in O0&&"AGENT_NAME"in O0)return 1;if(_&&!z&&G===void 0)return 0;let J=G||0;if(O0.TERM==="dumb")return J;if(s5.platform==="win32"){let Y=PP.release().split(".");if(Number(Y[0])>=10&&Number(Y[2])>=10586)return Number(Y[2])>=14931?3:2;return 1}if("CI"in O0){if(["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some((Y)=>(Y in O0)))return 3;if(["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some((Y)=>(Y in O0))||O0.CI_NAME==="codeship")return 1;return J}if("TEAMCITY_VERSION"in O0)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(O0.TEAMCITY_VERSION)?1:0;if(O0.COLORTERM==="truecolor")return 3;if(O0.TERM==="xterm-kitty")return 3;if(O0.TERM==="xterm-ghostty")return 3;if(O0.TERM==="wezterm")return 3;if("TERM_PROGRAM"in O0){let Y=Number.parseInt((O0.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(O0.TERM_PROGRAM){case"iTerm.app":return Y>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(O0.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(O0.TERM))return 1;if("COLORTERM"in O0)return 1;return J}function AQ(_,z={}){let A=IP(_,{streamIsTTY:_&&_.isTTY,...z});return kP(A)}var xP={stdout:AQ({isTTY:zQ.isatty(1)}),stderr:AQ({isTTY:zQ.isatty(2)})},bQ=xP;function GQ(_,z,A){let b=_.indexOf(z);if(b===-1)return _;let G=z.length,J=0,Y="";do Y+=_.slice(J,b)+z+A,J=b+G,b=_.indexOf(z,J);while(b!==-1);return Y+=_.slice(J),Y}function JQ(_,z,A,b){let G=0,J="";do{let Y=_[b-1]==="\r";J+=_.slice(G,Y?b-1:b)+z+(Y?`\r
151
151
  `:`
152
152
  `)+A,G=b+1,b=_.indexOf(`
153
- `,G)}while(b!==-1);return J+=_.slice(G),J}var{stdout:YQ,stderr:XQ}=bQ,a5=Symbol("GENERATOR"),K1=Symbol("STYLER"),kz=Symbol("IS_EMPTY"),QQ=["ansi","ansi","ansi256","ansi16m"],q1=Object.create(null),PP=(_,z={})=>{if(z.level&&!(Number.isInteger(z.level)&&z.level>=0&&z.level<=3))throw Error("The `level` option should be an integer from 0 to 3");let A=YQ?YQ.level:0;_.level=z.level===void 0?A:z.level};var SP=(_)=>{let z=(...A)=>A.join(" ");return PP(z,_),Object.setPrototypeOf(z,Iz.prototype),z};function Iz(_){return SP(_)}Object.setPrototypeOf(Iz.prototype,Function.prototype);for(let[_,z]of Object.entries(m9))q1[_]={get(){let A=L6(this,t5(z.open,z.close,this[K1]),this[kz]);return Object.defineProperty(this,_,{value:A}),A}};q1.visible={get(){let _=L6(this,this[K1],!0);return Object.defineProperty(this,"visible",{value:_}),_}};var s5=(_,z,A,...b)=>{if(_==="rgb"){if(z==="ansi16m")return m9[A].ansi16m(...b);if(z==="ansi256")return m9[A].ansi256(m9.rgbToAnsi256(...b));return m9[A].ansi(m9.rgbToAnsi(...b))}if(_==="hex")return s5("rgb",z,A,...m9.hexToRgb(...b));return m9[A][_](...b)},kP=["rgb","hex","ansi256"];for(let _ of kP){q1[_]={get(){let{level:A}=this;return function(...b){let G=t5(s5(_,QQ[A],"color",...b),m9.color.close,this[K1]);return L6(this,G,this[kz])}}};let z="bg"+_[0].toUpperCase()+_.slice(1);q1[z]={get(){let{level:A}=this;return function(...b){let G=t5(s5(_,QQ[A],"bgColor",...b),m9.bgColor.close,this[K1]);return L6(this,G,this[kz])}}}}var IP=Object.defineProperties(()=>{},{...q1,level:{enumerable:!0,get(){return this[a5].level},set(_){this[a5].level=_}}}),t5=(_,z,A)=>{let b,G;if(A===void 0)b=_,G=z;else b=A.openAll+_,G=z+A.closeAll;return{open:_,close:z,openAll:b,closeAll:G,parent:A}},L6=(_,z,A)=>{let b=(...G)=>xP(b,G.length===1?""+G[0]:G.join(" "));return Object.setPrototypeOf(b,IP),b[a5]=_,b[K1]=z,b[kz]=A,b},xP=(_,z)=>{if(_.level<=0||!z)return _[kz]?"":z;let A=_[K1];if(A===void 0)return z;let{openAll:b,closeAll:G}=A;if(z.includes("\x1B"))while(A!==void 0)z=GQ(z,A.close,A.open),A=A.parent;let J=z.indexOf(`
154
- `);if(J!==-1)z=JQ(z,G,b,J);return b+z+G};Object.defineProperties(Iz.prototype,q1);var TP=Iz(),ns=Iz({level:XQ?XQ.level:0});var H4=TP;var CP=15,vP={selectedPrefix:(_)=>H4.cyan(_),selectedText:(_)=>H4.cyan(_),description:(_)=>H4.gray(_),scrollInfo:(_)=>H4.gray(_),noMatch:(_)=>H4.yellow(_)};function yP(_){let A=Date.now()-_.getTime(),b=Math.floor(A/1000),G=Math.floor(b/60),J=Math.floor(G/60),Y=Math.floor(J/24),X=Math.floor(Y/7);if(X>0)return`${X}w ago`;if(Y>0)return`${Y}d ago`;if(J>0)return`${J}h ago`;if(G>0)return`${G}m ago`;return"now"}function gP(_,z){if(!_)return"";let A=process.env.HOME??"",b=_;if(A&&_.startsWith(A))b="~"+_.slice(A.length);return n0(b,z,"…",!1)}function fP(_){if(!_)return"";let z=[];if(_.linesAdded>0)z.push(H4.green(`+${_.linesAdded}`));if(_.linesModified>0)z.push(H4.yellow(`~${_.linesModified}`));if(_.linesRemoved>0)z.push(H4.red(`-${_.linesRemoved}`));return z.join(" ")}function hP(_,z){let A=yP(_.timestamp).padEnd(7),b=_.source.padEnd(11),G=fP(_.stats),J=_.stats?15:0,Y=24+J+(J>0?3:0),X=Math.max(40,z-Y),Q=Math.min(22,Math.floor(X*0.35)),$=X-Q-3,H=gP(_.cwd,Q).padEnd(Q),B=n0(_.preview??"",$,"…",!1);if(G)return`${A} │ ${b} │ ${G.padEnd(15)} │ ${H} │ ${B}`;return`${A} │ ${b} │ ${H} │ ${B}`}async function $Q(_){if(_.length===0)return console.log("No transcripts found."),null;return new Promise((z)=>{let A=new E6,b=new F1(A),G=process.stdout.columns??80,J=_.map((Q)=>({value:Q.id,label:hP(Q,G),description:"",transcript:Q})),Y=new B1(H4.gray("Select a transcript to upload (↑↓ navigate, Enter select, Esc cancel)"),1),X=new Lz(J,CP,vP);X.onSelect=(Q)=>{b.stop(),z(Q.transcript)},X.onCancel=()=>{b.stop(),z(null)},b.addChild(Y),b.addChild(X),b.setFocus(X),b.start()})}import{createHash as HQ}from"crypto";import{existsSync as e5,readFileSync as mP}from"fs";import{dirname as uP,isAbsolute as cP,resolve as lP}from"path";async function BQ(_,z={}){let A=_2(_),b=await a0(A.cwd);if(!t9(b))return{success:!1,eventCount:A.records.length,invalidLines:A.invalidLines,sessionId:"",cwd:A.cwd,unifiedTranscript:{},sha256:"",source:_.source??"claude-code",skipped:!0};let G=await FQ(_,A),J=L5(G.unifiedTranscript),Y=L_(J),X=JSON.stringify(Y),Q=HQ("sha256").update(X).digest("hex"),$=await z4(G.sessionId),H=_.visibility??V8(b),B=G6(G.rawTranscript),Z={id:$,sha256:Q,rawTranscript:B,unifiedTranscript:Y,blobs:G.blobs.length>0?G.blobs:void 0,visibility:H},F=await K5(Z,z);if(F.success&&F.id)await z5(G.sessionId,F.id);return{...F,eventCount:G.eventCount,invalidLines:G.invalidLines,sessionId:G.sessionId,unifiedTranscript:Y,sha256:Q,source:_.source??"claude-code",cwd:G.cwd,skipped:!1}}function ZQ(_){if(!_)return null;if(cP(_))return e5(_)?_:null;let z=new Set,A=(J)=>{if(!J)return null;let Y=lP(J,_);if(z.has(Y))return null;return z.add(Y),e5(Y)?Y:null},b=A(process.cwd())??A(process.env.INIT_CWD)??A(process.env.PWD);if(b)return b;let G=process.cwd();while(!0){let J=A(G);if(J)return J;let Y=uP(G);if(Y===G)break;G=Y}return null}function pP(_){for(let z of _){let A=typeof z.cwd==="string"?z.cwd.trim():"";if(A)return A}return null}function dP(_){for(let z of _){let A=typeof z.gitBranch==="string"?z.gitBranch.trim():"";if(A)return A}return}function _2(_){let{transcriptPath:z}=_;if(!z)throw Error("No transcript path provided.");if(!e5(z))throw Error(`Transcript file not found at path: ${z}`);let A=mP(z,"utf8"),b=A.split(/\r?\n/),G=[],J=0;for(let X of b){let Q=X.trim();if(!Q)continue;try{let $=JSON.parse(Q);if(typeof $==="object"&&$!==null)G.push($);else J+=1}catch{J+=1}}if(G.length===0)throw Error("No transcript events found in the specified file.");let Y=_.cwdOverride&&_.cwdOverride.trim().length>0?_.cwdOverride.trim():pP(G)??process.cwd();return{rawContent:A,records:G,cwd:Y,invalidLines:J}}async function FQ(_,z){let{sessionId:A,source:b="claude-code"}=_,G=z??_2(_),Y=await new r0().fetchModelPricing(),X=Object.fromEntries(Y),Q=dP(G.records),$=await e0(G.cwd,Q),H={pricing:X,gitContext:$},B=b==="codex"?w5(G.records,{pricing:X}):A6(G.records,H);if(!B)throw Error(`Unable to convert ${b} transcript to unified format.`);let{transcript:Z,blobs:F}=B,K=A??Z.id;if(!K)throw Error("Transcript did not include a session identifier.");if(A&&A!==Z.id)throw Error(`Provided sessionId (${A}) does not match unified transcript id (${Z.id}).`);let q=[];for(let[W,V]of F)q.push({sha256:W,data:new Uint8Array(V.data),mediaType:V.mediaType});return{unifiedTranscript:Z,rawTranscript:G.rawContent,blobs:q,sessionId:K,cwd:G.cwd,eventCount:G.records.length,invalidLines:G.invalidLines}}async function P4(_){let z=_2(_),A=await a0(z.cwd);if(!t9(A))return{results:[],eventCount:z.records.length,id:"",sessionId:"",anySuccess:!1,allSuccess:!1};let b=await FQ(_,z),G=await E9({unifiedTranscript:b.unifiedTranscript,sessionId:b.sessionId,cwd:b.cwd,rawTranscript:b.rawTranscript,blobs:b.blobs,visibility:_.visibility});if(G.skipped)return{results:[],eventCount:b.eventCount,id:"",sessionId:b.sessionId,anySuccess:!1,allSuccess:!1};return{results:G.results,eventCount:b.eventCount,id:G.id,sessionId:G.sessionId,anySuccess:G.anySuccess,allSuccess:G.allSuccess}}async function E9(_){let{unifiedTranscript:z,sessionId:A,cwd:b,rawTranscript:G,blobs:J,visibility:Y}=_,X=await a0(b);if(!t9(X))return{results:[],id:"",sessionId:A,anySuccess:!1,allSuccess:!1,skipped:!0};let Q=await A4();if(Q.length===0)throw Error("No authenticated environments found. Run `agentlogs login` first.");let $=L5(z),H=L_($),B=JSON.stringify(H),Z=HQ("sha256").update(B).digest("hex"),F=await z4(A),K=Y??V8(X),q=G6(G??B),W={id:F,sha256:Z,rawTranscript:q,unifiedTranscript:H,blobs:J&&J.length>0?J:void 0,visibility:K},V=[],w="";for(let O of Q)try{let M=await K5(W,{serverUrl:O.baseURL,authToken:O.token});if(M.success&&M.id){if(await z5(A,M.id),!w)w=M.id}V.push({envName:O.name,baseURL:O.baseURL,success:M.success,id:M.id,transcriptId:M.transcriptId})}catch(M){V.push({envName:O.name,baseURL:O.baseURL,success:!1,error:M instanceof Error?M.message:String(M)})}return{results:V,id:w,sessionId:A,anySuccess:V.some((O)=>O.success),allSuccess:V.every((O)=>O.success),skipped:!1}}async function KQ(_,z={}){if((await A4()).length===0)console.error("You must be logged in to upload transcripts."),console.error("Run `agentlogs login` to authenticate."),process.exit(1);let b=_?rP(_):void 0,G=await VX({sources:z.source?[z.source]:void 0,cwd:b,limit:100});if(G.length===0){let X=[b?`directory: ${b}`:null,z.source?`source: ${z.source}`:null].filter(Boolean).join(", ");console.log(X?`No transcripts found matching filters (${X}).`:"No transcripts found.");return}let J=null;if(z.latest)J=G[0],console.log(`Auto-selecting most recent transcript: ${J.id}`);else J=await $Q(G);if(!J)process.exit(0);let Y=await aP(J);process.exit(Y?0:1)}async function aP(_){if(console.log(""),console.log(`Uploading ${_.source} transcript: ${_.id}`),_.cwd)console.log(`Directory: ${_.cwd}`);try{switch(_.source){case"claude-code":return await sP(_);case"codex":return await tP(_);case"opencode":return await eP(_);case"pi":return await _S(_)}}catch(z){return console.error(""),console.error("Upload failed:",z instanceof Error?z.message:String(z)),!1}}async function sP(_){let z=await P4({transcriptPath:_.path,sessionId:_.id,cwdOverride:_.cwd??void 0,source:"claude-code"});return qQ(z)}async function tP(_){let z=await P4({transcriptPath:_.path,sessionId:_.id,cwdOverride:_.cwd??void 0,source:"codex"});return qQ(z)}async function eP(_){let z=AS(_.id);if(!z)throw Error(`Failed to read OpenCode session: ${_.id}`);let b=await new r0().fetchModelPricing(),G=Object.fromEntries(b),J=z.info.directory??process.cwd(),Y=await e0(J,void 0);if(Y?.repo)console.log(`Repository: ${Y.repo}`);console.log("Converting transcript...");let X=E_(z,{pricing:G,gitContext:Y,cwd:J});if(!X)throw Error("Failed to convert OpenCode transcript");console.log("Uploading...");let Q=await E9({unifiedTranscript:X,sessionId:_.id,cwd:J,rawTranscript:JSON.stringify(z)});if(Q.skipped)return console.log(""),console.log("Skipped: Repository not in allowlist"),!0;if(Q.anySuccess&&Q.id){console.log(""),console.log("Upload successful!"),console.log(`Transcript ID: ${Q.id}`);for(let $ of Q.results)if($.success){let H=`${$.baseURL}/s/${Q.id}`;console.log(`View: ${H}`)}return!0}else{console.error(""),console.error("Upload failed:");for(let $ of Q.results)if(!$.success&&$.error)console.error(` ${$.envName}: ${$.error}`);return!1}}async function _S(_){let z=zS(_.path);if(!z)throw Error(`Failed to read Pi session: ${_.path}`);let b=await new r0().fetchModelPricing(),G=Object.fromEntries(b),J=z.header.cwd??process.cwd(),Y=await e0(J,void 0);if(Y?.repo)console.log(`Repository: ${Y.repo}`);console.log("Converting transcript...");let X=O_(z,{pricing:G,gitContext:Y,cwd:J});if(!X)throw Error("Failed to convert Pi transcript");console.log("Uploading...");let Q=await E9({unifiedTranscript:X.transcript,sessionId:_.id,cwd:J,rawTranscript:JSON.stringify(z)});if(Q.skipped)return console.log(""),console.log("Skipped: Repository not in allowlist"),!0;if(Q.anySuccess&&Q.id){console.log(""),console.log("Upload successful!"),console.log(`Transcript ID: ${Q.id}`);for(let $ of Q.results)if($.success){let H=`${$.baseURL}/s/${Q.id}`;console.log(`View: ${H}`)}return!0}else{console.error(""),console.error("Upload failed:");for(let $ of Q.results)if(!$.success&&$.error)console.error(` ${$.envName}: ${$.error}`);return!1}}function zS(_){if(!iP(_))return null;let A=oP(_,"utf-8").split(`
155
- `).filter((J)=>J.trim());if(A.length===0)return null;let b=JSON.parse(A[0]),G=[];for(let J=1;J<A.length;J++)try{G.push(JSON.parse(A[J]))}catch{}return{header:b,entries:G}}function AS(_){try{let z=nP("opencode",["export",_],{encoding:"utf-8",timeout:30000,stdio:["pipe","pipe","pipe"]});if(z.status!==0||z.error)return null;let A=z.stdout.trim();if(!A)return null;return JSON.parse(A)}catch{return null}}function qQ(_){if(_.anySuccess&&_.id){console.log(""),console.log("Upload successful!"),console.log(`Transcript ID: ${_.id}`);for(let z of _.results)if(z.success){let A=`${z.baseURL}/s/${_.id}`;console.log(`View: ${A}`)}return!0}else if(_.results.length===0)return console.log(""),console.log("Skipped: Repository not in allowlist"),!0;else{console.error(""),console.error("Upload failed:");for(let z of _.results)if(!z.success&&z.error)console.error(` ${z.envName}: ${z.error}`);return!1}}var WQ=_6(),x=mY("cli",{logFilePath:WQ??void 0,logToFile:WQ!==null,disableConsole:!0});function P_(_){return/\bgit\s+commit\b/.test(_)}function W1(_,z){let A=`\uD83D\uDD2E View transcript: https://agentlogs.ai/s/${z}`;if(_.includes(A))return _;let b=`
153
+ `,G)}while(b!==-1);return J+=_.slice(G),J}var{stdout:YQ,stderr:XQ}=bQ,t5=Symbol("GENERATOR"),W1=Symbol("STYLER"),xz=Symbol("IS_EMPTY"),QQ=["ansi","ansi","ansi256","ansi16m"],V1=Object.create(null),TP=(_,z={})=>{if(z.level&&!(Number.isInteger(z.level)&&z.level>=0&&z.level<=3))throw Error("The `level` option should be an integer from 0 to 3");let A=YQ?YQ.level:0;_.level=z.level===void 0?A:z.level};var CP=(_)=>{let z=(...A)=>A.join(" ");return TP(z,_),Object.setPrototypeOf(z,Tz.prototype),z};function Tz(_){return CP(_)}Object.setPrototypeOf(Tz.prototype,Function.prototype);for(let[_,z]of Object.entries(u9))V1[_]={get(){let A=P6(this,_2(z.open,z.close,this[W1]),this[xz]);return Object.defineProperty(this,_,{value:A}),A}};V1.visible={get(){let _=P6(this,this[W1],!0);return Object.defineProperty(this,"visible",{value:_}),_}};var e5=(_,z,A,...b)=>{if(_==="rgb"){if(z==="ansi16m")return u9[A].ansi16m(...b);if(z==="ansi256")return u9[A].ansi256(u9.rgbToAnsi256(...b));return u9[A].ansi(u9.rgbToAnsi(...b))}if(_==="hex")return e5("rgb",z,A,...u9.hexToRgb(...b));return u9[A][_](...b)},vP=["rgb","hex","ansi256"];for(let _ of vP){V1[_]={get(){let{level:A}=this;return function(...b){let G=_2(e5(_,QQ[A],"color",...b),u9.color.close,this[W1]);return P6(this,G,this[xz])}}};let z="bg"+_[0].toUpperCase()+_.slice(1);V1[z]={get(){let{level:A}=this;return function(...b){let G=_2(e5(_,QQ[A],"bgColor",...b),u9.bgColor.close,this[W1]);return P6(this,G,this[xz])}}}}var yP=Object.defineProperties(()=>{},{...V1,level:{enumerable:!0,get(){return this[t5].level},set(_){this[t5].level=_}}}),_2=(_,z,A)=>{let b,G;if(A===void 0)b=_,G=z;else b=A.openAll+_,G=z+A.closeAll;return{open:_,close:z,openAll:b,closeAll:G,parent:A}},P6=(_,z,A)=>{let b=(...G)=>gP(b,G.length===1?""+G[0]:G.join(" "));return Object.setPrototypeOf(b,yP),b[t5]=_,b[W1]=z,b[xz]=A,b},gP=(_,z)=>{if(_.level<=0||!z)return _[xz]?"":z;let A=_[W1];if(A===void 0)return z;let{openAll:b,closeAll:G}=A;if(z.includes("\x1B"))while(A!==void 0)z=GQ(z,A.close,A.open),A=A.parent;let J=z.indexOf(`
154
+ `);if(J!==-1)z=JQ(z,G,b,J);return b+z+G};Object.defineProperties(Tz.prototype,V1);var fP=Tz(),bt=Tz({level:XQ?XQ.level:0});var H4=fP;var hP=15,mP={selectedPrefix:(_)=>H4.cyan(_),selectedText:(_)=>H4.cyan(_),description:(_)=>H4.gray(_),scrollInfo:(_)=>H4.gray(_),noMatch:(_)=>H4.yellow(_)};function uP(_){let A=Date.now()-_.getTime(),b=Math.floor(A/1000),G=Math.floor(b/60),J=Math.floor(G/60),Y=Math.floor(J/24),X=Math.floor(Y/7);if(X>0)return`${X}w ago`;if(Y>0)return`${Y}d ago`;if(J>0)return`${J}h ago`;if(G>0)return`${G}m ago`;return"now"}function cP(_,z){if(!_)return"";let A=process.env.HOME??"",b=_;if(A&&_.startsWith(A))b="~"+_.slice(A.length);return n0(b,z,"…",!1)}function lP(_){if(!_)return"";let z=[];if(_.linesAdded>0)z.push(H4.green(`+${_.linesAdded}`));if(_.linesModified>0)z.push(H4.yellow(`~${_.linesModified}`));if(_.linesRemoved>0)z.push(H4.red(`-${_.linesRemoved}`));return z.join(" ")}function pP(_,z){let A=uP(_.timestamp).padEnd(7),b=_.source.padEnd(11),G=lP(_.stats),J=_.stats?15:0,Y=24+J+(J>0?3:0),X=Math.max(40,z-Y),Q=Math.min(22,Math.floor(X*0.35)),$=X-Q-3,H=cP(_.cwd,Q).padEnd(Q),B=n0(_.preview??"",$,"…",!1);if(G)return`${A} │ ${b} │ ${G.padEnd(15)} │ ${H} │ ${B}`;return`${A} │ ${b} │ ${H} │ ${B}`}async function $Q(_){if(_.length===0)return console.log("No transcripts found."),null;return new Promise((z)=>{let A=new j6,b=new q1(A),G=process.stdout.columns??80,J=_.map((Q)=>({value:Q.id,label:pP(Q,G),description:"",transcript:Q})),Y=new F1(H4.gray("Select a transcript to upload (↑↓ navigate, Enter select, Esc cancel)"),1),X=new Rz(J,hP,mP);X.onSelect=(Q)=>{b.stop(),z(Q.transcript)},X.onCancel=()=>{b.stop(),z(null)},b.addChild(Y),b.addChild(X),b.setFocus(X),b.start()})}import{createHash as HQ}from"crypto";import{existsSync as z2,readFileSync as dP}from"fs";import{dirname as rP,isAbsolute as nP,resolve as iP}from"path";async function BQ(_,z={}){let A=A2(_),b=await a0(A.cwd);if(!e9(b))return{success:!1,eventCount:A.records.length,invalidLines:A.invalidLines,sessionId:"",cwd:A.cwd,unifiedTranscript:{},sha256:"",source:_.source??"claude-code",skipped:!0};let G=await FQ(_,A),J=R5(G.unifiedTranscript),Y=L_(J),X=JSON.stringify(Y),Q=HQ("sha256").update(X).digest("hex"),$=await A4(G.sessionId),H=_.visibility??M8(b),B=X6(G.rawTranscript),Z={id:$,sha256:Q,rawTranscript:B,unifiedTranscript:Y,blobs:G.blobs.length>0?G.blobs:void 0,visibility:H},F=await W5(Z,z);if(F.success&&F.id)await G5(G.sessionId,F.id);return{...F,eventCount:G.eventCount,invalidLines:G.invalidLines,sessionId:G.sessionId,unifiedTranscript:Y,sha256:Q,source:_.source??"claude-code",cwd:G.cwd,skipped:!1}}function ZQ(_){if(!_)return null;if(nP(_))return z2(_)?_:null;let z=new Set,A=(J)=>{if(!J)return null;let Y=iP(J,_);if(z.has(Y))return null;return z.add(Y),z2(Y)?Y:null},b=A(process.cwd())??A(process.env.INIT_CWD)??A(process.env.PWD);if(b)return b;let G=process.cwd();while(!0){let J=A(G);if(J)return J;let Y=rP(G);if(Y===G)break;G=Y}return null}function oP(_){for(let z of _){let A=typeof z.cwd==="string"?z.cwd.trim():"";if(A)return A}return null}function aP(_){for(let z of _){let A=typeof z.gitBranch==="string"?z.gitBranch.trim():"";if(A)return A}return}function A2(_){let{transcriptPath:z}=_;if(!z)throw Error("No transcript path provided.");if(!z2(z))throw Error(`Transcript file not found at path: ${z}`);let A=dP(z,"utf8"),b=A.split(/\r?\n/),G=[],J=0;for(let X of b){let Q=X.trim();if(!Q)continue;try{let $=JSON.parse(Q);if(typeof $==="object"&&$!==null)G.push($);else J+=1}catch{J+=1}}if(G.length===0)throw Error("No transcript events found in the specified file.");let Y=_.cwdOverride&&_.cwdOverride.trim().length>0?_.cwdOverride.trim():oP(G)??process.cwd();return{rawContent:A,records:G,cwd:Y,invalidLines:J}}async function FQ(_,z){let{sessionId:A,source:b="claude-code"}=_,G=z??A2(_),Y=await new r0().fetchModelPricing(),X=Object.fromEntries(Y),Q=aP(G.records),$=await e0(G.cwd,Q),H={pricing:X,gitContext:$},B=b==="codex"?O5(G.records,{pricing:X}):J6(G.records,H);if(!B)throw Error(`Unable to convert ${b} transcript to unified format.`);let{transcript:Z,blobs:F}=B,K=A??Z.id;if(!K)throw Error("Transcript did not include a session identifier.");if(A&&A!==Z.id)throw Error(`Provided sessionId (${A}) does not match unified transcript id (${Z.id}).`);let q=[];for(let[W,V]of F)q.push({sha256:W,data:new Uint8Array(V.data),mediaType:V.mediaType});return{unifiedTranscript:Z,rawTranscript:G.rawContent,blobs:q,sessionId:K,cwd:G.cwd,eventCount:G.records.length,invalidLines:G.invalidLines}}async function P4(_){let z=A2(_),A=await a0(z.cwd);if(!e9(A))return{results:[],eventCount:z.records.length,id:"",sessionId:"",anySuccess:!1,allSuccess:!1};let b=await FQ(_,z),G=await E9({unifiedTranscript:b.unifiedTranscript,sessionId:b.sessionId,cwd:b.cwd,rawTranscript:b.rawTranscript,blobs:b.blobs,visibility:_.visibility});if(G.skipped)return{results:[],eventCount:b.eventCount,id:"",sessionId:b.sessionId,anySuccess:!1,allSuccess:!1};return{results:G.results,eventCount:b.eventCount,id:G.id,sessionId:G.sessionId,anySuccess:G.anySuccess,allSuccess:G.allSuccess}}async function E9(_){let{unifiedTranscript:z,sessionId:A,cwd:b,rawTranscript:G,blobs:J,visibility:Y}=_,X=await a0(b);if(!e9(X))return{results:[],id:"",sessionId:A,anySuccess:!1,allSuccess:!1,skipped:!0};let Q=await T9();if(Q.length===0)throw Error("No authenticated environments found. Run `agentlogs login agentlogs.ai` first.");let $=R5(z),H=L_($),B=JSON.stringify(H),Z=HQ("sha256").update(B).digest("hex"),F=await A4(A),K=Y??M8(X),q=X6(G??B),W={id:F,sha256:Z,rawTranscript:q,unifiedTranscript:H,blobs:J&&J.length>0?J:void 0,visibility:K},V=[],w="";for(let O of Q)try{let M=await W5(W,{serverUrl:O.baseURL,authToken:O.token});if(M.success&&M.id){if(await G5(A,M.id),!w)w=M.id}V.push({envName:O.name,baseURL:O.baseURL,success:M.success,id:M.id,transcriptId:M.transcriptId})}catch(M){V.push({envName:O.name,baseURL:O.baseURL,success:!1,error:M instanceof Error?M.message:String(M)})}return{results:V,id:w,sessionId:A,anySuccess:V.some((O)=>O.success),allSuccess:V.every((O)=>O.success),skipped:!1}}async function KQ(_,z={}){if((await T9()).length===0)console.error("You must be logged in to upload transcripts."),console.error("Run `agentlogs login agentlogs.ai` to authenticate."),process.exit(1);let b=_?sP(_):void 0,G=await VX({sources:z.source?[z.source]:void 0,cwd:b,limit:100});if(G.length===0){let X=[b?`directory: ${b}`:null,z.source?`source: ${z.source}`:null].filter(Boolean).join(", ");console.log(X?`No transcripts found matching filters (${X}).`:"No transcripts found.");return}let J=null;if(z.latest)J=G[0],console.log(`Auto-selecting most recent transcript: ${J.id}`);else J=await $Q(G);if(!J)process.exit(0);let Y=await zS(J);process.exit(Y?0:1)}async function zS(_){if(console.log(""),console.log(`Uploading ${_.source} transcript: ${_.id}`),_.cwd)console.log(`Directory: ${_.cwd}`);try{switch(_.source){case"claude-code":return await AS(_);case"codex":return await bS(_);case"opencode":return await GS(_);case"pi":return await JS(_)}}catch(z){return console.error(""),console.error("Upload failed:",z instanceof Error?z.message:String(z)),!1}}async function AS(_){let z=await P4({transcriptPath:_.path,sessionId:_.id,cwdOverride:_.cwd??void 0,source:"claude-code"});return qQ(z)}async function bS(_){let z=await P4({transcriptPath:_.path,sessionId:_.id,cwdOverride:_.cwd??void 0,source:"codex"});return qQ(z)}async function GS(_){let z=XS(_.id);if(!z)throw Error(`Failed to read OpenCode session: ${_.id}`);let b=await new r0().fetchModelPricing(),G=Object.fromEntries(b),J=z.info.directory??process.cwd(),Y=await e0(J,void 0);if(Y?.repo)console.log(`Repository: ${Y.repo}`);console.log("Converting transcript...");let X=E_(z,{pricing:G,gitContext:Y,cwd:J});if(!X)throw Error("Failed to convert OpenCode transcript");console.log("Uploading...");let Q=await E9({unifiedTranscript:X,sessionId:_.id,cwd:J,rawTranscript:JSON.stringify(z)});if(Q.skipped)return console.log(""),console.log("Skipped: Repository not in allowlist"),!0;if(Q.anySuccess&&Q.id){console.log(""),console.log("Upload successful!"),console.log(`Transcript ID: ${Q.id}`);for(let $ of Q.results)if($.success){let H=`${$.baseURL}/s/${Q.id}`;console.log(`View: ${H}`)}return!0}else{console.error(""),console.error("Upload failed:");for(let $ of Q.results)if(!$.success&&$.error)console.error(` ${$.envName}: ${$.error}`);return!1}}async function JS(_){let z=YS(_.path);if(!z)throw Error(`Failed to read Pi session: ${_.path}`);let b=await new r0().fetchModelPricing(),G=Object.fromEntries(b),J=z.header.cwd??process.cwd(),Y=await e0(J,void 0);if(Y?.repo)console.log(`Repository: ${Y.repo}`);console.log("Converting transcript...");let X=O_(z,{pricing:G,gitContext:Y,cwd:J});if(!X)throw Error("Failed to convert Pi transcript");console.log("Uploading...");let Q=await E9({unifiedTranscript:X.transcript,sessionId:_.id,cwd:J,rawTranscript:JSON.stringify(z)});if(Q.skipped)return console.log(""),console.log("Skipped: Repository not in allowlist"),!0;if(Q.anySuccess&&Q.id){console.log(""),console.log("Upload successful!"),console.log(`Transcript ID: ${Q.id}`);for(let $ of Q.results)if($.success){let H=`${$.baseURL}/s/${Q.id}`;console.log(`View: ${H}`)}return!0}else{console.error(""),console.error("Upload failed:");for(let $ of Q.results)if(!$.success&&$.error)console.error(` ${$.envName}: ${$.error}`);return!1}}function YS(_){if(!eP(_))return null;let A=_S(_,"utf-8").split(`
155
+ `).filter((J)=>J.trim());if(A.length===0)return null;let b=JSON.parse(A[0]),G=[];for(let J=1;J<A.length;J++)try{G.push(JSON.parse(A[J]))}catch{}return{header:b,entries:G}}function XS(_){try{let z=tP("opencode",["export",_],{encoding:"utf-8",timeout:30000,stdio:["pipe","pipe","pipe"]});if(z.status!==0||z.error)return null;let A=z.stdout.trim();if(!A)return null;return JSON.parse(A)}catch{return null}}function qQ(_){if(_.anySuccess&&_.id){console.log(""),console.log("Upload successful!"),console.log(`Transcript ID: ${_.id}`);for(let z of _.results)if(z.success){let A=`${z.baseURL}/s/${_.id}`;console.log(`View: ${A}`)}return!0}else if(_.results.length===0)return console.log(""),console.log("Skipped: Repository not in allowlist"),!0;else{console.error(""),console.error("Upload failed:");for(let z of _.results)if(!z.success&&z.error)console.error(` ${z.envName}: ${z.error}`);return!1}}var WQ=b6(),x=mY("cli",{logFilePath:WQ??void 0,logToFile:WQ!==null,disableConsole:!0}),VQ="https://agentlogs.ai",QS=/https?:\/\/[^\s"'`]+\/s\/([a-zA-Z0-9_-]+)/;function $S(_){let z=_.toLowerCase();return z==="localhost"||z==="127.0.0.1"||z==="::1"}function HS(_){try{let z=new URL(_);return $S(z.hostname)}catch{return!1}}function UQ(_){try{let z=new URL(_);return`${z.protocol}//${z.host.toLowerCase()}`}catch{return _.replace(/\/+$/,"")}}function BS(_){let z=_.find((A)=>!HS(A.baseURL))??_[0];return UQ(z?.baseURL??VQ)}async function U1(){let _=await T9();return BS(_)}function P_(_){return/\bgit\s+commit\b/.test(_)}function D1(_,z,A){let G=`\uD83D\uDD2E View transcript: ${UQ(A??VQ)}/s/${z}`;if(_.includes(G)||S_(_)===z)return _;let J=`
156
156
 
157
- ${A}`,G=[{regex:/(\s--message=)"([^"]*)"/,quote:'"',equalsForm:!0},{regex:/(\s--message=)'([^']*)'/,quote:"'",equalsForm:!0},{regex:/(\s(?:-m|--message|-am))\s+"([^"]*)"/,quote:'"',equalsForm:!1},{regex:/(\s(?:-m|--message|-am))\s+'([^']*)'/,quote:"'",equalsForm:!1},{regex:/(\s--message=)([^\s"'][^\s]*)(\s|$)/,quote:'"',equalsForm:!0,unquoted:!0},{regex:/(\s(?:-m|--message|-am))\s+([^\s"'-][^\s]*)(\s|$)/,quote:'"',equalsForm:!1,unquoted:!0}];for(let{regex:J,quote:Y,equalsForm:X,unquoted:Q}of G){let $=_.match(J);if($){let H=$[1],B=$[2],Z=$[3]||"";if(Q&&X)return _.replace(J,`${H}${Y}${B}${b}${Y}${Z}`);if(Q)return _.replace(J,`${H} ${Y}${B}${b}${Y}${Z}`);if(X)return _.replace(J,`${H}${Y}${B}${b}${Y}`);return _.replace(J,`${H} ${Y}${B}${b}${Y}`)}}return _}function V1(_){let z=_.match(/agentlogs\.ai\/s\/([a-zA-Z0-9_-]+)/g);if(!z||z.length===0)return;let b=z[z.length-1].match(/agentlogs\.ai\/s\/([a-zA-Z0-9_-]+)/);return b?b[1]:void 0}function U1(_){let z=_.match(/\[[\w/-]+(?:\s+\([^)]+\))?\s+([a-f0-9]{7,40})\]/);return z?z[1]:void 0}function D1(_){let z=_.match(/\[[\w/-]+(?:\s+\([^)]+\))?\s+[a-f0-9]{7,40}\]\s+(.+)/);return z?z[1].trim():void 0}function M1(_){let z=_.match(/\[([\w/-]+)(?:\s+\([^)]+\))?\s+[a-f0-9]{7,40}\]/);return z?z[1]:void 0}async function N1(_){let z=await A4();if(z.length===0){x.warn("Commit tracking skipped: no authenticated environments",{transcriptId:_.transcriptId.substring(0,8)});return}for(let A of z)try{let b=new AbortController,G=setTimeout(()=>b.abort(),5000),J=await fetch(new URL("/api/commit-track",A.baseURL),{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${A.token}`},body:JSON.stringify({transcript_id:_.transcriptId,repo_path:_.repoPath,timestamp:_.timestamp,commit_sha:_.commitSha,commit_title:_.commitTitle,branch:_.branch}),signal:b.signal});if(clearTimeout(G),!J.ok){x.warn(`Commit tracking to ${A.name} failed`,{transcriptId:_.transcriptId.substring(0,8),status:J.status});continue}x.info(`Commit tracked (${A.name})`,{transcriptId:_.transcriptId.substring(0,8)})}catch(b){if(b instanceof Error&&b.name==="AbortError"){x.warn(`Commit tracking to ${A.name} timed out`,{transcriptId:_.transcriptId.substring(0,8)});continue}x.error(`Commit tracking to ${A.name} error`,{transcriptId:_.transcriptId.substring(0,8),error:b instanceof Error?b.message:String(b)})}}var bS=2048;function w1(){return new Promise((_,z)=>{let A="";process.stdin.setEncoding("utf8"),process.stdin.on("data",(b)=>{A+=b}),process.stdin.on("end",()=>{_({preview:A.slice(0,bS),full:A})}),process.stdin.on("error",(b)=>z(b))})}async function VQ(){let _=Date.now(),z,A;try{let{preview:b,full:G}=await w1();if(x.info(`Hook invoked (stdin: ${G.length} bytes)`),!G.trim())x.warn("Hook received empty stdin - ignoring"),process.exit(0);let J=b.includes('"PreToolUse"'),Y=b.includes("git")&&b.includes("commit");if(J&&!Y){let $={hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"allow"}};process.stdout.write(JSON.stringify($));let H=Date.now()-_;x.info(`Hook completed: PreToolUse (fast path, ${H}ms)`),process.exit(0)}let X;try{X=JSON.parse(G)}catch($){x.error("Hook failed to parse stdin JSON",{error:$ instanceof Error?$.message:$}),process.exit(1)}if(z=X.hook_event_name,A=X.session_id||"unknown",!z)x.error("Hook missing event name",{sessionId:A}),process.exit(1);if(x.info(`Hook: ${z} (session: ${A.substring(0,8)}...)`),z==="PreToolUse")await YS(X);else if(z==="PostToolUse")await XS(X);else if(z==="SessionEnd")await QS(X);else if(z==="Stop")await $S(X);else x.debug(`Hook: skipping unsupported event ${z}`);let Q=Date.now()-_;x.info(`Hook completed: ${z} (${Q}ms)`,{sessionId:A.substring(0,8)}),process.exit(0)}catch(b){let G=Date.now()-_;x.error(`Hook failed: ${z||"unknown"} (${G}ms)`,{sessionId:A?.substring(0,8),error:b instanceof Error?b.message:String(b)}),process.exit(1)}}function UQ(_){if(_.tool_input&&typeof _.tool_input==="object"&&typeof _.tool_input.command==="string")return{command:_.tool_input.command,updateCommand:(z)=>{if(_.tool_input)_.tool_input.command=z}};if(typeof _.command==="string")return{command:_.command,updateCommand:(z)=>{_.command=z}};return{command:void 0,updateCommand:()=>{}}}function GS(_){if(_.tool_response?.stdout)return _.tool_response.stdout;if(_.tool_response)return JSON.stringify(_.tool_response);return}function JS(_){if(typeof _.repo_path==="string")return _.repo_path;if(typeof _.cwd==="string")return _.cwd;return""}async function YS(_){let z=_.session_id||"unknown",A=!1,b=!1,{command:G,updateCommand:J}=UQ(_),Y=typeof _.tool_name==="string"?_.tool_name:_.tool,X=Y?Y.toLowerCase()==="bash":Boolean(G),Q=typeof _.cwd==="string"?_.cwd:void 0,$=await a0(Q),H=t9($);if(X&&G&&P_(G)&&H){A=!0;let Z=await z4(z),F=W1(G,Z);if(F!==G)J(F),b=!0}let B=b?{hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"allow",updatedInput:_.tool_input}}:{hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"allow"}};if(process.stdout.write(JSON.stringify(B)),A)await HS({sessionId:z,transcriptPath:_.transcript_path,cwd:typeof _.cwd==="string"?_.cwd:void 0});x.info("PreToolUse handled",{sessionId:z.substring(0,8),shouldTrack:A,modified:b})}async function XS(_){let z=_.session_id||"unknown",A=JS(_),{command:b}=UQ(_);if(!b||!P_(b))return;let G=V1(b);if(!G){x.debug("PostToolUse: git commit without agentlogs link",{sessionId:z.substring(0,8)});return}let J=GS(_),Y=J?U1(J):void 0,X=J?D1(J):void 0,Q=J?M1(J):void 0;await N1({transcriptId:G,repoPath:A,timestamp:new Date().toISOString(),commitSha:Y,commitTitle:X,branch:Q}),x.info("PostToolUse: tracked commit",{sessionId:z.substring(0,8),transcriptId:G,commitSha:Y?.substring(0,8)})}async function QS(_){let z=_.transcript_path,A=_.session_id||"unknown";if(!z){x.error("SessionEnd: missing transcript_path",{sessionId:A});return}try{let b=await P4({transcriptPath:z,sessionId:_.session_id,cwdOverride:_.cwd});if(b.results.length===0){if(!b.anySuccess)x.info("SessionEnd: upload skipped (repo not allowed or no auth)",{sessionId:A});return}for(let G of b.results)if(G.success)x.info(`SessionEnd: uploaded to ${G.envName} (${b.eventCount} events)`,{transcriptId:G.transcriptId,sessionId:A.substring(0,8)});else x.error(`SessionEnd: upload to ${G.envName} failed`,{sessionId:A,error:G.error})}catch(b){x.error("SessionEnd: upload error",{sessionId:A,error:b instanceof Error?b.message:String(b)})}}async function $S(_){let z=_.transcript_path,A=_.session_id||"unknown";if(!z){x.error("Stop: missing transcript_path",{sessionId:A});return}if(_.stop_hook_active){x.debug("Stop: skipped (stop_hook_active=true)",{sessionId:A});return}try{let b=await P4({transcriptPath:z,sessionId:_.session_id,cwdOverride:_.cwd});if(b.results.length===0){if(!b.anySuccess)x.info("Stop: upload skipped (repo not allowed or no auth)",{sessionId:A});return}for(let G of b.results)if(G.success)x.info(`Stop: uploaded to ${G.envName} (${b.eventCount} events)`,{transcriptId:G.transcriptId,sessionId:A.substring(0,8)});else x.error(`Stop: upload to ${G.envName} failed`,{sessionId:A,error:G.error})}catch(b){x.error("Stop: upload error",{sessionId:A,error:b instanceof Error?b.message:String(b)})}}async function HS(_){if(!_.transcriptPath){x.warn("Partial upload skipped: missing transcript_path",{sessionId:_.sessionId.substring(0,8)});return}try{let z=await P4({transcriptPath:_.transcriptPath,sessionId:_.sessionId,cwdOverride:_.cwd});if(z.results.length===0){if(!z.anySuccess)x.info("Partial upload: skipped (repo not allowed or no auth)",{sessionId:_.sessionId.substring(0,8)});return}for(let A of z.results)if(A.success)x.info(`Partial upload: uploaded to ${A.envName}`,{transcriptId:A.transcriptId,sessionId:_.sessionId.substring(0,8),eventCount:z.eventCount});else x.error(`Partial upload: to ${A.envName} failed`,{sessionId:_.sessionId.substring(0,8),error:A.error})}catch(z){x.error("Partial upload: error",{sessionId:_.sessionId.substring(0,8),error:z instanceof Error?z.message:String(z)})}}import{createHash as BS}from"crypto";import{promises as j6}from"fs";import{homedir as ZS}from"os";import{basename as FS,extname as KS,join as R6,relative as qS,resolve as WS}from"path";var VS=R6(ZS(),".claude");async function DQ(_={}){let{repoFilter:z,claudeDir:A}=_,b=await A4();if(b.length===0)console.error("You must be logged in to sync transcripts."),console.error("Run `agentlogs login` to authenticate"),process.exit(1);let G=A?WS(A):process.env.CLAUDE_HOME??VS,J=R6(G,"projects"),Y=await DS(J);if(Y.length===0){console.log(`No local Claude Code transcripts were found under ${J}. Nothing to sync.`);return}let X=z?Y.filter(($)=>$.repoId===z):Y;if(z&&X.length===0){let $=Y.filter((H)=>H.repoId===null).length;if(console.log(`No local Claude Code transcripts matched repo ${z}.`),$>0)console.log(`${$} transcript(s) were skipped because their repo could not be determined.`);return}let Q=b.map(($)=>$.name).join(", ");console.log(`Syncing to environments: ${Q}`),console.log(`Found ${X.length} local transcript(s)
158
- `);for(let $ of b)await US($,X,z)}async function US(_,z,A){let b=_.name==="dev"?"Development":"Production";console.log(`
159
- --- ${b} (${_.baseURL}) ---`);try{let G=await BX({serverUrl:_.baseURL,authToken:_.token}),J=A?G.filter((F)=>F.repoId===A):G,Y=new Map;for(let F of J)Y.set(F.transcriptId,F.sha256);let X=z.filter((F)=>{let K=Y.get(F.transcriptId);return!K||K!==F.sha256});if(X.length===0){console.log("All local transcripts are up to date.");return}console.log(`Uploading ${X.length} transcript(s)...`);let Q=0,$=0,H=0,B=[];for(let[F,K]of X.entries()){let q=`${F+1}/${X.length}`,W=K.repoId?` • ${K.repoId}`:"",V=`${K.transcriptId} – ${K.displayPath}${W}`;try{let w=await BQ({transcriptPath:K.path,sessionId:K.transcriptId,cwdOverride:K.cwd??void 0},{serverUrl:_.baseURL,authToken:_.token});if(w.skipped)$+=1,console.log(`[${q}] - ${V} • skipped (repo not allowed)`);else if(w.success)Q+=1,console.log(`[${q}] ✓ ${V} • ${w.eventCount} events${w.transcriptId?` → ${w.transcriptId}`:""}`);else{H+=1;let O="Upload returned unsuccessful response.";console.error(`[${q}] ✗ ${V} • ${O}`),B.push({transcriptId:K.transcriptId,displayPath:K.displayPath,reason:O})}}catch(w){H+=1;let O=w instanceof Error?w.message:String(w);console.error(`[${q}] ✗ ${V} • ${O}`),B.push({transcriptId:K.transcriptId,displayPath:K.displayPath,reason:O})}}let Z=$>0?`, ${$} skipped`:"";if(console.log(`Sync complete: ${Q} uploaded, ${H} failed${Z}.`),B.length>0){console.error("Failed transcript details:");for(let F of B.slice(0,10))console.error(` - ${F.transcriptId} (${F.displayPath}): ${F.reason}`);if(B.length>10)console.error(` …and ${B.length-10} more failures.`)}}catch(G){console.error(`Error syncing to ${b}: ${G instanceof Error?G.message:String(G)}`)}}async function DS(_){if(!await MQ(_))return[];let z=await j6.readdir(_,{withFileTypes:!0}),A=[],G=await new r0().fetchModelPricing(),J=Object.fromEntries(G);for(let Y of z){if(!Y.isDirectory())continue;let X=R6(_,Y.name),Q=await j6.readdir(X,{withFileTypes:!0});for(let $ of Q){if(!$.isFile()||KS($.name)!==".jsonl")continue;let H=R6(X,$.name),B=FS($.name,".jsonl");try{let Z=await j6.readFile(H,"utf8"),F=NS(Z),K=await ES(F),q=MS(Z),W=wS(q),V=F?await e0(F,W):null,w=A6(q,{pricing:J,gitContext:V});if(!w){console.warn(`Skipped transcript at ${H}: Could not convert to unified format`);continue}let O=L_(w.transcript),M=JSON.stringify(O),P=BS("sha256").update(M).digest("hex");A.push({transcriptId:B,path:H,sha256:P,cwd:F,repoId:K,displayPath:qS(_,H)||$.name})}catch(Z){console.warn(`Skipped transcript at ${H}: ${Z.message}`)}}}return A}async function MQ(_){try{return(await j6.stat(_)).isDirectory()}catch{return!1}}function MS(_){let z=_.split(/\r?\n/),A=[];for(let b of z){let G=b.trim();if(!G)continue;try{let J=JSON.parse(G);if(typeof J==="object"&&J!==null)A.push(J)}catch{continue}}return A}function NS(_){let z=_.split(/\r?\n/);for(let A of z){let b=A.trim();if(!b)continue;try{let J=JSON.parse(b)?.cwd;if(typeof J==="string"&&J.length>0)return J}catch{continue}}return null}function wS(_){for(let z of _){let A=typeof z.gitBranch==="string"?z.gitBranch.trim():"";if(A)return A}return}async function ES(_){if(!_)return null;if(!await MQ(_))return null;try{return uY(_).repoId}catch{return null}}async function P6(_,z="claude-code"){if(!_)console.error("The upload command expects a <transcript> argument."),process.exit(1);let A=ZQ(_);if(!A)console.error(`Transcript file not found for path: ${_}`),process.exit(1);let b=await A4();if(b.length===0)console.error("You must be logged in to upload transcripts."),console.error("Run `agentlogs login` to authenticate"),process.exit(1);let G=z==="codex"?"Codex":"Claude Code",J=b.map((Y)=>Y.name).join(", ");console.log(`Uploading ${G} transcript from ${A}`),console.log(`Target environments: ${J}`);try{let Y=await P4({transcriptPath:A,source:z});if(Y.results.length===0){console.log(""),console.log("- Upload skipped (repo not allowed by allowlist)"),console.log(" Use `agentlogs allow` to enable uploads for this repo.");return}console.log("");for(let X of Y.results){let Q=X.envName==="dev"?"Development":"Production";if(X.success){if(console.log(`✓ ${Q}: uploaded successfully`),X.id)console.log(` ID: ${X.id}`);if(X.transcriptId)console.log(` Transcript ID: ${X.transcriptId}`)}else if(console.log(`✗ ${Q}: upload failed`),X.error)console.log(` Error: ${X.error}`)}if(console.log(""),Y.allSuccess)console.log(`✓ Upload complete (${Y.eventCount} events)`);else if(Y.anySuccess)console.log(`⚠ Partial upload (${Y.eventCount} events) - some environments failed`),process.exit(1);else console.error("✗ Upload failed for all environments"),process.exit(1)}catch(Y){console.error(Y instanceof Error?Y.message:"Unexpected error occurred while uploading transcript."),process.exit(1)}}async function NQ(_){await P6(_,"claude-code")}async function wQ(_){await P6(_,"codex")}import{spawnSync as OS}from"child_process";function LS(_){try{let z=OS("opencode",["export",_],{encoding:"utf-8",timeout:30000,stdio:["pipe","pipe","pipe"]});if(z.status!==0||z.error)return null;let A=z.stdout.trim();if(!A)return null;return JSON.parse(A)}catch{return null}}async function EQ(_){if(!_)console.error("Error: Session ID is required"),process.exit(1);console.log(`Uploading OpenCode session: ${_}`);let z=LS(_);if(!z)console.error(`Error: Session not found: ${_}`),console.error("Run 'opencode session list' to see available sessions"),process.exit(1);if(z.info.parentID)console.log("Skipping subagent session"),process.exit(0);let A=z.info.title||"Untitled",b=z.messages?.length??0;console.log(`Session: "${A}" (${b} messages)`);let J=await new r0().fetchModelPricing(),Y=Object.fromEntries(J),X=z.info.directory??process.cwd(),Q=await e0(X,void 0);if(Q?.repo)console.log(`Repository: ${Q.repo}`);console.log("Converting transcript...");let $=E_(z,{pricing:Y,gitContext:Q,cwd:X});if(!$)console.error("Error: Failed to convert transcript"),process.exit(1);console.log("Uploading...");let H=await E9({unifiedTranscript:$,sessionId:_,cwd:X,rawTranscript:JSON.stringify(z)});if(H.skipped)console.log("Skipped: Repository not in allowlist"),process.exit(0);if(H.anySuccess&&H.id){console.log(""),console.log("Upload successful!"),console.log(`Transcript ID: ${H.id}`);for(let B of H.results)if(B.success){let Z=`${B.baseURL}/app/logs/${H.id}`;console.log(`View: ${Z}`)}}else{console.error(""),console.error("Upload failed:");for(let B of H.results)if(!B.success&&B.error)console.error(` ${B.envName}: ${B.error}`);process.exit(1)}}import{spawnSync as jS}from"child_process";async function OQ(){let _=Date.now(),z,A;try{let{preview:b,full:G}=await w1();if(x.info(`OpenCode hook invoked (stdin: ${G.length} bytes)`),!G.trim())x.warn("OpenCode hook received empty stdin - ignoring"),B4({modified:!1}),process.exit(0);let J=b.includes("tool.execute.before"),Y=b.includes("git")&&b.includes("commit");if(J&&!Y){B4({modified:!1});let $=Date.now()-_;x.info(`OpenCode hook completed: tool.execute.before (fast path, ${$}ms)`),process.exit(0)}let X;try{X=JSON.parse(G)}catch($){x.error("OpenCode hook failed to parse stdin JSON",{error:$ instanceof Error?$.message:$}),B4({modified:!1}),process.exit(1)}if(z=X.hook_event_name,A=X.session_id||"unknown",!z)x.error("OpenCode hook missing event name",{sessionId:A}),B4({modified:!1}),process.exit(1);if(x.info(`OpenCode hook: ${z} (session: ${A.substring(0,8)}...)`),z==="tool.execute.before")await RS(X);else if(z==="tool.execute.after")await PS(X),B4({modified:!1});else if(z==="session.idle")await SS(X),B4({modified:!1});else x.debug(`OpenCode hook: skipping unsupported event ${z}`),B4({modified:!1});let Q=Date.now()-_;x.info(`OpenCode hook completed: ${z} (${Q}ms)`,{sessionId:A.substring(0,8)}),process.exit(0)}catch(b){let G=Date.now()-_;x.error(`OpenCode hook failed: ${z||"unknown"} (${G}ms)`,{sessionId:A?.substring(0,8),error:b instanceof Error?b.message:String(b)}),B4({modified:!1}),process.exit(1)}}function B4(_){process.stdout.write(JSON.stringify(_))}async function RS(_){let{session_id:z,call_id:A}=_,b=_.tool||"",G=_.tool_input||{},J=typeof G.command==="string"?G.command:"",Y=_.cwd,X=b==="bash",Q=await a0(Y),$=t9(Q);if(X&&P_(J)&&$){let H=await z4(z),B=W1(J,H);if(B!==J){if(x.info("OpenCode hook: intercepting git commit",{sessionId:z.substring(0,8),transcriptId:H,callId:A}),A)await Yz(A,H);await kS(z,Y),B4({modified:!0,args:{...G,command:B}});return}}B4({modified:!1})}async function PS(_){let{session_id:z,call_id:A}=_,b=_.tool||"",G=_.tool_output||{},J=_.cwd||"";if(b!=="bash")return;let X=G.output||"",Q=V1(X),$=!1;if(!Q&&A)Q=await Xz(A),$=!0;if(!Q)return;if(A)await Qz(A);let H=U1(X),B=D1(X),Z=M1(X);if(!H){x.debug("OpenCode PostToolUse: found link but no commit SHA",{sessionId:z.substring(0,8),transcriptId:Q,fromCache:$});return}await N1({transcriptId:Q,repoPath:J,timestamp:new Date().toISOString(),commitSha:H,commitTitle:B,branch:Z}),x.info("OpenCode PostToolUse: tracked commit",{sessionId:z.substring(0,8),transcriptId:Q,commitSha:H.substring(0,8),fromCache:$})}async function SS(_){let{session_id:z,cwd:A}=_;x.info("OpenCode session.idle: uploading transcript",{sessionId:z.substring(0,8)}),await IS(z,A)}function LQ(_){try{let z=jS("opencode",["export",_],{encoding:"utf-8",timeout:30000,stdio:["pipe","pipe","pipe"]});if(z.status!==0||z.error)return x.warn("OpenCode export failed",{sessionId:_.substring(0,8),error:z.error?.message||z.stderr}),null;let A=z.stdout.trim();if(!A)return null;return JSON.parse(A)}catch(z){return x.error("OpenCode export error",{sessionId:_.substring(0,8),error:z instanceof Error?z.message:String(z)}),null}}async function kS(_,z){let A=LQ(_);if(!A){x.warn("OpenCode partial upload: session not found",{sessionId:_.substring(0,8)});return}await jQ(A,_,z,"partial")}async function IS(_,z){let A=LQ(_);if(!A){x.warn("OpenCode full upload: session not found",{sessionId:_.substring(0,8)});return}if(A.info.parentID){x.debug("OpenCode full upload: skipping subagent session",{sessionId:_.substring(0,8)});return}await jQ(A,_,z,"full")}async function jQ(_,z,A,b="full"){try{let J=await new r0().fetchModelPricing(),Y=Object.fromEntries(J),X=A||_.info.directory||process.cwd(),Q=await e0(X,void 0),$=E_(_,{pricing:Y,gitContext:Q,cwd:X});if(!$){x.error(`OpenCode ${b} upload: failed to convert transcript`,{sessionId:z.substring(0,8)});return}let H=await E9({unifiedTranscript:$,sessionId:z,cwd:X,rawTranscript:JSON.stringify(_)});if(H.skipped){x.info(`OpenCode ${b} upload: skipped (repo not allowed)`,{sessionId:z.substring(0,8)});return}for(let B of H.results)if(B.success)x.info(`OpenCode ${b} upload: success (${B.envName})`,{sessionId:z.substring(0,8),transcriptId:H.id});else x.error(`OpenCode ${b} upload: failed (${B.envName})`,{sessionId:z.substring(0,8),error:B.error})}catch(G){x.error(`OpenCode ${b} upload: error`,{sessionId:z.substring(0,8),error:G instanceof Error?G.message:String(G)})}}import{existsSync as O1,readFileSync as z2,readdirSync as S6}from"fs";import{join as E1,basename as xS}from"path";import{homedir as RQ}from"os";var t4=E1(RQ(),".pi","agent","sessions");function TS(_){if(!O1(_))return null;let A=z2(_,"utf-8").split(`
160
- `).filter((J)=>J.trim());if(A.length===0)return null;let b=JSON.parse(A[0]),G=[];for(let J=1;J<A.length;J++)try{G.push(JSON.parse(A[J]))}catch{}return{header:b,entries:G}}function CS(_){if(!O1(t4))return null;for(let z of S6(t4)){let A=E1(t4,z);if(!O1(A))continue;for(let b of S6(A)){if(!b.endsWith(".jsonl"))continue;if(b.includes(_))return E1(A,b);let G=E1(A,b);try{let J=z2(G,"utf-8").split(`
161
- `)[0];if(JSON.parse(J).id===_)return G}catch{}}}return null}function vS(_=10){let z=[];if(!O1(t4))return z;for(let A of S6(t4)){let b=E1(t4,A);if(!O1(b))continue;for(let G of S6(b)){if(!G.endsWith(".jsonl"))continue;let J=E1(b,G);try{let Y=z2(J,"utf-8").split(`
162
- `)[0],X=JSON.parse(Y);z.push({path:J,id:X.id,timestamp:X.timestamp,cwd:X.cwd})}catch{}}}return z.sort((A,b)=>b.timestamp.localeCompare(A.timestamp)),z.slice(0,_)}async function PQ(_){if(!_){console.log("Recent Pi sessions:"),console.log("");let F=vS(10);if(F.length===0)console.log("No sessions found in",t4),process.exit(1);for(let K of F){let W=new Date(K.timestamp).toLocaleString();console.log(` ${K.id.substring(0,8)}... ${W}`),console.log(` ${K.cwd}`),console.log("")}console.log("Usage: agentlogs pi upload <session-id-or-path>"),process.exit(0)}let z,A=_.startsWith("~")?_.replace(/^~/,RQ()):_;if(O1(A))z=A;else{let F=CS(_);if(!F)console.error(`Error: Session not found: ${_}`),console.error(`Searched in: ${t4}`),process.exit(1);z=F}console.log(`Uploading Pi session: ${xS(z)}`);let b=TS(z);if(!b)console.error(`Error: Failed to read session file: ${z}`),process.exit(1);let G=b.entries.filter((F)=>F.type==="message").length;console.log(`Session: ${b.header.id.substring(0,8)}... (${G} messages)`);let Y=await new r0().fetchModelPricing(),X=Object.fromEntries(Y),Q=b.header.cwd??process.cwd(),$=await e0(Q,void 0);if($?.repo)console.log(`Repository: ${$.repo}`);console.log("Converting transcript...");let H=O_(b,{pricing:X,gitContext:$,cwd:Q});if(!H)console.error("Error: Failed to convert transcript"),process.exit(1);let B=[];for(let[F,K]of H.blobs)B.push({sha256:F,data:new Uint8Array(K.data),mediaType:K.mediaType});console.log("Uploading...");let Z=await E9({unifiedTranscript:H.transcript,sessionId:b.header.id,cwd:Q,rawTranscript:JSON.stringify(b),blobs:B.length>0?B:void 0});if(Z.skipped)console.log("Skipped: Repository not in allowlist"),process.exit(0);if(Z.anySuccess&&Z.id){console.log(""),console.log("Upload successful!"),console.log(`Transcript ID: ${Z.id}`);for(let F of Z.results)if(F.success){let K=`${F.baseURL}/app/logs/${Z.id}`;console.log(`View: ${K}`)}}else{console.error(""),console.error("Upload failed:");for(let F of Z.results)if(!F.success&&F.error)console.error(` ${F.envName}: ${F.error}`);process.exit(1)}}import{existsSync as yS,readFileSync as gS}from"fs";async function SQ(){let _=Date.now(),z,A;try{let{preview:b,full:G}=await w1();if(x.info(`Pi hook invoked (stdin: ${G.length} bytes)`),!G.trim())x.warn("Pi hook received empty stdin - ignoring"),u9({modified:!1}),process.exit(0);let J=b.includes("tool_call")&&!b.includes("tool_call_id"),Y=b.includes("git")&&b.includes("commit");if(J&&!Y){u9({modified:!1});let $=Date.now()-_;x.info(`Pi hook completed: tool_call (fast path, ${$}ms)`),process.exit(0)}let X;try{X=JSON.parse(G)}catch($){x.error("Pi hook failed to parse stdin JSON",{error:$ instanceof Error?$.message:$}),u9({modified:!1}),process.exit(1)}if(z=X.hook_event_name,A=X.session_id||"unknown",!z)x.error("Pi hook missing event name",{sessionId:A}),u9({modified:!1}),process.exit(1);if(x.info(`Pi hook: ${z} (session: ${A.substring(0,8)}...)`),z==="tool_call")await fS(X);else if(z==="tool_result")await hS(X),u9({modified:!1});else if(z==="session_shutdown")await mS(X),u9({modified:!1});else if(z==="agent_end")await uS(X),u9({modified:!1});else x.debug(`Pi hook: skipping unsupported event ${z}`),u9({modified:!1});let Q=Date.now()-_;x.info(`Pi hook completed: ${z} (${Q}ms)`,{sessionId:A.substring(0,8)}),process.exit(0)}catch(b){let G=Date.now()-_;x.error(`Pi hook failed: ${z||"unknown"} (${G}ms)`,{sessionId:A?.substring(0,8),error:b instanceof Error?b.message:String(b)}),u9({modified:!1}),process.exit(1)}}function u9(_){process.stdout.write(JSON.stringify(_))}async function fS(_){let{session_id:z,tool_call_id:A}=_,b=_.tool||"",G=_.tool_input||{},J=typeof G.command==="string"?G.command:"",Y=_.cwd,X=b.toLowerCase()==="bash",Q=await a0(Y),$=t9(Q);if(X&&P_(J)&&$){let H=await z4(z),B=W1(J,H);if(B!==J){if(x.info("Pi hook: intercepting git commit",{sessionId:z.substring(0,8),transcriptId:H,toolCallId:A}),A)await Yz(A,H);await cS(_),u9({modified:!0,updatedInput:{...G,command:B}});return}}u9({modified:!1})}async function hS(_){let{session_id:z,tool_call_id:A}=_,b=_.tool||"",G=_.tool_output||{},J=_.cwd||"";if(b.toLowerCase()!=="bash")return;let X=G.stdout||G.content||"",Q=typeof X==="string"?X:JSON.stringify(X),$=V1(Q),H=!1;if(!$&&A)$=await Xz(A),H=!0;if(!$)return;if(A)await Qz(A);let B=U1(Q),Z=D1(Q),F=M1(Q);if(!B){x.debug("Pi tool_result: found link but no commit SHA",{sessionId:z.substring(0,8),transcriptId:$,fromCache:H});return}await N1({transcriptId:$,repoPath:J,timestamp:new Date().toISOString(),commitSha:B,commitTitle:Z,branch:F}),x.info("Pi tool_result: tracked commit",{sessionId:z.substring(0,8),transcriptId:$,commitSha:B.substring(0,8),fromCache:H})}async function mS(_){let z=_.session_id;x.info("Pi session_shutdown: uploading transcript",{sessionId:z.substring(0,8)}),await IQ(_)}async function uS(_){let z=_.session_id;x.info("Pi agent_end: uploading transcript",{sessionId:z.substring(0,8)}),await IQ(_)}function kQ(_){if(!yS(_))return null;try{let A=gS(_,"utf-8").split(`
163
- `).filter((J)=>J.trim());if(A.length===0)return null;let b=JSON.parse(A[0]),G=[];for(let J=1;J<A.length;J++)try{G.push(JSON.parse(A[J]))}catch{}return{header:b,entries:G}}catch(z){return x.error("Pi: failed to read session file",{sessionFile:_,error:z instanceof Error?z.message:String(z)}),null}}async function cS(_){let{session_id:z,cwd:A,session_data:b}=_;if(!b&&_.session_file)b=kQ(_.session_file)??void 0;if(!b){x.warn("Pi partial upload: no session data available",{sessionId:z.substring(0,8)});return}await xQ(b,z,A,_.leaf_id,"partial")}async function IQ(_){let{session_id:z,cwd:A,session_data:b}=_;if(!b&&_.session_file)b=kQ(_.session_file)??void 0;if(!b){x.warn("Pi full upload: no session data available",{sessionId:z.substring(0,8)});return}await xQ(b,z,A,_.leaf_id,"full")}async function xQ(_,z,A,b,G="full"){try{let Y=await new r0().fetchModelPricing(),X=Object.fromEntries(Y),Q=A||_.header.cwd||process.cwd(),$=await e0(Q,void 0),H=O_(_,{pricing:X,gitContext:$,cwd:Q,leafId:b});if(!H){x.error(`Pi ${G} upload: failed to convert transcript`,{sessionId:z.substring(0,8)});return}let B=await E9({unifiedTranscript:H.transcript,sessionId:z,cwd:Q,rawTranscript:JSON.stringify(_)});if(B.skipped){x.info(`Pi ${G} upload: skipped (repo not allowed)`,{sessionId:z.substring(0,8)});return}for(let Z of B.results)if(Z.success)x.info(`Pi ${G} upload: success (${Z.envName})`,{sessionId:z.substring(0,8),transcriptId:B.id});else x.error(`Pi ${G} upload: failed (${Z.envName})`,{sessionId:z.substring(0,8),error:Z.error})}catch(J){x.error(`Pi ${G} upload: error`,{sessionId:z.substring(0,8),error:J instanceof Error?J.message:String(J)})}}import{spawn as dS}from"child_process";import{existsSync as k6,readFileSync as hQ}from"fs";import{createInterface as rS}from"readline";import{dirname as nS,resolve as gQ}from"path";import{fileURLToPath as iS}from"url";import{homedir as TQ}from"os";import{join as S_}from"path";var L1=S_(TQ(),".agentlogs"),j1=S_(L1,"service.pid"),CQ=S_(L1,"service.sock"),vQ=S_(L1,"service.log"),lS=S_(TQ(),".codex"),Pe=S_(lS,"sessions"),R1=S_(L1,"watcher-events.log");import{createServer as Ie,connect as pS}from"net";function k_(){return new Promise((_,z)=>{let A=pS(CQ);A.on("connect",()=>{_(A)}),A.on("error",(b)=>{z(b)})})}function xz(_,z){_.write(JSON.stringify(z)+`
164
- `)}function yQ(_,z,A=5000){return new Promise((b,G)=>{let J="",Y=setTimeout(()=>{G(Error("Timeout waiting for response"))},A),X=(Q)=>{J+=Q.toString();let $=J.split(`
165
- `);J=$.pop()||"";for(let H of $){if(!H.trim())continue;try{let B=JSON.parse(H);if(B.type===z)clearTimeout(Y),_.off("data",X),b(B.data)}catch{}}};_.on("data",X)})}var oS=iS(import.meta.url),fQ=nS(oS);function I6(){if(!k6(j1))return{running:!1};try{let _=parseInt(hQ(j1,"utf-8").trim());return process.kill(_,0),{running:!0,pid:_}}catch{return{running:!1}}}async function mQ(){let _=I6();if(_.running){console.log(`Service already running (PID: ${_.pid})`);return}let z=gQ(fQ,"../../service/server.ts"),A=gQ(fQ,"../../service/server.js"),b=k6(z)?z:A;if(!k6(b))console.error(`Service script not found at ${b}`),process.exit(1);let G=dS("bun",["run",b],{detached:!0,stdio:"ignore",env:{...process.env}});G.unref(),console.log(`Service starting (PID: ${G.pid})...`);let J=50;for(let Y=0;Y<J;Y++)try{(await k_()).end(),console.log("Service ready");return}catch{await new Promise((X)=>setTimeout(X,100))}console.error("Service failed to start. Check logs:"),console.error(` tail -f ${vQ}`),process.exit(1)}async function uQ(){let _=I6();if(!_.running){console.log("Service is not running");return}try{let z=await k_();if(xz(z,{type:"shutdown"}),z.end(),console.log("Shutdown signal sent"),await new Promise((b)=>setTimeout(b,1000)),I6().running)process.kill(_.pid,"SIGTERM"),console.log(`Sent SIGTERM to PID ${_.pid}`)}catch{if(_.pid)process.kill(_.pid,"SIGTERM"),console.log(`Sent SIGTERM to PID ${_.pid}`)}}async function cQ(){let _=I6();if(!_.running){console.log("Service: not running");return}console.log(`Service: running (PID: ${_.pid})`);try{let z=await k_();xz(z,{type:"status"});let A=await yQ(z,"status_response");if(z.end(),console.log(`Connections: ${A.connections}`),console.log(`Watching: ${A.watching}`),console.log(`Uptime: ${Math.round(A.uptime/1000)}s`),A.lastEvent){let b=Math.round((Date.now()-A.lastEvent.timestamp)/1000);console.log(`Last event: ${A.lastEvent.type} (${b}s ago)`),console.log(` Path: ${A.lastEvent.path}`)}}catch{console.log("Could not connect to service for status")}}async function lQ(){if(!k6(R1)){console.log("No watcher logs yet"),console.log(`Log file: ${R1}`);return}console.log(`Tailing ${R1} (Ctrl+C to stop)
166
- `);let A=hQ(R1,"utf-8").trim().split(`
167
- `).slice(-20);for(let Y of A)try{let X=JSON.parse(Y),Q=new Date(X.timestamp).toISOString();console.log(`[${Q}] ${X.type}: ${X.path}`)}catch{console.log(Y)}let{spawn:b}=await import("child_process"),G=b("tail",["-f",R1],{stdio:["ignore","pipe","inherit"]});rS({input:G.stdout}).on("line",(Y)=>{try{let X=JSON.parse(Y),Q=new Date(X.timestamp).toISOString();console.log(`[${Q}] ${X.type}: ${X.path}`)}catch{console.log(Y)}}),await new Promise(()=>{})}import{spawn as Ru}from"child_process";import{existsSync as Eb,readFileSync as Pu,appendFileSync as Su}from"fs";import{dirname as ku,resolve as Ob}from"path";import{fileURLToPath as Iu}from"url";var ce=Object.freeze({status:"aborted"});function E(_,z,A){function b(X,Q){if(!X._zod)Object.defineProperty(X,"_zod",{value:{def:Q,constr:Y,traits:new Set},enumerable:!1});if(X._zod.traits.has(_))return;X._zod.traits.add(_),z(X,Q);let $=Y.prototype,H=Object.keys($);for(let B=0;B<H.length;B++){let Z=H[B];if(!(Z in X))X[Z]=$[Z].bind(X)}}let G=A?.Parent??Object;class J extends G{}Object.defineProperty(J,"name",{value:_});function Y(X){var Q;let $=A?.Parent?new J:this;b($,X),(Q=$._zod).deferred??(Q.deferred=[]);for(let H of $._zod.deferred)H();return $}return Object.defineProperty(Y,"init",{value:b}),Object.defineProperty(Y,Symbol.hasInstance,{value:(X)=>{if(A?.Parent&&X instanceof A.Parent)return!0;return X?._zod?.traits?.has(_)}}),Object.defineProperty(Y,"name",{value:_}),Y}var le=Symbol("zod_brand");class S4 extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Tz extends Error{constructor(_){super(`Encountered unidirectional transform during encode: ${_}`);this.name="ZodEncodeError"}}var x6={};function O9(_){if(_)Object.assign(x6,_);return x6}var X0={};A8(X0,{unwrapMessage:()=>Cz,uint8ArrayToHex:()=>Mk,uint8ArrayToBase64url:()=>Uk,uint8ArrayToBase64:()=>aQ,stringifyPrimitive:()=>y6,slugify:()=>G2,shallowClone:()=>dQ,safeExtend:()=>Zk,required:()=>qk,randomString:()=>Jk,propertyKeyTypes:()=>Y2,promiseAllObject:()=>Gk,primitiveTypes:()=>rQ,prefixIssues:()=>x4,pick:()=>$k,partial:()=>Kk,parsedType:()=>$2,optionalKeys:()=>X2,omit:()=>Hk,objectClone:()=>zk,numKeys:()=>Yk,nullish:()=>yz,normalizeParams:()=>c,mergeDefs:()=>k4,merge:()=>Fk,jsonStringifyReplacer:()=>P1,joinValues:()=>T6,issue:()=>k1,isPlainObject:()=>__,isObject:()=>I_,hexToUint8Array:()=>Dk,getSizableOrigin:()=>iQ,getParsedType:()=>Xk,getLengthableOrigin:()=>fz,getEnumValues:()=>vz,getElementAtPath:()=>bk,floatSafeRemainder:()=>b2,finalizeIssue:()=>l9,extend:()=>Bk,escapeRegex:()=>I4,esc:()=>C6,defineLazy:()=>H0,createTransparentProxy:()=>Qk,cloneDef:()=>Ak,clone:()=>c9,cleanRegex:()=>gz,cleanEnum:()=>Wk,captureStackTrace:()=>v6,cached:()=>S1,base64urlToUint8Array:()=>Vk,base64ToUint8Array:()=>oQ,assignProp:()=>e4,assertNotEqual:()=>sS,assertNever:()=>eS,assertIs:()=>tS,assertEqual:()=>aS,assert:()=>_k,allowsEval:()=>J2,aborted:()=>z_,NUMBER_FORMAT_RANGES:()=>Q2,Class:()=>sQ,BIGINT_FORMAT_RANGES:()=>nQ});function aS(_){return _}function sS(_){return _}function tS(_){}function eS(_){throw Error("Unexpected value in exhaustive check")}function _k(_){}function vz(_){let z=Object.values(_).filter((b)=>typeof b==="number");return Object.entries(_).filter(([b,G])=>z.indexOf(+b)===-1).map(([b,G])=>G)}function T6(_,z="|"){return _.map((A)=>y6(A)).join(z)}function P1(_,z){if(typeof z==="bigint")return z.toString();return z}function S1(_){return{get value(){{let A=_();return Object.defineProperty(this,"value",{value:A}),A}throw Error("cached value already set")}}}function yz(_){return _===null||_===void 0}function gz(_){let z=_.startsWith("^")?1:0,A=_.endsWith("$")?_.length-1:_.length;return _.slice(z,A)}function b2(_,z){let A=(_.toString().split(".")[1]||"").length,b=z.toString(),G=(b.split(".")[1]||"").length;if(G===0&&/\d?e-\d?/.test(b)){let Q=b.match(/\d?e-(\d?)/);if(Q?.[1])G=Number.parseInt(Q[1])}let J=A>G?A:G,Y=Number.parseInt(_.toFixed(J).replace(".","")),X=Number.parseInt(z.toFixed(J).replace(".",""));return Y%X/10**J}var pQ=Symbol("evaluating");function H0(_,z,A){let b=void 0;Object.defineProperty(_,z,{get(){if(b===pQ)return;if(b===void 0)b=pQ,b=A();return b},set(G){Object.defineProperty(_,z,{value:G})},configurable:!0})}function zk(_){return Object.create(Object.getPrototypeOf(_),Object.getOwnPropertyDescriptors(_))}function e4(_,z,A){Object.defineProperty(_,z,{value:A,writable:!0,enumerable:!0,configurable:!0})}function k4(..._){let z={};for(let A of _){let b=Object.getOwnPropertyDescriptors(A);Object.assign(z,b)}return Object.defineProperties({},z)}function Ak(_){return k4(_._zod.def)}function bk(_,z){if(!z)return _;return z.reduce((A,b)=>A?.[b],_)}function Gk(_){let z=Object.keys(_),A=z.map((b)=>_[b]);return Promise.all(A).then((b)=>{let G={};for(let J=0;J<z.length;J++)G[z[J]]=b[J];return G})}function Jk(_=10){let A="";for(let b=0;b<_;b++)A+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return A}function C6(_){return JSON.stringify(_)}function G2(_){return _.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var v6="captureStackTrace"in Error?Error.captureStackTrace:(..._)=>{};function I_(_){return typeof _==="object"&&_!==null&&!Array.isArray(_)}var J2=S1(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(_){return!1}});function __(_){if(I_(_)===!1)return!1;let z=_.constructor;if(z===void 0)return!0;if(typeof z!=="function")return!0;let A=z.prototype;if(I_(A)===!1)return!1;if(Object.prototype.hasOwnProperty.call(A,"isPrototypeOf")===!1)return!1;return!0}function dQ(_){if(__(_))return{..._};if(Array.isArray(_))return[..._];return _}function Yk(_){let z=0;for(let A in _)if(Object.prototype.hasOwnProperty.call(_,A))z++;return z}var Xk=(_)=>{let z=typeof _;switch(z){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(_)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray(_))return"array";if(_===null)return"null";if(_.then&&typeof _.then==="function"&&_.catch&&typeof _.catch==="function")return"promise";if(typeof Map<"u"&&_ instanceof Map)return"map";if(typeof Set<"u"&&_ instanceof Set)return"set";if(typeof Date<"u"&&_ instanceof Date)return"date";if(typeof File<"u"&&_ instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${z}`)}},Y2=new Set(["string","number","symbol"]),rQ=new Set(["string","number","bigint","boolean","symbol","undefined"]);function I4(_){return _.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function c9(_,z,A){let b=new _._zod.constr(z??_._zod.def);if(!z||A?.parent)b._zod.parent=_;return b}function c(_){let z=_;if(!z)return{};if(typeof z==="string")return{error:()=>z};if(z?.message!==void 0){if(z?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");z.error=z.message}if(delete z.message,typeof z.error==="string")return{...z,error:()=>z.error};return z}function Qk(_){let z;return new Proxy({},{get(A,b,G){return z??(z=_()),Reflect.get(z,b,G)},set(A,b,G,J){return z??(z=_()),Reflect.set(z,b,G,J)},has(A,b){return z??(z=_()),Reflect.has(z,b)},deleteProperty(A,b){return z??(z=_()),Reflect.deleteProperty(z,b)},ownKeys(A){return z??(z=_()),Reflect.ownKeys(z)},getOwnPropertyDescriptor(A,b){return z??(z=_()),Reflect.getOwnPropertyDescriptor(z,b)},defineProperty(A,b,G){return z??(z=_()),Reflect.defineProperty(z,b,G)}})}function y6(_){if(typeof _==="bigint")return _.toString()+"n";if(typeof _==="string")return`"${_}"`;return`${_}`}function X2(_){return Object.keys(_).filter((z)=>{return _[z]._zod.optin==="optional"&&_[z]._zod.optout==="optional"})}var Q2={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},nQ={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function $k(_,z){let A=_._zod.def,b=A.checks;if(b&&b.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let J=k4(_._zod.def,{get shape(){let Y={};for(let X in z){if(!(X in A.shape))throw Error(`Unrecognized key: "${X}"`);if(!z[X])continue;Y[X]=A.shape[X]}return e4(this,"shape",Y),Y},checks:[]});return c9(_,J)}function Hk(_,z){let A=_._zod.def,b=A.checks;if(b&&b.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let J=k4(_._zod.def,{get shape(){let Y={..._._zod.def.shape};for(let X in z){if(!(X in A.shape))throw Error(`Unrecognized key: "${X}"`);if(!z[X])continue;delete Y[X]}return e4(this,"shape",Y),Y},checks:[]});return c9(_,J)}function Bk(_,z){if(!__(z))throw Error("Invalid input to extend: expected a plain object");let A=_._zod.def.checks;if(A&&A.length>0){let J=_._zod.def.shape;for(let Y in z)if(Object.getOwnPropertyDescriptor(J,Y)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let G=k4(_._zod.def,{get shape(){let J={..._._zod.def.shape,...z};return e4(this,"shape",J),J}});return c9(_,G)}function Zk(_,z){if(!__(z))throw Error("Invalid input to safeExtend: expected a plain object");let A=k4(_._zod.def,{get shape(){let b={..._._zod.def.shape,...z};return e4(this,"shape",b),b}});return c9(_,A)}function Fk(_,z){let A=k4(_._zod.def,{get shape(){let b={..._._zod.def.shape,...z._zod.def.shape};return e4(this,"shape",b),b},get catchall(){return z._zod.def.catchall},checks:[]});return c9(_,A)}function Kk(_,z,A){let G=z._zod.def.checks;if(G&&G.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let Y=k4(z._zod.def,{get shape(){let X=z._zod.def.shape,Q={...X};if(A)for(let $ in A){if(!($ in X))throw Error(`Unrecognized key: "${$}"`);if(!A[$])continue;Q[$]=_?new _({type:"optional",innerType:X[$]}):X[$]}else for(let $ in X)Q[$]=_?new _({type:"optional",innerType:X[$]}):X[$];return e4(this,"shape",Q),Q},checks:[]});return c9(z,Y)}function qk(_,z,A){let b=k4(z._zod.def,{get shape(){let G=z._zod.def.shape,J={...G};if(A)for(let Y in A){if(!(Y in J))throw Error(`Unrecognized key: "${Y}"`);if(!A[Y])continue;J[Y]=new _({type:"nonoptional",innerType:G[Y]})}else for(let Y in G)J[Y]=new _({type:"nonoptional",innerType:G[Y]});return e4(this,"shape",J),J}});return c9(z,b)}function z_(_,z=0){if(_.aborted===!0)return!0;for(let A=z;A<_.issues.length;A++)if(_.issues[A]?.continue!==!0)return!0;return!1}function x4(_,z){return z.map((A)=>{var b;return(b=A).path??(b.path=[]),A.path.unshift(_),A})}function Cz(_){return typeof _==="string"?_:_?.message}function l9(_,z,A){let b={..._,path:_.path??[]};if(!_.message){let G=Cz(_.inst?._zod.def?.error?.(_))??Cz(z?.error?.(_))??Cz(A.customError?.(_))??Cz(A.localeError?.(_))??"Invalid input";b.message=G}if(delete b.inst,delete b.continue,!z?.reportInput)delete b.input;return b}function iQ(_){if(_ instanceof Set)return"set";if(_ instanceof Map)return"map";if(_ instanceof File)return"file";return"unknown"}function fz(_){if(Array.isArray(_))return"array";if(typeof _==="string")return"string";return"unknown"}function $2(_){let z=typeof _;switch(z){case"number":return Number.isNaN(_)?"nan":"number";case"object":{if(_===null)return"null";if(Array.isArray(_))return"array";let A=_;if(A&&Object.getPrototypeOf(A)!==Object.prototype&&"constructor"in A&&A.constructor)return A.constructor.name}}return z}function k1(..._){let[z,A,b]=_;if(typeof z==="string")return{message:z,code:"custom",input:A,inst:b};return{...z}}function Wk(_){return Object.entries(_).filter(([z,A])=>{return Number.isNaN(Number.parseInt(z,10))}).map((z)=>z[1])}function oQ(_){let z=atob(_),A=new Uint8Array(z.length);for(let b=0;b<z.length;b++)A[b]=z.charCodeAt(b);return A}function aQ(_){let z="";for(let A=0;A<_.length;A++)z+=String.fromCharCode(_[A]);return btoa(z)}function Vk(_){let z=_.replace(/-/g,"+").replace(/_/g,"/"),A="=".repeat((4-z.length%4)%4);return oQ(z+A)}function Uk(_){return aQ(_).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Dk(_){let z=_.replace(/^0x/,"");if(z.length%2!==0)throw Error("Invalid hex string length");let A=new Uint8Array(z.length/2);for(let b=0;b<z.length;b+=2)A[b/2]=Number.parseInt(z.slice(b,b+2),16);return A}function Mk(_){return Array.from(_).map((z)=>z.toString(16).padStart(2,"0")).join("")}class sQ{constructor(..._){}}var tQ=(_,z)=>{_.name="$ZodError",Object.defineProperty(_,"_zod",{value:_._zod,enumerable:!1}),Object.defineProperty(_,"issues",{value:z,enumerable:!1}),_.message=JSON.stringify(z,P1,2),Object.defineProperty(_,"toString",{value:()=>_.message,enumerable:!1})},g6=E("$ZodError",tQ),H2=E("$ZodError",tQ,{Parent:Error});function eQ(_,z=(A)=>A.message){let A={},b=[];for(let G of _.issues)if(G.path.length>0)A[G.path[0]]=A[G.path[0]]||[],A[G.path[0]].push(z(G));else b.push(z(G));return{formErrors:b,fieldErrors:A}}function _$(_,z=(A)=>A.message){let A={_errors:[]},b=(G)=>{for(let J of G.issues)if(J.code==="invalid_union"&&J.errors.length)J.errors.map((Y)=>b({issues:Y}));else if(J.code==="invalid_key")b({issues:J.issues});else if(J.code==="invalid_element")b({issues:J.issues});else if(J.path.length===0)A._errors.push(z(J));else{let Y=A,X=0;while(X<J.path.length){let Q=J.path[X];if(X!==J.path.length-1)Y[Q]=Y[Q]||{_errors:[]};else Y[Q]=Y[Q]||{_errors:[]},Y[Q]._errors.push(z(J));Y=Y[Q],X++}}};return b(_),A}var f6=(_)=>(z,A,b,G)=>{let J=b?Object.assign(b,{async:!1}):{async:!1},Y=z._zod.run({value:A,issues:[]},J);if(Y instanceof Promise)throw new S4;if(Y.issues.length){let X=new(G?.Err??_)(Y.issues.map((Q)=>l9(Q,J,O9())));throw v6(X,G?.callee),X}return Y.value};var h6=(_)=>async(z,A,b,G)=>{let J=b?Object.assign(b,{async:!0}):{async:!0},Y=z._zod.run({value:A,issues:[]},J);if(Y instanceof Promise)Y=await Y;if(Y.issues.length){let X=new(G?.Err??_)(Y.issues.map((Q)=>l9(Q,J,O9())));throw v6(X,G?.callee),X}return Y.value};var hz=(_)=>(z,A,b)=>{let G=b?{...b,async:!1}:{async:!1},J=z._zod.run({value:A,issues:[]},G);if(J instanceof Promise)throw new S4;return J.issues.length?{success:!1,error:new(_??g6)(J.issues.map((Y)=>l9(Y,G,O9())))}:{success:!0,data:J.value}},mz=hz(H2),uz=(_)=>async(z,A,b)=>{let G=b?Object.assign(b,{async:!0}):{async:!0},J=z._zod.run({value:A,issues:[]},G);if(J instanceof Promise)J=await J;return J.issues.length?{success:!1,error:new _(J.issues.map((Y)=>l9(Y,G,O9())))}:{success:!0,data:J.value}},m6=uz(H2),z$=(_)=>(z,A,b)=>{let G=b?Object.assign(b,{direction:"backward"}):{direction:"backward"};return f6(_)(z,A,G)};var A$=(_)=>(z,A,b)=>{return f6(_)(z,A,b)};var b$=(_)=>async(z,A,b)=>{let G=b?Object.assign(b,{direction:"backward"}):{direction:"backward"};return h6(_)(z,A,G)};var G$=(_)=>async(z,A,b)=>{return h6(_)(z,A,b)};var J$=(_)=>(z,A,b)=>{let G=b?Object.assign(b,{direction:"backward"}):{direction:"backward"};return hz(_)(z,A,G)};var Y$=(_)=>(z,A,b)=>{return hz(_)(z,A,b)};var X$=(_)=>async(z,A,b)=>{let G=b?Object.assign(b,{direction:"backward"}):{direction:"backward"};return uz(_)(z,A,G)};var Q$=(_)=>async(z,A,b)=>{return uz(_)(z,A,b)};var $$=/^[cC][^\s-]{8,}$/,H$=/^[0-9a-z]+$/,B$=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Z$=/^[0-9a-vA-V]{20}$/,F$=/^[A-Za-z0-9]{27}$/,K$=/^[a-zA-Z0-9_-]{21}$/,q$=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var W$=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,B2=(_)=>{if(!_)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${_}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var V$=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var wk="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function U$(){return new RegExp(wk,"u")}var D$=/^(?:(?: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])$/,M$=/^(([0-9a-fA-F]{1,4}:){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}|:))$/;var N$=/^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/,w$=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,E$=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Z2=/^[A-Za-z0-9_-]*$/;var O$=/^\+[1-9]\d{6,14}$/,L$="(?:(?:\\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])))",j$=new RegExp(`^${L$}$`);function R$(_){return typeof _.precision==="number"?_.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":_.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${_.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function P$(_){return new RegExp(`^${R$(_)}$`)}function S$(_){let z=R$({precision:_.precision}),A=["Z"];if(_.local)A.push("");if(_.offset)A.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let b=`${z}(?:${A.join("|")})`;return new RegExp(`^${L$}T(?:${b})$`)}var k$=(_)=>{let z=_?`[\\s\\S]{${_?.minimum??0},${_?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${z}$`)};var I$=/^-?\d+$/,u6=/^-?\d+(?:\.\d+)?$/,x$=/^(?:true|false)$/i,T$=/^null$/i;var C$=/^[^A-Z]*$/,v$=/^[^a-z]*$/;var f0=E("$ZodCheck",(_,z)=>{var A;_._zod??(_._zod={}),_._zod.def=z,(A=_._zod).onattach??(A.onattach=[])}),y$={number:"number",bigint:"bigint",object:"date"},F2=E("$ZodCheckLessThan",(_,z)=>{f0.init(_,z);let A=y$[typeof z.value];_._zod.onattach.push((b)=>{let G=b._zod.bag,J=(z.inclusive?G.maximum:G.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(z.value<J)if(z.inclusive)G.maximum=z.value;else G.exclusiveMaximum=z.value}),_._zod.check=(b)=>{if(z.inclusive?b.value<=z.value:b.value<z.value)return;b.issues.push({origin:A,code:"too_big",maximum:typeof z.value==="object"?z.value.getTime():z.value,input:b.value,inclusive:z.inclusive,inst:_,continue:!z.abort})}}),K2=E("$ZodCheckGreaterThan",(_,z)=>{f0.init(_,z);let A=y$[typeof z.value];_._zod.onattach.push((b)=>{let G=b._zod.bag,J=(z.inclusive?G.minimum:G.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(z.value>J)if(z.inclusive)G.minimum=z.value;else G.exclusiveMinimum=z.value}),_._zod.check=(b)=>{if(z.inclusive?b.value>=z.value:b.value>z.value)return;b.issues.push({origin:A,code:"too_small",minimum:typeof z.value==="object"?z.value.getTime():z.value,input:b.value,inclusive:z.inclusive,inst:_,continue:!z.abort})}}),g$=E("$ZodCheckMultipleOf",(_,z)=>{f0.init(_,z),_._zod.onattach.push((A)=>{var b;(b=A._zod.bag).multipleOf??(b.multipleOf=z.value)}),_._zod.check=(A)=>{if(typeof A.value!==typeof z.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof A.value==="bigint"?A.value%z.value===BigInt(0):b2(A.value,z.value)===0)return;A.issues.push({origin:typeof A.value,code:"not_multiple_of",divisor:z.value,input:A.value,inst:_,continue:!z.abort})}}),f$=E("$ZodCheckNumberFormat",(_,z)=>{f0.init(_,z),z.format=z.format||"float64";let A=z.format?.includes("int"),b=A?"int":"number",[G,J]=Q2[z.format];_._zod.onattach.push((Y)=>{let X=Y._zod.bag;if(X.format=z.format,X.minimum=G,X.maximum=J,A)X.pattern=I$}),_._zod.check=(Y)=>{let X=Y.value;if(A){if(!Number.isInteger(X)){Y.issues.push({expected:b,format:z.format,code:"invalid_type",continue:!1,input:X,inst:_});return}if(!Number.isSafeInteger(X)){if(X>0)Y.issues.push({input:X,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:_,origin:b,inclusive:!0,continue:!z.abort});else Y.issues.push({input:X,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:_,origin:b,inclusive:!0,continue:!z.abort});return}}if(X<G)Y.issues.push({origin:"number",input:X,code:"too_small",minimum:G,inclusive:!0,inst:_,continue:!z.abort});if(X>J)Y.issues.push({origin:"number",input:X,code:"too_big",maximum:J,inclusive:!0,inst:_,continue:!z.abort})}});var h$=E("$ZodCheckMaxLength",(_,z)=>{var A;f0.init(_,z),(A=_._zod.def).when??(A.when=(b)=>{let G=b.value;return!yz(G)&&G.length!==void 0}),_._zod.onattach.push((b)=>{let G=b._zod.bag.maximum??Number.POSITIVE_INFINITY;if(z.maximum<G)b._zod.bag.maximum=z.maximum}),_._zod.check=(b)=>{let G=b.value;if(G.length<=z.maximum)return;let Y=fz(G);b.issues.push({origin:Y,code:"too_big",maximum:z.maximum,inclusive:!0,input:G,inst:_,continue:!z.abort})}}),m$=E("$ZodCheckMinLength",(_,z)=>{var A;f0.init(_,z),(A=_._zod.def).when??(A.when=(b)=>{let G=b.value;return!yz(G)&&G.length!==void 0}),_._zod.onattach.push((b)=>{let G=b._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(z.minimum>G)b._zod.bag.minimum=z.minimum}),_._zod.check=(b)=>{let G=b.value;if(G.length>=z.minimum)return;let Y=fz(G);b.issues.push({origin:Y,code:"too_small",minimum:z.minimum,inclusive:!0,input:G,inst:_,continue:!z.abort})}}),u$=E("$ZodCheckLengthEquals",(_,z)=>{var A;f0.init(_,z),(A=_._zod.def).when??(A.when=(b)=>{let G=b.value;return!yz(G)&&G.length!==void 0}),_._zod.onattach.push((b)=>{let G=b._zod.bag;G.minimum=z.length,G.maximum=z.length,G.length=z.length}),_._zod.check=(b)=>{let G=b.value,J=G.length;if(J===z.length)return;let Y=fz(G),X=J>z.length;b.issues.push({origin:Y,...X?{code:"too_big",maximum:z.length}:{code:"too_small",minimum:z.length},inclusive:!0,exact:!0,input:b.value,inst:_,continue:!z.abort})}}),cz=E("$ZodCheckStringFormat",(_,z)=>{var A,b;if(f0.init(_,z),_._zod.onattach.push((G)=>{let J=G._zod.bag;if(J.format=z.format,z.pattern)J.patterns??(J.patterns=new Set),J.patterns.add(z.pattern)}),z.pattern)(A=_._zod).check??(A.check=(G)=>{if(z.pattern.lastIndex=0,z.pattern.test(G.value))return;G.issues.push({origin:"string",code:"invalid_format",format:z.format,input:G.value,...z.pattern?{pattern:z.pattern.toString()}:{},inst:_,continue:!z.abort})});else(b=_._zod).check??(b.check=()=>{})}),c$=E("$ZodCheckRegex",(_,z)=>{cz.init(_,z),_._zod.check=(A)=>{if(z.pattern.lastIndex=0,z.pattern.test(A.value))return;A.issues.push({origin:"string",code:"invalid_format",format:"regex",input:A.value,pattern:z.pattern.toString(),inst:_,continue:!z.abort})}}),l$=E("$ZodCheckLowerCase",(_,z)=>{z.pattern??(z.pattern=C$),cz.init(_,z)}),p$=E("$ZodCheckUpperCase",(_,z)=>{z.pattern??(z.pattern=v$),cz.init(_,z)}),d$=E("$ZodCheckIncludes",(_,z)=>{f0.init(_,z);let A=I4(z.includes),b=new RegExp(typeof z.position==="number"?`^.{${z.position}}${A}`:A);z.pattern=b,_._zod.onattach.push((G)=>{let J=G._zod.bag;J.patterns??(J.patterns=new Set),J.patterns.add(b)}),_._zod.check=(G)=>{if(G.value.includes(z.includes,z.position))return;G.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:z.includes,input:G.value,inst:_,continue:!z.abort})}}),r$=E("$ZodCheckStartsWith",(_,z)=>{f0.init(_,z);let A=new RegExp(`^${I4(z.prefix)}.*`);z.pattern??(z.pattern=A),_._zod.onattach.push((b)=>{let G=b._zod.bag;G.patterns??(G.patterns=new Set),G.patterns.add(A)}),_._zod.check=(b)=>{if(b.value.startsWith(z.prefix))return;b.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:z.prefix,input:b.value,inst:_,continue:!z.abort})}}),n$=E("$ZodCheckEndsWith",(_,z)=>{f0.init(_,z);let A=new RegExp(`.*${I4(z.suffix)}$`);z.pattern??(z.pattern=A),_._zod.onattach.push((b)=>{let G=b._zod.bag;G.patterns??(G.patterns=new Set),G.patterns.add(A)}),_._zod.check=(b)=>{if(b.value.endsWith(z.suffix))return;b.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:z.suffix,input:b.value,inst:_,continue:!z.abort})}});var i$=E("$ZodCheckOverwrite",(_,z)=>{f0.init(_,z),_._zod.check=(A)=>{A.value=z.tx(A.value)}});class q2{constructor(_=[]){if(this.content=[],this.indent=0,this)this.args=_}indented(_){this.indent+=1,_(this),this.indent-=1}write(_){if(typeof _==="function"){_(this,{execution:"sync"}),_(this,{execution:"async"});return}let A=_.split(`
157
+ ${G}`,Y=[{regex:/(\s--message=)"([^"]*)"/,quote:'"',equalsForm:!0},{regex:/(\s--message=)'([^']*)'/,quote:"'",equalsForm:!0},{regex:/(\s(?:-m|--message|-am))\s+"([^"]*)"/,quote:'"',equalsForm:!1},{regex:/(\s(?:-m|--message|-am))\s+'([^']*)'/,quote:"'",equalsForm:!1},{regex:/(\s--message=)([^\s"'][^\s]*)(\s|$)/,quote:'"',equalsForm:!0,unquoted:!0},{regex:/(\s(?:-m|--message|-am))\s+([^\s"'-][^\s]*)(\s|$)/,quote:'"',equalsForm:!1,unquoted:!0}];for(let{regex:X,quote:Q,equalsForm:$,unquoted:H}of Y){let B=_.match(X);if(B){let Z=B[1],F=B[2],K=B[3]||"";if(H&&$)return _.replace(X,`${Z}${Q}${F}${J}${Q}${K}`);if(H)return _.replace(X,`${Z} ${Q}${F}${J}${Q}${K}`);if($)return _.replace(X,`${Z}${Q}${F}${J}${Q}`);return _.replace(X,`${Z} ${Q}${F}${J}${Q}`)}}return _}function S_(_){let z=new RegExp(QS.source,"g"),A=[..._.matchAll(z)];if(A.length===0)return;return A[A.length-1][1]}function M1(_){let z=_.match(/\[[\w/-]+(?:\s+\([^)]+\))?\s+([a-f0-9]{7,40})\]/);return z?z[1]:void 0}function N1(_){let z=_.match(/\[[\w/-]+(?:\s+\([^)]+\))?\s+[a-f0-9]{7,40}\]\s+(.+)/);return z?z[1].trim():void 0}function w1(_){let z=_.match(/\[([\w/-]+)(?:\s+\([^)]+\))?\s+[a-f0-9]{7,40}\]/);return z?z[1]:void 0}async function E1(_){let z=await T9();if(z.length===0){x.warn("Commit tracking skipped: no authenticated environments",{transcriptId:_.transcriptId.substring(0,8)});return}for(let A of z)try{let b=new AbortController,G=setTimeout(()=>b.abort(),5000),J=await fetch(new URL("/api/commit-track",A.baseURL),{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${A.token}`},body:JSON.stringify({transcript_id:_.transcriptId,repo_path:_.repoPath,timestamp:_.timestamp,commit_sha:_.commitSha,commit_title:_.commitTitle,branch:_.branch}),signal:b.signal});if(clearTimeout(G),!J.ok){x.warn(`Commit tracking to ${A.name} failed`,{transcriptId:_.transcriptId.substring(0,8),status:J.status});continue}x.info(`Commit tracked (${A.name})`,{transcriptId:_.transcriptId.substring(0,8)})}catch(b){if(b instanceof Error&&b.name==="AbortError"){x.warn(`Commit tracking to ${A.name} timed out`,{transcriptId:_.transcriptId.substring(0,8)});continue}x.error(`Commit tracking to ${A.name} error`,{transcriptId:_.transcriptId.substring(0,8),error:b instanceof Error?b.message:String(b)})}}var ZS=2048;function O1(){return new Promise((_,z)=>{let A="";process.stdin.setEncoding("utf8"),process.stdin.on("data",(b)=>{A+=b}),process.stdin.on("end",()=>{_({preview:A.slice(0,ZS),full:A})}),process.stdin.on("error",(b)=>z(b))})}async function DQ(){let _=Date.now(),z,A;try{let{preview:b,full:G}=await O1();if(x.info(`Hook invoked (stdin: ${G.length} bytes)`),!G.trim())x.warn("Hook received empty stdin - ignoring"),process.exit(0);let J=b.includes('"PreToolUse"'),Y=b.includes("git")&&b.includes("commit");if(J&&!Y){let $={hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"allow"}};process.stdout.write(JSON.stringify($));let H=Date.now()-_;x.info(`Hook completed: PreToolUse (fast path, ${H}ms)`),process.exit(0)}let X;try{X=JSON.parse(G)}catch($){x.error("Hook failed to parse stdin JSON",{error:$ instanceof Error?$.message:$}),process.exit(1)}if(z=X.hook_event_name,A=X.session_id||"unknown",!z)x.error("Hook missing event name",{sessionId:A}),process.exit(1);if(x.info(`Hook: ${z} (session: ${A.substring(0,8)}...)`),z==="PreToolUse")await qS(X);else if(z==="PostToolUse")await WS(X);else if(z==="SessionEnd")await VS(X);else if(z==="Stop")await US(X);else x.debug(`Hook: skipping unsupported event ${z}`);let Q=Date.now()-_;x.info(`Hook completed: ${z} (${Q}ms)`,{sessionId:A.substring(0,8)}),process.exit(0)}catch(b){let G=Date.now()-_;x.error(`Hook failed: ${z||"unknown"} (${G}ms)`,{sessionId:A?.substring(0,8),error:b instanceof Error?b.message:String(b)}),process.exit(1)}}function MQ(_){if(_.tool_input&&typeof _.tool_input==="object"&&typeof _.tool_input.command==="string")return{command:_.tool_input.command,updateCommand:(z)=>{if(_.tool_input)_.tool_input.command=z}};if(typeof _.command==="string")return{command:_.command,updateCommand:(z)=>{_.command=z}};return{command:void 0,updateCommand:()=>{}}}function FS(_){if(_.tool_response?.stdout)return _.tool_response.stdout;if(_.tool_response)return JSON.stringify(_.tool_response);return}function KS(_){if(typeof _.repo_path==="string")return _.repo_path;if(typeof _.cwd==="string")return _.cwd;return""}async function qS(_){let z=_.session_id||"unknown",A=!1,b=!1,{command:G,updateCommand:J}=MQ(_),Y=typeof _.tool_name==="string"?_.tool_name:_.tool,X=Y?Y.toLowerCase()==="bash":Boolean(G),Q=typeof _.cwd==="string"?_.cwd:void 0,$=await a0(Q),H=e9($);if(X&&G&&P_(G)&&H){A=!0;let Z=await A4(z),F=await U1(),K=D1(G,Z,F);if(K!==G)J(K),b=!0}let B=b?{hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"allow",updatedInput:_.tool_input}}:{hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"allow"}};if(process.stdout.write(JSON.stringify(B)),A)await DS({sessionId:z,transcriptPath:_.transcript_path,cwd:typeof _.cwd==="string"?_.cwd:void 0});x.info("PreToolUse handled",{sessionId:z.substring(0,8),shouldTrack:A,modified:b})}async function WS(_){let z=_.session_id||"unknown",A=KS(_),{command:b}=MQ(_);if(!b||!P_(b))return;let G=S_(b);if(!G){x.debug("PostToolUse: git commit without agentlogs link",{sessionId:z.substring(0,8)});return}let J=FS(_),Y=J?M1(J):void 0,X=J?N1(J):void 0,Q=J?w1(J):void 0;await E1({transcriptId:G,repoPath:A,timestamp:new Date().toISOString(),commitSha:Y,commitTitle:X,branch:Q}),x.info("PostToolUse: tracked commit",{sessionId:z.substring(0,8),transcriptId:G,commitSha:Y?.substring(0,8)})}async function VS(_){let z=_.transcript_path,A=_.session_id||"unknown";if(!z){x.error("SessionEnd: missing transcript_path",{sessionId:A});return}try{let b=await P4({transcriptPath:z,sessionId:_.session_id,cwdOverride:_.cwd});if(b.results.length===0){if(!b.anySuccess)x.info("SessionEnd: upload skipped (repo not allowed or no auth)",{sessionId:A});return}for(let G of b.results)if(G.success)x.info(`SessionEnd: uploaded to ${G.envName} (${b.eventCount} events)`,{transcriptId:G.transcriptId,sessionId:A.substring(0,8)});else x.error(`SessionEnd: upload to ${G.envName} failed`,{sessionId:A,error:G.error})}catch(b){x.error("SessionEnd: upload error",{sessionId:A,error:b instanceof Error?b.message:String(b)})}}async function US(_){let z=_.transcript_path,A=_.session_id||"unknown";if(!z){x.error("Stop: missing transcript_path",{sessionId:A});return}if(_.stop_hook_active){x.debug("Stop: skipped (stop_hook_active=true)",{sessionId:A});return}try{let b=await P4({transcriptPath:z,sessionId:_.session_id,cwdOverride:_.cwd});if(b.results.length===0){if(!b.anySuccess)x.info("Stop: upload skipped (repo not allowed or no auth)",{sessionId:A});return}for(let G of b.results)if(G.success)x.info(`Stop: uploaded to ${G.envName} (${b.eventCount} events)`,{transcriptId:G.transcriptId,sessionId:A.substring(0,8)});else x.error(`Stop: upload to ${G.envName} failed`,{sessionId:A,error:G.error})}catch(b){x.error("Stop: upload error",{sessionId:A,error:b instanceof Error?b.message:String(b)})}}async function DS(_){if(!_.transcriptPath){x.warn("Partial upload skipped: missing transcript_path",{sessionId:_.sessionId.substring(0,8)});return}try{let z=await P4({transcriptPath:_.transcriptPath,sessionId:_.sessionId,cwdOverride:_.cwd});if(z.results.length===0){if(!z.anySuccess)x.info("Partial upload: skipped (repo not allowed or no auth)",{sessionId:_.sessionId.substring(0,8)});return}for(let A of z.results)if(A.success)x.info(`Partial upload: uploaded to ${A.envName}`,{transcriptId:A.transcriptId,sessionId:_.sessionId.substring(0,8),eventCount:z.eventCount});else x.error(`Partial upload: to ${A.envName} failed`,{sessionId:_.sessionId.substring(0,8),error:A.error})}catch(z){x.error("Partial upload: error",{sessionId:_.sessionId.substring(0,8),error:z instanceof Error?z.message:String(z)})}}import{createHash as MS}from"crypto";import{promises as S6}from"fs";import{homedir as NS}from"os";import{basename as wS,extname as ES,join as k6,relative as OS,resolve as LS}from"path";var jS=k6(NS(),".claude");async function NQ(_={}){let{repoFilter:z,claudeDir:A}=_,b=await T9();if(b.length===0)console.error("You must be logged in to sync transcripts."),console.error("Run `agentlogs login agentlogs.ai` to authenticate"),process.exit(1);let G=A?LS(A):process.env.CLAUDE_HOME??jS,J=k6(G,"projects"),Y=await PS(J);if(Y.length===0){console.log(`No local Claude Code transcripts were found under ${J}. Nothing to sync.`);return}let X=z?Y.filter(($)=>$.repoId===z):Y;if(z&&X.length===0){let $=Y.filter((H)=>H.repoId===null).length;if(console.log(`No local Claude Code transcripts matched repo ${z}.`),$>0)console.log(`${$} transcript(s) were skipped because their repo could not be determined.`);return}let Q=b.map(($)=>$.name).join(", ");console.log(`Syncing to environments: ${Q}`),console.log(`Found ${X.length} local transcript(s)
158
+ `);for(let $ of b)await RS($,X,z)}async function RS(_,z,A){let b=_.name;console.log(`
159
+ --- ${b} (${_.baseURL}) ---`);try{let G=await BX({serverUrl:_.baseURL,authToken:_.token}),J=A?G.filter((F)=>F.repoId===A):G,Y=new Map;for(let F of J)Y.set(F.transcriptId,F.sha256);let X=z.filter((F)=>{let K=Y.get(F.transcriptId);return!K||K!==F.sha256});if(X.length===0){console.log("All local transcripts are up to date.");return}console.log(`Uploading ${X.length} transcript(s)...`);let Q=0,$=0,H=0,B=[];for(let[F,K]of X.entries()){let q=`${F+1}/${X.length}`,W=K.repoId?` • ${K.repoId}`:"",V=`${K.transcriptId} – ${K.displayPath}${W}`;try{let w=await BQ({transcriptPath:K.path,sessionId:K.transcriptId,cwdOverride:K.cwd??void 0},{serverUrl:_.baseURL,authToken:_.token});if(w.skipped)$+=1,console.log(`[${q}] - ${V} • skipped (repo not allowed)`);else if(w.success)Q+=1,console.log(`[${q}] ✓ ${V} • ${w.eventCount} events${w.transcriptId?` → ${w.transcriptId}`:""}`);else{H+=1;let O="Upload returned unsuccessful response.";console.error(`[${q}] ✗ ${V} • ${O}`),B.push({transcriptId:K.transcriptId,displayPath:K.displayPath,reason:O})}}catch(w){H+=1;let O=w instanceof Error?w.message:String(w);console.error(`[${q}] ✗ ${V} • ${O}`),B.push({transcriptId:K.transcriptId,displayPath:K.displayPath,reason:O})}}let Z=$>0?`, ${$} skipped`:"";if(console.log(`Sync complete: ${Q} uploaded, ${H} failed${Z}.`),B.length>0){console.error("Failed transcript details:");for(let F of B.slice(0,10))console.error(` - ${F.transcriptId} (${F.displayPath}): ${F.reason}`);if(B.length>10)console.error(` …and ${B.length-10} more failures.`)}}catch(G){console.error(`Error syncing to ${b}: ${G instanceof Error?G.message:String(G)}`)}}async function PS(_){if(!await wQ(_))return[];let z=await S6.readdir(_,{withFileTypes:!0}),A=[],G=await new r0().fetchModelPricing(),J=Object.fromEntries(G);for(let Y of z){if(!Y.isDirectory())continue;let X=k6(_,Y.name),Q=await S6.readdir(X,{withFileTypes:!0});for(let $ of Q){if(!$.isFile()||ES($.name)!==".jsonl")continue;let H=k6(X,$.name),B=wS($.name,".jsonl");try{let Z=await S6.readFile(H,"utf8"),F=kS(Z),K=await xS(F),q=SS(Z),W=IS(q),V=F?await e0(F,W):null,w=J6(q,{pricing:J,gitContext:V});if(!w){console.warn(`Skipped transcript at ${H}: Could not convert to unified format`);continue}let O=L_(w.transcript),M=JSON.stringify(O),P=MS("sha256").update(M).digest("hex");A.push({transcriptId:B,path:H,sha256:P,cwd:F,repoId:K,displayPath:OS(_,H)||$.name})}catch(Z){console.warn(`Skipped transcript at ${H}: ${Z.message}`)}}}return A}async function wQ(_){try{return(await S6.stat(_)).isDirectory()}catch{return!1}}function SS(_){let z=_.split(/\r?\n/),A=[];for(let b of z){let G=b.trim();if(!G)continue;try{let J=JSON.parse(G);if(typeof J==="object"&&J!==null)A.push(J)}catch{continue}}return A}function kS(_){let z=_.split(/\r?\n/);for(let A of z){let b=A.trim();if(!b)continue;try{let J=JSON.parse(b)?.cwd;if(typeof J==="string"&&J.length>0)return J}catch{continue}}return null}function IS(_){for(let z of _){let A=typeof z.gitBranch==="string"?z.gitBranch.trim():"";if(A)return A}return}async function xS(_){if(!_)return null;if(!await wQ(_))return null;try{return uY(_).repoId}catch{return null}}async function I6(_,z="claude-code"){if(!_)console.error("The upload command expects a <transcript> argument."),process.exit(1);let A=ZQ(_);if(!A)console.error(`Transcript file not found for path: ${_}`),process.exit(1);let b=await T9();if(b.length===0)console.error("You must be logged in to upload transcripts."),console.error("Run `agentlogs login agentlogs.ai` to authenticate"),process.exit(1);let G=z==="codex"?"Codex":"Claude Code",J=b.map((Y)=>Y.name).join(", ");console.log(`Uploading ${G} transcript from ${A}`),console.log(`Target environments: ${J}`);try{let Y=await P4({transcriptPath:A,source:z});if(Y.results.length===0){console.log(""),console.log("- Upload skipped (repo not allowed by allowlist)"),console.log(" Use `agentlogs allow` to enable uploads for this repo.");return}console.log("");for(let X of Y.results){let Q=X.envName;if(X.success){if(console.log(`✓ ${Q}: uploaded successfully`),X.id)console.log(` ID: ${X.id}`);if(X.transcriptId)console.log(` Transcript ID: ${X.transcriptId}`)}else if(console.log(`✗ ${Q}: upload failed`),X.error)console.log(` Error: ${X.error}`)}if(console.log(""),Y.allSuccess)console.log(`✓ Upload complete (${Y.eventCount} events)`);else if(Y.anySuccess)console.log(`⚠ Partial upload (${Y.eventCount} events) - some environments failed`),process.exit(1);else console.error("✗ Upload failed for all environments"),process.exit(1)}catch(Y){console.error(Y instanceof Error?Y.message:"Unexpected error occurred while uploading transcript."),process.exit(1)}}async function EQ(_){await I6(_,"claude-code")}async function OQ(_){await I6(_,"codex")}import{spawnSync as TS}from"child_process";function CS(_){try{let z=TS("opencode",["export",_],{encoding:"utf-8",timeout:30000,stdio:["pipe","pipe","pipe"]});if(z.status!==0||z.error)return null;let A=z.stdout.trim();if(!A)return null;return JSON.parse(A)}catch{return null}}async function LQ(_){if(!_)console.error("Error: Session ID is required"),process.exit(1);console.log(`Uploading OpenCode session: ${_}`);let z=CS(_);if(!z)console.error(`Error: Session not found: ${_}`),console.error("Run 'opencode session list' to see available sessions"),process.exit(1);if(z.info.parentID)console.log("Skipping subagent session"),process.exit(0);let A=z.info.title||"Untitled",b=z.messages?.length??0;console.log(`Session: "${A}" (${b} messages)`);let J=await new r0().fetchModelPricing(),Y=Object.fromEntries(J),X=z.info.directory??process.cwd(),Q=await e0(X,void 0);if(Q?.repo)console.log(`Repository: ${Q.repo}`);console.log("Converting transcript...");let $=E_(z,{pricing:Y,gitContext:Q,cwd:X});if(!$)console.error("Error: Failed to convert transcript"),process.exit(1);console.log("Uploading...");let H=await E9({unifiedTranscript:$,sessionId:_,cwd:X,rawTranscript:JSON.stringify(z)});if(H.skipped)console.log("Skipped: Repository not in allowlist"),process.exit(0);if(H.anySuccess&&H.id){console.log(""),console.log("Upload successful!"),console.log(`Transcript ID: ${H.id}`);for(let B of H.results)if(B.success){let Z=`${B.baseURL}/app/logs/${H.id}`;console.log(`View: ${Z}`)}}else{console.error(""),console.error("Upload failed:");for(let B of H.results)if(!B.success&&B.error)console.error(` ${B.envName}: ${B.error}`);process.exit(1)}}import{spawnSync as vS}from"child_process";async function jQ(){let _=Date.now(),z,A;try{let{preview:b,full:G}=await O1();if(x.info(`OpenCode hook invoked (stdin: ${G.length} bytes)`),!G.trim())x.warn("OpenCode hook received empty stdin - ignoring"),B4({modified:!1}),process.exit(0);let J=b.includes("tool.execute.before"),Y=b.includes("git")&&b.includes("commit");if(J&&!Y){B4({modified:!1});let $=Date.now()-_;x.info(`OpenCode hook completed: tool.execute.before (fast path, ${$}ms)`),process.exit(0)}let X;try{X=JSON.parse(G)}catch($){x.error("OpenCode hook failed to parse stdin JSON",{error:$ instanceof Error?$.message:$}),B4({modified:!1}),process.exit(1)}if(z=X.hook_event_name,A=X.session_id||"unknown",!z)x.error("OpenCode hook missing event name",{sessionId:A}),B4({modified:!1}),process.exit(1);if(x.info(`OpenCode hook: ${z} (session: ${A.substring(0,8)}...)`),z==="tool.execute.before")await yS(X);else if(z==="tool.execute.after")await gS(X),B4({modified:!1});else if(z==="session.idle")await fS(X),B4({modified:!1});else x.debug(`OpenCode hook: skipping unsupported event ${z}`),B4({modified:!1});let Q=Date.now()-_;x.info(`OpenCode hook completed: ${z} (${Q}ms)`,{sessionId:A.substring(0,8)}),process.exit(0)}catch(b){let G=Date.now()-_;x.error(`OpenCode hook failed: ${z||"unknown"} (${G}ms)`,{sessionId:A?.substring(0,8),error:b instanceof Error?b.message:String(b)}),B4({modified:!1}),process.exit(1)}}function B4(_){process.stdout.write(JSON.stringify(_))}async function yS(_){let{session_id:z,call_id:A}=_,b=_.tool||"",G=_.tool_input||{},J=typeof G.command==="string"?G.command:"",Y=_.cwd,X=b==="bash",Q=await a0(Y),$=e9(Q);if(X&&P_(J)&&$){let H=await A4(z),B=await U1(),Z=D1(J,H,B);if(Z!==J){if(x.info("OpenCode hook: intercepting git commit",{sessionId:z.substring(0,8),transcriptId:H,callId:A}),A)await Qz(A,H);await hS(z,Y),B4({modified:!0,args:{...G,command:Z}});return}}B4({modified:!1})}async function gS(_){let{session_id:z,call_id:A}=_,b=_.tool||"",G=_.tool_output||{},J=_.cwd||"";if(b!=="bash")return;let X=G.output||"",Q=S_(X),$=!1;if(!Q&&A)Q=await $z(A),$=!0;if(!Q)return;if(A)await Hz(A);let H=M1(X),B=N1(X),Z=w1(X);if(!H){x.debug("OpenCode PostToolUse: found link but no commit SHA",{sessionId:z.substring(0,8),transcriptId:Q,fromCache:$});return}await E1({transcriptId:Q,repoPath:J,timestamp:new Date().toISOString(),commitSha:H,commitTitle:B,branch:Z}),x.info("OpenCode PostToolUse: tracked commit",{sessionId:z.substring(0,8),transcriptId:Q,commitSha:H.substring(0,8),fromCache:$})}async function fS(_){let{session_id:z,cwd:A}=_;x.info("OpenCode session.idle: uploading transcript",{sessionId:z.substring(0,8)}),await mS(z,A)}function RQ(_){try{let z=vS("opencode",["export",_],{encoding:"utf-8",timeout:30000,stdio:["pipe","pipe","pipe"]});if(z.status!==0||z.error)return x.warn("OpenCode export failed",{sessionId:_.substring(0,8),error:z.error?.message||z.stderr}),null;let A=z.stdout.trim();if(!A)return null;return JSON.parse(A)}catch(z){return x.error("OpenCode export error",{sessionId:_.substring(0,8),error:z instanceof Error?z.message:String(z)}),null}}async function hS(_,z){let A=RQ(_);if(!A){x.warn("OpenCode partial upload: session not found",{sessionId:_.substring(0,8)});return}await PQ(A,_,z,"partial")}async function mS(_,z){let A=RQ(_);if(!A){x.warn("OpenCode full upload: session not found",{sessionId:_.substring(0,8)});return}if(A.info.parentID){x.debug("OpenCode full upload: skipping subagent session",{sessionId:_.substring(0,8)});return}await PQ(A,_,z,"full")}async function PQ(_,z,A,b="full"){try{let J=await new r0().fetchModelPricing(),Y=Object.fromEntries(J),X=A||_.info.directory||process.cwd(),Q=await e0(X,void 0),$=E_(_,{pricing:Y,gitContext:Q,cwd:X});if(!$){x.error(`OpenCode ${b} upload: failed to convert transcript`,{sessionId:z.substring(0,8)});return}let H=await E9({unifiedTranscript:$,sessionId:z,cwd:X,rawTranscript:JSON.stringify(_)});if(H.skipped){x.info(`OpenCode ${b} upload: skipped (repo not allowed)`,{sessionId:z.substring(0,8)});return}for(let B of H.results)if(B.success)x.info(`OpenCode ${b} upload: success (${B.envName})`,{sessionId:z.substring(0,8),transcriptId:H.id});else x.error(`OpenCode ${b} upload: failed (${B.envName})`,{sessionId:z.substring(0,8),error:B.error})}catch(G){x.error(`OpenCode ${b} upload: error`,{sessionId:z.substring(0,8),error:G instanceof Error?G.message:String(G)})}}import{existsSync as j1,readFileSync as b2,readdirSync as x6}from"fs";import{join as L1,basename as uS}from"path";import{homedir as SQ}from"os";var t4=L1(SQ(),".pi","agent","sessions");function cS(_){if(!j1(_))return null;let A=b2(_,"utf-8").split(`
160
+ `).filter((J)=>J.trim());if(A.length===0)return null;let b=JSON.parse(A[0]),G=[];for(let J=1;J<A.length;J++)try{G.push(JSON.parse(A[J]))}catch{}return{header:b,entries:G}}function lS(_){if(!j1(t4))return null;for(let z of x6(t4)){let A=L1(t4,z);if(!j1(A))continue;for(let b of x6(A)){if(!b.endsWith(".jsonl"))continue;if(b.includes(_))return L1(A,b);let G=L1(A,b);try{let J=b2(G,"utf-8").split(`
161
+ `)[0];if(JSON.parse(J).id===_)return G}catch{}}}return null}function pS(_=10){let z=[];if(!j1(t4))return z;for(let A of x6(t4)){let b=L1(t4,A);if(!j1(b))continue;for(let G of x6(b)){if(!G.endsWith(".jsonl"))continue;let J=L1(b,G);try{let Y=b2(J,"utf-8").split(`
162
+ `)[0],X=JSON.parse(Y);z.push({path:J,id:X.id,timestamp:X.timestamp,cwd:X.cwd})}catch{}}}return z.sort((A,b)=>b.timestamp.localeCompare(A.timestamp)),z.slice(0,_)}async function kQ(_){if(!_){console.log("Recent Pi sessions:"),console.log("");let F=pS(10);if(F.length===0)console.log("No sessions found in",t4),process.exit(1);for(let K of F){let W=new Date(K.timestamp).toLocaleString();console.log(` ${K.id.substring(0,8)}... ${W}`),console.log(` ${K.cwd}`),console.log("")}console.log("Usage: agentlogs pi upload <session-id-or-path>"),process.exit(0)}let z,A=_.startsWith("~")?_.replace(/^~/,SQ()):_;if(j1(A))z=A;else{let F=lS(_);if(!F)console.error(`Error: Session not found: ${_}`),console.error(`Searched in: ${t4}`),process.exit(1);z=F}console.log(`Uploading Pi session: ${uS(z)}`);let b=cS(z);if(!b)console.error(`Error: Failed to read session file: ${z}`),process.exit(1);let G=b.entries.filter((F)=>F.type==="message").length;console.log(`Session: ${b.header.id.substring(0,8)}... (${G} messages)`);let Y=await new r0().fetchModelPricing(),X=Object.fromEntries(Y),Q=b.header.cwd??process.cwd(),$=await e0(Q,void 0);if($?.repo)console.log(`Repository: ${$.repo}`);console.log("Converting transcript...");let H=O_(b,{pricing:X,gitContext:$,cwd:Q});if(!H)console.error("Error: Failed to convert transcript"),process.exit(1);let B=[];for(let[F,K]of H.blobs)B.push({sha256:F,data:new Uint8Array(K.data),mediaType:K.mediaType});console.log("Uploading...");let Z=await E9({unifiedTranscript:H.transcript,sessionId:b.header.id,cwd:Q,rawTranscript:JSON.stringify(b),blobs:B.length>0?B:void 0});if(Z.skipped)console.log("Skipped: Repository not in allowlist"),process.exit(0);if(Z.anySuccess&&Z.id){console.log(""),console.log("Upload successful!"),console.log(`Transcript ID: ${Z.id}`);for(let F of Z.results)if(F.success){let K=`${F.baseURL}/app/logs/${Z.id}`;console.log(`View: ${K}`)}}else{console.error(""),console.error("Upload failed:");for(let F of Z.results)if(!F.success&&F.error)console.error(` ${F.envName}: ${F.error}`);process.exit(1)}}import{existsSync as dS,readFileSync as rS}from"fs";async function IQ(){let _=Date.now(),z,A;try{let{preview:b,full:G}=await O1();if(x.info(`Pi hook invoked (stdin: ${G.length} bytes)`),!G.trim())x.warn("Pi hook received empty stdin - ignoring"),c9({modified:!1}),process.exit(0);let J=b.includes("tool_call")&&!b.includes("tool_call_id"),Y=b.includes("git")&&b.includes("commit");if(J&&!Y){c9({modified:!1});let $=Date.now()-_;x.info(`Pi hook completed: tool_call (fast path, ${$}ms)`),process.exit(0)}let X;try{X=JSON.parse(G)}catch($){x.error("Pi hook failed to parse stdin JSON",{error:$ instanceof Error?$.message:$}),c9({modified:!1}),process.exit(1)}if(z=X.hook_event_name,A=X.session_id||"unknown",!z)x.error("Pi hook missing event name",{sessionId:A}),c9({modified:!1}),process.exit(1);if(x.info(`Pi hook: ${z} (session: ${A.substring(0,8)}...)`),z==="tool_call")await nS(X);else if(z==="tool_result")await iS(X),c9({modified:!1});else if(z==="session_shutdown")await oS(X),c9({modified:!1});else if(z==="agent_end")await aS(X),c9({modified:!1});else x.debug(`Pi hook: skipping unsupported event ${z}`),c9({modified:!1});let Q=Date.now()-_;x.info(`Pi hook completed: ${z} (${Q}ms)`,{sessionId:A.substring(0,8)}),process.exit(0)}catch(b){let G=Date.now()-_;x.error(`Pi hook failed: ${z||"unknown"} (${G}ms)`,{sessionId:A?.substring(0,8),error:b instanceof Error?b.message:String(b)}),c9({modified:!1}),process.exit(1)}}function c9(_){process.stdout.write(JSON.stringify(_))}async function nS(_){let{session_id:z,tool_call_id:A}=_,b=_.tool||"",G=_.tool_input||{},J=typeof G.command==="string"?G.command:"",Y=_.cwd,X=b.toLowerCase()==="bash",Q=await a0(Y),$=e9(Q);if(X&&P_(J)&&$){let H=await A4(z),B=await U1(),Z=D1(J,H,B);if(Z!==J){if(x.info("Pi hook: intercepting git commit",{sessionId:z.substring(0,8),transcriptId:H,toolCallId:A}),A)await Qz(A,H);await sS(_),c9({modified:!0,updatedInput:{...G,command:Z}});return}}c9({modified:!1})}async function iS(_){let{session_id:z,tool_call_id:A}=_,b=_.tool||"",G=_.tool_output||{},J=_.cwd||"";if(b.toLowerCase()!=="bash")return;let X=G.stdout||G.content||"",Q=typeof X==="string"?X:JSON.stringify(X),$=S_(Q),H=!1;if(!$&&A)$=await $z(A),H=!0;if(!$)return;if(A)await Hz(A);let B=M1(Q),Z=N1(Q),F=w1(Q);if(!B){x.debug("Pi tool_result: found link but no commit SHA",{sessionId:z.substring(0,8),transcriptId:$,fromCache:H});return}await E1({transcriptId:$,repoPath:J,timestamp:new Date().toISOString(),commitSha:B,commitTitle:Z,branch:F}),x.info("Pi tool_result: tracked commit",{sessionId:z.substring(0,8),transcriptId:$,commitSha:B.substring(0,8),fromCache:H})}async function oS(_){let z=_.session_id;x.info("Pi session_shutdown: uploading transcript",{sessionId:z.substring(0,8)}),await TQ(_)}async function aS(_){let z=_.session_id;x.info("Pi agent_end: uploading transcript",{sessionId:z.substring(0,8)}),await TQ(_)}function xQ(_){if(!dS(_))return null;try{let A=rS(_,"utf-8").split(`
163
+ `).filter((J)=>J.trim());if(A.length===0)return null;let b=JSON.parse(A[0]),G=[];for(let J=1;J<A.length;J++)try{G.push(JSON.parse(A[J]))}catch{}return{header:b,entries:G}}catch(z){return x.error("Pi: failed to read session file",{sessionFile:_,error:z instanceof Error?z.message:String(z)}),null}}async function sS(_){let{session_id:z,cwd:A,session_data:b}=_;if(!b&&_.session_file)b=xQ(_.session_file)??void 0;if(!b){x.warn("Pi partial upload: no session data available",{sessionId:z.substring(0,8)});return}await CQ(b,z,A,_.leaf_id,"partial")}async function TQ(_){let{session_id:z,cwd:A,session_data:b}=_;if(!b&&_.session_file)b=xQ(_.session_file)??void 0;if(!b){x.warn("Pi full upload: no session data available",{sessionId:z.substring(0,8)});return}await CQ(b,z,A,_.leaf_id,"full")}async function CQ(_,z,A,b,G="full"){try{let Y=await new r0().fetchModelPricing(),X=Object.fromEntries(Y),Q=A||_.header.cwd||process.cwd(),$=await e0(Q,void 0),H=O_(_,{pricing:X,gitContext:$,cwd:Q,leafId:b});if(!H){x.error(`Pi ${G} upload: failed to convert transcript`,{sessionId:z.substring(0,8)});return}let B=await E9({unifiedTranscript:H.transcript,sessionId:z,cwd:Q,rawTranscript:JSON.stringify(_)});if(B.skipped){x.info(`Pi ${G} upload: skipped (repo not allowed)`,{sessionId:z.substring(0,8)});return}for(let Z of B.results)if(Z.success)x.info(`Pi ${G} upload: success (${Z.envName})`,{sessionId:z.substring(0,8),transcriptId:B.id});else x.error(`Pi ${G} upload: failed (${Z.envName})`,{sessionId:z.substring(0,8),error:Z.error})}catch(J){x.error(`Pi ${G} upload: error`,{sessionId:z.substring(0,8),error:J instanceof Error?J.message:String(J)})}}import{spawn as _k}from"child_process";import{existsSync as T6,readFileSync as uQ}from"fs";import{createInterface as zk}from"readline";import{dirname as Ak,resolve as hQ}from"path";import{fileURLToPath as bk}from"url";import{homedir as vQ}from"os";import{join as k_}from"path";var R1=k_(vQ(),".agentlogs"),P1=k_(R1,"service.pid"),yQ=k_(R1,"service.sock"),gQ=k_(R1,"service.log"),tS=k_(vQ(),".codex"),fe=k_(tS,"sessions"),S1=k_(R1,"watcher-events.log");import{createServer as ue,connect as eS}from"net";function I_(){return new Promise((_,z)=>{let A=eS(yQ);A.on("connect",()=>{_(A)}),A.on("error",(b)=>{z(b)})})}function Cz(_,z){_.write(JSON.stringify(z)+`
164
+ `)}function fQ(_,z,A=5000){return new Promise((b,G)=>{let J="",Y=setTimeout(()=>{G(Error("Timeout waiting for response"))},A),X=(Q)=>{J+=Q.toString();let $=J.split(`
165
+ `);J=$.pop()||"";for(let H of $){if(!H.trim())continue;try{let B=JSON.parse(H);if(B.type===z)clearTimeout(Y),_.off("data",X),b(B.data)}catch{}}};_.on("data",X)})}var Gk=bk(import.meta.url),mQ=Ak(Gk);function C6(){if(!T6(P1))return{running:!1};try{let _=parseInt(uQ(P1,"utf-8").trim());return process.kill(_,0),{running:!0,pid:_}}catch{return{running:!1}}}async function cQ(){let _=C6();if(_.running){console.log(`Service already running (PID: ${_.pid})`);return}let z=hQ(mQ,"../../service/server.ts"),A=hQ(mQ,"../../service/server.js"),b=T6(z)?z:A;if(!T6(b))console.error(`Service script not found at ${b}`),process.exit(1);let G=_k("bun",["run",b],{detached:!0,stdio:"ignore",env:{...process.env}});G.unref(),console.log(`Service starting (PID: ${G.pid})...`);let J=50;for(let Y=0;Y<J;Y++)try{(await I_()).end(),console.log("Service ready");return}catch{await new Promise((X)=>setTimeout(X,100))}console.error("Service failed to start. Check logs:"),console.error(` tail -f ${gQ}`),process.exit(1)}async function lQ(){let _=C6();if(!_.running){console.log("Service is not running");return}try{let z=await I_();if(Cz(z,{type:"shutdown"}),z.end(),console.log("Shutdown signal sent"),await new Promise((b)=>setTimeout(b,1000)),C6().running)process.kill(_.pid,"SIGTERM"),console.log(`Sent SIGTERM to PID ${_.pid}`)}catch{if(_.pid)process.kill(_.pid,"SIGTERM"),console.log(`Sent SIGTERM to PID ${_.pid}`)}}async function pQ(){let _=C6();if(!_.running){console.log("Service: not running");return}console.log(`Service: running (PID: ${_.pid})`);try{let z=await I_();Cz(z,{type:"status"});let A=await fQ(z,"status_response");if(z.end(),console.log(`Connections: ${A.connections}`),console.log(`Watching: ${A.watching}`),console.log(`Uptime: ${Math.round(A.uptime/1000)}s`),A.lastEvent){let b=Math.round((Date.now()-A.lastEvent.timestamp)/1000);console.log(`Last event: ${A.lastEvent.type} (${b}s ago)`),console.log(` Path: ${A.lastEvent.path}`)}}catch{console.log("Could not connect to service for status")}}async function dQ(){if(!T6(S1)){console.log("No watcher logs yet"),console.log(`Log file: ${S1}`);return}console.log(`Tailing ${S1} (Ctrl+C to stop)
166
+ `);let A=uQ(S1,"utf-8").trim().split(`
167
+ `).slice(-20);for(let Y of A)try{let X=JSON.parse(Y),Q=new Date(X.timestamp).toISOString();console.log(`[${Q}] ${X.type}: ${X.path}`)}catch{console.log(Y)}let{spawn:b}=await import("child_process"),G=b("tail",["-f",S1],{stdio:["ignore","pipe","inherit"]});zk({input:G.stdout}).on("line",(Y)=>{try{let X=JSON.parse(Y),Q=new Date(X.timestamp).toISOString();console.log(`[${Q}] ${X.type}: ${X.path}`)}catch{console.log(Y)}}),await new Promise(()=>{})}import{spawn as yu}from"child_process";import{existsSync as Lb,readFileSync as gu,appendFileSync as fu}from"fs";import{dirname as hu,resolve as jb}from"path";import{fileURLToPath as mu}from"url";var te=Object.freeze({status:"aborted"});function E(_,z,A){function b(X,Q){if(!X._zod)Object.defineProperty(X,"_zod",{value:{def:Q,constr:Y,traits:new Set},enumerable:!1});if(X._zod.traits.has(_))return;X._zod.traits.add(_),z(X,Q);let $=Y.prototype,H=Object.keys($);for(let B=0;B<H.length;B++){let Z=H[B];if(!(Z in X))X[Z]=$[Z].bind(X)}}let G=A?.Parent??Object;class J extends G{}Object.defineProperty(J,"name",{value:_});function Y(X){var Q;let $=A?.Parent?new J:this;b($,X),(Q=$._zod).deferred??(Q.deferred=[]);for(let H of $._zod.deferred)H();return $}return Object.defineProperty(Y,"init",{value:b}),Object.defineProperty(Y,Symbol.hasInstance,{value:(X)=>{if(A?.Parent&&X instanceof A.Parent)return!0;return X?._zod?.traits?.has(_)}}),Object.defineProperty(Y,"name",{value:_}),Y}var ee=Symbol("zod_brand");class S4 extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class vz extends Error{constructor(_){super(`Encountered unidirectional transform during encode: ${_}`);this.name="ZodEncodeError"}}var v6={};function O9(_){if(_)Object.assign(v6,_);return v6}var X0={};J8(X0,{unwrapMessage:()=>yz,uint8ArrayToHex:()=>Sk,uint8ArrayToBase64url:()=>Rk,uint8ArrayToBase64:()=>tQ,stringifyPrimitive:()=>h6,slugify:()=>Y2,shallowClone:()=>nQ,safeExtend:()=>Nk,required:()=>Ok,randomString:()=>Kk,propertyKeyTypes:()=>Q2,promiseAllObject:()=>Fk,primitiveTypes:()=>iQ,prefixIssues:()=>x4,pick:()=>Uk,partial:()=>Ek,parsedType:()=>B2,optionalKeys:()=>$2,omit:()=>Dk,objectClone:()=>Hk,numKeys:()=>qk,nullish:()=>fz,normalizeParams:()=>c,mergeDefs:()=>k4,merge:()=>wk,jsonStringifyReplacer:()=>k1,joinValues:()=>y6,issue:()=>x1,isPlainObject:()=>__,isObject:()=>x_,hexToUint8Array:()=>Pk,getSizableOrigin:()=>aQ,getParsedType:()=>Wk,getLengthableOrigin:()=>mz,getEnumValues:()=>gz,getElementAtPath:()=>Zk,floatSafeRemainder:()=>J2,finalizeIssue:()=>p9,extend:()=>Mk,escapeRegex:()=>I4,esc:()=>g6,defineLazy:()=>H0,createTransparentProxy:()=>Vk,cloneDef:()=>Bk,clone:()=>l9,cleanRegex:()=>hz,cleanEnum:()=>Lk,captureStackTrace:()=>f6,cached:()=>I1,base64urlToUint8Array:()=>jk,base64ToUint8Array:()=>sQ,assignProp:()=>e4,assertNotEqual:()=>Yk,assertNever:()=>Qk,assertIs:()=>Xk,assertEqual:()=>Jk,assert:()=>$k,allowsEval:()=>X2,aborted:()=>z_,NUMBER_FORMAT_RANGES:()=>H2,Class:()=>eQ,BIGINT_FORMAT_RANGES:()=>oQ});function Jk(_){return _}function Yk(_){return _}function Xk(_){}function Qk(_){throw Error("Unexpected value in exhaustive check")}function $k(_){}function gz(_){let z=Object.values(_).filter((b)=>typeof b==="number");return Object.entries(_).filter(([b,G])=>z.indexOf(+b)===-1).map(([b,G])=>G)}function y6(_,z="|"){return _.map((A)=>h6(A)).join(z)}function k1(_,z){if(typeof z==="bigint")return z.toString();return z}function I1(_){return{get value(){{let A=_();return Object.defineProperty(this,"value",{value:A}),A}throw Error("cached value already set")}}}function fz(_){return _===null||_===void 0}function hz(_){let z=_.startsWith("^")?1:0,A=_.endsWith("$")?_.length-1:_.length;return _.slice(z,A)}function J2(_,z){let A=(_.toString().split(".")[1]||"").length,b=z.toString(),G=(b.split(".")[1]||"").length;if(G===0&&/\d?e-\d?/.test(b)){let Q=b.match(/\d?e-(\d?)/);if(Q?.[1])G=Number.parseInt(Q[1])}let J=A>G?A:G,Y=Number.parseInt(_.toFixed(J).replace(".","")),X=Number.parseInt(z.toFixed(J).replace(".",""));return Y%X/10**J}var rQ=Symbol("evaluating");function H0(_,z,A){let b=void 0;Object.defineProperty(_,z,{get(){if(b===rQ)return;if(b===void 0)b=rQ,b=A();return b},set(G){Object.defineProperty(_,z,{value:G})},configurable:!0})}function Hk(_){return Object.create(Object.getPrototypeOf(_),Object.getOwnPropertyDescriptors(_))}function e4(_,z,A){Object.defineProperty(_,z,{value:A,writable:!0,enumerable:!0,configurable:!0})}function k4(..._){let z={};for(let A of _){let b=Object.getOwnPropertyDescriptors(A);Object.assign(z,b)}return Object.defineProperties({},z)}function Bk(_){return k4(_._zod.def)}function Zk(_,z){if(!z)return _;return z.reduce((A,b)=>A?.[b],_)}function Fk(_){let z=Object.keys(_),A=z.map((b)=>_[b]);return Promise.all(A).then((b)=>{let G={};for(let J=0;J<z.length;J++)G[z[J]]=b[J];return G})}function Kk(_=10){let A="";for(let b=0;b<_;b++)A+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return A}function g6(_){return JSON.stringify(_)}function Y2(_){return _.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var f6="captureStackTrace"in Error?Error.captureStackTrace:(..._)=>{};function x_(_){return typeof _==="object"&&_!==null&&!Array.isArray(_)}var X2=I1(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(_){return!1}});function __(_){if(x_(_)===!1)return!1;let z=_.constructor;if(z===void 0)return!0;if(typeof z!=="function")return!0;let A=z.prototype;if(x_(A)===!1)return!1;if(Object.prototype.hasOwnProperty.call(A,"isPrototypeOf")===!1)return!1;return!0}function nQ(_){if(__(_))return{..._};if(Array.isArray(_))return[..._];return _}function qk(_){let z=0;for(let A in _)if(Object.prototype.hasOwnProperty.call(_,A))z++;return z}var Wk=(_)=>{let z=typeof _;switch(z){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(_)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray(_))return"array";if(_===null)return"null";if(_.then&&typeof _.then==="function"&&_.catch&&typeof _.catch==="function")return"promise";if(typeof Map<"u"&&_ instanceof Map)return"map";if(typeof Set<"u"&&_ instanceof Set)return"set";if(typeof Date<"u"&&_ instanceof Date)return"date";if(typeof File<"u"&&_ instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${z}`)}},Q2=new Set(["string","number","symbol"]),iQ=new Set(["string","number","bigint","boolean","symbol","undefined"]);function I4(_){return _.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function l9(_,z,A){let b=new _._zod.constr(z??_._zod.def);if(!z||A?.parent)b._zod.parent=_;return b}function c(_){let z=_;if(!z)return{};if(typeof z==="string")return{error:()=>z};if(z?.message!==void 0){if(z?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");z.error=z.message}if(delete z.message,typeof z.error==="string")return{...z,error:()=>z.error};return z}function Vk(_){let z;return new Proxy({},{get(A,b,G){return z??(z=_()),Reflect.get(z,b,G)},set(A,b,G,J){return z??(z=_()),Reflect.set(z,b,G,J)},has(A,b){return z??(z=_()),Reflect.has(z,b)},deleteProperty(A,b){return z??(z=_()),Reflect.deleteProperty(z,b)},ownKeys(A){return z??(z=_()),Reflect.ownKeys(z)},getOwnPropertyDescriptor(A,b){return z??(z=_()),Reflect.getOwnPropertyDescriptor(z,b)},defineProperty(A,b,G){return z??(z=_()),Reflect.defineProperty(z,b,G)}})}function h6(_){if(typeof _==="bigint")return _.toString()+"n";if(typeof _==="string")return`"${_}"`;return`${_}`}function $2(_){return Object.keys(_).filter((z)=>{return _[z]._zod.optin==="optional"&&_[z]._zod.optout==="optional"})}var H2={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},oQ={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Uk(_,z){let A=_._zod.def,b=A.checks;if(b&&b.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let J=k4(_._zod.def,{get shape(){let Y={};for(let X in z){if(!(X in A.shape))throw Error(`Unrecognized key: "${X}"`);if(!z[X])continue;Y[X]=A.shape[X]}return e4(this,"shape",Y),Y},checks:[]});return l9(_,J)}function Dk(_,z){let A=_._zod.def,b=A.checks;if(b&&b.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let J=k4(_._zod.def,{get shape(){let Y={..._._zod.def.shape};for(let X in z){if(!(X in A.shape))throw Error(`Unrecognized key: "${X}"`);if(!z[X])continue;delete Y[X]}return e4(this,"shape",Y),Y},checks:[]});return l9(_,J)}function Mk(_,z){if(!__(z))throw Error("Invalid input to extend: expected a plain object");let A=_._zod.def.checks;if(A&&A.length>0){let J=_._zod.def.shape;for(let Y in z)if(Object.getOwnPropertyDescriptor(J,Y)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let G=k4(_._zod.def,{get shape(){let J={..._._zod.def.shape,...z};return e4(this,"shape",J),J}});return l9(_,G)}function Nk(_,z){if(!__(z))throw Error("Invalid input to safeExtend: expected a plain object");let A=k4(_._zod.def,{get shape(){let b={..._._zod.def.shape,...z};return e4(this,"shape",b),b}});return l9(_,A)}function wk(_,z){let A=k4(_._zod.def,{get shape(){let b={..._._zod.def.shape,...z._zod.def.shape};return e4(this,"shape",b),b},get catchall(){return z._zod.def.catchall},checks:[]});return l9(_,A)}function Ek(_,z,A){let G=z._zod.def.checks;if(G&&G.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let Y=k4(z._zod.def,{get shape(){let X=z._zod.def.shape,Q={...X};if(A)for(let $ in A){if(!($ in X))throw Error(`Unrecognized key: "${$}"`);if(!A[$])continue;Q[$]=_?new _({type:"optional",innerType:X[$]}):X[$]}else for(let $ in X)Q[$]=_?new _({type:"optional",innerType:X[$]}):X[$];return e4(this,"shape",Q),Q},checks:[]});return l9(z,Y)}function Ok(_,z,A){let b=k4(z._zod.def,{get shape(){let G=z._zod.def.shape,J={...G};if(A)for(let Y in A){if(!(Y in J))throw Error(`Unrecognized key: "${Y}"`);if(!A[Y])continue;J[Y]=new _({type:"nonoptional",innerType:G[Y]})}else for(let Y in G)J[Y]=new _({type:"nonoptional",innerType:G[Y]});return e4(this,"shape",J),J}});return l9(z,b)}function z_(_,z=0){if(_.aborted===!0)return!0;for(let A=z;A<_.issues.length;A++)if(_.issues[A]?.continue!==!0)return!0;return!1}function x4(_,z){return z.map((A)=>{var b;return(b=A).path??(b.path=[]),A.path.unshift(_),A})}function yz(_){return typeof _==="string"?_:_?.message}function p9(_,z,A){let b={..._,path:_.path??[]};if(!_.message){let G=yz(_.inst?._zod.def?.error?.(_))??yz(z?.error?.(_))??yz(A.customError?.(_))??yz(A.localeError?.(_))??"Invalid input";b.message=G}if(delete b.inst,delete b.continue,!z?.reportInput)delete b.input;return b}function aQ(_){if(_ instanceof Set)return"set";if(_ instanceof Map)return"map";if(_ instanceof File)return"file";return"unknown"}function mz(_){if(Array.isArray(_))return"array";if(typeof _==="string")return"string";return"unknown"}function B2(_){let z=typeof _;switch(z){case"number":return Number.isNaN(_)?"nan":"number";case"object":{if(_===null)return"null";if(Array.isArray(_))return"array";let A=_;if(A&&Object.getPrototypeOf(A)!==Object.prototype&&"constructor"in A&&A.constructor)return A.constructor.name}}return z}function x1(..._){let[z,A,b]=_;if(typeof z==="string")return{message:z,code:"custom",input:A,inst:b};return{...z}}function Lk(_){return Object.entries(_).filter(([z,A])=>{return Number.isNaN(Number.parseInt(z,10))}).map((z)=>z[1])}function sQ(_){let z=atob(_),A=new Uint8Array(z.length);for(let b=0;b<z.length;b++)A[b]=z.charCodeAt(b);return A}function tQ(_){let z="";for(let A=0;A<_.length;A++)z+=String.fromCharCode(_[A]);return btoa(z)}function jk(_){let z=_.replace(/-/g,"+").replace(/_/g,"/"),A="=".repeat((4-z.length%4)%4);return sQ(z+A)}function Rk(_){return tQ(_).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Pk(_){let z=_.replace(/^0x/,"");if(z.length%2!==0)throw Error("Invalid hex string length");let A=new Uint8Array(z.length/2);for(let b=0;b<z.length;b+=2)A[b/2]=Number.parseInt(z.slice(b,b+2),16);return A}function Sk(_){return Array.from(_).map((z)=>z.toString(16).padStart(2,"0")).join("")}class eQ{constructor(..._){}}var _$=(_,z)=>{_.name="$ZodError",Object.defineProperty(_,"_zod",{value:_._zod,enumerable:!1}),Object.defineProperty(_,"issues",{value:z,enumerable:!1}),_.message=JSON.stringify(z,k1,2),Object.defineProperty(_,"toString",{value:()=>_.message,enumerable:!1})},m6=E("$ZodError",_$),Z2=E("$ZodError",_$,{Parent:Error});function z$(_,z=(A)=>A.message){let A={},b=[];for(let G of _.issues)if(G.path.length>0)A[G.path[0]]=A[G.path[0]]||[],A[G.path[0]].push(z(G));else b.push(z(G));return{formErrors:b,fieldErrors:A}}function A$(_,z=(A)=>A.message){let A={_errors:[]},b=(G)=>{for(let J of G.issues)if(J.code==="invalid_union"&&J.errors.length)J.errors.map((Y)=>b({issues:Y}));else if(J.code==="invalid_key")b({issues:J.issues});else if(J.code==="invalid_element")b({issues:J.issues});else if(J.path.length===0)A._errors.push(z(J));else{let Y=A,X=0;while(X<J.path.length){let Q=J.path[X];if(X!==J.path.length-1)Y[Q]=Y[Q]||{_errors:[]};else Y[Q]=Y[Q]||{_errors:[]},Y[Q]._errors.push(z(J));Y=Y[Q],X++}}};return b(_),A}var u6=(_)=>(z,A,b,G)=>{let J=b?Object.assign(b,{async:!1}):{async:!1},Y=z._zod.run({value:A,issues:[]},J);if(Y instanceof Promise)throw new S4;if(Y.issues.length){let X=new(G?.Err??_)(Y.issues.map((Q)=>p9(Q,J,O9())));throw f6(X,G?.callee),X}return Y.value};var c6=(_)=>async(z,A,b,G)=>{let J=b?Object.assign(b,{async:!0}):{async:!0},Y=z._zod.run({value:A,issues:[]},J);if(Y instanceof Promise)Y=await Y;if(Y.issues.length){let X=new(G?.Err??_)(Y.issues.map((Q)=>p9(Q,J,O9())));throw f6(X,G?.callee),X}return Y.value};var uz=(_)=>(z,A,b)=>{let G=b?{...b,async:!1}:{async:!1},J=z._zod.run({value:A,issues:[]},G);if(J instanceof Promise)throw new S4;return J.issues.length?{success:!1,error:new(_??m6)(J.issues.map((Y)=>p9(Y,G,O9())))}:{success:!0,data:J.value}},cz=uz(Z2),lz=(_)=>async(z,A,b)=>{let G=b?Object.assign(b,{async:!0}):{async:!0},J=z._zod.run({value:A,issues:[]},G);if(J instanceof Promise)J=await J;return J.issues.length?{success:!1,error:new _(J.issues.map((Y)=>p9(Y,G,O9())))}:{success:!0,data:J.value}},l6=lz(Z2),b$=(_)=>(z,A,b)=>{let G=b?Object.assign(b,{direction:"backward"}):{direction:"backward"};return u6(_)(z,A,G)};var G$=(_)=>(z,A,b)=>{return u6(_)(z,A,b)};var J$=(_)=>async(z,A,b)=>{let G=b?Object.assign(b,{direction:"backward"}):{direction:"backward"};return c6(_)(z,A,G)};var Y$=(_)=>async(z,A,b)=>{return c6(_)(z,A,b)};var X$=(_)=>(z,A,b)=>{let G=b?Object.assign(b,{direction:"backward"}):{direction:"backward"};return uz(_)(z,A,G)};var Q$=(_)=>(z,A,b)=>{return uz(_)(z,A,b)};var $$=(_)=>async(z,A,b)=>{let G=b?Object.assign(b,{direction:"backward"}):{direction:"backward"};return lz(_)(z,A,G)};var H$=(_)=>async(z,A,b)=>{return lz(_)(z,A,b)};var B$=/^[cC][^\s-]{8,}$/,Z$=/^[0-9a-z]+$/,F$=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,K$=/^[0-9a-vA-V]{20}$/,q$=/^[A-Za-z0-9]{27}$/,W$=/^[a-zA-Z0-9_-]{21}$/,V$=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var U$=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,F2=(_)=>{if(!_)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${_}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var D$=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var Ik="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function M$(){return new RegExp(Ik,"u")}var N$=/^(?:(?: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])$/,w$=/^(([0-9a-fA-F]{1,4}:){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}|:))$/;var E$=/^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/,O$=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,L$=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,K2=/^[A-Za-z0-9_-]*$/;var j$=/^\+[1-9]\d{6,14}$/,R$="(?:(?:\\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])))",P$=new RegExp(`^${R$}$`);function S$(_){return typeof _.precision==="number"?_.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":_.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${_.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function k$(_){return new RegExp(`^${S$(_)}$`)}function I$(_){let z=S$({precision:_.precision}),A=["Z"];if(_.local)A.push("");if(_.offset)A.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let b=`${z}(?:${A.join("|")})`;return new RegExp(`^${R$}T(?:${b})$`)}var x$=(_)=>{let z=_?`[\\s\\S]{${_?.minimum??0},${_?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${z}$`)};var T$=/^-?\d+$/,p6=/^-?\d+(?:\.\d+)?$/,C$=/^(?:true|false)$/i,v$=/^null$/i;var y$=/^[^A-Z]*$/,g$=/^[^a-z]*$/;var f0=E("$ZodCheck",(_,z)=>{var A;_._zod??(_._zod={}),_._zod.def=z,(A=_._zod).onattach??(A.onattach=[])}),f$={number:"number",bigint:"bigint",object:"date"},q2=E("$ZodCheckLessThan",(_,z)=>{f0.init(_,z);let A=f$[typeof z.value];_._zod.onattach.push((b)=>{let G=b._zod.bag,J=(z.inclusive?G.maximum:G.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(z.value<J)if(z.inclusive)G.maximum=z.value;else G.exclusiveMaximum=z.value}),_._zod.check=(b)=>{if(z.inclusive?b.value<=z.value:b.value<z.value)return;b.issues.push({origin:A,code:"too_big",maximum:typeof z.value==="object"?z.value.getTime():z.value,input:b.value,inclusive:z.inclusive,inst:_,continue:!z.abort})}}),W2=E("$ZodCheckGreaterThan",(_,z)=>{f0.init(_,z);let A=f$[typeof z.value];_._zod.onattach.push((b)=>{let G=b._zod.bag,J=(z.inclusive?G.minimum:G.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(z.value>J)if(z.inclusive)G.minimum=z.value;else G.exclusiveMinimum=z.value}),_._zod.check=(b)=>{if(z.inclusive?b.value>=z.value:b.value>z.value)return;b.issues.push({origin:A,code:"too_small",minimum:typeof z.value==="object"?z.value.getTime():z.value,input:b.value,inclusive:z.inclusive,inst:_,continue:!z.abort})}}),h$=E("$ZodCheckMultipleOf",(_,z)=>{f0.init(_,z),_._zod.onattach.push((A)=>{var b;(b=A._zod.bag).multipleOf??(b.multipleOf=z.value)}),_._zod.check=(A)=>{if(typeof A.value!==typeof z.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof A.value==="bigint"?A.value%z.value===BigInt(0):J2(A.value,z.value)===0)return;A.issues.push({origin:typeof A.value,code:"not_multiple_of",divisor:z.value,input:A.value,inst:_,continue:!z.abort})}}),m$=E("$ZodCheckNumberFormat",(_,z)=>{f0.init(_,z),z.format=z.format||"float64";let A=z.format?.includes("int"),b=A?"int":"number",[G,J]=H2[z.format];_._zod.onattach.push((Y)=>{let X=Y._zod.bag;if(X.format=z.format,X.minimum=G,X.maximum=J,A)X.pattern=T$}),_._zod.check=(Y)=>{let X=Y.value;if(A){if(!Number.isInteger(X)){Y.issues.push({expected:b,format:z.format,code:"invalid_type",continue:!1,input:X,inst:_});return}if(!Number.isSafeInteger(X)){if(X>0)Y.issues.push({input:X,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:_,origin:b,inclusive:!0,continue:!z.abort});else Y.issues.push({input:X,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:_,origin:b,inclusive:!0,continue:!z.abort});return}}if(X<G)Y.issues.push({origin:"number",input:X,code:"too_small",minimum:G,inclusive:!0,inst:_,continue:!z.abort});if(X>J)Y.issues.push({origin:"number",input:X,code:"too_big",maximum:J,inclusive:!0,inst:_,continue:!z.abort})}});var u$=E("$ZodCheckMaxLength",(_,z)=>{var A;f0.init(_,z),(A=_._zod.def).when??(A.when=(b)=>{let G=b.value;return!fz(G)&&G.length!==void 0}),_._zod.onattach.push((b)=>{let G=b._zod.bag.maximum??Number.POSITIVE_INFINITY;if(z.maximum<G)b._zod.bag.maximum=z.maximum}),_._zod.check=(b)=>{let G=b.value;if(G.length<=z.maximum)return;let Y=mz(G);b.issues.push({origin:Y,code:"too_big",maximum:z.maximum,inclusive:!0,input:G,inst:_,continue:!z.abort})}}),c$=E("$ZodCheckMinLength",(_,z)=>{var A;f0.init(_,z),(A=_._zod.def).when??(A.when=(b)=>{let G=b.value;return!fz(G)&&G.length!==void 0}),_._zod.onattach.push((b)=>{let G=b._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(z.minimum>G)b._zod.bag.minimum=z.minimum}),_._zod.check=(b)=>{let G=b.value;if(G.length>=z.minimum)return;let Y=mz(G);b.issues.push({origin:Y,code:"too_small",minimum:z.minimum,inclusive:!0,input:G,inst:_,continue:!z.abort})}}),l$=E("$ZodCheckLengthEquals",(_,z)=>{var A;f0.init(_,z),(A=_._zod.def).when??(A.when=(b)=>{let G=b.value;return!fz(G)&&G.length!==void 0}),_._zod.onattach.push((b)=>{let G=b._zod.bag;G.minimum=z.length,G.maximum=z.length,G.length=z.length}),_._zod.check=(b)=>{let G=b.value,J=G.length;if(J===z.length)return;let Y=mz(G),X=J>z.length;b.issues.push({origin:Y,...X?{code:"too_big",maximum:z.length}:{code:"too_small",minimum:z.length},inclusive:!0,exact:!0,input:b.value,inst:_,continue:!z.abort})}}),pz=E("$ZodCheckStringFormat",(_,z)=>{var A,b;if(f0.init(_,z),_._zod.onattach.push((G)=>{let J=G._zod.bag;if(J.format=z.format,z.pattern)J.patterns??(J.patterns=new Set),J.patterns.add(z.pattern)}),z.pattern)(A=_._zod).check??(A.check=(G)=>{if(z.pattern.lastIndex=0,z.pattern.test(G.value))return;G.issues.push({origin:"string",code:"invalid_format",format:z.format,input:G.value,...z.pattern?{pattern:z.pattern.toString()}:{},inst:_,continue:!z.abort})});else(b=_._zod).check??(b.check=()=>{})}),p$=E("$ZodCheckRegex",(_,z)=>{pz.init(_,z),_._zod.check=(A)=>{if(z.pattern.lastIndex=0,z.pattern.test(A.value))return;A.issues.push({origin:"string",code:"invalid_format",format:"regex",input:A.value,pattern:z.pattern.toString(),inst:_,continue:!z.abort})}}),d$=E("$ZodCheckLowerCase",(_,z)=>{z.pattern??(z.pattern=y$),pz.init(_,z)}),r$=E("$ZodCheckUpperCase",(_,z)=>{z.pattern??(z.pattern=g$),pz.init(_,z)}),n$=E("$ZodCheckIncludes",(_,z)=>{f0.init(_,z);let A=I4(z.includes),b=new RegExp(typeof z.position==="number"?`^.{${z.position}}${A}`:A);z.pattern=b,_._zod.onattach.push((G)=>{let J=G._zod.bag;J.patterns??(J.patterns=new Set),J.patterns.add(b)}),_._zod.check=(G)=>{if(G.value.includes(z.includes,z.position))return;G.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:z.includes,input:G.value,inst:_,continue:!z.abort})}}),i$=E("$ZodCheckStartsWith",(_,z)=>{f0.init(_,z);let A=new RegExp(`^${I4(z.prefix)}.*`);z.pattern??(z.pattern=A),_._zod.onattach.push((b)=>{let G=b._zod.bag;G.patterns??(G.patterns=new Set),G.patterns.add(A)}),_._zod.check=(b)=>{if(b.value.startsWith(z.prefix))return;b.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:z.prefix,input:b.value,inst:_,continue:!z.abort})}}),o$=E("$ZodCheckEndsWith",(_,z)=>{f0.init(_,z);let A=new RegExp(`.*${I4(z.suffix)}$`);z.pattern??(z.pattern=A),_._zod.onattach.push((b)=>{let G=b._zod.bag;G.patterns??(G.patterns=new Set),G.patterns.add(A)}),_._zod.check=(b)=>{if(b.value.endsWith(z.suffix))return;b.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:z.suffix,input:b.value,inst:_,continue:!z.abort})}});var a$=E("$ZodCheckOverwrite",(_,z)=>{f0.init(_,z),_._zod.check=(A)=>{A.value=z.tx(A.value)}});class V2{constructor(_=[]){if(this.content=[],this.indent=0,this)this.args=_}indented(_){this.indent+=1,_(this),this.indent-=1}write(_){if(typeof _==="function"){_(this,{execution:"sync"}),_(this,{execution:"async"});return}let A=_.split(`
168
168
  `).filter((J)=>J),b=Math.min(...A.map((J)=>J.length-J.trimStart().length)),G=A.map((J)=>J.slice(b)).map((J)=>" ".repeat(this.indent*2)+J);for(let J of G)this.content.push(J)}compile(){let _=Function,z=this?.args,b=[...(this?.content??[""]).map((G)=>` ${G}`)];return new _(...z,b.join(`
169
- `))}}var a$={major:4,minor:3,patch:5};var M0=E("$ZodType",(_,z)=>{var A;_??(_={}),_._zod.def=z,_._zod.bag=_._zod.bag||{},_._zod.version=a$;let b=[..._._zod.def.checks??[]];if(_._zod.traits.has("$ZodCheck"))b.unshift(_);for(let G of b)for(let J of G._zod.onattach)J(_);if(b.length===0)(A=_._zod).deferred??(A.deferred=[]),_._zod.deferred?.push(()=>{_._zod.run=_._zod.parse});else{let G=(Y,X,Q)=>{let $=z_(Y),H;for(let B of X){if(B._zod.def.when){if(!B._zod.def.when(Y))continue}else if($)continue;let Z=Y.issues.length,F=B._zod.check(Y);if(F instanceof Promise&&Q?.async===!1)throw new S4;if(H||F instanceof Promise)H=(H??Promise.resolve()).then(async()=>{if(await F,Y.issues.length===Z)return;if(!$)$=z_(Y,Z)});else{if(Y.issues.length===Z)continue;if(!$)$=z_(Y,Z)}}if(H)return H.then(()=>{return Y});return Y},J=(Y,X,Q)=>{if(z_(Y))return Y.aborted=!0,Y;let $=G(X,b,Q);if($ instanceof Promise){if(Q.async===!1)throw new S4;return $.then((H)=>_._zod.parse(H,Q))}return _._zod.parse($,Q)};_._zod.run=(Y,X)=>{if(X.skipChecks)return _._zod.parse(Y,X);if(X.direction==="backward"){let $=_._zod.parse({value:Y.value,issues:[]},{...X,skipChecks:!0});if($ instanceof Promise)return $.then((H)=>{return J(H,Y,X)});return J($,Y,X)}let Q=_._zod.parse(Y,X);if(Q instanceof Promise){if(X.async===!1)throw new S4;return Q.then(($)=>G($,b,X))}return G(Q,b,X)}}H0(_,"~standard",()=>({validate:(G)=>{try{let J=mz(_,G);return J.success?{value:J.data}:{issues:J.error?.issues}}catch(J){return m6(_,G).then((Y)=>Y.success?{value:Y.data}:{issues:Y.error?.issues})}},vendor:"zod",version:1}))}),d6=E("$ZodString",(_,z)=>{M0.init(_,z),_._zod.pattern=[..._?._zod.bag?.patterns??[]].pop()??k$(_._zod.bag),_._zod.parse=(A,b)=>{if(z.coerce)try{A.value=String(A.value)}catch(G){}if(typeof A.value==="string")return A;return A.issues.push({expected:"string",code:"invalid_type",input:A.value,inst:_}),A}}),N0=E("$ZodStringFormat",(_,z)=>{cz.init(_,z),d6.init(_,z)}),JH=E("$ZodGUID",(_,z)=>{z.pattern??(z.pattern=W$),N0.init(_,z)}),YH=E("$ZodUUID",(_,z)=>{if(z.version){let b={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[z.version];if(b===void 0)throw Error(`Invalid UUID version: "${z.version}"`);z.pattern??(z.pattern=B2(b))}else z.pattern??(z.pattern=B2());N0.init(_,z)}),XH=E("$ZodEmail",(_,z)=>{z.pattern??(z.pattern=V$),N0.init(_,z)}),QH=E("$ZodURL",(_,z)=>{N0.init(_,z),_._zod.check=(A)=>{try{let b=A.value.trim(),G=new URL(b);if(z.hostname){if(z.hostname.lastIndex=0,!z.hostname.test(G.hostname))A.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:z.hostname.source,input:A.value,inst:_,continue:!z.abort})}if(z.protocol){if(z.protocol.lastIndex=0,!z.protocol.test(G.protocol.endsWith(":")?G.protocol.slice(0,-1):G.protocol))A.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:z.protocol.source,input:A.value,inst:_,continue:!z.abort})}if(z.normalize)A.value=G.href;else A.value=b;return}catch(b){A.issues.push({code:"invalid_format",format:"url",input:A.value,inst:_,continue:!z.abort})}}}),$H=E("$ZodEmoji",(_,z)=>{z.pattern??(z.pattern=U$()),N0.init(_,z)}),HH=E("$ZodNanoID",(_,z)=>{z.pattern??(z.pattern=K$),N0.init(_,z)}),BH=E("$ZodCUID",(_,z)=>{z.pattern??(z.pattern=$$),N0.init(_,z)}),ZH=E("$ZodCUID2",(_,z)=>{z.pattern??(z.pattern=H$),N0.init(_,z)}),FH=E("$ZodULID",(_,z)=>{z.pattern??(z.pattern=B$),N0.init(_,z)}),KH=E("$ZodXID",(_,z)=>{z.pattern??(z.pattern=Z$),N0.init(_,z)}),qH=E("$ZodKSUID",(_,z)=>{z.pattern??(z.pattern=F$),N0.init(_,z)}),WH=E("$ZodISODateTime",(_,z)=>{z.pattern??(z.pattern=S$(z)),N0.init(_,z)}),VH=E("$ZodISODate",(_,z)=>{z.pattern??(z.pattern=j$),N0.init(_,z)}),UH=E("$ZodISOTime",(_,z)=>{z.pattern??(z.pattern=P$(z)),N0.init(_,z)}),DH=E("$ZodISODuration",(_,z)=>{z.pattern??(z.pattern=q$),N0.init(_,z)}),MH=E("$ZodIPv4",(_,z)=>{z.pattern??(z.pattern=D$),N0.init(_,z),_._zod.bag.format="ipv4"}),NH=E("$ZodIPv6",(_,z)=>{z.pattern??(z.pattern=M$),N0.init(_,z),_._zod.bag.format="ipv6",_._zod.check=(A)=>{try{new URL(`http://[${A.value}]`)}catch{A.issues.push({code:"invalid_format",format:"ipv6",input:A.value,inst:_,continue:!z.abort})}}});var wH=E("$ZodCIDRv4",(_,z)=>{z.pattern??(z.pattern=N$),N0.init(_,z)}),EH=E("$ZodCIDRv6",(_,z)=>{z.pattern??(z.pattern=w$),N0.init(_,z),_._zod.check=(A)=>{let b=A.value.split("/");try{if(b.length!==2)throw Error();let[G,J]=b;if(!J)throw Error();let Y=Number(J);if(`${Y}`!==J)throw Error();if(Y<0||Y>128)throw Error();new URL(`http://[${G}]`)}catch{A.issues.push({code:"invalid_format",format:"cidrv6",input:A.value,inst:_,continue:!z.abort})}}});function OH(_){if(_==="")return!0;if(_.length%4!==0)return!1;try{return atob(_),!0}catch{return!1}}var LH=E("$ZodBase64",(_,z)=>{z.pattern??(z.pattern=E$),N0.init(_,z),_._zod.bag.contentEncoding="base64",_._zod.check=(A)=>{if(OH(A.value))return;A.issues.push({code:"invalid_format",format:"base64",input:A.value,inst:_,continue:!z.abort})}});function Lk(_){if(!Z2.test(_))return!1;let z=_.replace(/[-_]/g,(b)=>b==="-"?"+":"/"),A=z.padEnd(Math.ceil(z.length/4)*4,"=");return OH(A)}var jH=E("$ZodBase64URL",(_,z)=>{z.pattern??(z.pattern=Z2),N0.init(_,z),_._zod.bag.contentEncoding="base64url",_._zod.check=(A)=>{if(Lk(A.value))return;A.issues.push({code:"invalid_format",format:"base64url",input:A.value,inst:_,continue:!z.abort})}}),RH=E("$ZodE164",(_,z)=>{z.pattern??(z.pattern=O$),N0.init(_,z)});function jk(_,z=null){try{let A=_.split(".");if(A.length!==3)return!1;let[b]=A;if(!b)return!1;let G=JSON.parse(atob(b));if("typ"in G&&G?.typ!=="JWT")return!1;if(!G.alg)return!1;if(z&&(!("alg"in G)||G.alg!==z))return!1;return!0}catch{return!1}}var PH=E("$ZodJWT",(_,z)=>{N0.init(_,z),_._zod.check=(A)=>{if(jk(A.value,z.alg))return;A.issues.push({code:"invalid_format",format:"jwt",input:A.value,inst:_,continue:!z.abort})}});var V2=E("$ZodNumber",(_,z)=>{M0.init(_,z),_._zod.pattern=_._zod.bag.pattern??u6,_._zod.parse=(A,b)=>{if(z.coerce)try{A.value=Number(A.value)}catch(Y){}let G=A.value;if(typeof G==="number"&&!Number.isNaN(G)&&Number.isFinite(G))return A;let J=typeof G==="number"?Number.isNaN(G)?"NaN":!Number.isFinite(G)?"Infinity":void 0:void 0;return A.issues.push({expected:"number",code:"invalid_type",input:G,inst:_,...J?{received:J}:{}}),A}}),SH=E("$ZodNumberFormat",(_,z)=>{f$.init(_,z),V2.init(_,z)}),kH=E("$ZodBoolean",(_,z)=>{M0.init(_,z),_._zod.pattern=x$,_._zod.parse=(A,b)=>{if(z.coerce)try{A.value=Boolean(A.value)}catch(J){}let G=A.value;if(typeof G==="boolean")return A;return A.issues.push({expected:"boolean",code:"invalid_type",input:G,inst:_}),A}});var IH=E("$ZodNull",(_,z)=>{M0.init(_,z),_._zod.pattern=T$,_._zod.values=new Set([null]),_._zod.parse=(A,b)=>{let G=A.value;if(G===null)return A;return A.issues.push({expected:"null",code:"invalid_type",input:G,inst:_}),A}});var xH=E("$ZodUnknown",(_,z)=>{M0.init(_,z),_._zod.parse=(A)=>A}),TH=E("$ZodNever",(_,z)=>{M0.init(_,z),_._zod.parse=(A,b)=>{return A.issues.push({expected:"never",code:"invalid_type",input:A.value,inst:_}),A}});function s$(_,z,A){if(_.issues.length)z.issues.push(...x4(A,_.issues));z.value[A]=_.value}var CH=E("$ZodArray",(_,z)=>{M0.init(_,z),_._zod.parse=(A,b)=>{let G=A.value;if(!Array.isArray(G))return A.issues.push({expected:"array",code:"invalid_type",input:G,inst:_}),A;A.value=Array(G.length);let J=[];for(let Y=0;Y<G.length;Y++){let X=G[Y],Q=z.element._zod.run({value:X,issues:[]},b);if(Q instanceof Promise)J.push(Q.then(($)=>s$($,A,Y)));else s$(Q,A,Y)}if(J.length)return Promise.all(J).then(()=>A);return A}});function p6(_,z,A,b,G){if(_.issues.length){if(G&&!(A in b))return;z.issues.push(...x4(A,_.issues))}if(_.value===void 0){if(A in b)z.value[A]=void 0}else z.value[A]=_.value}function vH(_){let z=Object.keys(_.shape);for(let b of z)if(!_.shape?.[b]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${b}": expected a Zod schema`);let A=X2(_.shape);return{..._,keys:z,keySet:new Set(z),numKeys:z.length,optionalKeys:new Set(A)}}function yH(_,z,A,b,G,J){let Y=[],X=G.keySet,Q=G.catchall._zod,$=Q.def.type,H=Q.optout==="optional";for(let B in z){if(X.has(B))continue;if($==="never"){Y.push(B);continue}let Z=Q.run({value:z[B],issues:[]},b);if(Z instanceof Promise)_.push(Z.then((F)=>p6(F,A,B,z,H)));else p6(Z,A,B,z,H)}if(Y.length)A.issues.push({code:"unrecognized_keys",keys:Y,input:z,inst:J});if(!_.length)return A;return Promise.all(_).then(()=>{return A})}var Rk=E("$ZodObject",(_,z)=>{if(M0.init(_,z),!Object.getOwnPropertyDescriptor(z,"shape")?.get){let X=z.shape;Object.defineProperty(z,"shape",{get:()=>{let Q={...X};return Object.defineProperty(z,"shape",{value:Q}),Q}})}let b=S1(()=>vH(z));H0(_._zod,"propValues",()=>{let X=z.shape,Q={};for(let $ in X){let H=X[$]._zod;if(H.values){Q[$]??(Q[$]=new Set);for(let B of H.values)Q[$].add(B)}}return Q});let G=I_,J=z.catchall,Y;_._zod.parse=(X,Q)=>{Y??(Y=b.value);let $=X.value;if(!G($))return X.issues.push({expected:"object",code:"invalid_type",input:$,inst:_}),X;X.value={};let H=[],B=Y.shape;for(let Z of Y.keys){let F=B[Z],K=F._zod.optout==="optional",q=F._zod.run({value:$[Z],issues:[]},Q);if(q instanceof Promise)H.push(q.then((W)=>p6(W,X,Z,$,K)));else p6(q,X,Z,$,K)}if(!J)return H.length?Promise.all(H).then(()=>X):X;return yH(H,$,X,Q,b.value,_)}}),gH=E("$ZodObjectJIT",(_,z)=>{Rk.init(_,z);let A=_._zod.parse,b=S1(()=>vH(z)),G=(Z)=>{let F=new q2(["shape","payload","ctx"]),K=b.value,q=(O)=>{let M=C6(O);return`shape[${M}]._zod.run({ value: input[${M}], issues: [] }, ctx)`};F.write("const input = payload.value;");let W=Object.create(null),V=0;for(let O of K.keys)W[O]=`key_${V++}`;F.write("const newResult = {};");for(let O of K.keys){let M=W[O],P=C6(O),L=Z[O]?._zod?.optout==="optional";if(F.write(`const ${M} = ${q(O)};`),L)F.write(`
169
+ `))}}var t$={major:4,minor:3,patch:5};var M0=E("$ZodType",(_,z)=>{var A;_??(_={}),_._zod.def=z,_._zod.bag=_._zod.bag||{},_._zod.version=t$;let b=[..._._zod.def.checks??[]];if(_._zod.traits.has("$ZodCheck"))b.unshift(_);for(let G of b)for(let J of G._zod.onattach)J(_);if(b.length===0)(A=_._zod).deferred??(A.deferred=[]),_._zod.deferred?.push(()=>{_._zod.run=_._zod.parse});else{let G=(Y,X,Q)=>{let $=z_(Y),H;for(let B of X){if(B._zod.def.when){if(!B._zod.def.when(Y))continue}else if($)continue;let Z=Y.issues.length,F=B._zod.check(Y);if(F instanceof Promise&&Q?.async===!1)throw new S4;if(H||F instanceof Promise)H=(H??Promise.resolve()).then(async()=>{if(await F,Y.issues.length===Z)return;if(!$)$=z_(Y,Z)});else{if(Y.issues.length===Z)continue;if(!$)$=z_(Y,Z)}}if(H)return H.then(()=>{return Y});return Y},J=(Y,X,Q)=>{if(z_(Y))return Y.aborted=!0,Y;let $=G(X,b,Q);if($ instanceof Promise){if(Q.async===!1)throw new S4;return $.then((H)=>_._zod.parse(H,Q))}return _._zod.parse($,Q)};_._zod.run=(Y,X)=>{if(X.skipChecks)return _._zod.parse(Y,X);if(X.direction==="backward"){let $=_._zod.parse({value:Y.value,issues:[]},{...X,skipChecks:!0});if($ instanceof Promise)return $.then((H)=>{return J(H,Y,X)});return J($,Y,X)}let Q=_._zod.parse(Y,X);if(Q instanceof Promise){if(X.async===!1)throw new S4;return Q.then(($)=>G($,b,X))}return G(Q,b,X)}}H0(_,"~standard",()=>({validate:(G)=>{try{let J=cz(_,G);return J.success?{value:J.data}:{issues:J.error?.issues}}catch(J){return l6(_,G).then((Y)=>Y.success?{value:Y.data}:{issues:Y.error?.issues})}},vendor:"zod",version:1}))}),i6=E("$ZodString",(_,z)=>{M0.init(_,z),_._zod.pattern=[..._?._zod.bag?.patterns??[]].pop()??x$(_._zod.bag),_._zod.parse=(A,b)=>{if(z.coerce)try{A.value=String(A.value)}catch(G){}if(typeof A.value==="string")return A;return A.issues.push({expected:"string",code:"invalid_type",input:A.value,inst:_}),A}}),N0=E("$ZodStringFormat",(_,z)=>{pz.init(_,z),i6.init(_,z)}),XH=E("$ZodGUID",(_,z)=>{z.pattern??(z.pattern=U$),N0.init(_,z)}),QH=E("$ZodUUID",(_,z)=>{if(z.version){let b={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[z.version];if(b===void 0)throw Error(`Invalid UUID version: "${z.version}"`);z.pattern??(z.pattern=F2(b))}else z.pattern??(z.pattern=F2());N0.init(_,z)}),$H=E("$ZodEmail",(_,z)=>{z.pattern??(z.pattern=D$),N0.init(_,z)}),HH=E("$ZodURL",(_,z)=>{N0.init(_,z),_._zod.check=(A)=>{try{let b=A.value.trim(),G=new URL(b);if(z.hostname){if(z.hostname.lastIndex=0,!z.hostname.test(G.hostname))A.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:z.hostname.source,input:A.value,inst:_,continue:!z.abort})}if(z.protocol){if(z.protocol.lastIndex=0,!z.protocol.test(G.protocol.endsWith(":")?G.protocol.slice(0,-1):G.protocol))A.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:z.protocol.source,input:A.value,inst:_,continue:!z.abort})}if(z.normalize)A.value=G.href;else A.value=b;return}catch(b){A.issues.push({code:"invalid_format",format:"url",input:A.value,inst:_,continue:!z.abort})}}}),BH=E("$ZodEmoji",(_,z)=>{z.pattern??(z.pattern=M$()),N0.init(_,z)}),ZH=E("$ZodNanoID",(_,z)=>{z.pattern??(z.pattern=W$),N0.init(_,z)}),FH=E("$ZodCUID",(_,z)=>{z.pattern??(z.pattern=B$),N0.init(_,z)}),KH=E("$ZodCUID2",(_,z)=>{z.pattern??(z.pattern=Z$),N0.init(_,z)}),qH=E("$ZodULID",(_,z)=>{z.pattern??(z.pattern=F$),N0.init(_,z)}),WH=E("$ZodXID",(_,z)=>{z.pattern??(z.pattern=K$),N0.init(_,z)}),VH=E("$ZodKSUID",(_,z)=>{z.pattern??(z.pattern=q$),N0.init(_,z)}),UH=E("$ZodISODateTime",(_,z)=>{z.pattern??(z.pattern=I$(z)),N0.init(_,z)}),DH=E("$ZodISODate",(_,z)=>{z.pattern??(z.pattern=P$),N0.init(_,z)}),MH=E("$ZodISOTime",(_,z)=>{z.pattern??(z.pattern=k$(z)),N0.init(_,z)}),NH=E("$ZodISODuration",(_,z)=>{z.pattern??(z.pattern=V$),N0.init(_,z)}),wH=E("$ZodIPv4",(_,z)=>{z.pattern??(z.pattern=N$),N0.init(_,z),_._zod.bag.format="ipv4"}),EH=E("$ZodIPv6",(_,z)=>{z.pattern??(z.pattern=w$),N0.init(_,z),_._zod.bag.format="ipv6",_._zod.check=(A)=>{try{new URL(`http://[${A.value}]`)}catch{A.issues.push({code:"invalid_format",format:"ipv6",input:A.value,inst:_,continue:!z.abort})}}});var OH=E("$ZodCIDRv4",(_,z)=>{z.pattern??(z.pattern=E$),N0.init(_,z)}),LH=E("$ZodCIDRv6",(_,z)=>{z.pattern??(z.pattern=O$),N0.init(_,z),_._zod.check=(A)=>{let b=A.value.split("/");try{if(b.length!==2)throw Error();let[G,J]=b;if(!J)throw Error();let Y=Number(J);if(`${Y}`!==J)throw Error();if(Y<0||Y>128)throw Error();new URL(`http://[${G}]`)}catch{A.issues.push({code:"invalid_format",format:"cidrv6",input:A.value,inst:_,continue:!z.abort})}}});function jH(_){if(_==="")return!0;if(_.length%4!==0)return!1;try{return atob(_),!0}catch{return!1}}var RH=E("$ZodBase64",(_,z)=>{z.pattern??(z.pattern=L$),N0.init(_,z),_._zod.bag.contentEncoding="base64",_._zod.check=(A)=>{if(jH(A.value))return;A.issues.push({code:"invalid_format",format:"base64",input:A.value,inst:_,continue:!z.abort})}});function Ck(_){if(!K2.test(_))return!1;let z=_.replace(/[-_]/g,(b)=>b==="-"?"+":"/"),A=z.padEnd(Math.ceil(z.length/4)*4,"=");return jH(A)}var PH=E("$ZodBase64URL",(_,z)=>{z.pattern??(z.pattern=K2),N0.init(_,z),_._zod.bag.contentEncoding="base64url",_._zod.check=(A)=>{if(Ck(A.value))return;A.issues.push({code:"invalid_format",format:"base64url",input:A.value,inst:_,continue:!z.abort})}}),SH=E("$ZodE164",(_,z)=>{z.pattern??(z.pattern=j$),N0.init(_,z)});function vk(_,z=null){try{let A=_.split(".");if(A.length!==3)return!1;let[b]=A;if(!b)return!1;let G=JSON.parse(atob(b));if("typ"in G&&G?.typ!=="JWT")return!1;if(!G.alg)return!1;if(z&&(!("alg"in G)||G.alg!==z))return!1;return!0}catch{return!1}}var kH=E("$ZodJWT",(_,z)=>{N0.init(_,z),_._zod.check=(A)=>{if(vk(A.value,z.alg))return;A.issues.push({code:"invalid_format",format:"jwt",input:A.value,inst:_,continue:!z.abort})}});var D2=E("$ZodNumber",(_,z)=>{M0.init(_,z),_._zod.pattern=_._zod.bag.pattern??p6,_._zod.parse=(A,b)=>{if(z.coerce)try{A.value=Number(A.value)}catch(Y){}let G=A.value;if(typeof G==="number"&&!Number.isNaN(G)&&Number.isFinite(G))return A;let J=typeof G==="number"?Number.isNaN(G)?"NaN":!Number.isFinite(G)?"Infinity":void 0:void 0;return A.issues.push({expected:"number",code:"invalid_type",input:G,inst:_,...J?{received:J}:{}}),A}}),IH=E("$ZodNumberFormat",(_,z)=>{m$.init(_,z),D2.init(_,z)}),xH=E("$ZodBoolean",(_,z)=>{M0.init(_,z),_._zod.pattern=C$,_._zod.parse=(A,b)=>{if(z.coerce)try{A.value=Boolean(A.value)}catch(J){}let G=A.value;if(typeof G==="boolean")return A;return A.issues.push({expected:"boolean",code:"invalid_type",input:G,inst:_}),A}});var TH=E("$ZodNull",(_,z)=>{M0.init(_,z),_._zod.pattern=v$,_._zod.values=new Set([null]),_._zod.parse=(A,b)=>{let G=A.value;if(G===null)return A;return A.issues.push({expected:"null",code:"invalid_type",input:G,inst:_}),A}});var CH=E("$ZodUnknown",(_,z)=>{M0.init(_,z),_._zod.parse=(A)=>A}),vH=E("$ZodNever",(_,z)=>{M0.init(_,z),_._zod.parse=(A,b)=>{return A.issues.push({expected:"never",code:"invalid_type",input:A.value,inst:_}),A}});function e$(_,z,A){if(_.issues.length)z.issues.push(...x4(A,_.issues));z.value[A]=_.value}var yH=E("$ZodArray",(_,z)=>{M0.init(_,z),_._zod.parse=(A,b)=>{let G=A.value;if(!Array.isArray(G))return A.issues.push({expected:"array",code:"invalid_type",input:G,inst:_}),A;A.value=Array(G.length);let J=[];for(let Y=0;Y<G.length;Y++){let X=G[Y],Q=z.element._zod.run({value:X,issues:[]},b);if(Q instanceof Promise)J.push(Q.then(($)=>e$($,A,Y)));else e$(Q,A,Y)}if(J.length)return Promise.all(J).then(()=>A);return A}});function n6(_,z,A,b,G){if(_.issues.length){if(G&&!(A in b))return;z.issues.push(...x4(A,_.issues))}if(_.value===void 0){if(A in b)z.value[A]=void 0}else z.value[A]=_.value}function gH(_){let z=Object.keys(_.shape);for(let b of z)if(!_.shape?.[b]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${b}": expected a Zod schema`);let A=$2(_.shape);return{..._,keys:z,keySet:new Set(z),numKeys:z.length,optionalKeys:new Set(A)}}function fH(_,z,A,b,G,J){let Y=[],X=G.keySet,Q=G.catchall._zod,$=Q.def.type,H=Q.optout==="optional";for(let B in z){if(X.has(B))continue;if($==="never"){Y.push(B);continue}let Z=Q.run({value:z[B],issues:[]},b);if(Z instanceof Promise)_.push(Z.then((F)=>n6(F,A,B,z,H)));else n6(Z,A,B,z,H)}if(Y.length)A.issues.push({code:"unrecognized_keys",keys:Y,input:z,inst:J});if(!_.length)return A;return Promise.all(_).then(()=>{return A})}var yk=E("$ZodObject",(_,z)=>{if(M0.init(_,z),!Object.getOwnPropertyDescriptor(z,"shape")?.get){let X=z.shape;Object.defineProperty(z,"shape",{get:()=>{let Q={...X};return Object.defineProperty(z,"shape",{value:Q}),Q}})}let b=I1(()=>gH(z));H0(_._zod,"propValues",()=>{let X=z.shape,Q={};for(let $ in X){let H=X[$]._zod;if(H.values){Q[$]??(Q[$]=new Set);for(let B of H.values)Q[$].add(B)}}return Q});let G=x_,J=z.catchall,Y;_._zod.parse=(X,Q)=>{Y??(Y=b.value);let $=X.value;if(!G($))return X.issues.push({expected:"object",code:"invalid_type",input:$,inst:_}),X;X.value={};let H=[],B=Y.shape;for(let Z of Y.keys){let F=B[Z],K=F._zod.optout==="optional",q=F._zod.run({value:$[Z],issues:[]},Q);if(q instanceof Promise)H.push(q.then((W)=>n6(W,X,Z,$,K)));else n6(q,X,Z,$,K)}if(!J)return H.length?Promise.all(H).then(()=>X):X;return fH(H,$,X,Q,b.value,_)}}),hH=E("$ZodObjectJIT",(_,z)=>{yk.init(_,z);let A=_._zod.parse,b=I1(()=>gH(z)),G=(Z)=>{let F=new V2(["shape","payload","ctx"]),K=b.value,q=(O)=>{let M=g6(O);return`shape[${M}]._zod.run({ value: input[${M}], issues: [] }, ctx)`};F.write("const input = payload.value;");let W=Object.create(null),V=0;for(let O of K.keys)W[O]=`key_${V++}`;F.write("const newResult = {};");for(let O of K.keys){let M=W[O],P=g6(O),L=Z[O]?._zod?.optout==="optional";if(F.write(`const ${M} = ${q(O)};`),L)F.write(`
170
170
  if (${M}.issues.length) {
171
171
  if (${P} in input) {
172
172
  payload.issues = payload.issues.concat(${M}.issues.map(iss => ({
@@ -200,9 +200,9 @@ ${A}`,G=[{regex:/(\s--message=)"([^"]*)"/,quote:'"',equalsForm:!0},{regex:/(\s--
200
200
  newResult[${P}] = ${M}.value;
201
201
  }
202
202
 
203
- `)}F.write("payload.value = newResult;"),F.write("return payload;");let w=F.compile();return(O,M)=>w(Z,O,M)},J,Y=I_,X=!x6.jitless,$=X&&J2.value,H=z.catchall,B;_._zod.parse=(Z,F)=>{B??(B=b.value);let K=Z.value;if(!Y(K))return Z.issues.push({expected:"object",code:"invalid_type",input:K,inst:_}),Z;if(X&&$&&F?.async===!1&&F.jitless!==!0){if(!J)J=G(z.shape);if(Z=J(Z,F),!H)return Z;return yH([],K,Z,F,B,_)}return A(Z,F)}});function t$(_,z,A,b){for(let J of _)if(J.issues.length===0)return z.value=J.value,z;let G=_.filter((J)=>!z_(J));if(G.length===1)return z.value=G[0].value,G[0];return z.issues.push({code:"invalid_union",input:z.value,inst:A,errors:_.map((J)=>J.issues.map((Y)=>l9(Y,b,O9())))}),z}var U2=E("$ZodUnion",(_,z)=>{M0.init(_,z),H0(_._zod,"optin",()=>z.options.some((G)=>G._zod.optin==="optional")?"optional":void 0),H0(_._zod,"optout",()=>z.options.some((G)=>G._zod.optout==="optional")?"optional":void 0),H0(_._zod,"values",()=>{if(z.options.every((G)=>G._zod.values))return new Set(z.options.flatMap((G)=>Array.from(G._zod.values)));return}),H0(_._zod,"pattern",()=>{if(z.options.every((G)=>G._zod.pattern)){let G=z.options.map((J)=>J._zod.pattern);return new RegExp(`^(${G.map((J)=>gz(J.source)).join("|")})$`)}return});let A=z.options.length===1,b=z.options[0]._zod.run;_._zod.parse=(G,J)=>{if(A)return b(G,J);let Y=!1,X=[];for(let Q of z.options){let $=Q._zod.run({value:G.value,issues:[]},J);if($ instanceof Promise)X.push($),Y=!0;else{if($.issues.length===0)return $;X.push($)}}if(!Y)return t$(X,G,_,J);return Promise.all(X).then((Q)=>{return t$(Q,G,_,J)})}});var fH=E("$ZodDiscriminatedUnion",(_,z)=>{z.inclusive=!1,U2.init(_,z);let A=_._zod.parse;H0(_._zod,"propValues",()=>{let G={};for(let J of z.options){let Y=J._zod.propValues;if(!Y||Object.keys(Y).length===0)throw Error(`Invalid discriminated union option at index "${z.options.indexOf(J)}"`);for(let[X,Q]of Object.entries(Y)){if(!G[X])G[X]=new Set;for(let $ of Q)G[X].add($)}}return G});let b=S1(()=>{let G=z.options,J=new Map;for(let Y of G){let X=Y._zod.propValues?.[z.discriminator];if(!X||X.size===0)throw Error(`Invalid discriminated union option at index "${z.options.indexOf(Y)}"`);for(let Q of X){if(J.has(Q))throw Error(`Duplicate discriminator value "${String(Q)}"`);J.set(Q,Y)}}return J});_._zod.parse=(G,J)=>{let Y=G.value;if(!I_(Y))return G.issues.push({code:"invalid_type",expected:"object",input:Y,inst:_}),G;let X=b.value.get(Y?.[z.discriminator]);if(X)return X._zod.run(G,J);if(z.unionFallback)return A(G,J);return G.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:z.discriminator,input:Y,path:[z.discriminator],inst:_}),G}}),hH=E("$ZodIntersection",(_,z)=>{M0.init(_,z),_._zod.parse=(A,b)=>{let G=A.value,J=z.left._zod.run({value:G,issues:[]},b),Y=z.right._zod.run({value:G,issues:[]},b);if(J instanceof Promise||Y instanceof Promise)return Promise.all([J,Y]).then(([Q,$])=>{return e$(A,Q,$)});return e$(A,J,Y)}});function W2(_,z){if(_===z)return{valid:!0,data:_};if(_ instanceof Date&&z instanceof Date&&+_===+z)return{valid:!0,data:_};if(__(_)&&__(z)){let A=Object.keys(z),b=Object.keys(_).filter((J)=>A.indexOf(J)!==-1),G={..._,...z};for(let J of b){let Y=W2(_[J],z[J]);if(!Y.valid)return{valid:!1,mergeErrorPath:[J,...Y.mergeErrorPath]};G[J]=Y.data}return{valid:!0,data:G}}if(Array.isArray(_)&&Array.isArray(z)){if(_.length!==z.length)return{valid:!1,mergeErrorPath:[]};let A=[];for(let b=0;b<_.length;b++){let G=_[b],J=z[b],Y=W2(G,J);if(!Y.valid)return{valid:!1,mergeErrorPath:[b,...Y.mergeErrorPath]};A.push(Y.data)}return{valid:!0,data:A}}return{valid:!1,mergeErrorPath:[]}}function e$(_,z,A){let b=new Map,G;for(let X of z.issues)if(X.code==="unrecognized_keys"){G??(G=X);for(let Q of X.keys){if(!b.has(Q))b.set(Q,{});b.get(Q).l=!0}}else _.issues.push(X);for(let X of A.issues)if(X.code==="unrecognized_keys")for(let Q of X.keys){if(!b.has(Q))b.set(Q,{});b.get(Q).r=!0}else _.issues.push(X);let J=[...b].filter(([,X])=>X.l&&X.r).map(([X])=>X);if(J.length&&G)_.issues.push({...G,keys:J});if(z_(_))return _;let Y=W2(z.value,A.value);if(!Y.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(Y.mergeErrorPath)}`);return _.value=Y.data,_}var mH=E("$ZodRecord",(_,z)=>{M0.init(_,z),_._zod.parse=(A,b)=>{let G=A.value;if(!__(G))return A.issues.push({expected:"record",code:"invalid_type",input:G,inst:_}),A;let J=[],Y=z.keyType._zod.values;if(Y){A.value={};let X=new Set;for(let $ of Y)if(typeof $==="string"||typeof $==="number"||typeof $==="symbol"){X.add(typeof $==="number"?$.toString():$);let H=z.valueType._zod.run({value:G[$],issues:[]},b);if(H instanceof Promise)J.push(H.then((B)=>{if(B.issues.length)A.issues.push(...x4($,B.issues));A.value[$]=B.value}));else{if(H.issues.length)A.issues.push(...x4($,H.issues));A.value[$]=H.value}}let Q;for(let $ in G)if(!X.has($))Q=Q??[],Q.push($);if(Q&&Q.length>0)A.issues.push({code:"unrecognized_keys",input:G,inst:_,keys:Q})}else{A.value={};for(let X of Reflect.ownKeys(G)){if(X==="__proto__")continue;let Q=z.keyType._zod.run({value:X,issues:[]},b);if(Q instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof X==="string"&&u6.test(X)&&Q.issues.length&&Q.issues.some((B)=>B.code==="invalid_type"&&B.expected==="number")){let B=z.keyType._zod.run({value:Number(X),issues:[]},b);if(B instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(B.issues.length===0)Q=B}if(Q.issues.length){if(z.mode==="loose")A.value[X]=G[X];else A.issues.push({code:"invalid_key",origin:"record",issues:Q.issues.map((B)=>l9(B,b,O9())),input:X,path:[X],inst:_});continue}let H=z.valueType._zod.run({value:G[X],issues:[]},b);if(H instanceof Promise)J.push(H.then((B)=>{if(B.issues.length)A.issues.push(...x4(X,B.issues));A.value[Q.value]=B.value}));else{if(H.issues.length)A.issues.push(...x4(X,H.issues));A.value[Q.value]=H.value}}}if(J.length)return Promise.all(J).then(()=>A);return A}});var uH=E("$ZodEnum",(_,z)=>{M0.init(_,z);let A=vz(z.entries),b=new Set(A);_._zod.values=b,_._zod.pattern=new RegExp(`^(${A.filter((G)=>Y2.has(typeof G)).map((G)=>typeof G==="string"?I4(G):G.toString()).join("|")})$`),_._zod.parse=(G,J)=>{let Y=G.value;if(b.has(Y))return G;return G.issues.push({code:"invalid_value",values:A,input:Y,inst:_}),G}}),cH=E("$ZodLiteral",(_,z)=>{if(M0.init(_,z),z.values.length===0)throw Error("Cannot create literal schema with no valid values");let A=new Set(z.values);_._zod.values=A,_._zod.pattern=new RegExp(`^(${z.values.map((b)=>typeof b==="string"?I4(b):b?I4(b.toString()):String(b)).join("|")})$`),_._zod.parse=(b,G)=>{let J=b.value;if(A.has(J))return b;return b.issues.push({code:"invalid_value",values:z.values,input:J,inst:_}),b}});var lH=E("$ZodTransform",(_,z)=>{M0.init(_,z),_._zod.parse=(A,b)=>{if(b.direction==="backward")throw new Tz(_.constructor.name);let G=z.transform(A.value,A);if(b.async)return(G instanceof Promise?G:Promise.resolve(G)).then((Y)=>{return A.value=Y,A});if(G instanceof Promise)throw new S4;return A.value=G,A}});function _H(_,z){if(_.issues.length&&z===void 0)return{issues:[],value:void 0};return _}var D2=E("$ZodOptional",(_,z)=>{M0.init(_,z),_._zod.optin="optional",_._zod.optout="optional",H0(_._zod,"values",()=>{return z.innerType._zod.values?new Set([...z.innerType._zod.values,void 0]):void 0}),H0(_._zod,"pattern",()=>{let A=z.innerType._zod.pattern;return A?new RegExp(`^(${gz(A.source)})?$`):void 0}),_._zod.parse=(A,b)=>{if(z.innerType._zod.optin==="optional"){let G=z.innerType._zod.run(A,b);if(G instanceof Promise)return G.then((J)=>_H(J,A.value));return _H(G,A.value)}if(A.value===void 0)return A;return z.innerType._zod.run(A,b)}}),pH=E("$ZodExactOptional",(_,z)=>{D2.init(_,z),H0(_._zod,"values",()=>z.innerType._zod.values),H0(_._zod,"pattern",()=>z.innerType._zod.pattern),_._zod.parse=(A,b)=>{return z.innerType._zod.run(A,b)}}),dH=E("$ZodNullable",(_,z)=>{M0.init(_,z),H0(_._zod,"optin",()=>z.innerType._zod.optin),H0(_._zod,"optout",()=>z.innerType._zod.optout),H0(_._zod,"pattern",()=>{let A=z.innerType._zod.pattern;return A?new RegExp(`^(${gz(A.source)}|null)$`):void 0}),H0(_._zod,"values",()=>{return z.innerType._zod.values?new Set([...z.innerType._zod.values,null]):void 0}),_._zod.parse=(A,b)=>{if(A.value===null)return A;return z.innerType._zod.run(A,b)}}),rH=E("$ZodDefault",(_,z)=>{M0.init(_,z),_._zod.optin="optional",H0(_._zod,"values",()=>z.innerType._zod.values),_._zod.parse=(A,b)=>{if(b.direction==="backward")return z.innerType._zod.run(A,b);if(A.value===void 0)return A.value=z.defaultValue,A;let G=z.innerType._zod.run(A,b);if(G instanceof Promise)return G.then((J)=>zH(J,z));return zH(G,z)}});function zH(_,z){if(_.value===void 0)_.value=z.defaultValue;return _}var nH=E("$ZodPrefault",(_,z)=>{M0.init(_,z),_._zod.optin="optional",H0(_._zod,"values",()=>z.innerType._zod.values),_._zod.parse=(A,b)=>{if(b.direction==="backward")return z.innerType._zod.run(A,b);if(A.value===void 0)A.value=z.defaultValue;return z.innerType._zod.run(A,b)}}),iH=E("$ZodNonOptional",(_,z)=>{M0.init(_,z),H0(_._zod,"values",()=>{let A=z.innerType._zod.values;return A?new Set([...A].filter((b)=>b!==void 0)):void 0}),_._zod.parse=(A,b)=>{let G=z.innerType._zod.run(A,b);if(G instanceof Promise)return G.then((J)=>AH(J,_));return AH(G,_)}});function AH(_,z){if(!_.issues.length&&_.value===void 0)_.issues.push({code:"invalid_type",expected:"nonoptional",input:_.value,inst:z});return _}var oH=E("$ZodCatch",(_,z)=>{M0.init(_,z),H0(_._zod,"optin",()=>z.innerType._zod.optin),H0(_._zod,"optout",()=>z.innerType._zod.optout),H0(_._zod,"values",()=>z.innerType._zod.values),_._zod.parse=(A,b)=>{if(b.direction==="backward")return z.innerType._zod.run(A,b);let G=z.innerType._zod.run(A,b);if(G instanceof Promise)return G.then((J)=>{if(A.value=J.value,J.issues.length)A.value=z.catchValue({...A,error:{issues:J.issues.map((Y)=>l9(Y,b,O9()))},input:A.value}),A.issues=[];return A});if(A.value=G.value,G.issues.length)A.value=z.catchValue({...A,error:{issues:G.issues.map((J)=>l9(J,b,O9()))},input:A.value}),A.issues=[];return A}});var aH=E("$ZodPipe",(_,z)=>{M0.init(_,z),H0(_._zod,"values",()=>z.in._zod.values),H0(_._zod,"optin",()=>z.in._zod.optin),H0(_._zod,"optout",()=>z.out._zod.optout),H0(_._zod,"propValues",()=>z.in._zod.propValues),_._zod.parse=(A,b)=>{if(b.direction==="backward"){let J=z.out._zod.run(A,b);if(J instanceof Promise)return J.then((Y)=>l6(Y,z.in,b));return l6(J,z.in,b)}let G=z.in._zod.run(A,b);if(G instanceof Promise)return G.then((J)=>l6(J,z.out,b));return l6(G,z.out,b)}});function l6(_,z,A){if(_.issues.length)return _.aborted=!0,_;return z._zod.run({value:_.value,issues:_.issues},A)}var sH=E("$ZodReadonly",(_,z)=>{M0.init(_,z),H0(_._zod,"propValues",()=>z.innerType._zod.propValues),H0(_._zod,"values",()=>z.innerType._zod.values),H0(_._zod,"optin",()=>z.innerType?._zod?.optin),H0(_._zod,"optout",()=>z.innerType?._zod?.optout),_._zod.parse=(A,b)=>{if(b.direction==="backward")return z.innerType._zod.run(A,b);let G=z.innerType._zod.run(A,b);if(G instanceof Promise)return G.then(bH);return bH(G)}});function bH(_){return _.value=Object.freeze(_.value),_}var tH=E("$ZodCustom",(_,z)=>{f0.init(_,z),M0.init(_,z),_._zod.parse=(A,b)=>{return A},_._zod.check=(A)=>{let b=A.value,G=z.fn(b);if(G instanceof Promise)return G.then((J)=>GH(J,A,b,_));GH(G,A,b,_);return}});function GH(_,z,A,b){if(!_){let G={code:"custom",input:A,inst:b,path:[...b._zod.def.path??[]],continue:!b._zod.def.abort};if(b._zod.def.params)G.params=b._zod.def.params;z.issues.push(k1(G))}}var Pk=()=>{let _={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function z(G){return _[G]??null}let A={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},b={nan:"NaN"};return(G)=>{switch(G.code){case"invalid_type":{let J=b[G.expected]??G.expected,Y=$2(G.input),X=b[Y]??Y;return`Invalid input: expected ${J}, received ${X}`}case"invalid_value":if(G.values.length===1)return`Invalid input: expected ${y6(G.values[0])}`;return`Invalid option: expected one of ${T6(G.values,"|")}`;case"too_big":{let J=G.inclusive?"<=":"<",Y=z(G.origin);if(Y)return`Too big: expected ${G.origin??"value"} to have ${J}${G.maximum.toString()} ${Y.unit??"elements"}`;return`Too big: expected ${G.origin??"value"} to be ${J}${G.maximum.toString()}`}case"too_small":{let J=G.inclusive?">=":">",Y=z(G.origin);if(Y)return`Too small: expected ${G.origin} to have ${J}${G.minimum.toString()} ${Y.unit}`;return`Too small: expected ${G.origin} to be ${J}${G.minimum.toString()}`}case"invalid_format":{let J=G;if(J.format==="starts_with")return`Invalid string: must start with "${J.prefix}"`;if(J.format==="ends_with")return`Invalid string: must end with "${J.suffix}"`;if(J.format==="includes")return`Invalid string: must include "${J.includes}"`;if(J.format==="regex")return`Invalid string: must match pattern ${J.pattern}`;return`Invalid ${A[J.format]??G.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${G.divisor}`;case"unrecognized_keys":return`Unrecognized key${G.keys.length>1?"s":""}: ${T6(G.keys,", ")}`;case"invalid_key":return`Invalid key in ${G.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${G.origin}`;default:return"Invalid input"}}};function M2(){return{localeError:Pk()}}var eH,G00=Symbol("ZodOutput"),J00=Symbol("ZodInput");class _B{constructor(){this._map=new WeakMap,this._idmap=new Map}add(_,...z){let A=z[0];if(this._map.set(_,A),A&&typeof A==="object"&&"id"in A)this._idmap.set(A.id,_);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(_){let z=this._map.get(_);if(z&&typeof z==="object"&&"id"in z)this._idmap.delete(z.id);return this._map.delete(_),this}get(_){let z=_._zod.parent;if(z){let A={...this.get(z)??{}};delete A.id;let b={...A,...this._map.get(_)};return Object.keys(b).length?b:void 0}return this._map.get(_)}has(_){return this._map.has(_)}}function Sk(){return new _B}(eH=globalThis).__zod_globalRegistry??(eH.__zod_globalRegistry=Sk());var x_=globalThis.__zod_globalRegistry;function zB(_,z){return new _({type:"string",...c(z)})}function AB(_,z){return new _({type:"string",format:"email",check:"string_format",abort:!1,...c(z)})}function N2(_,z){return new _({type:"string",format:"guid",check:"string_format",abort:!1,...c(z)})}function bB(_,z){return new _({type:"string",format:"uuid",check:"string_format",abort:!1,...c(z)})}function GB(_,z){return new _({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...c(z)})}function JB(_,z){return new _({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...c(z)})}function YB(_,z){return new _({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...c(z)})}function XB(_,z){return new _({type:"string",format:"url",check:"string_format",abort:!1,...c(z)})}function QB(_,z){return new _({type:"string",format:"emoji",check:"string_format",abort:!1,...c(z)})}function $B(_,z){return new _({type:"string",format:"nanoid",check:"string_format",abort:!1,...c(z)})}function HB(_,z){return new _({type:"string",format:"cuid",check:"string_format",abort:!1,...c(z)})}function BB(_,z){return new _({type:"string",format:"cuid2",check:"string_format",abort:!1,...c(z)})}function ZB(_,z){return new _({type:"string",format:"ulid",check:"string_format",abort:!1,...c(z)})}function FB(_,z){return new _({type:"string",format:"xid",check:"string_format",abort:!1,...c(z)})}function KB(_,z){return new _({type:"string",format:"ksuid",check:"string_format",abort:!1,...c(z)})}function qB(_,z){return new _({type:"string",format:"ipv4",check:"string_format",abort:!1,...c(z)})}function WB(_,z){return new _({type:"string",format:"ipv6",check:"string_format",abort:!1,...c(z)})}function VB(_,z){return new _({type:"string",format:"cidrv4",check:"string_format",abort:!1,...c(z)})}function UB(_,z){return new _({type:"string",format:"cidrv6",check:"string_format",abort:!1,...c(z)})}function DB(_,z){return new _({type:"string",format:"base64",check:"string_format",abort:!1,...c(z)})}function MB(_,z){return new _({type:"string",format:"base64url",check:"string_format",abort:!1,...c(z)})}function NB(_,z){return new _({type:"string",format:"e164",check:"string_format",abort:!1,...c(z)})}function wB(_,z){return new _({type:"string",format:"jwt",check:"string_format",abort:!1,...c(z)})}function EB(_,z){return new _({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...c(z)})}function OB(_,z){return new _({type:"string",format:"date",check:"string_format",...c(z)})}function LB(_,z){return new _({type:"string",format:"time",check:"string_format",precision:null,...c(z)})}function jB(_,z){return new _({type:"string",format:"duration",check:"string_format",...c(z)})}function RB(_,z){return new _({type:"number",checks:[],...c(z)})}function PB(_,z){return new _({type:"number",check:"number_format",abort:!1,format:"safeint",...c(z)})}function SB(_,z){return new _({type:"boolean",...c(z)})}function kB(_,z){return new _({type:"null",...c(z)})}function IB(_){return new _({type:"unknown"})}function xB(_,z){return new _({type:"never",...c(z)})}function r6(_,z){return new F2({check:"less_than",...c(z),value:_,inclusive:!1})}function lz(_,z){return new F2({check:"less_than",...c(z),value:_,inclusive:!0})}function n6(_,z){return new K2({check:"greater_than",...c(z),value:_,inclusive:!1})}function pz(_,z){return new K2({check:"greater_than",...c(z),value:_,inclusive:!0})}function i6(_,z){return new g$({check:"multiple_of",...c(z),value:_})}function o6(_,z){return new h$({check:"max_length",...c(z),maximum:_})}function I1(_,z){return new m$({check:"min_length",...c(z),minimum:_})}function a6(_,z){return new u$({check:"length_equals",...c(z),length:_})}function w2(_,z){return new c$({check:"string_format",format:"regex",...c(z),pattern:_})}function E2(_){return new l$({check:"string_format",format:"lowercase",...c(_)})}function O2(_){return new p$({check:"string_format",format:"uppercase",...c(_)})}function L2(_,z){return new d$({check:"string_format",format:"includes",...c(z),includes:_})}function j2(_,z){return new r$({check:"string_format",format:"starts_with",...c(z),prefix:_})}function R2(_,z){return new n$({check:"string_format",format:"ends_with",...c(z),suffix:_})}function A_(_){return new i$({check:"overwrite",tx:_})}function P2(_){return A_((z)=>z.normalize(_))}function S2(){return A_((_)=>_.trim())}function k2(){return A_((_)=>_.toLowerCase())}function I2(){return A_((_)=>_.toUpperCase())}function x2(){return A_((_)=>G2(_))}function TB(_,z,A){return new _({type:"array",element:z,...c(A)})}function CB(_,z,A){let b=c(A);return b.abort??(b.abort=!0),new _({type:"custom",check:"custom",fn:z,...b})}function vB(_,z,A){return new _({type:"custom",check:"custom",fn:z,...c(A)})}function yB(_){let z=kk((A)=>{return A.addIssue=(b)=>{if(typeof b==="string")A.issues.push(k1(b,A.value,z._zod.def));else{let G=b;if(G.fatal)G.continue=!1;G.code??(G.code="custom"),G.input??(G.input=A.value),G.inst??(G.inst=z),G.continue??(G.continue=!z._zod.def.abort),A.issues.push(k1(G))}},_(A.value,A)});return z}function kk(_,z){let A=new f0({check:"custom",...c(z)});return A._zod.check=_,A}function T2(_){let z=_?.target??"draft-2020-12";if(z==="draft-4")z="draft-04";if(z==="draft-7")z="draft-07";return{processors:_.processors??{},metadataRegistry:_?.metadata??x_,target:z,unrepresentable:_?.unrepresentable??"throw",override:_?.override??(()=>{}),io:_?.io??"output",counter:0,seen:new Map,cycles:_?.cycles??"ref",reused:_?.reused??"inline",external:_?.external??void 0}}function I0(_,z,A={path:[],schemaPath:[]}){var b;let G=_._zod.def,J=z.seen.get(_);if(J){if(J.count++,A.schemaPath.includes(_))J.cycle=A.path;return J.schema}let Y={schema:{},count:1,cycle:void 0,path:A.path};z.seen.set(_,Y);let X=_._zod.toJSONSchema?.();if(X)Y.schema=X;else{let H={...A,schemaPath:[...A.schemaPath,_],path:A.path};if(_._zod.processJSONSchema)_._zod.processJSONSchema(z,Y.schema,H);else{let Z=Y.schema,F=z.processors[G.type];if(!F)throw Error(`[toJSONSchema]: Non-representable type encountered: ${G.type}`);F(_,z,Z,H)}let B=_._zod.parent;if(B){if(!Y.ref)Y.ref=B;I0(B,z,H),z.seen.get(B).isParent=!0}}let Q=z.metadataRegistry.get(_);if(Q)Object.assign(Y.schema,Q);if(z.io==="input"&&z9(_))delete Y.schema.examples,delete Y.schema.default;if(z.io==="input"&&Y.schema._prefault)(b=Y.schema).default??(b.default=Y.schema._prefault);return delete Y.schema._prefault,z.seen.get(_).schema}function C2(_,z){let A=_.seen.get(z);if(!A)throw Error("Unprocessed schema. This is a bug in Zod.");let b=new Map;for(let Y of _.seen.entries()){let X=_.metadataRegistry.get(Y[0])?.id;if(X){let Q=b.get(X);if(Q&&Q!==Y[0])throw Error(`Duplicate schema id "${X}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);b.set(X,Y[0])}}let G=(Y)=>{let X=_.target==="draft-2020-12"?"$defs":"definitions";if(_.external){let B=_.external.registry.get(Y[0])?.id,Z=_.external.uri??((K)=>K);if(B)return{ref:Z(B)};let F=Y[1].defId??Y[1].schema.id??`schema${_.counter++}`;return Y[1].defId=F,{defId:F,ref:`${Z("__shared")}#/${X}/${F}`}}if(Y[1]===A)return{ref:"#"};let $=`${"#"}/${X}/`,H=Y[1].schema.id??`__schema${_.counter++}`;return{defId:H,ref:$+H}},J=(Y)=>{if(Y[1].schema.$ref)return;let X=Y[1],{ref:Q,defId:$}=G(Y);if(X.def={...X.schema},$)X.defId=$;let H=X.schema;for(let B in H)delete H[B];H.$ref=Q};if(_.cycles==="throw")for(let Y of _.seen.entries()){let X=Y[1];if(X.cycle)throw Error(`Cycle detected: #/${X.cycle?.join("/")}/<root>
203
+ `)}F.write("payload.value = newResult;"),F.write("return payload;");let w=F.compile();return(O,M)=>w(Z,O,M)},J,Y=x_,X=!v6.jitless,$=X&&X2.value,H=z.catchall,B;_._zod.parse=(Z,F)=>{B??(B=b.value);let K=Z.value;if(!Y(K))return Z.issues.push({expected:"object",code:"invalid_type",input:K,inst:_}),Z;if(X&&$&&F?.async===!1&&F.jitless!==!0){if(!J)J=G(z.shape);if(Z=J(Z,F),!H)return Z;return fH([],K,Z,F,B,_)}return A(Z,F)}});function _H(_,z,A,b){for(let J of _)if(J.issues.length===0)return z.value=J.value,z;let G=_.filter((J)=>!z_(J));if(G.length===1)return z.value=G[0].value,G[0];return z.issues.push({code:"invalid_union",input:z.value,inst:A,errors:_.map((J)=>J.issues.map((Y)=>p9(Y,b,O9())))}),z}var M2=E("$ZodUnion",(_,z)=>{M0.init(_,z),H0(_._zod,"optin",()=>z.options.some((G)=>G._zod.optin==="optional")?"optional":void 0),H0(_._zod,"optout",()=>z.options.some((G)=>G._zod.optout==="optional")?"optional":void 0),H0(_._zod,"values",()=>{if(z.options.every((G)=>G._zod.values))return new Set(z.options.flatMap((G)=>Array.from(G._zod.values)));return}),H0(_._zod,"pattern",()=>{if(z.options.every((G)=>G._zod.pattern)){let G=z.options.map((J)=>J._zod.pattern);return new RegExp(`^(${G.map((J)=>hz(J.source)).join("|")})$`)}return});let A=z.options.length===1,b=z.options[0]._zod.run;_._zod.parse=(G,J)=>{if(A)return b(G,J);let Y=!1,X=[];for(let Q of z.options){let $=Q._zod.run({value:G.value,issues:[]},J);if($ instanceof Promise)X.push($),Y=!0;else{if($.issues.length===0)return $;X.push($)}}if(!Y)return _H(X,G,_,J);return Promise.all(X).then((Q)=>{return _H(Q,G,_,J)})}});var mH=E("$ZodDiscriminatedUnion",(_,z)=>{z.inclusive=!1,M2.init(_,z);let A=_._zod.parse;H0(_._zod,"propValues",()=>{let G={};for(let J of z.options){let Y=J._zod.propValues;if(!Y||Object.keys(Y).length===0)throw Error(`Invalid discriminated union option at index "${z.options.indexOf(J)}"`);for(let[X,Q]of Object.entries(Y)){if(!G[X])G[X]=new Set;for(let $ of Q)G[X].add($)}}return G});let b=I1(()=>{let G=z.options,J=new Map;for(let Y of G){let X=Y._zod.propValues?.[z.discriminator];if(!X||X.size===0)throw Error(`Invalid discriminated union option at index "${z.options.indexOf(Y)}"`);for(let Q of X){if(J.has(Q))throw Error(`Duplicate discriminator value "${String(Q)}"`);J.set(Q,Y)}}return J});_._zod.parse=(G,J)=>{let Y=G.value;if(!x_(Y))return G.issues.push({code:"invalid_type",expected:"object",input:Y,inst:_}),G;let X=b.value.get(Y?.[z.discriminator]);if(X)return X._zod.run(G,J);if(z.unionFallback)return A(G,J);return G.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:z.discriminator,input:Y,path:[z.discriminator],inst:_}),G}}),uH=E("$ZodIntersection",(_,z)=>{M0.init(_,z),_._zod.parse=(A,b)=>{let G=A.value,J=z.left._zod.run({value:G,issues:[]},b),Y=z.right._zod.run({value:G,issues:[]},b);if(J instanceof Promise||Y instanceof Promise)return Promise.all([J,Y]).then(([Q,$])=>{return zH(A,Q,$)});return zH(A,J,Y)}});function U2(_,z){if(_===z)return{valid:!0,data:_};if(_ instanceof Date&&z instanceof Date&&+_===+z)return{valid:!0,data:_};if(__(_)&&__(z)){let A=Object.keys(z),b=Object.keys(_).filter((J)=>A.indexOf(J)!==-1),G={..._,...z};for(let J of b){let Y=U2(_[J],z[J]);if(!Y.valid)return{valid:!1,mergeErrorPath:[J,...Y.mergeErrorPath]};G[J]=Y.data}return{valid:!0,data:G}}if(Array.isArray(_)&&Array.isArray(z)){if(_.length!==z.length)return{valid:!1,mergeErrorPath:[]};let A=[];for(let b=0;b<_.length;b++){let G=_[b],J=z[b],Y=U2(G,J);if(!Y.valid)return{valid:!1,mergeErrorPath:[b,...Y.mergeErrorPath]};A.push(Y.data)}return{valid:!0,data:A}}return{valid:!1,mergeErrorPath:[]}}function zH(_,z,A){let b=new Map,G;for(let X of z.issues)if(X.code==="unrecognized_keys"){G??(G=X);for(let Q of X.keys){if(!b.has(Q))b.set(Q,{});b.get(Q).l=!0}}else _.issues.push(X);for(let X of A.issues)if(X.code==="unrecognized_keys")for(let Q of X.keys){if(!b.has(Q))b.set(Q,{});b.get(Q).r=!0}else _.issues.push(X);let J=[...b].filter(([,X])=>X.l&&X.r).map(([X])=>X);if(J.length&&G)_.issues.push({...G,keys:J});if(z_(_))return _;let Y=U2(z.value,A.value);if(!Y.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(Y.mergeErrorPath)}`);return _.value=Y.data,_}var cH=E("$ZodRecord",(_,z)=>{M0.init(_,z),_._zod.parse=(A,b)=>{let G=A.value;if(!__(G))return A.issues.push({expected:"record",code:"invalid_type",input:G,inst:_}),A;let J=[],Y=z.keyType._zod.values;if(Y){A.value={};let X=new Set;for(let $ of Y)if(typeof $==="string"||typeof $==="number"||typeof $==="symbol"){X.add(typeof $==="number"?$.toString():$);let H=z.valueType._zod.run({value:G[$],issues:[]},b);if(H instanceof Promise)J.push(H.then((B)=>{if(B.issues.length)A.issues.push(...x4($,B.issues));A.value[$]=B.value}));else{if(H.issues.length)A.issues.push(...x4($,H.issues));A.value[$]=H.value}}let Q;for(let $ in G)if(!X.has($))Q=Q??[],Q.push($);if(Q&&Q.length>0)A.issues.push({code:"unrecognized_keys",input:G,inst:_,keys:Q})}else{A.value={};for(let X of Reflect.ownKeys(G)){if(X==="__proto__")continue;let Q=z.keyType._zod.run({value:X,issues:[]},b);if(Q instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof X==="string"&&p6.test(X)&&Q.issues.length&&Q.issues.some((B)=>B.code==="invalid_type"&&B.expected==="number")){let B=z.keyType._zod.run({value:Number(X),issues:[]},b);if(B instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(B.issues.length===0)Q=B}if(Q.issues.length){if(z.mode==="loose")A.value[X]=G[X];else A.issues.push({code:"invalid_key",origin:"record",issues:Q.issues.map((B)=>p9(B,b,O9())),input:X,path:[X],inst:_});continue}let H=z.valueType._zod.run({value:G[X],issues:[]},b);if(H instanceof Promise)J.push(H.then((B)=>{if(B.issues.length)A.issues.push(...x4(X,B.issues));A.value[Q.value]=B.value}));else{if(H.issues.length)A.issues.push(...x4(X,H.issues));A.value[Q.value]=H.value}}}if(J.length)return Promise.all(J).then(()=>A);return A}});var lH=E("$ZodEnum",(_,z)=>{M0.init(_,z);let A=gz(z.entries),b=new Set(A);_._zod.values=b,_._zod.pattern=new RegExp(`^(${A.filter((G)=>Q2.has(typeof G)).map((G)=>typeof G==="string"?I4(G):G.toString()).join("|")})$`),_._zod.parse=(G,J)=>{let Y=G.value;if(b.has(Y))return G;return G.issues.push({code:"invalid_value",values:A,input:Y,inst:_}),G}}),pH=E("$ZodLiteral",(_,z)=>{if(M0.init(_,z),z.values.length===0)throw Error("Cannot create literal schema with no valid values");let A=new Set(z.values);_._zod.values=A,_._zod.pattern=new RegExp(`^(${z.values.map((b)=>typeof b==="string"?I4(b):b?I4(b.toString()):String(b)).join("|")})$`),_._zod.parse=(b,G)=>{let J=b.value;if(A.has(J))return b;return b.issues.push({code:"invalid_value",values:z.values,input:J,inst:_}),b}});var dH=E("$ZodTransform",(_,z)=>{M0.init(_,z),_._zod.parse=(A,b)=>{if(b.direction==="backward")throw new vz(_.constructor.name);let G=z.transform(A.value,A);if(b.async)return(G instanceof Promise?G:Promise.resolve(G)).then((Y)=>{return A.value=Y,A});if(G instanceof Promise)throw new S4;return A.value=G,A}});function AH(_,z){if(_.issues.length&&z===void 0)return{issues:[],value:void 0};return _}var N2=E("$ZodOptional",(_,z)=>{M0.init(_,z),_._zod.optin="optional",_._zod.optout="optional",H0(_._zod,"values",()=>{return z.innerType._zod.values?new Set([...z.innerType._zod.values,void 0]):void 0}),H0(_._zod,"pattern",()=>{let A=z.innerType._zod.pattern;return A?new RegExp(`^(${hz(A.source)})?$`):void 0}),_._zod.parse=(A,b)=>{if(z.innerType._zod.optin==="optional"){let G=z.innerType._zod.run(A,b);if(G instanceof Promise)return G.then((J)=>AH(J,A.value));return AH(G,A.value)}if(A.value===void 0)return A;return z.innerType._zod.run(A,b)}}),rH=E("$ZodExactOptional",(_,z)=>{N2.init(_,z),H0(_._zod,"values",()=>z.innerType._zod.values),H0(_._zod,"pattern",()=>z.innerType._zod.pattern),_._zod.parse=(A,b)=>{return z.innerType._zod.run(A,b)}}),nH=E("$ZodNullable",(_,z)=>{M0.init(_,z),H0(_._zod,"optin",()=>z.innerType._zod.optin),H0(_._zod,"optout",()=>z.innerType._zod.optout),H0(_._zod,"pattern",()=>{let A=z.innerType._zod.pattern;return A?new RegExp(`^(${hz(A.source)}|null)$`):void 0}),H0(_._zod,"values",()=>{return z.innerType._zod.values?new Set([...z.innerType._zod.values,null]):void 0}),_._zod.parse=(A,b)=>{if(A.value===null)return A;return z.innerType._zod.run(A,b)}}),iH=E("$ZodDefault",(_,z)=>{M0.init(_,z),_._zod.optin="optional",H0(_._zod,"values",()=>z.innerType._zod.values),_._zod.parse=(A,b)=>{if(b.direction==="backward")return z.innerType._zod.run(A,b);if(A.value===void 0)return A.value=z.defaultValue,A;let G=z.innerType._zod.run(A,b);if(G instanceof Promise)return G.then((J)=>bH(J,z));return bH(G,z)}});function bH(_,z){if(_.value===void 0)_.value=z.defaultValue;return _}var oH=E("$ZodPrefault",(_,z)=>{M0.init(_,z),_._zod.optin="optional",H0(_._zod,"values",()=>z.innerType._zod.values),_._zod.parse=(A,b)=>{if(b.direction==="backward")return z.innerType._zod.run(A,b);if(A.value===void 0)A.value=z.defaultValue;return z.innerType._zod.run(A,b)}}),aH=E("$ZodNonOptional",(_,z)=>{M0.init(_,z),H0(_._zod,"values",()=>{let A=z.innerType._zod.values;return A?new Set([...A].filter((b)=>b!==void 0)):void 0}),_._zod.parse=(A,b)=>{let G=z.innerType._zod.run(A,b);if(G instanceof Promise)return G.then((J)=>GH(J,_));return GH(G,_)}});function GH(_,z){if(!_.issues.length&&_.value===void 0)_.issues.push({code:"invalid_type",expected:"nonoptional",input:_.value,inst:z});return _}var sH=E("$ZodCatch",(_,z)=>{M0.init(_,z),H0(_._zod,"optin",()=>z.innerType._zod.optin),H0(_._zod,"optout",()=>z.innerType._zod.optout),H0(_._zod,"values",()=>z.innerType._zod.values),_._zod.parse=(A,b)=>{if(b.direction==="backward")return z.innerType._zod.run(A,b);let G=z.innerType._zod.run(A,b);if(G instanceof Promise)return G.then((J)=>{if(A.value=J.value,J.issues.length)A.value=z.catchValue({...A,error:{issues:J.issues.map((Y)=>p9(Y,b,O9()))},input:A.value}),A.issues=[];return A});if(A.value=G.value,G.issues.length)A.value=z.catchValue({...A,error:{issues:G.issues.map((J)=>p9(J,b,O9()))},input:A.value}),A.issues=[];return A}});var tH=E("$ZodPipe",(_,z)=>{M0.init(_,z),H0(_._zod,"values",()=>z.in._zod.values),H0(_._zod,"optin",()=>z.in._zod.optin),H0(_._zod,"optout",()=>z.out._zod.optout),H0(_._zod,"propValues",()=>z.in._zod.propValues),_._zod.parse=(A,b)=>{if(b.direction==="backward"){let J=z.out._zod.run(A,b);if(J instanceof Promise)return J.then((Y)=>r6(Y,z.in,b));return r6(J,z.in,b)}let G=z.in._zod.run(A,b);if(G instanceof Promise)return G.then((J)=>r6(J,z.out,b));return r6(G,z.out,b)}});function r6(_,z,A){if(_.issues.length)return _.aborted=!0,_;return z._zod.run({value:_.value,issues:_.issues},A)}var eH=E("$ZodReadonly",(_,z)=>{M0.init(_,z),H0(_._zod,"propValues",()=>z.innerType._zod.propValues),H0(_._zod,"values",()=>z.innerType._zod.values),H0(_._zod,"optin",()=>z.innerType?._zod?.optin),H0(_._zod,"optout",()=>z.innerType?._zod?.optout),_._zod.parse=(A,b)=>{if(b.direction==="backward")return z.innerType._zod.run(A,b);let G=z.innerType._zod.run(A,b);if(G instanceof Promise)return G.then(JH);return JH(G)}});function JH(_){return _.value=Object.freeze(_.value),_}var _B=E("$ZodCustom",(_,z)=>{f0.init(_,z),M0.init(_,z),_._zod.parse=(A,b)=>{return A},_._zod.check=(A)=>{let b=A.value,G=z.fn(b);if(G instanceof Promise)return G.then((J)=>YH(J,A,b,_));YH(G,A,b,_);return}});function YH(_,z,A,b){if(!_){let G={code:"custom",input:A,inst:b,path:[...b._zod.def.path??[]],continue:!b._zod.def.abort};if(b._zod.def.params)G.params=b._zod.def.params;z.issues.push(x1(G))}}var gk=()=>{let _={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function z(G){return _[G]??null}let A={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},b={nan:"NaN"};return(G)=>{switch(G.code){case"invalid_type":{let J=b[G.expected]??G.expected,Y=B2(G.input),X=b[Y]??Y;return`Invalid input: expected ${J}, received ${X}`}case"invalid_value":if(G.values.length===1)return`Invalid input: expected ${h6(G.values[0])}`;return`Invalid option: expected one of ${y6(G.values,"|")}`;case"too_big":{let J=G.inclusive?"<=":"<",Y=z(G.origin);if(Y)return`Too big: expected ${G.origin??"value"} to have ${J}${G.maximum.toString()} ${Y.unit??"elements"}`;return`Too big: expected ${G.origin??"value"} to be ${J}${G.maximum.toString()}`}case"too_small":{let J=G.inclusive?">=":">",Y=z(G.origin);if(Y)return`Too small: expected ${G.origin} to have ${J}${G.minimum.toString()} ${Y.unit}`;return`Too small: expected ${G.origin} to be ${J}${G.minimum.toString()}`}case"invalid_format":{let J=G;if(J.format==="starts_with")return`Invalid string: must start with "${J.prefix}"`;if(J.format==="ends_with")return`Invalid string: must end with "${J.suffix}"`;if(J.format==="includes")return`Invalid string: must include "${J.includes}"`;if(J.format==="regex")return`Invalid string: must match pattern ${J.pattern}`;return`Invalid ${A[J.format]??G.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${G.divisor}`;case"unrecognized_keys":return`Unrecognized key${G.keys.length>1?"s":""}: ${y6(G.keys,", ")}`;case"invalid_key":return`Invalid key in ${G.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${G.origin}`;default:return"Invalid input"}}};function w2(){return{localeError:gk()}}var zB,K00=Symbol("ZodOutput"),q00=Symbol("ZodInput");class AB{constructor(){this._map=new WeakMap,this._idmap=new Map}add(_,...z){let A=z[0];if(this._map.set(_,A),A&&typeof A==="object"&&"id"in A)this._idmap.set(A.id,_);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(_){let z=this._map.get(_);if(z&&typeof z==="object"&&"id"in z)this._idmap.delete(z.id);return this._map.delete(_),this}get(_){let z=_._zod.parent;if(z){let A={...this.get(z)??{}};delete A.id;let b={...A,...this._map.get(_)};return Object.keys(b).length?b:void 0}return this._map.get(_)}has(_){return this._map.has(_)}}function fk(){return new AB}(zB=globalThis).__zod_globalRegistry??(zB.__zod_globalRegistry=fk());var T_=globalThis.__zod_globalRegistry;function bB(_,z){return new _({type:"string",...c(z)})}function GB(_,z){return new _({type:"string",format:"email",check:"string_format",abort:!1,...c(z)})}function E2(_,z){return new _({type:"string",format:"guid",check:"string_format",abort:!1,...c(z)})}function JB(_,z){return new _({type:"string",format:"uuid",check:"string_format",abort:!1,...c(z)})}function YB(_,z){return new _({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...c(z)})}function XB(_,z){return new _({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...c(z)})}function QB(_,z){return new _({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...c(z)})}function $B(_,z){return new _({type:"string",format:"url",check:"string_format",abort:!1,...c(z)})}function HB(_,z){return new _({type:"string",format:"emoji",check:"string_format",abort:!1,...c(z)})}function BB(_,z){return new _({type:"string",format:"nanoid",check:"string_format",abort:!1,...c(z)})}function ZB(_,z){return new _({type:"string",format:"cuid",check:"string_format",abort:!1,...c(z)})}function FB(_,z){return new _({type:"string",format:"cuid2",check:"string_format",abort:!1,...c(z)})}function KB(_,z){return new _({type:"string",format:"ulid",check:"string_format",abort:!1,...c(z)})}function qB(_,z){return new _({type:"string",format:"xid",check:"string_format",abort:!1,...c(z)})}function WB(_,z){return new _({type:"string",format:"ksuid",check:"string_format",abort:!1,...c(z)})}function VB(_,z){return new _({type:"string",format:"ipv4",check:"string_format",abort:!1,...c(z)})}function UB(_,z){return new _({type:"string",format:"ipv6",check:"string_format",abort:!1,...c(z)})}function DB(_,z){return new _({type:"string",format:"cidrv4",check:"string_format",abort:!1,...c(z)})}function MB(_,z){return new _({type:"string",format:"cidrv6",check:"string_format",abort:!1,...c(z)})}function NB(_,z){return new _({type:"string",format:"base64",check:"string_format",abort:!1,...c(z)})}function wB(_,z){return new _({type:"string",format:"base64url",check:"string_format",abort:!1,...c(z)})}function EB(_,z){return new _({type:"string",format:"e164",check:"string_format",abort:!1,...c(z)})}function OB(_,z){return new _({type:"string",format:"jwt",check:"string_format",abort:!1,...c(z)})}function LB(_,z){return new _({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...c(z)})}function jB(_,z){return new _({type:"string",format:"date",check:"string_format",...c(z)})}function RB(_,z){return new _({type:"string",format:"time",check:"string_format",precision:null,...c(z)})}function PB(_,z){return new _({type:"string",format:"duration",check:"string_format",...c(z)})}function SB(_,z){return new _({type:"number",checks:[],...c(z)})}function kB(_,z){return new _({type:"number",check:"number_format",abort:!1,format:"safeint",...c(z)})}function IB(_,z){return new _({type:"boolean",...c(z)})}function xB(_,z){return new _({type:"null",...c(z)})}function TB(_){return new _({type:"unknown"})}function CB(_,z){return new _({type:"never",...c(z)})}function o6(_,z){return new q2({check:"less_than",...c(z),value:_,inclusive:!1})}function dz(_,z){return new q2({check:"less_than",...c(z),value:_,inclusive:!0})}function a6(_,z){return new W2({check:"greater_than",...c(z),value:_,inclusive:!1})}function rz(_,z){return new W2({check:"greater_than",...c(z),value:_,inclusive:!0})}function s6(_,z){return new h$({check:"multiple_of",...c(z),value:_})}function t6(_,z){return new u$({check:"max_length",...c(z),maximum:_})}function T1(_,z){return new c$({check:"min_length",...c(z),minimum:_})}function e6(_,z){return new l$({check:"length_equals",...c(z),length:_})}function O2(_,z){return new p$({check:"string_format",format:"regex",...c(z),pattern:_})}function L2(_){return new d$({check:"string_format",format:"lowercase",...c(_)})}function j2(_){return new r$({check:"string_format",format:"uppercase",...c(_)})}function R2(_,z){return new n$({check:"string_format",format:"includes",...c(z),includes:_})}function P2(_,z){return new i$({check:"string_format",format:"starts_with",...c(z),prefix:_})}function S2(_,z){return new o$({check:"string_format",format:"ends_with",...c(z),suffix:_})}function A_(_){return new a$({check:"overwrite",tx:_})}function k2(_){return A_((z)=>z.normalize(_))}function I2(){return A_((_)=>_.trim())}function x2(){return A_((_)=>_.toLowerCase())}function T2(){return A_((_)=>_.toUpperCase())}function C2(){return A_((_)=>Y2(_))}function vB(_,z,A){return new _({type:"array",element:z,...c(A)})}function yB(_,z,A){let b=c(A);return b.abort??(b.abort=!0),new _({type:"custom",check:"custom",fn:z,...b})}function gB(_,z,A){return new _({type:"custom",check:"custom",fn:z,...c(A)})}function fB(_){let z=hk((A)=>{return A.addIssue=(b)=>{if(typeof b==="string")A.issues.push(x1(b,A.value,z._zod.def));else{let G=b;if(G.fatal)G.continue=!1;G.code??(G.code="custom"),G.input??(G.input=A.value),G.inst??(G.inst=z),G.continue??(G.continue=!z._zod.def.abort),A.issues.push(x1(G))}},_(A.value,A)});return z}function hk(_,z){let A=new f0({check:"custom",...c(z)});return A._zod.check=_,A}function v2(_){let z=_?.target??"draft-2020-12";if(z==="draft-4")z="draft-04";if(z==="draft-7")z="draft-07";return{processors:_.processors??{},metadataRegistry:_?.metadata??T_,target:z,unrepresentable:_?.unrepresentable??"throw",override:_?.override??(()=>{}),io:_?.io??"output",counter:0,seen:new Map,cycles:_?.cycles??"ref",reused:_?.reused??"inline",external:_?.external??void 0}}function I0(_,z,A={path:[],schemaPath:[]}){var b;let G=_._zod.def,J=z.seen.get(_);if(J){if(J.count++,A.schemaPath.includes(_))J.cycle=A.path;return J.schema}let Y={schema:{},count:1,cycle:void 0,path:A.path};z.seen.set(_,Y);let X=_._zod.toJSONSchema?.();if(X)Y.schema=X;else{let H={...A,schemaPath:[...A.schemaPath,_],path:A.path};if(_._zod.processJSONSchema)_._zod.processJSONSchema(z,Y.schema,H);else{let Z=Y.schema,F=z.processors[G.type];if(!F)throw Error(`[toJSONSchema]: Non-representable type encountered: ${G.type}`);F(_,z,Z,H)}let B=_._zod.parent;if(B){if(!Y.ref)Y.ref=B;I0(B,z,H),z.seen.get(B).isParent=!0}}let Q=z.metadataRegistry.get(_);if(Q)Object.assign(Y.schema,Q);if(z.io==="input"&&z9(_))delete Y.schema.examples,delete Y.schema.default;if(z.io==="input"&&Y.schema._prefault)(b=Y.schema).default??(b.default=Y.schema._prefault);return delete Y.schema._prefault,z.seen.get(_).schema}function y2(_,z){let A=_.seen.get(z);if(!A)throw Error("Unprocessed schema. This is a bug in Zod.");let b=new Map;for(let Y of _.seen.entries()){let X=_.metadataRegistry.get(Y[0])?.id;if(X){let Q=b.get(X);if(Q&&Q!==Y[0])throw Error(`Duplicate schema id "${X}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);b.set(X,Y[0])}}let G=(Y)=>{let X=_.target==="draft-2020-12"?"$defs":"definitions";if(_.external){let B=_.external.registry.get(Y[0])?.id,Z=_.external.uri??((K)=>K);if(B)return{ref:Z(B)};let F=Y[1].defId??Y[1].schema.id??`schema${_.counter++}`;return Y[1].defId=F,{defId:F,ref:`${Z("__shared")}#/${X}/${F}`}}if(Y[1]===A)return{ref:"#"};let $=`${"#"}/${X}/`,H=Y[1].schema.id??`__schema${_.counter++}`;return{defId:H,ref:$+H}},J=(Y)=>{if(Y[1].schema.$ref)return;let X=Y[1],{ref:Q,defId:$}=G(Y);if(X.def={...X.schema},$)X.defId=$;let H=X.schema;for(let B in H)delete H[B];H.$ref=Q};if(_.cycles==="throw")for(let Y of _.seen.entries()){let X=Y[1];if(X.cycle)throw Error(`Cycle detected: #/${X.cycle?.join("/")}/<root>
204
204
 
205
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let Y of _.seen.entries()){let X=Y[1];if(z===Y[0]){J(Y);continue}if(_.external){let $=_.external.registry.get(Y[0])?.id;if(z!==Y[0]&&$){J(Y);continue}}if(_.metadataRegistry.get(Y[0])?.id){J(Y);continue}if(X.cycle){J(Y);continue}if(X.count>1){if(_.reused==="ref"){J(Y);continue}}}}function v2(_,z){let A=_.seen.get(z);if(!A)throw Error("Unprocessed schema. This is a bug in Zod.");let b=(Y)=>{let X=_.seen.get(Y);if(X.ref===null)return;let Q=X.def??X.schema,$={...Q},H=X.ref;if(X.ref=null,H){b(H);let Z=_.seen.get(H),F=Z.schema;if(F.$ref&&(_.target==="draft-07"||_.target==="draft-04"||_.target==="openapi-3.0"))Q.allOf=Q.allOf??[],Q.allOf.push(F);else Object.assign(Q,F);if(Object.assign(Q,$),Y._zod.parent===H)for(let q in Q){if(q==="$ref"||q==="allOf")continue;if(!(q in $))delete Q[q]}if(F.$ref)for(let q in Q){if(q==="$ref"||q==="allOf")continue;if(q in Z.def&&JSON.stringify(Q[q])===JSON.stringify(Z.def[q]))delete Q[q]}}let B=Y._zod.parent;if(B&&B!==H){b(B);let Z=_.seen.get(B);if(Z?.schema.$ref){if(Q.$ref=Z.schema.$ref,Z.def)for(let F in Q){if(F==="$ref"||F==="allOf")continue;if(F in Z.def&&JSON.stringify(Q[F])===JSON.stringify(Z.def[F]))delete Q[F]}}}_.override({zodSchema:Y,jsonSchema:Q,path:X.path??[]})};for(let Y of[..._.seen.entries()].reverse())b(Y[0]);let G={};if(_.target==="draft-2020-12")G.$schema="https://json-schema.org/draft/2020-12/schema";else if(_.target==="draft-07")G.$schema="http://json-schema.org/draft-07/schema#";else if(_.target==="draft-04")G.$schema="http://json-schema.org/draft-04/schema#";else if(_.target==="openapi-3.0");if(_.external?.uri){let Y=_.external.registry.get(z)?.id;if(!Y)throw Error("Schema is missing an `id` property");G.$id=_.external.uri(Y)}Object.assign(G,A.def??A.schema);let J=_.external?.defs??{};for(let Y of _.seen.entries()){let X=Y[1];if(X.def&&X.defId)J[X.defId]=X.def}if(_.external);else if(Object.keys(J).length>0)if(_.target==="draft-2020-12")G.$defs=J;else G.definitions=J;try{let Y=JSON.parse(JSON.stringify(G));return Object.defineProperty(Y,"~standard",{value:{...z["~standard"],jsonSchema:{input:dz(z,"input",_.processors),output:dz(z,"output",_.processors)}},enumerable:!1,writable:!1}),Y}catch(Y){throw Error("Error converting schema to JSON.")}}function z9(_,z){let A=z??{seen:new Set};if(A.seen.has(_))return!1;A.seen.add(_);let b=_._zod.def;if(b.type==="transform")return!0;if(b.type==="array")return z9(b.element,A);if(b.type==="set")return z9(b.valueType,A);if(b.type==="lazy")return z9(b.getter(),A);if(b.type==="promise"||b.type==="optional"||b.type==="nonoptional"||b.type==="nullable"||b.type==="readonly"||b.type==="default"||b.type==="prefault")return z9(b.innerType,A);if(b.type==="intersection")return z9(b.left,A)||z9(b.right,A);if(b.type==="record"||b.type==="map")return z9(b.keyType,A)||z9(b.valueType,A);if(b.type==="pipe")return z9(b.in,A)||z9(b.out,A);if(b.type==="object"){for(let G in b.shape)if(z9(b.shape[G],A))return!0;return!1}if(b.type==="union"){for(let G of b.options)if(z9(G,A))return!0;return!1}if(b.type==="tuple"){for(let G of b.items)if(z9(G,A))return!0;if(b.rest&&z9(b.rest,A))return!0;return!1}return!1}var gB=(_,z={})=>(A)=>{let b=T2({...A,processors:z});return I0(_,b),C2(b,_),v2(b,_)},dz=(_,z,A={})=>(b)=>{let{libraryOptions:G,target:J}=b??{},Y=T2({...G??{},target:J,io:z,processors:A});return I0(_,Y),C2(Y,_),v2(Y,_)};var Ik={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},fB=(_,z,A,b)=>{let G=A;G.type="string";let{minimum:J,maximum:Y,format:X,patterns:Q,contentEncoding:$}=_._zod.bag;if(typeof J==="number")G.minLength=J;if(typeof Y==="number")G.maxLength=Y;if(X){if(G.format=Ik[X]??X,G.format==="")delete G.format;if(X==="time")delete G.format}if($)G.contentEncoding=$;if(Q&&Q.size>0){let H=[...Q];if(H.length===1)G.pattern=H[0].source;else if(H.length>1)G.allOf=[...H.map((B)=>({...z.target==="draft-07"||z.target==="draft-04"||z.target==="openapi-3.0"?{type:"string"}:{},pattern:B.source}))]}},hB=(_,z,A,b)=>{let G=A,{minimum:J,maximum:Y,format:X,multipleOf:Q,exclusiveMaximum:$,exclusiveMinimum:H}=_._zod.bag;if(typeof X==="string"&&X.includes("int"))G.type="integer";else G.type="number";if(typeof H==="number")if(z.target==="draft-04"||z.target==="openapi-3.0")G.minimum=H,G.exclusiveMinimum=!0;else G.exclusiveMinimum=H;if(typeof J==="number"){if(G.minimum=J,typeof H==="number"&&z.target!=="draft-04")if(H>=J)delete G.minimum;else delete G.exclusiveMinimum}if(typeof $==="number")if(z.target==="draft-04"||z.target==="openapi-3.0")G.maximum=$,G.exclusiveMaximum=!0;else G.exclusiveMaximum=$;if(typeof Y==="number"){if(G.maximum=Y,typeof $==="number"&&z.target!=="draft-04")if($<=Y)delete G.maximum;else delete G.exclusiveMaximum}if(typeof Q==="number")G.multipleOf=Q},mB=(_,z,A,b)=>{A.type="boolean"};var uB=(_,z,A,b)=>{if(z.target==="openapi-3.0")A.type="string",A.nullable=!0,A.enum=[null];else A.type="null"};var cB=(_,z,A,b)=>{A.not={}};var lB=(_,z,A,b)=>{};var pB=(_,z,A,b)=>{let G=_._zod.def,J=vz(G.entries);if(J.every((Y)=>typeof Y==="number"))A.type="number";if(J.every((Y)=>typeof Y==="string"))A.type="string";A.enum=J},dB=(_,z,A,b)=>{let G=_._zod.def,J=[];for(let Y of G.values)if(Y===void 0){if(z.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof Y==="bigint")if(z.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else J.push(Number(Y));else J.push(Y);if(J.length===0);else if(J.length===1){let Y=J[0];if(A.type=Y===null?"null":typeof Y,z.target==="draft-04"||z.target==="openapi-3.0")A.enum=[Y];else A.const=Y}else{if(J.every((Y)=>typeof Y==="number"))A.type="number";if(J.every((Y)=>typeof Y==="string"))A.type="string";if(J.every((Y)=>typeof Y==="boolean"))A.type="boolean";if(J.every((Y)=>Y===null))A.type="null";A.enum=J}};var rB=(_,z,A,b)=>{if(z.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")};var nB=(_,z,A,b)=>{if(z.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")};var iB=(_,z,A,b)=>{let G=A,J=_._zod.def,{minimum:Y,maximum:X}=_._zod.bag;if(typeof Y==="number")G.minItems=Y;if(typeof X==="number")G.maxItems=X;G.type="array",G.items=I0(J.element,z,{...b,path:[...b.path,"items"]})},oB=(_,z,A,b)=>{let G=A,J=_._zod.def;G.type="object",G.properties={};let Y=J.shape;for(let $ in Y)G.properties[$]=I0(Y[$],z,{...b,path:[...b.path,"properties",$]});let X=new Set(Object.keys(Y)),Q=new Set([...X].filter(($)=>{let H=J.shape[$]._zod;if(z.io==="input")return H.optin===void 0;else return H.optout===void 0}));if(Q.size>0)G.required=Array.from(Q);if(J.catchall?._zod.def.type==="never")G.additionalProperties=!1;else if(!J.catchall){if(z.io==="output")G.additionalProperties=!1}else if(J.catchall)G.additionalProperties=I0(J.catchall,z,{...b,path:[...b.path,"additionalProperties"]})},aB=(_,z,A,b)=>{let G=_._zod.def,J=G.inclusive===!1,Y=G.options.map((X,Q)=>I0(X,z,{...b,path:[...b.path,J?"oneOf":"anyOf",Q]}));if(J)A.oneOf=Y;else A.anyOf=Y},sB=(_,z,A,b)=>{let G=_._zod.def,J=I0(G.left,z,{...b,path:[...b.path,"allOf",0]}),Y=I0(G.right,z,{...b,path:[...b.path,"allOf",1]}),X=($)=>("allOf"in $)&&Object.keys($).length===1,Q=[...X(J)?J.allOf:[J],...X(Y)?Y.allOf:[Y]];A.allOf=Q};var tB=(_,z,A,b)=>{let G=A,J=_._zod.def;G.type="object";let Y=J.keyType,Q=Y._zod.bag?.patterns;if(J.mode==="loose"&&Q&&Q.size>0){let H=I0(J.valueType,z,{...b,path:[...b.path,"patternProperties","*"]});G.patternProperties={};for(let B of Q)G.patternProperties[B.source]=H}else{if(z.target==="draft-07"||z.target==="draft-2020-12")G.propertyNames=I0(J.keyType,z,{...b,path:[...b.path,"propertyNames"]});G.additionalProperties=I0(J.valueType,z,{...b,path:[...b.path,"additionalProperties"]})}let $=Y._zod.values;if($){let H=[...$].filter((B)=>typeof B==="string"||typeof B==="number");if(H.length>0)G.required=H}},eB=(_,z,A,b)=>{let G=_._zod.def,J=I0(G.innerType,z,b),Y=z.seen.get(_);if(z.target==="openapi-3.0")Y.ref=G.innerType,A.nullable=!0;else A.anyOf=[J,{type:"null"}]},_Z=(_,z,A,b)=>{let G=_._zod.def;I0(G.innerType,z,b);let J=z.seen.get(_);J.ref=G.innerType},zZ=(_,z,A,b)=>{let G=_._zod.def;I0(G.innerType,z,b);let J=z.seen.get(_);J.ref=G.innerType,A.default=JSON.parse(JSON.stringify(G.defaultValue))},AZ=(_,z,A,b)=>{let G=_._zod.def;I0(G.innerType,z,b);let J=z.seen.get(_);if(J.ref=G.innerType,z.io==="input")A._prefault=JSON.parse(JSON.stringify(G.defaultValue))},bZ=(_,z,A,b)=>{let G=_._zod.def;I0(G.innerType,z,b);let J=z.seen.get(_);J.ref=G.innerType;let Y;try{Y=G.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}A.default=Y},GZ=(_,z,A,b)=>{let G=_._zod.def,J=z.io==="input"?G.in._zod.def.type==="transform"?G.out:G.in:G.out;I0(J,z,b);let Y=z.seen.get(_);Y.ref=J},JZ=(_,z,A,b)=>{let G=_._zod.def;I0(G.innerType,z,b);let J=z.seen.get(_);J.ref=G.innerType,A.readOnly=!0};var y2=(_,z,A,b)=>{let G=_._zod.def;I0(G.innerType,z,b);let J=z.seen.get(_);J.ref=G.innerType};function x1(_){return!!_._zod}function b_(_,z){if(x1(_))return mz(_,z);return _.safeParse(z)}function s6(_){if(!_)return;let z;if(x1(_))z=_._zod?.def?.shape;else z=_.shape;if(!z)return;if(typeof z==="function")try{return z()}catch{return}return z}function YZ(_){if(x1(_)){let J=_._zod?.def;if(J){if(J.value!==void 0)return J.value;if(Array.isArray(J.values)&&J.values.length>0)return J.values[0]}}let A=_._def;if(A){if(A.value!==void 0)return A.value;if(Array.isArray(A.values)&&A.values.length>0)return A.values[0]}let b=_.value;if(b!==void 0)return b;return}var nz={};A8(nz,{time:()=>h2,duration:()=>m2,datetime:()=>g2,date:()=>f2,ZodISOTime:()=>$Z,ZodISODuration:()=>HZ,ZodISODateTime:()=>XZ,ZodISODate:()=>QZ});var XZ=E("ZodISODateTime",(_,z)=>{WH.init(_,z),L0.init(_,z)});function g2(_){return EB(XZ,_)}var QZ=E("ZodISODate",(_,z)=>{VH.init(_,z),L0.init(_,z)});function f2(_){return OB(QZ,_)}var $Z=E("ZodISOTime",(_,z)=>{UH.init(_,z),L0.init(_,z)});function h2(_){return LB($Z,_)}var HZ=E("ZodISODuration",(_,z)=>{DH.init(_,z),L0.init(_,z)});function m2(_){return jB(HZ,_)}var BZ=(_,z)=>{g6.init(_,z),_.name="ZodError",Object.defineProperties(_,{format:{value:(A)=>_$(_,A)},flatten:{value:(A)=>eQ(_,A)},addIssue:{value:(A)=>{_.issues.push(A),_.message=JSON.stringify(_.issues,P1,2)}},addIssues:{value:(A)=>{_.issues.push(...A),_.message=JSON.stringify(_.issues,P1,2)}},isEmpty:{get(){return _.issues.length===0}}})},i00=E("ZodError",BZ),V9=E("ZodError",BZ,{Parent:Error});var ZZ=f6(V9),FZ=h6(V9),KZ=hz(V9),qZ=uz(V9),WZ=z$(V9),VZ=A$(V9),UZ=b$(V9),DZ=G$(V9),MZ=J$(V9),NZ=Y$(V9),wZ=X$(V9),EZ=Q$(V9);var R0=E("ZodType",(_,z)=>{return M0.init(_,z),Object.assign(_["~standard"],{jsonSchema:{input:dz(_,"input"),output:dz(_,"output")}}),_.toJSONSchema=gB(_,{}),_.def=z,_.type=z.type,Object.defineProperty(_,"_def",{value:z}),_.check=(...A)=>{return _.clone(X0.mergeDefs(z,{checks:[...z.checks??[],...A.map((b)=>typeof b==="function"?{_zod:{check:b,def:{check:"custom"},onattach:[]}}:b)]}),{parent:!0})},_.with=_.check,_.clone=(A,b)=>c9(_,A,b),_.brand=()=>_,_.register=(A,b)=>{return A.add(_,b),_},_.parse=(A,b)=>ZZ(_,A,b,{callee:_.parse}),_.safeParse=(A,b)=>KZ(_,A,b),_.parseAsync=async(A,b)=>FZ(_,A,b,{callee:_.parseAsync}),_.safeParseAsync=async(A,b)=>qZ(_,A,b),_.spa=_.safeParseAsync,_.encode=(A,b)=>WZ(_,A,b),_.decode=(A,b)=>VZ(_,A,b),_.encodeAsync=async(A,b)=>UZ(_,A,b),_.decodeAsync=async(A,b)=>DZ(_,A,b),_.safeEncode=(A,b)=>MZ(_,A,b),_.safeDecode=(A,b)=>NZ(_,A,b),_.safeEncodeAsync=async(A,b)=>wZ(_,A,b),_.safeDecodeAsync=async(A,b)=>EZ(_,A,b),_.refine=(A,b)=>_.check(kI(A,b)),_.superRefine=(A)=>_.check(II(A)),_.overwrite=(A)=>_.check(A_(A)),_.optional=()=>k0(_),_.exactOptional=()=>UI(_),_.nullable=()=>jZ(_),_.nullish=()=>k0(jZ(_)),_.nonoptional=(A)=>OI(_,A),_.array=()=>A0(_),_.or=(A)=>U0([_,A]),_.and=(A)=>e6(_,A),_.transform=(A)=>c2(_,IZ(A)),_.default=(A)=>NI(_,A),_.prefault=(A)=>EI(_,A),_.catch=(A)=>jI(_,A),_.pipe=(A)=>c2(_,A),_.readonly=()=>SI(_),_.describe=(A)=>{let b=_.clone();return x_.add(b,{description:A}),b},Object.defineProperty(_,"description",{get(){return x_.get(_)?.description},configurable:!0}),_.meta=(...A)=>{if(A.length===0)return x_.get(_);let b=_.clone();return x_.add(b,A[0]),b},_.isOptional=()=>_.safeParse(void 0).success,_.isNullable=()=>_.safeParse(null).success,_.apply=(A)=>A(_),_}),RZ=E("_ZodString",(_,z)=>{d6.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(b,G,J)=>fB(_,b,G,J);let A=_._zod.bag;_.format=A.format??null,_.minLength=A.minimum??null,_.maxLength=A.maximum??null,_.regex=(...b)=>_.check(w2(...b)),_.includes=(...b)=>_.check(L2(...b)),_.startsWith=(...b)=>_.check(j2(...b)),_.endsWith=(...b)=>_.check(R2(...b)),_.min=(...b)=>_.check(I1(...b)),_.max=(...b)=>_.check(o6(...b)),_.length=(...b)=>_.check(a6(...b)),_.nonempty=(...b)=>_.check(I1(1,...b)),_.lowercase=(b)=>_.check(E2(b)),_.uppercase=(b)=>_.check(O2(b)),_.trim=()=>_.check(S2()),_.normalize=(...b)=>_.check(P2(...b)),_.toLowerCase=()=>_.check(k2()),_.toUpperCase=()=>_.check(I2()),_.slugify=()=>_.check(x2())}),uk=E("ZodString",(_,z)=>{d6.init(_,z),RZ.init(_,z),_.email=(A)=>_.check(AB(ck,A)),_.url=(A)=>_.check(XB(lk,A)),_.jwt=(A)=>_.check(wB(GI,A)),_.emoji=(A)=>_.check(QB(pk,A)),_.guid=(A)=>_.check(N2(OZ,A)),_.uuid=(A)=>_.check(bB(t6,A)),_.uuidv4=(A)=>_.check(GB(t6,A)),_.uuidv6=(A)=>_.check(JB(t6,A)),_.uuidv7=(A)=>_.check(YB(t6,A)),_.nanoid=(A)=>_.check($B(dk,A)),_.guid=(A)=>_.check(N2(OZ,A)),_.cuid=(A)=>_.check(HB(rk,A)),_.cuid2=(A)=>_.check(BB(nk,A)),_.ulid=(A)=>_.check(ZB(ik,A)),_.base64=(A)=>_.check(DB(zI,A)),_.base64url=(A)=>_.check(MB(AI,A)),_.xid=(A)=>_.check(FB(ok,A)),_.ksuid=(A)=>_.check(KB(ak,A)),_.ipv4=(A)=>_.check(qB(sk,A)),_.ipv6=(A)=>_.check(WB(tk,A)),_.cidrv4=(A)=>_.check(VB(ek,A)),_.cidrv6=(A)=>_.check(UB(_I,A)),_.e164=(A)=>_.check(NB(bI,A)),_.datetime=(A)=>_.check(g2(A)),_.date=(A)=>_.check(f2(A)),_.time=(A)=>_.check(h2(A)),_.duration=(A)=>_.check(m2(A))});function N(_){return zB(uk,_)}var L0=E("ZodStringFormat",(_,z)=>{N0.init(_,z),RZ.init(_,z)}),ck=E("ZodEmail",(_,z)=>{XH.init(_,z),L0.init(_,z)});var OZ=E("ZodGUID",(_,z)=>{JH.init(_,z),L0.init(_,z)});var t6=E("ZodUUID",(_,z)=>{YH.init(_,z),L0.init(_,z)});var lk=E("ZodURL",(_,z)=>{QH.init(_,z),L0.init(_,z)});var pk=E("ZodEmoji",(_,z)=>{$H.init(_,z),L0.init(_,z)});var dk=E("ZodNanoID",(_,z)=>{HH.init(_,z),L0.init(_,z)});var rk=E("ZodCUID",(_,z)=>{BH.init(_,z),L0.init(_,z)});var nk=E("ZodCUID2",(_,z)=>{ZH.init(_,z),L0.init(_,z)});var ik=E("ZodULID",(_,z)=>{FH.init(_,z),L0.init(_,z)});var ok=E("ZodXID",(_,z)=>{KH.init(_,z),L0.init(_,z)});var ak=E("ZodKSUID",(_,z)=>{qH.init(_,z),L0.init(_,z)});var sk=E("ZodIPv4",(_,z)=>{MH.init(_,z),L0.init(_,z)});var tk=E("ZodIPv6",(_,z)=>{NH.init(_,z),L0.init(_,z)});var ek=E("ZodCIDRv4",(_,z)=>{wH.init(_,z),L0.init(_,z)});var _I=E("ZodCIDRv6",(_,z)=>{EH.init(_,z),L0.init(_,z)});var zI=E("ZodBase64",(_,z)=>{LH.init(_,z),L0.init(_,z)});var AI=E("ZodBase64URL",(_,z)=>{jH.init(_,z),L0.init(_,z)});var bI=E("ZodE164",(_,z)=>{RH.init(_,z),L0.init(_,z)});var GI=E("ZodJWT",(_,z)=>{PH.init(_,z),L0.init(_,z)});var PZ=E("ZodNumber",(_,z)=>{V2.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(b,G,J)=>hB(_,b,G,J),_.gt=(b,G)=>_.check(n6(b,G)),_.gte=(b,G)=>_.check(pz(b,G)),_.min=(b,G)=>_.check(pz(b,G)),_.lt=(b,G)=>_.check(r6(b,G)),_.lte=(b,G)=>_.check(lz(b,G)),_.max=(b,G)=>_.check(lz(b,G)),_.int=(b)=>_.check(LZ(b)),_.safe=(b)=>_.check(LZ(b)),_.positive=(b)=>_.check(n6(0,b)),_.nonnegative=(b)=>_.check(pz(0,b)),_.negative=(b)=>_.check(r6(0,b)),_.nonpositive=(b)=>_.check(lz(0,b)),_.multipleOf=(b,G)=>_.check(i6(b,G)),_.step=(b,G)=>_.check(i6(b,G)),_.finite=()=>_;let A=_._zod.bag;_.minValue=Math.max(A.minimum??Number.NEGATIVE_INFINITY,A.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,_.maxValue=Math.min(A.maximum??Number.POSITIVE_INFINITY,A.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,_.isInt=(A.format??"").includes("int")||Number.isSafeInteger(A.multipleOf??0.5),_.isFinite=!0,_.format=A.format??null});function q0(_){return RB(PZ,_)}var JI=E("ZodNumberFormat",(_,z)=>{SH.init(_,z),PZ.init(_,z)});function LZ(_){return PB(JI,_)}var YI=E("ZodBoolean",(_,z)=>{kH.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,b,G)=>mB(_,A,b,G)});function y0(_){return SB(YI,_)}var XI=E("ZodNull",(_,z)=>{IH.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,b,G)=>uB(_,A,b,G)});function l2(_){return kB(XI,_)}var QI=E("ZodUnknown",(_,z)=>{xH.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,b,G)=>lB(_,A,b,G)});function j0(){return IB(QI)}var $I=E("ZodNever",(_,z)=>{TH.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,b,G)=>cB(_,A,b,G)});function HI(_){return xB($I,_)}var BI=E("ZodArray",(_,z)=>{CH.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,b,G)=>iB(_,A,b,G),_.element=z.element,_.min=(A,b)=>_.check(I1(A,b)),_.nonempty=(A)=>_.check(I1(1,A)),_.max=(A,b)=>_.check(o6(A,b)),_.length=(A,b)=>_.check(a6(A,b)),_.unwrap=()=>_.element});function A0(_,z){return TB(BI,_,z)}var SZ=E("ZodObject",(_,z)=>{gH.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,b,G)=>oB(_,A,b,G),X0.defineLazy(_,"shape",()=>{return z.shape}),_.keyof=()=>$9(Object.keys(_._zod.def.shape)),_.catchall=(A)=>_.clone({..._._zod.def,catchall:A}),_.passthrough=()=>_.clone({..._._zod.def,catchall:j0()}),_.loose=()=>_.clone({..._._zod.def,catchall:j0()}),_.strict=()=>_.clone({..._._zod.def,catchall:HI()}),_.strip=()=>_.clone({..._._zod.def,catchall:void 0}),_.extend=(A)=>{return X0.extend(_,A)},_.safeExtend=(A)=>{return X0.safeExtend(_,A)},_.merge=(A)=>X0.merge(_,A),_.pick=(A)=>X0.pick(_,A),_.omit=(A)=>X0.omit(_,A),_.partial=(...A)=>X0.partial(xZ,_,A[0]),_.required=(...A)=>X0.required(TZ,_,A[0])});function C(_,z){let A={type:"object",shape:_??{},...X0.normalizeParams(z)};return new SZ(A)}function A9(_,z){return new SZ({type:"object",shape:_,catchall:j0(),...X0.normalizeParams(z)})}var kZ=E("ZodUnion",(_,z)=>{U2.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,b,G)=>aB(_,A,b,G),_.options=z.options});function U0(_,z){return new kZ({type:"union",options:_,...X0.normalizeParams(z)})}var ZI=E("ZodDiscriminatedUnion",(_,z)=>{kZ.init(_,z),fH.init(_,z)});function p2(_,z,A){return new ZI({type:"union",options:z,discriminator:_,...X0.normalizeParams(A)})}var FI=E("ZodIntersection",(_,z)=>{hH.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,b,G)=>sB(_,A,b,G)});function e6(_,z){return new FI({type:"intersection",left:_,right:z})}var KI=E("ZodRecord",(_,z)=>{mH.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,b,G)=>tB(_,A,b,G),_.keyType=z.keyType,_.valueType=z.valueType});function P0(_,z,A){return new KI({type:"record",keyType:_,valueType:z,...X0.normalizeParams(A)})}var u2=E("ZodEnum",(_,z)=>{uH.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(b,G,J)=>pB(_,b,G,J),_.enum=z.entries,_.options=Object.values(z.entries);let A=new Set(Object.keys(z.entries));_.extract=(b,G)=>{let J={};for(let Y of b)if(A.has(Y))J[Y]=z.entries[Y];else throw Error(`Key ${Y} not found in enum`);return new u2({...z,checks:[],...X0.normalizeParams(G),entries:J})},_.exclude=(b,G)=>{let J={...z.entries};for(let Y of b)if(A.has(Y))delete J[Y];else throw Error(`Key ${Y} not found in enum`);return new u2({...z,checks:[],...X0.normalizeParams(G),entries:J})}});function $9(_,z){let A=Array.isArray(_)?Object.fromEntries(_.map((b)=>[b,b])):_;return new u2({type:"enum",entries:A,...X0.normalizeParams(z)})}var qI=E("ZodLiteral",(_,z)=>{cH.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,b,G)=>dB(_,A,b,G),_.values=new Set(z.values),Object.defineProperty(_,"value",{get(){if(z.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return z.values[0]}})});function f(_,z){return new qI({type:"literal",values:Array.isArray(_)?_:[_],...X0.normalizeParams(z)})}var WI=E("ZodTransform",(_,z)=>{lH.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,b,G)=>nB(_,A,b,G),_._zod.parse=(A,b)=>{if(b.direction==="backward")throw new Tz(_.constructor.name);A.addIssue=(J)=>{if(typeof J==="string")A.issues.push(X0.issue(J,A.value,z));else{let Y=J;if(Y.fatal)Y.continue=!1;Y.code??(Y.code="custom"),Y.input??(Y.input=A.value),Y.inst??(Y.inst=_),A.issues.push(X0.issue(Y))}};let G=z.transform(A.value,A);if(G instanceof Promise)return G.then((J)=>{return A.value=J,A});return A.value=G,A}});function IZ(_){return new WI({type:"transform",transform:_})}var xZ=E("ZodOptional",(_,z)=>{D2.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,b,G)=>y2(_,A,b,G),_.unwrap=()=>_._zod.def.innerType});function k0(_){return new xZ({type:"optional",innerType:_})}var VI=E("ZodExactOptional",(_,z)=>{pH.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,b,G)=>y2(_,A,b,G),_.unwrap=()=>_._zod.def.innerType});function UI(_){return new VI({type:"optional",innerType:_})}var DI=E("ZodNullable",(_,z)=>{dH.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,b,G)=>eB(_,A,b,G),_.unwrap=()=>_._zod.def.innerType});function jZ(_){return new DI({type:"nullable",innerType:_})}var MI=E("ZodDefault",(_,z)=>{rH.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,b,G)=>zZ(_,A,b,G),_.unwrap=()=>_._zod.def.innerType,_.removeDefault=_.unwrap});function NI(_,z){return new MI({type:"default",innerType:_,get defaultValue(){return typeof z==="function"?z():X0.shallowClone(z)}})}var wI=E("ZodPrefault",(_,z)=>{nH.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,b,G)=>AZ(_,A,b,G),_.unwrap=()=>_._zod.def.innerType});function EI(_,z){return new wI({type:"prefault",innerType:_,get defaultValue(){return typeof z==="function"?z():X0.shallowClone(z)}})}var TZ=E("ZodNonOptional",(_,z)=>{iH.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,b,G)=>_Z(_,A,b,G),_.unwrap=()=>_._zod.def.innerType});function OI(_,z){return new TZ({type:"nonoptional",innerType:_,...X0.normalizeParams(z)})}var LI=E("ZodCatch",(_,z)=>{oH.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,b,G)=>bZ(_,A,b,G),_.unwrap=()=>_._zod.def.innerType,_.removeCatch=_.unwrap});function jI(_,z){return new LI({type:"catch",innerType:_,catchValue:typeof z==="function"?z:()=>z})}var RI=E("ZodPipe",(_,z)=>{aH.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,b,G)=>GZ(_,A,b,G),_.in=z.in,_.out=z.out});function c2(_,z){return new RI({type:"pipe",in:_,out:z})}var PI=E("ZodReadonly",(_,z)=>{sH.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,b,G)=>JZ(_,A,b,G),_.unwrap=()=>_._zod.def.innerType});function SI(_){return new PI({type:"readonly",innerType:_})}var CZ=E("ZodCustom",(_,z)=>{tH.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,b,G)=>rB(_,A,b,G)});function vZ(_,z){return CB(CZ,_??(()=>!0),z)}function kI(_,z={}){return vB(CZ,_,z)}function II(_){return yB(_)}function d2(_,z){return c2(IZ(_),z)}O9(M2());var r2="2025-11-25";var yZ=[r2,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],G_="io.modelcontextprotocol/related-task",zA="2.0",h0=vZ((_)=>_!==null&&(typeof _==="object"||typeof _==="function")),gZ=U0([N(),q0().int()]),fZ=N(),B40=A9({ttl:U0([q0(),l2()]).optional(),pollInterval:q0().optional()}),xI=C({ttl:q0().optional()}),TI=C({taskId:N()}),n2=A9({progressToken:gZ.optional(),[G_]:TI.optional()}),U9=C({_meta:n2.optional()}),iz=U9.extend({task:xI.optional()}),hZ=(_)=>iz.safeParse(_).success,m0=C({method:N(),params:U9.loose().optional()}),L9=C({_meta:n2.optional()}),j9=C({method:N(),params:L9.loose().optional()}),u0=A9({_meta:n2.optional()}),AA=U0([N(),q0().int()]),mZ=C({jsonrpc:f(zA),id:AA,...m0.shape}).strict(),i2=(_)=>mZ.safeParse(_).success,uZ=C({jsonrpc:f(zA),...j9.shape}).strict(),cZ=(_)=>uZ.safeParse(_).success,o2=C({jsonrpc:f(zA),id:AA,result:u0}).strict(),oz=(_)=>o2.safeParse(_).success;var b0;(function(_){_[_.ConnectionClosed=-32000]="ConnectionClosed",_[_.RequestTimeout=-32001]="RequestTimeout",_[_.ParseError=-32700]="ParseError",_[_.InvalidRequest=-32600]="InvalidRequest",_[_.MethodNotFound=-32601]="MethodNotFound",_[_.InvalidParams=-32602]="InvalidParams",_[_.InternalError=-32603]="InternalError",_[_.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(b0||(b0={}));var a2=C({jsonrpc:f(zA),id:AA.optional(),error:C({code:q0().int(),message:N(),data:j0().optional()})}).strict();var lZ=(_)=>a2.safeParse(_).success;var pZ=U0([mZ,uZ,o2,a2]),Z40=U0([o2,a2]),bA=u0.strict(),CI=L9.extend({requestId:AA.optional(),reason:N().optional()}),GA=j9.extend({method:f("notifications/cancelled"),params:CI}),vI=C({src:N(),mimeType:N().optional(),sizes:A0(N()).optional(),theme:$9(["light","dark"]).optional()}),az=C({icons:A0(vI).optional()}),T1=C({name:N(),title:N().optional()}),dZ=T1.extend({...T1.shape,...az.shape,version:N(),websiteUrl:N().optional(),description:N().optional()}),yI=e6(C({applyDefaults:y0().optional()}),P0(N(),j0())),gI=d2((_)=>{if(_&&typeof _==="object"&&!Array.isArray(_)){if(Object.keys(_).length===0)return{form:{}}}return _},e6(C({form:yI.optional(),url:h0.optional()}),P0(N(),j0()).optional())),fI=A9({list:h0.optional(),cancel:h0.optional(),requests:A9({sampling:A9({createMessage:h0.optional()}).optional(),elicitation:A9({create:h0.optional()}).optional()}).optional()}),hI=A9({list:h0.optional(),cancel:h0.optional(),requests:A9({tools:A9({call:h0.optional()}).optional()}).optional()}),mI=C({experimental:P0(N(),h0).optional(),sampling:C({context:h0.optional(),tools:h0.optional()}).optional(),elicitation:gI.optional(),roots:C({listChanged:y0().optional()}).optional(),tasks:fI.optional()}),uI=U9.extend({protocolVersion:N(),capabilities:mI,clientInfo:dZ}),s2=m0.extend({method:f("initialize"),params:uI});var cI=C({experimental:P0(N(),h0).optional(),logging:h0.optional(),completions:h0.optional(),prompts:C({listChanged:y0().optional()}).optional(),resources:C({subscribe:y0().optional(),listChanged:y0().optional()}).optional(),tools:C({listChanged:y0().optional()}).optional(),tasks:hI.optional()}),lI=u0.extend({protocolVersion:N(),capabilities:cI,serverInfo:dZ,instructions:N().optional()}),t2=j9.extend({method:f("notifications/initialized"),params:L9.optional()});var JA=m0.extend({method:f("ping"),params:U9.optional()}),pI=C({progress:q0(),total:k0(q0()),message:k0(N())}),dI=C({...L9.shape,...pI.shape,progressToken:gZ}),YA=j9.extend({method:f("notifications/progress"),params:dI}),rI=U9.extend({cursor:fZ.optional()}),sz=m0.extend({params:rI.optional()}),tz=u0.extend({nextCursor:fZ.optional()}),nI=$9(["working","input_required","completed","failed","cancelled"]),ez=C({taskId:N(),status:nI,ttl:U0([q0(),l2()]),createdAt:N(),lastUpdatedAt:N(),pollInterval:k0(q0()),statusMessage:k0(N())}),C1=u0.extend({task:ez}),iI=L9.merge(ez),_3=j9.extend({method:f("notifications/tasks/status"),params:iI}),XA=m0.extend({method:f("tasks/get"),params:U9.extend({taskId:N()})}),QA=u0.merge(ez),$A=m0.extend({method:f("tasks/result"),params:U9.extend({taskId:N()})}),F40=u0.loose(),HA=sz.extend({method:f("tasks/list")}),BA=tz.extend({tasks:A0(ez)}),ZA=m0.extend({method:f("tasks/cancel"),params:U9.extend({taskId:N()})}),rZ=u0.merge(ez),nZ=C({uri:N(),mimeType:k0(N()),_meta:P0(N(),j0()).optional()}),iZ=nZ.extend({text:N()}),e2=N().refine((_)=>{try{return atob(_),!0}catch{return!1}},{message:"Invalid Base64 string"}),oZ=nZ.extend({blob:e2}),z3=$9(["user","assistant"]),v1=C({audience:A0(z3).optional(),priority:q0().min(0).max(1).optional(),lastModified:nz.datetime({offset:!0}).optional()}),aZ=C({...T1.shape,...az.shape,uri:N(),description:k0(N()),mimeType:k0(N()),annotations:v1.optional(),_meta:k0(A9({}))}),oI=C({...T1.shape,...az.shape,uriTemplate:N(),description:k0(N()),mimeType:k0(N()),annotations:v1.optional(),_meta:k0(A9({}))}),aI=sz.extend({method:f("resources/list")}),sI=tz.extend({resources:A0(aZ)}),tI=sz.extend({method:f("resources/templates/list")}),eI=tz.extend({resourceTemplates:A0(oI)}),_7=U9.extend({uri:N()}),_x=_7,zx=m0.extend({method:f("resources/read"),params:_x}),Ax=u0.extend({contents:A0(U0([iZ,oZ]))}),bx=j9.extend({method:f("notifications/resources/list_changed"),params:L9.optional()}),Gx=_7,Jx=m0.extend({method:f("resources/subscribe"),params:Gx}),Yx=_7,Xx=m0.extend({method:f("resources/unsubscribe"),params:Yx}),Qx=L9.extend({uri:N()}),$x=j9.extend({method:f("notifications/resources/updated"),params:Qx}),Hx=C({name:N(),description:k0(N()),required:k0(y0())}),Bx=C({...T1.shape,...az.shape,description:k0(N()),arguments:k0(A0(Hx)),_meta:k0(A9({}))}),z7=sz.extend({method:f("prompts/list")}),Zx=tz.extend({prompts:A0(Bx)}),Fx=U9.extend({name:N(),arguments:P0(N(),N()).optional()}),Kx=m0.extend({method:f("prompts/get"),params:Fx}),A7=C({type:f("text"),text:N(),annotations:v1.optional(),_meta:P0(N(),j0()).optional()}),b7=C({type:f("image"),data:e2,mimeType:N(),annotations:v1.optional(),_meta:P0(N(),j0()).optional()}),G7=C({type:f("audio"),data:e2,mimeType:N(),annotations:v1.optional(),_meta:P0(N(),j0()).optional()}),qx=C({type:f("tool_use"),name:N(),id:N(),input:P0(N(),j0()),_meta:P0(N(),j0()).optional()}),Wx=C({type:f("resource"),resource:U0([iZ,oZ]),annotations:v1.optional(),_meta:P0(N(),j0()).optional()}),Vx=aZ.extend({type:f("resource_link")}),J7=U0([A7,b7,G7,Vx,Wx]),Ux=C({role:z3,content:J7}),Dx=u0.extend({description:N().optional(),messages:A0(Ux)}),Mx=j9.extend({method:f("notifications/prompts/list_changed"),params:L9.optional()}),Nx=C({title:N().optional(),readOnlyHint:y0().optional(),destructiveHint:y0().optional(),idempotentHint:y0().optional(),openWorldHint:y0().optional()}),wx=C({taskSupport:$9(["required","optional","forbidden"]).optional()}),sZ=C({...T1.shape,...az.shape,description:N().optional(),inputSchema:C({type:f("object"),properties:P0(N(),h0).optional(),required:A0(N()).optional()}).catchall(j0()),outputSchema:C({type:f("object"),properties:P0(N(),h0).optional(),required:A0(N()).optional()}).catchall(j0()).optional(),annotations:Nx.optional(),execution:wx.optional(),_meta:P0(N(),j0()).optional()}),Y7=sz.extend({method:f("tools/list")}),Ex=tz.extend({tools:A0(sZ)}),FA=u0.extend({content:A0(J7).default([]),structuredContent:P0(N(),j0()).optional(),isError:y0().optional()}),K40=FA.or(u0.extend({toolResult:j0()})),Ox=iz.extend({name:N(),arguments:P0(N(),j0()).optional()}),X7=m0.extend({method:f("tools/call"),params:Ox}),Lx=j9.extend({method:f("notifications/tools/list_changed"),params:L9.optional()}),q40=C({autoRefresh:y0().default(!0),debounceMs:q0().int().nonnegative().default(300)}),A3=$9(["debug","info","notice","warning","error","critical","alert","emergency"]),jx=U9.extend({level:A3}),Q7=m0.extend({method:f("logging/setLevel"),params:jx}),Rx=L9.extend({level:A3,logger:N().optional(),data:j0()}),Px=j9.extend({method:f("notifications/message"),params:Rx}),Sx=C({name:N().optional()}),kx=C({hints:A0(Sx).optional(),costPriority:q0().min(0).max(1).optional(),speedPriority:q0().min(0).max(1).optional(),intelligencePriority:q0().min(0).max(1).optional()}),Ix=C({mode:$9(["auto","required","none"]).optional()}),xx=C({type:f("tool_result"),toolUseId:N().describe("The unique identifier for the corresponding tool call."),content:A0(J7).default([]),structuredContent:C({}).loose().optional(),isError:y0().optional(),_meta:P0(N(),j0()).optional()}),Tx=p2("type",[A7,b7,G7]),_A=p2("type",[A7,b7,G7,qx,xx]),Cx=C({role:z3,content:U0([_A,A0(_A)]),_meta:P0(N(),j0()).optional()}),vx=iz.extend({messages:A0(Cx),modelPreferences:kx.optional(),systemPrompt:N().optional(),includeContext:$9(["none","thisServer","allServers"]).optional(),temperature:q0().optional(),maxTokens:q0().int(),stopSequences:A0(N()).optional(),metadata:h0.optional(),tools:A0(sZ).optional(),toolChoice:Ix.optional()}),yx=m0.extend({method:f("sampling/createMessage"),params:vx}),$7=u0.extend({model:N(),stopReason:k0($9(["endTurn","stopSequence","maxTokens"]).or(N())),role:z3,content:Tx}),H7=u0.extend({model:N(),stopReason:k0($9(["endTurn","stopSequence","maxTokens","toolUse"]).or(N())),role:z3,content:U0([_A,A0(_A)])}),gx=C({type:f("boolean"),title:N().optional(),description:N().optional(),default:y0().optional()}),fx=C({type:f("string"),title:N().optional(),description:N().optional(),minLength:q0().optional(),maxLength:q0().optional(),format:$9(["email","uri","date","date-time"]).optional(),default:N().optional()}),hx=C({type:$9(["number","integer"]),title:N().optional(),description:N().optional(),minimum:q0().optional(),maximum:q0().optional(),default:q0().optional()}),mx=C({type:f("string"),title:N().optional(),description:N().optional(),enum:A0(N()),default:N().optional()}),ux=C({type:f("string"),title:N().optional(),description:N().optional(),oneOf:A0(C({const:N(),title:N()})),default:N().optional()}),cx=C({type:f("string"),title:N().optional(),description:N().optional(),enum:A0(N()),enumNames:A0(N()).optional(),default:N().optional()}),lx=U0([mx,ux]),px=C({type:f("array"),title:N().optional(),description:N().optional(),minItems:q0().optional(),maxItems:q0().optional(),items:C({type:f("string"),enum:A0(N())}),default:A0(N()).optional()}),dx=C({type:f("array"),title:N().optional(),description:N().optional(),minItems:q0().optional(),maxItems:q0().optional(),items:C({anyOf:A0(C({const:N(),title:N()}))}),default:A0(N()).optional()}),rx=U0([px,dx]),nx=U0([cx,lx,rx]),ix=U0([nx,gx,fx,hx]),ox=iz.extend({mode:f("form").optional(),message:N(),requestedSchema:C({type:f("object"),properties:P0(N(),ix),required:A0(N()).optional()})}),ax=iz.extend({mode:f("url"),message:N(),elicitationId:N(),url:N().url()}),sx=U0([ox,ax]),tx=m0.extend({method:f("elicitation/create"),params:sx}),ex=L9.extend({elicitationId:N()}),_T=j9.extend({method:f("notifications/elicitation/complete"),params:ex}),KA=u0.extend({action:$9(["accept","decline","cancel"]),content:d2((_)=>_===null?void 0:_,P0(N(),U0([N(),q0(),y0(),A0(N())])).optional())}),zT=C({type:f("ref/resource"),uri:N()});var AT=C({type:f("ref/prompt"),name:N()}),bT=U9.extend({ref:U0([AT,zT]),argument:C({name:N(),value:N()}),context:C({arguments:P0(N(),N()).optional()}).optional()}),GT=m0.extend({method:f("completion/complete"),params:bT});var JT=u0.extend({completion:A9({values:A0(N()).max(100),total:k0(q0().int()),hasMore:k0(y0())})}),YT=C({uri:N().startsWith("file://"),name:N().optional(),_meta:P0(N(),j0()).optional()}),XT=m0.extend({method:f("roots/list"),params:U9.optional()}),B7=u0.extend({roots:A0(YT)}),QT=j9.extend({method:f("notifications/roots/list_changed"),params:L9.optional()}),W40=U0([JA,s2,GT,Q7,Kx,z7,aI,tI,zx,Jx,Xx,X7,Y7,XA,$A,HA,ZA]),V40=U0([GA,YA,t2,QT,_3]),U40=U0([bA,$7,H7,KA,B7,QA,BA,C1]),D40=U0([JA,yx,tx,XT,XA,$A,HA,ZA]),M40=U0([GA,YA,Px,$x,bx,Lx,Mx,_3,_T]),N40=U0([bA,lI,JT,Dx,Zx,sI,eI,Ax,FA,Ex,QA,BA,C1]);class s extends Error{constructor(_,z,A){super(`MCP error ${_}: ${z}`);this.code=_,this.data=A,this.name="McpError"}static fromError(_,z,A){if(_===b0.UrlElicitationRequired&&A){let b=A;if(b.elicitations)return new tZ(b.elicitations,z)}return new s(_,z,A)}}class tZ extends s{constructor(_,z=`URL elicitation${_.length>1?"s":""} required`){super(b0.UrlElicitationRequired,z,{elicitations:_})}get elicitations(){return this.data?.elicitations??[]}}function J_(_){return _==="completed"||_==="failed"||_==="cancelled"}var $T=Symbol("Let zodToJsonSchema decide on which parser to use");var __0=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Z7(_){let A=s6(_)?.method;if(!A)throw Error("Schema is missing a method literal");let b=YZ(A);if(typeof b!=="string")throw Error("Schema method literal must be a string");return b}function F7(_,z){let A=b_(_,z);if(!A.success)throw A.error;return A.data}var qT=60000;class K7{constructor(_){if(this._options=_,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(GA,(z)=>{this._oncancel(z)}),this.setNotificationHandler(YA,(z)=>{this._onprogress(z)}),this.setRequestHandler(JA,(z)=>({})),this._taskStore=_?.taskStore,this._taskMessageQueue=_?.taskMessageQueue,this._taskStore)this.setRequestHandler(XA,async(z,A)=>{let b=await this._taskStore.getTask(z.params.taskId,A.sessionId);if(!b)throw new s(b0.InvalidParams,"Failed to retrieve task: Task not found");return{...b}}),this.setRequestHandler($A,async(z,A)=>{let b=async()=>{let G=z.params.taskId;if(this._taskMessageQueue){let Y;while(Y=await this._taskMessageQueue.dequeue(G,A.sessionId)){if(Y.type==="response"||Y.type==="error"){let X=Y.message,Q=X.id,$=this._requestResolvers.get(Q);if($)if(this._requestResolvers.delete(Q),Y.type==="response")$(X);else{let H=X,B=new s(H.error.code,H.error.message,H.error.data);$(B)}else{let H=Y.type==="response"?"Response":"Error";this._onerror(Error(`${H} handler missing for request ${Q}`))}continue}await this._transport?.send(Y.message,{relatedRequestId:A.requestId})}}let J=await this._taskStore.getTask(G,A.sessionId);if(!J)throw new s(b0.InvalidParams,`Task not found: ${G}`);if(!J_(J.status))return await this._waitForTaskUpdate(G,A.signal),await b();if(J_(J.status)){let Y=await this._taskStore.getTaskResult(G,A.sessionId);return this._clearTaskQueue(G),{...Y,_meta:{...Y._meta,[G_]:{taskId:G}}}}return await b()};return await b()}),this.setRequestHandler(HA,async(z,A)=>{try{let{tasks:b,nextCursor:G}=await this._taskStore.listTasks(z.params?.cursor,A.sessionId);return{tasks:b,nextCursor:G,_meta:{}}}catch(b){throw new s(b0.InvalidParams,`Failed to list tasks: ${b instanceof Error?b.message:String(b)}`)}}),this.setRequestHandler(ZA,async(z,A)=>{try{let b=await this._taskStore.getTask(z.params.taskId,A.sessionId);if(!b)throw new s(b0.InvalidParams,`Task not found: ${z.params.taskId}`);if(J_(b.status))throw new s(b0.InvalidParams,`Cannot cancel task in terminal status: ${b.status}`);await this._taskStore.updateTaskStatus(z.params.taskId,"cancelled","Client cancelled task execution.",A.sessionId),this._clearTaskQueue(z.params.taskId);let G=await this._taskStore.getTask(z.params.taskId,A.sessionId);if(!G)throw new s(b0.InvalidParams,`Task not found after cancellation: ${z.params.taskId}`);return{_meta:{},...G}}catch(b){if(b instanceof s)throw b;throw new s(b0.InvalidRequest,`Failed to cancel task: ${b instanceof Error?b.message:String(b)}`)}})}async _oncancel(_){if(!_.params.requestId)return;this._requestHandlerAbortControllers.get(_.params.requestId)?.abort(_.params.reason)}_setupTimeout(_,z,A,b,G=!1){this._timeoutInfo.set(_,{timeoutId:setTimeout(b,z),startTime:Date.now(),timeout:z,maxTotalTimeout:A,resetTimeoutOnProgress:G,onTimeout:b})}_resetTimeout(_){let z=this._timeoutInfo.get(_);if(!z)return!1;let A=Date.now()-z.startTime;if(z.maxTotalTimeout&&A>=z.maxTotalTimeout)throw this._timeoutInfo.delete(_),s.fromError(b0.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:z.maxTotalTimeout,totalElapsed:A});return clearTimeout(z.timeoutId),z.timeoutId=setTimeout(z.onTimeout,z.timeout),!0}_cleanupTimeout(_){let z=this._timeoutInfo.get(_);if(z)clearTimeout(z.timeoutId),this._timeoutInfo.delete(_)}async connect(_){this._transport=_;let z=this.transport?.onclose;this._transport.onclose=()=>{z?.(),this._onclose()};let A=this.transport?.onerror;this._transport.onerror=(G)=>{A?.(G),this._onerror(G)};let b=this._transport?.onmessage;this._transport.onmessage=(G,J)=>{if(b?.(G,J),oz(G)||lZ(G))this._onresponse(G);else if(i2(G))this._onrequest(G,J);else if(cZ(G))this._onnotification(G);else this._onerror(Error(`Unknown message type: ${JSON.stringify(G)}`))},await this._transport.start()}_onclose(){let _=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();let z=s.fromError(b0.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let A of _.values())A(z)}_onerror(_){this.onerror?.(_)}_onnotification(_){let z=this._notificationHandlers.get(_.method)??this.fallbackNotificationHandler;if(z===void 0)return;Promise.resolve().then(()=>z(_)).catch((A)=>this._onerror(Error(`Uncaught error in notification handler: ${A}`)))}_onrequest(_,z){let A=this._requestHandlers.get(_.method)??this.fallbackRequestHandler,b=this._transport,G=_.params?._meta?.[G_]?.taskId;if(A===void 0){let $={jsonrpc:"2.0",id:_.id,error:{code:b0.MethodNotFound,message:"Method not found"}};if(G&&this._taskMessageQueue)this._enqueueTaskMessage(G,{type:"error",message:$,timestamp:Date.now()},b?.sessionId).catch((H)=>this._onerror(Error(`Failed to enqueue error response: ${H}`)));else b?.send($).catch((H)=>this._onerror(Error(`Failed to send an error response: ${H}`)));return}let J=new AbortController;this._requestHandlerAbortControllers.set(_.id,J);let Y=hZ(_.params)?_.params.task:void 0,X=this._taskStore?this.requestTaskStore(_,b?.sessionId):void 0,Q={signal:J.signal,sessionId:b?.sessionId,_meta:_.params?._meta,sendNotification:async($)=>{let H={relatedRequestId:_.id};if(G)H.relatedTask={taskId:G};await this.notification($,H)},sendRequest:async($,H,B)=>{let Z={...B,relatedRequestId:_.id};if(G&&!Z.relatedTask)Z.relatedTask={taskId:G};let F=Z.relatedTask?.taskId??G;if(F&&X)await X.updateTaskStatus(F,"input_required");return await this.request($,H,Z)},authInfo:z?.authInfo,requestId:_.id,requestInfo:z?.requestInfo,taskId:G,taskStore:X,taskRequestedTtl:Y?.ttl,closeSSEStream:z?.closeSSEStream,closeStandaloneSSEStream:z?.closeStandaloneSSEStream};Promise.resolve().then(()=>{if(Y)this.assertTaskHandlerCapability(_.method)}).then(()=>A(_,Q)).then(async($)=>{if(J.signal.aborted)return;let H={result:$,jsonrpc:"2.0",id:_.id};if(G&&this._taskMessageQueue)await this._enqueueTaskMessage(G,{type:"response",message:H,timestamp:Date.now()},b?.sessionId);else await b?.send(H)},async($)=>{if(J.signal.aborted)return;let H={jsonrpc:"2.0",id:_.id,error:{code:Number.isSafeInteger($.code)?$.code:b0.InternalError,message:$.message??"Internal error",...$.data!==void 0&&{data:$.data}}};if(G&&this._taskMessageQueue)await this._enqueueTaskMessage(G,{type:"error",message:H,timestamp:Date.now()},b?.sessionId);else await b?.send(H)}).catch(($)=>this._onerror(Error(`Failed to send response: ${$}`))).finally(()=>{this._requestHandlerAbortControllers.delete(_.id)})}_onprogress(_){let{progressToken:z,...A}=_.params,b=Number(z),G=this._progressHandlers.get(b);if(!G){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(_)}`));return}let J=this._responseHandlers.get(b),Y=this._timeoutInfo.get(b);if(Y&&J&&Y.resetTimeoutOnProgress)try{this._resetTimeout(b)}catch(X){this._responseHandlers.delete(b),this._progressHandlers.delete(b),this._cleanupTimeout(b),J(X);return}G(A)}_onresponse(_){let z=Number(_.id),A=this._requestResolvers.get(z);if(A){if(this._requestResolvers.delete(z),oz(_))A(_);else{let J=new s(_.error.code,_.error.message,_.error.data);A(J)}return}let b=this._responseHandlers.get(z);if(b===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(_)}`));return}this._responseHandlers.delete(z),this._cleanupTimeout(z);let G=!1;if(oz(_)&&_.result&&typeof _.result==="object"){let J=_.result;if(J.task&&typeof J.task==="object"){let Y=J.task;if(typeof Y.taskId==="string")G=!0,this._taskProgressTokens.set(Y.taskId,z)}}if(!G)this._progressHandlers.delete(z);if(oz(_))b(_);else{let J=s.fromError(_.error.code,_.error.message,_.error.data);b(J)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(_,z,A){let{task:b}=A??{};if(!b){try{yield{type:"result",result:await this.request(_,z,A)}}catch(J){yield{type:"error",error:J instanceof s?J:new s(b0.InternalError,String(J))}}return}let G;try{let J=await this.request(_,C1,A);if(J.task)G=J.task.taskId,yield{type:"taskCreated",task:J.task};else throw new s(b0.InternalError,"Task creation did not return a task");while(!0){let Y=await this.getTask({taskId:G},A);if(yield{type:"taskStatus",task:Y},J_(Y.status)){if(Y.status==="completed")yield{type:"result",result:await this.getTaskResult({taskId:G},z,A)};else if(Y.status==="failed")yield{type:"error",error:new s(b0.InternalError,`Task ${G} failed`)};else if(Y.status==="cancelled")yield{type:"error",error:new s(b0.InternalError,`Task ${G} was cancelled`)};return}if(Y.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:G},z,A)};return}let X=Y.pollInterval??this._options?.defaultTaskPollInterval??1000;await new Promise((Q)=>setTimeout(Q,X)),A?.signal?.throwIfAborted()}}catch(J){yield{type:"error",error:J instanceof s?J:new s(b0.InternalError,String(J))}}}request(_,z,A){let{relatedRequestId:b,resumptionToken:G,onresumptiontoken:J,task:Y,relatedTask:X}=A??{};return new Promise((Q,$)=>{let H=(V)=>{$(V)};if(!this._transport){H(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{if(this.assertCapabilityForMethod(_.method),Y)this.assertTaskCapability(_.method)}catch(V){H(V);return}A?.signal?.throwIfAborted();let B=this._requestMessageId++,Z={..._,jsonrpc:"2.0",id:B};if(A?.onprogress)this._progressHandlers.set(B,A.onprogress),Z.params={..._.params,_meta:{..._.params?._meta||{},progressToken:B}};if(Y)Z.params={...Z.params,task:Y};if(X)Z.params={...Z.params,_meta:{...Z.params?._meta||{},[G_]:X}};let F=(V)=>{this._responseHandlers.delete(B),this._progressHandlers.delete(B),this._cleanupTimeout(B),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:B,reason:String(V)}},{relatedRequestId:b,resumptionToken:G,onresumptiontoken:J}).catch((O)=>this._onerror(Error(`Failed to send cancellation: ${O}`)));let w=V instanceof s?V:new s(b0.RequestTimeout,String(V));$(w)};this._responseHandlers.set(B,(V)=>{if(A?.signal?.aborted)return;if(V instanceof Error)return $(V);try{let w=b_(z,V.result);if(!w.success)$(w.error);else Q(w.data)}catch(w){$(w)}}),A?.signal?.addEventListener("abort",()=>{F(A?.signal?.reason)});let K=A?.timeout??qT,q=()=>F(s.fromError(b0.RequestTimeout,"Request timed out",{timeout:K}));this._setupTimeout(B,K,A?.maxTotalTimeout,q,A?.resetTimeoutOnProgress??!1);let W=X?.taskId;if(W){let V=(w)=>{let O=this._responseHandlers.get(B);if(O)O(w);else this._onerror(Error(`Response handler missing for side-channeled request ${B}`))};this._requestResolvers.set(B,V),this._enqueueTaskMessage(W,{type:"request",message:Z,timestamp:Date.now()}).catch((w)=>{this._cleanupTimeout(B),$(w)})}else this._transport.send(Z,{relatedRequestId:b,resumptionToken:G,onresumptiontoken:J}).catch((V)=>{this._cleanupTimeout(B),$(V)})})}async getTask(_,z){return this.request({method:"tasks/get",params:_},QA,z)}async getTaskResult(_,z,A){return this.request({method:"tasks/result",params:_},z,A)}async listTasks(_,z){return this.request({method:"tasks/list",params:_},BA,z)}async cancelTask(_,z){return this.request({method:"tasks/cancel",params:_},rZ,z)}async notification(_,z){if(!this._transport)throw Error("Not connected");this.assertNotificationCapability(_.method);let A=z?.relatedTask?.taskId;if(A){let Y={..._,jsonrpc:"2.0",params:{..._.params,_meta:{..._.params?._meta||{},[G_]:z.relatedTask}}};await this._enqueueTaskMessage(A,{type:"notification",message:Y,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(_.method)&&!_.params&&!z?.relatedRequestId&&!z?.relatedTask){if(this._pendingDebouncedNotifications.has(_.method))return;this._pendingDebouncedNotifications.add(_.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(_.method),!this._transport)return;let Y={..._,jsonrpc:"2.0"};if(z?.relatedTask)Y={...Y,params:{...Y.params,_meta:{...Y.params?._meta||{},[G_]:z.relatedTask}}};this._transport?.send(Y,z).catch((X)=>this._onerror(X))});return}let J={..._,jsonrpc:"2.0"};if(z?.relatedTask)J={...J,params:{...J.params,_meta:{...J.params?._meta||{},[G_]:z.relatedTask}}};await this._transport.send(J,z)}setRequestHandler(_,z){let A=Z7(_);this.assertRequestHandlerCapability(A),this._requestHandlers.set(A,(b,G)=>{let J=F7(_,b);return Promise.resolve(z(J,G))})}removeRequestHandler(_){this._requestHandlers.delete(_)}assertCanSetRequestHandler(_){if(this._requestHandlers.has(_))throw Error(`A request handler for ${_} already exists, which would be overridden`)}setNotificationHandler(_,z){let A=Z7(_);this._notificationHandlers.set(A,(b)=>{let G=F7(_,b);return Promise.resolve(z(G))})}removeNotificationHandler(_){this._notificationHandlers.delete(_)}_cleanupTaskProgressHandler(_){let z=this._taskProgressTokens.get(_);if(z!==void 0)this._progressHandlers.delete(z),this._taskProgressTokens.delete(_)}async _enqueueTaskMessage(_,z,A){if(!this._taskStore||!this._taskMessageQueue)throw Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let b=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(_,z,A,b)}async _clearTaskQueue(_,z){if(this._taskMessageQueue){let A=await this._taskMessageQueue.dequeueAll(_,z);for(let b of A)if(b.type==="request"&&i2(b.message)){let G=b.message.id,J=this._requestResolvers.get(G);if(J)J(new s(b0.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(G);else this._onerror(Error(`Resolver missing for request ${G} during task ${_} cleanup`))}}}async _waitForTaskUpdate(_,z){let A=this._options?.defaultTaskPollInterval??1000;try{let b=await this._taskStore?.getTask(_);if(b?.pollInterval)A=b.pollInterval}catch{}return new Promise((b,G)=>{if(z.aborted){G(new s(b0.InvalidRequest,"Request cancelled"));return}let J=setTimeout(b,A);z.addEventListener("abort",()=>{clearTimeout(J),G(new s(b0.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(_,z){let A=this._taskStore;if(!A)throw Error("No task store configured");return{createTask:async(b)=>{if(!_)throw Error("No request provided");return await A.createTask(b,_.id,{method:_.method,params:_.params},z)},getTask:async(b)=>{let G=await A.getTask(b,z);if(!G)throw new s(b0.InvalidParams,"Failed to retrieve task: Task not found");return G},storeTaskResult:async(b,G,J)=>{await A.storeTaskResult(b,G,J,z);let Y=await A.getTask(b,z);if(Y){let X=_3.parse({method:"notifications/tasks/status",params:Y});if(await this.notification(X),J_(Y.status))this._cleanupTaskProgressHandler(b)}},getTaskResult:(b)=>{return A.getTaskResult(b,z)},updateTaskStatus:async(b,G,J)=>{let Y=await A.getTask(b,z);if(!Y)throw new s(b0.InvalidParams,`Task "${b}" not found - it may have been cleaned up`);if(J_(Y.status))throw new s(b0.InvalidParams,`Cannot update task "${b}" from terminal status "${Y.status}" to "${G}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await A.updateTaskStatus(b,G,J,z);let X=await A.getTask(b,z);if(X){let Q=_3.parse({method:"notifications/tasks/status",params:X});if(await this.notification(Q),J_(X.status))this._cleanupTaskProgressHandler(b)}},listTasks:(b)=>{return A.listTasks(b,z)}}}}function eZ(_){return _!==null&&typeof _==="object"&&!Array.isArray(_)}function _F(_,z){let A={..._};for(let b in z){let G=b,J=z[G];if(J===void 0)continue;let Y=A[G];if(eZ(Y)&&eZ(J))A[G]={...Y,...J};else A[G]=J}return A}var IV=z8(Qb(),1),xV=z8(kV(),1);function Lu(){let _=new IV.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return xV.default(_),_}class Ub{constructor(_){this._ajv=_??Lu()}getValidator(_){let z="$id"in _&&typeof _.$id==="string"?this._ajv.getSchema(_.$id)??this._ajv.compile(_):this._ajv.compile(_);return(A)=>{if(z(A))return{valid:!0,data:A,errorMessage:void 0};else return{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(z.errors)}}}}class Db{constructor(_){this._server=_}requestStream(_,z,A){return this._server.requestStream(_,z,A)}async getTask(_,z){return this._server.getTask({taskId:_},z)}async getTaskResult(_,z,A){return this._server.getTaskResult({taskId:_},z,A)}async listTasks(_,z){return this._server.listTasks(_?{cursor:_}:void 0,z)}async cancelTask(_,z){return this._server.cancelTask({taskId:_},z)}}function TV(_,z,A){if(!_)throw Error(`${A} does not support task creation (required for ${z})`);switch(z){case"tools/call":if(!_.tools?.call)throw Error(`${A} does not support task creation for tools/call (required for ${z})`);break;default:break}}function CV(_,z,A){if(!_)throw Error(`${A} does not support task creation (required for ${z})`);switch(z){case"sampling/createMessage":if(!_.sampling?.createMessage)throw Error(`${A} does not support task creation for sampling/createMessage (required for ${z})`);break;case"elicitation/create":if(!_.elicitation?.create)throw Error(`${A} does not support task creation for elicitation/create (required for ${z})`);break;default:break}}class Mb extends K7{constructor(_,z){super(z);if(this._serverInfo=_,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(A3.options.map((A,b)=>[A,b])),this.isMessageIgnored=(A,b)=>{let G=this._loggingLevels.get(b);return G?this.LOG_LEVEL_SEVERITY.get(A)<this.LOG_LEVEL_SEVERITY.get(G):!1},this._capabilities=z?.capabilities??{},this._instructions=z?.instructions,this._jsonSchemaValidator=z?.jsonSchemaValidator??new Ub,this.setRequestHandler(s2,(A)=>this._oninitialize(A)),this.setNotificationHandler(t2,()=>this.oninitialized?.()),this._capabilities.logging)this.setRequestHandler(Q7,async(A,b)=>{let G=b.sessionId||b.requestInfo?.headers["mcp-session-id"]||void 0,{level:J}=A.params,Y=A3.safeParse(J);if(Y.success)this._loggingLevels.set(G,Y.data);return{}})}get experimental(){if(!this._experimental)this._experimental={tasks:new Db(this)};return this._experimental}registerCapabilities(_){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=_F(this._capabilities,_)}setRequestHandler(_,z){let b=s6(_)?.method;if(!b)throw Error("Schema is missing a method literal");let G;if(x1(b)){let Y=b;G=Y._zod?.def?.value??Y.value}else{let Y=b;G=Y._def?.value??Y.value}if(typeof G!=="string")throw Error("Schema method literal must be a string");if(G==="tools/call"){let Y=async(X,Q)=>{let $=b_(X7,X);if(!$.success){let F=$.error instanceof Error?$.error.message:String($.error);throw new s(b0.InvalidParams,`Invalid tools/call request: ${F}`)}let{params:H}=$.data,B=await Promise.resolve(z(X,Q));if(H.task){let F=b_(C1,B);if(!F.success){let K=F.error instanceof Error?F.error.message:String(F.error);throw new s(b0.InvalidParams,`Invalid task creation result: ${K}`)}return F.data}let Z=b_(FA,B);if(!Z.success){let F=Z.error instanceof Error?Z.error.message:String(Z.error);throw new s(b0.InvalidParams,`Invalid tools/call result: ${F}`)}return Z.data};return super.setRequestHandler(_,Y)}return super.setRequestHandler(_,z)}assertCapabilityForMethod(_){switch(_){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw Error(`Client does not support sampling (required for ${_})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw Error(`Client does not support elicitation (required for ${_})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw Error(`Client does not support listing roots (required for ${_})`);break;case"ping":break}}assertNotificationCapability(_){switch(_){case"notifications/message":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${_})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw Error(`Server does not support notifying about resources (required for ${_})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw Error(`Server does not support notifying of tool list changes (required for ${_})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw Error(`Server does not support notifying of prompt list changes (required for ${_})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw Error(`Client does not support URL elicitation (required for ${_})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(_){if(!this._capabilities)return;switch(_){case"completion/complete":if(!this._capabilities.completions)throw Error(`Server does not support completions (required for ${_})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${_})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw Error(`Server does not support prompts (required for ${_})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw Error(`Server does not support resources (required for ${_})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(`Server does not support tools (required for ${_})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw Error(`Server does not support tasks capability (required for ${_})`);break;case"ping":case"initialize":break}}assertTaskCapability(_){CV(this._clientCapabilities?.tasks?.requests,_,"Client")}assertTaskHandlerCapability(_){if(!this._capabilities)return;TV(this._capabilities.tasks?.requests,_,"Server")}async _oninitialize(_){let z=_.params.protocolVersion;return this._clientCapabilities=_.params.capabilities,this._clientVersion=_.params.clientInfo,{protocolVersion:yZ.includes(z)?z:r2,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},bA)}async createMessage(_,z){if(_.tools||_.toolChoice){if(!this._clientCapabilities?.sampling?.tools)throw Error("Client does not support sampling tools capability.")}if(_.messages.length>0){let A=_.messages[_.messages.length-1],b=Array.isArray(A.content)?A.content:[A.content],G=b.some((Q)=>Q.type==="tool_result"),J=_.messages.length>1?_.messages[_.messages.length-2]:void 0,Y=J?Array.isArray(J.content)?J.content:[J.content]:[],X=Y.some((Q)=>Q.type==="tool_use");if(G){if(b.some((Q)=>Q.type!=="tool_result"))throw Error("The last message must contain only tool_result content if any is present");if(!X)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if(X){let Q=new Set(Y.filter((H)=>H.type==="tool_use").map((H)=>H.id)),$=new Set(b.filter((H)=>H.type==="tool_result").map((H)=>H.toolUseId));if(Q.size!==$.size||![...Q].every((H)=>$.has(H)))throw Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}if(_.tools)return this.request({method:"sampling/createMessage",params:_},H7,z);return this.request({method:"sampling/createMessage",params:_},$7,z)}async elicitInput(_,z){switch(_.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw Error("Client does not support url elicitation.");let b=_;return this.request({method:"elicitation/create",params:b},KA,z)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw Error("Client does not support form elicitation.");let b=_.mode==="form"?_:{..._,mode:"form"},G=await this.request({method:"elicitation/create",params:b},KA,z);if(G.action==="accept"&&G.content&&b.requestedSchema)try{let Y=this._jsonSchemaValidator.getValidator(b.requestedSchema)(G.content);if(!Y.valid)throw new s(b0.InvalidParams,`Elicitation response content does not match requested schema: ${Y.errorMessage}`)}catch(J){if(J instanceof s)throw J;throw new s(b0.InternalError,`Error validating elicitation response: ${J instanceof Error?J.message:String(J)}`)}return G}}}createElicitationCompletionNotifier(_,z){if(!this._clientCapabilities?.elicitation?.url)throw Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:_}},z)}async listRoots(_,z){return this.request({method:"roots/list",params:_},B7,z)}async sendLoggingMessage(_,z){if(this._capabilities.logging){if(!this.isMessageIgnored(_.level,z))return this.notification({method:"notifications/message",params:_})}}async sendResourceUpdated(_){return this.notification({method:"notifications/resources/updated",params:_})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}}import yV from"node:process";class Nb{append(_){this._buffer=this._buffer?Buffer.concat([this._buffer,_]):_}readMessage(){if(!this._buffer)return null;let _=this._buffer.indexOf(`
206
- `);if(_===-1)return null;let z=this._buffer.toString("utf8",0,_).replace(/\r$/,"");return this._buffer=this._buffer.subarray(_+1),ju(z)}clear(){this._buffer=void 0}}function ju(_){return pZ.parse(JSON.parse(_))}function vV(_){return JSON.stringify(_)+`
207
- `}class wb{constructor(_=yV.stdin,z=yV.stdout){this._stdin=_,this._stdout=z,this._readBuffer=new Nb,this._started=!1,this._ondata=(A)=>{this._readBuffer.append(A),this.processReadBuffer()},this._onerror=(A)=>{this.onerror?.(A)}}async start(){if(this._started)throw Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){while(!0)try{let _=this._readBuffer.readMessage();if(_===null)break;this.onmessage?.(_)}catch(_){this.onerror?.(_)}}async close(){if(this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0)this._stdin.pause();this._readBuffer.clear(),this.onclose?.()}send(_){return new Promise((z)=>{let A=vV(_);if(this._stdout.write(A))z();else this._stdout.once("drain",z)})}}var xu=Iu(import.meta.url),gV=ku(xu),Tu=Ob(L1,"mcp.log");function D9(_){let A=`[${new Date().toISOString()}] [mcp] ${_}
208
- `;try{Su(Tu,A)}catch{}}function Cu(){if(!Eb(j1))return!1;try{let _=parseInt(Pu(j1,"utf-8").trim());return process.kill(_,0),!0}catch{return!1}}async function vu(){if(Cu()){D9("Service already running");return}D9("Starting service...");let _=Ob(gV,"../../service/server.ts"),z=Ob(gV,"../../service/server.js"),A=Eb(_)?_:z;if(!Eb(A))throw D9(`Service script not found: ${A}`),Error("Service script not found");let b=Ru("bun",["run",A],{detached:!0,stdio:"ignore",env:{...process.env}});b.unref(),D9(`Service spawned (PID: ${b.pid})`);let G=50;for(let J=0;J<G;J++)try{(await k_()).end(),D9("Service ready");return}catch{await new Promise((Y)=>setTimeout(Y,100))}throw Error("Service failed to start")}async function yu(){let _=await k_(),z=crypto.randomUUID();return xz(_,{type:"connect",id:z}),D9(`Connected to service with ID: ${z}`),_}async function fV(){D9("MCP server starting");let _=null;try{await vu(),_=await yu()}catch(G){D9(`Failed to connect to service: ${G instanceof Error?G.message:String(G)}`)}let z=new Mb({name:"agentlogs",version:"0.0.1"},{capabilities:{tools:{},prompts:{}}});z.setRequestHandler(Y7,()=>({tools:[]})),z.setRequestHandler(z7,()=>({prompts:[]}));let A=()=>{if(D9("Shutting down"),_)_.end()};process.on("SIGTERM",()=>{D9("Received SIGTERM"),A(),process.exit(0)}),process.on("SIGINT",()=>{D9("Received SIGINT"),A(),process.exit(0)});let b=new wb;D9("MCP server connecting to transport"),await z.connect(b),D9("MCP server ready")}var o0=new lb;o0.name("agentlogs").description("CLI tools for working with AgentLogs accounts and transcripts from Claude Code and Codex");o0.command("login").description("Authenticate with AgentLogs using device authorization").option("--dev","Login to development environment (http://localhost:3000)").action(async(_)=>{await UY({dev:_.dev})});o0.command("status").description("Check your current login status").action(async()=>{await NY()});o0.command("logout").description("Log out and clear stored credentials").option("--dev","Logout from development environment").action(async(_)=>{await DY({dev:_.dev})});o0.command("upload").argument("[directory]","Filter transcripts to this directory").option("-s, --source <source>","Filter by source: claude-code, codex, opencode, or pi").option("-l, --latest","Upload the most recent transcript without picker").description("Interactively select and upload a transcript").action(async(_,z)=>{let A=z.source;await KQ(_,{source:A,latest:z.latest})});var Lb=o0.command("claudecode").description("Claude Code transcript utilities for AgentLogs");Lb.command("upload").argument("<transcript>","Path or alias for a transcript JSONL file").description("Upload a transcript JSONL file to AgentLogs").action(async(_)=>{await NQ(_)});Lb.command("hook").description("Process Claude Code hook input from stdin").action(async()=>{await VQ()});var gu=o0.command("codex").description("Codex transcript utilities for AgentLogs");gu.command("upload").argument("<transcript>","Path or alias for a Codex transcript JSONL file").description("Upload a Codex transcript JSONL file to AgentLogs").action(async(_)=>{await wQ(_)});var hV=o0.command("opencode").description("OpenCode transcript utilities for AgentLogs");hV.command("upload").argument("<sessionId>","OpenCode session ID to upload").description("Upload an OpenCode session transcript to AgentLogs").action(async(_)=>{await EQ(_)});hV.command("hook").description("Process OpenCode hook input from stdin").action(async()=>{await OQ()});var mV=o0.command("pi").description("Pi transcript utilities for AgentLogs");mV.command("upload").argument("[sessionIdOrPath]","Pi session ID or path to session file").description("Upload a Pi session transcript to AgentLogs").action(async(_)=>{await PQ(_)});mV.command("hook").description("Process Pi hook input from stdin").action(async()=>{await SQ()});Lb.command("sync").argument("[claudeDir]","Optional Claude data directory (defaults to ~/.claude)").option("-r, --repo <repoId>","Only sync transcripts for the provided repo identifier").description("Upload all local Claude Code transcripts that are missing or outdated on the server").action(async(_,z)=>{await DQ({claudeDir:_,repoFilter:z.repo})});o0.command("settings").description("View and modify AgentLogs settings").option("--allowMode <mode>","Set allow mode: 'allowlist' or 'denylist'").action(async(_)=>{await MY({allowMode:_.allowMode})});o0.command("allow").description("Allow capture for the current repository").option("--visibility <visibility>","Set visibility: 'public', 'team', or 'private'").option("--public","Set visibility to public").option("--team","Set visibility to team").option("--private","Set visibility to private").action(async(_)=>{await JG(_)});o0.command("deny").description("Deny capture for the current repository").action(async()=>{await YG()});var eA=o0.command("service").description("Manage the agentlogs background service");eA.command("start").description("Start the background service").action(async()=>{await mQ()});eA.command("stop").description("Stop the background service").action(async()=>{await uQ()});eA.command("status").description("Show service status").action(async()=>{await cQ()});eA.command("logs").description("Tail the watcher event logs").action(async()=>{await lQ()});o0.command("mcp").description("Start MCP server (used by Codex)").action(async()=>{await fV()});o0.showHelpAfterError("(add --help for additional information)");o0.parseAsync().catch((_)=>{console.error("CLI encountered an unexpected error."),console.error(_),process.exit(1)});
205
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let Y of _.seen.entries()){let X=Y[1];if(z===Y[0]){J(Y);continue}if(_.external){let $=_.external.registry.get(Y[0])?.id;if(z!==Y[0]&&$){J(Y);continue}}if(_.metadataRegistry.get(Y[0])?.id){J(Y);continue}if(X.cycle){J(Y);continue}if(X.count>1){if(_.reused==="ref"){J(Y);continue}}}}function g2(_,z){let A=_.seen.get(z);if(!A)throw Error("Unprocessed schema. This is a bug in Zod.");let b=(Y)=>{let X=_.seen.get(Y);if(X.ref===null)return;let Q=X.def??X.schema,$={...Q},H=X.ref;if(X.ref=null,H){b(H);let Z=_.seen.get(H),F=Z.schema;if(F.$ref&&(_.target==="draft-07"||_.target==="draft-04"||_.target==="openapi-3.0"))Q.allOf=Q.allOf??[],Q.allOf.push(F);else Object.assign(Q,F);if(Object.assign(Q,$),Y._zod.parent===H)for(let q in Q){if(q==="$ref"||q==="allOf")continue;if(!(q in $))delete Q[q]}if(F.$ref)for(let q in Q){if(q==="$ref"||q==="allOf")continue;if(q in Z.def&&JSON.stringify(Q[q])===JSON.stringify(Z.def[q]))delete Q[q]}}let B=Y._zod.parent;if(B&&B!==H){b(B);let Z=_.seen.get(B);if(Z?.schema.$ref){if(Q.$ref=Z.schema.$ref,Z.def)for(let F in Q){if(F==="$ref"||F==="allOf")continue;if(F in Z.def&&JSON.stringify(Q[F])===JSON.stringify(Z.def[F]))delete Q[F]}}}_.override({zodSchema:Y,jsonSchema:Q,path:X.path??[]})};for(let Y of[..._.seen.entries()].reverse())b(Y[0]);let G={};if(_.target==="draft-2020-12")G.$schema="https://json-schema.org/draft/2020-12/schema";else if(_.target==="draft-07")G.$schema="http://json-schema.org/draft-07/schema#";else if(_.target==="draft-04")G.$schema="http://json-schema.org/draft-04/schema#";else if(_.target==="openapi-3.0");if(_.external?.uri){let Y=_.external.registry.get(z)?.id;if(!Y)throw Error("Schema is missing an `id` property");G.$id=_.external.uri(Y)}Object.assign(G,A.def??A.schema);let J=_.external?.defs??{};for(let Y of _.seen.entries()){let X=Y[1];if(X.def&&X.defId)J[X.defId]=X.def}if(_.external);else if(Object.keys(J).length>0)if(_.target==="draft-2020-12")G.$defs=J;else G.definitions=J;try{let Y=JSON.parse(JSON.stringify(G));return Object.defineProperty(Y,"~standard",{value:{...z["~standard"],jsonSchema:{input:nz(z,"input",_.processors),output:nz(z,"output",_.processors)}},enumerable:!1,writable:!1}),Y}catch(Y){throw Error("Error converting schema to JSON.")}}function z9(_,z){let A=z??{seen:new Set};if(A.seen.has(_))return!1;A.seen.add(_);let b=_._zod.def;if(b.type==="transform")return!0;if(b.type==="array")return z9(b.element,A);if(b.type==="set")return z9(b.valueType,A);if(b.type==="lazy")return z9(b.getter(),A);if(b.type==="promise"||b.type==="optional"||b.type==="nonoptional"||b.type==="nullable"||b.type==="readonly"||b.type==="default"||b.type==="prefault")return z9(b.innerType,A);if(b.type==="intersection")return z9(b.left,A)||z9(b.right,A);if(b.type==="record"||b.type==="map")return z9(b.keyType,A)||z9(b.valueType,A);if(b.type==="pipe")return z9(b.in,A)||z9(b.out,A);if(b.type==="object"){for(let G in b.shape)if(z9(b.shape[G],A))return!0;return!1}if(b.type==="union"){for(let G of b.options)if(z9(G,A))return!0;return!1}if(b.type==="tuple"){for(let G of b.items)if(z9(G,A))return!0;if(b.rest&&z9(b.rest,A))return!0;return!1}return!1}var hB=(_,z={})=>(A)=>{let b=v2({...A,processors:z});return I0(_,b),y2(b,_),g2(b,_)},nz=(_,z,A={})=>(b)=>{let{libraryOptions:G,target:J}=b??{},Y=v2({...G??{},target:J,io:z,processors:A});return I0(_,Y),y2(Y,_),g2(Y,_)};var mk={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},mB=(_,z,A,b)=>{let G=A;G.type="string";let{minimum:J,maximum:Y,format:X,patterns:Q,contentEncoding:$}=_._zod.bag;if(typeof J==="number")G.minLength=J;if(typeof Y==="number")G.maxLength=Y;if(X){if(G.format=mk[X]??X,G.format==="")delete G.format;if(X==="time")delete G.format}if($)G.contentEncoding=$;if(Q&&Q.size>0){let H=[...Q];if(H.length===1)G.pattern=H[0].source;else if(H.length>1)G.allOf=[...H.map((B)=>({...z.target==="draft-07"||z.target==="draft-04"||z.target==="openapi-3.0"?{type:"string"}:{},pattern:B.source}))]}},uB=(_,z,A,b)=>{let G=A,{minimum:J,maximum:Y,format:X,multipleOf:Q,exclusiveMaximum:$,exclusiveMinimum:H}=_._zod.bag;if(typeof X==="string"&&X.includes("int"))G.type="integer";else G.type="number";if(typeof H==="number")if(z.target==="draft-04"||z.target==="openapi-3.0")G.minimum=H,G.exclusiveMinimum=!0;else G.exclusiveMinimum=H;if(typeof J==="number"){if(G.minimum=J,typeof H==="number"&&z.target!=="draft-04")if(H>=J)delete G.minimum;else delete G.exclusiveMinimum}if(typeof $==="number")if(z.target==="draft-04"||z.target==="openapi-3.0")G.maximum=$,G.exclusiveMaximum=!0;else G.exclusiveMaximum=$;if(typeof Y==="number"){if(G.maximum=Y,typeof $==="number"&&z.target!=="draft-04")if($<=Y)delete G.maximum;else delete G.exclusiveMaximum}if(typeof Q==="number")G.multipleOf=Q},cB=(_,z,A,b)=>{A.type="boolean"};var lB=(_,z,A,b)=>{if(z.target==="openapi-3.0")A.type="string",A.nullable=!0,A.enum=[null];else A.type="null"};var pB=(_,z,A,b)=>{A.not={}};var dB=(_,z,A,b)=>{};var rB=(_,z,A,b)=>{let G=_._zod.def,J=gz(G.entries);if(J.every((Y)=>typeof Y==="number"))A.type="number";if(J.every((Y)=>typeof Y==="string"))A.type="string";A.enum=J},nB=(_,z,A,b)=>{let G=_._zod.def,J=[];for(let Y of G.values)if(Y===void 0){if(z.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof Y==="bigint")if(z.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else J.push(Number(Y));else J.push(Y);if(J.length===0);else if(J.length===1){let Y=J[0];if(A.type=Y===null?"null":typeof Y,z.target==="draft-04"||z.target==="openapi-3.0")A.enum=[Y];else A.const=Y}else{if(J.every((Y)=>typeof Y==="number"))A.type="number";if(J.every((Y)=>typeof Y==="string"))A.type="string";if(J.every((Y)=>typeof Y==="boolean"))A.type="boolean";if(J.every((Y)=>Y===null))A.type="null";A.enum=J}};var iB=(_,z,A,b)=>{if(z.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")};var oB=(_,z,A,b)=>{if(z.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")};var aB=(_,z,A,b)=>{let G=A,J=_._zod.def,{minimum:Y,maximum:X}=_._zod.bag;if(typeof Y==="number")G.minItems=Y;if(typeof X==="number")G.maxItems=X;G.type="array",G.items=I0(J.element,z,{...b,path:[...b.path,"items"]})},sB=(_,z,A,b)=>{let G=A,J=_._zod.def;G.type="object",G.properties={};let Y=J.shape;for(let $ in Y)G.properties[$]=I0(Y[$],z,{...b,path:[...b.path,"properties",$]});let X=new Set(Object.keys(Y)),Q=new Set([...X].filter(($)=>{let H=J.shape[$]._zod;if(z.io==="input")return H.optin===void 0;else return H.optout===void 0}));if(Q.size>0)G.required=Array.from(Q);if(J.catchall?._zod.def.type==="never")G.additionalProperties=!1;else if(!J.catchall){if(z.io==="output")G.additionalProperties=!1}else if(J.catchall)G.additionalProperties=I0(J.catchall,z,{...b,path:[...b.path,"additionalProperties"]})},tB=(_,z,A,b)=>{let G=_._zod.def,J=G.inclusive===!1,Y=G.options.map((X,Q)=>I0(X,z,{...b,path:[...b.path,J?"oneOf":"anyOf",Q]}));if(J)A.oneOf=Y;else A.anyOf=Y},eB=(_,z,A,b)=>{let G=_._zod.def,J=I0(G.left,z,{...b,path:[...b.path,"allOf",0]}),Y=I0(G.right,z,{...b,path:[...b.path,"allOf",1]}),X=($)=>("allOf"in $)&&Object.keys($).length===1,Q=[...X(J)?J.allOf:[J],...X(Y)?Y.allOf:[Y]];A.allOf=Q};var _Z=(_,z,A,b)=>{let G=A,J=_._zod.def;G.type="object";let Y=J.keyType,Q=Y._zod.bag?.patterns;if(J.mode==="loose"&&Q&&Q.size>0){let H=I0(J.valueType,z,{...b,path:[...b.path,"patternProperties","*"]});G.patternProperties={};for(let B of Q)G.patternProperties[B.source]=H}else{if(z.target==="draft-07"||z.target==="draft-2020-12")G.propertyNames=I0(J.keyType,z,{...b,path:[...b.path,"propertyNames"]});G.additionalProperties=I0(J.valueType,z,{...b,path:[...b.path,"additionalProperties"]})}let $=Y._zod.values;if($){let H=[...$].filter((B)=>typeof B==="string"||typeof B==="number");if(H.length>0)G.required=H}},zZ=(_,z,A,b)=>{let G=_._zod.def,J=I0(G.innerType,z,b),Y=z.seen.get(_);if(z.target==="openapi-3.0")Y.ref=G.innerType,A.nullable=!0;else A.anyOf=[J,{type:"null"}]},AZ=(_,z,A,b)=>{let G=_._zod.def;I0(G.innerType,z,b);let J=z.seen.get(_);J.ref=G.innerType},bZ=(_,z,A,b)=>{let G=_._zod.def;I0(G.innerType,z,b);let J=z.seen.get(_);J.ref=G.innerType,A.default=JSON.parse(JSON.stringify(G.defaultValue))},GZ=(_,z,A,b)=>{let G=_._zod.def;I0(G.innerType,z,b);let J=z.seen.get(_);if(J.ref=G.innerType,z.io==="input")A._prefault=JSON.parse(JSON.stringify(G.defaultValue))},JZ=(_,z,A,b)=>{let G=_._zod.def;I0(G.innerType,z,b);let J=z.seen.get(_);J.ref=G.innerType;let Y;try{Y=G.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}A.default=Y},YZ=(_,z,A,b)=>{let G=_._zod.def,J=z.io==="input"?G.in._zod.def.type==="transform"?G.out:G.in:G.out;I0(J,z,b);let Y=z.seen.get(_);Y.ref=J},XZ=(_,z,A,b)=>{let G=_._zod.def;I0(G.innerType,z,b);let J=z.seen.get(_);J.ref=G.innerType,A.readOnly=!0};var f2=(_,z,A,b)=>{let G=_._zod.def;I0(G.innerType,z,b);let J=z.seen.get(_);J.ref=G.innerType};function C1(_){return!!_._zod}function b_(_,z){if(C1(_))return cz(_,z);return _.safeParse(z)}function _A(_){if(!_)return;let z;if(C1(_))z=_._zod?.def?.shape;else z=_.shape;if(!z)return;if(typeof z==="function")try{return z()}catch{return}return z}function QZ(_){if(C1(_)){let J=_._zod?.def;if(J){if(J.value!==void 0)return J.value;if(Array.isArray(J.values)&&J.values.length>0)return J.values[0]}}let A=_._def;if(A){if(A.value!==void 0)return A.value;if(Array.isArray(A.values)&&A.values.length>0)return A.values[0]}let b=_.value;if(b!==void 0)return b;return}var oz={};J8(oz,{time:()=>u2,duration:()=>c2,datetime:()=>h2,date:()=>m2,ZodISOTime:()=>BZ,ZodISODuration:()=>ZZ,ZodISODateTime:()=>$Z,ZodISODate:()=>HZ});var $Z=E("ZodISODateTime",(_,z)=>{UH.init(_,z),L0.init(_,z)});function h2(_){return LB($Z,_)}var HZ=E("ZodISODate",(_,z)=>{DH.init(_,z),L0.init(_,z)});function m2(_){return jB(HZ,_)}var BZ=E("ZodISOTime",(_,z)=>{MH.init(_,z),L0.init(_,z)});function u2(_){return RB(BZ,_)}var ZZ=E("ZodISODuration",(_,z)=>{NH.init(_,z),L0.init(_,z)});function c2(_){return PB(ZZ,_)}var FZ=(_,z)=>{m6.init(_,z),_.name="ZodError",Object.defineProperties(_,{format:{value:(A)=>A$(_,A)},flatten:{value:(A)=>z$(_,A)},addIssue:{value:(A)=>{_.issues.push(A),_.message=JSON.stringify(_.issues,k1,2)}},addIssues:{value:(A)=>{_.issues.push(...A),_.message=JSON.stringify(_.issues,k1,2)}},isEmpty:{get(){return _.issues.length===0}}})},G90=E("ZodError",FZ),V9=E("ZodError",FZ,{Parent:Error});var KZ=u6(V9),qZ=c6(V9),WZ=uz(V9),VZ=lz(V9),UZ=b$(V9),DZ=G$(V9),MZ=J$(V9),NZ=Y$(V9),wZ=X$(V9),EZ=Q$(V9),OZ=$$(V9),LZ=H$(V9);var R0=E("ZodType",(_,z)=>{return M0.init(_,z),Object.assign(_["~standard"],{jsonSchema:{input:nz(_,"input"),output:nz(_,"output")}}),_.toJSONSchema=hB(_,{}),_.def=z,_.type=z.type,Object.defineProperty(_,"_def",{value:z}),_.check=(...A)=>{return _.clone(X0.mergeDefs(z,{checks:[...z.checks??[],...A.map((b)=>typeof b==="function"?{_zod:{check:b,def:{check:"custom"},onattach:[]}}:b)]}),{parent:!0})},_.with=_.check,_.clone=(A,b)=>l9(_,A,b),_.brand=()=>_,_.register=(A,b)=>{return A.add(_,b),_},_.parse=(A,b)=>KZ(_,A,b,{callee:_.parse}),_.safeParse=(A,b)=>WZ(_,A,b),_.parseAsync=async(A,b)=>qZ(_,A,b,{callee:_.parseAsync}),_.safeParseAsync=async(A,b)=>VZ(_,A,b),_.spa=_.safeParseAsync,_.encode=(A,b)=>UZ(_,A,b),_.decode=(A,b)=>DZ(_,A,b),_.encodeAsync=async(A,b)=>MZ(_,A,b),_.decodeAsync=async(A,b)=>NZ(_,A,b),_.safeEncode=(A,b)=>wZ(_,A,b),_.safeDecode=(A,b)=>EZ(_,A,b),_.safeEncodeAsync=async(A,b)=>OZ(_,A,b),_.safeDecodeAsync=async(A,b)=>LZ(_,A,b),_.refine=(A,b)=>_.check(hI(A,b)),_.superRefine=(A)=>_.check(mI(A)),_.overwrite=(A)=>_.check(A_(A)),_.optional=()=>k0(_),_.exactOptional=()=>RI(_),_.nullable=()=>PZ(_),_.nullish=()=>k0(PZ(_)),_.nonoptional=(A)=>TI(_,A),_.array=()=>A0(_),_.or=(A)=>U0([_,A]),_.and=(A)=>AA(_,A),_.transform=(A)=>p2(_,TZ(A)),_.default=(A)=>kI(_,A),_.prefault=(A)=>xI(_,A),_.catch=(A)=>vI(_,A),_.pipe=(A)=>p2(_,A),_.readonly=()=>fI(_),_.describe=(A)=>{let b=_.clone();return T_.add(b,{description:A}),b},Object.defineProperty(_,"description",{get(){return T_.get(_)?.description},configurable:!0}),_.meta=(...A)=>{if(A.length===0)return T_.get(_);let b=_.clone();return T_.add(b,A[0]),b},_.isOptional=()=>_.safeParse(void 0).success,_.isNullable=()=>_.safeParse(null).success,_.apply=(A)=>A(_),_}),SZ=E("_ZodString",(_,z)=>{i6.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(b,G,J)=>mB(_,b,G,J);let A=_._zod.bag;_.format=A.format??null,_.minLength=A.minimum??null,_.maxLength=A.maximum??null,_.regex=(...b)=>_.check(O2(...b)),_.includes=(...b)=>_.check(R2(...b)),_.startsWith=(...b)=>_.check(P2(...b)),_.endsWith=(...b)=>_.check(S2(...b)),_.min=(...b)=>_.check(T1(...b)),_.max=(...b)=>_.check(t6(...b)),_.length=(...b)=>_.check(e6(...b)),_.nonempty=(...b)=>_.check(T1(1,...b)),_.lowercase=(b)=>_.check(L2(b)),_.uppercase=(b)=>_.check(j2(b)),_.trim=()=>_.check(I2()),_.normalize=(...b)=>_.check(k2(...b)),_.toLowerCase=()=>_.check(x2()),_.toUpperCase=()=>_.check(T2()),_.slugify=()=>_.check(C2())}),ak=E("ZodString",(_,z)=>{i6.init(_,z),SZ.init(_,z),_.email=(A)=>_.check(GB(sk,A)),_.url=(A)=>_.check($B(tk,A)),_.jwt=(A)=>_.check(OB(FI,A)),_.emoji=(A)=>_.check(HB(ek,A)),_.guid=(A)=>_.check(E2(jZ,A)),_.uuid=(A)=>_.check(JB(zA,A)),_.uuidv4=(A)=>_.check(YB(zA,A)),_.uuidv6=(A)=>_.check(XB(zA,A)),_.uuidv7=(A)=>_.check(QB(zA,A)),_.nanoid=(A)=>_.check(BB(_I,A)),_.guid=(A)=>_.check(E2(jZ,A)),_.cuid=(A)=>_.check(ZB(zI,A)),_.cuid2=(A)=>_.check(FB(AI,A)),_.ulid=(A)=>_.check(KB(bI,A)),_.base64=(A)=>_.check(NB(HI,A)),_.base64url=(A)=>_.check(wB(BI,A)),_.xid=(A)=>_.check(qB(GI,A)),_.ksuid=(A)=>_.check(WB(JI,A)),_.ipv4=(A)=>_.check(VB(YI,A)),_.ipv6=(A)=>_.check(UB(XI,A)),_.cidrv4=(A)=>_.check(DB(QI,A)),_.cidrv6=(A)=>_.check(MB($I,A)),_.e164=(A)=>_.check(EB(ZI,A)),_.datetime=(A)=>_.check(h2(A)),_.date=(A)=>_.check(m2(A)),_.time=(A)=>_.check(u2(A)),_.duration=(A)=>_.check(c2(A))});function N(_){return bB(ak,_)}var L0=E("ZodStringFormat",(_,z)=>{N0.init(_,z),SZ.init(_,z)}),sk=E("ZodEmail",(_,z)=>{$H.init(_,z),L0.init(_,z)});var jZ=E("ZodGUID",(_,z)=>{XH.init(_,z),L0.init(_,z)});var zA=E("ZodUUID",(_,z)=>{QH.init(_,z),L0.init(_,z)});var tk=E("ZodURL",(_,z)=>{HH.init(_,z),L0.init(_,z)});var ek=E("ZodEmoji",(_,z)=>{BH.init(_,z),L0.init(_,z)});var _I=E("ZodNanoID",(_,z)=>{ZH.init(_,z),L0.init(_,z)});var zI=E("ZodCUID",(_,z)=>{FH.init(_,z),L0.init(_,z)});var AI=E("ZodCUID2",(_,z)=>{KH.init(_,z),L0.init(_,z)});var bI=E("ZodULID",(_,z)=>{qH.init(_,z),L0.init(_,z)});var GI=E("ZodXID",(_,z)=>{WH.init(_,z),L0.init(_,z)});var JI=E("ZodKSUID",(_,z)=>{VH.init(_,z),L0.init(_,z)});var YI=E("ZodIPv4",(_,z)=>{wH.init(_,z),L0.init(_,z)});var XI=E("ZodIPv6",(_,z)=>{EH.init(_,z),L0.init(_,z)});var QI=E("ZodCIDRv4",(_,z)=>{OH.init(_,z),L0.init(_,z)});var $I=E("ZodCIDRv6",(_,z)=>{LH.init(_,z),L0.init(_,z)});var HI=E("ZodBase64",(_,z)=>{RH.init(_,z),L0.init(_,z)});var BI=E("ZodBase64URL",(_,z)=>{PH.init(_,z),L0.init(_,z)});var ZI=E("ZodE164",(_,z)=>{SH.init(_,z),L0.init(_,z)});var FI=E("ZodJWT",(_,z)=>{kH.init(_,z),L0.init(_,z)});var kZ=E("ZodNumber",(_,z)=>{D2.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(b,G,J)=>uB(_,b,G,J),_.gt=(b,G)=>_.check(a6(b,G)),_.gte=(b,G)=>_.check(rz(b,G)),_.min=(b,G)=>_.check(rz(b,G)),_.lt=(b,G)=>_.check(o6(b,G)),_.lte=(b,G)=>_.check(dz(b,G)),_.max=(b,G)=>_.check(dz(b,G)),_.int=(b)=>_.check(RZ(b)),_.safe=(b)=>_.check(RZ(b)),_.positive=(b)=>_.check(a6(0,b)),_.nonnegative=(b)=>_.check(rz(0,b)),_.negative=(b)=>_.check(o6(0,b)),_.nonpositive=(b)=>_.check(dz(0,b)),_.multipleOf=(b,G)=>_.check(s6(b,G)),_.step=(b,G)=>_.check(s6(b,G)),_.finite=()=>_;let A=_._zod.bag;_.minValue=Math.max(A.minimum??Number.NEGATIVE_INFINITY,A.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,_.maxValue=Math.min(A.maximum??Number.POSITIVE_INFINITY,A.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,_.isInt=(A.format??"").includes("int")||Number.isSafeInteger(A.multipleOf??0.5),_.isFinite=!0,_.format=A.format??null});function q0(_){return SB(kZ,_)}var KI=E("ZodNumberFormat",(_,z)=>{IH.init(_,z),kZ.init(_,z)});function RZ(_){return kB(KI,_)}var qI=E("ZodBoolean",(_,z)=>{xH.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,b,G)=>cB(_,A,b,G)});function y0(_){return IB(qI,_)}var WI=E("ZodNull",(_,z)=>{TH.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,b,G)=>lB(_,A,b,G)});function d2(_){return xB(WI,_)}var VI=E("ZodUnknown",(_,z)=>{CH.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,b,G)=>dB(_,A,b,G)});function j0(){return TB(VI)}var UI=E("ZodNever",(_,z)=>{vH.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,b,G)=>pB(_,A,b,G)});function DI(_){return CB(UI,_)}var MI=E("ZodArray",(_,z)=>{yH.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,b,G)=>aB(_,A,b,G),_.element=z.element,_.min=(A,b)=>_.check(T1(A,b)),_.nonempty=(A)=>_.check(T1(1,A)),_.max=(A,b)=>_.check(t6(A,b)),_.length=(A,b)=>_.check(e6(A,b)),_.unwrap=()=>_.element});function A0(_,z){return vB(MI,_,z)}var IZ=E("ZodObject",(_,z)=>{hH.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,b,G)=>sB(_,A,b,G),X0.defineLazy(_,"shape",()=>{return z.shape}),_.keyof=()=>$9(Object.keys(_._zod.def.shape)),_.catchall=(A)=>_.clone({..._._zod.def,catchall:A}),_.passthrough=()=>_.clone({..._._zod.def,catchall:j0()}),_.loose=()=>_.clone({..._._zod.def,catchall:j0()}),_.strict=()=>_.clone({..._._zod.def,catchall:DI()}),_.strip=()=>_.clone({..._._zod.def,catchall:void 0}),_.extend=(A)=>{return X0.extend(_,A)},_.safeExtend=(A)=>{return X0.safeExtend(_,A)},_.merge=(A)=>X0.merge(_,A),_.pick=(A)=>X0.pick(_,A),_.omit=(A)=>X0.omit(_,A),_.partial=(...A)=>X0.partial(CZ,_,A[0]),_.required=(...A)=>X0.required(vZ,_,A[0])});function C(_,z){let A={type:"object",shape:_??{},...X0.normalizeParams(z)};return new IZ(A)}function A9(_,z){return new IZ({type:"object",shape:_,catchall:j0(),...X0.normalizeParams(z)})}var xZ=E("ZodUnion",(_,z)=>{M2.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,b,G)=>tB(_,A,b,G),_.options=z.options});function U0(_,z){return new xZ({type:"union",options:_,...X0.normalizeParams(z)})}var NI=E("ZodDiscriminatedUnion",(_,z)=>{xZ.init(_,z),mH.init(_,z)});function r2(_,z,A){return new NI({type:"union",options:z,discriminator:_,...X0.normalizeParams(A)})}var wI=E("ZodIntersection",(_,z)=>{uH.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,b,G)=>eB(_,A,b,G)});function AA(_,z){return new wI({type:"intersection",left:_,right:z})}var EI=E("ZodRecord",(_,z)=>{cH.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,b,G)=>_Z(_,A,b,G),_.keyType=z.keyType,_.valueType=z.valueType});function P0(_,z,A){return new EI({type:"record",keyType:_,valueType:z,...X0.normalizeParams(A)})}var l2=E("ZodEnum",(_,z)=>{lH.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(b,G,J)=>rB(_,b,G,J),_.enum=z.entries,_.options=Object.values(z.entries);let A=new Set(Object.keys(z.entries));_.extract=(b,G)=>{let J={};for(let Y of b)if(A.has(Y))J[Y]=z.entries[Y];else throw Error(`Key ${Y} not found in enum`);return new l2({...z,checks:[],...X0.normalizeParams(G),entries:J})},_.exclude=(b,G)=>{let J={...z.entries};for(let Y of b)if(A.has(Y))delete J[Y];else throw Error(`Key ${Y} not found in enum`);return new l2({...z,checks:[],...X0.normalizeParams(G),entries:J})}});function $9(_,z){let A=Array.isArray(_)?Object.fromEntries(_.map((b)=>[b,b])):_;return new l2({type:"enum",entries:A,...X0.normalizeParams(z)})}var OI=E("ZodLiteral",(_,z)=>{pH.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,b,G)=>nB(_,A,b,G),_.values=new Set(z.values),Object.defineProperty(_,"value",{get(){if(z.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return z.values[0]}})});function f(_,z){return new OI({type:"literal",values:Array.isArray(_)?_:[_],...X0.normalizeParams(z)})}var LI=E("ZodTransform",(_,z)=>{dH.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,b,G)=>oB(_,A,b,G),_._zod.parse=(A,b)=>{if(b.direction==="backward")throw new vz(_.constructor.name);A.addIssue=(J)=>{if(typeof J==="string")A.issues.push(X0.issue(J,A.value,z));else{let Y=J;if(Y.fatal)Y.continue=!1;Y.code??(Y.code="custom"),Y.input??(Y.input=A.value),Y.inst??(Y.inst=_),A.issues.push(X0.issue(Y))}};let G=z.transform(A.value,A);if(G instanceof Promise)return G.then((J)=>{return A.value=J,A});return A.value=G,A}});function TZ(_){return new LI({type:"transform",transform:_})}var CZ=E("ZodOptional",(_,z)=>{N2.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,b,G)=>f2(_,A,b,G),_.unwrap=()=>_._zod.def.innerType});function k0(_){return new CZ({type:"optional",innerType:_})}var jI=E("ZodExactOptional",(_,z)=>{rH.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,b,G)=>f2(_,A,b,G),_.unwrap=()=>_._zod.def.innerType});function RI(_){return new jI({type:"optional",innerType:_})}var PI=E("ZodNullable",(_,z)=>{nH.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,b,G)=>zZ(_,A,b,G),_.unwrap=()=>_._zod.def.innerType});function PZ(_){return new PI({type:"nullable",innerType:_})}var SI=E("ZodDefault",(_,z)=>{iH.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,b,G)=>bZ(_,A,b,G),_.unwrap=()=>_._zod.def.innerType,_.removeDefault=_.unwrap});function kI(_,z){return new SI({type:"default",innerType:_,get defaultValue(){return typeof z==="function"?z():X0.shallowClone(z)}})}var II=E("ZodPrefault",(_,z)=>{oH.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,b,G)=>GZ(_,A,b,G),_.unwrap=()=>_._zod.def.innerType});function xI(_,z){return new II({type:"prefault",innerType:_,get defaultValue(){return typeof z==="function"?z():X0.shallowClone(z)}})}var vZ=E("ZodNonOptional",(_,z)=>{aH.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,b,G)=>AZ(_,A,b,G),_.unwrap=()=>_._zod.def.innerType});function TI(_,z){return new vZ({type:"nonoptional",innerType:_,...X0.normalizeParams(z)})}var CI=E("ZodCatch",(_,z)=>{sH.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,b,G)=>JZ(_,A,b,G),_.unwrap=()=>_._zod.def.innerType,_.removeCatch=_.unwrap});function vI(_,z){return new CI({type:"catch",innerType:_,catchValue:typeof z==="function"?z:()=>z})}var yI=E("ZodPipe",(_,z)=>{tH.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,b,G)=>YZ(_,A,b,G),_.in=z.in,_.out=z.out});function p2(_,z){return new yI({type:"pipe",in:_,out:z})}var gI=E("ZodReadonly",(_,z)=>{eH.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,b,G)=>XZ(_,A,b,G),_.unwrap=()=>_._zod.def.innerType});function fI(_){return new gI({type:"readonly",innerType:_})}var yZ=E("ZodCustom",(_,z)=>{_B.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,b,G)=>iB(_,A,b,G)});function gZ(_,z){return yB(yZ,_??(()=>!0),z)}function hI(_,z={}){return gB(yZ,_,z)}function mI(_){return fB(_)}function n2(_,z){return p2(TZ(_),z)}O9(w2());var i2="2025-11-25";var fZ=[i2,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],G_="io.modelcontextprotocol/related-task",GA="2.0",h0=gZ((_)=>_!==null&&(typeof _==="object"||typeof _==="function")),hZ=U0([N(),q0().int()]),mZ=N(),N40=A9({ttl:U0([q0(),d2()]).optional(),pollInterval:q0().optional()}),uI=C({ttl:q0().optional()}),cI=C({taskId:N()}),o2=A9({progressToken:hZ.optional(),[G_]:cI.optional()}),U9=C({_meta:o2.optional()}),az=U9.extend({task:uI.optional()}),uZ=(_)=>az.safeParse(_).success,m0=C({method:N(),params:U9.loose().optional()}),L9=C({_meta:o2.optional()}),j9=C({method:N(),params:L9.loose().optional()}),u0=A9({_meta:o2.optional()}),JA=U0([N(),q0().int()]),cZ=C({jsonrpc:f(GA),id:JA,...m0.shape}).strict(),a2=(_)=>cZ.safeParse(_).success,lZ=C({jsonrpc:f(GA),...j9.shape}).strict(),pZ=(_)=>lZ.safeParse(_).success,s2=C({jsonrpc:f(GA),id:JA,result:u0}).strict(),sz=(_)=>s2.safeParse(_).success;var b0;(function(_){_[_.ConnectionClosed=-32000]="ConnectionClosed",_[_.RequestTimeout=-32001]="RequestTimeout",_[_.ParseError=-32700]="ParseError",_[_.InvalidRequest=-32600]="InvalidRequest",_[_.MethodNotFound=-32601]="MethodNotFound",_[_.InvalidParams=-32602]="InvalidParams",_[_.InternalError=-32603]="InternalError",_[_.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(b0||(b0={}));var t2=C({jsonrpc:f(GA),id:JA.optional(),error:C({code:q0().int(),message:N(),data:j0().optional()})}).strict();var dZ=(_)=>t2.safeParse(_).success;var rZ=U0([cZ,lZ,s2,t2]),w40=U0([s2,t2]),YA=u0.strict(),lI=L9.extend({requestId:JA.optional(),reason:N().optional()}),XA=j9.extend({method:f("notifications/cancelled"),params:lI}),pI=C({src:N(),mimeType:N().optional(),sizes:A0(N()).optional(),theme:$9(["light","dark"]).optional()}),tz=C({icons:A0(pI).optional()}),v1=C({name:N(),title:N().optional()}),nZ=v1.extend({...v1.shape,...tz.shape,version:N(),websiteUrl:N().optional(),description:N().optional()}),dI=AA(C({applyDefaults:y0().optional()}),P0(N(),j0())),rI=n2((_)=>{if(_&&typeof _==="object"&&!Array.isArray(_)){if(Object.keys(_).length===0)return{form:{}}}return _},AA(C({form:dI.optional(),url:h0.optional()}),P0(N(),j0()).optional())),nI=A9({list:h0.optional(),cancel:h0.optional(),requests:A9({sampling:A9({createMessage:h0.optional()}).optional(),elicitation:A9({create:h0.optional()}).optional()}).optional()}),iI=A9({list:h0.optional(),cancel:h0.optional(),requests:A9({tools:A9({call:h0.optional()}).optional()}).optional()}),oI=C({experimental:P0(N(),h0).optional(),sampling:C({context:h0.optional(),tools:h0.optional()}).optional(),elicitation:rI.optional(),roots:C({listChanged:y0().optional()}).optional(),tasks:nI.optional()}),aI=U9.extend({protocolVersion:N(),capabilities:oI,clientInfo:nZ}),e2=m0.extend({method:f("initialize"),params:aI});var sI=C({experimental:P0(N(),h0).optional(),logging:h0.optional(),completions:h0.optional(),prompts:C({listChanged:y0().optional()}).optional(),resources:C({subscribe:y0().optional(),listChanged:y0().optional()}).optional(),tools:C({listChanged:y0().optional()}).optional(),tasks:iI.optional()}),tI=u0.extend({protocolVersion:N(),capabilities:sI,serverInfo:nZ,instructions:N().optional()}),_7=j9.extend({method:f("notifications/initialized"),params:L9.optional()});var QA=m0.extend({method:f("ping"),params:U9.optional()}),eI=C({progress:q0(),total:k0(q0()),message:k0(N())}),_x=C({...L9.shape,...eI.shape,progressToken:hZ}),$A=j9.extend({method:f("notifications/progress"),params:_x}),zx=U9.extend({cursor:mZ.optional()}),ez=m0.extend({params:zx.optional()}),_3=u0.extend({nextCursor:mZ.optional()}),Ax=$9(["working","input_required","completed","failed","cancelled"]),z3=C({taskId:N(),status:Ax,ttl:U0([q0(),d2()]),createdAt:N(),lastUpdatedAt:N(),pollInterval:k0(q0()),statusMessage:k0(N())}),y1=u0.extend({task:z3}),bx=L9.merge(z3),A3=j9.extend({method:f("notifications/tasks/status"),params:bx}),HA=m0.extend({method:f("tasks/get"),params:U9.extend({taskId:N()})}),BA=u0.merge(z3),ZA=m0.extend({method:f("tasks/result"),params:U9.extend({taskId:N()})}),E40=u0.loose(),FA=ez.extend({method:f("tasks/list")}),KA=_3.extend({tasks:A0(z3)}),qA=m0.extend({method:f("tasks/cancel"),params:U9.extend({taskId:N()})}),iZ=u0.merge(z3),oZ=C({uri:N(),mimeType:k0(N()),_meta:P0(N(),j0()).optional()}),aZ=oZ.extend({text:N()}),z7=N().refine((_)=>{try{return atob(_),!0}catch{return!1}},{message:"Invalid Base64 string"}),sZ=oZ.extend({blob:z7}),b3=$9(["user","assistant"]),g1=C({audience:A0(b3).optional(),priority:q0().min(0).max(1).optional(),lastModified:oz.datetime({offset:!0}).optional()}),tZ=C({...v1.shape,...tz.shape,uri:N(),description:k0(N()),mimeType:k0(N()),annotations:g1.optional(),_meta:k0(A9({}))}),Gx=C({...v1.shape,...tz.shape,uriTemplate:N(),description:k0(N()),mimeType:k0(N()),annotations:g1.optional(),_meta:k0(A9({}))}),Jx=ez.extend({method:f("resources/list")}),Yx=_3.extend({resources:A0(tZ)}),Xx=ez.extend({method:f("resources/templates/list")}),Qx=_3.extend({resourceTemplates:A0(Gx)}),A7=U9.extend({uri:N()}),$x=A7,Hx=m0.extend({method:f("resources/read"),params:$x}),Bx=u0.extend({contents:A0(U0([aZ,sZ]))}),Zx=j9.extend({method:f("notifications/resources/list_changed"),params:L9.optional()}),Fx=A7,Kx=m0.extend({method:f("resources/subscribe"),params:Fx}),qx=A7,Wx=m0.extend({method:f("resources/unsubscribe"),params:qx}),Vx=L9.extend({uri:N()}),Ux=j9.extend({method:f("notifications/resources/updated"),params:Vx}),Dx=C({name:N(),description:k0(N()),required:k0(y0())}),Mx=C({...v1.shape,...tz.shape,description:k0(N()),arguments:k0(A0(Dx)),_meta:k0(A9({}))}),b7=ez.extend({method:f("prompts/list")}),Nx=_3.extend({prompts:A0(Mx)}),wx=U9.extend({name:N(),arguments:P0(N(),N()).optional()}),Ex=m0.extend({method:f("prompts/get"),params:wx}),G7=C({type:f("text"),text:N(),annotations:g1.optional(),_meta:P0(N(),j0()).optional()}),J7=C({type:f("image"),data:z7,mimeType:N(),annotations:g1.optional(),_meta:P0(N(),j0()).optional()}),Y7=C({type:f("audio"),data:z7,mimeType:N(),annotations:g1.optional(),_meta:P0(N(),j0()).optional()}),Ox=C({type:f("tool_use"),name:N(),id:N(),input:P0(N(),j0()),_meta:P0(N(),j0()).optional()}),Lx=C({type:f("resource"),resource:U0([aZ,sZ]),annotations:g1.optional(),_meta:P0(N(),j0()).optional()}),jx=tZ.extend({type:f("resource_link")}),X7=U0([G7,J7,Y7,jx,Lx]),Rx=C({role:b3,content:X7}),Px=u0.extend({description:N().optional(),messages:A0(Rx)}),Sx=j9.extend({method:f("notifications/prompts/list_changed"),params:L9.optional()}),kx=C({title:N().optional(),readOnlyHint:y0().optional(),destructiveHint:y0().optional(),idempotentHint:y0().optional(),openWorldHint:y0().optional()}),Ix=C({taskSupport:$9(["required","optional","forbidden"]).optional()}),eZ=C({...v1.shape,...tz.shape,description:N().optional(),inputSchema:C({type:f("object"),properties:P0(N(),h0).optional(),required:A0(N()).optional()}).catchall(j0()),outputSchema:C({type:f("object"),properties:P0(N(),h0).optional(),required:A0(N()).optional()}).catchall(j0()).optional(),annotations:kx.optional(),execution:Ix.optional(),_meta:P0(N(),j0()).optional()}),Q7=ez.extend({method:f("tools/list")}),xx=_3.extend({tools:A0(eZ)}),WA=u0.extend({content:A0(X7).default([]),structuredContent:P0(N(),j0()).optional(),isError:y0().optional()}),O40=WA.or(u0.extend({toolResult:j0()})),Tx=az.extend({name:N(),arguments:P0(N(),j0()).optional()}),$7=m0.extend({method:f("tools/call"),params:Tx}),Cx=j9.extend({method:f("notifications/tools/list_changed"),params:L9.optional()}),L40=C({autoRefresh:y0().default(!0),debounceMs:q0().int().nonnegative().default(300)}),G3=$9(["debug","info","notice","warning","error","critical","alert","emergency"]),vx=U9.extend({level:G3}),H7=m0.extend({method:f("logging/setLevel"),params:vx}),yx=L9.extend({level:G3,logger:N().optional(),data:j0()}),gx=j9.extend({method:f("notifications/message"),params:yx}),fx=C({name:N().optional()}),hx=C({hints:A0(fx).optional(),costPriority:q0().min(0).max(1).optional(),speedPriority:q0().min(0).max(1).optional(),intelligencePriority:q0().min(0).max(1).optional()}),mx=C({mode:$9(["auto","required","none"]).optional()}),ux=C({type:f("tool_result"),toolUseId:N().describe("The unique identifier for the corresponding tool call."),content:A0(X7).default([]),structuredContent:C({}).loose().optional(),isError:y0().optional(),_meta:P0(N(),j0()).optional()}),cx=r2("type",[G7,J7,Y7]),bA=r2("type",[G7,J7,Y7,Ox,ux]),lx=C({role:b3,content:U0([bA,A0(bA)]),_meta:P0(N(),j0()).optional()}),px=az.extend({messages:A0(lx),modelPreferences:hx.optional(),systemPrompt:N().optional(),includeContext:$9(["none","thisServer","allServers"]).optional(),temperature:q0().optional(),maxTokens:q0().int(),stopSequences:A0(N()).optional(),metadata:h0.optional(),tools:A0(eZ).optional(),toolChoice:mx.optional()}),dx=m0.extend({method:f("sampling/createMessage"),params:px}),B7=u0.extend({model:N(),stopReason:k0($9(["endTurn","stopSequence","maxTokens"]).or(N())),role:b3,content:cx}),Z7=u0.extend({model:N(),stopReason:k0($9(["endTurn","stopSequence","maxTokens","toolUse"]).or(N())),role:b3,content:U0([bA,A0(bA)])}),rx=C({type:f("boolean"),title:N().optional(),description:N().optional(),default:y0().optional()}),nx=C({type:f("string"),title:N().optional(),description:N().optional(),minLength:q0().optional(),maxLength:q0().optional(),format:$9(["email","uri","date","date-time"]).optional(),default:N().optional()}),ix=C({type:$9(["number","integer"]),title:N().optional(),description:N().optional(),minimum:q0().optional(),maximum:q0().optional(),default:q0().optional()}),ox=C({type:f("string"),title:N().optional(),description:N().optional(),enum:A0(N()),default:N().optional()}),ax=C({type:f("string"),title:N().optional(),description:N().optional(),oneOf:A0(C({const:N(),title:N()})),default:N().optional()}),sx=C({type:f("string"),title:N().optional(),description:N().optional(),enum:A0(N()),enumNames:A0(N()).optional(),default:N().optional()}),tx=U0([ox,ax]),ex=C({type:f("array"),title:N().optional(),description:N().optional(),minItems:q0().optional(),maxItems:q0().optional(),items:C({type:f("string"),enum:A0(N())}),default:A0(N()).optional()}),_T=C({type:f("array"),title:N().optional(),description:N().optional(),minItems:q0().optional(),maxItems:q0().optional(),items:C({anyOf:A0(C({const:N(),title:N()}))}),default:A0(N()).optional()}),zT=U0([ex,_T]),AT=U0([sx,tx,zT]),bT=U0([AT,rx,nx,ix]),GT=az.extend({mode:f("form").optional(),message:N(),requestedSchema:C({type:f("object"),properties:P0(N(),bT),required:A0(N()).optional()})}),JT=az.extend({mode:f("url"),message:N(),elicitationId:N(),url:N().url()}),YT=U0([GT,JT]),XT=m0.extend({method:f("elicitation/create"),params:YT}),QT=L9.extend({elicitationId:N()}),$T=j9.extend({method:f("notifications/elicitation/complete"),params:QT}),VA=u0.extend({action:$9(["accept","decline","cancel"]),content:n2((_)=>_===null?void 0:_,P0(N(),U0([N(),q0(),y0(),A0(N())])).optional())}),HT=C({type:f("ref/resource"),uri:N()});var BT=C({type:f("ref/prompt"),name:N()}),ZT=U9.extend({ref:U0([BT,HT]),argument:C({name:N(),value:N()}),context:C({arguments:P0(N(),N()).optional()}).optional()}),FT=m0.extend({method:f("completion/complete"),params:ZT});var KT=u0.extend({completion:A9({values:A0(N()).max(100),total:k0(q0().int()),hasMore:k0(y0())})}),qT=C({uri:N().startsWith("file://"),name:N().optional(),_meta:P0(N(),j0()).optional()}),WT=m0.extend({method:f("roots/list"),params:U9.optional()}),F7=u0.extend({roots:A0(qT)}),VT=j9.extend({method:f("notifications/roots/list_changed"),params:L9.optional()}),j40=U0([QA,e2,FT,H7,Ex,b7,Jx,Xx,Hx,Kx,Wx,$7,Q7,HA,ZA,FA,qA]),R40=U0([XA,$A,_7,VT,A3]),P40=U0([YA,B7,Z7,VA,F7,BA,KA,y1]),S40=U0([QA,dx,XT,WT,HA,ZA,FA,qA]),k40=U0([XA,$A,gx,Ux,Zx,Cx,Sx,A3,$T]),I40=U0([YA,tI,KT,Px,Nx,Yx,Qx,Bx,WA,xx,BA,KA,y1]);class s extends Error{constructor(_,z,A){super(`MCP error ${_}: ${z}`);this.code=_,this.data=A,this.name="McpError"}static fromError(_,z,A){if(_===b0.UrlElicitationRequired&&A){let b=A;if(b.elicitations)return new _F(b.elicitations,z)}return new s(_,z,A)}}class _F extends s{constructor(_,z=`URL elicitation${_.length>1?"s":""} required`){super(b0.UrlElicitationRequired,z,{elicitations:_})}get elicitations(){return this.data?.elicitations??[]}}function J_(_){return _==="completed"||_==="failed"||_==="cancelled"}var UT=Symbol("Let zodToJsonSchema decide on which parser to use");var H_0=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function K7(_){let A=_A(_)?.method;if(!A)throw Error("Schema is missing a method literal");let b=QZ(A);if(typeof b!=="string")throw Error("Schema method literal must be a string");return b}function q7(_,z){let A=b_(_,z);if(!A.success)throw A.error;return A.data}var OT=60000;class W7{constructor(_){if(this._options=_,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(XA,(z)=>{this._oncancel(z)}),this.setNotificationHandler($A,(z)=>{this._onprogress(z)}),this.setRequestHandler(QA,(z)=>({})),this._taskStore=_?.taskStore,this._taskMessageQueue=_?.taskMessageQueue,this._taskStore)this.setRequestHandler(HA,async(z,A)=>{let b=await this._taskStore.getTask(z.params.taskId,A.sessionId);if(!b)throw new s(b0.InvalidParams,"Failed to retrieve task: Task not found");return{...b}}),this.setRequestHandler(ZA,async(z,A)=>{let b=async()=>{let G=z.params.taskId;if(this._taskMessageQueue){let Y;while(Y=await this._taskMessageQueue.dequeue(G,A.sessionId)){if(Y.type==="response"||Y.type==="error"){let X=Y.message,Q=X.id,$=this._requestResolvers.get(Q);if($)if(this._requestResolvers.delete(Q),Y.type==="response")$(X);else{let H=X,B=new s(H.error.code,H.error.message,H.error.data);$(B)}else{let H=Y.type==="response"?"Response":"Error";this._onerror(Error(`${H} handler missing for request ${Q}`))}continue}await this._transport?.send(Y.message,{relatedRequestId:A.requestId})}}let J=await this._taskStore.getTask(G,A.sessionId);if(!J)throw new s(b0.InvalidParams,`Task not found: ${G}`);if(!J_(J.status))return await this._waitForTaskUpdate(G,A.signal),await b();if(J_(J.status)){let Y=await this._taskStore.getTaskResult(G,A.sessionId);return this._clearTaskQueue(G),{...Y,_meta:{...Y._meta,[G_]:{taskId:G}}}}return await b()};return await b()}),this.setRequestHandler(FA,async(z,A)=>{try{let{tasks:b,nextCursor:G}=await this._taskStore.listTasks(z.params?.cursor,A.sessionId);return{tasks:b,nextCursor:G,_meta:{}}}catch(b){throw new s(b0.InvalidParams,`Failed to list tasks: ${b instanceof Error?b.message:String(b)}`)}}),this.setRequestHandler(qA,async(z,A)=>{try{let b=await this._taskStore.getTask(z.params.taskId,A.sessionId);if(!b)throw new s(b0.InvalidParams,`Task not found: ${z.params.taskId}`);if(J_(b.status))throw new s(b0.InvalidParams,`Cannot cancel task in terminal status: ${b.status}`);await this._taskStore.updateTaskStatus(z.params.taskId,"cancelled","Client cancelled task execution.",A.sessionId),this._clearTaskQueue(z.params.taskId);let G=await this._taskStore.getTask(z.params.taskId,A.sessionId);if(!G)throw new s(b0.InvalidParams,`Task not found after cancellation: ${z.params.taskId}`);return{_meta:{},...G}}catch(b){if(b instanceof s)throw b;throw new s(b0.InvalidRequest,`Failed to cancel task: ${b instanceof Error?b.message:String(b)}`)}})}async _oncancel(_){if(!_.params.requestId)return;this._requestHandlerAbortControllers.get(_.params.requestId)?.abort(_.params.reason)}_setupTimeout(_,z,A,b,G=!1){this._timeoutInfo.set(_,{timeoutId:setTimeout(b,z),startTime:Date.now(),timeout:z,maxTotalTimeout:A,resetTimeoutOnProgress:G,onTimeout:b})}_resetTimeout(_){let z=this._timeoutInfo.get(_);if(!z)return!1;let A=Date.now()-z.startTime;if(z.maxTotalTimeout&&A>=z.maxTotalTimeout)throw this._timeoutInfo.delete(_),s.fromError(b0.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:z.maxTotalTimeout,totalElapsed:A});return clearTimeout(z.timeoutId),z.timeoutId=setTimeout(z.onTimeout,z.timeout),!0}_cleanupTimeout(_){let z=this._timeoutInfo.get(_);if(z)clearTimeout(z.timeoutId),this._timeoutInfo.delete(_)}async connect(_){this._transport=_;let z=this.transport?.onclose;this._transport.onclose=()=>{z?.(),this._onclose()};let A=this.transport?.onerror;this._transport.onerror=(G)=>{A?.(G),this._onerror(G)};let b=this._transport?.onmessage;this._transport.onmessage=(G,J)=>{if(b?.(G,J),sz(G)||dZ(G))this._onresponse(G);else if(a2(G))this._onrequest(G,J);else if(pZ(G))this._onnotification(G);else this._onerror(Error(`Unknown message type: ${JSON.stringify(G)}`))},await this._transport.start()}_onclose(){let _=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();let z=s.fromError(b0.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let A of _.values())A(z)}_onerror(_){this.onerror?.(_)}_onnotification(_){let z=this._notificationHandlers.get(_.method)??this.fallbackNotificationHandler;if(z===void 0)return;Promise.resolve().then(()=>z(_)).catch((A)=>this._onerror(Error(`Uncaught error in notification handler: ${A}`)))}_onrequest(_,z){let A=this._requestHandlers.get(_.method)??this.fallbackRequestHandler,b=this._transport,G=_.params?._meta?.[G_]?.taskId;if(A===void 0){let $={jsonrpc:"2.0",id:_.id,error:{code:b0.MethodNotFound,message:"Method not found"}};if(G&&this._taskMessageQueue)this._enqueueTaskMessage(G,{type:"error",message:$,timestamp:Date.now()},b?.sessionId).catch((H)=>this._onerror(Error(`Failed to enqueue error response: ${H}`)));else b?.send($).catch((H)=>this._onerror(Error(`Failed to send an error response: ${H}`)));return}let J=new AbortController;this._requestHandlerAbortControllers.set(_.id,J);let Y=uZ(_.params)?_.params.task:void 0,X=this._taskStore?this.requestTaskStore(_,b?.sessionId):void 0,Q={signal:J.signal,sessionId:b?.sessionId,_meta:_.params?._meta,sendNotification:async($)=>{let H={relatedRequestId:_.id};if(G)H.relatedTask={taskId:G};await this.notification($,H)},sendRequest:async($,H,B)=>{let Z={...B,relatedRequestId:_.id};if(G&&!Z.relatedTask)Z.relatedTask={taskId:G};let F=Z.relatedTask?.taskId??G;if(F&&X)await X.updateTaskStatus(F,"input_required");return await this.request($,H,Z)},authInfo:z?.authInfo,requestId:_.id,requestInfo:z?.requestInfo,taskId:G,taskStore:X,taskRequestedTtl:Y?.ttl,closeSSEStream:z?.closeSSEStream,closeStandaloneSSEStream:z?.closeStandaloneSSEStream};Promise.resolve().then(()=>{if(Y)this.assertTaskHandlerCapability(_.method)}).then(()=>A(_,Q)).then(async($)=>{if(J.signal.aborted)return;let H={result:$,jsonrpc:"2.0",id:_.id};if(G&&this._taskMessageQueue)await this._enqueueTaskMessage(G,{type:"response",message:H,timestamp:Date.now()},b?.sessionId);else await b?.send(H)},async($)=>{if(J.signal.aborted)return;let H={jsonrpc:"2.0",id:_.id,error:{code:Number.isSafeInteger($.code)?$.code:b0.InternalError,message:$.message??"Internal error",...$.data!==void 0&&{data:$.data}}};if(G&&this._taskMessageQueue)await this._enqueueTaskMessage(G,{type:"error",message:H,timestamp:Date.now()},b?.sessionId);else await b?.send(H)}).catch(($)=>this._onerror(Error(`Failed to send response: ${$}`))).finally(()=>{this._requestHandlerAbortControllers.delete(_.id)})}_onprogress(_){let{progressToken:z,...A}=_.params,b=Number(z),G=this._progressHandlers.get(b);if(!G){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(_)}`));return}let J=this._responseHandlers.get(b),Y=this._timeoutInfo.get(b);if(Y&&J&&Y.resetTimeoutOnProgress)try{this._resetTimeout(b)}catch(X){this._responseHandlers.delete(b),this._progressHandlers.delete(b),this._cleanupTimeout(b),J(X);return}G(A)}_onresponse(_){let z=Number(_.id),A=this._requestResolvers.get(z);if(A){if(this._requestResolvers.delete(z),sz(_))A(_);else{let J=new s(_.error.code,_.error.message,_.error.data);A(J)}return}let b=this._responseHandlers.get(z);if(b===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(_)}`));return}this._responseHandlers.delete(z),this._cleanupTimeout(z);let G=!1;if(sz(_)&&_.result&&typeof _.result==="object"){let J=_.result;if(J.task&&typeof J.task==="object"){let Y=J.task;if(typeof Y.taskId==="string")G=!0,this._taskProgressTokens.set(Y.taskId,z)}}if(!G)this._progressHandlers.delete(z);if(sz(_))b(_);else{let J=s.fromError(_.error.code,_.error.message,_.error.data);b(J)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(_,z,A){let{task:b}=A??{};if(!b){try{yield{type:"result",result:await this.request(_,z,A)}}catch(J){yield{type:"error",error:J instanceof s?J:new s(b0.InternalError,String(J))}}return}let G;try{let J=await this.request(_,y1,A);if(J.task)G=J.task.taskId,yield{type:"taskCreated",task:J.task};else throw new s(b0.InternalError,"Task creation did not return a task");while(!0){let Y=await this.getTask({taskId:G},A);if(yield{type:"taskStatus",task:Y},J_(Y.status)){if(Y.status==="completed")yield{type:"result",result:await this.getTaskResult({taskId:G},z,A)};else if(Y.status==="failed")yield{type:"error",error:new s(b0.InternalError,`Task ${G} failed`)};else if(Y.status==="cancelled")yield{type:"error",error:new s(b0.InternalError,`Task ${G} was cancelled`)};return}if(Y.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:G},z,A)};return}let X=Y.pollInterval??this._options?.defaultTaskPollInterval??1000;await new Promise((Q)=>setTimeout(Q,X)),A?.signal?.throwIfAborted()}}catch(J){yield{type:"error",error:J instanceof s?J:new s(b0.InternalError,String(J))}}}request(_,z,A){let{relatedRequestId:b,resumptionToken:G,onresumptiontoken:J,task:Y,relatedTask:X}=A??{};return new Promise((Q,$)=>{let H=(V)=>{$(V)};if(!this._transport){H(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{if(this.assertCapabilityForMethod(_.method),Y)this.assertTaskCapability(_.method)}catch(V){H(V);return}A?.signal?.throwIfAborted();let B=this._requestMessageId++,Z={..._,jsonrpc:"2.0",id:B};if(A?.onprogress)this._progressHandlers.set(B,A.onprogress),Z.params={..._.params,_meta:{..._.params?._meta||{},progressToken:B}};if(Y)Z.params={...Z.params,task:Y};if(X)Z.params={...Z.params,_meta:{...Z.params?._meta||{},[G_]:X}};let F=(V)=>{this._responseHandlers.delete(B),this._progressHandlers.delete(B),this._cleanupTimeout(B),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:B,reason:String(V)}},{relatedRequestId:b,resumptionToken:G,onresumptiontoken:J}).catch((O)=>this._onerror(Error(`Failed to send cancellation: ${O}`)));let w=V instanceof s?V:new s(b0.RequestTimeout,String(V));$(w)};this._responseHandlers.set(B,(V)=>{if(A?.signal?.aborted)return;if(V instanceof Error)return $(V);try{let w=b_(z,V.result);if(!w.success)$(w.error);else Q(w.data)}catch(w){$(w)}}),A?.signal?.addEventListener("abort",()=>{F(A?.signal?.reason)});let K=A?.timeout??OT,q=()=>F(s.fromError(b0.RequestTimeout,"Request timed out",{timeout:K}));this._setupTimeout(B,K,A?.maxTotalTimeout,q,A?.resetTimeoutOnProgress??!1);let W=X?.taskId;if(W){let V=(w)=>{let O=this._responseHandlers.get(B);if(O)O(w);else this._onerror(Error(`Response handler missing for side-channeled request ${B}`))};this._requestResolvers.set(B,V),this._enqueueTaskMessage(W,{type:"request",message:Z,timestamp:Date.now()}).catch((w)=>{this._cleanupTimeout(B),$(w)})}else this._transport.send(Z,{relatedRequestId:b,resumptionToken:G,onresumptiontoken:J}).catch((V)=>{this._cleanupTimeout(B),$(V)})})}async getTask(_,z){return this.request({method:"tasks/get",params:_},BA,z)}async getTaskResult(_,z,A){return this.request({method:"tasks/result",params:_},z,A)}async listTasks(_,z){return this.request({method:"tasks/list",params:_},KA,z)}async cancelTask(_,z){return this.request({method:"tasks/cancel",params:_},iZ,z)}async notification(_,z){if(!this._transport)throw Error("Not connected");this.assertNotificationCapability(_.method);let A=z?.relatedTask?.taskId;if(A){let Y={..._,jsonrpc:"2.0",params:{..._.params,_meta:{..._.params?._meta||{},[G_]:z.relatedTask}}};await this._enqueueTaskMessage(A,{type:"notification",message:Y,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(_.method)&&!_.params&&!z?.relatedRequestId&&!z?.relatedTask){if(this._pendingDebouncedNotifications.has(_.method))return;this._pendingDebouncedNotifications.add(_.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(_.method),!this._transport)return;let Y={..._,jsonrpc:"2.0"};if(z?.relatedTask)Y={...Y,params:{...Y.params,_meta:{...Y.params?._meta||{},[G_]:z.relatedTask}}};this._transport?.send(Y,z).catch((X)=>this._onerror(X))});return}let J={..._,jsonrpc:"2.0"};if(z?.relatedTask)J={...J,params:{...J.params,_meta:{...J.params?._meta||{},[G_]:z.relatedTask}}};await this._transport.send(J,z)}setRequestHandler(_,z){let A=K7(_);this.assertRequestHandlerCapability(A),this._requestHandlers.set(A,(b,G)=>{let J=q7(_,b);return Promise.resolve(z(J,G))})}removeRequestHandler(_){this._requestHandlers.delete(_)}assertCanSetRequestHandler(_){if(this._requestHandlers.has(_))throw Error(`A request handler for ${_} already exists, which would be overridden`)}setNotificationHandler(_,z){let A=K7(_);this._notificationHandlers.set(A,(b)=>{let G=q7(_,b);return Promise.resolve(z(G))})}removeNotificationHandler(_){this._notificationHandlers.delete(_)}_cleanupTaskProgressHandler(_){let z=this._taskProgressTokens.get(_);if(z!==void 0)this._progressHandlers.delete(z),this._taskProgressTokens.delete(_)}async _enqueueTaskMessage(_,z,A){if(!this._taskStore||!this._taskMessageQueue)throw Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let b=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(_,z,A,b)}async _clearTaskQueue(_,z){if(this._taskMessageQueue){let A=await this._taskMessageQueue.dequeueAll(_,z);for(let b of A)if(b.type==="request"&&a2(b.message)){let G=b.message.id,J=this._requestResolvers.get(G);if(J)J(new s(b0.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(G);else this._onerror(Error(`Resolver missing for request ${G} during task ${_} cleanup`))}}}async _waitForTaskUpdate(_,z){let A=this._options?.defaultTaskPollInterval??1000;try{let b=await this._taskStore?.getTask(_);if(b?.pollInterval)A=b.pollInterval}catch{}return new Promise((b,G)=>{if(z.aborted){G(new s(b0.InvalidRequest,"Request cancelled"));return}let J=setTimeout(b,A);z.addEventListener("abort",()=>{clearTimeout(J),G(new s(b0.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(_,z){let A=this._taskStore;if(!A)throw Error("No task store configured");return{createTask:async(b)=>{if(!_)throw Error("No request provided");return await A.createTask(b,_.id,{method:_.method,params:_.params},z)},getTask:async(b)=>{let G=await A.getTask(b,z);if(!G)throw new s(b0.InvalidParams,"Failed to retrieve task: Task not found");return G},storeTaskResult:async(b,G,J)=>{await A.storeTaskResult(b,G,J,z);let Y=await A.getTask(b,z);if(Y){let X=A3.parse({method:"notifications/tasks/status",params:Y});if(await this.notification(X),J_(Y.status))this._cleanupTaskProgressHandler(b)}},getTaskResult:(b)=>{return A.getTaskResult(b,z)},updateTaskStatus:async(b,G,J)=>{let Y=await A.getTask(b,z);if(!Y)throw new s(b0.InvalidParams,`Task "${b}" not found - it may have been cleaned up`);if(J_(Y.status))throw new s(b0.InvalidParams,`Cannot update task "${b}" from terminal status "${Y.status}" to "${G}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await A.updateTaskStatus(b,G,J,z);let X=await A.getTask(b,z);if(X){let Q=A3.parse({method:"notifications/tasks/status",params:X});if(await this.notification(Q),J_(X.status))this._cleanupTaskProgressHandler(b)}},listTasks:(b)=>{return A.listTasks(b,z)}}}}function zF(_){return _!==null&&typeof _==="object"&&!Array.isArray(_)}function AF(_,z){let A={..._};for(let b in z){let G=b,J=z[G];if(J===void 0)continue;let Y=A[G];if(zF(Y)&&zF(J))A[G]={...Y,...J};else A[G]=J}return A}var TV=G8(Hb(),1),CV=G8(xV(),1);function Cu(){let _=new TV.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return CV.default(_),_}class Mb{constructor(_){this._ajv=_??Cu()}getValidator(_){let z="$id"in _&&typeof _.$id==="string"?this._ajv.getSchema(_.$id)??this._ajv.compile(_):this._ajv.compile(_);return(A)=>{if(z(A))return{valid:!0,data:A,errorMessage:void 0};else return{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(z.errors)}}}}class Nb{constructor(_){this._server=_}requestStream(_,z,A){return this._server.requestStream(_,z,A)}async getTask(_,z){return this._server.getTask({taskId:_},z)}async getTaskResult(_,z,A){return this._server.getTaskResult({taskId:_},z,A)}async listTasks(_,z){return this._server.listTasks(_?{cursor:_}:void 0,z)}async cancelTask(_,z){return this._server.cancelTask({taskId:_},z)}}function vV(_,z,A){if(!_)throw Error(`${A} does not support task creation (required for ${z})`);switch(z){case"tools/call":if(!_.tools?.call)throw Error(`${A} does not support task creation for tools/call (required for ${z})`);break;default:break}}function yV(_,z,A){if(!_)throw Error(`${A} does not support task creation (required for ${z})`);switch(z){case"sampling/createMessage":if(!_.sampling?.createMessage)throw Error(`${A} does not support task creation for sampling/createMessage (required for ${z})`);break;case"elicitation/create":if(!_.elicitation?.create)throw Error(`${A} does not support task creation for elicitation/create (required for ${z})`);break;default:break}}class wb extends W7{constructor(_,z){super(z);if(this._serverInfo=_,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(G3.options.map((A,b)=>[A,b])),this.isMessageIgnored=(A,b)=>{let G=this._loggingLevels.get(b);return G?this.LOG_LEVEL_SEVERITY.get(A)<this.LOG_LEVEL_SEVERITY.get(G):!1},this._capabilities=z?.capabilities??{},this._instructions=z?.instructions,this._jsonSchemaValidator=z?.jsonSchemaValidator??new Mb,this.setRequestHandler(e2,(A)=>this._oninitialize(A)),this.setNotificationHandler(_7,()=>this.oninitialized?.()),this._capabilities.logging)this.setRequestHandler(H7,async(A,b)=>{let G=b.sessionId||b.requestInfo?.headers["mcp-session-id"]||void 0,{level:J}=A.params,Y=G3.safeParse(J);if(Y.success)this._loggingLevels.set(G,Y.data);return{}})}get experimental(){if(!this._experimental)this._experimental={tasks:new Nb(this)};return this._experimental}registerCapabilities(_){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=AF(this._capabilities,_)}setRequestHandler(_,z){let b=_A(_)?.method;if(!b)throw Error("Schema is missing a method literal");let G;if(C1(b)){let Y=b;G=Y._zod?.def?.value??Y.value}else{let Y=b;G=Y._def?.value??Y.value}if(typeof G!=="string")throw Error("Schema method literal must be a string");if(G==="tools/call"){let Y=async(X,Q)=>{let $=b_($7,X);if(!$.success){let F=$.error instanceof Error?$.error.message:String($.error);throw new s(b0.InvalidParams,`Invalid tools/call request: ${F}`)}let{params:H}=$.data,B=await Promise.resolve(z(X,Q));if(H.task){let F=b_(y1,B);if(!F.success){let K=F.error instanceof Error?F.error.message:String(F.error);throw new s(b0.InvalidParams,`Invalid task creation result: ${K}`)}return F.data}let Z=b_(WA,B);if(!Z.success){let F=Z.error instanceof Error?Z.error.message:String(Z.error);throw new s(b0.InvalidParams,`Invalid tools/call result: ${F}`)}return Z.data};return super.setRequestHandler(_,Y)}return super.setRequestHandler(_,z)}assertCapabilityForMethod(_){switch(_){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw Error(`Client does not support sampling (required for ${_})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw Error(`Client does not support elicitation (required for ${_})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw Error(`Client does not support listing roots (required for ${_})`);break;case"ping":break}}assertNotificationCapability(_){switch(_){case"notifications/message":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${_})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw Error(`Server does not support notifying about resources (required for ${_})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw Error(`Server does not support notifying of tool list changes (required for ${_})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw Error(`Server does not support notifying of prompt list changes (required for ${_})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw Error(`Client does not support URL elicitation (required for ${_})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(_){if(!this._capabilities)return;switch(_){case"completion/complete":if(!this._capabilities.completions)throw Error(`Server does not support completions (required for ${_})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${_})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw Error(`Server does not support prompts (required for ${_})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw Error(`Server does not support resources (required for ${_})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(`Server does not support tools (required for ${_})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw Error(`Server does not support tasks capability (required for ${_})`);break;case"ping":case"initialize":break}}assertTaskCapability(_){yV(this._clientCapabilities?.tasks?.requests,_,"Client")}assertTaskHandlerCapability(_){if(!this._capabilities)return;vV(this._capabilities.tasks?.requests,_,"Server")}async _oninitialize(_){let z=_.params.protocolVersion;return this._clientCapabilities=_.params.capabilities,this._clientVersion=_.params.clientInfo,{protocolVersion:fZ.includes(z)?z:i2,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},YA)}async createMessage(_,z){if(_.tools||_.toolChoice){if(!this._clientCapabilities?.sampling?.tools)throw Error("Client does not support sampling tools capability.")}if(_.messages.length>0){let A=_.messages[_.messages.length-1],b=Array.isArray(A.content)?A.content:[A.content],G=b.some((Q)=>Q.type==="tool_result"),J=_.messages.length>1?_.messages[_.messages.length-2]:void 0,Y=J?Array.isArray(J.content)?J.content:[J.content]:[],X=Y.some((Q)=>Q.type==="tool_use");if(G){if(b.some((Q)=>Q.type!=="tool_result"))throw Error("The last message must contain only tool_result content if any is present");if(!X)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if(X){let Q=new Set(Y.filter((H)=>H.type==="tool_use").map((H)=>H.id)),$=new Set(b.filter((H)=>H.type==="tool_result").map((H)=>H.toolUseId));if(Q.size!==$.size||![...Q].every((H)=>$.has(H)))throw Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}if(_.tools)return this.request({method:"sampling/createMessage",params:_},Z7,z);return this.request({method:"sampling/createMessage",params:_},B7,z)}async elicitInput(_,z){switch(_.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw Error("Client does not support url elicitation.");let b=_;return this.request({method:"elicitation/create",params:b},VA,z)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw Error("Client does not support form elicitation.");let b=_.mode==="form"?_:{..._,mode:"form"},G=await this.request({method:"elicitation/create",params:b},VA,z);if(G.action==="accept"&&G.content&&b.requestedSchema)try{let Y=this._jsonSchemaValidator.getValidator(b.requestedSchema)(G.content);if(!Y.valid)throw new s(b0.InvalidParams,`Elicitation response content does not match requested schema: ${Y.errorMessage}`)}catch(J){if(J instanceof s)throw J;throw new s(b0.InternalError,`Error validating elicitation response: ${J instanceof Error?J.message:String(J)}`)}return G}}}createElicitationCompletionNotifier(_,z){if(!this._clientCapabilities?.elicitation?.url)throw Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:_}},z)}async listRoots(_,z){return this.request({method:"roots/list",params:_},F7,z)}async sendLoggingMessage(_,z){if(this._capabilities.logging){if(!this.isMessageIgnored(_.level,z))return this.notification({method:"notifications/message",params:_})}}async sendResourceUpdated(_){return this.notification({method:"notifications/resources/updated",params:_})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}}import fV from"node:process";class Eb{append(_){this._buffer=this._buffer?Buffer.concat([this._buffer,_]):_}readMessage(){if(!this._buffer)return null;let _=this._buffer.indexOf(`
206
+ `);if(_===-1)return null;let z=this._buffer.toString("utf8",0,_).replace(/\r$/,"");return this._buffer=this._buffer.subarray(_+1),vu(z)}clear(){this._buffer=void 0}}function vu(_){return rZ.parse(JSON.parse(_))}function gV(_){return JSON.stringify(_)+`
207
+ `}class Ob{constructor(_=fV.stdin,z=fV.stdout){this._stdin=_,this._stdout=z,this._readBuffer=new Eb,this._started=!1,this._ondata=(A)=>{this._readBuffer.append(A),this.processReadBuffer()},this._onerror=(A)=>{this.onerror?.(A)}}async start(){if(this._started)throw Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){while(!0)try{let _=this._readBuffer.readMessage();if(_===null)break;this.onmessage?.(_)}catch(_){this.onerror?.(_)}}async close(){if(this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0)this._stdin.pause();this._readBuffer.clear(),this.onclose?.()}send(_){return new Promise((z)=>{let A=gV(_);if(this._stdout.write(A))z();else this._stdout.once("drain",z)})}}var uu=mu(import.meta.url),hV=hu(uu),cu=jb(R1,"mcp.log");function D9(_){let A=`[${new Date().toISOString()}] [mcp] ${_}
208
+ `;try{fu(cu,A)}catch{}}function lu(){if(!Lb(P1))return!1;try{let _=parseInt(gu(P1,"utf-8").trim());return process.kill(_,0),!0}catch{return!1}}async function pu(){if(lu()){D9("Service already running");return}D9("Starting service...");let _=jb(hV,"../../service/server.ts"),z=jb(hV,"../../service/server.js"),A=Lb(_)?_:z;if(!Lb(A))throw D9(`Service script not found: ${A}`),Error("Service script not found");let b=yu("bun",["run",A],{detached:!0,stdio:"ignore",env:{...process.env}});b.unref(),D9(`Service spawned (PID: ${b.pid})`);let G=50;for(let J=0;J<G;J++)try{(await I_()).end(),D9("Service ready");return}catch{await new Promise((Y)=>setTimeout(Y,100))}throw Error("Service failed to start")}async function du(){let _=await I_(),z=crypto.randomUUID();return Cz(_,{type:"connect",id:z}),D9(`Connected to service with ID: ${z}`),_}async function mV(){D9("MCP server starting");let _=null;try{await pu(),_=await du()}catch(G){D9(`Failed to connect to service: ${G instanceof Error?G.message:String(G)}`)}let z=new wb({name:"agentlogs",version:"0.0.1"},{capabilities:{tools:{},prompts:{}}});z.setRequestHandler(Q7,()=>({tools:[]})),z.setRequestHandler(b7,()=>({prompts:[]}));let A=()=>{if(D9("Shutting down"),_)_.end()};process.on("SIGTERM",()=>{D9("Received SIGTERM"),A(),process.exit(0)}),process.on("SIGINT",()=>{D9("Received SIGINT"),A(),process.exit(0)});let b=new Ob;D9("MCP server connecting to transport"),await z.connect(b),D9("MCP server ready")}var o0=new db;o0.name("agentlogs").description("CLI tools for working with AgentLogs accounts and transcripts from Claude Code and Codex");o0.command("login").description("Authenticate with AgentLogs using device authorization").argument("<hostname>","AgentLogs server hostname, e.g. agentlogs.ai").action(async(_)=>{await UY({hostname:_})});o0.command("status").description("Check your current login status").action(async()=>{await NY()});o0.command("logout").description("Log out and clear stored credentials").argument("[hostname]","Optional hostname to log out from (logs out all when omitted)").action(async(_)=>{await DY({hostname:_})});o0.command("upload").argument("[directory]","Filter transcripts to this directory").option("-s, --source <source>","Filter by source: claude-code, codex, opencode, or pi").option("-l, --latest","Upload the most recent transcript without picker").description("Interactively select and upload a transcript").action(async(_,z)=>{let A=z.source;await KQ(_,{source:A,latest:z.latest})});var Rb=o0.command("claudecode").description("Claude Code transcript utilities for AgentLogs");Rb.command("upload").argument("<transcript>","Path or alias for a transcript JSONL file").description("Upload a transcript JSONL file to AgentLogs").action(async(_)=>{await EQ(_)});Rb.command("hook").description("Process Claude Code hook input from stdin").action(async()=>{await DQ()});var ru=o0.command("codex").description("Codex transcript utilities for AgentLogs");ru.command("upload").argument("<transcript>","Path or alias for a Codex transcript JSONL file").description("Upload a Codex transcript JSONL file to AgentLogs").action(async(_)=>{await OQ(_)});var uV=o0.command("opencode").description("OpenCode transcript utilities for AgentLogs");uV.command("upload").argument("<sessionId>","OpenCode session ID to upload").description("Upload an OpenCode session transcript to AgentLogs").action(async(_)=>{await LQ(_)});uV.command("hook").description("Process OpenCode hook input from stdin").action(async()=>{await jQ()});var cV=o0.command("pi").description("Pi transcript utilities for AgentLogs");cV.command("upload").argument("[sessionIdOrPath]","Pi session ID or path to session file").description("Upload a Pi session transcript to AgentLogs").action(async(_)=>{await kQ(_)});cV.command("hook").description("Process Pi hook input from stdin").action(async()=>{await IQ()});Rb.command("sync").argument("[claudeDir]","Optional Claude data directory (defaults to ~/.claude)").option("-r, --repo <repoId>","Only sync transcripts for the provided repo identifier").description("Upload all local Claude Code transcripts that are missing or outdated on the server").action(async(_,z)=>{await NQ({claudeDir:_,repoFilter:z.repo})});o0.command("settings").description("View and modify AgentLogs settings").option("--allowMode <mode>","Set allow mode: 'allowlist' or 'denylist'").action(async(_)=>{await MY({allowMode:_.allowMode})});o0.command("allow").description("Allow capture for the current repository").option("--visibility <visibility>","Set visibility: 'public', 'team', or 'private'").option("--public","Set visibility to public").option("--team","Set visibility to team").option("--private","Set visibility to private").action(async(_)=>{await XG(_)});o0.command("deny").description("Deny capture for the current repository").action(async()=>{await QG()});var A8=o0.command("service").description("Manage the agentlogs background service");A8.command("start").description("Start the background service").action(async()=>{await cQ()});A8.command("stop").description("Stop the background service").action(async()=>{await lQ()});A8.command("status").description("Show service status").action(async()=>{await pQ()});A8.command("logs").description("Tail the watcher event logs").action(async()=>{await dQ()});o0.command("mcp").description("Start MCP server (used by Codex)").action(async()=>{await mV()});o0.showHelpAfterError("(add --help for additional information)");o0.parseAsync().catch((_)=>{console.error("CLI encountered an unexpected error."),console.error(_),process.exit(1)});